Browse Source

对接完成商家中心提现相关接口,对接商家中心扫码输入金额

master
邓平艺 4 years ago
parent
commit
b34f21f604
  1. 4
      pages/business/center/center.vue
  2. 32
      pages/business/payment/money.vue
  3. 102
      pages/business/withdrawal/withdrawal.vue

4
pages/business/center/center.vue

@ -138,7 +138,9 @@
console.log(res);
//
let result = res.result;
this.$url('/pages/business/payment/money');
// TODO result
this.$url('/pages/business/payment/money?user_id=1');
}
})
}

32
pages/business/payment/money.vue

@ -23,15 +23,41 @@
export default {
data(){
return {
money: ''
money: '',
user_id: 0
}
},
onLoad(){
onLoad(options){
if(options.user_id){
this.user_id = options.user_id;
}else{
this.$msg('二维码错误', {icon: 'error'}).then(() => {
this.$toBack();
})
}
},
methods: {
confirm(){
if(!this.money) return this.$msg('请输入金额');
if(!this.$check(this.money, 'money')) return this.$msg('请输入正确的金额');
let token = this.$cookieStorage.get('store_token');
this.$http.post({
api: 'api/supplier/offline/order',
data: {
user_id: this.user_id,
amount: this.money
},
header: {
token: token
}
}).then(res => {
if(res.data.code == 200){
this.$url('/pages/business/payment/wait', {type: 'redirect'})
}else{
let msg = res.data.msg || '网络错误';
this.$msg(msg);
}
})
}
}
}

102
pages/business/withdrawal/withdrawal.vue

@ -2,19 +2,19 @@
<view>
<lf-nav title="提现" :showIcon="true" bgColor="#fff"></lf-nav>
<view class="tabs">
<view class="tab">
<view class="name" :class="{'active-tab': current == 0}" @click="current = 0">支付宝</view>
<view class="tab" v-for="(item, index) in tab_list" :key="index">
<view class="name"
:class="{'active-tab': current == index}"
@click="switchTab(index)">{{ item }}
</view>
<view class="tab">
<view class="name" :class="{'active-tab': current == 1}" @click="current = 1">银行卡</view>
</view>
</view>
<view class="content">
<!-- 店铺信息 -->
<view class="card">
<view class="lf-flex">
<image class="shop-avatar" mode="aspectFill" src="https://picsum.photos/id/237/200/300"></image>
<view class="shop-name">雅诗兰黛专卖店</view>
<image class="shop-avatar" mode="aspectFill" :src="brand.logo"></image>
<view class="shop-name">{{ brand.name }}</view>
</view>
</view>
<!-- 收款信息 - 提现到支付宝 -->
@ -79,7 +79,10 @@
</view>
<!-- 提现金额 -->
<view class="card">
<view class="lf-font-28 lf-color-222">提现金额</view>
<view class="lf-font-28 lf-color-222">
<text class="lf-m-r-10">提现金额</text>
<text class="lf-font-24">(当前可用余额{{ balance }})</text>
</view>
<view class="list money-list">
<view class="lf-flex">
<view class="symbol"></view>
@ -92,12 +95,10 @@
<view class="lf-font-28 lf-m-t-30" style="color: #F63434;" v-if="isMoney">输入金额超过可用余额</view>
</view>
<!-- 提现说明 -->
<view class="card">
<view class="card" v-if="remark.length">
<view class="lf-font-28 lf-color-555 lf-m-b-20">提现说明</view>
<view class="lf-font-28 lf-color-222">
<view>1提现到账时间为T+1</view>
<view>2提现最高单笔为10000元</view>
<view>3提现手续单笔收费10%</view>
<view v-for="(item, index) in remark" :key="index">{{ item }}</view>
</view>
</view>
<button class="confirm" hover-class="lf-opacity" @click="confirm">确认提现</button>
@ -109,6 +110,7 @@
export default {
data(){
return {
tab_list: ['支付宝', '银行卡'],
current: 0, // 01
alipay_name: '', //
alipay_account: '', //
@ -116,19 +118,41 @@
bank_sub_branch: '', //
bank_number: '', //
bank_account_name: '', //
money: '' //
money: '', //
token: '',
remark: [], //
brand: {}, //
balance: 0 //
}
},
computed: {
isMoney(){
// TODO 10
return Number(this.money) > 10;
return Number(this.money) > this.balance;
}
},
onLoad(){
let token = this.$cookieStorage.get('store_token');
this.token = token;
this.getApplyInfo();
},
methods: {
//
getApplyInfo(){
this.$http.get({
api: 'api/supplier/apply_info',
header: {
token: this.token
}
}).then(res => {
this.balance = res.data.data.balance;
this.brand = res.data.data.brand;
this.remark = res.data.data.remark;
})
},
// tab
switchTab(index){
this.current = index;
},
confirm(){
if(this.current == 0){
//
@ -137,7 +161,7 @@
if(!this.money) return this.$msg('请输入提现金额');
if(this.isMoney) return this.$msg('提现金额超出当前余额');
if(this.money <= 0) return this.$msg('提现金额需大于0');
this.launch();
this.launch('alipay');
}else if(this.current == 1){
//
if(!this.bank_name) return this.$msg('请输入银行名称');
@ -147,12 +171,50 @@
if(!this.money) return this.$msg('请输入提现金额');
if(this.isMoney) return this.$msg('提现金额超出当前余额');
if(this.money <= 0) return this.$msg('提现金额需大于0');
this.launch();
this.launch('bankcard');
}
},
launch(){
// TODO
console.log("发起提现");
launch(type_name){
uni.showLoading({
title: '正在提现中'
})
let par = {
type: type_name,
value: this.money
};
if(type_name == 'bankcard'){
par.bank_name = this.bank_name;
par.bank_branch = this.bank_sub_branch;
par.bank_number = this.bank_number;
par.bank_username = this.bank_account_name;
}else if(type_name == 'alipay'){
par.alipay_name = this.alipay_name;
par.alipay_account = this.alipay_account;
}
this.$http.post({
api: 'api/supplier/cash_apply',
data: par,
header: {
token: this.token
}
}).then(res => {
if(res.data.code == 200){
if(type_name == 'bankcard'){
this.bank_name = '';
this.bank_sub_branch = '';
this.bank_number = '';
this.bank_account_name = '';
}else if(type_name == 'alipay'){
this.alipay_name = '';
this.alipay_account = '';
}
this.money = '';
this.$msg('提现成功', {icon: 'success'});
this.getApplyInfo();
}
uni.hideLoading();
}).catch(err => uni.hideLoading());
}
}
}

Loading…
Cancel
Save