|
@ -10,11 +10,11 @@ |
|
|
<image class="info-bg" src="../static/withdraw/bg.png"></image> |
|
|
<image class="info-bg" src="../static/withdraw/bg.png"></image> |
|
|
|
|
|
|
|
|
<view class="info-content"> |
|
|
<view class="info-content"> |
|
|
<view class="label">总佣金余额(元)</view> |
|
|
|
|
|
<view class="value">{{ riceInfo.canWithdraw || 0 }}</view> |
|
|
|
|
|
|
|
|
<view class="label">佣金(元)</view> |
|
|
|
|
|
<view class="value">{{ userInfo.recommendAmount || 0 }}</view> |
|
|
<view class="flex desc"> |
|
|
<view class="flex desc"> |
|
|
<!-- todo: 对接接口字段 --> |
|
|
<!-- todo: 对接接口字段 --> |
|
|
<view>{{ `累积提现:${123 || 0} 元` }}</view> |
|
|
|
|
|
|
|
|
<view>{{ `累积提现:${userInfo.cashoutSum || 0} 元` }}</view> |
|
|
<button plain class="btn" @click="toRunningWater"> |
|
|
<button plain class="btn" @click="toRunningWater"> |
|
|
<text>提现记录</text> |
|
|
<text>提现记录</text> |
|
|
<image class="btn-icon" src="@/static/image/center/icon-arrow.png" mode="widthFix"></image> |
|
|
<image class="btn-icon" src="@/static/image/center/icon-arrow.png" mode="widthFix"></image> |
|
@ -108,14 +108,20 @@ |
|
|
|
|
|
|
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// todo |
|
|
|
|
|
if (this.form.money < 300) { |
|
|
|
|
|
|
|
|
if (this.form.money < 1) { |
|
|
return uni.showToast({ |
|
|
return uni.showToast({ |
|
|
title: '未满300元不可提现哦!', |
|
|
|
|
|
|
|
|
title: '提现只能是整数必须大于1!', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// todo |
|
|
|
|
|
// if (this.form.money < 300) { |
|
|
|
|
|
// return uni.showToast({ |
|
|
|
|
|
// title: '未满300元不可提现哦!', |
|
|
|
|
|
// icon: 'none' |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
let isOk = this.parameterVerification(); |
|
|
let isOk = this.parameterVerification(); |
|
|
if (isOk && !isOk.auth) { |
|
|
if (isOk && !isOk.auth) { |
|
|
return uni.showToast({ |
|
|
return uni.showToast({ |
|
@ -123,17 +129,91 @@ |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
this.$api('recharge', this.form, res => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '提现成功', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
this.$store.commit('getUserInfo') |
|
|
|
|
|
this.$store.commit('getRiceInfo') |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// this.$api('recharge', this.form, res => { |
|
|
|
|
|
// if (res.code == 200) { |
|
|
|
|
|
// uni.showToast({ |
|
|
|
|
|
// title: '提现成功', |
|
|
|
|
|
// icon: 'none' |
|
|
|
|
|
// }) |
|
|
|
|
|
// this.$store.commit('getUserInfo') |
|
|
|
|
|
// this.$store.commit('getRiceInfo') |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 显示提交中状态 |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '提交中...' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 提现 |
|
|
|
|
|
this.$api('cashout', { transferAmount: this.form.money, userName: this.form.name }, res => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
if (res.code === 200) { |
|
|
|
|
|
// 处理待收款用户确认的情况 |
|
|
|
|
|
if (res.result && res.result.state === 'WAIT_USER_CONFIRM' && res.result.packageInfo && res.result.outBillNo) { |
|
|
|
|
|
// 拉起微信收款确认页面 |
|
|
|
|
|
if (!wx.canIUse('requestMerchantTransfer')) { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
content: '你的微信版本过低,请更新至最新版本。', |
|
|
|
|
|
showCancel: false, |
|
|
|
|
|
}); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let data = res.result |
|
|
|
|
|
|
|
|
|
|
|
// 在真机环境中,调用API |
|
|
|
|
|
wx.requestMerchantTransfer({ |
|
|
|
|
|
mchId: this.$config.mchId, |
|
|
|
|
|
appId: wx.getAccountInfoSync().miniProgram.appId, |
|
|
|
|
|
package: res.result.packageInfo, |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '提现申请已提交', |
|
|
|
|
|
icon: 'success' |
|
|
|
|
|
}) |
|
|
|
|
|
this.form.money = '' |
|
|
|
|
|
this.form.name = '' |
|
|
|
|
|
|
|
|
|
|
|
this.$api('getMoney', { |
|
|
|
|
|
id : data.outBillNo, |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
this.$store.commit('getUserInfo') |
|
|
|
|
|
this.$store.commit('getRiceInfo') |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (res) => { |
|
|
|
|
|
console.log('fail:', res); |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '提现失败,请稍后再试', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
complete: (res) => { |
|
|
|
|
|
console.log('requestMerchantTransfer完成:', res); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '提现成功', |
|
|
|
|
|
icon: 'success' |
|
|
|
|
|
}) |
|
|
|
|
|
this.$store.commit('getUserInfo') |
|
|
|
|
|
this.form.money = '' |
|
|
|
|
|
this.form.name = '' |
|
|
|
|
|
} |
|
|
|
|
|
}else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '提现只能是整数必须大于1!', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parameterVerification() { //验证用户参数合法性 |
|
|
parameterVerification() { //验证用户参数合法性 |
|
|
let { |
|
|
let { |
|
|