准备调试充值
This commit is contained in:
parent
cae7b2767f
commit
3e7c9540ac
|
@ -4,6 +4,7 @@ import { alertInfo } 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({
|
||||
|
@ -104,7 +105,7 @@ Page({
|
|||
return;
|
||||
}
|
||||
this.setData({
|
||||
tenement: data,
|
||||
meter: data,
|
||||
show: false,
|
||||
})
|
||||
},
|
||||
|
@ -122,12 +123,23 @@ Page({
|
|||
onChangeMoney(e) {
|
||||
this.setData({ money: e.detail ? Number(e.detail) : e.detail })
|
||||
},
|
||||
recharge() {
|
||||
const { user, money } = this.data;
|
||||
async recharge() {
|
||||
const { user, money, meter, tenement, park } = this.data;
|
||||
if (!user || !user.id) {
|
||||
alertInfo("请先登录")
|
||||
return
|
||||
}
|
||||
if (!money) {
|
||||
alertInfo("请先输入金额")
|
||||
return;
|
||||
}
|
||||
console.log('this.data', this.data)
|
||||
const { code, message, data } = await requestRecharge({ money, meter: meter.code, tenement: tenement.id, park: park.id })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
console.log('data', data)
|
||||
},
|
||||
jumpToInvoice() {
|
||||
wx.navigateTo({
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<view class="chooseParkWrapper">
|
||||
|
||||
</view>
|
||||
<view class="login" wx:if="{{!user && !user.id}}" class="notLoginWrapper">
|
||||
<view class="login" wx:if="{{!user || !user.id}}" class="notLoginWrapper">
|
||||
<van-image width="100rpx" height="100rpx" src="/assets/images/defaultAvatar.png" class="defaultAvatar"/>
|
||||
<van-button type="primary" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">请登录</van-button>
|
||||
</view>
|
||||
|
|
Loading…
Reference in New Issue
Block a user