refactor: 国际化文本迁移至全局 locales/messages.js

将组件级 i18n 对象重构为统一由全局 locales/messages.js 管理,确保中英文语言切换时正确显示对应文本。

- 新增 utils/i18n.js 国际化工具函数
- 更新 store/$t.mixin.js 翻译混入逻辑
- 迁移 pkgService、pkgBooking、pkgAccount、pkgExplore、pages 等共 58 个组件的中英文文本至全局消息表
This commit is contained in:
liangjian
2026-07-24 13:43:41 +08:00
parent 445bd850f4
commit 6e721ccc7e
58 changed files with 1810 additions and 4065 deletions

View File

@@ -1,24 +1,24 @@
<template>
<view class="bill-panel">
<view class="hero-panel tn-margin-bottom-lg">
<view class="hero-title tn-margin-top">{{ t('heroTitle') }}</view>
<view class="hero-title tn-margin-top">{{ $tr('待支付账单') }}</view>
<view class="hero-desc tn-margin-top-sm">{{ heroDesc }}</view>
<view v-if="currentReferenceTypeNo" class="source-tag tn-margin-top-sm">{{ t('applicationNoPrefix') }}{{ currentReferenceTypeNo }}</view>
<view v-if="currentReferenceTypeNo" class="source-tag tn-margin-top-sm">{{ $tr('申请单号:') }}{{ currentReferenceTypeNo }}</view>
<view class="hero-summary tn-margin-top-lg">
<view class="summary-card">
<view class="summary-label">{{ t('pendingCountLabel') }}</view>
<view class="summary-label">{{ $tr('待支付数量') }}</view>
<view class="summary-value tn-margin-top-sm">{{ billList.length }}</view>
</view>
<view class="summary-card">
<view class="summary-label">{{ t('pendingAmountLabel') }}</view>
<view class="summary-label">{{ $tr('待支付总额') }}</view>
<view class="summary-value tn-margin-top-sm">¥{{ formatMoney(totalRemainingAmount) }}</view>
</view>
</view>
</view>
<view v-if="loading || resolvingReference" class="empty-panel tn-padding-lg">
<view class="empty-title">{{ t('loadingTitle') }}</view>
<view class="empty-desc tn-margin-top-sm">{{ t('loadingDesc') }}</view>
<view class="empty-title">{{ $tr('账单加载中') }}</view>
<view class="empty-desc tn-margin-top-sm">{{ $tr('正在同步您的待支付账单,请稍候。') }}</view>
</view>
<view v-else-if="billList.length">
@@ -39,64 +39,64 @@
<view class="card-body tn-margin-top">
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('relatedBusinessNoLabel') }}</text>
<text class="info-label">{{ $tr('关联业务编号') }}</text>
<text class="info-value">{{ getBillReferenceTypeNo(item) || '--' }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('totalChargeLabel') }}</text>
<text class="info-label">{{ $tr('应收合计') }}</text>
<text class="info-value">¥{{ formatMoney(getBillTotalCharge(item)) }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('paidAmountLabel') }}</text>
<text class="info-label">{{ $tr('已付金额') }}</text>
<text class="info-value">¥{{ formatMoney(getBillPaidAmount(item)) }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('remainingAmountLabel') }}</text>
<text class="info-label">{{ $tr('待付金额') }}</text>
<text class="info-value info-value--highlight">¥{{ formatMoney(getBillRemainingAmount(item)) }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('refundStatusLabel') }}</text>
<text class="info-label">{{ $tr('退款状态') }}</text>
<text class="info-value">{{ getRefundStatusText(getBillRefundStatus(item)) }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('createTimeLabel') }}</text>
<text class="info-label">{{ $tr('创建时间') }}</text>
<text class="info-value">{{ formatDateTime(getBillCreateTime(item)) }}</text>
</view>
</view>
<view v-if="getBillRemark(item) || getBillResult(item)" class="remark-panel tn-margin-top">
<view v-if="getBillRemark(item)" class="remark-line">
<text class="remark-label">{{ t('remarkLabel') }}</text>
<text class="remark-label">{{ $tr('备注') }}</text>
<text class="remark-text">{{ getBillRemark(item) }}</text>
</view>
<view v-if="getBillResult(item)" class="remark-line tn-margin-top-sm">
<text class="remark-label">{{ t('resultLabel') }}</text>
<text class="remark-label">{{ $tr('处理结果') }}</text>
<text class="remark-text">{{ getBillResult(item) }}</text>
</view>
</view>
<view v-if="getPendingPaymentOrder(item)" class="pending-payment-panel tn-margin-top">
<view class="pending-payment-title">{{ t('pendingPaymentTitle') }}</view>
<view class="pending-payment-title">{{ $tr('未完成支付订单') }}</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('pendingPaymentOrderNoLabel') }}</text>
<text class="info-label">{{ $tr('支付单号') }}</text>
<text class="info-value">{{ getPendingPaymentOrderNo(item) }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('pendingPaymentAmountLabel') }}</text>
<text class="info-label">{{ $tr('订单金额') }}</text>
<text class="info-value info-value--highlight">¥{{ formatMoney(getPendingPaymentAmount(item)) }}</text>
</view>
<view v-if="getPendingPaymentExpireText(item)" class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('pendingPaymentExpireLabel') }}</text>
<text class="info-label">{{ $tr('剩余支付时间') }}</text>
<text class="info-value" :class="{ 'info-value--expired': isPendingPaymentExpired(item) }">
{{ getPendingPaymentExpireText(item) }}
</text>
</view>
<view v-if="getPendingPaymentDescription(item)" class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('pendingPaymentDescLabel') }}</text>
<text class="info-label">{{ $tr('支付说明') }}</text>
<text class="info-value">{{ getPendingPaymentDescription(item) }}</text>
</view>
<view v-if="getPendingPaymentChannel(item)" class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('pendingPaymentChannelLabel') }}</text>
<text class="info-label">{{ $tr('支付渠道') }}</text>
<text class="info-value">{{ getPendingPaymentChannel(item) }}</text>
</view>
</view>
@@ -124,10 +124,10 @@
</view>
<view v-else class="empty-panel tn-padding-lg">
<view class="empty-title">{{ currentReferenceTypeNo ? t('emptyPendingTitle') : t('emptyApplicationTitle') }}</view>
<view class="empty-desc tn-margin-top-sm">{{ currentReferenceTypeNo ? t('emptyPendingDesc') : t('emptyApplicationDesc') }}</view>
<view class="empty-title">{{ currentReferenceTypeNo ? $tr('暂无待支付账单') : $tr('暂无可查询申请单') }}</view>
<view class="empty-desc tn-margin-top-sm">{{ currentReferenceTypeNo ? $tr('当前申请单下没有查询到待支付账单,后续有新账单时会在这里展示。') : $tr('当前未找到可关联的申请单,请先前往“我的申请”选择具体申请后查看账单。') }}</view>
<view v-if="!currentReferenceTypeNo" class="empty-action tn-margin-top-lg" @tap="goToMyApplication">
<text class="tn-text-bold">{{ t('goToMyApplication') }}</text>
<text class="tn-text-bold">{{ $tr('前往我的申请') }}</text>
</view>
</view>
@@ -197,7 +197,7 @@
<view v-if="isPaymentWaitingStage" class="payment-progress-card">
<view class="payment-progress-head tn-flex tn-flex-row-between tn-flex-col-center">
<text class="payment-progress-label">{{ t('paymentProgressLabel') }}</text>
<text class="payment-progress-label">{{ $tr('结果确认进度') }}</text>
<text class="payment-progress-value">{{ paymentProgressText }}</text>
</view>
<view class="payment-progress-track">
@@ -208,11 +208,11 @@
<view class="payment-summary-grid">
<view class="payment-summary-item">
<view class="payment-summary-label">{{ t('billNoLabel') }}</view>
<view class="payment-summary-label">{{ $tr('账单号') }}</view>
<view class="payment-summary-value payment-summary-value--mono">{{ paymentWaitingBillNo || '--' }}</view>
</view>
<view class="payment-summary-item">
<view class="payment-summary-label">{{ t('currentPaymentLabel') }}</view>
<view class="payment-summary-label">{{ $tr('本次支付') }}</view>
<view class="payment-summary-value payment-summary-value--price">¥{{ paymentWaitingAmountText }}</view>
</view>
</view>
@@ -380,212 +380,6 @@ export default {
lines: [],
confirmText: '',
cancelText: ''
},
i18n: {
zh: {
heroTitle: '待支付账单',
applicationNoPrefix: '申请单号:',
pendingCountLabel: '待支付数量',
pendingAmountLabel: '待支付总额',
loadingTitle: '账单加载中',
loadingDesc: '正在同步您的待支付账单,请稍候。',
relatedBusinessNoLabel: '关联业务编号',
totalChargeLabel: '应收合计',
paidAmountLabel: '已付金额',
remainingAmountLabel: '待付金额',
refundStatusLabel: '退款状态',
createTimeLabel: '创建时间',
remarkLabel: '备注',
resultLabel: '处理结果',
pendingPaymentTitle: '未完成支付订单',
pendingPaymentOrderNoLabel: '支付单号',
pendingPaymentAmountLabel: '订单金额',
pendingPaymentDescLabel: '支付说明',
pendingPaymentChannelLabel: '支付渠道',
pendingPaymentExpireLabel: '剩余支付时间',
pendingPaymentExpired: '已失效',
emptyPendingTitle: '暂无待支付账单',
emptyApplicationTitle: '暂无可查询申请单',
emptyPendingDesc: '当前申请单下没有查询到待支付账单,后续有新账单时会在这里展示。',
emptyApplicationDesc: '当前未找到可关联的申请单,请先前往“我的申请”选择具体申请后查看账单。',
goToMyApplication: '前往我的申请',
paymentProgressLabel: '结果确认进度',
billNoLabel: '账单号',
currentPaymentLabel: '本次支付',
heroDescResolved: '当前页面已按申请单编号查询其关联的待支付账单记录。',
heroDescAutoResolve: '当前将优先读取最近申请单的编号来查询关联账单。',
paymentStageLaunching: '正在唤起微信收银台',
paymentStagePolling: '正在同步支付结果',
paymentStageSuccess: '支付结果已确认',
paymentStageFailed: '支付未完成',
paymentStageDefault: '支付处理中',
paymentTitleLaunching: '请完成微信支付',
paymentTitlePolling: '正在确认是否支付成功',
paymentTitleSuccess: '支付成功',
paymentTitleFailed: '支付结果确认失败',
paymentTitleDefault: '支付处理中',
paymentDescLaunching: '系统正在调起微信支付,请在微信收银台中完成付款后返回。',
paymentDescPolling: '支付完成后,系统会自动向后台查询支付状态,无需手动刷新。',
paymentDescSuccess: '本次支付已同步完成,账单状态已更新。',
paymentDescFailed: '系统暂时未能确认支付成功,您可以查看提示后稍后重试。',
paymentProgressWaiting: '等待支付完成',
paymentHintLaunching: '已为您准备好支付信息,等待微信支付完成。',
paymentHintPolling: '正在与后台核对支付状态,请稍候。',
paymentTipsTitleFailed: '处理建议',
paymentTipsTitleSuccess: '完成说明',
paymentTipsTitleDefault: '温馨提示',
paymentTipsFailed1: '若您已完成付款,请稍后刷新账单,避免重复支付。',
paymentTipsFailed2: '若微信侧已扣款但页面未更新,请联系管家或客服协助核实。',
paymentTipsFailed3: '若未扣款,可返回账单列表后重新发起支付。',
paymentTipsSuccess1: '若当前申请单还有其他待付账单,可继续在当前页完成支付。',
paymentTipsSuccess2: '若当前账单已全部支付完成,系统会自动返回首页。',
paymentTipsSuccess3: '支付记录同步可能略有延迟,刷新后即可看到最新状态。',
paymentTipsDefault1: '支付成功后,系统可能需要几秒钟同步账单状态。',
paymentTipsDefault2: '请不要重复点击支付,也不要提前关闭当前页面。',
paymentTipsDefault3: '如果超时未完成,系统会自动再校验一次账单状态。',
paymentActionAcknowledge: '我知道了',
buttonConfirming: '确认结果中...',
buttonPolling: '查询结果中({current}/{total})',
buttonLaunching: '拉起支付中...',
wechatPayButton: '微信支付',
continuePayButton: '继续支付',
paymentStatusPending: '处理中',
billRecordFallback: '账单记录',
paymentParamIncomplete: '微信支付参数不完整',
wechatCodeFailed: '获取微信登录凭证失败',
billPaymentDesc: '账单支付',
paymentFailedHint: '暂未查询到支付成功结果,请稍后刷新账单确认。',
paymentResultSuccess: '后台确认支付成功',
paymentResultFailed: '后台返回支付失败',
paymentResultPending: '后台仍在处理中',
paymentHintPaidWaiting: '已支付成功,正在等待后台确认账单状态。',
paymentFailedError: '支付失败',
paymentTimeoutError: '支付结果确认超时,请稍后刷新账单确认',
paymentSuccessPendingBills: '支付结果已确认,当前申请单仍有其他待支付账单。',
paymentSuccessAllDone: '支付结果已确认,当前申请单账单已全部完成。',
billInfoIncomplete: '账单信息不完整',
paymentNoticeTitle: '用户须知',
paymentNoticeBillLabel: '账单号',
paymentNoticeAmountLabel: '支付金额',
paymentNoticeItemLabel: '费用项目',
paymentNoticeLine1: '请确认本次支付账单和金额无误后再继续付款。',
paymentNoticeLine2: '支付完成后,账单状态可能需要几秒同步,请勿重复支付。',
paymentNoticeLine3: '若支付中断或页面关闭,可稍后返回账单页查看最新结果。',
paymentNoticeConfirm: '继续支付',
paymentNoticeCancel: '稍后再付',
paymentHintLaunchingToast: '正在唤起微信支付,请在微信内完成付款。',
paymentCanceled: '已取消支付',
paymentResultFailedRetry: '支付结果确认失败,请稍后刷新账单确认',
billLoadFailed: '账单加载失败',
cancelOrderButton: '取消订单',
cancelOrderLoading: '取消中...',
cancelOrderTitle: '取消订单',
cancelOrderContent: '取消后将关闭当前未支付订单,是否继续?',
cancelOrderSuccess: '订单已取消',
cancelOrderFailed: '取消订单失败'
},
en: {
heroTitle: 'Pending Bills',
applicationNoPrefix: 'Application No: ',
pendingCountLabel: 'Pending Count',
pendingAmountLabel: 'Pending Amount',
loadingTitle: 'Loading Bills',
loadingDesc: 'Syncing your pending bills, please wait.',
relatedBusinessNoLabel: 'Related Business No.',
totalChargeLabel: 'Total Charge',
paidAmountLabel: 'Paid Amount',
remainingAmountLabel: 'Remaining Amount',
refundStatusLabel: 'Refund Status',
createTimeLabel: 'Created At',
remarkLabel: 'Remark',
resultLabel: 'Result',
pendingPaymentTitle: 'Unfinished Payment',
pendingPaymentOrderNoLabel: 'Payment Order No.',
pendingPaymentAmountLabel: 'Order Amount',
pendingPaymentDescLabel: 'Description',
pendingPaymentChannelLabel: 'Channel',
pendingPaymentExpireLabel: 'Time Left',
pendingPaymentExpired: 'Expired',
emptyPendingTitle: 'No Pending Bills',
emptyApplicationTitle: 'No Application Available',
emptyPendingDesc: 'No pending bills are found under the current application. New bills will appear here later.',
emptyApplicationDesc: 'No related application is found. Please go to "My Applications" and select an application first.',
goToMyApplication: 'Go to My Applications',
paymentProgressLabel: 'Confirmation Progress',
billNoLabel: 'Bill No.',
currentPaymentLabel: 'This Payment',
heroDescResolved: 'This page is querying pending bills by the current application number.',
heroDescAutoResolve: 'The latest application number will be used first to query related bills.',
paymentStageLaunching: 'Launching Wechat Pay',
paymentStagePolling: 'Syncing Payment Result',
paymentStageSuccess: 'Payment Confirmed',
paymentStageFailed: 'Payment Incomplete',
paymentStageDefault: 'Processing Payment',
paymentTitleLaunching: 'Complete Wechat Pay',
paymentTitlePolling: 'Confirming Payment Result',
paymentTitleSuccess: 'Payment Successful',
paymentTitleFailed: 'Payment Confirmation Failed',
paymentTitleDefault: 'Processing Payment',
paymentDescLaunching: 'Wechat Pay is being launched. Complete the payment in Wechat and return here.',
paymentDescPolling: 'After payment, the system checks the payment status automatically. No manual refresh is needed.',
paymentDescSuccess: 'This payment has been synchronized and the bill status is updated.',
paymentDescFailed: 'The system cannot confirm the payment for now. Please review the tips and try again later.',
paymentProgressWaiting: 'Waiting for Payment',
paymentHintLaunching: 'Payment information is ready. Waiting for Wechat payment to complete.',
paymentHintPolling: 'Checking payment status with the backend, please wait.',
paymentTipsTitleFailed: 'Suggestions',
paymentTipsTitleSuccess: 'Completion Notes',
paymentTipsTitleDefault: 'Tips',
paymentTipsFailed1: 'If you have completed the payment, refresh the bill later to avoid duplicate payment.',
paymentTipsFailed2: 'If Wechat has deducted the amount but the page is not updated, contact your manager or support for verification.',
paymentTipsFailed3: 'If no deduction occurred, return to the bill list and try again.',
paymentTipsSuccess1: 'If there are other pending bills under this application, you can continue paying on this page.',
paymentTipsSuccess2: 'If all bills are paid, the system returns to the home page automatically.',
paymentTipsSuccess3: 'Payment record synchronization may be slightly delayed. Refresh to see the latest status.',
paymentTipsDefault1: 'After successful payment, the system may need a few seconds to sync the bill status.',
paymentTipsDefault2: 'Do not tap the pay button repeatedly or close this page too early.',
paymentTipsDefault3: 'If the process times out, the system checks the bill status again automatically.',
paymentActionAcknowledge: 'Got It',
buttonConfirming: 'Confirming...',
buttonPolling: 'Checking ({current}/{total})',
buttonLaunching: 'Launching...',
wechatPayButton: 'Wechat Pay',
continuePayButton: 'Continue Pay',
paymentStatusPending: 'Processing',
billRecordFallback: 'Bill Record',
paymentParamIncomplete: 'Incomplete Wechat payment parameters',
wechatCodeFailed: 'Failed to get Wechat login code',
billPaymentDesc: 'Bill Payment',
paymentFailedHint: 'Payment success is not confirmed yet. Please refresh the bill later.',
paymentResultSuccess: 'Backend confirmed payment success',
paymentResultFailed: 'Backend returned payment failure',
paymentResultPending: 'Backend is still processing',
paymentHintPaidWaiting: 'Payment succeeded. Waiting for backend confirmation of the bill status.',
paymentFailedError: 'Payment failed',
paymentTimeoutError: 'Payment confirmation timed out. Please refresh the bill later.',
paymentSuccessPendingBills: 'Payment is confirmed. There are still other unpaid bills under this application.',
paymentSuccessAllDone: 'Payment is confirmed. All bills under this application are completed.',
billInfoIncomplete: 'Incomplete bill information',
paymentNoticeTitle: 'Payment Notice',
paymentNoticeBillLabel: 'Bill No.',
paymentNoticeAmountLabel: 'Amount',
paymentNoticeItemLabel: 'Charge Item',
paymentNoticeLine1: 'Please confirm the bill and payment amount before continuing.',
paymentNoticeLine2: 'After payment, the bill status may take a few seconds to sync. Please do not pay repeatedly.',
paymentNoticeLine3: 'If the payment is interrupted or the page is closed, return to the bill page later to check the latest result.',
paymentNoticeConfirm: 'Continue',
paymentNoticeCancel: 'Later',
paymentHintLaunchingToast: 'Launching Wechat Pay. Please complete the payment in Wechat.',
paymentCanceled: 'Payment canceled',
paymentResultFailedRetry: 'Payment confirmation failed. Please refresh the bill later.',
billLoadFailed: 'Failed to load bills',
cancelOrderButton: 'Cancel Order',
cancelOrderLoading: 'Canceling...',
cancelOrderTitle: 'Cancel Order',
cancelOrderContent: 'This will close the current unpaid order. Continue?',
cancelOrderSuccess: 'Order canceled',
cancelOrderFailed: 'Failed to cancel order'
}
}
}
},
@@ -600,9 +394,9 @@ export default {
},
heroDesc() {
if (this.currentReferenceTypeNo) {
return this.t('heroDescResolved')
return this.$tr('当前页面已按申请单编号查询其关联的待支付账单记录。')
}
return this.t('heroDescAutoResolve')
return this.$tr('当前将优先读取最近申请单的编号来查询关联账单。')
},
showPaymentFeedbackPanel() {
return Boolean(this.paymentStage)
@@ -627,18 +421,18 @@ export default {
},
paymentStageLabel() {
if (this.paymentStage === 'launching') {
return this.t('paymentStageLaunching')
return this.$tr('正在唤起微信收银台')
}
if (this.paymentStage === 'polling') {
return this.t('paymentStagePolling')
return this.$tr('正在同步支付结果')
}
if (this.paymentStage === 'success') {
return this.t('paymentStageSuccess')
return this.$tr('支付结果已确认')
}
if (this.paymentStage === 'failed') {
return this.t('paymentStageFailed')
return this.$tr('支付未完成')
}
return this.t('paymentStageDefault')
return this.$tr('支付处理中')
},
paymentBadgeIconClass() {
if (this.isPaymentSuccessStage) {
@@ -660,31 +454,31 @@ export default {
},
paymentWaitingTitle() {
if (this.paymentStage === 'launching') {
return this.t('paymentTitleLaunching')
return this.$tr('请完成微信支付')
}
if (this.paymentStage === 'polling') {
return this.t('paymentTitlePolling')
return this.$tr('正在确认是否支付成功')
}
if (this.paymentStage === 'success') {
return this.t('paymentTitleSuccess')
return this.$tr('支付成功')
}
if (this.paymentStage === 'failed') {
return this.t('paymentTitleFailed')
return this.$tr('支付结果确认失败')
}
return this.t('paymentTitleDefault')
return this.$tr('支付处理中')
},
paymentWaitingDesc() {
if (this.paymentStage === 'launching') {
return this.t('paymentDescLaunching')
return this.$tr('系统正在调起微信支付,请在微信收银台中完成付款后返回。')
}
if (this.paymentStage === 'polling') {
return this.t('paymentDescPolling')
return this.$tr('支付完成后,系统会自动向后台查询支付状态,无需手动刷新。')
}
if (this.paymentStage === 'success') {
return this.t('paymentDescSuccess')
return this.$tr('本次支付已同步完成,账单状态已更新。')
}
if (this.paymentStage === 'failed') {
return this.t('paymentDescFailed')
return this.$tr('系统暂时未能确认支付成功,您可以查看提示后稍后重试。')
}
return ''
},
@@ -704,7 +498,7 @@ export default {
},
paymentProgressText() {
if (this.paymentStage !== 'polling') {
return this.t('paymentProgressWaiting')
return this.$tr('等待支付完成')
}
const current = this.paymentPollingAttempt > 0 ? this.paymentPollingAttempt : 1
return `${current}/${PAYMENT_QUERY_MAX_ATTEMPTS}`
@@ -714,45 +508,45 @@ export default {
return this.paymentStatusHint
}
if (this.paymentStage === 'launching') {
return this.t('paymentHintLaunching')
return this.$tr('已为您准备好支付信息,等待微信支付完成。')
}
return this.t('paymentHintPolling')
return this.$tr('正在与后台核对支付状态,请稍候。')
},
paymentTipsTitle() {
if (this.isPaymentFailedStage) {
return this.t('paymentTipsTitleFailed')
return this.$tr('处理建议')
}
if (this.isPaymentSuccessStage) {
return this.t('paymentTipsTitleSuccess')
return this.$tr('完成说明')
}
return this.t('paymentTipsTitleDefault')
return this.$tr('温馨提示')
},
paymentTips() {
if (this.isPaymentFailedStage) {
return [
this.t('paymentTipsFailed1'),
this.t('paymentTipsFailed2'),
this.t('paymentTipsFailed3')
this.$tr('若您已完成付款,请稍后刷新账单,避免重复支付。'),
this.$tr('若微信侧已扣款但页面未更新,请联系管家或客服协助核实。'),
this.$tr('若未扣款,可返回账单列表后重新发起支付。')
]
}
if (this.isPaymentSuccessStage) {
return [
this.t('paymentTipsSuccess1'),
this.t('paymentTipsSuccess2'),
this.t('paymentTipsSuccess3')
this.$tr('若当前申请单还有其他待付账单,可继续在当前页完成支付。'),
this.$tr('若当前账单已全部支付完成,系统会自动返回首页。'),
this.$tr('支付记录同步可能略有延迟,刷新后即可看到最新状态。')
]
}
return [
this.t('paymentTipsDefault1'),
this.t('paymentTipsDefault2'),
this.t('paymentTipsDefault3')
this.$tr('支付成功后,系统可能需要几秒钟同步账单状态。'),
this.$tr('请不要重复点击支付,也不要提前关闭当前页面。'),
this.$tr('如果超时未完成,系统会自动再校验一次账单状态。')
]
},
showPaymentActionButton() {
return this.isPaymentFailedStage
},
paymentActionText() {
return this.isPaymentFailedStage ? this.t('paymentActionAcknowledge') : ''
return this.isPaymentFailedStage ? this.$tr('我知道了') : ''
}
},
watch: {
@@ -782,22 +576,6 @@ export default {
this.clearCountdownTimer()
},
methods: {
t(key, params) {
const translatedText = this.$tm('pkgService.components.CurrentApplicationBillPanel', key, params)
if (translatedText && translatedText !== key) {
return translatedText
}
const languagePack = this.i18n && this.i18n[this.language] ? this.i18n[this.language] : this.i18n.zh
const fallbackText = languagePack && languagePack[key] ? languagePack[key] : key
if (!params || typeof fallbackText !== 'string') {
return fallbackText
}
return fallbackText.replace(/\{(\w+)\}/g, (match, token) => {
return Object.prototype.hasOwnProperty.call(params, token) ? params[token] : match
})
},
getBillNo(item = {}) {
return item.no || item.billNo || ''
},
@@ -812,7 +590,7 @@ export default {
},
getBillPaymentStatusText(item = {}) {
const translatedStatus = this.getPaymentStatusText(this.getBillPaymentStatus(item))
return translatedStatus || item.paymentStatusDesc || this.t('paymentStatusPending')
return translatedStatus || item.paymentStatusDesc || this.$tr('处理中')
},
getBillRefundStatus(item = {}) {
return item.refundStatus
@@ -918,7 +696,7 @@ export default {
return ''
}
if (expireTimestamp <= this.countdownNow) {
return this.t('pendingPaymentExpired')
return this.$tr('已失效')
}
return this.formatPendingPaymentCountdown(this.getPendingPaymentRemainingSeconds(item))
},
@@ -926,20 +704,20 @@ export default {
const billNo = this.getBillNo(item)
if (this.paymentPollingBillNo && this.paymentPollingBillNo === billNo) {
if (!this.paymentPollingAttempt) {
return this.t('buttonConfirming')
return this.$tr('确认结果中...')
}
return this.t('buttonPolling', {
return this.$tr('查询结果中({current}/{total})', {
current: this.paymentPollingAttempt,
total: PAYMENT_QUERY_MAX_ATTEMPTS
})
}
if (this.payingBillNo === billNo) {
return this.paymentStage === 'launching' ? this.t('buttonLaunching') : this.t('buttonConfirming')
return this.paymentStage === 'launching' ? this.$tr('拉起支付中...') : this.$tr('确认结果中...')
}
if (this.getPendingPaymentOrder(item) && !this.isPendingPaymentExpired(item)) {
return this.t('continuePayButton')
return this.$tr('继续支付')
}
return this.t('wechatPayButton')
return this.$tr('微信支付')
},
canCancelOrder(item = {}) {
if (!this.currentReferenceTypeNo) {
@@ -951,8 +729,8 @@ export default {
},
getCancelButtonText(item = {}) {
return this.cancelingBillNo === this.getBillNo(item)
? this.t('cancelOrderLoading')
: this.t('cancelOrderButton')
? this.$tr('取消中...')
: this.$tr('取消订单')
},
resolveReferenceTypeNo(item = {}) {
return item.code || item.detailCode || ''
@@ -1024,7 +802,7 @@ export default {
return text.length > 16 ? text.slice(0, 16) : text
},
getPaymentStatusText(status) {
return getAccountBillPaymentStatusLabel(status, this.t('paymentStatusPending'))
return getAccountBillPaymentStatusLabel(status, this.$tr('处理中'))
},
resolvePaymentStatusType(status) {
if (Number(status) === ACCOUNT_BILL_PAYMENT_STATUS.PAID) {
@@ -1040,7 +818,7 @@ export default {
},
getReferenceTypeText(item = {}) {
const translatedType = getAccountReferenceTypeLabel(item.referenceType, '')
return translatedType || item.referenceTypeDesc || this.t('billRecordFallback')
return translatedType || item.referenceTypeDesc || this.$tr('账单记录')
},
parsePaymentInfo(paymentInfo) {
if (!paymentInfo) {
@@ -1073,7 +851,7 @@ export default {
requestWechatPayment(paymentInfo) {
const payOptions = this.normalizeWechatPayOptions(paymentInfo)
if (!payOptions.timeStamp || !payOptions.nonceStr || !payOptions.package || !payOptions.paySign) {
return Promise.reject(new Error(this.t('paymentParamIncomplete')))
return Promise.reject(new Error(this.$tr('微信支付参数不完整')))
}
return new Promise((resolve, reject) => {
@@ -1143,13 +921,13 @@ export default {
success: (res) => {
const code = res && res.code ? res.code : ''
if (!code) {
reject(new Error(this.t('wechatCodeFailed')))
reject(new Error(this.$tr('获取微信登录凭证失败')))
return
}
resolve(code)
},
fail: (error) => {
reject(error || new Error(this.t('wechatCodeFailed')))
reject(error || new Error(this.$tr('获取微信登录凭证失败')))
}
})
})
@@ -1160,7 +938,7 @@ export default {
billNo: this.getBillNo(item),
payMethod: 'Wechat',
amount: Number(this.getBillRemainingAmount(item) || 0),
description: this.getReferenceTypeText(item) || this.t('billPaymentDesc')
description: this.getReferenceTypeText(item) || this.$tr('账单支付')
}
if (wechatCode) {
payload.ExtraInfo = wechatCode
@@ -1168,10 +946,6 @@ export default {
return payload
},
resolveNoticeText(key, zhText, enText) {
const translatedText = this.t(key)
if (translatedText && translatedText !== key) {
return translatedText
}
return this.language === 'en' ? enText : zhText
},
resetPaymentNoticeContext() {
@@ -1237,8 +1011,8 @@ export default {
confirmCancelOrder() {
return new Promise((resolve) => {
uni.showModal({
title: this.t('cancelOrderTitle'),
content: this.t('cancelOrderContent'),
title: this.$tr('取消订单'),
content: this.$tr('取消后将关闭当前未支付订单,是否继续?'),
confirmColor: '#ef4444',
success: (res) => resolve(!!(res && res.confirm)),
fail: () => resolve(false)
@@ -1264,7 +1038,7 @@ export default {
this.paymentSession = {
billNo: this.getBillNo(item),
amount: Number(this.getBillRemainingAmount(item) || 0),
title: this.getReferenceTypeText(item) || this.t('billPaymentDesc')
title: this.getReferenceTypeText(item) || this.$tr('账单支付')
}
},
resetPaymentWaitingState() {
@@ -1277,7 +1051,7 @@ export default {
},
openPaymentFailedState(message = '') {
this.paymentStage = 'failed'
this.paymentStatusHint = message || this.t('paymentFailedHint')
this.paymentStatusHint = message || this.$tr('暂未查询到支付成功结果,请稍后刷新账单确认。')
this.payingBillNo = ''
this.paymentPollingBillNo = this.paymentWaitingBillNo
},
@@ -1312,20 +1086,20 @@ export default {
if (payStatus === PAYMENT_ORDER_STATUS.SUCCESS) {
return {
status: PAYMENT_QUERY_STATUS.SUCCESS,
message: statusDesc || this.t('paymentResultSuccess'),
message: statusDesc || this.$tr('后台确认支付成功'),
data: payload
}
}
if (payStatus === PAYMENT_ORDER_STATUS.FAILED) {
return {
status: PAYMENT_QUERY_STATUS.FAILED,
message: statusDesc || this.t('paymentResultFailed'),
message: statusDesc || this.$tr('后台返回支付失败'),
data: payload
}
}
return {
status: PAYMENT_QUERY_STATUS.PENDING,
message: statusDesc || this.t('paymentResultPending'),
message: statusDesc || this.$tr('后台仍在处理中'),
data: payload
}
})
@@ -1337,7 +1111,7 @@ export default {
this.paymentStage = 'polling'
this.paymentPollingBillNo = queryContext.billNo
this.paymentPollingAttempt = 0
this.paymentStatusHint = this.t('paymentHintPaidWaiting')
this.paymentStatusHint = this.$tr('已支付成功,正在等待后台确认账单状态。')
const executePolling = async () => {
for (let attempt = 1; attempt <= PAYMENT_QUERY_MAX_ATTEMPTS; attempt += 1) {
@@ -1346,15 +1120,15 @@ export default {
}
this.paymentPollingAttempt = attempt
lastResult = await this.queryPaymentResult(queryContext)
this.paymentStatusHint = lastResult && lastResult.message ? lastResult.message : this.t('paymentHintPolling')
this.paymentStatusHint = lastResult && lastResult.message ? lastResult.message : this.$tr('正在与后台核对支付状态,请稍候。')
if (lastResult && lastResult.status === PAYMENT_QUERY_STATUS.SUCCESS) {
return lastResult
}
if (lastResult && lastResult.status === PAYMENT_QUERY_STATUS.FAILED) {
throw new Error(lastResult.message || this.t('paymentFailedError'))
throw new Error(lastResult.message || this.$tr('支付失败'))
}
}
throw new Error((lastResult && lastResult.message) || this.t('paymentTimeoutError'))
throw new Error((lastResult && lastResult.message) || this.$tr('支付结果确认超时,请稍后刷新账单确认'))
}
return executePolling()
@@ -1363,8 +1137,8 @@ export default {
const hasPendingBills = this.billList.length > 0
this.paymentStage = 'success'
this.paymentStatusHint = hasPendingBills
? this.t('paymentSuccessPendingBills')
: this.t('paymentSuccessAllDone')
? this.$tr('支付结果已确认,当前申请单仍有其他待支付账单。')
: this.$tr('支付结果已确认,当前申请单账单已全部完成。')
this.payingBillNo = ''
this.paymentPollingBillNo = this.paymentWaitingBillNo
return this.wait(1200)
@@ -1413,7 +1187,7 @@ export default {
: null
if (!billNo || !this.currentReferenceTypeNo) {
uni.showToast({
title: this.t('billInfoIncomplete'),
title: this.$tr('账单信息不完整'),
icon: 'none'
})
return
@@ -1430,7 +1204,7 @@ export default {
}
this.payingBillNo = billNo
this.paymentStage = 'launching'
this.paymentStatusHint = this.t('paymentHintLaunchingToast')
this.paymentStatusHint = this.$tr('正在唤起微信支付,请在微信内完成付款。')
this.createPaymentSession(item)
})
.then(() => {
@@ -1464,7 +1238,7 @@ export default {
if (/cancel/i.test(errMsg)) {
this.resetPaymentWaitingState()
uni.showToast({
title: this.t('paymentCanceled'),
title: this.$tr('已取消支付'),
icon: 'none'
})
return
@@ -1474,7 +1248,7 @@ export default {
if (hasConfirmedSuccess) {
return
}
this.openPaymentFailedState(errMsg || this.t('paymentResultFailedRetry'))
this.openPaymentFailedState(errMsg || this.$tr('支付结果确认失败,请稍后刷新账单确认'))
})
})
.finally(() => {
@@ -1500,7 +1274,7 @@ export default {
return userDetailCancel(this.buildCancelOrderPayload(item), this.language)
.then(() => {
uni.showToast({
title: this.t('cancelOrderSuccess'),
title: this.$tr('订单已取消'),
icon: 'success'
})
return this.refreshBillList()
@@ -1508,7 +1282,7 @@ export default {
})
.catch((error) => {
uni.showToast({
title: (error && (error.message || error.msg)) || this.t('cancelOrderFailed'),
title: (error && (error.message || error.msg)) || this.$tr('取消订单失败'),
icon: 'none'
})
})
@@ -1554,7 +1328,7 @@ export default {
this.billList = []
this.pendingPaymentOrderMap = {}
uni.showToast({
title: (error && (error.message || error.msg)) || this.t('billLoadFailed'),
title: (error && (error.message || error.msg)) || this.$tr('账单加载失败'),
icon: 'none'
})
return []