From b5efdb89b096906a9cf20e04610bda7f460cbb0f Mon Sep 17 00:00:00 2001 From: Liuyi <candymxq888@outlook.com> Date: 星期六, 12 十月 2024 15:43:47 +0800 Subject: [PATCH] 添加充值记录页面,完善首页用户会员卡绑定信息,添加用户水卡注销及删除 --- pages/userInfo/index.vue | 6 package-lock.json | 27 pages/functionList/rechargeRecord/index.vue | 170 +++++++ unpackage/dist/dev/mp-weixin/pages/index/index.js | 181 +++++-- pages/functionList/paymentRecord/index.vue | 170 +++++++ pages/functionList/balanceRecord/index.vue | 191 ++++++++ unpackage/dist/dev/mp-weixin/static/images/index/icon37.png | 0 unpackage/dist/dev/mp-weixin/pages/addCard/index.js | 3 static/images/index/icon37.png | 0 pages/index/index.vue | 138 ++++- static/images/index/card11.png | 0 unpackage/dist/dev/mp-weixin/api/index.js | 16 pages.json | 10 unpackage/dist/dev/mp-weixin/pages/index/index.wxml | 2 static/images/index/icon38.png | 0 unpackage/dist/dev/mp-weixin/app.js | 5 unpackage/dist/dev/mp-weixin/config/baseUrl.js | 2 unpackage/dist/dev/mp-weixin/app.json | 5 pages/addCard/index.vue | 3 pages/recharge/index.vue | 4 unpackage/dist/cache/.vite/deps/_metadata.json | 6 /dev/null | 111 ----- unpackage/dist/dev/mp-weixin/static/images/index/icon38.png | 0 pages/station/index.vue | 198 +++++++++ unpackage/dist/dev/mp-weixin/pages/recharge/index.js | 4 api/index.js | 16 unpackage/dist/dev/mp-weixin/common/assets.js | 4 27 files changed, 1,030 insertions(+), 242 deletions(-) diff --git a/api/index.js b/api/index.js index cd3230a..babe02c 100644 --- a/api/index.js +++ b/api/index.js @@ -55,11 +55,23 @@ return request('/pay/service/wxPay',data,'POST') } //余额记录 -export function balanceChangeApi(data){ - return request('/userCapitalChange/search',data,'POST') +export function balanceChangeApi(date){ + return request(`/userCapitalChange/getListByUser?date=${date}`,{},'GET') } //消费记录 export function paymentChangeApi(date){ return request(`/paymentRecords/getListByUser?date=${date}`,{},'GET') } +//充值记录 +export function rechargeChangeApi(date){ + return request(`/rechargeRecords/getListByUser?date=${date}`,{},'GET') +} +//会员卡挂失 +export function reportLossApi(cardNumber){ + return request(`/waterCard/reportLoss?cardNumber=${cardNumber}`,{},'GET') +} +//会员卡删除 +export function removeCardApi(cardNumber){ + return request(`/waterCard/remove?cardNumber=${cardNumber}`,{},'GET') +} diff --git a/package-lock.json b/package-lock.json index 063845d..16f9f5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,12 @@ { - "name": "water-drinking-uniapp", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "water-drinking-uniapp", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@dcloudio/uni-ui": "^1.4.28" - } - }, - "node_modules/@dcloudio/uni-ui": { - "version": "1.5.6", - "resolved": "https://registry.npmmirror.com/@dcloudio/uni-ui/-/uni-ui-1.5.6.tgz", - "integrity": "sha512-jmb98PasFvZkrIDXGh94GbdWg2/jyhgs1HUG+bU8eyL7Ltias/5XBz4q8w9RXyWUfqepJRqapPA2IIQpLCuTIg==" + "name": "da-tree 树组件(支持单选、多选、无限级、主题色,Vue3版) ", + "version": "1.4.2", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "da-tree 树组件(支持单选、多选、无限级、主题色,Vue3版) ", + "version": "1.4.2" + } } - } } diff --git a/pages.json b/pages.json index 769fbd2..45fc51d 100644 --- a/pages.json +++ b/pages.json @@ -19,13 +19,19 @@ } }, { - "path" : "pages/balanceRecord/index", + "path" : "pages/functionList/balanceRecord/index", "style": { "navigationStyle":"custom" } }, { - "path" : "pages/paymentRecord/index", + "path" : "pages/functionList/paymentRecord/index", + "style": { + "navigationStyle":"custom" + } + }, + { + "path" : "pages/functionList/rechargeRecord/index", "style": { "navigationStyle":"custom" } diff --git a/pages/addCard/index.vue b/pages/addCard/index.vue index d6d6f97..9006518 100644 --- a/pages/addCard/index.vue +++ b/pages/addCard/index.vue @@ -3,7 +3,8 @@ import{ creatUserArchive } from '../../api/index.js' const form = ref({ - waterCardNumber:'', + id:JSON.parse(uni.getStorageSync('userInfo')).id, + waterCardNumber:'023B7C45', userName:'', userPhone:'', remark:'', diff --git a/pages/balanceRecord/index.vue b/pages/balanceRecord/index.vue deleted file mode 100644 index 881dd1a..0000000 --- a/pages/balanceRecord/index.vue +++ /dev/null @@ -1,136 +0,0 @@ -<script setup> - import { ref } from 'vue' - import { balanceChangeApi } from '../../api/index.js' - //返回 - function navBackTo(){ - uni.navigateBack() - } - async function getBalanceList(){ - await balanceChangeApi().then((res) =>{ - if(res.code == 200){ - // banlanceList.value = res.data.list - } - }) - } - const banlanceList = ref([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]) -</script> -<template> - <view class="container"> - <navbar @navBackTo="navBackTo()" title="余额记录"></navbar> - <view class="date"> - <view> - <text>2024年09月</text> - </view> - <view> - <text>支出¥5341.05</text> - <text>充值¥941.59</text> - </view> - </view> - <view class="main"> - <block v-for="(item,index) in banlanceList"> - <view class="item"> - <view class="item-left"> - <text>缴费</text> - <text class="methods">支付方式:微信</text> - <text>2024年09月20日 18:25</text> - </view> - <view class="item-right"> - <text>-¥125.00</text> - <text>2000.00</text> - </view> - </view> - </block> - </view> - </view> -</template> - -<style lang="scss"> - .container{ - width: 100%; - height: 100vh; - background:linear-gradient(to top,#FFFFFF,#E8EFFF); - .date{ - height: 84rpx; - width:100%; - display: flex; - padding: 0 36rpx; - box-sizing: border-box; - justify-content:space-between; - align-items: center; - view:first-child{ - font-weight: 300; - font-size: 32rpx; - color: #000000; - } - view:last-child{ - font-weight: 300; - font-size: 24rpx; - color: #7E7E7E; - text:first-child{ - margin-right:30rpx; - } - } - } - .main{ - width:99%; - height: calc(100vh - 84rpx - 176rpx - 70rpx); - background: #fff; - border-radius:20rpx; - margin: 0 auto; - padding:28rpx 48rpx; - box-sizing: border-box; - overflow-y: scroll; - // background: #7E7E7E; - .item{ - width:100%; - height:184rpx; - // background:rgba(170, 216, 255, 0.2); - border-bottom:1rpx solid #D8D8D8; - box-sizing:border-box; - padding-bottom:38rpx; - justify-content:space-between; - align-items: flex-end; - display: flex; - .item-left{ - height:100%; - display:flex; - flex-direction:column; - justify-content:space-between; - align-items: flex-start; - text:first-child{ - font-weight: 300; - font-size: 32rpx; - color: #000000; - } - .methods{ - font-weight: 300; - font-size: 32rpx; - color: #474646; - } - text:last-child{ - font-weight: 300; - font-size: 24rpx; - color: #A7A7A7; - } - } - .item-right{ - height:100%; - display:flex; - flex-direction:column; - justify-content:flex-end; - align-items: flex-end; - text:first-child{ - font-weight: 300; - font-size: 32rpx; - color: #000000; - } - text:last-child{ - font-weight: 300; - font-size: 24rpx; - color: #A7A7A7; - } - } - } - } - } -</style> diff --git a/pages/functionList/balanceRecord/index.vue b/pages/functionList/balanceRecord/index.vue new file mode 100644 index 0000000..2c24692 --- /dev/null +++ b/pages/functionList/balanceRecord/index.vue @@ -0,0 +1,191 @@ +<script setup> + import { computed, onMounted, ref } from 'vue' + import { balanceChangeApi } from '../../../api/index.js' + //返回 + function navBackTo(){ + uni.navigateBack() + } + //日期 + const endDate = ref() + const startDate = ref() + const datePay = ref() + const dateNow = ref() + //获取当前日期 + function getDate() { + const date = new Date(); + let year = date.getFullYear(); + let month = date.getMonth() + 1; + dateNow.value = year + '-' + month + datePay.value = dateNow.value + } + //选中日期 + async function bindDateChange(e){ + datePay.value = e.detail.value + await getBalanceList(datePay.value) + } + + //获取余额变动列表 + const banlanceList = ref([]) + async function getBalanceList(val){ + await balanceChangeApi(val).then((res) =>{ + if(res.code == 200){ + banlanceList.value = res.data + } + }) + } + //动态设置用户支出收入对应样式 + function setStyleMoney(val){ + if(val == 200){ + return { color:'#ebc117'} + }else{ + return { color:'#00aa00'} + } + } + onMounted(async() =>{ + getDate() + await getBalanceList(datePay.value) + }) +</script> +<template> + <view class="container"> + <navbar @navBackTo="navBackTo()" title="余额记录"></navbar> + <view class="date"> + <view class="picker"> + <picker mode="date" :value="datePay" :fields="'month'" @change="bindDateChange"> + <view class="date-text"> + <text class="uni-input">{{datePay}}</text> + <image src="../../../static/images/other/more.png" alt=''></image> + </view> + </picker> + </view> + <view class="date-money"> + <text>支出¥5341.05</text> + <text>充值¥941.59</text> + </view> + </view> + <view class="main"> + <block v-for="(item,index) in banlanceList"> + <view class="item"> + <view class="item-left"> + <text class="methods">{{item.businessName}}</text> + <text>{{item.createTimeView}}</text> + </view> + <view class="item-right"> + <view> + <text v-if="item.business == 200" style="color:#ebc117">-</text> + <text class="money" :style="setStyleMoney(item.business)">{{item.changeMoney}}</text> + <text>元</text> + </view> + <text>{{item.beforeMoney}}</text> + </view> + </view> + </block> + </view> + </view> +</template> + +<style lang="scss"> + .container{ + width: 100%; + height: 100vh; + background:linear-gradient(to top,#FFFFFF,#E8EFFF); + .date{ + height: 84rpx; + width:100%; + display: flex; + padding: 0 36rpx; + box-sizing: border-box; + justify-content:space-between; + align-items: center; + .picker{ + .date-text{ + height: 84rpx; + display: flex; + align-items: center; + text{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + margin-right:10rpx; + } + image{ + width: 28rpx; + height:32rpx; + transform: rotate(90deg); + // margin-top:10rpx; + } + } + } + .date-money{ + font-weight: 300; + font-size: 24rpx; + color: #7E7E7E; + text:first-child{ + margin-right:30rpx; + } + } + } + .main{ + width:99%; + height: calc(100vh - 84rpx - 176rpx - 70rpx); + background: #fff; + border-radius:20rpx; + margin: 0 auto; + padding:28rpx 48rpx; + box-sizing: border-box; + overflow-y: scroll; + // background: #7E7E7E; + .item{ + width:100%; + height:160rpx; + // background:rgba(170, 216, 255, 0.2); + border-bottom:1rpx solid #D8D8D8; + box-sizing:border-box; + // padding-bottom:38rpx; + justify-content:space-between; + align-items: flex-end; + display: flex; + .item-left{ + height:100%; + display:flex; + flex-direction:column; + justify-content:space-around; + align-items: flex-start; + text:first-child{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + } + .methods{ + font-weight: 300; + font-size: 32rpx; + color: #474646; + } + text:last-child{ + font-weight: 300; + font-size: 24rpx; + color: #A7A7A7; + } + } + .item-right{ + height:100%; + display:flex; + flex-direction:column; + justify-content:space-around; + align-items:flex-end; + text{ + font-weight: 300; + font-size: 24rpx; + color: #474646; + margin-left:5rpx; + } + .money{ + font-weight: 500; + font-size: 32rpx; + color: #0d83bb; + } + } + } + } + } +</style> diff --git a/pages/functionList/paymentRecord/index.vue b/pages/functionList/paymentRecord/index.vue new file mode 100644 index 0000000..6b413b1 --- /dev/null +++ b/pages/functionList/paymentRecord/index.vue @@ -0,0 +1,170 @@ +<script setup> + import { onMounted, ref } from 'vue' + import { paymentChangeApi } from '../../../api/index.js' + //返回 + function navBackTo(){ + uni.navigateBack() + } + //日期 + const endDate = ref() + const startDate = ref() + const datePay = ref() + const dateNow = ref() + //获取当前日期 + function getDate() { + const date = new Date(); + let year = date.getFullYear(); + let month = date.getMonth() + 1; + dateNow.value = year + '-' + month + datePay.value = dateNow.value + console.log('datePay',datePay.value) + // return `${year} + '-' + ${month}` + } + //选中日期 + async function bindDateChange(e){ + datePay.value = e.detail.value + await getBalanceList(datePay.value) + console.log('e',e) + } + + //获取消费变动列表 + const banlanceList = ref([]) + async function getBalanceList(val){ + await paymentChangeApi(val).then((res) =>{ + if(res.code == 200){ + banlanceList.value = res.data + } + }) + } + onMounted(async() =>{ + getDate() + await getBalanceList(datePay.value) + }) +</script> +<template> + <view class="container"> + <navbar @navBackTo="navBackTo()" title="消费记录"></navbar> + <view class="date"> + <view class="picker"> + <picker mode="date" :value="datePay" :fields="'month'" @change="bindDateChange"> + <view class="date-text"> + <text class="uni-input">{{datePay}}</text> + <image src="../../../static/images/other/more.png" alt=''></image> + </view> + </picker> + </view> + </view> + <view class="main"> + <block v-for="(item,index) in banlanceList"> + <view class="item"> + <view class="item-left"> + <text>购水</text> + <text class="methods">消费方式:{{item.consumptionTypeView}}</text> + <text>{{item.payTime}}</text> + </view> + <view class="item-right"> + <text class="money">{{item.paymentAmount}}</text> + <text>元</text> + </view> + </view> + </block> + </view> + </view> +</template> + +<style lang="scss"> + .container{ + width: 100%; + height: 100vh; + background:linear-gradient(to top,#FFFFFF,#E8EFFF); + .date{ + height: 84rpx; + width:100%; + display: flex; + padding: 0 36rpx; + box-sizing: border-box; + justify-content:flex-start; + align-items: center; + .picker{ + .date-text{ + height: 84rpx; + display: flex; + align-items: center; + text{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + margin-right:10rpx; + } + image{ + width: 28rpx; + height:32rpx; + transform: rotate(90deg); + // margin-top:10rpx; + } + } + } + } + .main{ + width:99%; + height: calc(100vh - 84rpx - 176rpx - 70rpx); + background: #fff; + border-radius:20rpx; + margin: 0 auto; + padding:28rpx 48rpx; + box-sizing: border-box; + overflow-y: scroll; + // background: #7E7E7E; + .item{ + width:100%; + height:184rpx; + // background:rgba(170, 216, 255, 0.2); + border-bottom:1rpx solid #D8D8D8; + box-sizing:border-box; + padding-bottom:38rpx; + justify-content:space-between; + align-items: flex-end; + display: flex; + .item-left{ + height:100%; + display:flex; + flex-direction:column; + justify-content:space-between; + align-items: flex-start; + text:first-child{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + } + .methods{ + font-weight: 300; + font-size: 32rpx; + color: #474646; + } + text:last-child{ + font-weight: 300; + font-size: 24rpx; + color: #A7A7A7; + } + } + .item-right{ + height:100%; + display:flex; + justify-content:flex-end; + align-items:flex-end; + text{ + font-weight: 300; + font-size: 24rpx; + color: #474646; + margin-left:5rpx; + } + .money{ + font-weight: 500; + font-size: 32rpx; + color: #0d83bb; + } + } + } + } + } +</style> diff --git a/pages/functionList/rechargeRecord/index.vue b/pages/functionList/rechargeRecord/index.vue new file mode 100644 index 0000000..0f20179 --- /dev/null +++ b/pages/functionList/rechargeRecord/index.vue @@ -0,0 +1,170 @@ +<script setup> + import { onMounted, ref } from 'vue' + import { rechargeChangeApi } from '../../../api/index.js' + //返回 + function navBackTo(){ + uni.navigateBack() + } + //日期 + const endDate = ref() + const startDate = ref() + const datePay = ref() + const dateNow = ref() + //获取当前日期 + function getDate() { + const date = new Date(); + let year = date.getFullYear(); + let month = date.getMonth() + 1; + dateNow.value = year + '-' + month + datePay.value = dateNow.value + console.log('datePay',datePay.value) + // return `${year} + '-' + ${month}` + } + //选中日期 + async function bindDateChange(e){ + datePay.value = e.detail.value + await getBalanceList(datePay.value) + console.log('e',e) + } + + //获取消费变动列表 + const banlanceList = ref([]) + async function getBalanceList(val){ + await rechargeChangeApi(val).then((res) =>{ + if(res.code == 200){ + banlanceList.value = res.data + } + }) + } + onMounted(async() =>{ + getDate() + await getBalanceList(datePay.value) + }) +</script> +<template> + <view class="container"> + <navbar @navBackTo="navBackTo()" title="充值记录"></navbar> + <view class="date"> + <view class="picker"> + <picker mode="date" :value="datePay" :fields="'month'" @change="bindDateChange"> + <view class="date-text"> + <text class="uni-input">{{datePay}}</text> + <image src="../../../static/images/other/more.png" alt=''></image> + </view> + </picker> + </view> + </view> + <view class="main"> + <block v-for="(item,index) in banlanceList"> + <view class="item"> + <view class="item-left"> + <text>购水</text> + <text class="methods">消费方式:{{item.consumptionTypeView}}</text> + <text>{{item.payTime}}</text> + </view> + <view class="item-right"> + <text class="money">{{item.paymentAmount}}</text> + <text>元</text> + </view> + </view> + </block> + </view> + </view> +</template> + +<style lang="scss"> + .container{ + width: 100%; + height: 100vh; + background:linear-gradient(to top,#FFFFFF,#E8EFFF); + .date{ + height: 84rpx; + width:100%; + display: flex; + padding: 0 36rpx; + box-sizing: border-box; + justify-content:flex-start; + align-items: center; + .picker{ + .date-text{ + height: 84rpx; + display: flex; + align-items: center; + text{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + margin-right:10rpx; + } + image{ + width: 28rpx; + height:32rpx; + transform: rotate(90deg); + // margin-top:10rpx; + } + } + } + } + .main{ + width:99%; + height: calc(100vh - 84rpx - 176rpx - 70rpx); + background: #fff; + border-radius:20rpx; + margin: 0 auto; + padding:28rpx 48rpx; + box-sizing: border-box; + overflow-y: scroll; + // background: #7E7E7E; + .item{ + width:100%; + height:184rpx; + // background:rgba(170, 216, 255, 0.2); + border-bottom:1rpx solid #D8D8D8; + box-sizing:border-box; + padding-bottom:38rpx; + justify-content:space-between; + align-items: flex-end; + display: flex; + .item-left{ + height:100%; + display:flex; + flex-direction:column; + justify-content:space-between; + align-items: flex-start; + text:first-child{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + } + .methods{ + font-weight: 300; + font-size: 32rpx; + color: #474646; + } + text:last-child{ + font-weight: 300; + font-size: 24rpx; + color: #A7A7A7; + } + } + .item-right{ + height:100%; + display:flex; + justify-content:flex-end; + align-items:flex-end; + text{ + font-weight: 300; + font-size: 24rpx; + color: #474646; + margin-left:5rpx; + } + .money{ + font-weight: 500; + font-size: 32rpx; + color: #0d83bb; + } + } + } + } + } +</style> diff --git a/pages/index/index.vue b/pages/index/index.vue index b9649d4..efcc82e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,6 +1,6 @@ <script setup> import { onMounted, ref } from "vue"; - import { getVipInfoApi,getUserInfo } from '../../api/index.js' + import { getVipInfoApi,getUserInfo,reportLossApi,removeCardApi } from '../../api/index.js' import { onShow } from '@dcloudio/uni-app' //状态栏高度 const topHeight = ref(0) @@ -15,38 +15,46 @@ */ const cardInfo = ref({ id:'', - userName:'', + userName:'微信用户', headImg:'', + userPhone:'', waterCardNumber:'', balance:'', count:'', - userPhone:'', }) const isVip = ref(false) //获取会员卡信息 - async function getInfo(){ - let res = await getUserInfo() - if(res.code == 200){ - console.log('res',res.data) - cardInfo.value.userName = res.data.userInfo.userName - cardInfo.value.headImg = res.data.userInfo.headImg - cardInfo.value.userPhone = res.data.userInfo.userPhone - cardInfo.value.id = res.data.userInfo.id - if(res.data.userInfo.waterCardNumber){ - let res1 = await getVipInfoApi() - cardInfo.value.waterCardNumber = res1.data.cardNumber - if(res1.data.cardType == 1){ - cardInfo.value.balance = res1.data.balance - }else if(res1.data.cardType == 2){ - cardInfo.value.count = res1.data.count + async function getVipInfo(){ + await getVipInfoApi().then((res) =>{ + if(res.code == 200){ + cardInfo.value.waterCardNumber = res.data.cardNumber + if(res.data.cardType == 1){ + cardInfo.value.balance = res.data.balance + }else if(res.data.cardType == 2){ + cardInfo.value.count = res.data.count } isVip.value = true - }else{ - isVip.value = false } - uni.setStorageSync('userInfo',JSON.stringify(cardInfo.value)) - } + }) + } + //获取用户信息 + async function getInfo(){ + await getUserInfo().then(async(res) =>{ + if(res.code == 200){ + cardInfo.value.userName = res.data.userInfo.userName ? res.data.userInfo.userName : cardInfo.value.userName + cardInfo.value.headImg = res.data.userInfo.headImg + cardInfo.value.userPhone = res.data.userInfo.userPhone + cardInfo.value.id = res.data.userInfo.id + + if(res.data.userInfo.waterCardNumber){ + await getVipInfo() + }else{ + isVip.value = false + } + uni.setStorageSync('userInfo',JSON.stringify(cardInfo.value)) + } + }) } /** * 扫码取水相关 @@ -67,19 +75,74 @@ * 功能列表相关 */ const functionList = ref([ - {text:'余额记录',icon:'../../static/images/index/icon31.png',url:'/pages/balanceRecord/index'}, - {text:'消费记录',icon:'../../static/images/index/icon32.png',url:'/pages/paymentRecord/index'}, - {text:'充值记录',icon:'../../static/images/index/icon33.png',url:''}, - {text:'账户共享',icon:'../../static/images/index/icon34.png',url:''}, - {text:'优惠卷',icon:'../../static/images/index/icon35.png',url:''}, - {text:'电子发票',icon:'../../static/images/index/icon36.png',url:''}, - {text:'联系客服',icon:'../../static/images/index/icon37.png',url:''}, - {text:'推广分佣',icon:'../../static/images/index/icon38.png',url:''}, + {text:'余额记录',icon:'../../static/images/index/icon31.png',url:'/pages/functionList/balanceRecord/index',isUrl:1}, + {text:'消费记录',icon:'../../static/images/index/icon32.png',url:'/pages/functionList/paymentRecord/index',isUrl:1}, + {text:'充值记录',icon:'../../static/images/index/icon33.png',url:'/pages/functionList/rechargeRecord/index',isUrl:1}, + {text:'账户共享',icon:'../../static/images/index/icon34.png',url:'',isUrl:1}, + {text:'优惠卷',icon:'../../static/images/index/icon35.png',url:'',isUrl:1}, + {text:'电子发票',icon:'../../static/images/index/icon36.png',url:'',isUrl:1}, + {text:'会员卡挂失',icon:'../../static/images/index/icon37.png',url:'',isUrl:2}, + {text:'会员卡注销',icon:'../../static/images/index/icon38.png',url:'',isUrl:3}, ]) function navTo(itemUrl){ if(itemUrl){ uni.navigateTo({ url:itemUrl + }) + } + } + //功能列表点击功能 + async function setEvent(isUrl,url){ + if(isUrl == 1){ + navTo(url) + }else if(isUrl == 2){ + uni.showModal({ + title: '会员卡挂失', + content: '确认挂失会员卡?', + success: async function(res) { + if (res.confirm) { + await reportLossApi(cardInfo.value.waterCardNumber).then((res) =>{ + if(res.code == 200){ + uni.showToast({ + title: '已挂失', + duration: 2000, + }); + } + }) + }else{ + console.log('点击了取消7') + } + } + }) + }else if(isUrl == 3){ + uni.showModal({ + title: '会员卡注销', + content: '确认注销会员卡?', + success: async function(res) { + if (res.confirm) { + await removeCardApi(cardInfo.value.waterCardNumber).then(async(res) =>{ + if(res.code == 200){ + uni.showToast({ + title: '已注销', + duration: 2000, + }); + await getVipInfo().then((res) =>{ + if(res.code == 200){ + if(!res.data.id){ + isVip.value = false + cardInfo.value.balance = '' + cardInfo.value.count = '' + cardInfo.value.waterCardNumber = '' + uni.setStorageSync('userInfo',JSON.stringify(cardInfo.value)) + } + } + }) + } + }) + }else{ + console.log('点击了取消8') + } + } }) } } @@ -110,12 +173,12 @@ <view class="card-left"> <view class="left-top"> <view> - <image src="../../static/images/index/code1.png" alt=""></image> + <image v-if="isVip" src="../../static/images/index/code1.png" alt=""></image> <text>会员卡</text> </view> - <view>ID:{{cardInfo.waterCardNumber}}</view> + <view v-if="isVip">ID:{{cardInfo.waterCardNumber}}</view> </view> - <view class="left-bottom">电话:{{cardInfo.userPhone}}</view> + <!-- <view v-if="cardInfo.userPhone" class="left-bottom">电话:{{cardInfo.userPhone}}</view> --> </view> <view class="card-right"> <view class="card-right-top"> @@ -123,10 +186,11 @@ <image src='../../static/images/index/vip-add.png' alt=''></image> <text>添加会员卡</text> </view> --> - <text>金额卡</text> - <text>{{cardInfo.balance}}元</text> + <text v-if="isVip">金额卡</text> + <text v-if="!isVip">未绑定会员卡</text> + <text v-if="isVip">{{cardInfo.balance}}元</text> </view> - <view class="card-right-bottom" @click="navTo('/pages/recharge/index')">充值</view> + <view v-if="isVip" class="card-right-bottom" @click="navTo('/pages/recharge/index')">充值</view> </view> </view> </view> @@ -157,7 +221,7 @@ <view class="box2-title"><text>功能列表</text></view> <view class="box2-content"> <block v-for="(item,index) in functionList" :key="index"> - <view class="box2-item" @click="navTo(item.url)"> + <view class="box2-item" @click="setEvent(item.isUrl,item.url)"> <image :src= "item.icon" alt=""></image> <view class="box2-item-text">{{item.text}}</view> </view> diff --git a/pages/recharge/index.vue b/pages/recharge/index.vue index ebffff7..5d64e33 100644 --- a/pages/recharge/index.vue +++ b/pages/recharge/index.vue @@ -2,7 +2,7 @@ import{ ref ,onMounted} from 'vue' import { wxPayApi } from '../../api/index.js' - const choosedMoney = ref() + const choosedMoney = ref(50) const disabled = ref(true) //选择金额 const moneyList = ref([ @@ -56,7 +56,7 @@ if(disabled.value){ money = choosedMoney.value }else{ - money = otherMoney.value + money = Number(otherMoney.value) } await wxPayApi({businessType:1,tradeAmount:money}).then((res) =>{ console.log('reswxpay',res) diff --git a/pages/station/index.vue b/pages/station/index.vue new file mode 100644 index 0000000..cbe1f70 --- /dev/null +++ b/pages/station/index.vue @@ -0,0 +1,198 @@ +<template> + <view class="container"> + <navbar title = '站点列表'></navbar> + <view class="content"> + <view class="nav"> + <view class="nav-title"> + <view @click="switchTo(1)" class="title-text" :style="isNav === 1 ? isActive : {}">送水点</view> + <view @click="switchTo(2)" class="title-text" :style="isNav === 2 ? isActive : {}">设备点</view> + </view> + </view> + <view v-if="isNav === 1" class="main"> + <block v-for="(item,index) in sendWaterSiteList" :key='index'> + <view class="item"> + <view class="item-img"> + <image src="../../static/logo.png" alt=''></image> + </view> + <view class="item-info"> + <view class="info-name">{{item.name}}</view> + <view class="info-addr" @click="openMap(item.latitude,item.longitude)"> + <text class="addr-text">地址:{{item.address}}</text> + <view> + <image src="../../static/images/index/icon22.png" alt=''></image> + <text>{{item.distanceValue}}km</text> + </view> + </view> + </view> + </view> + </block> + </view> + + <view v-if="isNav === 2" class="main"> + <block v-for="(item,index) in facilitySiteList" :key='index'> + <view class="item"> + <view class="item-img"> + <image src="../../static/logo.png" alt=''></image> + </view> + <view class="item-info"> + <view class="info-name">{{item.name}}</view> + <view class="info-addr"> + <text class="addr-text">地址:{{item.address}}</text> + <view @click="openMap(item.latitude,item.longitude)"> + <image src="../../static/images/index/icon22.png" alt=''></image> + <text>{{item.distanceValue}}km</text> + </view> + </view> + </view> + </view> + </block> + </view> + </view> + </view> +</template> + +<script setup> + import { onMounted, ref } from 'vue' + import { siteApi } from '../../api/index.js' + const isNav = ref(2)//1:送水点;2:设备点 + const isActive = ref({borderBottom:`3px solid #226AC9`}) + const userLocation = ref() + const sendWaterSiteList = ref([]) + const facilitySiteList = ref([]) + + //导航切换 + function switchTo(val){ + if((val === 1 && isNav.value === 1) || (val === 2 && isNav.value === 2)){ + }else{ + if(val === 1){ + isNav.value = 1 + }else if(val === 2){ + isNav.value = 2 + } + } + } + //获取送水点及饮水设备点列表 + async function getSiteList(){ + let param1 = { + type:1, + latitude: userLocation.value.lat, + longitude:userLocation.value.lon, + } + let param2 = {...param1} + param2.type = 2 + await siteApi(param1).then((res) =>{ + sendWaterSiteList.value = res.data + }) + await siteApi(param2).then((res1) =>{ + facilitySiteList.value = res1.data + }) + } + //打开地图导航 + function openMap(lat,lon){ + uni.openLocation({ + latitude: parseFloat(lat), + longitude: parseFloat(lon), + scale:18 + }) + } + onMounted(async() =>{ + userLocation.value = JSON.parse(uni.getStorageSync('userLocation')) + await getSiteList() + }) +</script> + +<style lang="scss"> +.container{ + width: 100%; + height: 100vh; + .content{ + width: 100%; + height:calc(100vh - 176rpx); + background:linear-gradient(to top,#FFFFFF,#E8EFFF); + padding:32rpx 0 100rpx; + box-sizing: border-box; + .nav{ + height: 100rpx; + width:100%; + box-sizing: border-box; + margin-bottom:32rpx; + background-color: #FFF; + .nav-title{ + width: 100%; + box-sizing: border-box; + padding: 0 160rpx; + height: 100rpx; + display: flex; + justify-content: space-between; + align-items: center; + .title-text{ + font-weight: 300; + font-size: 32rpx; + color: #000000; + width:120rpx; + height:65rpx; + text-align: center; + line-height:65rpx; + } + } + } + .main{ + height:calc(100vh - 176rpx - 350rpx); + width:100%; + // background-color: #e4f8ff; + padding:0 32rpx; + box-sizing: border-box; + .item{ + height:200rpx; + width:100%; + background-color: #FFFFFF; + border-radius: 24rpx; + padding:0 20rpx; + margin-bottom:20rpx; + box-sizing: border-box; + display: flex; + align-items:center; + .item-img{ + image{ + width:130rpx; + height: 130rpx; + } + } + .item-info{ + display: flex; + flex-direction: column; + margin-left:20rpx; + justify-content: space-between; + .info-name{ + color:#222c35; + } + .info-addr{ + display: flex; + justify-content: space-between; + align-items:center; + .addr-text{ + width:340rpx; + height:80rpx; + color: #6a6e75; + font-size:26rpx; + } + view{ + display: flex; + justify-content: space-between; + align-items:center; + image{ + width:50rpx; + height:50rpx; + } + text{ + color: #6a6e75; + font-size:26rpx; + } + } + } + } + } + } + } +} +</style> diff --git a/pages/userInfo/index.vue b/pages/userInfo/index.vue index 7dce482..f7d58b8 100644 --- a/pages/userInfo/index.vue +++ b/pages/userInfo/index.vue @@ -60,13 +60,15 @@ <view class="info-list"> <view class="item"> <text>会员卡号</text> - <text>{{userInfo.waterCardNumber}}</text> + <text v-if="userInfo.waterCardNumber">{{userInfo.waterCardNumber}}</text> + <text v-else>未绑定会员卡</text> </view> <view class="item"> <text>联系方式</text> <view> <input v-if="isEdit" v-model="editForm.userPhone" placeholder="请输入新联系方式"/> - <text v-else>{{userInfo.userPhone}}</text> + <text v-if="userInfo.userPhone">{{userInfo.userPhone}}</text> + <text v-if="!userInfo.userPhone">未添加联系方式</text> <!-- <image class="edit"src="../../static/images//other/more.png" alt=''></image> --> </view> </view> diff --git a/static/images/index/card11.png b/static/images/index/card11.png new file mode 100644 index 0000000..097b45d --- /dev/null +++ b/static/images/index/card11.png Binary files differ diff --git a/static/images/index/icon37.png b/static/images/index/icon37.png index bfcf59a..c8fa025 100644 --- a/static/images/index/icon37.png +++ b/static/images/index/icon37.png Binary files differ diff --git a/static/images/index/icon38.png b/static/images/index/icon38.png index 51b3c66..1d19344 100644 --- a/static/images/index/icon38.png +++ b/static/images/index/icon38.png Binary files differ diff --git a/unpackage/dist/cache/.vite/deps/_metadata.json b/unpackage/dist/cache/.vite/deps/_metadata.json index f17be66..74eb13c 100644 --- a/unpackage/dist/cache/.vite/deps/_metadata.json +++ b/unpackage/dist/cache/.vite/deps/_metadata.json @@ -1,8 +1,8 @@ { - "hash": "01069312", + "hash": "675162bf", "configHash": "14deb472", - "lockfileHash": "8eeba737", - "browserHash": "7ec93261", + "lockfileHash": "8b439a23", + "browserHash": "8f4b50d7", "optimized": {}, "chunks": {} } \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/api/index.js b/unpackage/dist/dev/mp-weixin/api/index.js index 16005e1..0fafc6e 100644 --- a/unpackage/dist/dev/mp-weixin/api/index.js +++ b/unpackage/dist/dev/mp-weixin/api/index.js @@ -42,9 +42,22 @@ function wxPayApi(data) { return util_request.request("/pay/service/wxPay", data, "POST"); } +function balanceChangeApi(date) { + return util_request.request(`/userCapitalChange/getListByUser?date=${date}`, {}, "GET"); +} function paymentChangeApi(date) { return util_request.request(`/paymentRecords/getListByUser?date=${date}`, {}, "GET"); } +function rechargeChangeApi(date) { + return util_request.request(`/rechargeRecords/getListByUser?date=${date}`, {}, "GET"); +} +function reportLossApi(cardNumber) { + return util_request.request(`/waterCard/reportLoss?cardNumber=${cardNumber}`, {}, "GET"); +} +function removeCardApi(cardNumber) { + return util_request.request(`/waterCard/remove?cardNumber=${cardNumber}`, {}, "GET"); +} +exports.balanceChangeApi = balanceChangeApi; exports.creatUserArchive = creatUserArchive; exports.deleteAddressApi = deleteAddressApi; exports.editAddressApi = editAddressApi; @@ -54,6 +67,9 @@ exports.getUserInfo = getUserInfo; exports.getVipInfoApi = getVipInfoApi; exports.paymentChangeApi = paymentChangeApi; +exports.rechargeChangeApi = rechargeChangeApi; +exports.removeCardApi = removeCardApi; +exports.reportLossApi = reportLossApi; exports.searchAddress = searchAddress; exports.searchFacilityApi = searchFacilityApi; exports.setAddressDefaultApi = setAddressDefaultApi; diff --git a/unpackage/dist/dev/mp-weixin/app.js b/unpackage/dist/dev/mp-weixin/app.js index c99035d..226ae33 100644 --- a/unpackage/dist/dev/mp-weixin/app.js +++ b/unpackage/dist/dev/mp-weixin/app.js @@ -6,8 +6,9 @@ "./pages/index/index.js"; "./pages/addCard/index.js"; "./pages/userInfo/index.js"; - "./pages/balanceRecord/index.js"; - "./pages/paymentRecord/index.js"; + "./pages/functionList/balanceRecord/index.js"; + "./pages/functionList/paymentRecord/index.js"; + "./pages/functionList/rechargeRecord/index.js"; "./pages/scanWater/index.js"; "./pages/recharge/index.js"; "./pages/sendWater/index.js"; diff --git a/unpackage/dist/dev/mp-weixin/app.json b/unpackage/dist/dev/mp-weixin/app.json index b2dcc0b..0c3d818 100644 --- a/unpackage/dist/dev/mp-weixin/app.json +++ b/unpackage/dist/dev/mp-weixin/app.json @@ -3,8 +3,9 @@ "pages/index/index", "pages/addCard/index", "pages/userInfo/index", - "pages/balanceRecord/index", - "pages/paymentRecord/index", + "pages/functionList/balanceRecord/index", + "pages/functionList/paymentRecord/index", + "pages/functionList/rechargeRecord/index", "pages/scanWater/index", "pages/recharge/index", "pages/sendWater/index", diff --git a/unpackage/dist/dev/mp-weixin/common/assets.js b/unpackage/dist/dev/mp-weixin/common/assets.js index c76d5a5..bbbf469 100644 --- a/unpackage/dist/dev/mp-weixin/common/assets.js +++ b/unpackage/dist/dev/mp-weixin/common/assets.js @@ -27,8 +27,8 @@ exports._imports_0$5 = _imports_0$3; exports._imports_0$6 = _imports_0$2; exports._imports_0$7 = _imports_0$1; -exports._imports_1 = _imports_1$2; -exports._imports_1$1 = _imports_1$1; +exports._imports_1 = _imports_1$1; +exports._imports_1$1 = _imports_1$2; exports._imports_1$2 = _imports_1; exports._imports_10 = _imports_10; exports._imports_11 = _imports_11; diff --git a/unpackage/dist/dev/mp-weixin/config/baseUrl.js b/unpackage/dist/dev/mp-weixin/config/baseUrl.js index 0701120..4c47d63 100644 --- a/unpackage/dist/dev/mp-weixin/config/baseUrl.js +++ b/unpackage/dist/dev/mp-weixin/config/baseUrl.js @@ -1,3 +1,3 @@ "use strict"; -const BASE_URL = "http://113.250.189.120:8031"; +const BASE_URL = "http://192.168.0.105:8031"; exports.BASE_URL = BASE_URL; diff --git a/unpackage/dist/dev/mp-weixin/pages/addCard/index.js b/unpackage/dist/dev/mp-weixin/pages/addCard/index.js index 350a886..82220fa 100644 --- a/unpackage/dist/dev/mp-weixin/pages/addCard/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/addCard/index.js @@ -14,7 +14,8 @@ __name: "index", setup(__props) { const form = common_vendor.ref({ - waterCardNumber: "", + id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id, + waterCardNumber: "023B7C45", userName: "", userPhone: "", remark: "" diff --git a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.js b/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.js deleted file mode 100644 index 0021cae..0000000 --- a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -const common_vendor = require("../../common/vendor.js"); -if (!Array) { - const _easycom_navbar2 = common_vendor.resolveComponent("navbar"); - _easycom_navbar2(); -} -const _easycom_navbar = () => "../../components/navbar/navbar.js"; -if (!Math) { - _easycom_navbar(); -} -const _sfc_main = { - __name: "index", - setup(__props) { - function navBackTo() { - common_vendor.index.navigateBack(); - } - const banlanceList = common_vendor.ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); - return (_ctx, _cache) => { - return { - a: common_vendor.o(($event) => navBackTo()), - b: common_vendor.p({ - title: "余额记录" - }), - c: common_vendor.f(banlanceList.value, (item, index, i0) => { - return {}; - }) - }; - }; - } -}; -wx.createPage(_sfc_main); diff --git a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.json b/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.json deleted file mode 100644 index ff63ccc..0000000 --- a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "navigationStyle": "custom", - "usingComponents": { - "navbar": "../../components/navbar/navbar" - } -} \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.wxml b/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.wxml deleted file mode 100644 index 274622c..0000000 --- a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.wxml +++ /dev/null @@ -1 +0,0 @@ -<view class="container"><navbar wx:if="{{b}}" bindnavBackTo="{{a}}" u-i="434b3e96-0" bind:__l="__l" u-p="{{b}}"></navbar><view class="date"><view><text>2024年09月</text></view><view><text>支出¥5341.05</text><text>充值¥941.59</text></view></view><view class="main"><block wx:for="{{c}}" wx:for-item="item"><view class="item"><view class="item-left"><text>缴费</text><text class="methods">支付方式:微信</text><text>2024年09月20日 18:25</text></view><view class="item-right"><text>-¥125.00</text><text>2000.00</text></view></view></block></view></view> \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.wxss b/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.wxss deleted file mode 100644 index 48fdf86..0000000 --- a/unpackage/dist/dev/mp-weixin/pages/balanceRecord/index.wxss +++ /dev/null @@ -1,111 +0,0 @@ -/** - * 这里是uni-app内置的常用样式变量 - * - * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 - * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App - * - */ -/** - * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 - * - * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 - */ -/* 颜色变量 */ -/* 行为相关颜色 */ -/* 文字基本颜色 */ -/* 背景颜色 */ -/* 边框颜色 */ -/* 尺寸变量 */ -/* 文字尺寸 */ -/* 图片尺寸 */ -/* Border Radius */ -/* 水平间距 */ -/* 垂直间距 */ -/* 透明度 */ -/* 文章场景相关 */ -.container { - width: 100%; - height: 100vh; - background: linear-gradient(to top, #FFFFFF, #E8EFFF); -} -.container .date { - height: 84rpx; - width: 100%; - display: flex; - padding: 0 36rpx; - box-sizing: border-box; - justify-content: space-between; - align-items: center; -} -.container .date view:first-child { - font-weight: 300; - font-size: 32rpx; - color: #000000; -} -.container .date view:last-child { - font-weight: 300; - font-size: 24rpx; - color: #7E7E7E; -} -.container .date view:last-child text:first-child { - margin-right: 30rpx; -} -.container .main { - width: 99%; - height: calc(100vh - 84rpx - 176rpx - 70rpx); - background: #fff; - border-radius: 20rpx; - margin: 0 auto; - padding: 28rpx 48rpx; - box-sizing: border-box; - overflow-y: scroll; -} -.container .main .item { - width: 100%; - height: 184rpx; - border-bottom: 1rpx solid #D8D8D8; - box-sizing: border-box; - padding-bottom: 38rpx; - justify-content: space-between; - align-items: flex-end; - display: flex; -} -.container .main .item .item-left { - height: 100%; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: flex-start; -} -.container .main .item .item-left text:first-child { - font-weight: 300; - font-size: 32rpx; - color: #000000; -} -.container .main .item .item-left .methods { - font-weight: 300; - font-size: 32rpx; - color: #474646; -} -.container .main .item .item-left text:last-child { - font-weight: 300; - font-size: 24rpx; - color: #A7A7A7; -} -.container .main .item .item-right { - height: 100%; - display: flex; - flex-direction: column; - justify-content: flex-end; - align-items: flex-end; -} -.container .main .item .item-right text:first-child { - font-weight: 300; - font-size: 32rpx; - color: #000000; -} -.container .main .item .item-right text:last-child { - font-weight: 300; - font-size: 24rpx; - color: #A7A7A7; -} \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/index/index.js b/unpackage/dist/dev/mp-weixin/pages/index/index.js index 66682be..00026c3 100644 --- a/unpackage/dist/dev/mp-weixin/pages/index/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/index/index.js @@ -13,36 +13,42 @@ } const cardInfo = common_vendor.ref({ id: "", - userName: "", + userName: "微信用户", headImg: "", + userPhone: "", waterCardNumber: "", balance: "", - count: "", - userPhone: "" + count: "" }); const isVip = common_vendor.ref(false); - async function getInfo() { - let res = await api_index.getUserInfo(); - if (res.code == 200) { - console.log("res", res.data); - cardInfo.value.userName = res.data.userInfo.userName; - cardInfo.value.headImg = res.data.userInfo.headImg; - cardInfo.value.userPhone = res.data.userInfo.userPhone; - cardInfo.value.id = res.data.userInfo.id; - if (res.data.userInfo.waterCardNumber) { - let res1 = await api_index.getVipInfoApi(); - cardInfo.value.waterCardNumber = res1.data.cardNumber; - if (res1.data.cardType == 1) { - cardInfo.value.balance = res1.data.balance; - } else if (res1.data.cardType == 2) { - cardInfo.value.count = res1.data.count; + async function getVipInfo() { + await api_index.getVipInfoApi().then((res) => { + if (res.code == 200) { + cardInfo.value.waterCardNumber = res.data.cardNumber; + if (res.data.cardType == 1) { + cardInfo.value.balance = res.data.balance; + } else if (res.data.cardType == 2) { + cardInfo.value.count = res.data.count; } isVip.value = true; - } else { - isVip.value = false; } - common_vendor.index.setStorageSync("userInfo", JSON.stringify(cardInfo.value)); - } + }); + } + async function getInfo() { + await api_index.getUserInfo().then(async (res) => { + if (res.code == 200) { + cardInfo.value.userName = res.data.userInfo.userName ? res.data.userInfo.userName : cardInfo.value.userName; + cardInfo.value.headImg = res.data.userInfo.headImg; + cardInfo.value.userPhone = res.data.userInfo.userPhone; + cardInfo.value.id = res.data.userInfo.id; + if (res.data.userInfo.waterCardNumber) { + await getVipInfo(); + } else { + isVip.value = false; + } + common_vendor.index.setStorageSync("userInfo", JSON.stringify(cardInfo.value)); + } + }); } function toScan() { common_vendor.index.scanCode({ @@ -56,19 +62,73 @@ }); } const functionList = common_vendor.ref([ - { text: "余额记录", icon: "../../static/images/index/icon31.png", url: "/pages/balanceRecord/index" }, - { text: "消费记录", icon: "../../static/images/index/icon32.png", url: "/pages/paymentRecord/index" }, - { text: "充值记录", icon: "../../static/images/index/icon33.png", url: "" }, - { text: "账户共享", icon: "../../static/images/index/icon34.png", url: "" }, - { text: "优惠卷", icon: "../../static/images/index/icon35.png", url: "" }, - { text: "电子发票", icon: "../../static/images/index/icon36.png", url: "" }, - { text: "联系客服", icon: "../../static/images/index/icon37.png", url: "" }, - { text: "推广分佣", icon: "../../static/images/index/icon38.png", url: "" } + { text: "余额记录", icon: "../../static/images/index/icon31.png", url: "/pages/functionList/balanceRecord/index", isUrl: 1 }, + { text: "消费记录", icon: "../../static/images/index/icon32.png", url: "/pages/functionList/paymentRecord/index", isUrl: 1 }, + { text: "充值记录", icon: "../../static/images/index/icon33.png", url: "/pages/functionList/rechargeRecord/index", isUrl: 1 }, + { text: "账户共享", icon: "../../static/images/index/icon34.png", url: "", isUrl: 1 }, + { text: "优惠卷", icon: "../../static/images/index/icon35.png", url: "", isUrl: 1 }, + { text: "电子发票", icon: "../../static/images/index/icon36.png", url: "", isUrl: 1 }, + { text: "会员卡挂失", icon: "../../static/images/index/icon37.png", url: "", isUrl: 2 }, + { text: "会员卡注销", icon: "../../static/images/index/icon38.png", url: "", isUrl: 3 } ]); function navTo(itemUrl) { if (itemUrl) { common_vendor.index.navigateTo({ url: itemUrl + }); + } + } + async function setEvent(isUrl, url) { + if (isUrl == 1) { + navTo(url); + } else if (isUrl == 2) { + common_vendor.index.showModal({ + title: "会员卡挂失", + content: "确认挂失会员卡?", + success: async function(res) { + if (res.confirm) { + await api_index.reportLossApi(cardInfo.value.waterCardNumber).then((res2) => { + if (res2.code == 200) { + common_vendor.index.showToast({ + title: "已挂失", + duration: 2e3 + }); + } + }); + } else { + console.log("点击了取消7"); + } + } + }); + } else if (isUrl == 3) { + common_vendor.index.showModal({ + title: "会员卡注销", + content: "确认注销会员卡?", + success: async function(res) { + if (res.confirm) { + await api_index.removeCardApi(cardInfo.value.waterCardNumber).then(async (res2) => { + if (res2.code == 200) { + common_vendor.index.showToast({ + title: "已注销", + duration: 2e3 + }); + await getVipInfo().then((res3) => { + if (res3.code == 200) { + if (!res3.data.id) { + isVip.value = false; + cardInfo.value.balance = ""; + cardInfo.value.count = ""; + cardInfo.value.waterCardNumber = ""; + common_vendor.index.setStorageSync("userInfo", JSON.stringify(cardInfo.value)); + } + } + }); + } + }); + } else { + console.log("点击了取消8"); + } + } }); } } @@ -79,41 +139,56 @@ await getInfo(); }); return (_ctx, _cache) => { - return { + return common_vendor.e({ a: common_assets._imports_0$1, b: common_vendor.t(cardInfo.value.userName), - c: common_assets._imports_1, + c: common_assets._imports_1$1, d: common_assets._imports_2, e: common_vendor.o(($event) => navTo("/pages/addCard/index")), f: common_vendor.o(($event) => navTo("/pages/userInfo/index")), g: common_assets._imports_3, - h: common_assets._imports_4, - i: common_vendor.t(cardInfo.value.waterCardNumber), - j: common_vendor.t(cardInfo.value.userPhone), - k: common_vendor.t(cardInfo.value.balance), - l: common_vendor.o(($event) => navTo("/pages/recharge/index")), - m: topHeight.value + "rpx", - n: common_assets._imports_5, - o: common_vendor.o(($event) => navTo("/pages/sendWater/index")), - p: common_assets._imports_1$1, - q: common_vendor.o(($event) => navTo("/pages/facilityList/index")), - r: common_assets._imports_7, - s: common_vendor.o(($event) => toScan()), - t: common_vendor.f(functionList.value, (item, index, i0) => { + h: isVip.value + }, isVip.value ? { + i: common_assets._imports_4 + } : {}, { + j: isVip.value + }, isVip.value ? { + k: common_vendor.t(cardInfo.value.waterCardNumber) + } : {}, { + l: isVip.value + }, isVip.value ? {} : {}, { + m: !isVip.value + }, !isVip.value ? {} : {}, { + n: isVip.value + }, isVip.value ? { + o: common_vendor.t(cardInfo.value.balance) + } : {}, { + p: isVip.value + }, isVip.value ? { + q: common_vendor.o(($event) => navTo("/pages/recharge/index")) + } : {}, { + r: topHeight.value + "rpx", + s: common_assets._imports_5, + t: common_vendor.o(($event) => navTo("/pages/sendWater/index")), + v: common_assets._imports_1, + w: common_vendor.o(($event) => navTo("/pages/facilityList/index")), + x: common_assets._imports_7, + y: common_vendor.o(($event) => toScan()), + z: common_vendor.f(functionList.value, (item, index, i0) => { return { a: item.icon, b: common_vendor.t(item.text), - c: common_vendor.o(($event) => navTo(item.url), index), + c: common_vendor.o(($event) => setEvent(item.isUrl, item.url), index), d: index }; }), - v: common_assets._imports_8, - w: common_assets._imports_9, - x: common_assets._imports_10, - y: common_vendor.o(($event) => navTo("/pages/station/index")), - z: common_assets._imports_11, - A: common_assets._imports_10 - }; + A: common_assets._imports_8, + B: common_assets._imports_9, + C: common_assets._imports_10, + D: common_vendor.o(($event) => navTo("/pages/station/index")), + E: common_assets._imports_11, + F: common_assets._imports_10 + }); }; } }; diff --git a/unpackage/dist/dev/mp-weixin/pages/index/index.wxml b/unpackage/dist/dev/mp-weixin/pages/index/index.wxml index f0187c0..6196737 100644 --- a/unpackage/dist/dev/mp-weixin/pages/index/index.wxml +++ b/unpackage/dist/dev/mp-weixin/pages/index/index.wxml @@ -1 +1 @@ -<view class="container data-v-1cf27b2a"><view class="content data-v-1cf27b2a"><view class="card-box data-v-1cf27b2a" style="{{'padding-top:' + m}}"><view class="user-info data-v-1cf27b2a" bindtap="{{f}}"><image class="user-img data-v-1cf27b2a" src="{{a}}" alt=""></image><text class="data-v-1cf27b2a">{{b}}</text><image class="user-more data-v-1cf27b2a" src="{{c}}"></image><view class="user-add-card data-v-1cf27b2a" bindtap="{{e}}"><image class="data-v-1cf27b2a" src="{{d}}" alt=""></image><text class="data-v-1cf27b2a">添加会员卡</text></view></view><view class="card data-v-1cf27b2a"><image class="card-bg data-v-1cf27b2a" src="{{g}}" alt=""></image><view class="card-content data-v-1cf27b2a"><view class="card-left data-v-1cf27b2a"><view class="left-top data-v-1cf27b2a"><view class="data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{h}}" alt=""></image><text class="data-v-1cf27b2a">会员卡</text></view><view class="data-v-1cf27b2a">ID:{{i}}</view></view><view class="left-bottom data-v-1cf27b2a">电话:{{j}}</view></view><view class="card-right data-v-1cf27b2a"><view class="card-right-top data-v-1cf27b2a"><text class="data-v-1cf27b2a">金额卡</text><text class="data-v-1cf27b2a">{{k}}元</text></view><view class="card-right-bottom data-v-1cf27b2a" bindtap="{{l}}">充值</view></view></view></view></view><view class="function-box1 data-v-1cf27b2a"><view class="box1-bg box1-one data-v-1cf27b2a" bindtap="{{o}}"><image class="data-v-1cf27b2a" src="{{n}}" alt=""></image><view class="data-v-1cf27b2a">送水到家</view></view><view bindtap="{{q}}" class="box1-bg box1-two data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{p}}" alt=""></image><view class="data-v-1cf27b2a">附近设备</view></view><view class="box1-bg box1-three data-v-1cf27b2a" bindtap="{{s}}"><image class="data-v-1cf27b2a" src="{{r}}" alt=""></image><view class="data-v-1cf27b2a">扫码取水</view></view></view><view class="function-box2 data-v-1cf27b2a"><view class="box2-title data-v-1cf27b2a"><text class="data-v-1cf27b2a">功能列表</text></view><view class="box2-content data-v-1cf27b2a"><block wx:for="{{t}}" wx:for-item="item" wx:key="d"><view class="box2-item data-v-1cf27b2a" bindtap="{{item.c}}"><image class="data-v-1cf27b2a" src="{{item.a}}" alt=""></image><view class="box2-item-text data-v-1cf27b2a">{{item.b}}</view></view></block></view></view><view class="advertisement-box data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{v}}" alt=""></image></view><view class="service-box data-v-1cf27b2a"><view class="service-title data-v-1cf27b2a"><text class="data-v-1cf27b2a">服务指南</text></view><view class="service-content data-v-1cf27b2a"><view class="service-bg data-v-1cf27b2a" bindtap="{{y}}"><view class="data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{w}}" alt=""></image><text class="data-v-1cf27b2a">附近站点</text></view><view class="service-info data-v-1cf27b2a">蔡家供水服务中心正在营业中……</view><view class="data-v-1cf27b2a"><text class="data-v-1cf27b2a">查看更多</text><image class="data-v-1cf27b2a" src="{{x}}" alt=""></image></view></view><view class="service-bg data-v-1cf27b2a"><view class="data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{z}}" alt=""></image><text class="data-v-1cf27b2a">公示公告</text></view><view class="service-info data-v-1cf27b2a">停水公告的部分摘要的内容展示……</view><view class="data-v-1cf27b2a"><text class="data-v-1cf27b2a">查看更多</text><image class="data-v-1cf27b2a" src="{{A}}" alt=""></image></view></view></view></view></view></view> \ No newline at end of file +<view class="container data-v-1cf27b2a"><view class="content data-v-1cf27b2a"><view class="card-box data-v-1cf27b2a" style="{{'padding-top:' + r}}"><view class="user-info data-v-1cf27b2a" bindtap="{{f}}"><image class="user-img data-v-1cf27b2a" src="{{a}}" alt=""></image><text class="data-v-1cf27b2a">{{b}}</text><image class="user-more data-v-1cf27b2a" src="{{c}}"></image><view class="user-add-card data-v-1cf27b2a" bindtap="{{e}}"><image class="data-v-1cf27b2a" src="{{d}}" alt=""></image><text class="data-v-1cf27b2a">添加会员卡</text></view></view><view class="card data-v-1cf27b2a"><image class="card-bg data-v-1cf27b2a" src="{{g}}" alt=""></image><view class="card-content data-v-1cf27b2a"><view class="card-left data-v-1cf27b2a"><view class="left-top data-v-1cf27b2a"><view class="data-v-1cf27b2a"><image wx:if="{{h}}" class="data-v-1cf27b2a" src="{{i}}" alt=""></image><text class="data-v-1cf27b2a">会员卡</text></view><view wx:if="{{j}}" class="data-v-1cf27b2a">ID:{{k}}</view></view></view><view class="card-right data-v-1cf27b2a"><view class="card-right-top data-v-1cf27b2a"><text wx:if="{{l}}" class="data-v-1cf27b2a">金额卡</text><text wx:if="{{m}}" class="data-v-1cf27b2a">未绑定会员卡</text><text wx:if="{{n}}" class="data-v-1cf27b2a">{{o}}元</text></view><view wx:if="{{p}}" class="card-right-bottom data-v-1cf27b2a" bindtap="{{q}}">充值</view></view></view></view></view><view class="function-box1 data-v-1cf27b2a"><view class="box1-bg box1-one data-v-1cf27b2a" bindtap="{{t}}"><image class="data-v-1cf27b2a" src="{{s}}" alt=""></image><view class="data-v-1cf27b2a">送水到家</view></view><view bindtap="{{w}}" class="box1-bg box1-two data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{v}}" alt=""></image><view class="data-v-1cf27b2a">附近设备</view></view><view class="box1-bg box1-three data-v-1cf27b2a" bindtap="{{y}}"><image class="data-v-1cf27b2a" src="{{x}}" alt=""></image><view class="data-v-1cf27b2a">扫码取水</view></view></view><view class="function-box2 data-v-1cf27b2a"><view class="box2-title data-v-1cf27b2a"><text class="data-v-1cf27b2a">功能列表</text></view><view class="box2-content data-v-1cf27b2a"><block wx:for="{{z}}" wx:for-item="item" wx:key="d"><view class="box2-item data-v-1cf27b2a" bindtap="{{item.c}}"><image class="data-v-1cf27b2a" src="{{item.a}}" alt=""></image><view class="box2-item-text data-v-1cf27b2a">{{item.b}}</view></view></block></view></view><view class="advertisement-box data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{A}}" alt=""></image></view><view class="service-box data-v-1cf27b2a"><view class="service-title data-v-1cf27b2a"><text class="data-v-1cf27b2a">服务指南</text></view><view class="service-content data-v-1cf27b2a"><view class="service-bg data-v-1cf27b2a" bindtap="{{D}}"><view class="data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{B}}" alt=""></image><text class="data-v-1cf27b2a">附近站点</text></view><view class="service-info data-v-1cf27b2a">蔡家供水服务中心正在营业中……</view><view class="data-v-1cf27b2a"><text class="data-v-1cf27b2a">查看更多</text><image class="data-v-1cf27b2a" src="{{C}}" alt=""></image></view></view><view class="service-bg data-v-1cf27b2a"><view class="data-v-1cf27b2a"><image class="data-v-1cf27b2a" src="{{E}}" alt=""></image><text class="data-v-1cf27b2a">公示公告</text></view><view class="service-info data-v-1cf27b2a">停水公告的部分摘要的内容展示……</view><view class="data-v-1cf27b2a"><text class="data-v-1cf27b2a">查看更多</text><image class="data-v-1cf27b2a" src="{{F}}" alt=""></image></view></view></view></view></view></view> \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/recharge/index.js b/unpackage/dist/dev/mp-weixin/pages/recharge/index.js index 9d34e6d..2872b67 100644 --- a/unpackage/dist/dev/mp-weixin/pages/recharge/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/recharge/index.js @@ -12,7 +12,7 @@ const _sfc_main = { __name: "index", setup(__props) { - const choosedMoney = common_vendor.ref(); + const choosedMoney = common_vendor.ref(50); const disabled = common_vendor.ref(true); const moneyList = common_vendor.ref([ { value: 50, active: true }, @@ -54,7 +54,7 @@ if (disabled.value) { money = choosedMoney.value; } else { - money = otherMoney.value; + money = Number(otherMoney.value); } await api_index.wxPayApi({ businessType: 1, tradeAmount: money }).then((res) => { console.log("reswxpay", res); diff --git a/unpackage/dist/dev/mp-weixin/static/images/index/icon37.png b/unpackage/dist/dev/mp-weixin/static/images/index/icon37.png index bfcf59a..c8fa025 100644 --- a/unpackage/dist/dev/mp-weixin/static/images/index/icon37.png +++ b/unpackage/dist/dev/mp-weixin/static/images/index/icon37.png Binary files differ diff --git a/unpackage/dist/dev/mp-weixin/static/images/index/icon38.png b/unpackage/dist/dev/mp-weixin/static/images/index/icon38.png index 51b3c66..1d19344 100644 --- a/unpackage/dist/dev/mp-weixin/static/images/index/icon38.png +++ b/unpackage/dist/dev/mp-weixin/static/images/index/icon38.png Binary files differ -- Gitblit v1.9.3