diff --git a/package.json b/package.json index bcf5a141..abc1018a 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,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..4bb06b36 100644 --- a/src/api/pay/app/index.ts +++ b/src/api/pay/app/index.ts @@ -22,16 +22,6 @@ export interface AppPageReqVO extends PageParam { createTime?: Date[] } -export interface AppExportReqVO { - name?: string - status?: number - remark?: string - payNotifyUrl?: string - refundNotifyUrl?: string - merchantName?: string - createTime?: Date[] -} - export interface AppUpdateStatusReqVO { id: number status: number @@ -67,12 +57,9 @@ export const deleteApp = (id: number) => { return request.delete({ url: '/pay/app/delete?id=' + id }) } -// 导出支付应用 -export const exportApp = (params: AppExportReqVO) => { - return request.download({ url: '/pay/app/export-excel', params }) -} - -// 根据商ID称搜索应用列表 -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/merchant/index.ts b/src/api/pay/merchant/index.ts deleted file mode 100644 index bb630c36..00000000 --- a/src/api/pay/merchant/index.ts +++ /dev/null @@ -1,78 +0,0 @@ -import request from '@/config/axios' - -export interface MerchantVO { - id: number - no: string - name: string - shortName: string - status: number - remark: string - createTime: Date -} - -export interface MerchantPageReqVO extends PageParam { - no?: string - name?: string - shortName?: string - status?: number - remark?: string - createTime?: Date[] -} - -export interface MerchantExportReqVO { - no?: string - name?: string - shortName?: string - status?: number - remark?: string - createTime?: Date[] -} - -// 查询列表支付商户 -export const getMerchantPage = (params: MerchantPageReqVO) => { - return request.get({ url: '/pay/merchant/page', params }) -} - -// 查询详情支付商户 -export const getMerchant = (id: number) => { - return request.get({ url: '/pay/merchant/get?id=' + id }) -} - -// 根据商户名称搜索商户列表 -export const getMerchantListByName = (name?: string) => { - return request.get({ - url: '/pay/merchant/list-by-name', - params: { - name: name - } - }) -} - -// 新增支付商户 -export const createMerchant = (data: MerchantVO) => { - return request.post({ url: '/pay/merchant/create', data }) -} - -// 修改支付商户 -export const updateMerchant = (data: MerchantVO) => { - return request.put({ url: '/pay/merchant/update', data }) -} - -// 删除支付商户 -export const deleteMerchant = (id: number) => { - return request.delete({ url: '/pay/merchant/delete?id=' + id }) -} - -// 导出支付商户 -export const exportMerchant = (params: MerchantExportReqVO) => { - return request.download({ url: '/pay/merchant/export-excel', params }) -} - -// 支付商户状态修改 -export const updateMerchantStatus = (id: number, status: number) => { - const data = { - id, - status - } - return request.put({ url: '/pay/merchant/update-status', data: data }) -} diff --git a/src/api/pay/notify/index.ts b/src/api/pay/notify/index.ts new file mode 100644 index 00000000..dc8bd887 --- /dev/null +++ b/src/api/pay/notify/index.ts @@ -0,0 +1,16 @@ +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..71960a8a 100644 --- a/src/api/pay/order/index.ts +++ b/src/api/pay/order/index.ts @@ -93,19 +93,9 @@ export const getOrderDetail = async (id: number) => { return await request.get({ url: '/pay/order/get-detail?id=' + id }) } -// 新增支付订单 -export const createOrder = async (data: OrderVO) => { - return await request.post({ url: '/pay/order/create', data }) -} - -// 修改支付订单 -export const updateOrder = async (data: OrderVO) => { - return await request.put({ url: '/pay/order/update', data }) -} - -// 删除支付订单 -export const deleteOrder = async (id: number) => { - return await request.delete({ url: '/pay/order/delete?id=' + id }) +// 提交支付订单 +export const submitOrder = async (data: any) => { + return await request.post({ url: '/pay/order/submit', data }) } // 导出支付订单 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 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 diff --git a/src/config/axios/service.ts b/src/config/axios/service.ts index 1a4741b6..3a4635f0 100644 --- a/src/config/axios/service.ts +++ b/src/config/axios/service.ts @@ -31,7 +31,7 @@ let requestList: any[] = [] // 是否正在刷新中 let isRefreshToken = false // 请求白名单,无须token的接口 -const whiteList: string[] = ['/login', '/refresh-token'] +const whiteList: string[] = ['/login', '/refresh-token', '/system/tenant/get-id-by-name'] // 创建axios实例 const service: AxiosInstance = axios.create({ @@ -47,8 +47,7 @@ service.interceptors.request.use( let isToken = (config!.headers || {}).isToken === false whiteList.some((v) => { if (config.url) { - config.url.indexOf(v) > -1 - return (isToken = false) + return (isToken = config.url.indexOf(v) > -1) } }) if (getAccessToken() && !isToken) { 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 edde87d5..cd346a5c 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,36 @@ export const PayChannelEnum = { } } +/** + * 支付的展示模式每局 + */ +export const PayDisplayModeEnum = { + URL: { + mode: 'url' + }, + IFRAME: { + mode: 'iframe' + }, + FORM: { + mode: 'form' + }, + QR_CODE: { + mode: 'qr_code' + }, + APP: { + mode: 'app' + } +} + +/** + * 支付类型枚举 + */ +export const PayType = { + WECHAT: 'WECHAT', + ALIPAY: 'ALIPAY', + MOCK: 'MOCK' +} + /** * 支付订单状态枚举 */ @@ -143,80 +177,6 @@ export const PayOrderStatusEnum = { } } -/** - * 支付订单回调状态枚举 - */ -export const PayOrderNotifyStatusEnum = { - NO: { - status: 0, - name: '未通知' - }, - SUCCESS: { - status: 10, - name: '通知成功' - }, - FAILURE: { - status: 20, - name: '通知失败' - } -} - -/** - * 支付订单退款状态枚举 - */ -export const PayOrderRefundStatusEnum = { - NO: { - status: 0, - name: '未退款' - }, - SOME: { - status: 10, - name: '部分退款' - }, - ALL: { - status: 20, - name: '全部退款' - } -} - -/** - * 支付退款订单状态枚举 - */ -export const PayRefundStatusEnum = { - CREATE: { - status: 0, - name: '退款订单生成' - }, - SUCCESS: { - status: 1, - name: '退款成功' - }, - FAILURE: { - status: 2, - name: '退款失败' - }, - PROCESSING_NOTIFY: { - status: 3, - name: '退款中,渠道通知结果' - }, - PROCESSING_QUERY: { - status: 4, - name: '退款中,系统查询结果' - }, - UNKNOWN_RETRY: { - status: 5, - name: '状态未知,请重试' - }, - UNKNOWN_QUERY: { - status: 6, - name: '状态未知,系统查询结果' - }, - CLOSE: { - status: 99, - name: '退款关闭' - } -} - /** * 商品 SPU 状态 */ diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 67a92ba6..d11d1d33 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -130,17 +130,16 @@ export enum DICT_TYPE { BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type', // ========== PAY 模块 ========== - PAY_CHANNEL_WECHAT_VERSION = 'pay_channel_wechat_version', // 微信渠道版本 - 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_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/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 82dbe3fc..190c5aa1 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -148,6 +148,8 @@ import { ElLoading } from 'element-plus' import LoginFormTitle from './LoginFormTitle.vue' import type { RouteLocationNormalizedLoaded } from 'vue-router' +import { CACHE_KEY, useCache } from '@/hooks/web/useCache' +const { wsCache } = useCache() import { useIcon } from '@/hooks/web/useIcon' import * as authUtil from '@/utils/auth' @@ -244,6 +246,7 @@ const handleLogin = async (params) => { if (!res) { return } + wsCache.delete(CACHE_KEY.USER) // 清除上次登录用户信息 ElLoading.service({ lock: true, text: '正在加载系统中...', diff --git a/src/views/infra/fileConfig/FileConfigForm.vue b/src/views/infra/fileConfig/FileConfigForm.vue index 6332f702..06b80e7d 100644 --- a/src/views/infra/fileConfig/FileConfigForm.vue +++ b/src/views/infra/fileConfig/FileConfigForm.vue @@ -67,7 +67,7 @@ 主动模式 - 主动模式 + 被动模式 diff --git a/src/views/pay/app/components/AppForm.vue b/src/views/pay/app/components/AppForm.vue index 4277fb62..b99766c1 100644 --- a/src/views/pay/app/components/AppForm.vue +++ b/src/views/pay/app/components/AppForm.vue @@ -21,8 +21,8 @@ - - + + @@ -66,7 +66,7 @@ const formData = ref({ const formRules = reactive({ name: [{ required: true, message: '应用名不能为空', trigger: 'blur' }], status: [{ required: true, message: '开启状态不能为空', trigger: 'blur' }], - payNotifyUrl: [{ required: true, message: '支付结果的回调地址不能为空', trigger: 'blur' }], + orderNotifyUrl: [{ required: true, message: '支付结果的回调地址不能为空', trigger: 'blur' }], refundNotifyUrl: [{ required: true, message: '退款结果的回调地址不能为空', trigger: 'blur' }] }) const formRef = ref() // 表单 Ref @@ -122,7 +122,7 @@ const resetForm = () => { name: undefined, status: CommonStatusEnum.ENABLE, remark: undefined, - payNotifyUrl: undefined, + orderNotifyUrl: undefined, refundNotifyUrl: undefined } formRef.value?.resetFields() diff --git a/src/views/pay/app/index.vue b/src/views/pay/app/index.vue index d3f993e9..e1c3ce31 100644 --- a/src/views/pay/app/index.vue +++ b/src/views/pay/app/index.vue @@ -1,4 +1,5 @@