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:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="my-application-page tn-safe-area-inset-bottom">
|
||||
<tn-nav-bar :isBack="true" :bottomShadow="false" backgroundColor="transparent">
|
||||
<view class="tn-text-bold tn-text-xl tn-color-black">{{ t('navTitle') }}</view>
|
||||
<view class="tn-text-bold tn-text-xl tn-color-black">{{ $tr('我的申请') }}</view>
|
||||
</tn-nav-bar>
|
||||
|
||||
<view class="page-main tn-padding" :style="{ paddingTop: vuex_custom_bar_height + 'px', paddingBottom: '48rpx' }">
|
||||
@@ -20,7 +20,7 @@
|
||||
</scroll-view>
|
||||
|
||||
<view class="toolbar-row tn-margin-bottom-lg">
|
||||
<view class="toolbar-summary">{{ t('toolbarSummary', { total }) }}</view>
|
||||
<view class="toolbar-summary">{{ $tr('共 {total} 条申请', { total }) }}</view>
|
||||
<view
|
||||
class="refresh-btn"
|
||||
:class="{ 'refresh-btn--loading': loading }"
|
||||
@@ -30,7 +30,7 @@
|
||||
class="tn-text-bold tn-flex tn-flex-row-center tn-flex-col-center"
|
||||
>
|
||||
<text v-if="loading" class="tn-icon-loading tn-margin-right-xs spin"></text>
|
||||
{{ loading ? t('refreshing') : t('refresh') }}
|
||||
{{ loading ? $tr('刷新中...') : $tr('刷新状态') }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -54,23 +54,23 @@
|
||||
|
||||
<view class="card-body tn-margin-top">
|
||||
<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 v-if="item.remark" class="remark-panel tn-margin-top">
|
||||
<view class="remark-label">{{ t('remarkLabel') }}</view>
|
||||
<view class="remark-label">{{ $tr('补充说明') }}</view>
|
||||
<view class="remark-text tn-margin-top-xs">{{ item.remark }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -80,29 +80,29 @@
|
||||
:data-reference-type-no="resolveReferenceTypeNo(item)"
|
||||
@click="goToBillPage"
|
||||
>
|
||||
<text class="tn-text-bold">{{ t('viewBill') }}</text>
|
||||
<text class="tn-text-bold">{{ $tr('查看关联账单') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="load-state">
|
||||
<text v-if="loadingMore">{{ t('loadingMore') }}</text>
|
||||
<text v-else-if="!hasMore">{{ t('noMore') }}</text>
|
||||
<text v-else>{{ t('pullUpMore') }}</text>
|
||||
<text v-if="loadingMore">{{ $tr('加载中...') }}</text>
|
||||
<text v-else-if="!hasMore">{{ $tr('没有更多申请了') }}</text>
|
||||
<text v-else>{{ $tr('上拉加载更多') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else-if="!loading" class="empty-panel tn-padding-lg">
|
||||
<view class="empty-title">{{ t('emptyTitle') }}</view>
|
||||
<view class="empty-desc tn-margin-top-sm">{{ t('emptyDesc') }}</view>
|
||||
<view class="empty-title">{{ $tr('暂无申请记录') }}</view>
|
||||
<view class="empty-desc tn-margin-top-sm">{{ $tr('您还没有提交任何申请,去选房后可发起入住申请或预约看房。') }}</view>
|
||||
<view class="action-btn tn-margin-top-lg" @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-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>
|
||||
</view>
|
||||
@@ -169,76 +169,6 @@ function normalizeApplicationList(list = []) {
|
||||
}
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
zh: {
|
||||
navTitle: '我的申请',
|
||||
toolbarSummary: '共 {total} 条申请',
|
||||
refreshing: '刷新中...',
|
||||
refresh: '刷新状态',
|
||||
apartmentLabel: '所属公寓',
|
||||
occupantLabel: '入住人',
|
||||
viewingTimeLabel: '预约时间',
|
||||
leaseTermLabel: '预计租期',
|
||||
submittedAtLabel: '提交时间',
|
||||
remarkLabel: '补充说明',
|
||||
viewBill: '查看关联账单',
|
||||
loadingMore: '加载中...',
|
||||
noMore: '没有更多申请了',
|
||||
pullUpMore: '上拉加载更多',
|
||||
emptyTitle: '暂无申请记录',
|
||||
emptyDesc: '您还没有提交任何申请,去选房后可发起入住申请或预约看房。',
|
||||
goSelectRoom: '去选房',
|
||||
loadingTitle: '申请列表加载中',
|
||||
loadingDesc: '正在同步您的入住申请记录,请稍候。',
|
||||
statusAll: '全部',
|
||||
statusPending: '待审核',
|
||||
statusApproved: '已通过',
|
||||
statusRejected: '已拒绝',
|
||||
statusFinished: '已结束',
|
||||
statusProcessing: '处理中',
|
||||
refreshSuccess: '申请状态已刷新',
|
||||
loadError: '申请记录加载失败',
|
||||
viewingApplicationTitle: '预约看房申请',
|
||||
stayApplicationTitle: '入住申请',
|
||||
missingBillCode: '申请单编号缺失',
|
||||
missingApplicationCode: '申请编号缺失',
|
||||
dateRangeJoiner: ' 至 '
|
||||
},
|
||||
en: {
|
||||
navTitle: 'My Applications',
|
||||
toolbarSummary: '{total} applications',
|
||||
refreshing: 'Refreshing...',
|
||||
refresh: 'Refresh Status',
|
||||
apartmentLabel: 'Apartment',
|
||||
occupantLabel: 'Resident',
|
||||
viewingTimeLabel: 'Viewing Time',
|
||||
leaseTermLabel: 'Lease Term',
|
||||
submittedAtLabel: 'Submitted At',
|
||||
remarkLabel: 'Remarks',
|
||||
viewBill: 'View Related Bill',
|
||||
loadingMore: 'Loading...',
|
||||
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',
|
||||
loadingTitle: 'Loading applications',
|
||||
loadingDesc: 'Syncing your application records. Please wait.',
|
||||
statusAll: 'All',
|
||||
statusPending: 'Pending',
|
||||
statusApproved: 'Approved',
|
||||
statusRejected: 'Rejected',
|
||||
statusFinished: 'Closed',
|
||||
statusProcessing: 'Processing',
|
||||
refreshSuccess: 'Application status refreshed',
|
||||
loadError: 'Failed to load applications',
|
||||
viewingApplicationTitle: 'Viewing Request',
|
||||
stayApplicationTitle: 'Stay Application',
|
||||
missingBillCode: 'Missing application bill number',
|
||||
missingApplicationCode: 'Missing application number',
|
||||
dateRangeJoiner: ' to '
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
status: '',
|
||||
@@ -278,26 +208,23 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
t(key, params) {
|
||||
return this.$tm('pkgService.my_application.my_application', key, params)
|
||||
},
|
||||
syncStatusOptions() {
|
||||
this.statusOptions = [
|
||||
{ label: this.t('statusAll'), value: '' },
|
||||
{ label: this.t('statusPending'), value: 0 },
|
||||
{ label: this.t('statusApproved'), value: 10 },
|
||||
{ label: this.t('statusRejected'), value: 20 },
|
||||
{ label: this.t('statusFinished'), value: 99 }
|
||||
{ label: this.$tr('全部'), value: '' },
|
||||
{ label: this.$tr('待审核'), value: 0 },
|
||||
{ label: this.$tr('已通过'), value: 10 },
|
||||
{ label: this.$tr('已拒绝'), value: 20 },
|
||||
{ label: this.$tr('已结束'), value: 99 }
|
||||
]
|
||||
},
|
||||
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.language !== 'en' && item.statusDesc) {
|
||||
@@ -338,10 +265,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)}`
|
||||
},
|
||||
async refreshStatus() {
|
||||
if (this.loading || this.loadingMore) {
|
||||
@@ -350,7 +277,7 @@ export default {
|
||||
await this.reloadList()
|
||||
if (this.list.length || this.total === 0) {
|
||||
uni.showToast({
|
||||
title: this.t('refreshSuccess'),
|
||||
title: this.$tr('申请状态已刷新'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
@@ -407,7 +334,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'
|
||||
})
|
||||
})
|
||||
@@ -431,9 +358,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 || ''
|
||||
@@ -495,7 +422,7 @@ export default {
|
||||
: ''
|
||||
if (!referenceTypeNo) {
|
||||
uni.showToast({
|
||||
title: this.t('missingBillCode'),
|
||||
title: this.$tr('申请单编号缺失'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user