Browse Source

add api

tid1509
刘嘉炜 12 months ago
parent
commit
858fc5784b
  1. 113
      src/subpackage/wallet/components/bf_withdraw.vue
  2. 4
      src/subpackage/wallet/js/api.js
  3. 71
      src/subpackage/wallet/pages/baofu_withdraw/index.vue
  4. 93
      src/subpackage/wallet/pages/baofu_withdraw/modules/baofu_item.vue
  5. 31
      src/subpackage/wallet/pages/douyin_withdraw/record.vue
  6. 5
      src/subpackage/wallet/pages/index/index.vue
  7. 2
      src/subpackage/wallet/pages/index/modules/wallet_info.vue
  8. 2
      src/utils/util.js

113
src/subpackage/wallet/components/bf_withdraw.vue

@ -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>

4
src/subpackage/wallet/js/api.js

@ -4,6 +4,10 @@ export const WALLET_API = {
walletBalance:`${ORIGIN}/admin/merchantwallet/balance`, // 获取商户钱包余额
withdrawalOfDouyinOrg_totalAmount:`${ORIGIN}/admin/financialReconciliation/withdrawalOfDouyinOrg/totalAmount`, // 可提现总额 抖音
withdrawalOfDouyinOrg_edit:`${ORIGIN}/admin/financialReconciliation/withdrawalOfDouyinOrg/edit`, // 申请提现-编辑 抖音
withdrawalOfDouyinOrg_list:`${ORIGIN}/admin/financialReconciliation/withdrawalOfDouyinOrg/list`, // 提现申请-列表 抖音
// 宝付
getPayAssureConfigs:`${ORIGIN}/admin/pay/assure/getPayAssureConfigs`, // 查看可选择的支付账户列表
baofuV2Gateway:`${ORIGIN}/admin/pay/assure/baofuV2/gateway`, // 宝付v2获取金额信息
}
export default WALLET_API;

71
src/subpackage/wallet/pages/baofu_withdraw/index.vue

@ -1,22 +1,81 @@
<template>
<view class="baofu-index">
<view class="bi-item">
<baofu-item></baofu-item>
<view class="bi-item" v-for="(e, i) in accountLs" :key="i">
<baofu-item
:name="e.label_name"
:account="e.baofu_v2_contract_no"
:tag="getBaoFuV2AccountTypeForChinese(e.baofu_v2_config)"
:personal="getBaoFuV2AccountTypeForChinese(e.baofu_v2_config) === '个人'"
@click:extract='extractBtn(i)'
></baofu-item>
</view>
<view class="bi-item">
<baofu-item personal></baofu-item>
</view>
<bf-withdraw></bf-withdraw>
<bf-withdraw ref="bfWithdraw"></bf-withdraw>
</view>
</template>
<script>
import baofuItem from './modules/baofu_item.vue';
import bfWithdraw from '../../components/bf_withdraw.vue';
import { WALLET_API } from '../../js/api';
import servers from '../../js/server';
import { routeTo } from '@/utils/util'
export default {
components: {
'baofu-item': baofuItem,
'bf-withdraw': bfWithdraw
},
data(){
return {
accountLs: []
}
},
onLoad(options){
this.brand_id = options.brand_id ?? '';
// this.getWalletBalance(options.brand_id);
this.getPayAssureConfigs();
},
methods: {
extractBtn(i){
let { accountLs } = this;
let _curItem = accountLs[i];
let _type = this.getBaoFuV2AccountTypeForChinese(_curItem.baofu_v2_config) === '个人' ? '1' : '2';
this.$refs.bfWithdraw.alert({
name: _curItem.label_name,
account: _curItem.baofu_v2_contract_no,
type: _type,
});
},
getPayAssureConfigs(){
servers.get({
url: WALLET_API.getPayAssureConfigs,
failMsg: '获取账户列表失败',
data: {
pay_way: 'WeChat',
appid: 'wxc141a743225e7885'
}
})
.then(res=>{
let _ls = res ?? [];
this.accountLs = this.filterBaoFuV2Accounts(_ls);
})
},
/**
* 过滤宝付V2账户
* @param {Array} list 账户列表 -> /admin/pay/assure/getPayAssureConfigs
* @returns {Array} 宝付V2账户列表
* */
filterBaoFuV2Accounts(list){
return list.filter(e=>e.assure_account_type === 'BaoFuV2');
},
/**
* 获取宝付V2账户类型中文 -> 个人/企业
* @param {Object} baofuV2Config 宝付V2配置
* @returns {String} 个人/企业
* */
getBaoFuV2AccountTypeForChinese(baofuV2Config = null){
return baofuV2Config?.person ? '个人' : '企业';
}
}
}
</script>

93
src/subpackage/wallet/pages/baofu_withdraw/modules/baofu_item.vue

