Browse Source

feat: pay order

main
xingyu 2 years ago
parent
commit
0a797760a0
  1. 4
      src/utils/dict.ts
  2. 2
      src/views/pay/order/OrderModal.vue
  3. 216
      src/views/pay/order/order.data.ts

4
src/utils/dict.ts

@ -123,10 +123,12 @@ export enum DICT_TYPE {
PAY_CHANNEL_ALIPAY_SERVER_TYPE = 'pay_channel_alipay_server_type', // 支付宝网关地址 PAY_CHANNEL_ALIPAY_SERVER_TYPE = 'pay_channel_alipay_server_type', // 支付宝网关地址
PAY_CHANNEL_CODE_TYPE = 'pay_channel_code_type', // 支付渠道编码类型 PAY_CHANNEL_CODE_TYPE = 'pay_channel_code_type', // 支付渠道编码类型
PAY_ORDER_NOTIFY_STATUS = 'pay_order_notify_status', // 商户支付订单回调状态 PAY_ORDER_NOTIFY_STATUS = 'pay_order_notify_status', // 商户支付订单回调状态
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态 PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态
PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态 PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态
PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别 PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态 PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态
PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态 PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态

2
src/views/pay/order/OrderModal.vue

@ -18,6 +18,6 @@ const [registerModal, { setModalProps }] = useModalInner(async (data) => {
<template> <template>
<BasicModal v-bind="$attrs" width="60%" title="查看详情" :show-ok-btn="false" @register="registerModal"> <BasicModal v-bind="$attrs" width="60%" title="查看详情" :show-ok-btn="false" @register="registerModal">
<Description :bordered="false" :column="3" :data="refundData" :schema="descSchema" /> <Description :bordered="false" :column="2" :data="refundData" :schema="descSchema" />
</BasicModal> </BasicModal>
</template> </template>

216
src/views/pay/order/order.data.ts

@ -1,4 +1,4 @@
import { getMerchantListByName } from '@/api/pay/merchant' import { getAppList } from '@/api/pay/app'
import type { DescItem } from '@/components/Description' import type { DescItem } from '@/components/Description'
import type { BasicColumn, FormSchema } from '@/components/Table' import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table' import { useRender } from '@/components/Table'
@ -10,46 +10,6 @@ export const columns: BasicColumn[] = [
dataIndex: 'id', dataIndex: 'id',
width: 100, width: 100,
}, },
{
title: '支付渠道',
children: [
{
title: '商户名称',
dataIndex: 'merchantName',
width: 120,
},
{
title: '应用名称',
dataIndex: 'appName',
width: 120,
},
{
title: '渠道名称',
dataIndex: 'channelCodeName',
width: 160,
},
],
},
{
title: '支付订单',
children: [
{
title: '商户',
dataIndex: 'merchantOrderId',
width: 100,
},
{
title: '支付',
dataIndex: 'channelOrderNo',
width: 200,
},
],
},
{
title: '商品标题',
dataIndex: 'subject',
width: 200,
},
{ {
title: '支付金额(元)', title: '支付金额(元)',
dataIndex: 'amount', dataIndex: 'amount',
@ -74,6 +34,26 @@ export const columns: BasicColumn[] = [
return `${Number.parseFloat(text || 0 / 100).toFixed(2)}` return `${Number.parseFloat(text || 0 / 100).toFixed(2)}`
}, },
}, },
{
title: '订单号',
children: [
{
title: '商户',
dataIndex: 'merchantOrderId',
width: 120,
},
{
title: '支付',
dataIndex: 'no',
width: 120,
},
{
title: '渠道',
dataIndex: 'channelOrderNo',
width: 160,
},
],
},
{ {
title: '支付状态', title: '支付状态',
dataIndex: 'status', dataIndex: 'status',
@ -83,13 +63,23 @@ export const columns: BasicColumn[] = [
}, },
}, },
{ {
title: '回调状态', title: '支付渠道',
dataIndex: 'notifyStatus', dataIndex: 'channelCode',
width: 100, width: 100,
customRender: ({ text }) => { customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.PAY_ORDER_NOTIFY_STATUS) return useRender.renderDict(text, DICT_TYPE.PAY_CHANNEL_CODE)
}, },
}, },
{
title: '支付应用',
dataIndex: 'appName',
width: 100,
},
{
title: '商品标题',
dataIndex: 'subject',
width: 180,
},
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
@ -110,22 +100,18 @@ export const columns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
label: '所属商户', label: '应用编号',
field: 'merchantId', field: 'appId',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: () => getMerchantListByName(''), api: () => getAppList(),
labelField: 'name',
valueField: 'id',
}, },
colProps: { span: 8 }, colProps: { span: 8 },
}, },
{ {
label: '应用编号', label: '支付渠道',
field: 'appId',
component: 'Input',
colProps: { span: 8 },
},
{
label: '渠道编码',
field: 'channelCode', field: 'channelCode',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
@ -134,13 +120,19 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 8 }, colProps: { span: 8 },
}, },
{ {
label: '商户号', label: '商户单号',
field: 'merchantOrderId', field: 'merchantOrderId',
component: 'Input', component: 'Input',
colProps: { span: 8 }, colProps: { span: 8 },
}, },
{ {
label: '渠道订单号', label: '支付单号',
field: 'no',
component: 'Input',
colProps: { span: 8 },
},
{
label: '渠道单号',
field: 'channelOrderNo', field: 'channelOrderNo',
component: 'Input', component: 'Input',
colProps: { span: 8 }, colProps: { span: 8 },
@ -154,24 +146,6 @@ export const searchFormSchema: FormSchema[] = [
}, },
colProps: { span: 8 }, colProps: { span: 8 },
}, },
{
label: '退款状态',
field: 'refundStatus',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.PAY_ORDER_REFUND_STATUS),
},
colProps: { span: 8 },
},
{
label: '回调商户状态',
field: 'notifyStatus',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS),
},
colProps: { span: 8 },
},
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',
@ -182,36 +156,29 @@ export const searchFormSchema: FormSchema[] = [
export const descSchema: DescItem[] = [ export const descSchema: DescItem[] = [
{ {
label: '商户名称', label: '商户单号',
field: 'merchantName', field: 'merchantOrderId',
},
{
label: '应用名称',
field: 'appName',
},
{
label: '商品名称',
field: 'subject',
}, },
{ {
label: '商户订单号', label: '支付单号',
field: 'merchantOrderId', field: 'no',
render: (curVal) => { render: (curVal) => {
return useRender.renderTag(curVal) return useRender.renderTag(curVal)
}, },
}, },
{ {
label: '渠道订单号', label: '应用编号',
field: 'channelOrderNo', field: 'appId',
render: (curVal) => { },
return useRender.renderTag(curVal) {
}, label: '应用名称',
field: 'appName',
}, },
{ {
label: '支付订单号', label: '支付状态',
field: 'payOrderExtension.no', field: 'status',
render: (curVal) => { render: (curVal) => {
return useRender.renderTag(curVal) return useRender.renderDict(curVal, DICT_TYPE.PAY_ORDER_STATUS)
}, },
}, },
{ {
@ -236,23 +203,19 @@ export const descSchema: DescItem[] = [
}, },
}, },
{ {
label: '支付状态', label: '支付时间',
field: 'status', field: 'successTime',
render: (curVal) => { render: (curVal) => {
return useRender.renderDict(curVal, DICT_TYPE.PAY_ORDER_STATUS) return useRender.renderDate(curVal)
}, },
}, },
{ {
label: '回调状态', label: '失效时间',
field: 'notifyStatus', field: 'expireTime',
render: (curVal) => { render: (curVal) => {
return useRender.renderDict(curVal, DICT_TYPE.PAY_ORDER_NOTIFY_STATUS) return useRender.renderDate(curVal)
}, },
}, },
{
label: '回调地址',
field: 'notifyUrl',
},
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',
@ -261,58 +224,55 @@ export const descSchema: DescItem[] = [
}, },
}, },
{ {
label: '支付时间', label: '更新时间',
field: 'successTime', field: 'updateTime',
render: (curVal) => { render: (curVal) => {
return useRender.renderDate(curVal) return useRender.renderDate(curVal)
}, },
}, },
{ {
label: '失效时间', label: '商品标题',
field: 'expireTime', field: 'subject',
render: (curVal) => {
return useRender.renderDate(curVal)
},
}, },
{ {
label: '通知时间', label: '商品描述',
field: 'notifyTime', field: 'body',
render: (curVal) => {
return useRender.renderDate(curVal)
},
}, },
{ {
label: '支付渠道', label: '支付渠道',
field: 'channelCodeName', field: 'channelCode',
render: (curVal) => {
return useRender.renderDict(curVal, DICT_TYPE.PAY_CHANNEL_CODE)
},
}, },
{ {
label: '支付IP', label: '支付 IP',
field: 'userIp', field: 'userIp',
}, },
{ {
label: '退款状态', label: '渠道单号',
field: 'notifyStatus', field: 'channelOrderNo',
render: (curVal) => { render: (curVal) => {
return useRender.renderDict(curVal, DICT_TYPE.PAY_ORDER_REFUND_STATUS) return useRender.renderTag(curVal)
}, },
}, },
{ {
label: '退款次数', label: '渠道用户',
field: 'refundTimes', field: 'channelUserId',
}, },
{ {
label: '退款金额', label: '退款金额',
field: 'refundAmount', field: 'refundPrice',
render: (curVal) => { render: (curVal) => {
return `${Number.parseFloat(curVal / 100).toFixed(2)}` return `${Number.parseFloat(`${curVal / 100}`).toFixed(2)}`
}, },
}, },
{ {
label: '商品描述', label: '通知 URL',
field: 'body', field: 'notifyUrl',
}, },
{ {
label: '支付通道异步回调内容', label: '支付通道异步回调内容',
field: 'payOrderExtension.channelNotifyData', field: 'extension.channelNotifyData',
}, },
] ]