| | |
| | | payMethod.value = payList.value[index1].value |
| | | console.log('index',index1,payMethod.value) |
| | | } |
| | | //确认支付 |
| | | let timerId |
| | | let payState = ref(true) |
| | | async function submit(){ |
| | | if(payState.value){ |
| | | payState.value = false |
| | | timerId = setTimeout(() =>{ |
| | | payState.value = true |
| | | },20000) |
| | | //余额支付 |
| | | if(payMethod.value == 1){ |
| | | if(choosedMoney.value > Number(userBalance.value)){ |
| | |
| | | } |
| | | }) |
| | | } |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'支付间隔20秒,请稍后!', |
| | | icon:'none' |
| | | }) |
| | | } |
| | | } |
| | | const facilityCode = ref() |
| | | onLoad((option) =>{ |
| | | facilityCode.value = option.facilityCode |
| | | console.log('小程序扫码取水','option.facilityCode',option.facilityCode,'facilityCode',facilityCode.value) |
| | | console.log('小程序扫码取水','option.facilityCode',option.facilityCode,'传参SN',facilityCode.value) |
| | | }) |
| | | //设置水价及支付方式 |
| | | //设置水价,设置支付方式,用户未绑定会员卡不显示余额支付选项 |
| | | async function getWaterPrice(){ |
| | | await getPriceBySnApi(facilityCode.value).then((res) =>{ |
| | | moneyList.value.forEach((item,index) =>{ |
| | |
| | | item.volume = ((index + 1) * res.data.yield).toFixed(1) |
| | | }) |
| | | choosedMoney.value = res.data.price |
| | | console.log('水价设置回调',res,'传参',facilityCode.value) |
| | | console.log('水价设置回调',res,'传参',facilityCode.value,'水价列表',choosedMoney.value) |
| | | }) |
| | | let waterCardNumber = JSON.parse(uni.getStorageSync('userInfo')).waterCardNumber |
| | | let waterCardNumber = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo')).waterCardNumber ) |
| | | console.log('用户水卡信息',uni.getStorageSync('userInfo')) |
| | | if(!waterCardNumber){ |
| | | payList.value.splice(1,1) |
| | | } |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="submit-btn" @click="submit()">确认支付</view> |
| | | <view :style="{opacity:payState ? 1 : 0.7}" class="submit-btn" @click="submit()">确认支付</view> |
| | | </view> |
| | | </view> |
| | | </template> |