diff --git a/config/index.ts b/config/index.ts index 86fa9c6..bdb7305 100644 --- a/config/index.ts +++ b/config/index.ts @@ -1,20 +1,20 @@ // #ifdef MP-ALIPAY -const APP_ID = '123019'; -// const APP_ID = '12317'; +// const APP_ID = '123019'; +const APP_ID = '12317'; // #endif // #ifdef MP-WEIXIN -const APP_ID = '123018'; -// const APP_ID = '12316'; +// const APP_ID = '123018'; +const APP_ID = '12316'; // #endif // #ifndef MP-WEIXIN // #ifndef MP-ALIPAY -const APP_ID = '123018'; -// const APP_ID = '12316'; +// const APP_ID = '123018'; +const APP_ID = '12316'; // #endif // #endif export const APP_CONFIG = { - API_BASE_URL: 'https://dev.api.leapy.cn', + API_BASE_URL: 'https://api.leapy.cn', APP_ID, RESOURCE_URL: 'https://resource.leapy.cn/staff/', PROPERTY_IMG_URL: 'https://resource.leapy.cn/', diff --git a/pages.json b/pages.json index 4699222..abf9fbc 100644 --- a/pages.json +++ b/pages.json @@ -21,7 +21,7 @@ "style": { "enablePullDownRefresh": false, "navigationBarTextStyle": "black", - "navigationBarTitleText": "支付结果" + "navigationBarTitleText": "详情" } }, { diff --git a/pages/cashier/result.vue b/pages/cashier/result.vue index 23803a4..0b82bb7 100644 --- a/pages/cashier/result.vue +++ b/pages/cashier/result.vue @@ -1,5 +1,10 @@ @@ -52,12 +58,17 @@ import { computed, onUnmounted, ref } from 'vue'; import { onLoad } from '@dcloudio/uni-app'; import { queryTrade } from '@/api/cashier'; +import { APP_CONFIG } from '@/config'; const POLL_INTERVAL_MS = 1000; const POLL_MAX_ATTEMPTS = 240; +const PAY_RESULT_TITLE = '支付结果'; +const NEUTRAL_TITLE = '详情'; type ResultStatus = 'pending' | 'success' | 'failed'; +const emptyImage = `${APP_CONFIG.RESOURCE_URL}tip/message.png`; +const isValidEntry = ref(false); const amount = ref('0.00'); const accumulation = ref('0.00'); const merchantName = ref(''); @@ -97,12 +108,6 @@ const stopPolling = () => { }; const pollTradeStatus = async () => { - if (!tradeNo.value) { - status.value = 'failed'; - statusMessage.value = '缺少交易单号'; - return; - } - for (let attempt = 0; attempt < POLL_MAX_ATTEMPTS; attempt++) { if (pollStopped) return; @@ -127,6 +132,10 @@ const pollTradeStatus = async () => { } }; +const setPageTitle = (title: string) => { + uni.setNavigationBarTitle({ title }); +}; + const goMine = () => { uni.navigateTo({ url: '/pages/mine/index' @@ -147,12 +156,20 @@ const goCashier = () => { }; onLoad((options: any) => { + const nextTradeNo = decodeOption(options?.trade_no || options?.order_id || options?.orderId).trim(); + if (!nextTradeNo) { + setPageTitle(NEUTRAL_TITLE); + return; + } + + isValidEntry.value = true; + setPageTitle(PAY_RESULT_TITLE); amount.value = options?.amount || '0.00'; accumulation.value = options?.accumulation || '0.00'; merchantName.value = decodeOption(options?.merchant_name || options?.merchantName); merchantUrl.value = decodeOption(options?.merchant_url || options?.url); scoreName.value = decodeOption(options?.score_name) || '物业抵扣金'; - tradeNo.value = decodeOption(options?.trade_no || options?.order_id || options?.orderId); + tradeNo.value = nextTradeNo; pollTradeStatus(); }); @@ -168,6 +185,10 @@ onUnmounted(() => { background: #f4f6f8; } +.empty-page { + padding-top: 300rpx; +} + .result-card { padding: 72rpx 36rpx 48rpx; border-radius: 14rpx; diff --git a/pages/pay/pay.vue b/pages/pay/pay.vue index 8a7027b..3d6b4ba 100644 --- a/pages/pay/pay.vue +++ b/pages/pay/pay.vue @@ -1,34 +1,11 @@