缴费新增对公支付(但是功能不可操作),开始调整首页
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| /* components/avatar/index.wxss */ | ||||
| .wrapper { | ||||
|   width: 150rpx; | ||||
|   height: 150rpx; | ||||
|   width: 120rpx; | ||||
|   height: 120rpx; | ||||
|   border-radius: 50%; | ||||
|   background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) ); | ||||
|   display: flex; | ||||
| @@ -14,4 +14,5 @@ | ||||
|   max-width: 100rpx; | ||||
|   overflow: hidden; | ||||
|   white-space: nowrap; | ||||
|   font-size: 30rpx; | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import { alertInfo, alertSuccess } from "../../utils/index"; | ||||
| import request from '../../utils/request'; | ||||
| import { getDot } from "../../utils/system"; | ||||
| import { getUserInfo } from "../../service/user" | ||||
|  | ||||
| import { requestRecharge } from "../../service/recharge"; | ||||
| const { OK } = request; | ||||
| // pages/home/index.js | ||||
| Page({ | ||||
| @@ -22,6 +22,11 @@ Page({ | ||||
|     pickerType: "", | ||||
|     meterList: [], | ||||
|     meterIndex: 0, | ||||
|     rechargeVisible: false, | ||||
|     actions: [ | ||||
|       { name: '微信支付', }, | ||||
|       { name: '对公支付', disabled: true }, | ||||
|     ], | ||||
|   }, | ||||
|    | ||||
|   /** | ||||
| @@ -148,10 +153,10 @@ Page({ | ||||
|       alertInfo("最少为1分") | ||||
|       return | ||||
|     } | ||||
|     wx.navigateTo({ | ||||
|       url: `/pages/rechargeWay/index?money=${money}&address=${meter.address}&id=${meter?.id}&tenement=${tenement?.id}&park=${park.id}`, | ||||
|     }) | ||||
|      | ||||
|     // wx.navigateTo({ | ||||
|     //   url: `/pages/rechargeWay/index?money=${money}&address=${meter.address}&id=${meter?.id}&tenement=${tenement?.id}&park=${park.id}`, | ||||
|     // }) | ||||
|     this.setData({ rechargeVisible: true }) | ||||
|   }, | ||||
|   jumpToInvoice() { | ||||
|     wx.navigateTo({ | ||||
| @@ -311,6 +316,48 @@ Page({ | ||||
|       url: '/pages/billList/index', | ||||
|     }) | ||||
|   }, | ||||
|   onCloseRechargeWay() { | ||||
|     this.setData({ rechargeVisible: false }) | ||||
|   }, | ||||
|   onSelectRechargeWay(e) { | ||||
|     switch(e.detail.name) { | ||||
|       case "对公支付": | ||||
|         alertInfo("开发中") | ||||
|         break; | ||||
|       default: | ||||
|         this.wxRecharge(); | ||||
|         break; | ||||
|     } | ||||
|   }, | ||||
|   async wxRecharge() { | ||||
|     const { money, meter, tenement, park } = this.data; | ||||
|     const { code, message, data } = await requestRecharge({ money: Number(money), id: meter?.id, tenement: tenement?.id, park: park?.id }) | ||||
|     if (code !== OK) { | ||||
|       alertInfo(message) | ||||
|       return; | ||||
|     } | ||||
|     wx.requestPayment({ | ||||
|       timeStamp: data?.time, | ||||
|       nonceStr: data?.nonceStr, | ||||
|       package: "prepay_id=" + data?.prepay_id, | ||||
|       paySign: data?.paySign, | ||||
|       signType: 'RSA', | ||||
|       success: (res) => { | ||||
|         alertSuccess("充值成功") | ||||
|         that.setData({ | ||||
|           money: null | ||||
|         }) | ||||
|       }, | ||||
|       fail: (res) => { | ||||
|         console.log('fail', res) | ||||
|         alertInfo("请稍后重试") | ||||
|       }, | ||||
|       complete: (res) => { | ||||
|         console.log('complete') | ||||
|         that.handleGetMeterDetail(meter.id) | ||||
|       } | ||||
|     }) | ||||
|   }, | ||||
|   /** | ||||
|    * 生命周期函数--监听页面隐藏 | ||||
|    */ | ||||
|   | ||||
| @@ -8,7 +8,8 @@ | ||||
|     "van-field": "@vant/weapp/field/index", | ||||
|     "picker": "/components/picker/index", | ||||
|     "van-grid": "@vant/weapp/grid/index", | ||||
|     "van-grid-item": "@vant/weapp/grid-item/index" | ||||
|     "van-grid-item": "@vant/weapp/grid-item/index", | ||||
|     "van-action-sheet": "@vant/weapp/action-sheet/index" | ||||
|   }, | ||||
|   "navigationStyle": "custom" | ||||
| } | ||||
| @@ -106,3 +106,10 @@ | ||||
| </view> | ||||
| </view> | ||||
| <picker show="{{show}}" valueKey="name" columns="{{columns}}" bind:ok="onOk" bind:cancel="onCancel" type="{{pickerType}}" /> | ||||
|  | ||||
| <van-action-sheet | ||||
|   show="{{ rechargeVisible }}" | ||||
|   actions="{{ actions }}" | ||||
|   bind:close="onCloseRechargeWay" | ||||
|   bind:select="onSelectRechargeWay" | ||||
| /> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user