| | |
| | | export default { |
| | | onLaunch: function() { |
| | | console.log('App Launch') |
| | | // if(!uni.getStorageSync('openId') || !uni.getStorageSync('token')){ |
| | | // uni.redirectTo({ |
| | | // url:'/pages/login/index' |
| | | // }) |
| | | // } |
| | | if(!uni.getStorageSync('openId') || !uni.getStorageSync('token')){ |
| | | uni.redirectTo({ |
| | | url:'/pages/login/index' |
| | | }) |
| | | } |
| | | }, |
| | | onShow: function() { |
| | | console.log('App Show') |
| | |
| | | return request('/pay/service/wxPay',data,'POST') |
| | | } |
| | | |
| | | //水卡充值* |
| | | //生成订单 |
| | | export function rechargeApi(data){ |
| | | return request('/rechargeRecords/fees',data,'POST') |
| | | return request('/api/user/fees',data,'POST') |
| | | } |
| | | |
| | | // 设备列表 |
| | |
| | | export const BASE_URL = 'http://192.168.0.67:8041' |
| | | export const BASE_URL = 'https://www.huiwuyuntong.com/water-ration-beta' |
| | |
| | | </view> |
| | | <view class="info-addr" @click="openMap(item.lat,item.lon)"> |
| | | <text class="addr-text">地址:{{item.address}}</text> |
| | | <view> |
| | | <view class="addr-icon"> |
| | | <image src="../../static/images/icon-point.svg" alt=''></image> |
| | | <text>{{item.distanceValue}}km</text> |
| | | </view> |
| | |
| | | align-items:center; |
| | | .addr-text{ |
| | | width:340rpx; |
| | | flex-shrink: 0; |
| | | height:80rpx; |
| | | color: #6a6e75; |
| | | font-size:26rpx; |
| | | } |
| | | view{ |
| | | .addr-icon{ |
| | | width: 150rpx; |
| | | flex-shrink: 0; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items:center; |
| | | justify-content: flex-end; |
| | | image{ |
| | | width:50rpx; |
| | | height:50rpx; |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | } |
| | | text{ |
| | | color: #6a6e75; |
| | | font-size:26rpx; |
| | | font-size:22rpx; |
| | | } |
| | | } |
| | | } |
| | |
| | | import { onMounted, ref } from "vue"; |
| | | import { BASE_URL } from '../../config/index.js'; |
| | | import { getUserInfo } from '@/api/index.js' |
| | | import { onShow } from "@dcloudio/uni-app" |
| | | |
| | | const topHeight = ref(0) |
| | | const userInfo = ref() |
| | |
| | | } |
| | | onMounted(() => { |
| | | getTopHeight() |
| | | getUserDatail() |
| | | // 获取位置信息 |
| | | getUserLocation() |
| | | }) |
| | | |
| | | onShow(() => { |
| | | getUserDatail() |
| | | }) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | <image class="top-bg" src="../../static/images/login/top_bg.png" mode="widthFix"></image> |
| | | <view class="top--title"> |
| | | <image class="logo" src="../../static/images/login/logo.png "></image> |
| | | <view class="text">慧物通直饮水</view> |
| | | <view class="text">定量取水小程序</view> |
| | | </view> |
| | | </view> |
| | | <view class="login-text"> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <button :style="{opacity:payStatus ? 1 : 0.7}" class="submit-btn" @click="submit()">立即充值</button> |
| | | <button :disabled="payStatus" class="submit-btn" @click="submit()">立即充值</button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | |
| | | {text:"微信支付",value:2,checked:true,img:'../../static/images/recharge/wx.png'}, |
| | | ]) |
| | | let timerId |
| | | let payStatus = ref(true) |
| | | let payStatus = ref(false) |
| | | |
| | | const chooseMoney = (index1) => { |
| | | moneyList.value.forEach((item,index) =>{ |
| | |
| | | } |
| | | |
| | | const submit = () => { |
| | | if(payStatus.value){ |
| | | payStatus.value = false |
| | | timerId = setTimeout(()=>{ |
| | | payStatus.value = true |
| | | },20000) |
| | | payStatus.value = true; //点击后禁用按钮 |
| | | try{ |
| | | let money = '' |
| | | if(disabled.value){ |
| | | money = choosedMoney.value |
| | |
| | | money = Number(otherMoney.value) |
| | | } |
| | | let data = { |
| | | cardNumber:userInfo.waterCardNumber, |
| | | paymentMethod:1, |
| | | rechargeAmount:money |
| | | } |
| | | cardNumber:userInfo.waterCardNumber, |
| | | paymentMethod:1, |
| | | rechargeAmount:money |
| | | } |
| | | //生成订单 |
| | | rechargeApi(data).then(async(res) =>{ |
| | | rechargeApi(data).then(async (res) =>{ |
| | | if(res.code == 200){ |
| | | let data = { |
| | | businessType:1, |
| | | businessNo:res.data |
| | | } |
| | | } |
| | | //发起支付 |
| | | await wxPay(data) |
| | | otherMoney.value = '' |
| | | payStatus.value = false; |
| | | } |
| | | }) |
| | | }else{ |
| | | }catch(err){ |
| | | payStatus.value = false; |
| | | uni.showToast({ |
| | | title:'充值间隔20秒,请稍后!', |
| | | title:'失败', |
| | | icon:'none' |
| | | }) |
| | | } |
| | |
| | | wxPayApi(data).then((res) =>{ |
| | | if(res.code == 200){ |
| | | //调用微信官方支付接口弹出付款界面,输入密码扣款 |
| | | wx.requestPayment({ |
| | | uni.requestPayment({ |
| | | //预支付订单信息 |
| | | // appId: res.data.appId, |
| | | provider: 'wxpay', |
| | | timeStamp: res.data.timeStamp, //时间戳 |
| | | nonceStr: res.data.nonceStr, //随机串 |
| | | package: res.data.package, //prepay_id |