diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 22486f3..3ef557d 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -145,6 +145,12 @@ path: '/subpackage/blacklist/pages/abnormal_list/abnormal_list', serverKey: 1015 // 后端对应权限编号 1015 }, + { + id: 11, + name: '钱包', + path: '/subpackage/wallet/pages/index/index', + serverKey: 1015 // 后端对应权限编号 1015 + }, ]; const app = getApp(); diff --git a/src/subpackage/wallet/components/bf_withdraw.vue b/src/subpackage/wallet/components/bf_withdraw.vue index 577da09..05763e5 100644 --- a/src/subpackage/wallet/components/bf_withdraw.vue +++ b/src/subpackage/wallet/components/bf_withdraw.vue @@ -6,7 +6,7 @@ 可提现资金: {{ accountInfo.availableBal || 0 }}元 - + 温馨提示 @@ -36,35 +36,67 @@ export default { return { isShow: false, accountInfo: {}, - extractNum: 0, - companyInfo: {} + extractNum: '', + companyInfo: { + /** + * name, -> 公司名称 + * account -> 账户账号 + * type -> 1(个人)/ 2(企业) + * index -> 当前账户索引 + */ + } } }, methods: { confirmExtract: debounce(async function(){ let { companyInfo, accountInfo, extractNum } = this; + if(!this.checkExtractNum({ availableBal: accountInfo?.availableBal, extractNum }))return; try{ showLoad(); - let _accountInfo = await this.setPriceInfo({ + let _operateInfo = await this.setPriceInfo({ contractNo: companyInfo?.account ?? '', dealAmount: extractNum }) hideLoad(); - if(_accountInfo?.errorCode === 'SUCCESS')this.isShow = true; + // showNone(_operateInfo?.transRemark || '提现成功!'); + this.hide(); + this.$emit('click:extract', companyInfo.index); }catch(err){ hideLoad(); - showNone(err?.message || err?.data?.errorMsg || '提现失败!'); - console.warn('alert catch error: ', err); + let _errMsg = err?.message || err?.data?.transRemark || err?.data?.errorMsg || '提现失败!'; + showNone(_errMsg); + console.warn('confirmExtract catch error: ', err); } }, 300, true), /** + * @param {String} availableBal 可提现金额 + * @param {String} extractNum 提现金额 + * @returns {Boolean} + */ + checkExtractNum({ availableBal, extractNum }){ + let _num = +extractNum || 0; + if(!extractNum){ + showNone('请输入提现金额!'); + return false; + } + if(_num <= 0){ + showNone('提现金额必须大于0!'); + return false; + } + if(_num > +availableBal){ + showNone('提现金额不能大于可提现金额!'); + return false; + } + return true; + }, + /** * @param {String} account 宝付V2账户 * @param {String} type '1'->个人 / '2'->企业 * @param {String} name 公司名 */ - async alert({ account, type, name }){ + async alert({ account, type, name, index }){ if(!account)return showNone('账户号不存在!'); - this.companyInfo = { account, type, name }; + this.companyInfo = { account, type, name, index }; try{ showLoad(); let _accountInfo = await this.getPriceInfo({ @@ -72,10 +104,11 @@ export default { contractNo: account }) hideLoad(); - if(_accountInfo?.errorCode === 'SUCCESS')this.isShow = true; + this.isShow = true; }catch(err){ hideLoad(); - showNone(err?.message || err?.data?.errorMsg || '获取账户信息失败!'); + let _errMsg = err?.message || err?.data?.errorMsg || '获取账户信息失败!'; + showNone(_errMsg); console.warn('alert catch error: ', err); } }, @@ -88,6 +121,13 @@ export default { service: 'T-1001-013-06', query: { accType, contractNo } }) + .then(res=>{ + if(res?.data?.errorCode === 'SUCCESS'){ + return this.accountInfo = res?.data || {}; + }else{ + return Promise.reject(res) + } + }) }, // 提现 setPriceInfo({ contractNo, dealAmount }){ @@ -100,6 +140,13 @@ export default { dealAmount: dealAmount } }) + .then(res=>{ + if(res?.data.state === 1){ + return res?.data || {}; + }else{ + return Promise.reject(res) + } + }) }, /** * @param {String} service 查询 -> T-1001-013-06 / 提现 -> T-1001-013-14 @@ -124,10 +171,10 @@ export default { }) .then(res=>{ let _data = res?.data; - if(_data.code === 0&&_data.data.errorCode === 'SUCCESS'){ - return this.accountInfo = _data.data; + if(_data.code === 0&&_data.data.retCode === 1){ + return _data || {}; }else{ - return Promise.reject(_data) + return Promise.reject(_data || {}) } }) } diff --git a/src/subpackage/wallet/components/dy_withdraw_apply.vue b/src/subpackage/wallet/components/dy_withdraw_apply.vue index a422a00..a86d363 100644 --- a/src/subpackage/wallet/components/dy_withdraw_apply.vue +++ b/src/subpackage/wallet/components/dy_withdraw_apply.vue @@ -23,7 +23,7 @@ - + @@ -87,17 +87,9 @@ export default { this.info.bank_name = this.banks[value]; }, alert(){ - this.getStorageAndSet(); - // if(this.isEmptyInfo){ - // showModal({ - // content: '是否自动填充上次提现信息?', - // showCancel: true, - // success: res=>{ - // if(res.confirm)this.getStorageAndSet(); - // } - // }) - // } - this.show = true + // this.getStorageAndSet(); + this.show = true; + if(this.isEmptyInfo())this.getStorageAndSet(); }, hide(){ this.show = false @@ -106,7 +98,15 @@ export default { uni.getStorage({ key: 'dyRecentWithdrawApplyInfo', success: res=>{ - this.info = res.data; + showModal({ + content: '是否自动填充上次提现信息?', + showCancel: true, + success: mRes=>{ + if(mRes.confirm){ + this.info = res.data; + } + } + }) } }) }, @@ -222,7 +222,6 @@ export default { flex-shrink: 0; width: 20upx; height: 20upx; - background: skyblue; } } } diff --git a/src/subpackage/wallet/components/record_line.vue b/src/subpackage/wallet/components/record_line.vue new file mode 100644 index 0000000..1a6ff88 --- /dev/null +++ b/src/subpackage/wallet/components/record_line.vue @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/wallet/components/wallet_modal.vue b/src/subpackage/wallet/components/wallet_modal.vue index 0716b3a..dac98cd 100644 --- a/src/subpackage/wallet/components/wallet_modal.vue +++ b/src/subpackage/wallet/components/wallet_modal.vue @@ -1,7 +1,12 @@