|
|
@ -1,12 +1,12 @@ |
|
|
|
<template> |
|
|
|
<wallet-modal title="提现"> |
|
|
|
<wallet-modal title="提现" :show="isShow" @click:close="hide"> |
|
|
|
<view class="bf-withdraw"> |
|
|
|
<view class="bw-txt">广州欧轩网络有限公司</view> |
|
|
|
<view class="bw-txt">{{ companyInfo.name || '' }}</view> |
|
|
|
<view class="bw-txt"> |
|
|
|
可提现资金: |
|
|
|
<text class="bt-price">399.63元</text> |
|
|
|
<text class="bt-price">{{ accountInfo.availableBal || 0 }}元</text> |
|
|
|
</view> |
|
|
|
<input type="text" class="bw-ipt"> |
|
|
|
<input type="digit" class="bw-ipt" v-model="extractNum"> |
|
|
|
|
|
|
|
<view class="dwa-tip"> |
|
|
|
<view class="dt-tit">温馨提示</view> |
|
|
@ -15,7 +15,7 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="dwa-btn"> |
|
|
|
<wm-button green>确认提现</wm-button> |
|
|
|
<wm-button green @click='confirmExtract'>确认提现</wm-button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</wallet-modal> |
|
|
@ -24,10 +24,113 @@ |
|
|
|
<script> |
|
|
|
import walletModal from './wallet_modal.vue'; |
|
|
|
import wmButton from './wm_button.vue'; |
|
|
|
import { WALLET_API } from '../js/api'; |
|
|
|
import servers from '../js/server'; |
|
|
|
import { showNone, showLoad, hideLoad, debounce } from '@/utils/util' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
'wallet-modal': walletModal, |
|
|
|
'wm-button': wmButton |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
isShow: false, |
|
|
|
accountInfo: {}, |
|
|
|
extractNum: 0, |
|
|
|
companyInfo: {} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
confirmExtract: debounce(async function(){ |
|
|
|
let { companyInfo, accountInfo, extractNum } = this; |
|
|
|
try{ |
|
|
|
showLoad(); |
|
|
|
let _accountInfo = await this.setPriceInfo({ |
|
|
|
contractNo: companyInfo?.account ?? '', |
|
|
|
dealAmount: extractNum |
|
|
|
}) |
|
|
|
hideLoad(); |
|
|
|
if(_accountInfo?.errorCode === 'SUCCESS')this.isShow = true; |
|
|
|
}catch(err){ |
|
|
|
hideLoad(); |
|
|
|
showNone(err?.message || err?.data?.errorMsg || '提现失败!'); |
|
|
|
console.warn('alert catch error: ', err); |
|
|
|
} |
|
|
|
}, 300, true), |
|
|
|
/** |
|
|
|
* @param {String} account 宝付V2账户 |
|
|
|
* @param {String} type '1'->个人 / '2'->企业 |
|
|
|
* @param {String} name 公司名 |
|
|
|
*/ |
|
|
|
async alert({ account, type, name }){ |
|
|
|
if(!account)return showNone('账户号不存在!'); |
|
|
|
this.companyInfo = { account, type, name }; |
|
|
|
try{ |
|
|
|
showLoad(); |
|
|
|
let _accountInfo = await this.getPriceInfo({ |
|
|
|
accType: type, |
|
|
|
contractNo: account |
|
|
|
}) |
|
|
|
hideLoad(); |
|
|
|
if(_accountInfo?.errorCode === 'SUCCESS')this.isShow = true; |
|
|
|
}catch(err){ |
|
|
|
hideLoad(); |
|
|
|
showNone(err?.message || err?.data?.errorMsg || '获取账户信息失败!'); |
|
|
|
console.warn('alert catch error: ', err); |
|
|
|
} |
|
|
|
}, |
|
|
|
hide(){ |
|
|
|
this.isShow = false |
|
|
|
}, |
|
|
|
// 查询 |
|
|
|
getPriceInfo({ accType, contractNo }){ |
|
|
|
return this.baofuV2PriceOperate({ |
|
|
|
service: 'T-1001-013-06', |
|
|
|
query: { accType, contractNo } |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 提现 |
|
|
|
setPriceInfo({ contractNo, dealAmount }){ |
|
|
|
return this.baofuV2PriceOperate({ |
|
|
|
service: 'T-1001-013-14', |
|
|
|
query: { |
|
|
|
contractNo: contractNo, |
|
|
|
feeMemberId: contractNo, |
|
|
|
transSerialNo: `TX${new Date().getTime()}`, // 流水号 |
|
|
|
dealAmount: dealAmount |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* @param {String} service 查询 -> T-1001-013-06 / 提现 -> T-1001-013-14 |
|
|
|
* @param {String} api 接口 默认 '/' |
|
|
|
* @param {Object} query 操作参数 |
|
|
|
* @param {String} version 版本 默认 '4.0.0' |
|
|
|
* @returns {Promise} |
|
|
|
* |
|
|
|
* */ |
|
|
|
baofuV2PriceOperate({ service = 'T-1001-013-06', api = '/', query, version = '4.0.0' }){ |
|
|
|
return servers.post({ |
|
|
|
url: WALLET_API.baofuV2Gateway, |
|
|
|
data: { |
|
|
|
service: service, |
|
|
|
api: api, |
|
|
|
data: { |
|
|
|
...query, |
|
|
|
version: version |
|
|
|
} |
|
|
|
}, |
|
|
|
isDefaultGet: false |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
let _data = res?.data; |
|
|
|
if(_data.code === 0&&_data.data.errorCode === 'SUCCESS'){ |
|
|
|
return this.accountInfo = _data.data; |
|
|
|
}else{ |
|
|
|
return Promise.reject(_data) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|