mirror of
https://gitee.com/bootx/dax-pay-h5
synced 2026-08-09 06:26:00 +08:00
feat 进件申请表单嵌入式模式下可以读取商户信息
This commit is contained in:
14
src/views/daxpay/h5/onboarded/common/Base.d.ts
vendored
14
src/views/daxpay/h5/onboarded/common/Base.d.ts
vendored
@@ -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
|
||||
/** 持卡人姓名 */
|
||||
|
||||
@@ -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<Result<MchMainBody>>({
|
||||
url: '/merchant/profile/getMainBody',
|
||||
params: { mchNo },
|
||||
headers,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商户店铺信息(嵌入)
|
||||
*/
|
||||
export function getShopInfo(mchNo: string, headers) {
|
||||
return http.request<Result<MchShopProfile>>({
|
||||
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
|
||||
}
|
||||
|
||||
56
src/views/daxpay/h5/onboarded/common/OnbMchApplyUtil.ts
Normal file
56
src/views/daxpay/h5/onboarded/common/OnbMchApplyUtil.ts
Normal file
@@ -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: '',
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
/** 经营类目代码 */
|
||||
|
||||
@@ -621,13 +621,16 @@
|
||||
</div>
|
||||
<div class="btnContain">
|
||||
<div class="btnBox">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === 1 && clientCode" type="" block @click="readMch">
|
||||
读取商户信息
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex > 1" type="primary" block @click="prevClick">
|
||||
上一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex < currentPage.date.length" type="primary" block @click="nextClick">
|
||||
下一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
提交
|
||||
</van-button>
|
||||
</div>
|
||||
@@ -641,7 +644,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { showNotify } from 'vant'
|
||||
import {showConfirmDialog, showDialog, showNotify} from 'vant'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import type { MccConst, MerchantApply } from './HkrtApply.api'
|
||||
@@ -659,6 +662,7 @@ import {
|
||||
import BUpload from '@/components/BUpload.vue'
|
||||
import type { WebHeaders } from '#/web'
|
||||
import router from '@/router'
|
||||
import { initMerchantProfile } from '@/views/daxpay/h5/onboarded/common/OnbMchApplyUtil'
|
||||
|
||||
const route = useRoute()
|
||||
// sign 作为H5独立访问时, 用来给数据验证访问做的安全措施
|
||||
@@ -796,39 +800,48 @@ function saveTemp() {
|
||||
* 提交
|
||||
*/
|
||||
function submitClick() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 暂存
|
||||
const saveRes = clientCode ? await save(form.value, headers) : await saveH5(form.value, sign, headers)
|
||||
if (saveRes.code !== 0) {
|
||||
showNotify({ type: 'danger', message: saveRes.msg })
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
// 提交申请
|
||||
const submitRes = clientCode ? await submit(form.value.applyId, headers) : await submitH5(form.value.applyId, sign, headers)
|
||||
if (submitRes.code !== 0) {
|
||||
showNotify({ type: 'danger', message: submitRes.msg })
|
||||
return
|
||||
}
|
||||
loading.value = false
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要提交进件申请!',
|
||||
}).then(() => {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 执行下一步操作
|
||||
const savePromise = clientCode ? save(form.value, headers) : saveH5(form.value, sign, headers)
|
||||
await savePromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
// 提交
|
||||
const submitPromise = clientCode ? submit(form.value.applyId, headers) : submitH5(form.value.applyId, sign, headers)
|
||||
await submitPromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
return
|
||||
}
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
showDialog({ title: '提交成功', message: '返回申请列表后请刷新查看最新信息!' }).then(() => {
|
||||
uni.navigateBack()
|
||||
})
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -896,6 +909,30 @@ function bankOcr() {
|
||||
form.value.bankAccount.cardNo = data.cardNumber
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
function readMch() {
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要读取商户资料吗?读取后会覆盖已经填写的信息内容!',
|
||||
}).then(() => {
|
||||
readMchData()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
async function readMchData() {
|
||||
// 获取当前商户号
|
||||
const mchNo = form.value.merchant.mchNo as string
|
||||
loading.value = true
|
||||
await initMerchantProfile(form.value, mchNo, headers)
|
||||
loading.value = false
|
||||
showNotify({ type: 'success', message: '商户资料读取成功' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -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,
|
||||
@@ -71,7 +71,7 @@ export function mccTree() {
|
||||
/**
|
||||
* 乐刷商户申请参数
|
||||
*/
|
||||
export interface MerchantApply {
|
||||
export interface MerchantApply extends MchEntity {
|
||||
/** 申请单ID */
|
||||
applyId?: string
|
||||
/** 商户信息 */
|
||||
|
||||
@@ -617,13 +617,16 @@
|
||||
</div>
|
||||
<div class="btnContain">
|
||||
<div class="btnBox">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === 1 && clientCode" type="" block @click="readMch">
|
||||
读取商户信息
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex > 1" type="primary" block @click="prevClick">
|
||||
上一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex < currentPage.date.length" type="primary" block @click="nextClick">
|
||||
下一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
提交
|
||||
</van-button>
|
||||
</div>
|
||||
@@ -637,7 +640,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { showNotify } from 'vant'
|
||||
import { showConfirmDialog, showDialog, showNotify } from 'vant'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ref } from 'vue'
|
||||
import type { MccConst, MerchantApply } from './LeshuaApply.api'
|
||||
@@ -658,6 +661,7 @@ import {
|
||||
import BUpload from '@/components/BUpload.vue'
|
||||
import type { WebHeaders } from '#/web'
|
||||
import router from '@/router'
|
||||
import { initMerchantProfile } from '@/views/daxpay/h5/onboarded/common/OnbMchApplyUtil'
|
||||
|
||||
const route = useRoute()
|
||||
const { id: applyId, sign, token, clientCode, show } = route.query
|
||||
@@ -790,41 +794,48 @@ function saveTemp() {
|
||||
* 提交
|
||||
*/
|
||||
function submitClick() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 执行下一步操作
|
||||
const savePromise = clientCode ? save(form.value, headers) : saveH5(form.value, sign, headers)
|
||||
await savePromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
loading.value = false
|
||||
}
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要提交进件申请!',
|
||||
}).then(() => {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 执行下一步操作
|
||||
const savePromise = clientCode ? save(form.value, headers) : saveH5(form.value, sign, headers)
|
||||
await savePromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
// 提交
|
||||
const submitPromise = clientCode ? submit(form.value.applyId, headers) : submitH5(form.value.applyId, sign, headers)
|
||||
await submitPromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
return
|
||||
}
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
showDialog({ title: '提交成功', message: '返回申请列表后请刷新查看最新信息!' }).then(() => {
|
||||
uni.navigateBack()
|
||||
})
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
// 提交
|
||||
const submitPromise = clientCode ? submit(form.value.applyId, headers) : submitH5(form.value.applyId, sign, headers)
|
||||
await submitPromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
return
|
||||
}
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
})
|
||||
}
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -915,6 +926,30 @@ function ocrBankIdCardBack() {
|
||||
form.value.cardHolder.endDate = data.endDate
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
function readMch() {
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要读取商户资料吗?读取后会覆盖已经填写的信息内容!',
|
||||
}).then(() => {
|
||||
readMchData()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
async function readMchData() {
|
||||
// 获取当前商户号
|
||||
const mchNo = form.value.merchant.mchNo as string
|
||||
loading.value = true
|
||||
await initMerchantProfile(form.value, mchNo, headers)
|
||||
loading.value = false
|
||||
showNotify({ type: 'success', message: '商户资料读取成功' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { http } from '@/utils/http/axios'
|
||||
import type { Result } from '#/axios'
|
||||
import type {MchEntity, Result} from '#/axios'
|
||||
import type {
|
||||
OnbLegalProfile,
|
||||
OnbLicenseProfile,
|
||||
@@ -107,7 +107,7 @@ export interface MerchantApply {
|
||||
/**
|
||||
* 杉德其他申请数据
|
||||
*/
|
||||
export interface SandOtherApply {
|
||||
export interface SandOtherApply extends MchEntity {
|
||||
/** 邮箱 */
|
||||
email?: string
|
||||
/** 商户经营类目编码 */
|
||||
|
||||
@@ -493,13 +493,16 @@
|
||||
<!-- 底部按钮 -->
|
||||
<div class="btnContain">
|
||||
<div class="btnBox">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === 1 && clientCode" type="" block @click="readMch">
|
||||
读取商户信息
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex > 1" type="primary" block @click="prevClick">
|
||||
上一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex < currentPage.date.length" type="primary" block @click="nextClick">
|
||||
下一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
提交
|
||||
</van-button>
|
||||
</div>
|
||||
@@ -514,8 +517,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { showNotify } from 'vant'
|
||||
import { useRoute } from 'vue-router'
|
||||
import {Dialog, showConfirmDialog, showDialog, showNotify} from 'vant'
|
||||
import type { MccConst, MerchantApply } from './SandApply.api'
|
||||
import { findById, findH5ById, mccTree, mchMccTree, save, saveH5, wxMccTree } from './SandApply.api'
|
||||
import type {
|
||||
@@ -530,6 +533,7 @@ import {
|
||||
} from '@/views/daxpay/h5/onboarded/common/OnbMchApply.api'
|
||||
import type { WebHeaders } from '#/web'
|
||||
import router from '@/router'
|
||||
import { initMerchantProfile } from '@/views/daxpay/h5/onboarded/common/OnbMchApplyUtil'
|
||||
|
||||
const route = useRoute()
|
||||
const { id: applyId, sign, token, clientCode, show } = route.query
|
||||
@@ -668,39 +672,48 @@ function saveTemp() {
|
||||
* 提交
|
||||
*/
|
||||
function submitClick() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 暂存
|
||||
const saveRes = clientCode ? await save(form.value, headers) : await saveH5(form.value, sign, headers)
|
||||
if (saveRes.code !== 0) {
|
||||
showNotify({ type: 'danger', message: saveRes.msg })
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
// 提交申请
|
||||
const submitRes = clientCode ? await submit(form.value.applyId, headers) : await submitH5(form.value.applyId, sign, headers)
|
||||
if (submitRes.code !== 0) {
|
||||
showNotify({ type: 'danger', message: submitRes.msg })
|
||||
return
|
||||
}
|
||||
loading.value = false
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要提交进件申请!',
|
||||
}).then(() => {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 执行下一步操作
|
||||
const savePromise = clientCode ? save(form.value, headers) : saveH5(form.value, sign, headers)
|
||||
await savePromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
// 提交
|
||||
const submitPromise = clientCode ? submit(form.value.applyId, headers) : submitH5(form.value.applyId, sign, headers)
|
||||
await submitPromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
return
|
||||
}
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
showDialog({ title: '提交成功', message: '返回申请列表后请刷新查看最新信息!' }).then(() => {
|
||||
uni.navigateBack()
|
||||
})
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -753,6 +766,30 @@ function licenseInfoOcr() {
|
||||
form.value.license.endDate = data.endDate
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
function readMch() {
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要读取商户资料吗?读取后会覆盖已经填写的信息内容!',
|
||||
}).then(() => {
|
||||
readMchData()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
async function readMchData() {
|
||||
// 获取当前商户号
|
||||
const mchNo = form.value.merchant.mchNo as string
|
||||
loading.value = true
|
||||
await initMerchantProfile(form.value, mchNo, headers)
|
||||
loading.value = false
|
||||
showNotify({ type: 'success', message: '商户资料读取成功' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -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,
|
||||
@@ -95,7 +95,7 @@ export interface MerchantApply {
|
||||
/**
|
||||
* 其他申请数据
|
||||
*/
|
||||
export interface OtherApply {
|
||||
export interface OtherApply extends MchEntity {
|
||||
/** 经营类型 */
|
||||
operationalType?: string
|
||||
/** 线上产品类型 */
|
||||
|
||||
@@ -689,13 +689,16 @@
|
||||
</div>
|
||||
<div class="btnContain">
|
||||
<div class="btnBox">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === 1 && clientCode" type="" block @click="readMch">
|
||||
读取商户信息
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex > 1" type="primary" block @click="prevClick">
|
||||
上一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex < currentPage.date.length" type="primary" block @click="nextClick">
|
||||
下一步
|
||||
</van-button>
|
||||
<van-button v-if="currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
<van-button v-if="!showable && currentPage.currentIndex === currentPage.date.length" :disabled="showable" type="primary" block @click="submitClick">
|
||||
提交
|
||||
</van-button>
|
||||
</div>
|
||||
@@ -709,7 +712,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { showNotify } from 'vant'
|
||||
import { showConfirmDialog, showDialog, showNotify } from 'vant'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ref } from 'vue'
|
||||
import type { MccConst, MerchantApply } from './VbillApply.api'
|
||||
@@ -729,6 +732,7 @@ import {
|
||||
import BUpload from '@/components/BUpload.vue'
|
||||
import type { WebHeaders } from '#/web'
|
||||
import router from '@/router'
|
||||
import { initMerchantProfile } from '@/views/daxpay/h5/onboarded/common/OnbMchApplyUtil'
|
||||
|
||||
const route = useRoute()
|
||||
const { id: applyId, sign, token, clientCode, show } = route.query
|
||||
@@ -861,42 +865,48 @@ function saveTemp() {
|
||||
* 提交
|
||||
*/
|
||||
function submitClick() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 执行下一步操作
|
||||
const savePromise = clientCode ? save(form.value, headers) : saveH5(form.value, sign, headers)
|
||||
await savePromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
loading.value = false
|
||||
}
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要提交进件申请!',
|
||||
}).then(() => {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
loading.value = true
|
||||
// 执行下一步操作
|
||||
const savePromise = clientCode ? save(form.value, headers) : saveH5(form.value, sign, headers)
|
||||
await savePromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
// 提交
|
||||
const submitPromise = clientCode ? submit(form.value.applyId, headers) : submitH5(form.value.applyId, sign, headers)
|
||||
await submitPromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
return
|
||||
}
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
showDialog({ title: '提交成功', message: '返回申请列表后请刷新查看最新信息!' }).then(() => {
|
||||
uni.navigateBack()
|
||||
})
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
// 提交
|
||||
const submitPromise = clientCode ? submit(form.value.applyId, headers) : submitH5(form.value.applyId, sign, headers)
|
||||
await submitPromise.then(({ code, msg }) => {
|
||||
if (code !== 0) {
|
||||
showNotify({ type: 'danger', message: msg })
|
||||
return
|
||||
}
|
||||
loading.value = false
|
||||
// 嵌入方式直接返回
|
||||
if (clientCode) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
else {
|
||||
// 跳转到成功页面
|
||||
router.replace({
|
||||
name: 'SuccessResult',
|
||||
query: { title: '提交申请成功' },
|
||||
})
|
||||
}
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
showNotify({ type: 'danger', message: '还有必填项未填写,请仔细检查!' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -963,6 +973,30 @@ function bankOcr() {
|
||||
form.value.bankAccount.cardNo = data.cardNumber
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
function readMch() {
|
||||
showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要读取商户资料吗?读取后会覆盖已经填写的信息内容!',
|
||||
}).then(() => {
|
||||
readMchData()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取商户资料
|
||||
*/
|
||||
async function readMchData() {
|
||||
// 获取当前商户号
|
||||
const mchNo = form.value.merchant.mchNo as string
|
||||
loading.value = true
|
||||
await initMerchantProfile(form.value, mchNo, headers)
|
||||
loading.value = false
|
||||
showNotify({ type: 'success', message: '商户资料读取成功' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user