Browse Source

用户提现优化

master
yangrz 2 years ago
parent
commit
b89e9ff43a
  1. 7
      agentApp/common/api.js
  2. 64
      agentApp/pages/withdrawal-management/withdrawal-management.vue

7
agentApp/common/api.js

@ -56,4 +56,9 @@ export const userFillAlipayAccount = (params) => http.post(baseUrl + '/api/user/
export const userWithdraw = (params) => http.post(baseUrl + '/api/user/withdraw', params, userConfig())
export const userWithdrawList = (params) => http.post(baseUrl + '/api/user/withdrawList', params, userConfig())
export const userWithdrawList = (params) => http.post(baseUrl + '/api/user/withdrawList', params, userConfig())
export const publicSysConfig = (params) => http.post(baseUrl + '/api/public/sysConfig', params)

64
agentApp/pages/withdrawal-management/withdrawal-management.vue

@ -112,9 +112,16 @@
</view>
</view>
<u-modal title="确认提现金额" :show="isWithdrawForm" :showCancelButton="true" @confirm="confirmWithdraw" @cancel="isWithdrawForm=false">
<view class="slot-content">
<u--input prefixIcon="¥" placeholder="提现金额" border="surround" v-model="withdrawAmount"></u--input>
<u-modal title="确认提现金额" :show="isWithdrawForm" :showCancelButton="true" @confirm="confirmWithdraw"
@cancel="isWithdrawForm=false">
<view class="withdraw-form">
<u--input prefixIcon="¥" placeholder="提现金额" border="surround" v-model="inputAmount"></u--input>
<view class="fee-desc">
扣手续费{{calcFee}}实际到账{{calcReceiveAmount}}
</view>
<view class="tips">
<view class="tips-item" v-for="line in sysConfig.withdraw_tips.split('\n')">{{line}}</view>
</view>
</view>
</u-modal>
@ -125,7 +132,8 @@
import {
userAccountInfo,
userFillAlipayAccount,
userWithdraw
userWithdraw,
publicSysConfig
} from '../../common/api.js'
export default {
@ -136,11 +144,36 @@
inputAlipayAccount: '',
inputAlipayName: '',
isWithdrawForm: false,
withdrawAmount: ''
inputAmount: '',
sysConfig: {}
}
},
computed: {
calcFee() {
if (!this.inputAmount || isNaN(this.inputAmount)) {
return '--';
}
if (!this.sysConfig.withdraw_fee_rate) {
return '--';
}
let fee = (this.inputAmount * this.sysConfig.withdraw_fee_rate / 100).toFixed(2);
return fee;
},
calcReceiveAmount() {
if (!this.inputAmount || isNaN(this.inputAmount)) {
return '--';
}
if (!this.sysConfig.withdraw_fee_rate) {
return '--';
}
let fee = this.calcFee;
let receiveAmount = (this.inputAmount - parseFloat(fee)).toFixed(2);
return receiveAmount;
}
},
onLoad() {
this.getAccountInfo();
this.getSysConfig();
},
methods: {
getAccountInfo() {
@ -167,12 +200,13 @@
},
showWithdrawForm() {
this.isWithdrawForm = true
this.withdrawAmount = this.accountInfo.wallet_balance
this.inputAmount = this.accountInfo.wallet_balance
},
confirmWithdraw() {
userWithdraw({
amount: this.accountInfo.wallet_balance
amount: this.inputAmount
}).then(() => {
this.getAccountInfo()
this.isWithdrawForm = false
})
},
@ -180,7 +214,10 @@
uni.navigateTo({
url: '/pages/withdrawal-history/withdrawal-history'
});
}
},
getSysConfig() {
publicSysConfig().then(data => this.sysConfig = data)
},
}
}
</script>
@ -400,4 +437,15 @@
}
}
}
.withdraw-form {
font-size: 28rpx;
.tips {
margin-top: 20rpx;
.tips-item {
margin-top: 6rpx;
}
}
}
</style>
Loading…
Cancel
Save