diff --git a/.env b/.env index 9df3ab2..9479e92 100644 --- a/.env +++ b/.env @@ -1,12 +1,12 @@ # port -VITE_PORT = 9100 +VITE_PORT=9100 # spa-title -VITE_GLOB_APP_TITLE = DaxPay +VITE_GLOB_APP_TITLE=DaxPay # 系统中文名称 -VITE_GLOB_APP_TITLE_CN = DaxPay支付系统 +VITE_GLOB_APP_TITLE_CN=DaxPay支付系统 -# spa shortname 不可出现空格数字等特殊字符 -VITE_GLOB_APP_SHORT_NAME = vantMobile +# spa shortname 不可出现空格数字连接线等特殊字符 +VITE_GLOB_APP_SHORT_NAME=DaxPay diff --git a/.env.development b/.env.development index d6a5e2c..3e0ffc3 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,7 @@ VITE_PORT=9100 # 网站根目录 -VITE_PUBLIC_PATH=/ +VITE_PUBLIC_PATH=/h5 # 跨域代理,可以配置多个,请注意不要换行 VITE_PROXY=[["/server","http://localhost:10880"]] diff --git a/.env.production b/.env.production index fdfc2b2..99a6fd4 100644 --- a/.env.production +++ b/.env.production @@ -1,12 +1,12 @@ # 独立部署模式 -VITE_PUBLIC_PATH = / -# API 接口前缀 -VITE_GLOB_API_URL_PREFIX = /api - -# 嵌入式模式 与网关部署在一起, 和 接口 (server) 前缀 这个是 -#VITE_PUBLIC_PATH=/h5 +#VITE_PUBLIC_PATH = / ## API 接口前缀 -#VITE_GLOB_API_URL_PREFIX= +#VITE_GLOB_API_URL_PREFIX=/api + +# 嵌入式模式 与网关部署在一起 +VITE_PUBLIC_PATH=/h5 +# API 接口前缀 +VITE_GLOB_API_URL_PREFIX= # 是否删除console VITE_DROP_CONSOLE=true diff --git a/components.d.ts b/components.d.ts index 5629e63..e56734a 100644 --- a/components.d.ts +++ b/components.d.ts @@ -16,6 +16,7 @@ declare module 'vue' { VanField: typeof import('vant/es')['Field'] VanLoading: typeof import('vant/es')['Loading'] VanNumberKeyboard: typeof import('vant/es')['NumberKeyboard'] + VanOverlay: typeof import('vant/es')['Overlay'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/router/daxpay.ts b/src/router/daxpay.ts index f8dcba8..3c850a0 100644 --- a/src/router/daxpay.ts +++ b/src/router/daxpay.ts @@ -27,7 +27,7 @@ export const DaxPayRoute: RouteRecordRaw = { }, }, { - path: '/channel/cashier/:mchNo/:appId', + path: '/channel/cashier/:appId', name: 'ChannelCashier', component: () => import('@/views/daxpay/channel/ChannelCashier.vue'), meta: { @@ -35,7 +35,7 @@ export const DaxPayRoute: RouteRecordRaw = { }, }, { - path: '/alipay/cashier/:mchNo/:appId', + path: '/alipay/cashier/:appId', name: 'AlipayCashier', component: () => import('@/views/daxpay/channel/alipay/cashier/AlipayCashier.vue'), meta: { @@ -43,7 +43,7 @@ export const DaxPayRoute: RouteRecordRaw = { }, }, { - path: '/wechat/cashier/:mchNo/:appId', + path: '/wechat/cashier/:appId', name: 'WechatCashier', component: () => import('@/views/daxpay/channel/wechat/cashier/WechatCashier.vue'), meta: { diff --git a/src/router/index.ts b/src/router/index.ts index 1ed0233..a271200 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -23,7 +23,7 @@ routeStore.setRouters(constantRouter.concat(routeModuleList)) const router = createRouter({ // 重定向时hash模式有场景无法跳转,需要使用history模式 - history: createWebHistory(''), + history: createWebHistory(import.meta.env.VITE_PUBLIC_PATH), routes: constantRouter.concat(...routeModuleList), strict: true, scrollBehavior: () => ({ left: 0, top: 0 }), diff --git a/src/views/daxpay/channel/ChannelCashier.api.ts b/src/views/daxpay/channel/ChannelCashier.api.ts index f794d26..4a3f2d9 100644 --- a/src/views/daxpay/channel/ChannelCashier.api.ts +++ b/src/views/daxpay/channel/ChannelCashier.api.ts @@ -2,16 +2,6 @@ import type { AuthResult } from './ChannelAuth.api' import { http } from '@/utils/http/axios' import type { Result } from '#/axios' -/** - * 获取商户名称 - */ -export function getMchName(mchNo: string) { - return http.request>({ - url: '/unipay/ext/channel/cashier/getMchName', - method: 'GET', - params: { mchNo }, - }) -} /** * 获取收银台信息 @@ -61,8 +51,6 @@ export function cashierPay(param: CashierPayParam) { * 通道认证参数 */ export interface CashierAuthParam { - // 商户号 - mchNo?: string // 应用号 appId?: string // 收银台类型 @@ -75,9 +63,6 @@ export interface CashierAuthParam { * 通道收银支付参数 */ export interface CashierPayParam { - - // 商户号 - mchNo?: string // 应用号 appId?: string // 收银台类型 @@ -127,8 +112,6 @@ export interface WxJsapiSignResult { * 收银台配置信息 */ export interface ChannelCashierConfigResult { - // 商户号 - mchNo?: string // 应用号 appId?: string // 收银台类型 diff --git a/src/views/daxpay/channel/ChannelCashier.vue b/src/views/daxpay/channel/ChannelCashier.vue index 08642f7..d97039c 100644 --- a/src/views/daxpay/channel/ChannelCashier.vue +++ b/src/views/daxpay/channel/ChannelCashier.vue @@ -6,14 +6,14 @@ import { useRoute } from 'vue-router' import router from '@/router' const route = useRoute() -const { mchNo, appId } = route.params +const { appId } = route.params const ua = navigator.userAgent if (ua.includes('MicroMessenger')) { - router.push({ path: `/wechat/cashier/${mchNo}/${appId}`, replace: true }) + router.push({ path: `/wechat/cashier/${appId}`, replace: true }) } else if (ua.includes('Alipay')) { - router.push({ path: `/alipay/cashier/${mchNo}/${appId}`, replace: true }) + router.push({ path: `/alipay/cashier/${appId}`, replace: true }) } else { router.push({ name: 'ErrorResult', query: { msg: '请使用支付宝、微信等支付程序进行扫码支付' }, replace: true }) diff --git a/src/views/daxpay/channel/alipay/cashier/AlipayCashier.vue b/src/views/daxpay/channel/alipay/cashier/AlipayCashier.vue index 3fd5400..742cd2a 100644 --- a/src/views/daxpay/channel/alipay/cashier/AlipayCashier.vue +++ b/src/views/daxpay/channel/alipay/cashier/AlipayCashier.vue @@ -6,7 +6,7 @@

