From a6eab3cc9a998cff2120a6db82f6938ab1c2f206 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Sun, 6 Aug 2023 23:25:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=EF=BC=88=E5=88=9D=E7=A8=BF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/api/pay/app/index.ts | 6 + src/api/pay/demo/index.ts | 36 +++ src/api/pay/notify/index.ts | 15 + src/api/pay/order/index.ts | 2 +- src/router/modules/remaining.ts | 18 ++ src/utils/constants.ts | 25 ++ src/utils/dict.ts | 6 +- src/views/pay/cashier/index.vue | 485 ++++++++++++++++++++++++++++ src/views/pay/demo/index.vue | 242 ++++++++++++++ src/views/pay/notify/index.vue | 275 ++++++++++++++++ src/views/pay/order/OrderDetail.vue | 6 +- src/views/pay/order/index.vue | 92 +++--- src/views/pay/refund/index.vue | 4 +- 14 files changed, 1155 insertions(+), 58 deletions(-) create mode 100644 src/api/pay/demo/index.ts create mode 100644 src/api/pay/notify/index.ts create mode 100644 src/views/pay/cashier/index.vue create mode 100644 src/views/pay/demo/index.vue create mode 100644 src/views/pay/notify/index.vue diff --git a/package.json b/package.json index e6be32f8..d9fe0d60 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "nprogress": "^0.2.0", "pinia": "^2.1.6", "qrcode": "^1.5.3", + "qrcode.vue": "^3.4.0", "qs": "^6.11.2", "steady-xml": "^0.1.0", "url": "^0.11.1", diff --git a/src/api/pay/app/index.ts b/src/api/pay/app/index.ts index c19eb99b..286f97bb 100644 --- a/src/api/pay/app/index.ts +++ b/src/api/pay/app/index.ts @@ -76,3 +76,9 @@ export const exportApp = (params: AppExportReqVO) => { export const getAppListByMerchantId = (merchantId: number) => { return request.get({ url: '/pay/app/list-merchant-id', params: { merchantId: merchantId } }) } + +export const getAppList = () => { + return request.get({ + url: '/pay/app/list' + }) +} diff --git a/src/api/pay/demo/index.ts b/src/api/pay/demo/index.ts new file mode 100644 index 00000000..3824a8b2 --- /dev/null +++ b/src/api/pay/demo/index.ts @@ -0,0 +1,36 @@ +import request from '@/config/axios' + +export interface DemoOrderVO { + spuId: number + createTime: Date +} + +// 创建示例订单 +export function createDemoOrder(data: DemoOrderVO) { + return request.post({ + url: '/pay/demo-order/create', + data: data + }) +} + +// 获得示例订单 +export function getDemoOrder(id: number) { + return request.get({ + url: '/pay/demo-order/get?id=' + id + }) +} + +// 获得示例订单分页 +export function getDemoOrderPage(query: PageParam) { + return request.get({ + url: '/pay/demo-order/page', + params: query + }) +} + +// 退款示例订单 +export function refundDemoOrder(id) { + return request.put({ + url: '/pay/demo-order/refund?id=' + id + }) +} diff --git a/src/api/pay/notify/index.ts b/src/api/pay/notify/index.ts new file mode 100644 index 00000000..494c2216 --- /dev/null +++ b/src/api/pay/notify/index.ts @@ -0,0 +1,15 @@ +import request from '@/config/axios' + +export const getNotifyTaskDetail = (id) => { + return request.get({ + url: '/pay/notify/get-detail?id=' + id + }) +} + +// 获得支付通知分页 +export const getNotifyTaskPage = (query) => { + return request.get({ + url: '/pay/notify/page', + params: query + }) +} diff --git a/src/api/pay/order/index.ts b/src/api/pay/order/index.ts index 6621381a..95dda2c5 100644 --- a/src/api/pay/order/index.ts +++ b/src/api/pay/order/index.ts @@ -95,7 +95,7 @@ export const getOrderDetail = async (id: number) => { // 新增支付订单 export const createOrder = async (data: OrderVO) => { - return await request.post({ url: '/pay/order/create', data }) + return await request.post({ url: '/pay/order/submit', data }) } // 修改支付订单 diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 2a277a10..81f74d55 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -410,6 +410,24 @@ const remainingRouter: AppRouteRecordRaw[] = [ } } ] + }, + { + path: '/pay', + component: Layout, + name: 'pay', + meta: { hidden: true }, + children: [ + { + path: 'cashier', + name: 'PayCashier', + meta: { + title: '收银台', + noCache: true, + hidden: true + }, + component: () => import('@/views/pay/cashier/index.vue') + } + ] } ] diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 3a91899a..d5c29eb0 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -99,6 +99,10 @@ export const PayChannelEnum = { code: 'wx_app', name: '微信 APP 支付' }, + WX_BAR: { + code: 'wx_bar', + name: '微信条码支付' + }, ALIPAY_PC: { code: 'alipay_pc', name: '支付宝 PC 网站支付' @@ -125,6 +129,27 @@ export const PayChannelEnum = { } } +/** + * 支付的展示模式每局 + */ +export const PayDisplayModeEnum = { + URL: { + mode: 'url' + }, + IFRAME: { + mode: 'iframe' + }, + FORM: { + mode: 'form' + }, + QR_CODE: { + mode: 'qr_code' + }, + APP: { + mode: 'app' + } +} + /** * 支付类型枚举 */ diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 67a92ba6..7b1287fb 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -134,13 +134,17 @@ export enum DICT_TYPE { PAY_CHANNEL_ALIPAY_SIGN_TYPE = 'pay_channel_alipay_sign_type', // 支付渠道支付宝算法类型 PAY_CHANNEL_ALIPAY_MODE = 'pay_channel_alipay_mode', // 支付宝公钥类型 PAY_CHANNEL_ALIPAY_SERVER_TYPE = 'pay_channel_alipay_server_type', // 支付宝网关地址 + PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型 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_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态 PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别 + PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态 + PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态 + // ========== MP 模块 ========== MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型 MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型 diff --git a/src/views/pay/cashier/index.vue b/src/views/pay/cashier/index.vue new file mode 100644 index 00000000..44201fbe --- /dev/null +++ b/src/views/pay/cashier/index.vue @@ -0,0 +1,485 @@ + + + + + diff --git a/src/views/pay/demo/index.vue b/src/views/pay/demo/index.vue new file mode 100644 index 00000000..d7ed0a1b --- /dev/null +++ b/src/views/pay/demo/index.vue @@ -0,0 +1,242 @@ + + + diff --git a/src/views/pay/notify/index.vue b/src/views/pay/notify/index.vue new file mode 100644 index 00000000..0f9f4631 --- /dev/null +++ b/src/views/pay/notify/index.vue @@ -0,0 +1,275 @@ + + + diff --git a/src/views/pay/order/OrderDetail.vue b/src/views/pay/order/OrderDetail.vue index 4716b258..79834444 100644 --- a/src/views/pay/order/OrderDetail.vue +++ b/src/views/pay/order/OrderDetail.vue @@ -19,11 +19,11 @@ - ¥{{ parseFloat(detailData.amount / 100, 2).toFixed(2) }} + ¥{{ parseFloat(detailData.price / 100, 2).toFixed(2) }} - ¥{{ parseFloat(detailData.channelFeeAmount / 100, 2).toFixed(2) }} + ¥{{ parseFloat(detailData.channelFeePrice / 100, 2).toFixed(2) }} @@ -61,7 +61,7 @@ {{ detailData.refundTimes }} - {{ parseFloat(detailData.refundAmount / 100, 2) }} + {{ parseFloat(detailData.refundPrice / 100, 2) }} diff --git a/src/views/pay/order/index.vue b/src/views/pay/order/index.vue index 7f643ece..401e899f 100644 --- a/src/views/pay/order/index.vue +++ b/src/views/pay/order/index.vue @@ -139,56 +139,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +