文件
xionggeshop/xgsc.gynhc.com_wx/pages/user/wallet/withdraw.vue
2026-09-14 17:24:53 +08:00

585 行
16 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<!-- 提现 -->
<template>
<view class="draw-money-wrap">
<view class="head-box">
<shopro-navbar :background="{ background: 'none' }" :backTextStyle="{ color: '#fff' }" backText="提现"
backIconColor="#fff"></shopro-navbar>
<!-- 可提现 -->
<view class="wallet-num-box u-flex u-col-center u-row-between">
<view class="">
<view class="num-title">可提现金额(元)</view>
<view class="wallet-num">{{ userInfo.money || '0.00' }}</view>
</view>
<button class="u-reset-button log-btn"
@tap="$Router.push({ path: '/pages/user/wallet/withdraw-log' })">提现记录</button>
</view>
</view>
<!-- 提现输入卡片-->
<view class="draw-card">
<!-- 分账进件绑定入口(分销商 / 区域公司) -->
<view class="onboard-entry u-flex u-row-between u-col-center" v-if="showOnboardBind" @tap="goToOnboardBind">
<view class="onboard-entry-left">
<view class="onboard-entry-title">分账进件绑定</view>
<view class="onboard-entry-desc">{{ onboardEntryDesc }}</view>
</view>
<view class="onboard-entry-right u-flex u-col-center">
<text class="onboard-status" :class="onboardStatusClass" v-if="onboardStatusText">{{ onboardStatusText }}</text>
<text class="u-iconfont uicon-arrow-right arrow-icon"></text>
</view>
</view>
<view class="card-title">提现金额</view>
<view class="input-box u-flex u-col-center">
<view calss="unit">¥</view>
<input class="u-flex-1 u-p-l-10" type="number" @input="onWithdrawInput" v-model="money"
:placeholder-style="placeholderStyle" placeholder="请输入提现金额" />
</view>
<view class="bank-box u-flex u-col-center u-row-between u-m-b-30" @tap="openWithdrawMethod">
<view class="name">提现至</view>
<view class="bank-list u-flex u-col-center">
<view class="empty-text" v-if="!withdrawType">请选择提现方式</view>
<view class="sel-box u-flex u-col-center" v-else>
<image class="item-img" :src="withdrawList[withdrawType].icon" mode=""></image>
<view class="item-title u-m-l-20">{{ withdrawList[withdrawType].title }}</view>
</view>
<text class="u-iconfont uicon-arrow-right arrow-icon"></text>
</view>
</view>
<!-- 提现账户信息 -->
<view class="bank-info u-m-b-80" v-if="withdrawType">
<view class="account-card u-flex u-row-between u-col-center" @tap="goToBind">
<view class="bank-info-title">
<block v-if="withdrawType === 'wechat'">
{{ !withdrawInfo ? '暂未绑定微信,点击去绑定' : `${withdrawInfo.real_name || ''} ${withdrawInfo.card_no || ''}` }}
</block>
<block v-else>
{{
!withdrawInfo
? `暂未绑定${withdrawList[withdrawType].title},点击去添加`
: `${withdrawInfo.bank_name || ''} ${withdrawInfo.card_no || ''} ${withdrawInfo.real_name || ''}`
}}
</block>
</view>
<view class="bind-link u-flex u-col-center">
<text>{{ withdrawInfo ? '修改' : (withdrawType === 'wechat' ? '绑定' : '添加') }}</text>
<text class="u-iconfont uicon-arrow-right"></text>
</view>
</view>
</view>
<!-- 提现规则(审核要求清晰展示) -->
<view class="draw-notice in-card" v-if="ruleInfo">
<view class="title">提现规则</view>
<view class="rule-row">
<text class="rule-label">可提现额度</text>
<text class="rule-value">当前余额 {{ userInfo.money || '0.00' }} 元;单次 {{ ruleInfo.min }}~{{ ruleInfo.max }} 元</text>
</view>
<view class="rule-row">
<text class="rule-label">每日提现次数</text>
<text class="rule-value">{{ perdayNumText }}</text>
</view>
<view class="rule-row">
<text class="rule-label">每日提现总额</text>
<text class="rule-value">{{ perdayAmountText }}</text>
</view>
<view class="rule-row">
<text class="rule-label">提现时间</text>
<text class="rule-value">全天 24 小时可提交申请;人工审核时间为工作日 9:00-18:00</text>
</view>
<view class="rule-row">
<text class="rule-label">到账时间</text>
<text class="rule-value">{{ arrivalTimeText }}</text>
</view>
<view class="rule-row">
<text class="rule-label">手续费</text>
<text class="rule-value">每笔收取 {{ ruleInfo.service_fee }}%(从提现金额中扣除)</text>
</view>
</view>
<button class="u-reset-button save-btn" @tap="withdraw">确认提现</button>
</view>
<view class="draw-notice" v-if="ruleInfo">
<view class="title">温馨提示</view>
<view class="draw-list">1. 请确保提现账户信息真实有效,姓名需与实名信息一致;</view>
<view class="draw-list">2. 提现审核结果将通过小程序消息或提现记录通知;</view>
<view class="draw-list">3. 如有疑问请及时联系在线客服。</view>
</view>
<!-- modal -->
<u-modal ref="uModal" v-model="showModal" :show-cancel-button="true" confirm-color="#1677FF"
cancel-color="#666666" @confirm="$Router.push('/pages/user/wallet/withdraw-log')" confirm-text="查看记录"
cancel-text="继续提现" content="您的申请提现已提交" title="申请成功"></u-modal>
</view>
</template>
<script>
import {
mapState,
mapActions,
mapGetters
} from 'vuex';
export default {
data() {
return {
showModal: false,
money: '', //提现金额
ruleInfo: '', //提现规则
showOnboardBind: false,
huifuStatus: {},
canSubmitOnboard: false,
withdrawType: '',
withdrawInfo: null, //提现信息
withdrawList: {
bank: {
icon: this.$IMG_URL + '/imgs/wallet/bank_type.png',
title: '银行卡转账',
value: 'bank'
},
wechat: {
icon: this.$IMG_URL + '/imgs/wallet/wx_type.png',
title: '微信零钱',
value: 'wechat'
},
alipay: {
icon: this.$IMG_URL + '/imgs/wallet/ali_type.png',
title: '支付宝账户',
value: 'alipay'
}
},
placeholderStyle: 'font-size: 30rpx; font-weight: 500;color:#C2C7CF;'
};
},
computed: {
...mapGetters(['userInfo', 'initRecharge']),
perdayNumText() {
if (!this.ruleInfo) return '-';
const num = Number(this.ruleInfo.perday_num);
return num > 0 ? `每日最多 ${num} 次` : '不限次数';
},
perdayAmountText() {
if (!this.ruleInfo) return '-';
const amount = Number(this.ruleInfo.perday_amount);
return amount > 0 ? `每日最多 ${amount} 元` : '不限金额';
},
arrivalTimeText() {
if (!this.ruleInfo) return '-';
const type = this.withdrawType;
const auto = !!this.ruleInfo.wechat_alipay_auto;
if (type === 'bank') {
return '人工审核通过后 1~3 个工作日到账(以银行处理为准)';
}
if ((type === 'wechat' || type === 'alipay') && auto) {
return '审核通过后自动打款,一般 1 小时内到账(以微信/支付宝处理为准)';
}
if (type === 'wechat' || type === 'alipay') {
return '人工审核通过后 1~3 个工作日到账(以微信/支付宝处理为准)';
}
return '审核通过后 1~3 个工作日到账(以实际渠道处理为准)';
},
onboardEntryDesc() {
if (this.canSubmitOnboard) return '请完善实名与银行卡信息';
const h = this.huifuStatus || {};
if (h.await_admin) return '资料已提交,等待平台审核';
if (h.status === 'busi_pending' || h.status === 'submitting' || h.status === 'basic_ok') {
return '汇付进件审核中';
}
if (h.status === 'rejected' || h.status === 'failed' || h.can_submit) {
return '进件被驳回,请修改后重新提交';
}
return '提现前请先完成分账进件绑定';
},
onboardStatusText() {
const h = this.huifuStatus || {};
const map = {
draft: '待审核',
submitting: '提交中',
basic_ok: '开户成功',
busi_pending: '审核中',
rejected: '已驳回',
failed: '失败'
};
if (h.can_submit) return '待修改';
if (h.await_admin) return '待审核';
if (h.status && map[h.status]) return map[h.status];
if (this.canSubmitOnboard) return '待填写';
return '';
},
onboardStatusClass() {
const h = this.huifuStatus || {};
if (h.can_submit || h.status === 'rejected' || h.status === 'failed') return 'is-warn';
if (h.await_admin || h.status === 'draft') return 'is-pending';
if (h.status === 'busi_pending' || h.status === 'submitting' || h.status === 'basic_ok') {
return 'is-pending';
}
if (this.canSubmitOnboard) return 'is-warn';
return '';
}
},
onLoad() {
this.getWithdrawRules();
this.loadOnboardBind();
uni.$on('SELECT_WITHDRAW_TYPE', this.onSelectWithdrawType);
uni.$on('WITHDRAW_BIND_SUCCESS', this.onBindSuccess);
},
onShow() {
this.loadOnboardBind();
},
onUnload() {
uni.$off('SELECT_WITHDRAW_TYPE', this.onSelectWithdrawType);
uni.$off('WITHDRAW_BIND_SUCCESS', this.onBindSuccess);
},
methods: {
onSelectWithdrawType({ type }) {
if (!type) return;
this.withdrawType = type;
this.getWithdrawInfo();
},
onBindSuccess() {
if (this.withdrawType) {
this.getWithdrawInfo();
}
},
openWithdrawMethod() {
if (!this.ruleInfo) {
this.$u.toast('提现规则加载中,请稍候');
return;
}
const methods = Array.isArray(this.ruleInfo.methods) ? this.ruleInfo.methods : [];
if (!methods.length) {
this.$u.toast('暂无可用的提现方式,请联系客服');
return;
}
this.$Router.push({
path: '/pages/user/wallet/withdraw-method',
query: { current: this.withdrawType || '' }
});
},
goToBind() {
if (!this.withdrawType) {
this.$u.toast('请先选择提现方式');
return;
}
this.$Router.push({
path: '/pages/user/wallet/bank-bind',
query: { type: this.withdrawType }
});
},
goToOnboardBind() {
this.$Router.push({ path: '/pages/user/wallet/onboard-bind' });
},
// 提现检验
onWithdrawInput(e) {
let sVal = String(e.detail.value);
sVal = sVal.replace(/\b(0+)/gi, '');
sVal = sVal.replace(/[^\d]/g, '');
this.money = sVal;
},
// 提现
withdraw() {
const that = this;
if (!this.withdrawType) {
this.$u.toast('请选择提现方式');
return;
}
if (this.money <= 0) {
this.$u.toast('请输入提现金额');
return;
}
that.$http(
'money.walletApply', {
type: that.withdrawType,
money: that.money
},
'申请中...',
false
).then(res => {
if (res.code === 1) {
that.money = '';
that.showModal = true;
// #ifdef MP-WEIXIN
this.$store.commit('subscribeMessage', 'wallet');
// #endif
that.$store.dispatch('getUserInfo');
} else {
that.$u.toast(res.msg);
}
});
},
loadOnboardBind() {
this.$http('money.walletOnboard', {}, '', false).then(res => {
if (res.code !== 1) return;
const data = res.data || {};
this.showOnboardBind = !!data.show;
this.huifuStatus = data.huifu_onboard || {};
this.canSubmitOnboard = !!data.can_submit_bind;
});
},
// 提现规则
getWithdrawRules() {
let that = this;
that.$http('money.walletRule').then(res => {
if (res.code === 1) {
that.ruleInfo = res.data;
const methods = Array.isArray(that.ruleInfo.methods) ? that.ruleInfo.methods : [];
if (!that.withdrawType && methods.length) {
that.withdrawType = methods[0];
that.getWithdrawInfo();
}
}
});
},
// 获取提现信息
getWithdrawInfo() {
let that = this;
that.$http(
'money.bankInfo', {
type: that.withdrawType
},
'',
false
).then(res => {
that.withdrawInfo = res.code === 1 ? res.data : null;
});
}
}
};
</script>
<style lang="scss">
.head-box {
// background: url($IMG_URL+'/imgs/user/draw_money_head_bg.png') no-repeat;
background: $brand-primary-gradient;
background-size: 100% auto;
min-height: 400rpx;
padding-bottom: var(--status-bar-height);
// 可提现
.wallet-num-box {
padding: 20rpx 40rpx 0;
.num-title {
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
margin-bottom: 20rpx;
}
.wallet-num {
font-size: 60rpx;
font-weight: 500;
color: #ffffff;
}
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
background: rgba(255, 255, 255, 0.1);
border: 1rpx solid #eeeeee;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
}
}
}
// 提现输入卡片
.draw-card {
background-color: #fff;
border-radius: 20rpx;
width: 690rpx;
min-height: 530rpx;
margin: -70rpx auto 0;
padding: 30rpx;
.onboard-entry {
padding: 24rpx;
margin-bottom: 30rpx;
background: #F5F7FA;
border-radius: 12rpx;
.onboard-entry-title {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
}
.onboard-entry-desc {
font-size: 24rpx;
color: #999;
line-height: 1.5;
}
.onboard-status {
font-size: 24rpx;
margin-right: 8rpx;
&.is-warn {
color: #ff6b00;
}
&.is-pending {
color: #1677FF;
}
}
.arrow-icon {
font-size: 28rpx;
color: #C4C4C4;
}
}
.card-title {
font-size: 30rpx;
font-weight: 500;
color: #333333;
margin-bottom: 30rpx;
}
.input-box {
width: 624rpx;
border-bottom: 1rpx solid #eee;
height: 100rpx;
margin-bottom: 40rpx;
.unit {
font-size: 48rpx;
color: #333;
}
}
.bank-box {
min-height: 88rpx;
padding: 16rpx 0;
.name {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
.bank-list {
.empty-text {
font-size: 28rpx;
font-weight: 400;
color: #999999;
}
.sel-box {
.item-img {
width: 36rpx;
height: 36rpx;
}
.item-title {
font-size: 28rpx;
color: #333333;
}
}
.arrow-icon {
font-size: 28rpx;
color: #C4C4C4;
margin-left: 12rpx;
}
}
}
.bank-info {
.account-card {
background: #F5F7FA;
border-radius: 12rpx;
padding: 24rpx;
min-height: 88rpx;
}
.bank-info-title {
flex: 1;
font-size: 26rpx;
color: #666;
line-height: 1.5;
padding-right: 20rpx;
}
.bind-link {
flex-shrink: 0;
font-size: 26rpx;
color: #1677FF;
font-weight: 500;
.uicon-arrow-right {
font-size: 24rpx;
margin-left: 4rpx;
}
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
background: $brand-primary-gradient;
box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
border-radius: 43rpx;
font-size: 30rpx;
font-weight: 500;
color: #ffffff;
}
}
// 提现规则 / 温馨提示
.draw-notice {
width: 684rpx;
min-height: 180rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 30rpx 35rpx;
margin: 20rpx auto;
&.in-card {
width: 100%;
margin: 0 0 30rpx;
padding: 24rpx 0 0;
background: transparent;
border-top: 1rpx solid #f0f0f0;
border-radius: 0;
}
.title {
font-size: 30rpx;
font-weight: 600;
color: #333333;
margin-bottom: 24rpx;
}
.rule-row {
display: flex;
align-items: flex-start;
margin-bottom: 18rpx;
line-height: 1.6;
.rule-label {
flex-shrink: 0;
width: 168rpx;
font-size: 26rpx;
font-weight: 500;
color: #333;
}
.rule-value {
flex: 1;
font-size: 24rpx;
color: #666;
}
}
.draw-list {
font-size: 24rpx;
font-weight: 400;
color: #999999;
margin-bottom: 10rpx;
line-height: 1.6;
}
}
</style>