Skip to content

Commit a6eab3c

Browse files
committed
feat: 支付功能迁移(初稿)
1 parent 64b40e7 commit a6eab3c

File tree

14 files changed

+1144
-47
lines changed

14 files changed

+1144
-47
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"nprogress": "^0.2.0",
6161
"pinia": "^2.1.6",
6262
"qrcode": "^1.5.3",
63+
"qrcode.vue": "^3.4.0",
6364
"qs": "^6.11.2",
6465
"steady-xml": "^0.1.0",
6566
"url": "^0.11.1",

src/api/pay/app/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,9 @@ export const exportApp = (params: AppExportReqVO) => {
7676
export const getAppListByMerchantId = (merchantId: number) => {
7777
return request.get({ url: '/pay/app/list-merchant-id', params: { merchantId: merchantId } })
7878
}
79+
80+
export const getAppList = () => {
81+
return request.get({
82+
url: '/pay/app/list'
83+
})
84+
}

src/api/pay/demo/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import request from '@/config/axios'
2+
3+
export interface DemoOrderVO {
4+
spuId: number
5+
createTime: Date
6+
}
7+
8+
// 创建示例订单
9+
export function createDemoOrder(data: DemoOrderVO) {
10+
return request.post({
11+
url: '/pay/demo-order/create',
12+
data: data
13+
})
14+
}
15+
16+
// 获得示例订单
17+
export function getDemoOrder(id: number) {
18+
return request.get({
19+
url: '/pay/demo-order/get?id=' + id
20+
})
21+
}
22+
23+
// 获得示例订单分页
24+
export function getDemoOrderPage(query: PageParam) {
25+
return request.get({
26+
url: '/pay/demo-order/page',
27+
params: query
28+
})
29+
}
30+
31+
// 退款示例订单
32+
export function refundDemoOrder(id) {
33+
return request.put({
34+
url: '/pay/demo-order/refund?id=' + id
35+
})
36+
}

src/api/pay/notify/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import request from '@/config/axios'
2+
3+
export const getNotifyTaskDetail = (id) => {
4+
return request.get({
5+
url: '/pay/notify/get-detail?id=' + id
6+
})
7+
}
8+
9+
// 获得支付通知分页
10+
export const getNotifyTaskPage = (query) => {
11+
return request.get({
12+
url: '/pay/notify/page',
13+
params: query
14+
})
15+
}

src/api/pay/order/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const getOrderDetail = async (id: number) => {
9595

9696
// 新增支付订单
9797
export const createOrder = async (data: OrderVO) => {
98-
return await request.post({ url: '/pay/order/create', data })
98+
return await request.post({ url: '/pay/order/submit', data })
9999
}
100100

101101
// 修改支付订单

src/router/modules/remaining.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,24 @@ const remainingRouter: AppRouteRecordRaw[] = [
410410
}
411411
}
412412
]
413+
},
414+
{
415+
path: '/pay',
416+
component: Layout,
417+
name: 'pay',
418+
meta: { hidden: true },
419+
children: [
420+
{
421+
path: 'cashier',
422+
name: 'PayCashier',
423+
meta: {
424+
title: '收银台',
425+
noCache: true,
426+
hidden: true
427+
},
428+
component: () => import('@/views/pay/cashier/index.vue')
429+
}
430+
]
413431
}
414432
]
415433

src/utils/constants.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export const PayChannelEnum = {
9999
code: 'wx_app',
100100
name: '微信 APP 支付'
101101
},
102+
WX_BAR: {
103+
code: 'wx_bar',
104+
name: '微信条码支付'
105+
},
102106
ALIPAY_PC: {
103107
code: 'alipay_pc',
104108
name: '支付宝 PC 网站支付'
@@ -125,6 +129,27 @@ export const PayChannelEnum = {
125129
}
126130
}
127131

132+
/**
133+
* 支付的展示模式每局
134+
*/
135+
export const PayDisplayModeEnum = {
136+
URL: {
137+
mode: 'url'
138+
},
139+
IFRAME: {
140+
mode: 'iframe'
141+
},
142+
FORM: {
143+
mode: 'form'
144+
},
145+
QR_CODE: {
146+
mode: 'qr_code'
147+
},
148+
APP: {
149+
mode: 'app'
150+
}
151+
}
152+
128153
/**
129154
* 支付类型枚举
130155
*/

src/utils/dict.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,17 @@ export enum DICT_TYPE {
134134
PAY_CHANNEL_ALIPAY_SIGN_TYPE = 'pay_channel_alipay_sign_type', // 支付渠道支付宝算法类型
135135
PAY_CHANNEL_ALIPAY_MODE = 'pay_channel_alipay_mode', // 支付宝公钥类型
136136
PAY_CHANNEL_ALIPAY_SERVER_TYPE = 'pay_channel_alipay_server_type', // 支付宝网关地址
137+
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
137138
PAY_CHANNEL_CODE_TYPE = 'pay_channel_code_type', // 支付渠道编码类型
138-
PAY_ORDER_NOTIFY_STATUS = 'pay_order_notify_status', // 商户支付订单回调状态
139+
// PAY_ORDER_NOTIFY_STATUS = 'pay_order_notify_status', // 商户支付订单回调状态
139140
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
140141
PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态
141142
PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态
142143
PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别
143144

145+
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态
146+
PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态
147+
144148
// ========== MP 模块 ==========
145149
MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型
146150
MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型

0 commit comments

Comments
 (0)