@ -3,22 +3,23 @@
<view class="bi-bar" :class="{ 'bb-personal': personal }">
<view class="bb-name-bar">
<view class="bnb-left">
<view class="bl-txt">广州欧轩网络有限公司</view>
<view class="bl-tag" >企业</view>
<view class="bl-txt">{{ name }}</view>
<view class="bl-tag" >{{ tag }}</view>
</view>
<view class="bnb-right">
<view class="br-txt">提现记录</view>
<image class="wb-icon"></image>
</view>
</view>
<view class="bb-account-num">账户号CM660000000095108678</view>
<view class="bb-account-num">账户号{{ account }}</view>
</view>
<view class="bi-info">
<view class="bi-info" v-if="statusMsg === 'success'">
<view class="bi-balance">
<view class="bb-money">
19990.00
{{ accountInfo.availableBal || 0 }}
</view>
<view class="bb-btn">充值</view>
<view class="bb-btn" @click="$emit('click:extract')">提现</view>
</view>
<view class="bi-tip">
<view class="bt-txt">可提现资金()</view>
@ -26,14 +27,14 @@
</view>
<view class="bi-mony-info">
<view class="bmi-item">
<view class="bi-num">23525.89</view>
<view class="bi-num">{{ accountInfo.currBal || 0 }}</view>
<view class="bi-tip">
<view class="bt-txt">总资产()</view>
<image class="bt-icon"></image>
</view>
</view>
<view class="bmi-item">
<view class="bi-num">23525.89</view>
<view class="bi-num">{{ accountInfo.pendingBal || 0 }}</view>
<view class="bi-tip">
<view class="bt-txt">在途资金()</view>
<image class="bt-icon"></image>
@ -41,16 +42,84 @@
</view>
</view>
</view>
<view v-else class="bi-status-mes" @click="loadAgain">{{ statusMsg }}</view>
</view>
</template>
<script>
import { WALLET_API } from '../../../js/api';
import servers from '../../../js/server';
const failStatusMsg = '加载账户资金失败,点击重新加载!';
export default {
props: {
personal: {
type: Boolean,
default: false
},
name: {
type: String,
default: ''
},
tag: { // /
type: String,
default: ''
},
account: {
type: String,
default: ''
}
},
data(){
return {
statusMsg: '',
accountInfo: {},
}
},
created(){
this.getBaofuV2PriceInfo({
type: this.tag,
contractNo: this.account
});
},
methods:{
loadAgain(){
let { statusMsg } = this;
if(statusMsg === failStatusMsg){
this.getBaofuV2PriceInfo({
type: this.tag,
contractNo: this.account
});
}
},
getBaofuV2PriceInfo({ type, contractNo }){
this.statusMsg = '加载中...';
servers.post({
url: WALLET_API.baofuV2Gateway,
data: {
service: 'T-1001-013-06',
api: '/',
data: {
accType: type === '个人' ? '1' : '2',
contractNo: contractNo,
version: '4.0.0'
}
},
isDefaultGet: false
})
.then(res=>{
let _data = res?.data;
if(_data.code === 0&&_data.data.errorCode === 'SUCCESS'){
this.statusMsg = 'success';
this.accountInfo = _data.data;
}else{
console.warn('getBaofuV2PriceInfo error: ', res);
this.statusMsg = failStatusMsg;
}
})
.catch(err=>{
console.log('getBaofuV2PriceInfo catch error: ', err);
this.statusMsg = failStatusMsg;
})
}
}
}
@ -97,6 +166,7 @@ export default {
@include tHide;
}
.bl-tag{
flex-shrink: 0;
margin-left: 6upx;
padding: 0upx 6upx;
border-radius: 6upx;
@ -154,6 +224,9 @@ export default {
}
}
.bi-status-mes{
padding: 40upx 32upx;
@include flcw(24upx, 34upx, #000000);
}
}
</style>

31
src/subpackage/wallet/pages/douyin_withdraw/record.vue

@ -10,9 +10,40 @@
<script>
import recordItem from '../../components/record_item.vue';
import { WALLET_API } from '../../js/api';
import servers from '../../js/server';
import { routeTo, showLoad, hideLoad, showNone } from '@/utils/util';
export default {
components: {
'record-item': recordItem
},
onLoad(options){
this.getDouyinWalletWithdrawRecord(options);
},
methods: {
/**
* http://api.ouxuan.net:61080/project/11/interface/api/2202
* @param {String} brand_id 品牌id
* @param {status} status 传0展示未处理,传1展示处理不传展示全部
* @param {Number} page 页码
* @param {Number} page_size 每页条数
* */
getDouyinWalletWithdrawRecord({ brand_id, page = 1, page_size = 10 }){
showLoad();
servers.get({
url: WALLET_API.withdrawalOfDouyinOrg_list,
data: {
brand_id: brand_id,
page: page,
page_size: page_size
},
failMsg: '加载提现记录失败'
})
.then(res=>{
console.log(res);
})
.catch(hideLoad)
},
}
}
</script>

5
src/subpackage/wallet/pages/index/index.vue

@ -3,6 +3,7 @@
<wallet-info
:balance="balance"
@click:douyin="dyBtnClick"
@click:baofu="bfBtnClick"
></wallet-info>
<view class="wi-tips">
<view class="wt-tit">温馨提示</view>
@ -58,6 +59,10 @@ export default {
},
dyBtnClick(){
routeTo(`/subpackage/wallet/pages/douyin_withdraw/index?brand_id=${this.brand_id ?? ''}`, 'nT');
},
bfBtnClick(){
routeTo(`/subpackage/wallet/pages/baofu_withdraw/index?brand_id=${this.brand_id ?? ''}`, 'nT');
}
}
}

2
src/subpackage/wallet/pages/index/modules/wallet_info.vue

@ -22,7 +22,7 @@
</view>
</view>
<view class="wi-btns">
<view class="wb-item">
<view class="wb-item" @click="$emit('click:baofu')">
<text class="wi-txt">宝付提现</text>
</view>
<view class="wb-item" @click="$emit('click:douyin')">

2
src/utils/util.js

@ -95,7 +95,7 @@ export function showModal({
})
}
function debounce(func, wait, immediate) {
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result;
const later = function() {
// 据上一次触发时间间隔

Loading…
Cancel
Save