diff --git a/src/views/daxpay/h5/onboarded/common/Base.d.ts b/src/views/daxpay/h5/onboarded/common/Base.d.ts index 2abb59e..494d746 100644 --- a/src/views/daxpay/h5/onboarded/common/Base.d.ts +++ b/src/views/daxpay/h5/onboarded/common/Base.d.ts @@ -1,9 +1,11 @@ +import type { MchEntity } from '#/axios' + /** * 进件商户信息 * @author xxm * @since 2025/6/9 */ -export interface OnbMerchantProfile { +export interface OnbMerchantProfile extends MchEntity { /** 进件申请Id */ applyId?: number /** 商户类型 */ @@ -18,7 +20,7 @@ export interface OnbMerchantProfile { * @author xxm * @since 2025/6/9 */ -export interface OnbLegalProfile { +export interface OnbLegalProfile extends MchEntity { /** 进件申请Id */ applyId?: number /** 法人姓名 */ @@ -49,7 +51,7 @@ export interface OnbLegalProfile { * @author xxm * @since 2025/6/9 */ -export interface OnbLicenseProfile { +export interface OnbLicenseProfile extends MchEntity { /** 进件申请Id */ applyId?: number /** 营业执照号 */ @@ -76,7 +78,7 @@ export interface OnbLicenseProfile { * @author xxm * @since 2025/6/9 */ -export interface OnbShopProfile { +export interface OnbShopProfile extends MchEntity { /** 进件申请Id */ applyId?: number /** 门店类型 */ @@ -108,7 +110,7 @@ export interface OnbShopProfile { * @author xxm * @since 2025/6/9 */ -export interface OnbBankAccountProfile { +export interface OnbBankAccountProfile extends MchEntity { /** 进件申请Id */ applyId?: number /** 账户类型 */ @@ -138,7 +140,7 @@ export interface OnbBankAccountProfile { * @author xxm * @since 2025/6/9 */ -export interface OnbCardHolderProfile { +export interface OnbCardHolderProfile extends MchEntity { /** 进件申请Id */ applyId?: number /** 持卡人姓名 */ diff --git a/src/views/daxpay/h5/onboarded/common/OnbMchApply.api.ts b/src/views/daxpay/h5/onboarded/common/OnbMchApply.api.ts index 5d30c5b..9b4a795 100644 --- a/src/views/daxpay/h5/onboarded/common/OnbMchApply.api.ts +++ b/src/views/daxpay/h5/onboarded/common/OnbMchApply.api.ts @@ -1,5 +1,5 @@ import { http } from '@/utils/http/axios' -import type { Result } from '#/axios' +import type { MchEntity, Result } from '#/axios' /** * 地区树 */ @@ -69,6 +69,28 @@ export function bankCardOcr(uri, headers) { }) } +/** + * 获取商户主体信息(嵌入) + */ +export function getMainBody(mchNo: string, headers) { + return http.request>({ + url: '/merchant/profile/getMainBody', + params: { mchNo }, + headers, + }) +} + +/** + * 获取商户店铺信息(嵌入) + */ +export function getShopInfo(mchNo: string, headers) { + return http.request>({ + url: '/merchant/profile/shop/findByMchNo', + params: { mchNo }, + headers, + }) +} + /** * 区域 */ @@ -150,3 +172,91 @@ export interface BankCardOCRResult { /** 有效期 */ validToDate?: string } + +/** + * 商户主体信息参数 + */ +export interface MchMainBody { + // 基础信息 + base: MchBaseProfile + // 法人信息 + legal: MchLegalProfile + // 营业执照信息 + license: MchLicenseProfile +} + +/** + * 商户基础信息 + */ +export interface MchBaseProfile extends MchEntity { + // 商户类型 + merchantType?: string + // 商户名称 + merchantName?: string + // 商户简称 + merchantShortName?: string +} + +/** + * 商户法人信息 + */ +export interface MchLegalProfile extends MchEntity { + // 法人姓名 + legalName?: string + // 法人证件号 + certNo?: string + // 联系手机号 + contactPhone?: string + // 长期有效 + periodLong?: boolean + // 法人证件开始日期 + startDate?: string + // 法人证件结束日期 + endDate?: string + // 身份证地址 + address?: string + // 法人身份证正面照片 + frontPic?: string + // 法人身份证反面照片 + backPic?: string +} + +/** + * 商户营业执照信息 + */ +export interface MchLicenseProfile extends MchEntity { + // 营业执照号 + licenseNo?: string + // 营业执照名称 + licenseName?: string + // 执照地址-省市区编码 + regionCode?: string[] + // 营业执照详细地址 + address?: string + // 营业执照长期有效 + periodLong?: boolean + // 营业执照开始日期 + startDate?: string + // 营业执照结束日期 + endDate?: string + // 营业执照照片 + licensePic?: string +} + +/** + * 商户店铺信息 + */ +export interface MchShopProfile extends MchEntity { + // 经营场所名称 + name?: string + // 省市区编码 + regionCode?: string[] + // 经营场所详细地址 + address?: string + // 门头照 + doorPic?: string + // 室内照 + insidePic?: string + // 收银台照片 + cashierPic?: string +} diff --git a/src/views/daxpay/h5/onboarded/common/OnbMchApplyUtil.ts b/src/views/daxpay/h5/onboarded/common/OnbMchApplyUtil.ts new file mode 100644 index 0000000..929e954 --- /dev/null +++ b/src/views/daxpay/h5/onboarded/common/OnbMchApplyUtil.ts @@ -0,0 +1,56 @@ +import { cloneDeep } from 'lodash-es' +import { getMainBody, getShopInfo } from '@/views/daxpay/h5/onboarded/common/OnbMchApply.api' +/** + * 初始化商户信息 + */ +export async function initMerchantProfile(form, mchNo, headers) { + // 并行调用三个接口获取数据 + const [mainBodyRes, shopInfoRes] = await Promise.all([getMainBody(mchNo, headers), getShopInfo(mchNo, headers)]) + + // 映射主体信息到表单 + if (mainBodyRes.data) { + const mainBody = mainBodyRes.data + + // 映射基础信息 + if (mainBody.base) { + Object.assign(form.merchant, { + merchantType: mainBody.base.merchantType, + merchantName: mainBody.base.merchantName, + merchantShortName: mainBody.base.merchantShortName, + }) + } + + // 映射法人信息 + if (mainBody.legal) { + Object.assign(form.legal, cloneDeep(mainBody.legal), { + frontPicUrl: mainBody.legal.frontPic, + backPicUrl: mainBody.legal.backPic, + // 清空图片ID字段 + frontPic: '', + backPic: '', + }) + } + // 映射营业执照信息 + if (mainBody.license) { + Object.assign(form.license, cloneDeep(mainBody.license), { + licensePicUrl: mainBody.license.licensePic, + // 清空图片ID字段 + licensePic: '', + }) + } + } + + // 映射经营场所信息到表单 + if (shopInfoRes.data) { + const shopInfo = shopInfoRes.data + Object.assign(form.shop, cloneDeep(shopInfo), { + doorPicUrl: shopInfo.doorPic, + insidePicUrl: shopInfo.insidePic, + cashierPicUrl: shopInfo.cashierPic, + // 清空图片ID字段 + doorPic: '', + insidePic: '', + cashierPic: '', + }) + } +} diff --git a/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.api.ts b/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.api.ts index 4ab2f2b..c96b033 100644 --- a/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.api.ts +++ b/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.api.ts @@ -1,5 +1,5 @@ import { http } from '@/utils/http/axios' -import type { Result } from '#/axios' +import type {MchEntity, Result} from '#/axios' import type { OnbBankAccountProfile, OnbCardHolderProfile, @@ -93,7 +93,7 @@ export interface MerchantApply { /** * 其他申请数据 */ -export interface OtherApply { +export interface OtherApply extends MchEntity { /** 联系人手机号 */ contactPhone?: string /** 经营类目代码 */ diff --git a/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.vue b/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.vue index c212af0..b0ade82 100644 --- a/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.vue +++ b/src/views/daxpay/h5/onboarded/hkrt/HkrtApply.vue @@ -621,13 +621,16 @@
+ + 读取商户信息 + 上一步 下一步 - + 提交
@@ -641,7 +644,7 @@