- 付款给{{ mchName }} + 付款金额

¥ {{ amount }} @@ -70,7 +70,6 @@ import type { import { cashierPay, getCashierInfo, - getMchName, } from '@/views/daxpay/channel/ChannelCashier.api' import { CashierTypeEnum } from '@/enums/daxpay/DaxPayEnum' @@ -78,14 +77,13 @@ import router from '@/router' import { useKeyboard } from '@/hooks/daxpay/useKeyboard' const route = useRoute() -const { mchNo, appId } = route.params +const { appId } = route.params const showRemark = ref(false) const loading = ref(false) const cashierInfo = ref({}) const amount = ref('0') const description = ref('') -const mchName = ref('') const { input, del } = useKeyboard(amount) @@ -102,11 +100,6 @@ function initData() { }).catch((res) => { router.push({ name: 'ErrorResult', query: { msg: res.message } }) }) - getMchName(mchNo as string).then(({ data }) => { - mchName.value = data - }).catch((res) => { - router.push({ name: 'ErrorResult', query: { msg: res.message } }) - }) } /** @@ -124,7 +117,6 @@ function pay() { appId, cashierType: CashierTypeEnum.ALIPAY, description: description.value, - mchNo, } as CashierPayParam cashierPay(from) .then(({ data }) => { diff --git a/src/views/daxpay/channel/wechat/cashier/WechatCashier.vue b/src/views/daxpay/channel/wechat/cashier/WechatCashier.vue index f26e1bd..ce40d1a 100644 --- a/src/views/daxpay/channel/wechat/cashier/WechatCashier.vue +++ b/src/views/daxpay/channel/wechat/cashier/WechatCashier.vue @@ -6,7 +6,7 @@

- 付款给{{ mchName }} + 付款金额

¥ {{ amount }} @@ -74,7 +74,6 @@ import { , cashierPay, generateAuthUrl, getCashierInfo, - getMchName, } from '@/views/daxpay/channel/ChannelCashier.api' import { CashierTypeEnum } from '@/enums/daxpay/DaxPayEnum' @@ -82,7 +81,7 @@ import router from '@/router' import { useKeyboard } from '@/hooks/daxpay/useKeyboard' const route = useRoute() -const { mchNo, appId } = route.params +const { appId } = route.params const { code } = route.query const show = ref(false) @@ -91,12 +90,10 @@ const loading = ref(false) const cashierInfo = ref({}) const amount = ref('0') const description = ref('') -const mchName = ref('') const openId = ref('') // 认证参数 const authParam = ref({ - mchNo: mchNo as string, appId: appId as string, cashierType: CashierTypeEnum.WECHAT_PAY, }) @@ -138,11 +135,6 @@ function initData() { }).catch((res) => { router.push({ name: 'ErrorResult', query: { msg: res.message } }) }) - getMchName(mchNo as string).then(({ data }) => { - mchName.value = data - }).catch((res) => { - router.push({ name: 'ErrorResult', query: { msg: res.message } }) - }) auth(authParam.value).then(({ data }) => { openId.value = data.openId as string }).catch((res) => { @@ -167,7 +159,6 @@ function pay() { openId: openId.value, cashierType: CashierTypeEnum.WECHAT_PAY, description: description.value, - mchNo, } as CashierPayParam cashierPay(from) .then(({ data }) => {