From 34560b7a70e29ae4b2bef2869a6f3a679ae0c001 Mon Sep 17 00:00:00 2001 From: bootx Date: Mon, 12 Feb 2024 01:40:11 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=89=8B=E6=9C=BA=E7=AB=AF=E6=94=B6?= =?UTF-8?q?=E9=93=B6=E5=8F=B0=E5=BC=80=E5=8F=91.=20vant=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E5=8C=BA=E6=8C=87=E4=BB=A4=E4=B8=8D=E7=94=9F=E6=95=88=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 12 ++ index.html | 3 +- src/enums/payment/payChannelEnum.ts | 13 ++ src/enums/payment/payWayEnum.ts | 12 ++ src/layout/index.vue | 1 - src/router/demo.ts | 8 + src/views/demo/cashier/AliPayH5Cashier.vue | 11 - src/views/demo/cashier/Cashier.api.ts | 36 ++++ src/views/demo/cashier/UniCashier.vue | 193 ++++++++++++++++++ src/views/demo/cashier/WechatPayH5Cashier.vue | 11 - 10 files changed, 276 insertions(+), 24 deletions(-) create mode 100644 src/enums/payment/payChannelEnum.ts create mode 100644 src/enums/payment/payWayEnum.ts delete mode 100644 src/views/demo/cashier/AliPayH5Cashier.vue create mode 100644 src/views/demo/cashier/Cashier.api.ts create mode 100644 src/views/demo/cashier/UniCashier.vue delete mode 100644 src/views/demo/cashier/WechatPayH5Cashier.vue diff --git a/components.d.ts b/components.d.ts index 117afe9..7dba384 100644 --- a/components.d.ts +++ b/components.d.ts @@ -9,12 +9,24 @@ declare module '@vue/runtime-core' { export interface GlobalComponents { Loading: typeof import('./src/components/Loading/Loading.vue')['default'] SvgIcon: typeof import('./src/components/SvgIcon/SvgIcon.vue')['default'] + VanActionBar: typeof import('vant/es')['ActionBar'] + VanActionBarButton: typeof import('vant/es')['ActionBarButton'] + VanActionSheet: typeof import('vant/es')['ActionSheet'] VanButton: typeof import('vant/es')['Button'] + VanCellGroup: typeof import('vant/es')['CellGroup'] VanConfigProvider: typeof import('vant/es')['ConfigProvider'] + VanField: typeof import('vant/es')['Field'] + VanForm: typeof import('vant/es')['Form'] + Vani: typeof import('vant/es')['i'] VanIcon: typeof import('vant/es')['Icon'] + VanInput: typeof import('vant/es')['Input'] VanLoading: typeof import('vant/es')['Loading'] VanNavBar: typeof import('vant/es')['NavBar'] + VanNumberKeyboard: typeof import('vant/es')['NumberKeyboard'] VanOverlay: typeof import('vant/es')['Overlay'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] + VanSwitch: typeof import('vant/es')['Switch'] VanTabbar: typeof import('vant/es')['Tabbar'] VanTabbarItem: typeof import('vant/es')['TabbarItem'] } diff --git a/index.html b/index.html index c519316..670b50a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,8 @@ - + + <%= title %> diff --git a/src/enums/payment/payChannelEnum.ts b/src/enums/payment/payChannelEnum.ts new file mode 100644 index 0000000..4d12281 --- /dev/null +++ b/src/enums/payment/payChannelEnum.ts @@ -0,0 +1,13 @@ +/** + * 支付通道 + */ +export enum payChannelEnum { + ALI = 'ali_pay', + WECHAT = 'wechat_pay', + UNION_PAY = 'union_pay', + CASH = 'cash_pay', + WALLET = 'wallet_pay', + VOUCHER = 'voucher_pay', + CREDIT_CARD = 'credit_pay', + AGGREGATION = 'aggregation_pay', +} diff --git a/src/enums/payment/payWayEnum.ts b/src/enums/payment/payWayEnum.ts new file mode 100644 index 0000000..2a4fc23 --- /dev/null +++ b/src/enums/payment/payWayEnum.ts @@ -0,0 +1,12 @@ +/** + * 支付通道 + */ +export enum payWayEnum { + NORMAL = 'normal', + WAP = 'wap', + APP = 'app', + WEB = 'web', + QRCODE = 'qrcode', + BARCODE = 'barcode', + JSAPI = 'jsapi', +} diff --git a/src/layout/index.vue b/src/layout/index.vue index 7a0e490..94a7612 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -42,7 +42,6 @@ const currentRoute = useRoute() const getTitle = computed(() => currentRoute.meta.title as string) - console.log(getTitle) // 菜单 const getMenus = computed(() => routeStore.menus.filter((item) => { diff --git a/src/router/demo.ts b/src/router/demo.ts index 3e693db..8e1bf37 100644 --- a/src/router/demo.ts +++ b/src/router/demo.ts @@ -26,5 +26,13 @@ export const DemoRoute: RouteRecordRaw = { title: '微信聚合支付', }, }, + { + path: '/cashier/uniCashier', + name: 'UniCashier', + component: () => import('@/views/demo/cashier/UniCashier.vue'), + meta: { + title: '手机收银台', + }, + }, ], } diff --git a/src/views/demo/cashier/AliPayH5Cashier.vue b/src/views/demo/cashier/AliPayH5Cashier.vue deleted file mode 100644 index 0a8d203..0000000 --- a/src/views/demo/cashier/AliPayH5Cashier.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/src/views/demo/cashier/Cashier.api.ts b/src/views/demo/cashier/Cashier.api.ts new file mode 100644 index 0000000..6e3d538 --- /dev/null +++ b/src/views/demo/cashier/Cashier.api.ts @@ -0,0 +1,36 @@ +import { http } from '@/utils/http/axios' +import { Result } from '#/axios' + +/** + * 获取当前可用支付的环境 + */ +export function getPayEnv(): Promise> { + return http.request({ + url: '/demo/cashier/getPayEnv', + method: 'get', + }) +} + +/** + * 单独支付 + */ +export function simplePayCashier(obj): Promise> { + return http.request({ + url: '/demo/cashier/simplePayCashier', + method: 'post', + data: obj, + }) +} +/** + * 发起支付后响应对象 + */ +export interface PayOrderResult { + // 支付ID + paymentId: string + // 是否是异步支付 + asyncPay: boolean + // 异步支付通道 + asyncChannel: string + // 支付参数体(通常用于发起异步支付的参数) + payBody: string +} diff --git a/src/views/demo/cashier/UniCashier.vue b/src/views/demo/cashier/UniCashier.vue new file mode 100644 index 0000000..a3d1df5 --- /dev/null +++ b/src/views/demo/cashier/UniCashier.vue @@ -0,0 +1,193 @@ + + + + diff --git a/src/views/demo/cashier/WechatPayH5Cashier.vue b/src/views/demo/cashier/WechatPayH5Cashier.vue deleted file mode 100644 index 0a8d203..0000000 --- a/src/views/demo/cashier/WechatPayH5Cashier.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - -