fix: 优化提示异常问题

This commit is contained in:
bootx
2025-05-11 22:15:42 +08:00
parent e8dc8b6a93
commit a9067f4725
3 changed files with 12 additions and 12 deletions

View File

@@ -187,12 +187,12 @@ async function wxAuth() {
// 认证获取OpenId // 认证获取OpenId
await auth(authParam.value).then(({ data, code, msg }) => { await auth(authParam.value).then(({ data, code, msg }) => {
if (code) { if (code) {
router.push({ name: 'payFail', query: { msg }, replace: true }) router.replace({ name: 'payFail', query: { msg }, replace: true })
return return
} }
openId.value = data.openId as string openId.value = data.openId as string
}).catch((res) => { }).catch((res) => {
router.push({ name: 'payFail', query: { msg: res.message }, replace: true }) router.replace({ name: 'payFail', query: { msg: res.message }, replace: true })
}) })
} }
@@ -210,7 +210,7 @@ function pay() {
aggregatePay(from) aggregatePay(from)
.then(({ data, code, msg }) => { .then(({ data, code, msg }) => {
if (code) { if (code) {
router.push({ name: 'payFail', query: { msg }, replace: true }) router.replace({ name: 'payFail', query: { msg }, replace: true })
return return
} }
// 根据类型拉起对应的支付。 支持跳转和jsapi // 根据类型拉起对应的支付。 支持跳转和jsapi

View File

@@ -84,7 +84,7 @@ const showRemark = ref<boolean>(false) // 是否展示备注
const loading = ref<boolean>(false) // 加载状态 const loading = ref<boolean>(false) // 加载状态
const cashierInfo = ref<GatewayCashierConfig>() const cashierInfo = ref<GatewayCashierConfig>()
const amount = ref<string>('0') // 金额 const amount = ref<string>('0') // 金额
const description = ref<string>('') // 描述 const description = ref<string>()
const { input, del } = useKeyboard(amount) const { input, del } = useKeyboard(amount)
@@ -101,14 +101,14 @@ function initData() {
getCashierCodeConfig(code, CashierCodeTypeEnum.ALIPAY) getCashierCodeConfig(code, CashierCodeTypeEnum.ALIPAY)
.then((res) => { .then((res) => {
if (res.code) { if (res.code) {
router.push({ name: 'payFail', query: { msg: res.msg } }) router.replace({ name: 'payFail', query: { msg: res.msg } })
return return
} }
loading.value = false loading.value = false
cashierInfo.value = res.data as any cashierInfo.value = res.data as any
}) })
.catch((res) => { .catch((res) => {
router.push({ name: 'payFail', query: { msg: res.message } }) router.replace({ name: 'payFail', query: { msg: res.message } })
}) })
} }

View File

@@ -97,8 +97,8 @@ const showRemark = ref<boolean>(false)
const loading = ref<boolean>(false) const loading = ref<boolean>(false)
const cashierInfo = ref<GatewayCashierConfig>({}) const cashierInfo = ref<GatewayCashierConfig>({})
const amount = ref<string>('0') const amount = ref<string>('0')
const description = ref<string>('') const description = ref<string>()
const openId = ref<string>('') const openId = ref<string>()
const { input, del } = useKeyboard(amount) const { input, del } = useKeyboard(amount)
@@ -141,13 +141,13 @@ async function init() {
auth({ cashierCode: cashierCode as string, cashierType: CashierCodeTypeEnum.WECHAT_PAY, authCode: authCode as string }) auth({ cashierCode: cashierCode as string, cashierType: CashierCodeTypeEnum.WECHAT_PAY, authCode: authCode as string })
.then((res) => { .then((res) => {
if (res.code) { if (res.code) {
router.push({ name: 'payFail', query: { msg: res.msg } }) router.replace({ name: 'payFail', query: { msg: res.msg } })
return return
} }
openId.value = res.data.openId as string openId.value = res.data.openId as string
show.value = true show.value = true
}).catch((res) => { }).catch((res) => {
router.push({ name: 'payFail', query: { msg: res.message }, replace: true }) router.replace({ name: 'payFail', query: { msg: res.message }, replace: true })
}) })
} }
} }
@@ -156,7 +156,7 @@ async function init() {
} }
}) })
.catch((error) => { .catch((error) => {
router.push({ name: 'payFail', query: { msg: error } }) router.replace({ name: 'payFail', query: { msg: error } })
}) })
} }
@@ -181,7 +181,7 @@ function pay() {
cashierPay(from) cashierPay(from)
.then((res) => { .then((res) => {
if (res.code) { if (res.code) {
router.push({ name: 'payFail', query: { msg: res.msg } }) router.replace({ name: 'payFail', query: { msg: res.msg } })
return return
} }
loading.value = false loading.value = false