From 0c334ff4d69c3c5aff3bb08a6f11a217b092d9f3 Mon Sep 17 00:00:00 2001 From: linr <1101734174@qq.com> Date: Wed, 2 Aug 2023 16:55:28 +0800 Subject: [PATCH 01/10] =?UTF-8?q?request=E6=94=AF=E6=8C=81=E4=BC=A0?= =?UTF-8?q?=E9=80=92axios=E5=8E=9F=E7=94=9F=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E4=BE=8B=E5=A6=82=E8=B6=85=E6=97=B6=EF=BC=9Arequest(method:'GE?= =?UTF-8?q?T',url:'',timeout:1000)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/axios/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config/axios/index.ts b/src/config/axios/index.ts index e6c6af8d..79e558da 100644 --- a/src/config/axios/index.ts +++ b/src/config/axios/index.ts @@ -5,12 +5,13 @@ import { config } from './config' const { default_headers } = config const request = (option: any) => { - const { url, method, params, data, headersType, responseType } = option + const { url, method, params, data, headersType, responseType, ...config } = option return service({ url: url, method, params, data, + ...config, responseType: responseType, headers: { 'Content-Type': headersType || default_headers From 64b40e7fdfaa0f71e4cbdd89833784ec2fbf36d4 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Sun, 6 Aug 2023 16:54:12 +0800 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=9B=BE=E6=A0=87=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/svgs/pay/icon/alipay_app.svg | 1 + src/assets/svgs/pay/icon/alipay_bar.svg | 2 ++ src/assets/svgs/pay/icon/alipay_pc.svg | 1 + src/assets/svgs/pay/icon/alipay_qr.svg | 2 ++ src/assets/svgs/pay/icon/alipay_wap.svg | 1 + src/assets/svgs/pay/icon/mock.svg | 1 + src/assets/svgs/pay/icon/wx_app.svg | 2 ++ src/assets/svgs/pay/icon/wx_bar.svg | 1 + src/assets/svgs/pay/icon/wx_lite.svg | 1 + src/assets/svgs/pay/icon/wx_native.svg | 1 + src/assets/svgs/pay/icon/wx_pub.svg | 2 ++ 11 files changed, 15 insertions(+) create mode 100644 src/assets/svgs/pay/icon/alipay_app.svg create mode 100644 src/assets/svgs/pay/icon/alipay_bar.svg create mode 100644 src/assets/svgs/pay/icon/alipay_pc.svg create mode 100644 src/assets/svgs/pay/icon/alipay_qr.svg create mode 100644 src/assets/svgs/pay/icon/alipay_wap.svg create mode 100644 src/assets/svgs/pay/icon/mock.svg create mode 100644 src/assets/svgs/pay/icon/wx_app.svg create mode 100644 src/assets/svgs/pay/icon/wx_bar.svg create mode 100644 src/assets/svgs/pay/icon/wx_lite.svg create mode 100644 src/assets/svgs/pay/icon/wx_native.svg create mode 100644 src/assets/svgs/pay/icon/wx_pub.svg diff --git a/src/assets/svgs/pay/icon/alipay_app.svg b/src/assets/svgs/pay/icon/alipay_app.svg new file mode 100644 index 00000000..ebf11883 --- /dev/null +++ b/src/assets/svgs/pay/icon/alipay_app.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/alipay_bar.svg b/src/assets/svgs/pay/icon/alipay_bar.svg new file mode 100644 index 00000000..eb1e1e84 --- /dev/null +++ b/src/assets/svgs/pay/icon/alipay_bar.svg @@ -0,0 +1,2 @@ + diff --git a/src/assets/svgs/pay/icon/alipay_pc.svg b/src/assets/svgs/pay/icon/alipay_pc.svg new file mode 100644 index 00000000..2a752770 --- /dev/null +++ b/src/assets/svgs/pay/icon/alipay_pc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/alipay_qr.svg b/src/assets/svgs/pay/icon/alipay_qr.svg new file mode 100644 index 00000000..48337508 --- /dev/null +++ b/src/assets/svgs/pay/icon/alipay_qr.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/alipay_wap.svg b/src/assets/svgs/pay/icon/alipay_wap.svg new file mode 100644 index 00000000..87075dbb --- /dev/null +++ b/src/assets/svgs/pay/icon/alipay_wap.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/mock.svg b/src/assets/svgs/pay/icon/mock.svg new file mode 100644 index 00000000..27b09ead --- /dev/null +++ b/src/assets/svgs/pay/icon/mock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/wx_app.svg b/src/assets/svgs/pay/icon/wx_app.svg new file mode 100644 index 00000000..ad40b2a2 --- /dev/null +++ b/src/assets/svgs/pay/icon/wx_app.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/wx_bar.svg b/src/assets/svgs/pay/icon/wx_bar.svg new file mode 100644 index 00000000..11292e6e --- /dev/null +++ b/src/assets/svgs/pay/icon/wx_bar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/wx_lite.svg b/src/assets/svgs/pay/icon/wx_lite.svg new file mode 100644 index 00000000..0c925cf3 --- /dev/null +++ b/src/assets/svgs/pay/icon/wx_lite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/wx_native.svg b/src/assets/svgs/pay/icon/wx_native.svg new file mode 100644 index 00000000..bf3ba2b6 --- /dev/null +++ b/src/assets/svgs/pay/icon/wx_native.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/svgs/pay/icon/wx_pub.svg b/src/assets/svgs/pay/icon/wx_pub.svg new file mode 100644 index 00000000..3a6d15b7 --- /dev/null +++ b/src/assets/svgs/pay/icon/wx_pub.svg @@ -0,0 +1,2 @@ + \ No newline at end of file From a6eab3cc9a998cff2120a6db82f6938ab1c2f206 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Sun, 6 Aug 2023 23:25:07 +0800 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20=E6=94=AF=E4=BB=98=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +