feat 商户管理页面开发

This commit is contained in:
DaxPay
2024-07-16 17:59:16 +08:00
parent 17dc6983a5
commit bcb069b05f
8 changed files with 117 additions and 59 deletions

View File

@@ -64,7 +64,7 @@
import { FormEditType } from '@/enums/formTypeEnum'
import { useMessage } from '@/hooks/web/useMessage'
import { Dict } from '@/views/baseapi/dict/Dict.api'
import BasicDrawer from '@/components/Drawer/src/BasicDrawer.vue'
import { BasicDrawer } from '@/components/Drawer'
// 使用hooks
const { handleTableChange, pageQueryResHandel, pagination, pages, model, loading } =

View File

@@ -61,10 +61,14 @@ export interface MchApp extends BaseEntity {
appName?: string
// 签名方式
signType?: string
//
publicKey?: string
// 私钥
privateKey?: string
// 签名秘
signSecret?: string
// 是否对请求进行验签
reqSign?: boolean
// 支付限额
limitAmount?: number
// 订单默认超时时间(分钟)
orderTimeout: number
// 异步消息通知类型
notifyType?: string
// 通知地址, http/WebSocket 需要配置

View File

@@ -1,12 +1,12 @@
<template>
<basic-modal
:loading="confirmLoading"
<basic-drawer
showFooter
v-bind="$attrs"
:width="750"
width="50%"
:title="title"
:open="visible"
:mask-closable="showable"
@cancel="handleCancel"
:open="visible"
@close="handleCancel"
>
<a-form
class="small-from-item"
@@ -21,37 +21,59 @@
<a-input v-model:value="form.id" :disabled="showable" />
</a-form-item>
<a-form-item label="商户号" name="mchNo" v-show="!addable">
<a-input v-model:value="form.mchNo" disabled />
{{ form.mchNo }}
</a-form-item>
<a-form-item label="商户名称" name="mchName">
<a-input v-model:value="form.mchName" :disabled="showable" placeholder="请输入商户名称" />
<a-form-item label="应用号" name="appId" v-if="!addable">
{{ form.appId }}
</a-form-item>
<a-form-item label="公司名称" name="companyName">
<a-input v-model:value="form.mchName" :disabled="showable" placeholder="请输入公司名称" />
<a-form-item label="应用名称" name="appName">
<a-input v-model:value="form.appName" :disabled="showable" placeholder="请输入应用名称" />
</a-form-item>
<a-form-item label="证件类型" name="idType">
<a-input v-model:value="form.idType" :disabled="showable" placeholder="请输入证件类型" />
</a-form-item>
<a-form-item label="证件号" name="idNo">
<a-input v-model:value="form.idNo" :disabled="showable" placeholder="请输入证件号" />
</a-form-item>
<a-form-item label="联系方式" name="contact">
<a-input v-model:value="form.contact" :disabled="showable" placeholder="请输入联系方式" />
</a-form-item>
<a-form-item label="法人名称" name="legalPerson">
<a-input
v-model:value="form.legalPerson"
:disabled="showable"
placeholder="请输入法人名称"
<a-form-item label="请求验签" name="reqSign">
<a-switch
v-model:checked="form.reqSign"
checked-children="启用"
un-checked-children="停用"
/>
</a-form-item>
<a-form-item label="法人证件号码" name="legalPersonIdNo">
<a-input
v-model:value="form.legalPersonIdNo"
<a-form-item label="支付限额(元)" name="limitAmount">
<a-input-number
v-model:value="form.limitAmount"
:min="0.01"
:precision="2"
:disabled="showable"
placeholder="请输入法人证件号码"
placeholder="请输入支付限额(元)"
/>
</a-form-item>
<a-form-item label="订单超时时间(分钟)" name="orderTimeout">
<a-input-number
v-model:value="form.orderTimeout"
:min="5"
:precision="0"
:disabled="showable"
placeholder="请输入订单默认超时时间(分钟)"
/>
</a-form-item>
<a-form-item label="签名方式" name="signType">
<a-radio-group v-model:value="form.signType" button-style="solid">
<a-radio-button value="HMAC_SHA256">HMAC_SHA256</a-radio-button>
<a-radio-button value="SM3">SM3</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item label="签名秘钥" name="signSecret">
<a-textarea v-model:value="form.signSecret" :disabled="showable" placeholder="请输入公钥" />
<a-button type="link" @click="genSignSecret">生成秘钥</a-button>
</a-form-item>
<a-form-item label="通知方式" name="noticeType">
<a-radio-group v-model:value="form.signType" button-style="solid">
<a-radio-button value="http">http</a-radio-button>
<a-radio-button value="websocket">websocket</a-radio-button>
<a-radio-button disabled value="mq">消息队列</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item label="通知地址" name="notifyUrl">
<a-input v-model:value="form.notifyUrl" :disabled="showable" placeholder="请输入通知地址" />
</a-form-item>
</a-form>
<template #footer>
<a-space>
@@ -66,7 +88,7 @@
>
</a-space>
</template>
</basic-modal>
</basic-drawer>
</template>
<script lang="ts" setup>
@@ -75,7 +97,8 @@
import { add, get, MchApp, update } from './MchApp.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '@/enums/formTypeEnum'
import { BasicModal } from '@/components/Modal'
import { BasicDrawer } from '@/components/Drawer'
import { buildUUID } from "@/utils/uuid";
const {
initFormEditType,
@@ -96,8 +119,13 @@
// 校验
const rules = reactive({
mchName: [{ required: true, message: '请输入商户名称' }],
companyName: [{ required: true, message: '请输入公司名称' }],
appName: [{ required: true, message: '请输入应用名称' }],
signType: [{ required: true, message: '请选择签名方式' }],
signSecret: [{ required: true, message: '请输入签名秘钥' }],
reqSign: [{ required: true, message: '请选择是否验签' }],
limitAmount: [{ required: true, message: '请选择是否验签' }],
orderTimeout: [{ required: true, message: '请选择是否验签' }],
notifyType: [{ required: true, message: '请选择是否验签' }],
} as Record<string, Rule[]>)
// 事件
const emits = defineEmits(['ok'])
@@ -119,6 +147,7 @@
confirmLoading.value = false
})
} else if (editType === FormEditType.Add) {
genSignSecret()
confirmLoading.value = false
}
}
@@ -136,6 +165,12 @@
})
}
/**
* 生成秘钥
*/
function genSignSecret() {
form.value.signSecret = buildUUID()+buildUUID()
}
/**
* 重置表单的校验
*/

