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

184 行
4.9 KiB
Vue

<!-- 分账进件绑定 -->
<template>
<view class="onboard-bind-page brand-page">
<view class="page-wrap">
<shopro-navbar variant="gradient" backText="绑定银行卡"></shopro-navbar>
<view class="page-content" v-if="loaded">
<view class="role-card brand-card" v-if="onboardRoleText">
<view class="role-text">{{ onboardRoleText }}</view>
</view>
<view class="onboard-notice" v-if="onboardNoticeText">{{ onboardNoticeText }}</view>
<huifu-onboard-form
ref="huifuForm"
:required="huifuRequired"
:statusInfo="huifuStatus"
:readonly="huifuFormReadonly"
></huifu-onboard-form>
<view class="foot-box safe-area-inset-bottom" v-if="showOnboardSubmitBtn">
<button
class="u-reset-button save-btn"
@tap="submitOnboardBind"
:disabled="onboardSubmitting"
>{{ onboardSubmitText }}</button>
</view>
</view>
</view>
</view>
</template>
<script>
import HuifuOnboardForm from '@/components/huifu-onboard-form/huifu-onboard-form.vue';
export default {
components: { HuifuOnboardForm },
data() {
return {
loaded: false,
huifuRequired: false,
huifuStatus: {},
onboardRoleLabels: [],
canSubmitOnboard: false,
onboardSubmitting: false
};
},
computed: {
onboardRoleText() {
if (!this.onboardRoleLabels.length) return '';
return `适用角色:${this.onboardRoleLabels.join('、')}`;
},
huifuFormReadonly() {
if (!this.huifuRequired) return true;
return !this.canSubmitOnboard;
},
showOnboardSubmitBtn() {
return this.canSubmitOnboard;
},
onboardSubmitText() {
if (this.huifuStatus && this.huifuStatus.can_submit) return '重新提交进件资料';
return '提交开户认证';
},
onboardNoticeText() {
const h = this.huifuStatus || {};
if (h.can_submit) return '汇付进件被驳回,请修改下方资料后重新提交';
if (h.await_admin) return '进件资料已提交,请等待后台审核;审核通过后将自动提交汇付';
if (h.status === 'busi_pending' || h.status === 'submitting' || h.status === 'basic_ok') {
return '汇付进件审核中,请耐心等待';
}
if (h.status === 'approved') return '汇付进件已通过,分账功能已就绪';
if (h.status === 'rejected' || h.status === 'failed') {
return h.reject_reason ? `汇付进件被驳回:${h.reject_reason}` : '汇付进件被驳回,请修改后重新提交';
}
return '请填写实名与银行卡信息,提交后由平台审核';
}
},
onLoad() {
this.loadOnboardBind();
},
methods: {
loadOnboardBind() {
this.$http('money.walletOnboard', {}, '', false).then(res => {
if (res.code !== 1) {
this.$u.toast(res.msg || '加载失败');
setTimeout(() => this.$Router.back(), 1500);
return;
}
const data = res.data || {};
if (!data.show) {
this.$u.toast('当前无需绑定进件资料');
setTimeout(() => this.$Router.back(), 1500);
return;
}
this.huifuRequired = !!data.required;
this.huifuStatus = data.huifu_onboard || {};
this.onboardRoleLabels = Array.isArray(data.role_labels) ? data.role_labels : [];
this.canSubmitOnboard = !!data.can_submit_bind;
this.loaded = true;
});
},
submitOnboardBind() {
if (!this.$refs.huifuForm) return;
const valid = this.$refs.huifuForm.validate();
if (valid !== true) return;
this.onboardSubmitting = true;
this.$http(
'money.walletOnboardSubmit',
{ huifu_onboard: this.$refs.huifuForm.getPayload() },
'提交中...',
false
).then(res => {
this.onboardSubmitting = false;
if (res.code === 1) {
this.$u.toast(res.msg || '提交成功');
if (res.data) {
this.huifuStatus = res.data.huifu_onboard || {};
this.onboardRoleLabels = Array.isArray(res.data.role_labels) ? res.data.role_labels : [];
this.canSubmitOnboard = !!res.data.can_submit_bind;
if (!res.data.show) {
setTimeout(() => this.$Router.back(), 1500);
}
} else {
this.loadOnboardBind();
}
} else {
this.$u.toast(res.msg || '提交失败');
}
}).catch(() => {
this.onboardSubmitting = false;
});
}
}
};
</script>
<style lang="scss">
.onboard-bind-page {
min-height: 100vh;
background: #f5f7fa;
.page-content {
padding: 20rpx 30rpx 160rpx;
}
.role-card {
padding: 24rpx 28rpx;
margin-bottom: 20rpx;
.role-text {
font-size: 24rpx;
color: #999;
}
}
.onboard-notice {
margin-bottom: 20rpx;
padding: 20rpx 24rpx;
background: #f0f7ff;
border-radius: 12rpx;
font-size: 24rpx;
line-height: 1.6;
color: #1677FF;
}
.foot-box {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 20rpx 30rpx;
background: #fff;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
}
.save-btn {
width: 100%;
height: 86rpx;
line-height: 86rpx;
background: $brand-primary-gradient;
border-radius: 43rpx;
font-size: 30rpx;
font-weight: 500;
color: #fff;
}
}
</style>