654 行
32 KiB
Vue
654 行
32 KiB
Vue
<!-- 汇付进件表单:个人 / 个体户·企业 -->
|
||
<template>
|
||
<view class="huifu-onboard brand-card" id="huifu-section" v-if="required">
|
||
<view class="huifu-head">
|
||
<view class="huifu-head-row">
|
||
<view class="huifu-badge">汇付</view>
|
||
<view class="huifu-head-text">
|
||
<view class="section-title">绑定银行卡</view>
|
||
<view class="tip">填写开户资料,先由平台审核,通过后再提交汇付</view>
|
||
</view>
|
||
</view>
|
||
<view class="status-pill" v-if="statusInfo && statusInfo.status" :class="'is-' + statusInfo.status">
|
||
{{ statusText(statusInfo.status) }}
|
||
</view>
|
||
</view>
|
||
|
||
<view class="form-section">
|
||
<view class="section-label required">结算账户类型</view>
|
||
<view class="type-row">
|
||
<view
|
||
class="type-item"
|
||
v-for="item in accountTypeOptions"
|
||
:key="item.value"
|
||
:class="{ active: form.account_type === item.value, disabled: readonly }"
|
||
@tap="setAccountType(item.value)"
|
||
>
|
||
<text class="type-check">{{ form.account_type === item.value ? '✓' : '' }}</text>
|
||
<text>{{ item.label }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 个人:身份实名信息 -->
|
||
<view class="form-section" v-if="form.account_type === 'indv'">
|
||
<view class="section-label">身份实名信息</view>
|
||
<view class="field" id="field-name" :class="{ 'is-error': fieldErrors.name }">
|
||
<text class="field-label required">真实姓名</text>
|
||
<text class="field-hint">银行卡绑定的用户姓名</text>
|
||
<input class="field-input" v-model="form.name" placeholder="请输入真实姓名" placeholder-class="ph" :disabled="readonly" @input="clearError('name')" />
|
||
<text class="field-error" v-if="fieldErrors.name">{{ fieldErrors.name }}</text>
|
||
</view>
|
||
<view class="field" id="field-cert_no" :class="{ 'is-error': fieldErrors.cert_no }">
|
||
<text class="field-label required">身份证号</text>
|
||
<text class="field-hint">18 位二代身份证号码</text>
|
||
<input class="field-input" v-model="form.cert_no" maxlength="18" placeholder="请输入身份证号" placeholder-class="ph" :disabled="readonly" @input="clearError('cert_no')" />
|
||
<text class="field-error" v-if="fieldErrors.cert_no">{{ fieldErrors.cert_no }}</text>
|
||
</view>
|
||
<view class="field" id="field-cert_end_date" :class="{ 'is-error': fieldErrors.cert_end_date }">
|
||
<text class="field-label required">身份证有效期至</text>
|
||
<text class="field-hint">长期有效请选择 2099-12-31</text>
|
||
<picker mode="date" :value="certEndPickerValue" @change="onCertEndChange" :disabled="readonly">
|
||
<view class="field-input is-picker">
|
||
<text :class="{ ph: !form.cert_end_date }">{{ certEndDisplay || '请选择日期' }}</text>
|
||
<text class="arrow">›</text>
|
||
</view>
|
||
</picker>
|
||
<text class="field-error" v-if="fieldErrors.cert_end_date">{{ fieldErrors.cert_end_date }}</text>
|
||
</view>
|
||
<view class="field" id="field-region" :class="{ 'is-error': fieldErrors.prov_id }">
|
||
<text class="field-label required">所在区域</text>
|
||
<view class="field-input is-picker" @tap="openRegionPicker">
|
||
<text :class="{ ph: !regionText }">{{ regionText || '请选择省/市/区' }}</text>
|
||
<text class="arrow">›</text>
|
||
</view>
|
||
<text class="field-error" v-if="fieldErrors.prov_id">{{ fieldErrors.prov_id }}</text>
|
||
</view>
|
||
<view class="field" id="field-reg_detail" :class="{ 'is-error': fieldErrors.reg_detail }">
|
||
<text class="field-label required">详细地址</text>
|
||
<input class="field-input" v-model="form.reg_detail" placeholder="请输入详细居住地址" placeholder-class="ph" :disabled="readonly" @input="clearError('reg_detail')" />
|
||
<text class="field-error" v-if="fieldErrors.reg_detail">{{ fieldErrors.reg_detail }}</text>
|
||
</view>
|
||
<view class="upload-grid">
|
||
<view class="upload-cell" id="field-id_card_front_url" :class="{ 'is-error': fieldErrors.id_card_front_url }">
|
||
<text class="upload-label required">身份证人像面</text>
|
||
<u-upload :file-list="frontList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onFrontSuccess" @on-uploaded="onFrontUploaded" @on-error="onUploadError('id_card_front_url', '身份证人像面')" @on-remove="onFrontRemoved"></u-upload>
|
||
<text class="field-error" v-if="fieldErrors.id_card_front_url">{{ fieldErrors.id_card_front_url }}</text>
|
||
</view>
|
||
<view class="upload-cell" id="field-id_card_back_url" :class="{ 'is-error': fieldErrors.id_card_back_url }">
|
||
<text class="upload-label required">身份证国徽面</text>
|
||
<u-upload :file-list="backList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onBackSuccess" @on-uploaded="onBackUploaded" @on-error="onUploadError('id_card_back_url', '身份证国徽面')" @on-remove="onBackRemoved"></u-upload>
|
||
<text class="field-error" v-if="fieldErrors.id_card_back_url">{{ fieldErrors.id_card_back_url }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 企业:商户信息 -->
|
||
<view class="form-section" v-else>
|
||
<view class="section-label">商户信息</view>
|
||
<view class="field" id="field-reg_name" :class="{ 'is-error': fieldErrors.reg_name }">
|
||
<text class="field-label required">商户名称</text>
|
||
<text class="field-hint">请输入营业执照上的名称</text>
|
||
<input class="field-input" v-model="form.reg_name" placeholder="请输入商户名称" placeholder-class="ph" :disabled="readonly" @input="clearError('reg_name')" />
|
||
<text class="field-error" v-if="fieldErrors.reg_name">{{ fieldErrors.reg_name }}</text>
|
||
</view>
|
||
<view class="field" id="field-license_code" :class="{ 'is-error': fieldErrors.license_code }">
|
||
<text class="field-label required">统一社会信用代码</text>
|
||
<input class="field-input" v-model="form.license_code" maxlength="18" placeholder="请输入统一社会信用代码" placeholder-class="ph" :disabled="readonly" @input="clearError('license_code')" />
|
||
<text class="field-error" v-if="fieldErrors.license_code">{{ fieldErrors.license_code }}</text>
|
||
</view>
|
||
<view class="field" id="field-license_end_date" :class="{ 'is-error': fieldErrors.license_end_date }">
|
||
<text class="field-label required">统一社会信用代码有效期</text>
|
||
<text class="field-hint">长期有效请选择 2099-12-31</text>
|
||
<picker mode="date" :value="licenseEndPickerValue" @change="onLicenseEndChange" :disabled="readonly">
|
||
<view class="field-input is-picker">
|
||
<text :class="{ ph: !form.license_end_date }">{{ licenseEndDisplay || '请选择日期' }}</text>
|
||
<text class="arrow">›</text>
|
||
</view>
|
||
</picker>
|
||
<text class="field-error" v-if="fieldErrors.license_end_date">{{ fieldErrors.license_end_date }}</text>
|
||
</view>
|
||
<view class="field" id="field-ent-region" :class="{ 'is-error': fieldErrors.prov_id }">
|
||
<text class="field-label required">所在区域</text>
|
||
<view class="field-input is-picker" @tap="openRegionPicker">
|
||
<text :class="{ ph: !regionText }">{{ regionText || '请选择省/市/区' }}</text>
|
||
<text class="arrow">›</text>
|
||
</view>
|
||
<text class="field-error" v-if="fieldErrors.prov_id">{{ fieldErrors.prov_id }}</text>
|
||
</view>
|
||
<view class="field" id="field-ent-reg_detail" :class="{ 'is-error': fieldErrors.reg_detail }">
|
||
<text class="field-label required">企业地址</text>
|
||
<input class="field-input" v-model="form.reg_detail" placeholder="请输入企业经营地址" placeholder-class="ph" :disabled="readonly" @input="clearError('reg_detail')" />
|
||
<text class="field-error" v-if="fieldErrors.reg_detail">{{ fieldErrors.reg_detail }}</text>
|
||
</view>
|
||
<view class="field" id="field-legal_name" :class="{ 'is-error': fieldErrors.legal_name }">
|
||
<text class="field-label required">法人姓名</text>
|
||
<input class="field-input" v-model="form.legal_name" placeholder="请输入法人姓名" placeholder-class="ph" :disabled="readonly" @input="clearError('legal_name')" />
|
||
<text class="field-error" v-if="fieldErrors.legal_name">{{ fieldErrors.legal_name }}</text>
|
||
</view>
|
||
<view class="field" id="field-legal_mobile" :class="{ 'is-error': fieldErrors.legal_mobile }">
|
||
<text class="field-label required">法人手机号</text>
|
||
<input class="field-input" v-model="form.legal_mobile" type="number" maxlength="11" placeholder="请输入法人手机号" placeholder-class="ph" :disabled="readonly" @input="clearError('legal_mobile')" />
|
||
<text class="field-error" v-if="fieldErrors.legal_mobile">{{ fieldErrors.legal_mobile }}</text>
|
||
</view>
|
||
<view class="field" id="field-legal_cert_no" :class="{ 'is-error': fieldErrors.legal_cert_no }">
|
||
<text class="field-label required">法人身份证号</text>
|
||
<input class="field-input" v-model="form.legal_cert_no" maxlength="18" placeholder="请输入法人身份证号" placeholder-class="ph" :disabled="readonly" @input="clearError('legal_cert_no')" />
|
||
<text class="field-error" v-if="fieldErrors.legal_cert_no">{{ fieldErrors.legal_cert_no }}</text>
|
||
</view>
|
||
<view class="field" id="field-legal_cert_end_date" :class="{ 'is-error': fieldErrors.legal_cert_end_date }">
|
||
<text class="field-label required">法人身份证有效期</text>
|
||
<picker mode="date" :value="legalCertEndPickerValue" @change="onLegalCertEndChange" :disabled="readonly">
|
||
<view class="field-input is-picker">
|
||
<text :class="{ ph: !form.legal_cert_end_date }">{{ legalCertEndDisplay || '请选择日期' }}</text>
|
||
<text class="arrow">›</text>
|
||
</view>
|
||
</picker>
|
||
<text class="field-error" v-if="fieldErrors.legal_cert_end_date">{{ fieldErrors.legal_cert_end_date }}</text>
|
||
</view>
|
||
<view class="upload-grid">
|
||
<view class="upload-cell" id="field-license_url" :class="{ 'is-error': fieldErrors.license_url }">
|
||
<text class="upload-label required">营业执照照片</text>
|
||
<u-upload :file-list="licenseList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onLicenseSuccess" @on-uploaded="onLicenseUploaded" @on-remove="onLicenseRemoved"></u-upload>
|
||
<text class="field-error" v-if="fieldErrors.license_url">{{ fieldErrors.license_url }}</text>
|
||
</view>
|
||
<view class="upload-cell" id="field-legal_id_front_url" :class="{ 'is-error': fieldErrors.legal_id_front_url }">
|
||
<text class="upload-label required">法人身份证人像面</text>
|
||
<u-upload :file-list="legalFrontList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onLegalFrontSuccess" @on-uploaded="onLegalFrontUploaded" @on-remove="onLegalFrontRemoved"></u-upload>
|
||
<text class="field-error" v-if="fieldErrors.legal_id_front_url">{{ fieldErrors.legal_id_front_url }}</text>
|
||
</view>
|
||
<view class="upload-cell" id="field-legal_id_back_url" :class="{ 'is-error': fieldErrors.legal_id_back_url }">
|
||
<text class="upload-label required">法人身份证国徽面</text>
|
||
<u-upload :file-list="legalBackList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onLegalBackSuccess" @on-uploaded="onLegalBackUploaded" @on-remove="onLegalBackRemoved"></u-upload>
|
||
<text class="field-error" v-if="fieldErrors.legal_id_back_url">{{ fieldErrors.legal_id_back_url }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 结算账户信息 -->
|
||
<view class="form-section">
|
||
<view class="section-label">结算账户信息</view>
|
||
<view class="type-row" v-if="form.account_type === 'ent'">
|
||
<view
|
||
class="type-item small"
|
||
v-for="item in bankAccountTypeOptions"
|
||
:key="item.value"
|
||
:class="{ active: form.bank_account_type === item.value, disabled: readonly }"
|
||
@tap="setBankAccountType(item.value)"
|
||
>
|
||
<text class="type-check">{{ form.bank_account_type === item.value ? '✓' : '' }}</text>
|
||
<text>{{ item.label }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="field" id="field-card_no" :class="{ 'is-error': fieldErrors.card_no }">
|
||
<text class="field-label required">结算账户银行卡号</text>
|
||
<text class="field-hint">分成资金到账银行卡号,须为一类借记卡</text>
|
||
<input class="field-input" v-model="form.card_no" type="number" placeholder="请输入结算银行卡号" placeholder-class="ph" :disabled="readonly" @input="clearError('card_no')" />
|
||
<text class="field-error" v-if="fieldErrors.card_no">{{ fieldErrors.card_no }}</text>
|
||
</view>
|
||
<view class="field" id="field-branch_name" :class="{ 'is-error': fieldErrors.branch_name }">
|
||
<text class="field-label required">开户银行名称</text>
|
||
<text class="field-hint">搜索支行名称,系统将自动匹配联行号</text>
|
||
<input class="field-input" v-model="branchKeyword" placeholder="例如:农业银行贵阳总府支行" placeholder-class="ph" :disabled="readonly" @input="onBranchInput" @focus="onBranchInput" />
|
||
<view class="branch-panel" v-if="branchResults.length && !readonly">
|
||
<view class="branch-item" v-for="(item, idx) in branchResults" :key="idx" @tap="selectBranch(item)">
|
||
<text class="branch-name">{{ item.branch_name }}</text>
|
||
<text class="branch-code">{{ item.branch_code }}</text>
|
||
</view>
|
||
</view>
|
||
<text class="field-hint" v-if="form.branch_name">已选:{{ form.branch_name }}</text>
|
||
<text class="field-error" v-if="fieldErrors.branch_name">{{ fieldErrors.branch_name }}</text>
|
||
</view>
|
||
<view class="field" v-if="form.account_type === 'ent' && form.bank_account_type === '0'">
|
||
<text class="field-label required">银行卡户名</text>
|
||
<text class="field-hint">须为法人姓名</text>
|
||
<input class="field-input" :value="form.legal_name" disabled placeholder-class="ph" />
|
||
</view>
|
||
<view class="field" v-if="form.account_type === 'indv' || (form.account_type === 'ent' && form.bank_account_type === '0')" id="field-mobile_no" :class="{ 'is-error': fieldErrors.mobile_no }">
|
||
<text class="field-label required">{{ form.account_type === 'ent' ? '手机号' : '手机号' }}</text>
|
||
<text class="field-hint">银行卡开户预留的手机号</text>
|
||
<input class="field-input" v-model="bankMobile" type="number" maxlength="11" placeholder="请输入银行预留手机号" placeholder-class="ph" :disabled="readonly" @input="clearError('mobile_no')" />
|
||
<text class="field-error" v-if="fieldErrors.mobile_no">{{ fieldErrors.mobile_no }}</text>
|
||
</view>
|
||
<view class="field upload-bank">
|
||
<text class="field-label">银行卡正面照</text>
|
||
<text class="field-hint">建议上传,可加快审核</text>
|
||
<u-upload :file-list="bankList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onBankSuccess" @on-uploaded="onBankUploaded" @on-remove="onBankRemoved"></u-upload>
|
||
</view>
|
||
<view class="field upload-bank" v-if="form.account_type === 'ent' && form.bank_account_type === '1'">
|
||
<text class="field-label required">开户许可证/基本户证明</text>
|
||
<u-upload :file-list="permitList" :action="`${$API_URL}/index/upload`" :header="uploadHeader" maxCount="1" width="200" height="140" :deletable="!readonly" :disabled="readonly" @on-success="onPermitSuccess" @on-uploaded="onPermitUploaded" @on-remove="onPermitRemoved"></u-upload>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="reject-box" v-if="statusInfo && statusInfo.reject_reason">
|
||
<text class="reject-label">驳回原因</text>
|
||
<text class="reject-text">{{ statusInfo.reject_reason }}</text>
|
||
</view>
|
||
|
||
<u-select mode="mutil-column-auto" safe-area-inset-bottom :list="addressAreaList" v-model="showRegionSelect" @confirm="onRegionConfirm"></u-select>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
name: 'HuifuOnboardForm',
|
||
props: {
|
||
required: { type: Boolean, default: false },
|
||
statusInfo: { type: Object, default: () => ({}) },
|
||
readonly: { type: Boolean, default: false }
|
||
},
|
||
data() {
|
||
return {
|
||
accountTypeOptions: [
|
||
{ label: '个体户/企业', value: 'ent' },
|
||
{ label: '个人', value: 'indv' }
|
||
],
|
||
bankAccountTypeOptions: [
|
||
{ label: '对公', value: '1' },
|
||
{ label: '对私', value: '0' }
|
||
],
|
||
form: {
|
||
account_type: 'indv',
|
||
bank_account_type: '0',
|
||
name: '',
|
||
cert_no: '',
|
||
cert_validity_type: '1',
|
||
cert_begin_date: '20000101',
|
||
cert_end_date: '',
|
||
mobile_no: '',
|
||
reg_name: '',
|
||
license_code: '',
|
||
license_validity_type: '1',
|
||
license_begin_date: '20000101',
|
||
license_end_date: '',
|
||
legal_name: '',
|
||
legal_mobile: '',
|
||
legal_cert_no: '',
|
||
legal_cert_validity_type: '1',
|
||
legal_cert_begin_date: '20000101',
|
||
legal_cert_end_date: '',
|
||
reg_detail: '',
|
||
shopro_province_id: '',
|
||
shopro_city_id: '',
|
||
shopro_district_id: '',
|
||
prov_id: '',
|
||
area_id: '',
|
||
district_id: '',
|
||
card_no: '',
|
||
card_name: '',
|
||
branch_code: '',
|
||
branch_name: '',
|
||
mp: '',
|
||
id_card_front_url: '',
|
||
id_card_back_url: '',
|
||
license_url: '',
|
||
legal_id_front_url: '',
|
||
legal_id_back_url: '',
|
||
bank_card_url: '',
|
||
account_permit_url: ''
|
||
},
|
||
regionText: '',
|
||
showRegionSelect: false,
|
||
addressAreaList: [],
|
||
branchKeyword: '',
|
||
branchResults: [],
|
||
branchTimer: null,
|
||
frontList: [],
|
||
backList: [],
|
||
licenseList: [],
|
||
legalFrontList: [],
|
||
legalBackList: [],
|
||
bankList: [],
|
||
permitList: [],
|
||
fieldErrors: {}
|
||
};
|
||
},
|
||
computed: {
|
||
uploadHeader() {
|
||
return { token: uni.getStorageSync('token') || '' };
|
||
},
|
||
bankMobile: {
|
||
get() {
|
||
return this.form.account_type === 'ent' ? this.form.legal_mobile : this.form.mobile_no;
|
||
},
|
||
set(val) {
|
||
if (this.form.account_type === 'ent') {
|
||
this.form.legal_mobile = val;
|
||
} else {
|
||
this.form.mobile_no = val;
|
||
}
|
||
this.form.mp = val;
|
||
}
|
||
},
|
||
certEndPickerValue() {
|
||
return this.pickerDate(this.form.cert_end_date);
|
||
},
|
||
certEndDisplay() {
|
||
return this.displayDate(this.form.cert_end_date);
|
||
},
|
||
licenseEndPickerValue() {
|
||
return this.pickerDate(this.form.license_end_date);
|
||
},
|
||
licenseEndDisplay() {
|
||
return this.displayDate(this.form.license_end_date);
|
||
},
|
||
legalCertEndPickerValue() {
|
||
return this.pickerDate(this.form.legal_cert_end_date);
|
||
},
|
||
legalCertEndDisplay() {
|
||
return this.displayDate(this.form.legal_cert_end_date);
|
||
}
|
||
},
|
||
mounted() {
|
||
this.loadArea();
|
||
},
|
||
methods: {
|
||
loadArea() {
|
||
this.$http('address.area').then(res => {
|
||
if (res.code !== 1) return;
|
||
const { provinceData, cityData, areaData } = res.data || {};
|
||
const list = [];
|
||
(provinceData || []).forEach((item, index) => {
|
||
list.push({ ...item, children: [] });
|
||
list[index].children.push(...((cityData && cityData[index]) || []));
|
||
list[index].children.forEach((city, cityIndex) => {
|
||
city.children = [...(((areaData && areaData[index]) && areaData[index][cityIndex]) || [])];
|
||
});
|
||
});
|
||
this.addressAreaList = list;
|
||
});
|
||
},
|
||
setAccountType(value) {
|
||
if (this.readonly) return;
|
||
this.form.account_type = value;
|
||
if (value === 'indv') {
|
||
this.form.bank_account_type = '0';
|
||
}
|
||
},
|
||
setBankAccountType(value) {
|
||
if (this.readonly) return;
|
||
this.form.bank_account_type = value;
|
||
},
|
||
openRegionPicker() {
|
||
if (this.readonly) return;
|
||
if (!this.addressAreaList.length) {
|
||
this.$u.toast('区域数据加载中,请稍候');
|
||
return;
|
||
}
|
||
this.showRegionSelect = true;
|
||
},
|
||
onRegionConfirm(e) {
|
||
if (!e || !e.length) return;
|
||
this.form.shopro_province_id = e[0].value;
|
||
this.form.shopro_city_id = e[1] ? e[1].value : '';
|
||
this.form.shopro_district_id = e[2] ? e[2].value : '';
|
||
this.form.prov_id = String(e[0].value);
|
||
this.form.area_id = e[1] ? String(e[1].value) : '';
|
||
this.form.district_id = e[2] ? String(e[2].value) : '';
|
||
this.regionText = e.map(i => i.label).join(' / ');
|
||
this.clearError('prov_id');
|
||
},
|
||
applyValidityByEnd(prefix, endDate) {
|
||
const ymd = (endDate || '').replace(/-/g, '');
|
||
this.form[prefix + '_end_date'] = ymd;
|
||
if (endDate === '2099-12-31' || ymd === '20991231') {
|
||
this.form[prefix + '_validity_type'] = '1';
|
||
this.form[prefix + '_begin_date'] = this.form[prefix + '_begin_date'] || '20000101';
|
||
} else {
|
||
this.form[prefix + '_validity_type'] = '0';
|
||
if (!this.form[prefix + '_begin_date']) {
|
||
this.form[prefix + '_begin_date'] = '20000101';
|
||
}
|
||
}
|
||
},
|
||
onCertEndChange(e) {
|
||
this.applyValidityByEnd('cert', e.detail.value);
|
||
this.clearError('cert_end_date');
|
||
},
|
||
onLicenseEndChange(e) {
|
||
this.applyValidityByEnd('license', e.detail.value);
|
||
this.clearError('license_end_date');
|
||
},
|
||
onLegalCertEndChange(e) {
|
||
this.applyValidityByEnd('legal_cert', e.detail.value);
|
||
this.clearError('legal_cert_end_date');
|
||
},
|
||
onBranchInput() {
|
||
if (this.readonly) return;
|
||
clearTimeout(this.branchTimer);
|
||
const keyword = (this.branchKeyword || '').trim();
|
||
if (keyword.length < 2) {
|
||
this.branchResults = [];
|
||
return;
|
||
}
|
||
this.branchTimer = setTimeout(() => this.searchBranch(keyword), 300);
|
||
},
|
||
searchBranch(keyword) {
|
||
this.$http('huifuOnboard.searchBranch', { keyword, city_code: this.form.area_id || '' }, '', false).then(res => {
|
||
if (res.code === 1) {
|
||
this.branchResults = (res.data && res.data.list) || [];
|
||
}
|
||
});
|
||
},
|
||
selectBranch(item) {
|
||
this.form.branch_code = item.branch_code;
|
||
this.form.branch_name = item.branch_name;
|
||
this.branchKeyword = item.branch_name;
|
||
this.branchResults = [];
|
||
if (item.prov_id) this.form.prov_id = item.prov_id;
|
||
if (item.area_id) this.form.area_id = item.area_id;
|
||
this.clearError('branch_name');
|
||
},
|
||
pickerDate(ymd) {
|
||
if (!ymd || String(ymd).length !== 8) return '';
|
||
const s = String(ymd);
|
||
return `${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)}`;
|
||
},
|
||
displayDate(ymd) {
|
||
return this.pickerDate(ymd);
|
||
},
|
||
clearError(field) {
|
||
if (this.fieldErrors[field]) this.$delete(this.fieldErrors, field);
|
||
},
|
||
failField(field, message) {
|
||
this.fieldErrors = { [field]: message };
|
||
this.$u.toast(message);
|
||
return { field, message };
|
||
},
|
||
pickUploadUrl(payload) {
|
||
if (!payload) return '';
|
||
let data = payload;
|
||
if (typeof data === 'string') {
|
||
try { data = JSON.parse(data); } catch (e) { return data.indexOf('/') >= 0 ? data : ''; }
|
||
}
|
||
if (data.code === 1 && data.data) {
|
||
if (typeof data.data === 'string') return data.data;
|
||
if (data.data.fullurl) return data.data.fullurl;
|
||
if (data.data.url) return data.data.url;
|
||
}
|
||
if (data.fullurl) return data.fullurl;
|
||
if (data.url) return data.url;
|
||
return '';
|
||
},
|
||
assignPhoto(field, lists, responseData, listKey) {
|
||
if (lists) this[listKey] = lists;
|
||
const url = this.pickUploadUrl(responseData) || this.extractUrlFromLists(lists);
|
||
if (url === '__uploading__') return;
|
||
if (url) {
|
||
this.form[field] = url;
|
||
this.clearError(field);
|
||
}
|
||
},
|
||
extractUrlFromLists(lists) {
|
||
if (!lists || !lists.length) return '';
|
||
const item = lists[lists.length - 1];
|
||
if (item.progress > 0 && item.progress < 100) return '__uploading__';
|
||
return this.pickUploadUrl(item.response);
|
||
},
|
||
onUploadError(field, label) {
|
||
this.form[field] = '';
|
||
this.failField(field, label + '上传失败,请重试');
|
||
},
|
||
onFrontSuccess(d, i, l) { this.assignPhoto('id_card_front_url', l, d, 'frontList'); },
|
||
onFrontUploaded(l) { this.assignPhoto('id_card_front_url', l, null, 'frontList'); },
|
||
onFrontRemoved() { this.form.id_card_front_url = ''; this.frontList = []; },
|
||
onBackSuccess(d, i, l) { this.assignPhoto('id_card_back_url', l, d, 'backList'); },
|
||
onBackUploaded(l) { this.assignPhoto('id_card_back_url', l, null, 'backList'); },
|
||
onBackRemoved() { this.form.id_card_back_url = ''; this.backList = []; },
|
||
onLicenseSuccess(d, i, l) { this.assignPhoto('license_url', l, d, 'licenseList'); },
|
||
onLicenseUploaded(l) { this.assignPhoto('license_url', l, null, 'licenseList'); },
|
||
onLicenseRemoved() { this.form.license_url = ''; this.licenseList = []; },
|
||
onLegalFrontSuccess(d, i, l) { this.assignPhoto('legal_id_front_url', l, d, 'legalFrontList'); },
|
||
onLegalFrontUploaded(l) { this.assignPhoto('legal_id_front_url', l, null, 'legalFrontList'); },
|
||
onLegalFrontRemoved() { this.form.legal_id_front_url = ''; this.legalFrontList = []; },
|
||
onLegalBackSuccess(d, i, l) { this.assignPhoto('legal_id_back_url', l, d, 'legalBackList'); },
|
||
onLegalBackUploaded(l) { this.assignPhoto('legal_id_back_url', l, null, 'legalBackList'); },
|
||
onLegalBackRemoved() { this.form.legal_id_back_url = ''; this.legalBackList = []; },
|
||
onBankSuccess(d, i, l) { this.assignPhoto('bank_card_url', l, d, 'bankList'); },
|
||
onBankUploaded(l) { this.assignPhoto('bank_card_url', l, null, 'bankList'); },
|
||
onBankRemoved() { this.form.bank_card_url = ''; this.bankList = []; },
|
||
onPermitSuccess(d, i, l) { this.assignPhoto('account_permit_url', l, d, 'permitList'); },
|
||
onPermitUploaded(l) { this.assignPhoto('account_permit_url', l, null, 'permitList'); },
|
||
onPermitRemoved() { this.form.account_permit_url = ''; this.permitList = []; },
|
||
isFutureDateYmd(ymd) {
|
||
if (!ymd || String(ymd).length !== 8) return false;
|
||
const s = String(ymd);
|
||
const end = new Date(`${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)}T00:00:00`);
|
||
const today = new Date();
|
||
today.setHours(0, 0, 0, 0);
|
||
return end.getTime() > today.getTime();
|
||
},
|
||
normalizePayloadDates(payload) {
|
||
['cert', 'license', 'legal_cert'].forEach(prefix => {
|
||
const typeKey = `${prefix}_validity_type`;
|
||
const endKey = `${prefix}_end_date`;
|
||
if (payload[typeKey] === '1') {
|
||
delete payload[endKey];
|
||
}
|
||
});
|
||
return payload;
|
||
},
|
||
getPayload() {
|
||
const payload = { ...this.form };
|
||
payload.mp = this.bankMobile;
|
||
if (payload.account_type === 'indv') {
|
||
payload.card_name = payload.name;
|
||
} else if (payload.bank_account_type === '1') {
|
||
payload.card_name = payload.reg_name;
|
||
} else {
|
||
payload.card_name = payload.legal_name;
|
||
}
|
||
return this.normalizePayloadDates(payload);
|
||
},
|
||
validate() {
|
||
if (!this.required) return true;
|
||
this.fieldErrors = {};
|
||
const f = this.form;
|
||
if (!f.prov_id || !f.area_id) return this.failField('prov_id', '请选择所在区域');
|
||
if (!f.branch_code && !(this.branchKeyword || f.branch_name)) {
|
||
return this.failField('branch_name', '请搜索并选择开户银行支行');
|
||
}
|
||
if (!f.branch_name && this.branchKeyword) {
|
||
f.branch_name = this.branchKeyword.trim();
|
||
}
|
||
if (f.account_type === 'indv') {
|
||
if (!f.name) return this.failField('name', '请填写真实姓名');
|
||
if (!f.cert_no) return this.failField('cert_no', '请填写身份证号');
|
||
if (!/^\d{17}[\dX]$/.test(f.cert_no.toUpperCase())) return this.failField('cert_no', '身份证号格式不正确');
|
||
if (!f.cert_end_date && f.cert_validity_type !== '1') {
|
||
return this.failField('cert_end_date', '请选择身份证有效期');
|
||
}
|
||
if (f.cert_validity_type === '0' && !this.isFutureDateYmd(f.cert_end_date)) {
|
||
return this.failField('cert_end_date', '身份证有效期须晚于今天,长期有效请选择2099-12-31');
|
||
}
|
||
if (!f.reg_detail) return this.failField('reg_detail', '请填写详细地址');
|
||
if (!f.mobile_no || !/^1\d{10}$/.test(f.mobile_no)) return this.failField('mobile_no', '请填写正确手机号');
|
||
if (!f.id_card_front_url) return this.failField('id_card_front_url', '请上传身份证人像面');
|
||
if (!f.id_card_back_url) return this.failField('id_card_back_url', '请上传身份证国徽面');
|
||
} else {
|
||
if (!f.reg_name) return this.failField('reg_name', '请填写商户名称');
|
||
if (!f.license_code) return this.failField('license_code', '请填写统一社会信用代码');
|
||
if (!f.license_end_date && f.license_validity_type !== '1') {
|
||
return this.failField('license_end_date', '请选择证照有效期');
|
||
}
|
||
if (f.license_validity_type === '0' && !this.isFutureDateYmd(f.license_end_date)) {
|
||
return this.failField('license_end_date', '证照有效期须晚于今天,长期有效请选择2099-12-31');
|
||
}
|
||
if (!f.reg_detail) return this.failField('reg_detail', '请填写企业地址');
|
||
if (!f.legal_name) return this.failField('legal_name', '请填写法人姓名');
|
||
if (!f.legal_mobile || !/^1\d{10}$/.test(f.legal_mobile)) return this.failField('legal_mobile', '请填写法人手机号');
|
||
if (!f.legal_cert_no) return this.failField('legal_cert_no', '请填写法人身份证号');
|
||
if (!f.legal_cert_end_date && f.legal_cert_validity_type !== '1') {
|
||
return this.failField('legal_cert_end_date', '请选择法人身份证有效期');
|
||
}
|
||
if (f.legal_cert_validity_type === '0' && !this.isFutureDateYmd(f.legal_cert_end_date)) {
|
||
return this.failField('legal_cert_end_date', '法人身份证有效期须晚于今天,长期有效请选择2099-12-31');
|
||
}
|
||
if (!f.license_url) return this.failField('license_url', '请上传营业执照');
|
||
if (!f.legal_id_front_url) return this.failField('legal_id_front_url', '请上传法人身份证人像面');
|
||
if (!f.legal_id_back_url) return this.failField('legal_id_back_url', '请上传法人身份证国徽面');
|
||
if (f.bank_account_type === '1' && !f.account_permit_url) {
|
||
return this.failField('account_permit_url', '对公账户请上传开户许可证');
|
||
}
|
||
}
|
||
if (!f.card_no || !/^\d{12,19}$/.test(String(f.card_no).replace(/\s+/g, ''))) {
|
||
return this.failField('card_no', '请填写正确银行卡号');
|
||
}
|
||
return true;
|
||
},
|
||
statusText(status) {
|
||
const map = {
|
||
draft: '待后台审核',
|
||
submitting: '提交中',
|
||
basic_ok: '开户成功',
|
||
busi_pending: '审核中',
|
||
approved: '已通过',
|
||
rejected: '已驳回',
|
||
failed: '失败'
|
||
};
|
||
return map[status] || status;
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.huifu-onboard { margin-top: 24rpx; padding: 28rpx; }
|
||
.huifu-head { margin-bottom: 8rpx; }
|
||
.huifu-head-row { display: flex; align-items: flex-start; }
|
||
.huifu-badge { flex-shrink: 0; margin-right: 16rpx; padding: 8rpx 14rpx; font-size: 22rpx; font-weight: 600; color: #fff; background: linear-gradient(90deg, #1677ff, #4096ff); border-radius: 8rpx; }
|
||
.section-title { font-size: 32rpx; font-weight: 600; color: #222; }
|
||
.tip { margin-top: 8rpx; font-size: 24rpx; color: #999; line-height: 1.5; }
|
||
.status-pill { margin-top: 16rpx; display: inline-block; padding: 6rpx 16rpx; font-size: 22rpx; border-radius: 999rpx; background: #f0f7ff; color: #1677ff; }
|
||
.form-section { margin-top: 28rpx; padding-top: 8rpx; border-top: 1rpx solid #f0f0f0; }
|
||
.section-label { margin-bottom: 16rpx; font-size: 28rpx; font-weight: 600; color: #333; }
|
||
.section-label.required::before, .field-label.required::before { content: '*'; color: #ff4d4f; margin-right: 6rpx; }
|
||
.type-row { display: flex; gap: 16rpx; flex-wrap: wrap; }
|
||
.type-item { flex: 1; min-width: 200rpx; display: flex; align-items: center; justify-content: center; gap: 8rpx; padding: 18rpx 12rpx; border: 1rpx solid #e5e7eb; border-radius: 12rpx; font-size: 26rpx; color: #666; }
|
||
.type-item.small { min-width: 140rpx; }
|
||
.type-item.active { border-color: #1677ff; color: #1677ff; background: #f0f7ff; }
|
||
.type-item.disabled { opacity: 0.6; }
|
||
.type-check { width: 28rpx; text-align: center; font-weight: 700; }
|
||
.field { margin-bottom: 20rpx; }
|
||
.field-label { display: block; font-size: 26rpx; color: #333; margin-bottom: 8rpx; }
|
||
.field-hint { display: block; font-size: 22rpx; color: #ff7875; margin-bottom: 8rpx; line-height: 1.4; }
|
||
.field-input { width: 100%; min-height: 76rpx; padding: 0 20rpx; background: #f8fafc; border-radius: 12rpx; font-size: 28rpx; color: #222; box-sizing: border-box; }
|
||
.field-input.is-picker { display: flex; align-items: center; justify-content: space-between; }
|
||
.field-input .ph { color: #bbb; }
|
||
.arrow { color: #bbb; font-size: 32rpx; }
|
||
.field.is-error .field-input { border: 1rpx solid #ff4d4f; background: #fff7f7; }
|
||
.field-error { display: block; margin-top: 8rpx; font-size: 22rpx; color: #ff4d4f; }
|
||
.upload-grid { display: flex; flex-wrap: wrap; gap: 20rpx; }
|
||
.upload-cell { width: calc(50% - 10rpx); }
|
||
.upload-label { display: block; margin-bottom: 10rpx; font-size: 24rpx; color: #666; }
|
||
.upload-bank { margin-top: 8rpx; }
|
||
.branch-panel { margin-top: 8rpx; max-height: 320rpx; overflow-y: auto; background: #fff; border: 1rpx solid #e5e7eb; border-radius: 12rpx; }
|
||
.branch-item { padding: 18rpx 20rpx; border-bottom: 1rpx solid #f0f0f0; }
|
||
.branch-name { display: block; font-size: 26rpx; color: #333; }
|
||
.branch-code { display: block; margin-top: 4rpx; font-size: 22rpx; color: #999; }
|
||
.reject-box { margin-top: 24rpx; padding: 20rpx; background: #fff7f7; border-radius: 12rpx; }
|
||
.reject-label { display: block; font-size: 24rpx; color: #ff4d4f; font-weight: 600; }
|
||
.reject-text { display: block; margin-top: 8rpx; font-size: 24rpx; color: #666; line-height: 1.5; }
|
||
</style>
|