From d2ca977cf21e4f7a04c7e604c33b242d17eb2b79 Mon Sep 17 00:00:00 2001 From: DaxPay Date: Thu, 5 Dec 2024 14:37:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(daxpay):=20=E4=BC=98=E5=8C=96=E6=94=B6?= =?UTF-8?q?=E9=93=B6=E5=8F=B0=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增条码支付和聚合支付功能 - 优化支付流程和用户界面 --- index.html | 2 +- src/router/index.ts | 2 +- src/router/routes/index.ts | 20 +- src/router/routes/project.ts | 11 +- .../outside/checkout/CheckoutBarCode.vue | 62 +++ .../outside/checkout/CheckoutPay.api.ts | 60 +-- .../daxpay/outside/checkout/CheckoutPay.vue | 395 +++++++++++------- .../outside/checkout/CheckoutQrCode.vue | 36 ++ src/views/daxpay/outside/checkout/style.less | 34 +- 9 files changed, 407 insertions(+), 215 deletions(-) create mode 100644 src/views/daxpay/outside/checkout/CheckoutBarCode.vue create mode 100644 src/views/daxpay/outside/checkout/CheckoutQrCode.vue diff --git a/index.html b/index.html index 41d55cf5..c86caf63 100644 --- a/index.html +++ b/index.html @@ -137,7 +137,7 @@
-
<%= VITE_GLOB_APP_TITLE %>
+
DaxPay
diff --git a/src/router/index.ts b/src/router/index.ts index 73d52ba7..2ccd7708 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,7 @@ import type { RouteRecordRaw } from 'vue-router' import type { App } from 'vue' -import {createRouter, createWebHistory} from 'vue-router' +import { createRouter, createWebHistory } from 'vue-router' import { basicRoutes } from './routes' // 白名单应该包含基本静态路由 diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index b1c52ea6..2832c8ab 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -36,6 +36,22 @@ export const LoginRoute: AppRouteRecordRaw = { }, } -// Basic routing without permission +/** + * 外部页面, 不需要登陆 + */ +export const OUTSIDE: AppRouteModule = { + path: '/not/login/outside/', + name: 'NOT_LOGIN_OUTSIDE', + meta: { title: '' }, + children: [ + { + path: '/checkout/:orderNo', + name: 'CheckoutPay', + component: () => import('@/views/daxpay/outside/checkout/CheckoutPay.vue'), + meta: { title: '收银台', ignoreAuth: true }, + }, + ], +} + // 未经许可的基本路由 -export const basicRoutes = [LoginRoute, RootRoute, REDIRECT_ROUTE, PAGE_NOT_FOUND_ROUTE] +export const basicRoutes = [LoginRoute, RootRoute, REDIRECT_ROUTE, PAGE_NOT_FOUND_ROUTE,OUTSIDE] diff --git a/src/router/routes/project.ts b/src/router/routes/project.ts index fec720d3..86764535 100644 --- a/src/router/routes/project.ts +++ b/src/router/routes/project.ts @@ -29,20 +29,13 @@ export const INTERNAL: AppRouteModule = { } /** - * 位于主框架外的页面 + * 位于主框架外的页面 也需要登陆 */ export const OUTSIDE: AppRouteModule = { path: '/outside', name: 'PROJECT_OUTSIDE', meta: { title: '' }, - children: [ - { - path: '/checkout/:orderNo', - name: 'CheckoutPay', - component: () => import('@/views/daxpay/outside/checkout/CheckoutPay.vue'), - meta: { title: '收银台', ignoreAuth: true }, - }, - ], + children: [], } /** diff --git a/src/views/daxpay/outside/checkout/CheckoutBarCode.vue b/src/views/daxpay/outside/checkout/CheckoutBarCode.vue new file mode 100644 index 00000000..d9146d08 --- /dev/null +++ b/src/views/daxpay/outside/checkout/CheckoutBarCode.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/src/views/daxpay/outside/checkout/CheckoutPay.api.ts b/src/views/daxpay/outside/checkout/CheckoutPay.api.ts index 9987d6f2..c6582c06 100644 --- a/src/views/daxpay/outside/checkout/CheckoutPay.api.ts +++ b/src/views/daxpay/outside/checkout/CheckoutPay.api.ts @@ -1,6 +1,6 @@ import { defHttp } from '@/utils/http/axios' import { Result } from '#/axios' -import {PayResult} from "@/views/daxpay/common/develop/trade/DevelopTrade.api"; +import { PayResult } from '@/views/daxpay/common/develop/trade/DevelopTrade.api' /** * 获取收银台订单和配置信息 @@ -17,10 +17,10 @@ export function getOrderAndConfig(orderNo, checkoutType) { /** * 发起普通支付 */ -export function getCheckoutUrl(orderNo,checkoutType) { +export function getCheckoutUrl(orderNo, checkoutType) { return defHttp.get>({ url: '/unipay/checkout/getCheckoutUrl', - params: {orderNo,checkoutType}, + params: { orderNo, checkoutType }, }) } /** @@ -33,7 +33,25 @@ export function checkoutPay(param: CheckoutPayParam) { }) } +/** + * 聚合条码支付 + */ +export function aggregateBarPay(param: AggregateBarPayParam) { + return defHttp.post>({ + url: '/unipay/checkout/aggregateBarPay', + data: param, + }) +} +/** + * 查询订单状态 + */ +export function findStatusByOrderNo(orderNo) { + return defHttp.get>({ + url: '/unipay/checkout/findStatusByOrderNo', + params: { orderNo }, + }) +} /** * 收银台支付参数 @@ -49,6 +67,15 @@ export interface CheckoutPayParam { barCode?: string } +/** + * 聚合条码支付参数 + */ +export interface AggregateBarPayParam { + /** 订单号 */ + orderNo?: string + /** 付款码 */ + barCode?: string +} /** * 收银台配置 */ @@ -61,18 +88,6 @@ export interface CheckoutOrderAndConfigResult { groupConfigs: CheckoutGroupConfigResult[] } -/** - * 收银台聚合支付配置 - */ -export interface AggregateOrderAndConfigResult { - /** 订单信息 */ - order: CheckoutOrderResult - /** 收银台配置信息 */ - config: CheckoutConfigResult - /** 收银台聚合配置信息 */ - aggregateConfig: AggregateConfigResult -} - /** * 订单信息 */ @@ -87,7 +102,6 @@ export interface CheckoutOrderResult { description?: string /** 金额(元) */ amount?: string - } /** * 收银台配置信息 @@ -130,17 +144,3 @@ export interface CheckoutItemConfigResult { /** 支付方式 */ payMethod?: string } - -/** - * 收银台聚合配置信息 - */ -export interface AggregateConfigResult { - /** 支付类型 */ - type?: string - /** 通道 */ - channel?: string - /** 支付方式 */ - payMethod?: string - /** 自动拉起支付 */ - autoLaunch?: boolean -} diff --git a/src/views/daxpay/outside/checkout/CheckoutPay.vue b/src/views/daxpay/outside/checkout/CheckoutPay.vue index f446b574..a3492b3e 100644 --- a/src/views/daxpay/outside/checkout/CheckoutPay.vue +++ b/src/views/daxpay/outside/checkout/CheckoutPay.vue @@ -1,177 +1,278 @@ - diff --git a/src/views/daxpay/outside/checkout/CheckoutQrCode.vue b/src/views/daxpay/outside/checkout/CheckoutQrCode.vue new file mode 100644 index 00000000..7fd8afc8 --- /dev/null +++ b/src/views/daxpay/outside/checkout/CheckoutQrCode.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/views/daxpay/outside/checkout/style.less b/src/views/daxpay/outside/checkout/style.less index 2f514e2d..73c10ab5 100644 --- a/src/views/daxpay/outside/checkout/style.less +++ b/src/views/daxpay/outside/checkout/style.less @@ -1,15 +1,15 @@ .page { box-sizing: border-box; min-height: 100%; - //padding-bottom: 80px; - //margin-top: 81px; + padding-bottom: 80px; + margin-top: 81px; } -.paydemo { +.pay { .content { max-width: 1120px; margin: 0 auto; } - .paydemo-type-content { + .pay-type-content { padding: 20px; margin-bottom: 10px; background-color: #FFFFFF; @@ -26,46 +26,30 @@ margin-right: 10px; cursor: pointer; } - .paydemoType { + .payType { padding: 12px; border: solid 2px #e2e2e2; margin-right: 10px; cursor: pointer; } - .paydemo-type-img { + .pay-type-img { width: 40px; height: 40px; vertical-align: center; } - .paydemo-type-name { + .pay-type-name { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; } - .paydemo-type-body { + .pay-type-body { display: flex; flex-direction: row; align-items: center; margin-bottom: 10px; } - .paydemo-type-h5 { - padding: 12px; - border: solid 2px #e2e2e2; - margin-right: 10px; - cursor: pointer; - font-size: 14px; - } - .codeImg_wx_h5 { - position: absolute; - z-index: 1001; - display: flex; - flex-direction: column; - align-items: center; - background-color: #ffffff; - width: 160px; - } - .paydemo-form-item { + .pay-form-item { height: 38px; margin-bottom: 5px; display: flex;