feat: pay
parent
c382d63266
commit
044be6bd11
|
@ -67,16 +67,6 @@ export function deleteApp(id: number) {
|
|||
return defHttp.delete({ url: `/pay/app/delete?id=${id}` })
|
||||
}
|
||||
|
||||
// 导出支付应用
|
||||
export function exportApp(params: AppExportReqVO) {
|
||||
return defHttp.download({ url: '/pay/app/export-excel', params }, '支付应用.xls')
|
||||
}
|
||||
|
||||
// 根据商ID称搜索应用列表
|
||||
export function getAppListByMerchantId(merchantId: number) {
|
||||
return defHttp.get({ url: '/pay/app/list-merchant-id', params: { merchantId } })
|
||||
}
|
||||
|
||||
// 获得支付应用列表
|
||||
export function getAppList() {
|
||||
return defHttp.get({ url: '/pay/app/list' })
|
||||
|
|
|
@ -35,7 +35,7 @@ export interface ChannelExportReqVO {
|
|||
}
|
||||
|
||||
// 查询列表支付渠道
|
||||
export function getChannelPage(params: ChannelPageReqVO) {
|
||||
export function getChannelPage(params: PageParam) {
|
||||
return defHttp.get({ url: '/pay/channel/page', params })
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ export function getChannel(appId: string, code: string) {
|
|||
appId,
|
||||
code,
|
||||
}
|
||||
return defHttp.get({ url: '/pay/channel/get-channel', params })
|
||||
return defHttp.get({ url: '/pay/channel/get', params })
|
||||
}
|
||||
|
||||
// 新增支付渠道
|
||||
|
@ -64,6 +64,6 @@ export function deleteChannel(id: number) {
|
|||
}
|
||||
|
||||
// 导出支付渠道
|
||||
export function exportChannel(params: ChannelExportReqVO) {
|
||||
export function exportChannel(params) {
|
||||
return defHttp.download({ url: '/pay/channel/export-excel', params }, '支付渠道.xls')
|
||||
}
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
import { defHttp } from '@/utils/http/axios'
|
||||
|
||||
export interface MerchantVO {
|
||||
id: number
|
||||
no: string
|
||||
name: string
|
||||
shortName: string
|
||||
status: number
|
||||
remark: string
|
||||
createTime: Date
|
||||
}
|
||||
|
||||
export interface MerchantPageReqVO extends PageParam {
|
||||
no?: string
|
||||
name?: string
|
||||
shortName?: string
|
||||
status?: number
|
||||
remark?: string
|
||||
createTime?: Date[]
|
||||
}
|
||||
|
||||
export interface MerchantExportReqVO {
|
||||
no?: string
|
||||
name?: string
|
||||
shortName?: string
|
||||
status?: number
|
||||
remark?: string
|
||||
createTime?: Date[]
|
||||
}
|
||||
|
||||
// 查询列表支付商户
|
||||
export function getMerchantPage(params: MerchantPageReqVO) {
|
||||
return defHttp.get({ url: '/pay/merchant/page', params })
|
||||
}
|
||||
|
||||
// 查询详情支付商户
|
||||
export function getMerchant(id: number) {
|
||||
return defHttp.get({ url: `/pay/merchant/get?id=${id}` })
|
||||
}
|
||||
|
||||
// 根据商户名称搜索商户列表
|
||||
export function getMerchantListByName(name: string) {
|
||||
return defHttp.get({
|
||||
url: '/pay/merchant/list-by-name?id=',
|
||||
params: {
|
||||
name,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 新增支付商户
|
||||
export function createMerchant(data: MerchantVO) {
|
||||
return defHttp.post({ url: '/pay/merchant/create', data })
|
||||
}
|
||||
|
||||
// 修改支付商户
|
||||
export function updateMerchant(data: MerchantVO) {
|
||||
return defHttp.put({ url: '/pay/merchant/update', data })
|
||||
}
|
||||
|
||||
// 删除支付商户
|
||||
export function deleteMerchant(id: number) {
|
||||
return defHttp.delete({ url: `/pay/merchant/delete?id=${id}` })
|
||||
}
|
||||
|
||||
// 导出支付商户
|
||||
export function exportMerchant(params: MerchantExportReqVO) {
|
||||
return defHttp.download({ url: '/pay/merchant/export-excel', params }, '支付商户.xls')
|
||||
}
|
||||
// 支付商户状态修改
|
||||
export function changeMerchantStatus(id: number, status: number) {
|
||||
const data = {
|
||||
id,
|
||||
status,
|
||||
}
|
||||
return defHttp.put({ url: '/pay/merchant/update-status', data })
|
||||
}
|
|
@ -88,32 +88,17 @@ export function getOrder(id: number) {
|
|||
return defHttp.get({ url: `/pay/order/get?id=${id}` })
|
||||
}
|
||||
|
||||
// 查询详情支付订单
|
||||
// 获得支付订单的明细
|
||||
export function getOrderDetail(id: number) {
|
||||
return defHttp.get({ url: `/pay/order/get-detail?id=${id}` })
|
||||
}
|
||||
|
||||
// 新增支付订单
|
||||
export function createOrder(data: OrderVO) {
|
||||
return defHttp.post({ url: '/pay/order/create', data })
|
||||
}
|
||||
|
||||
// 修改支付订单
|
||||
export function updateOrder(data: OrderVO) {
|
||||
return defHttp.put({ url: '/pay/order/update', data })
|
||||
}
|
||||
|
||||
// 删除支付订单
|
||||
export function deleteOrder(id: number) {
|
||||
return defHttp.delete({ url: `/pay/order/delete?id=${id}` })
|
||||
// 提交支付订单
|
||||
export function submitOrder(data: any) {
|
||||
return defHttp.post({ url: '/pay/order/submit', data })
|
||||
}
|
||||
|
||||
// 导出支付订单
|
||||
export function exportOrder(params: OrderExportReqVO) {
|
||||
return defHttp.download({ url: '/pay/order/export-excel', params }, '支付订单.xls')
|
||||
}
|
||||
|
||||
// 提交支付订单
|
||||
export function submitOrder(data) {
|
||||
return defHttp.post({ url: '/pay/order/submit', data })
|
||||
return defHttp.download({ url: '/pay/order/export-excel', params })
|
||||
}
|
||||
|
|
|
@ -143,9 +143,9 @@ export const PayRoute: AppRouteRecordRaw = {
|
|||
},
|
||||
children: [
|
||||
{
|
||||
path: 'submit',
|
||||
component: () => import('@/views/pay/submit/index.vue'),
|
||||
name: 'PayOrderSubmit',
|
||||
path: 'cashier',
|
||||
component: () => import('@/views/pay/cashier/index.vue'),
|
||||
name: 'PayCashier',
|
||||
meta: {
|
||||
canTo: true,
|
||||
hidden: true,
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
import type { DescItem } from '@/components/Description'
|
||||
import { useRender } from '@/components/Table'
|
||||
|
||||
// 导入图标
|
||||
import svg_alipay_pc from '@/assets/svgs/pay/icon/alipay_pc.svg'
|
||||
import svg_alipay_wap from '@/assets/svgs/pay/icon/alipay_wap.svg'
|
||||
import svg_alipay_app from '@/assets/svgs/pay/icon/alipay_app.svg'
|
||||
import svg_alipay_qr from '@/assets/svgs/pay/icon/alipay_qr.svg'
|
||||
import svg_alipay_bar from '@/assets/svgs/pay/icon/alipay_bar.svg'
|
||||
import svg_wx_pub from '@/assets/svgs/pay/icon/wx_pub.svg'
|
||||
import svg_wx_lite from '@/assets/svgs/pay/icon/wx_lite.svg'
|
||||
import svg_wx_app from '@/assets/svgs/pay/icon/wx_app.svg'
|
||||
import svg_wx_native from '@/assets/svgs/pay/icon/wx_native.svg'
|
||||
import svg_wx_bar from '@/assets/svgs/pay/icon/wx_bar.svg'
|
||||
import svg_mock from '@/assets/svgs/pay/icon/mock.svg'
|
||||
|
||||
export const descSchema: DescItem[] = [
|
||||
{
|
||||
label: '支付单号',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
label: '商品标题',
|
||||
field: 'subject',
|
||||
},
|
||||
{
|
||||
label: '商品内容',
|
||||
field: 'body',
|
||||
},
|
||||
{
|
||||
label: '支付金额',
|
||||
field: 'amount',
|
||||
render: (curVal) => {
|
||||
return useRender.renderText('¥', Number.parseFloat(curVal || 0 / 100).toFixed(2))
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '创建时间',
|
||||
field: 'createTime',
|
||||
render: (curVal) => {
|
||||
return useRender.renderDate(curVal)
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '过期时间',
|
||||
field: 'expireTime',
|
||||
render: (curVal) => {
|
||||
return useRender.renderDate(curVal)
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export const channelsAlipay = [
|
||||
{
|
||||
name: '支付宝 PC 网站支付',
|
||||
icon: svg_alipay_pc,
|
||||
code: 'alipay_pc',
|
||||
},
|
||||
{
|
||||
name: '支付宝 Wap 网站支付',
|
||||
icon: svg_alipay_wap,
|
||||
code: 'alipay_wap',
|
||||
},
|
||||
{
|
||||
name: '支付宝 App 网站支付',
|
||||
icon: svg_alipay_app,
|
||||
code: 'alipay_app',
|
||||
},
|
||||
{
|
||||
name: '支付宝扫码支付',
|
||||
icon: svg_alipay_qr,
|
||||
code: 'alipay_qr',
|
||||
},
|
||||
{
|
||||
name: '支付宝条码支付',
|
||||
icon: svg_alipay_bar,
|
||||
code: 'alipay_bar',
|
||||
},
|
||||
]
|
||||
export const channelsWechat = [
|
||||
{
|
||||
name: '微信公众号支付',
|
||||
icon: svg_wx_pub,
|
||||
code: 'wx_pub',
|
||||
},
|
||||
{
|
||||
name: '微信小程序支付',
|
||||
icon: svg_wx_lite,
|
||||
code: 'wx_lite',
|
||||
},
|
||||
{
|
||||
name: '微信 App 支付',
|
||||
icon: svg_wx_app,
|
||||
code: 'wx_app',
|
||||
},
|
||||
{
|
||||
name: '微信扫码支付',
|
||||
icon: svg_wx_native,
|
||||
code: 'wx_native',
|
||||
},
|
||||
{
|
||||
name: '微信条码支付',
|
||||
icon: svg_wx_bar,
|
||||
code: 'wx_bar',
|
||||
},
|
||||
]
|
||||
export const channelsMock = [
|
||||
{
|
||||
name: '模拟支付',
|
||||
icon: svg_mock,
|
||||
code: 'mock',
|
||||
},
|
||||
]
|
|
@ -16,7 +16,7 @@ import wx_lite from '@/assets/images/pay/icon/wx_lite.svg'
|
|||
import wx_pub from '@/assets/images/pay/icon/wx_pub.svg'
|
||||
import mock from '@/assets/images/pay/icon/mock.svg'
|
||||
|
||||
defineOptions({ name: 'PayOrderSubmit' })
|
||||
defineOptions({ name: 'PayCashier' })
|
||||
|
||||
const ListItem = List.Item
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref, unref } from 'vue'
|
||||
import { formSchema } from './merchant.data'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { createMerchant, getMerchant, updateMerchant } from '@/api/pay/merchant'
|
||||
|
||||
defineOptions({ name: 'PayMerchantModal' })
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const { t } = useI18n()
|
||||
const { createMessage } = useMessage()
|
||||
const isUpdate = ref(true)
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 120,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: { span: 23 },
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getMerchant(data.record.id)
|
||||
setFieldsValue({ ...res })
|
||||
}
|
||||
})
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate))
|
||||
await updateMerchant(values)
|
||||
else
|
||||
await createMerchant(values)
|
||||
|
||||
closeModal()
|
||||
emit('success')
|
||||
createMessage.success(t('common.saveSuccessText'))
|
||||
}
|
||||
finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" :title="isUpdate ? t('action.edit') : t('action.create')" @register="registerModal" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
|
@ -1,94 +0,0 @@
|
|||
<script lang="ts" setup>
|
||||
import MerchantModal from './MerchantModal.vue'
|
||||
import { columns, searchFormSchema } from './merchant.data'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import { useModal } from '@/components/Modal'
|
||||
import { IconEnum } from '@/enums/appEnum'
|
||||
import { BasicTable, TableAction, useTable } from '@/components/Table'
|
||||
import type { MerchantExportReqVO } from '@/api/pay/merchant'
|
||||
import { deleteMerchant, exportMerchant, getMerchantPage } from '@/api/pay/merchant'
|
||||
|
||||
defineOptions({ name: 'PayMerchant' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const { createConfirm, createMessage } = useMessage()
|
||||
const [registerModal, { openModal }] = useModal()
|
||||
|
||||
const [registerTable, { getForm, reload }] = useTable({
|
||||
title: '商户列表',
|
||||
api: getMerchantPage,
|
||||
columns,
|
||||
formConfig: { labelWidth: 120, schemas: searchFormSchema },
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
actionColumn: {
|
||||
width: 140,
|
||||
title: t('common.action'),
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
},
|
||||
})
|
||||
|
||||
function handleCreate() {
|
||||
openModal(true, { isUpdate: false })
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true })
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
createConfirm({
|
||||
title: t('common.exportTitle'),
|
||||
iconType: 'warning',
|
||||
content: t('common.exportMessage'),
|
||||
async onOk() {
|
||||
await exportMerchant(getForm().getFieldsValue() as MerchantExportReqVO)
|
||||
createMessage.success(t('common.exportSuccessText'))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
await deleteMerchant(record.id)
|
||||
createMessage.success(t('common.delSuccessText'))
|
||||
reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button v-auth="['pay:merchant:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
|
||||
{{ t('action.create') }}
|
||||
</a-button>
|
||||
<a-button v-auth="['pay:merchant:export']" :pre-icon="IconEnum.EXPORT" @click="handleExport">
|
||||
{{ t('action.export') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'pay:merchant:update', onClick: handleEdit.bind(null, record) },
|
||||
{
|
||||
icon: IconEnum.DELETE,
|
||||
danger: true,
|
||||
label: t('action.delete'),
|
||||
auth: 'pay:merchant:delete',
|
||||
popConfirm: {
|
||||
title: t('common.delMessage'),
|
||||
placement: 'left',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MerchantModal @register="registerModal" @success="reload()" />
|
||||
</div>
|
||||
</template>
|
|
@ -1,151 +0,0 @@
|
|||
import { Switch } from 'ant-design-vue'
|
||||
import { h } from 'vue'
|
||||
import { changeMerchantStatus } from '@/api/pay/merchant'
|
||||
import type { BasicColumn, FormSchema } from '@/components/Table'
|
||||
import { useRender } from '@/components/Table'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '商户编号',
|
||||
dataIndex: 'id',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '商户号',
|
||||
dataIndex: 'no',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '商户全称',
|
||||
dataIndex: 'name',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '商户简称',
|
||||
dataIndex: 'shortName',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '开启状态',
|
||||
dataIndex: 'status',
|
||||
width: 180,
|
||||
customRender: ({ record }) => {
|
||||
if (!Reflect.has(record, 'pendingStatus'))
|
||||
record.pendingStatus = false
|
||||
|
||||
return h(Switch, {
|
||||
checked: record.status === 0,
|
||||
checkedChildren: '已启用',
|
||||
unCheckedChildren: '已禁用',
|
||||
loading: record.pendingStatus,
|
||||
onChange(checked: boolean) {
|
||||
record.pendingStatus = true
|
||||
const newStatus = checked ? 0 : 1
|
||||
const { createMessage } = useMessage()
|
||||
changeMerchantStatus(record.id, newStatus)
|
||||
.then(() => {
|
||||
record.status = newStatus
|
||||
createMessage.success('已成功修改商户状态')
|
||||
})
|
||||
.catch(() => {
|
||||
createMessage.error('修改商户状态失败')
|
||||
})
|
||||
.finally(() => {
|
||||
record.pendingStatus = false
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
width: 180,
|
||||
customRender: ({ text }) => {
|
||||
return useRender.renderDate(text)
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '商户号',
|
||||
field: 'no',
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
label: '商户全称',
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
label: '商户简称',
|
||||
field: 'shortName',
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS),
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
field: 'remark',
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
label: '创建时间',
|
||||
field: 'createTime',
|
||||
component: 'RangePicker',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
]
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '编号',
|
||||
field: 'id',
|
||||
show: false,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '商户全称',
|
||||
field: 'name',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '商户简称',
|
||||
field: 'shortName',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '开启状态',
|
||||
field: 'status',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
field: 'remark',
|
||||
component: 'InputTextArea',
|
||||
},
|
||||
]
|
|
@ -1,38 +0,0 @@
|
|||
import type { DescItem } from '@/components/Description'
|
||||
import { useRender } from '@/components/Table'
|
||||
|
||||
export const descSchema: DescItem[] = [
|
||||
{
|
||||
label: '支付单号',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
label: '商品标题',
|
||||
field: 'subject',
|
||||
},
|
||||
{
|
||||
label: '商品内容',
|
||||
field: 'body',
|
||||
},
|
||||
{
|
||||
label: '支付金额',
|
||||
field: 'amount',
|
||||
render: (curVal) => {
|
||||
return useRender.renderText('¥', Number.parseFloat(curVal || 0 / 100).toFixed(2))
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '创建时间',
|
||||
field: 'createTime',
|
||||
render: (curVal) => {
|
||||
return useRender.renderDate(curVal)
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '过期时间',
|
||||
field: 'expireTime',
|
||||
render: (curVal) => {
|
||||
return useRender.renderDate(curVal)
|
||||
},
|
||||
},
|
||||
]
|
Loading…
Reference in New Issue