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,19 +1,19 @@
<template>
<view class="my-application-page tn-flex tn-flex-direction-column" :style="{ height: 'calc(100vh - 100rpx - env(safe-area-inset-bottom))', boxSizing: 'border-box', paddingTop: (vuex_custom_bar_height) + 'px' }">
<view class="page-header tn-padding">
<view class="tn-text-bold tn-text-xl tn-color-black page-title">{{ t('pageTitle') }}</view>
<view class="tn-color-gray tn-text-sm tn-margin-top-xs">{{ t('pageDesc') }}</view>
<view class="tn-text-bold tn-text-xl tn-color-black page-title">{{ $tr('我的申请') }}</view>
<view class="tn-color-gray tn-text-sm tn-margin-top-xs">{{ $tr('您的入住和预约看房申请记录') }}</view>
</view>
<scroll-view v-if="reservationOrders.length || list.length" scroll-y class="list-scroll-view tn-padding" @scrolltolower="loadMore">
<view v-if="reservationOrders.length" class="reservation-flow-panel tn-margin-bottom-lg" @click.stop>
<view class="reservation-flow-panel__head">
<view class="reservation-flow-panel__title-wrap">
<view class="reservation-flow-panel__title">{{ t('reservationFlowTitle') }}</view>
<view class="reservation-flow-panel__desc">{{ t('reservationFlowDesc') }}</view>
<view class="reservation-flow-panel__title">{{ $tr('预定流程') }}</view>
<view class="reservation-flow-panel__desc">{{ $tr('当前预定单的流程进度') }}</view>
</view>
<view class="reservation-flow-panel__refresh" @click.stop="refreshStatus">
<text class="tn-text-bold">{{ t('refreshFlowAction') }}</text>
<text class="tn-text-bold">{{ $tr('刷新流程') }}</text>
</view>
</view>
@@ -26,26 +26,26 @@
:class="{ 'reservation-order-chip--active': activeReservationOrderNo === item.orderNo }"
@click.stop="switchReservationOrder(item)"
>
<view class="reservation-order-chip__title">{{ item.roomTypeText || item.roomTypeName || t('reservationOrderFallback') }}</view>
<view class="reservation-order-chip__title">{{ item.roomTypeText || item.roomTypeName || $tr('预定单') }}</view>
</view>
</view>
</scroll-view>
<view v-if="activeReservationOrder" class="reservation-grid-info tn-margin-top-lg">
<view class="grid-info-item">
<view class="grid-info-label">{{ t('apartmentLabel') }}</view>
<view class="grid-info-label">{{ $tr('所属公寓') }}</view>
<view class="grid-info-value">{{ activeReservationOrder.areaText || activeReservationOrder.areaName || '--' }}</view>
</view>
<view class="grid-info-item">
<view class="grid-info-label">{{ t('reservationRoomLabel') }}</view>
<view class="grid-info-label">{{ $tr('房型') }}</view>
<view class="grid-info-value">{{ activeReservationOrder.roomTypeText || activeReservationOrder.roomTypeName || '--' }}</view>
</view>
<view class="grid-info-item">
<view class="grid-info-label">{{ t('roomNoLabel') }}</view>
<view class="grid-info-label">{{ $tr('房间号') }}</view>
<view class="grid-info-value tn-font-mono">{{ activeReservationOrder.roomNoText || activeReservationOrder.roomNo || '--' }}</view>
</view>
<view class="grid-info-item">
<view class="grid-info-label">{{ t('reservationStatusLabel') }}</view>
<view class="grid-info-label">{{ $tr('订单状态') }}</view>
<view class="grid-info-value">{{ activeReservationOrder.orderStatusDesc || activeReservationOrder.statusText || '--' }}</view>
</view>
</view>
@@ -67,7 +67,7 @@
<view class="v-step-content">
<view class="v-step-header">
<view class="v-step-title">{{ node.stepDesc || getReservationStepLabel(node.step) }}</view>
<view v-if="node.isCurrent" class="v-step-current-tag">{{ t('currentStepTag') }}</view>
<view v-if="node.isCurrent" class="v-step-current-tag">{{ $tr('当前') }}</view>
</view>
<view
@@ -75,11 +75,11 @@
class="v-step-bill-card tn-margin-top-sm"
>
<view class="v-step-bill-row">
<text class="v-step-bill-label">{{ t('pendingPaymentDescLabel') }}</text>
<text class="v-step-bill-label">{{ $tr('支付说明') }}</text>
<text class="v-step-bill-value">{{ getReservationBillDisplayTitle(getActiveReservationBillDetail()) }}</text>
</view>
<view class="v-step-bill-row">
<text class="v-step-bill-label">{{ t('pendingPaymentAmountLabel') }}</text>
<text class="v-step-bill-label">{{ $tr('订单金额') }}</text>
<text class="v-step-bill-value v-step-bill-value--price">¥{{ formatMoney(getReservationBillDisplayAmount(getActiveReservationBillDetail())) }}</text>
</view>
</view>
@@ -96,7 +96,7 @@
class="v-step-action tn-margin-top-sm"
>
<view class="step-refresh-btn" @click.stop="refreshStatus">
<text class="tn-text-bold">{{ t('refreshAction') }}</text>
<text class="tn-text-bold">{{ $tr('刷新') }}</text>
</view>
</view>
@@ -132,57 +132,57 @@
<view class="card-body tn-margin-top-lg">
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('apartmentLabel') }}</text>
<text class="info-label">{{ $tr('所属公寓') }}</text>
<text class="info-value">{{ item.intendedAreaName || '--' }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('occupantLabel') }}</text>
<text class="info-label">{{ $tr('入住人') }}</text>
<text class="info-value">{{ item.userName || item.phone || '--' }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ item.isViewingApplication ? t('viewingTimeLabel') : t('leaseTermLabel') }}</text>
<text class="info-label">{{ item.isViewingApplication ? $tr('预约时间') : $tr('预计租期') }}</text>
<text class="info-value">{{ formatDateRange(item.start, item.end) }}</text>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('submittedAtLabel') }}</text>
<text class="info-label">{{ $tr('提交时间') }}</text>
<text class="info-value">{{ formatDateTime(item.createTime) }}</text>
</view>
</view>
<view v-if="item.remark" class="remark-panel tn-margin-top-lg">
<view class="remark-line">
<text class="remark-label">{{ t('remarkLabel') }}</text>
<text class="remark-label">{{ $tr('补充说明') }}</text>
<text class="remark-text">{{ item.remark }}</text>
</view>
</view>
<view v-if="getStatusReminderText(item)" class="reminder-panel tn-margin-top-lg" @click.stop>
<view class="reminder-head">
<view class="reminder-title">{{ t('statusReminderTitle') }}</view>
<view class="reminder-title">{{ $tr('当前进度提醒') }}</view>
<view class="reminder-refresh-btn" @click.stop="refreshStatus">
<text class="tn-text-bold">{{ t('refreshAction') }}</text>
<text class="tn-text-bold">{{ $tr('刷新') }}</text>
</view>
</view>
<view class="info-row tn-flex tn-flex-row-between">
<text class="info-label">{{ t('statusReminderTitle') }}</text>
<text class="info-label">{{ $tr('当前进度提醒') }}</text>
<text class="info-value">{{ getStatusReminderText(item) }}</text>
</view>
</view>
<view v-if="!isPaidApplication(item) && getApplicationPendingPaymentOrder(item)" class="pending-payment-panel tn-margin-top-lg" @click.stop>
<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('pendingPaymentAmountLabel') }}</text>
<text class="info-label">{{ $tr('订单金额') }}</text>
<text class="info-value info-value--highlight">¥{{ formatMoney(getApplicationPendingPaymentAmount(item)) }}</text>
</view>
<view v-if="getApplicationPendingPaymentExpireText(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': isApplicationPendingPaymentExpired(item) }">
{{ getApplicationPendingPaymentExpireText(item) }}
</text>
</view>
<view v-if="getApplicationPendingPaymentDescription(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">{{ getApplicationPendingPaymentDescription(item) }}</text>
</view>
</view>
@@ -223,36 +223,36 @@
:data-reference-type-no="resolveReferenceTypeNo(item)"
@click.stop="payDepositAction"
>
<text class="tn-text-bold">{{ t('payDeposit') }}</text>
<text class="tn-text-bold">{{ $tr('支付定金') }}</text>
</view>
</view>
</view>
<view v-if="hasMore || loadingMore" class="load-more-item tn-flex tn-flex-direction-column tn-flex-col-center tn-flex-row-center tn-padding-bottom">
<tn-loading v-if="loadingMore" mode="circle" color="#00BBE8"></tn-loading>
<text v-else-if="hasMore" class="tn-color-gray">{{ t('pullUpMore') }}</text>
<text v-else class="tn-color-gray">{{ t('noMore') }}</text>
<text v-else-if="hasMore" class="tn-color-gray">{{ $tr('上拉加载更多') }}</text>
<text v-else class="tn-color-gray">{{ $tr('没有更多申请了') }}</text>
</view>
</scroll-view>
<view v-else-if="!loading" class="empty-panel tn-flex tn-flex-direction-column tn-flex-col-center tn-flex-row-center animation-fade-in tn-padding-left tn-padding-right">
<tn-empty icon="order" :text="t('emptyTitle')"></tn-empty>
<view class="empty-desc tn-margin-top tn-text-center">{{ t('emptyDesc') }}</view>
<tn-empty icon="order" :text="$tr('暂无申请记录')"></tn-empty>
<view class="empty-desc tn-margin-top tn-text-center">{{ $tr('您还没有提交任何申请,去选房后可发起入住申请或预约看房。') }}</view>
<view class="empty-action tn-margin-top-xl" @click="goSelectRoom">
<text class="tn-text-bold">{{ t('goSelectRoom') }}</text>
<text class="tn-text-bold">{{ $tr('去选房') }}</text>
</view>
</view>
<view v-if="loading && !list.length" class="empty-panel tn-flex tn-flex-direction-column tn-flex-col-center tn-flex-row-center tn-padding-left tn-padding-right">
<tn-loading mode="circle" color="#00BBE8" size="60"></tn-loading>
<view class="empty-desc tn-margin-top-lg">{{ t('loadingDesc') }}</view>
<view class="empty-desc tn-margin-top-lg">{{ $tr('正在同步您的入住申请记录,请稍候。') }}</view>
</view>
<!-- 支付定金须知弹窗 -->
<tn-popup v-model="showDepositNotice" mode="bottom" length="80%" :borderRadius="32" :closeBtn="true" @close="closeDepositNotice">
<view class="deposit-notice-popup">
<view class="popup-header">
<view class="popup-title">{{ t('depositNoticeTitle') }}</view>
<view class="popup-title">{{ $tr('租房定金须知') }}</view>
</view>
<scroll-view scroll-y class="popup-body" @scrolltolower="onNoticeScrollToBottom">
<view class="notice-content">
@@ -288,8 +288,8 @@
:class="{ 'action-btn--disabled': !hasReadNotice }"
@click="confirmAndPayDeposit"
>
<text class="tn-text-bold">{{ t('agreeAndPay') }}</text>
<text v-if="!hasReadNotice" class="tn-margin-left-xs tn-text-sm">({{ t('scrollToRead') }})</text>
<text class="tn-text-bold">{{ $tr('同意并支付') }}</text>
<text v-if="!hasReadNotice" class="tn-margin-left-xs tn-text-sm">({{ $tr('请滑动阅读至底部') }})</text>
</view>
</view>
</view>
@@ -408,156 +408,6 @@ function padCountdownUnit(value) {
}
export default {
i18n: {
zh: {
pageTitle: '我的申请',
pageDesc: '您的入住和预约看房申请记录',
toolbarSummary: '共 {total} 条申请',
refreshing: '刷新中...',
refresh: '刷新状态',
apartmentLabel: '所属公寓',
occupantLabel: '入住人',
viewingTimeLabel: '预约时间',
leaseTermLabel: '预计租期',
submittedAtLabel: '提交时间',
remarkLabel: '补充说明',
payDeposit: '支付定金',
continuePay: '继续支付',
pendingPaymentTitle: '未完成支付订单',
pendingPaymentOrderNoLabel: '支付单号',
pendingPaymentAmountLabel: '订单金额',
pendingPaymentDescLabel: '支付说明',
pendingPaymentExpireLabel: '剩余支付时间',
pendingPaymentExpired: '已失效',
noMore: '没有更多申请了',
pullUpMore: '上拉加载更多',
emptyTitle: '暂无申请记录',
emptyDesc: '您还没有提交任何申请,去选房后可发起入住申请或预约看房。',
goSelectRoom: '去选房',
loadingDesc: '正在同步您的入住申请记录,请稍候。',
statusPending: '待审核',
statusApproved: '已通过',
statusRejected: '已拒绝',
statusFinished: '已结束',
statusProcessing: '处理中',
statusPendingPayment: '请支付定金',
statusWaitingRoomAssign: '等待预订中心分配房间',
statusReminderTitle: '当前进度提醒',
refreshEmptySuccess: '未查到申请单,已同步预订单',
refreshSuccess: '申请状态已刷新',
loadError: '申请记录加载失败',
cancelOrder: '取消订单',
cancelOrderLoading: '取消中...',
cancelOrderTitle: '取消订单',
cancelOrderContent: '取消后将关闭当前未支付的定金订单,是否继续?',
cancelOrderSuccess: '订单已取消',
cancelOrderFailed: '取消订单失败',
viewingApplicationTitle: '预约看房申请',
stayApplicationTitle: '入住申请',
missingBillCode: '申请单编号缺失',
missingContractNo: '合同编号缺失',
missingApplicationCode: '申请编号缺失',
dateRangeJoiner: ' 至 ',
depositNoticeTitle: '租房定金须知',
agreeAndPay: '同意并支付',
scrollToRead: '请滑动阅读至底部',
fetchPaymentParamsFailed: '获取支付参数失败',
fetchWechatLoginCodeFailed: '获取微信登录凭证失败',
loadingBill: '正在获取账单...',
noPendingDepositBill: '暂无待支付定金账单',
loadingPayment: '正在拉起支付...',
depositPaymentDesc: '支付定金',
paymentSuccess: '支付成功',
paymentCanceled: '已取消支付',
paymentFailed: '支付失败',
reservationFlowTitle: '预定流程',
reservationFlowDesc: '当前预定单的流程进度',
reservationOrderFallback: '预定单',
reservationOrderNoLabel: '预定单号',
roomNoLabel: '房间号',
reservationRoomLabel: '房型',
reservationStatusLabel: '订单状态',
currentStepTag: '当前',
contractPendingReviewHint: '合同已签,等待宿管审核',
checkinPendingHint: '宿管正在办理入住,请耐心等待',
refreshAction: '刷新',
refreshFlowAction: '刷新流程'
},
en: {
pageTitle: 'My Applications',
pageDesc: 'Your stay and viewing application records',
toolbarSummary: '{total} applications',
refreshing: 'Refreshing...',
refresh: 'Refresh Status',
apartmentLabel: 'Apartment',
occupantLabel: 'Resident',
viewingTimeLabel: 'Viewing Time',
leaseTermLabel: 'Lease Term',
submittedAtLabel: 'Submitted At',
remarkLabel: 'Remarks',
payDeposit: 'Pay Deposit',
continuePay: 'Continue Pay',
pendingPaymentTitle: 'Unfinished Payment',
pendingPaymentOrderNoLabel: 'Payment Order No.',
pendingPaymentAmountLabel: 'Order Amount',
pendingPaymentDescLabel: 'Description',
pendingPaymentExpireLabel: 'Time Left',
pendingPaymentExpired: 'Expired',
noMore: 'No more applications',
pullUpMore: 'Pull up to load more',
emptyTitle: 'No applications yet',
emptyDesc: 'You have not submitted any application yet. Go select a room to start a stay or viewing application.',
goSelectRoom: 'Select Room',
loadingDesc: 'Syncing your application records. Please wait.',
statusPending: 'Pending',
statusApproved: 'Approved',
statusRejected: 'Rejected',
statusFinished: 'Closed',
statusProcessing: 'Processing',
statusPendingPayment: 'Please Pay Deposit',
statusWaitingRoomAssign: 'Waiting for Room Assignment',
statusReminderTitle: 'Current Progress',
refreshEmptySuccess: 'No application found. Reservation records synced.',
refreshSuccess: 'Application status refreshed',
loadError: 'Failed to load applications',
cancelOrder: 'Cancel Order',
cancelOrderLoading: 'Canceling...',
cancelOrderTitle: 'Cancel Order',
cancelOrderContent: 'This will close the current unpaid deposit order. Continue?',
cancelOrderSuccess: 'Order canceled',
cancelOrderFailed: 'Failed to cancel order',
viewingApplicationTitle: 'Viewing Request',
stayApplicationTitle: 'Stay Application',
missingBillCode: 'Missing application bill number',
missingContractNo: 'Missing contract number',
missingApplicationCode: 'Missing application number',
dateRangeJoiner: ' to ',
depositNoticeTitle: 'Rental Deposit Notice',
agreeAndPay: 'Agree and Pay',
scrollToRead: 'Scroll to bottom',
fetchPaymentParamsFailed: 'Failed to get payment parameters',
fetchWechatLoginCodeFailed: 'Failed to get WeChat login code',
loadingBill: 'Loading bill...',
noPendingDepositBill: 'No pending deposit bill available',
loadingPayment: 'Opening payment...',
depositPaymentDesc: 'Deposit Payment',
paymentSuccess: 'Payment succeeded',
paymentCanceled: 'Payment canceled',
paymentFailed: 'Payment failed',
reservationFlowTitle: 'Reservation Flow',
reservationFlowDesc: 'Progress of the current reservation order',
reservationOrderFallback: 'Reservation',
reservationOrderNoLabel: 'Order No.',
roomNoLabel: 'Room No.',
reservationRoomLabel: 'Room Type',
reservationStatusLabel: 'Order Status',
currentStepTag: 'Current',
contractPendingReviewHint: 'Contract signed, waiting for review',
checkinPendingHint: 'Move-in is being processed, please wait',
refreshAction: 'Refresh',
refreshFlowAction: 'Refresh Flow'
}
},
data() {
return {
currentIndex: 0,
@@ -616,9 +466,6 @@ export default {
this.clearCountdownTimer()
},
methods: {
t(key, params) {
return this.$tm('pages.index.component.MyApplicationTab', key, params)
},
load(force = false) {
return this.reloadList(force)
},
@@ -637,12 +484,12 @@ export default {
},
getStatusText(status) {
const map = {
0: this.t('statusPending'),
10: this.t('statusApproved'),
20: this.t('statusRejected'),
99: this.t('statusFinished')
0: this.$tr('待审核'),
10: this.$tr('已通过'),
20: this.$tr('已拒绝'),
99: this.$tr('已结束')
}
return map[status] || this.t('statusProcessing')
return map[status] || this.$tr('处理中')
},
getDisplayStatusText(item = {}) {
if (this.$getLanguage() !== 'en' && item.statusDesc) {
@@ -685,17 +532,17 @@ export default {
return contractDetail.queryStatusDesc || contractDetail.approvalStatusDesc || contractDetail.statusDesc || getReservationCurrentStepText(item, this.language)
}
if (this.isReservationInspectionPendingReview(item)) {
return this.t('inspectionPendingReviewHint')
return this.$tr('验房已完成,等待宿管审核')
}
const reservationStepText = getReservationCurrentStepText(item, this.language)
if (reservationStepText) {
return reservationStepText
}
if (this.shouldPayDeposit(item)) {
return this.t('statusPendingPayment')
return this.$tr('请支付定金')
}
if (this.isWaitingRoomAssignment(item)) {
return this.t('statusWaitingRoomAssign')
return this.$tr('等待预订中心分配房间')
}
return ''
},
@@ -720,10 +567,10 @@ export default {
const startText = this.formatDateTime(start)
const endText = this.formatDateTime(end)
if (String(start).includes('T') || String(end).includes('T')) {
return `${startText}${this.t('dateRangeJoiner')}${endText}`
return `${startText}${this.$tr(' 至 ')}${endText}`
}
}
return `${this.formatDate(start)}${this.t('dateRangeJoiner')}${this.formatDate(end)}`
return `${this.formatDate(start)}${this.$tr(' 至 ')}${this.formatDate(end)}`
},
formatMoney(value) {
const amount = Number(value || 0)
@@ -826,7 +673,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('fetchPaymentParamsFailed')))
return Promise.reject(new Error(this.$tr('获取支付参数失败')))
}
return new Promise((resolve, reject) => {
uni.requestPayment({
@@ -842,7 +689,7 @@ export default {
provider: 'weixin',
success: (res) => {
if (!res || !res.code) {
reject(new Error(this.t('fetchWechatLoginCodeFailed')))
reject(new Error(this.$tr('获取微信登录凭证失败')))
return
}
resolve(res.code)
@@ -992,12 +839,12 @@ export default {
return ''
}
if (expireTimestamp <= this.countdownNow) {
return this.t('pendingPaymentExpired')
return this.$tr('已失效')
}
return this.formatPendingPaymentCountdown(this.getPendingPaymentRemainingSeconds(order))
},
getPendingPaymentActionText(item = {}) {
return this.isApplicationPendingPaymentExpired(item) ? this.t('payDeposit') : this.t('continuePay')
return this.isApplicationPendingPaymentExpired(item) ? this.$tr('支付定金') : this.$tr('继续支付')
},
getReservationOrderNoFromItem(item = {}) {
return getReservationOrderNo(item)
@@ -1077,14 +924,14 @@ export default {
},
getReservationCurrentStepHint(order = {}) {
if (this.isReservationInspectionPendingReview(order)) {
return this.t('inspectionPendingReviewHint')
return this.$tr('验房已完成,等待宿管审核')
}
if (this.isReservationContractAwaitingReview(order)) {
const detail = this.getReservationContractDetail(order) || {}
return String(detail.queryStatusDesc || detail.approvalStatusDesc || '').trim() || this.t('contractPendingReviewHint')
return String(detail.queryStatusDesc || detail.approvalStatusDesc || '').trim() || this.$tr('合同已签,等待宿管审核')
}
if (this.isReservationCheckinProcessing(order)) {
return this.t('checkinPendingHint')
return this.$tr('宿管正在办理入住,请耐心等待')
}
return ''
},
@@ -1127,7 +974,7 @@ export default {
|| bill.referenceTypeDesc
|| bill.billName
|| bill.name
|| this.t('depositPaymentDesc')
|| this.$tr('支付定金')
).trim()
},
getReservationBillDisplayAmount(bill = {}) {
@@ -1411,14 +1258,14 @@ export default {
if (this.total === 0 && !this.reservationOrders.length) {
this.$emit('refresh-shell-state')
uni.showToast({
title: this.t('refreshEmptySuccess'),
title: this.$tr('未查到申请单,已同步预订单'),
icon: 'none'
})
return
}
if (this.list.length || this.reservationOrders.length) {
uni.showToast({
title: this.t('refreshSuccess'),
title: this.$tr('申请状态已刷新'),
icon: 'none'
})
}
@@ -1507,7 +1354,7 @@ export default {
this.pageIndex = Math.max(1, this.pageIndex - 1)
}
uni.showToast({
title: (error && (error.message || error.msg)) || this.t('loadError'),
title: (error && (error.message || error.msg)) || this.$tr('申请记录加载失败'),
icon: 'none'
})
})
@@ -1531,9 +1378,9 @@ export default {
},
getApplicationTitle(item = {}) {
if (item.isViewingApplication) {
return this.t('viewingApplicationTitle')
return this.$tr('预约看房申请')
}
return item.intendedRoomTypeName || this.t('stayApplicationTitle')
return item.intendedRoomTypeName || this.$tr('入住申请')
},
resolveReferenceTypeNo(item = {}) {
return item.detailCode || ''
@@ -1549,14 +1396,14 @@ export default {
},
getCancelButtonText(item = {}) {
return this.cancelingReferenceTypeNo === this.resolveReferenceTypeNo(item)
? this.t('cancelOrderLoading')
: this.t('cancelOrder')
? this.$tr('取消中...')
: this.$tr('取消订单')
},
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)
@@ -1575,7 +1422,7 @@ export default {
return {
...item,
status: 99,
statusDesc: this.t('statusFinished'),
statusDesc: this.$tr('已结束'),
pendingDepositBill: null,
pendingPaymentOrder: null
}
@@ -1611,14 +1458,14 @@ export default {
await this.reloadList(true)
this.$emit('refresh-shell-state')
uni.showToast({
title: this.t('cancelOrderSuccess'),
title: this.$tr('订单已取消'),
icon: 'success'
})
})
})
.catch((error) => {
uni.showToast({
title: (error && (error.message || error.msg)) || this.t('cancelOrderFailed'),
title: (error && (error.message || error.msg)) || this.$tr('取消订单失败'),
icon: 'none'
})
})
@@ -1633,7 +1480,7 @@ export default {
: ''
if (!referenceTypeNo) {
uni.showToast({
title: this.t('missingBillCode'),
title: this.$tr('申请单编号缺失'),
icon: 'none'
})
return
@@ -1659,7 +1506,7 @@ export default {
: ''
if (!referenceTypeNo) {
uni.showToast({
title: this.t('missingBillCode'),
title: this.$tr('申请单编号缺失'),
icon: 'none'
})
return
@@ -1732,7 +1579,7 @@ export default {
referenceTypeNo: pickFirst(candidateReferenceTypeNos),
billNo: pickFirst(candidateBillNos),
paymentNo: pickFirst(candidatePaymentNos),
description: String(currentNode.stepDesc || fallbackContext.description || '').trim() || this.t('depositPaymentDesc')
description: String(currentNode.stepDesc || fallbackContext.description || '').trim() || this.$tr('支付定金')
}
},
resolvePendingPaymentContextByPaymentNo(paymentNo = '') {
@@ -1788,11 +1635,11 @@ export default {
let referenceTypeNo = String(context.referenceTypeNo || '').trim()
let billNo = String(context.billNo || '').trim()
const paymentNo = String(context.paymentNo || '').trim()
const description = String(context.description || '').trim() || this.t('depositPaymentDesc')
const description = String(context.description || '').trim() || this.$tr('支付定金')
if (!referenceTypeNo && !billNo && !paymentNo) {
uni.showToast({
title: this.t('missingBillCode'),
title: this.$tr('申请单编号缺失'),
icon: 'none'
})
return
@@ -1802,7 +1649,7 @@ export default {
saveActiveApplicationCode(referenceTypeNo)
}
uni.showLoading({ title: this.t('loadingBill') })
uni.showLoading({ title: this.$tr('正在获取账单...') })
try {
let bill = null
let pendingPaymentOrder = billNo ? await this.getPendingPaymentOrder(billNo).catch(() => null) : null
@@ -1850,7 +1697,7 @@ export default {
billName: description
}
} else {
uni.showToast({ title: this.t('noPendingDepositBill'), icon: 'none' })
uni.showToast({ title: this.$tr('暂无待支付定金账单'), icon: 'none' })
return
}
} else {
@@ -1872,11 +1719,11 @@ export default {
}
if (!billNo) {
uni.showToast({ title: this.t('noPendingDepositBill'), icon: 'none' })
uni.showToast({ title: this.$tr('暂无待支付定金账单'), icon: 'none' })
return
}
uni.showLoading({ title: this.t('loadingPayment') })
uni.showLoading({ title: this.$tr('正在拉起支付...') })
const reusablePendingPaymentOrder = pendingPaymentOrder && !this.isApplicationPendingPaymentExpired({
pendingPaymentOrder
@@ -1888,7 +1735,7 @@ export default {
await this.requestWechatPayment(reusablePendingPaymentOrder.cashier.paymentInfo)
} else {
if (!referenceTypeNo || !bill) {
throw new Error(this.t('fetchPaymentParamsFailed'))
throw new Error(this.$tr('获取支付参数失败'))
}
const wechatCode = await this.getWechatLoginCode()
const payRes = await paymentBillPay({
@@ -1905,11 +1752,11 @@ export default {
await this.requestWechatPayment(cashier.paymentInfo)
}
uni.showToast({ title: this.t('paymentSuccess'), icon: 'success' })
uni.showToast({ title: this.$tr('支付成功'), icon: 'success' })
} catch (error) {
const errMsg = error && (error.errMsg || error.message || error.msg) ? (error.errMsg || error.message || error.msg) : this.t('paymentFailed')
const errMsg = error && (error.errMsg || error.message || error.msg) ? (error.errMsg || error.message || error.msg) : this.$tr('支付失败')
if (/cancel/i.test(errMsg)) {
uni.showToast({ title: this.t('paymentCanceled'), icon: 'none' })
uni.showToast({ title: this.$tr('已取消支付'), icon: 'none' })
} else {
uni.showToast({ title: errMsg, icon: 'none' })
}
@@ -1946,7 +1793,7 @@ export default {
if (step === RESERVATION_FLOW_STEP.BILL) {
if (!referenceTypeNo) {
uni.showToast({
title: this.t('missingBillCode'),
title: this.$tr('申请单编号缺失'),
icon: 'none'
})
return
@@ -1964,7 +1811,7 @@ export default {
}
if (!contractNo) {
uni.showToast({
title: this.t('missingContractNo'),
title: this.$tr('合同编号缺失'),
icon: 'none'
})
return
@@ -2010,7 +1857,7 @@ export default {
const contractNo = String(order && order.reservationCurrentNode && order.reservationCurrentNode.refNo || '').trim()
if (!contractNo) {
uni.showToast({
title: this.t('missingContractNo'),
title: this.$tr('合同编号缺失'),
icon: 'none'
})
return