View File

@@ -20,20 +20,25 @@
</vxe-toolbar>
<vxe-table ref="xTable" key-field="id" :data="pagination.records" :loading="loading">
<vxe-column type="seq" width="60" />
<vxe-column field="mchNo" title="编码" />
<vxe-column field="mchName" title="名称" />
<vxe-column field="companyName" title="公司名称" />
<vxe-column field="idType" title="证件类型">
<vxe-column field="appId" title="应用号" :min-width="100" />
<vxe-column field="appName" title="应用名称" :min-width="100" />
<vxe-column field="signType" title="签名方式" :min-width="80">
<template #default="{ row }">
<a-tag v-if="row.idType === '0'" color="green">身份证</a-tag>
<a-tag v-else-if="row.idType === '1'" color="blue">护照</a-tag>
<a-tag v-else-if="row.idType === '2'" color="red">港澳通行证</a-tag>
<a-tag>{{ dictConvert('sign_type', row.signType) || '空' }}</a-tag>
</template>
</vxe-column>
<vxe-column field="tel" title="联系方式" />
<vxe-column field="legalPerson" title="法人名称" />
<vxe-column field="tel" title="联系方式" />
<vxe-column field="createTime" title="创建时间" />
<vxe-column field="notifyType" title="通知类型" :min-width="80">
<template #default="{ row }">
<a-tag>{{ dictConvert('notify_type', row.notifyType) || '空' }}</a-tag>
</template>
</vxe-column>
<vxe-column field="notifyUrl" title="通知地址" :min-width="220" />
<vxe-column field="status" title="状态" :min-width="80">
<template #default="{ row }">
<a-tag>{{ dictConvert('mach_app_status', row.status) || '空' }}</a-tag>
</template>
</vxe-column>
<vxe-column field="createTime" title="创建时间" :min-width="120" />
<vxe-column fixed="right" width="150" :showOverflow="false" title="操作">
<template #default="{ row }">
<span>
@@ -72,6 +77,7 @@
import { useMessage } from '@/hooks/web/useMessage'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import ALink from '@/components/Link/Link.vue'
import { useDict } from '@/hooks/bootx/useDict'
// 使用hooks
const {
@@ -84,6 +90,7 @@
loading,
} = useTablePage(queryPage)
const { createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
// 查询条件
const fields = [
{ field: 'code', formType: STRING, name: '编码', placeholder: '请输入终端编码' },

View File

@@ -1,12 +1,12 @@
<template>
<basic-modal
:loading="confirmLoading"
<basic-drawer
showFooter
v-bind="$attrs"
:width="750"
width="50%"
:title="title"
:open="visible"
:mask-closable="showable"
@cancel="handleCancel"
:open="visible"
@close="handleCancel"
>
<a-form
class="small-from-item"
@@ -30,7 +30,19 @@
<a-input v-model:value="form.mchName" :disabled="showable" placeholder="请输入公司名称" />
</a-form-item>
<a-form-item label="证件类型" name="idType">
<a-input v-model:value="form.idType" :disabled="showable" placeholder="请输入证件类型" />
<a-select
v-model:value="form.idType"
:disabled="showable"
allow-clear
placeholder="请选择证件类型"
>
<a-select-option value="1">身份证</a-select-option>
<a-select-option value="2">护照</a-select-option>
<a-select-option value="3">港澳居民来往内地通行证</a-select-option>
<a-select-option value="4">台湾居民来往大陆通行证</a-select-option>
<a-select-option value="5">户口簿</a-select-option>
<a-select-option value="6">军人证</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="证件号" name="idNo">
<a-input v-model:value="form.idNo" :disabled="showable" placeholder="请输入证件号" />
@@ -66,7 +78,7 @@
>
</a-space>
</template>
</basic-modal>
</basic-drawer>
</template>
<script lang="ts" setup>
@@ -75,7 +87,7 @@
import { add, get, Merchant, update } from './Merchant.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '@/enums/formTypeEnum'
import { BasicModal } from '@/components/Modal'
import { BasicDrawer } from '@/components/Drawer'
const {
initFormEditType,

View File

@@ -25,7 +25,7 @@
<vxe-column field="companyName" title="公司名称" :min-width="150" />
<vxe-column field="idType" title="证件类型" :min-width="80">
<template #default="{ row }">
<a-tag color="green">{{ dictConvert('idType', row.idType) }}</a-tag>
<a-tag color="green">{{ dictConvert('idType', row.idType) || '无' }}</a-tag>
</template>
</vxe-column>
<vxe-column field="tel" title="联系方式" :min-width="100" />

View File

@@ -53,7 +53,7 @@
</template>
<script lang="ts" setup>
import BasicDrawer from '@/components/Drawer/src/BasicDrawer.vue'
import { BasicDrawer } from '@/components/Drawer'
import useFormEdit from '@/hooks/bootx/useFormEdit'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { nextTick, reactive, ref } from 'vue'

View File

@@ -37,7 +37,7 @@
</template>
<script lang="ts" setup>
import BasicDrawer from '@/components/Drawer/src/BasicDrawer.vue'
import { BasicDrawer } from '@/components/Drawer'
import useFormEdit from '@/hooks/bootx/useFormEdit'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { computed, nextTick, ref } from 'vue'