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,15 +1,15 @@
|
||||
<template>
|
||||
<view class="my-contract-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" :style="{ paddingTop: vuex_custom_bar_height + 'px' }">
|
||||
<view class="overview-panel">
|
||||
<view class="overview-header">
|
||||
<view>
|
||||
<view class="overview-title">{{ t('overviewTitle') }}</view>
|
||||
<view class="overview-subtitle">{{ t('overviewSubtitle') }}</view>
|
||||
<view class="overview-title">{{ $tr('合同概览') }}</view>
|
||||
<view class="overview-subtitle">{{ $tr('查看住宿合同、签约状态与有效期限') }}</view>
|
||||
</view>
|
||||
<view class="overview-badge">
|
||||
<text class="tn-icon-edit-form"></text>
|
||||
@@ -18,11 +18,11 @@
|
||||
</view>
|
||||
<view class="overview-metrics">
|
||||
<view class="metric-item">
|
||||
<view class="metric-label">{{ t('pendingMetricLabel') }}</view>
|
||||
<view class="metric-label">{{ $tr('待签约/审批') }}</view>
|
||||
<view class="metric-value">{{ summaryStats.pending }}</view>
|
||||
</view>
|
||||
<view class="metric-item is-primary">
|
||||
<view class="metric-label">{{ t('displayMetricLabel') }}</view>
|
||||
<view class="metric-label">{{ $tr('当前展示') }}</view>
|
||||
<view class="metric-value">{{ displayList.length }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -41,8 +41,8 @@
|
||||
</view>
|
||||
|
||||
<view v-if="loading" class="empty-panel">
|
||||
<view class="empty-title">{{ t('loadingTitle') }}</view>
|
||||
<view class="empty-desc">{{ t('loadingDesc') }}</view>
|
||||
<view class="empty-title">{{ $tr('合同记录加载中') }}</view>
|
||||
<view class="empty-desc">{{ $tr('正在同步您的合同数据,请稍候。') }}</view>
|
||||
</view>
|
||||
|
||||
<view v-else-if="displayList.length" class="list-wrapper">
|
||||
@@ -58,7 +58,7 @@
|
||||
<text class="tn-icon-edit-write-fill"></text>
|
||||
</view>
|
||||
<view class="card-title-group">
|
||||
<view class="card-title">{{ t('contractTitle') }}</view>
|
||||
<view class="card-title">{{ $tr('住宿合同') }}</view>
|
||||
<view class="card-code">{{ item.no || item.contractNo || '--' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -70,26 +70,26 @@
|
||||
|
||||
<view class="meta-strip">
|
||||
<view class="meta-chip">
|
||||
<view class="meta-chip-label">{{ t('relatedOrderLabel') }}</view>
|
||||
<view class="meta-chip-label">{{ $tr('关联订单') }}</view>
|
||||
<view class="meta-chip-value">{{ item.orderNo || '--' }}</view>
|
||||
</view>
|
||||
<view class="meta-chip">
|
||||
<view class="meta-chip-label">{{ t('signStatusLabel') }}</view>
|
||||
<view class="meta-chip-value">{{ item.signImageUrl ? t('signed') : t('unsigned') }}</view>
|
||||
<view class="meta-chip-label">{{ $tr('签署状态') }}</view>
|
||||
<view class="meta-chip-value">{{ item.signImageUrl ? $tr('已签名') : $tr('待签名') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="detail-panel">
|
||||
<view class="info-row">
|
||||
<text class="info-label">{{ t('contractPeriodLabel') }}</text>
|
||||
<text class="info-label">{{ $tr('合同期限') }}</text>
|
||||
<text class="info-value">{{ formatDateRange(item.start, item.end) }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">{{ t('recordTipLabel') }}</text>
|
||||
<text class="info-label">{{ $tr('记录说明') }}</text>
|
||||
<text class="info-value">{{ getStatusTip(item) }}</text>
|
||||
</view>
|
||||
<view v-if="item.signImageUrl" class="sign-row">
|
||||
<text class="info-label">{{ t('mySignatureLabel') }}</text>
|
||||
<text class="info-label">{{ $tr('我的签名') }}</text>
|
||||
<view class="sign-preview">
|
||||
<image :src="item.signImageUrl" mode="aspectFit"></image>
|
||||
</view>
|
||||
@@ -112,8 +112,8 @@
|
||||
<view class="empty-icon">
|
||||
<text class="tn-icon-folder"></text>
|
||||
</view>
|
||||
<view class="empty-title">{{ t('emptyTitle') }}</view>
|
||||
<view class="empty-desc">{{ t('emptyDesc') }}</view>
|
||||
<view class="empty-title">{{ $tr('暂无对应的合同记录') }}</view>
|
||||
<view class="empty-desc">{{ $tr('切换筛选条件,或等待系统生成新的合同数据。') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -133,74 +133,6 @@ function normalizeContract(item = {}) {
|
||||
}
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
zh: {
|
||||
navTitle: '我的合同',
|
||||
overviewTitle: '合同概览',
|
||||
overviewSubtitle: '查看住宿合同、签约状态与有效期限',
|
||||
pendingMetricLabel: '待签约/审批',
|
||||
displayMetricLabel: '当前展示',
|
||||
loadingTitle: '合同记录加载中',
|
||||
loadingDesc: '正在同步您的合同数据,请稍候。',
|
||||
contractTitle: '住宿合同',
|
||||
relatedOrderLabel: '关联订单',
|
||||
signStatusLabel: '签署状态',
|
||||
signed: '已签名',
|
||||
unsigned: '待签名',
|
||||
contractPeriodLabel: '合同期限',
|
||||
recordTipLabel: '记录说明',
|
||||
mySignatureLabel: '我的签名',
|
||||
emptyTitle: '暂无对应的合同记录',
|
||||
emptyDesc: '切换筛选条件,或等待系统生成新的合同数据。',
|
||||
tabAll: '全部',
|
||||
tabPending: '待签约',
|
||||
statusRejected: '已拒绝',
|
||||
statusPending: '待审批',
|
||||
statusApproved: '已通过',
|
||||
statusProcessing: '处理中',
|
||||
dateRangeJoiner: ' 至 ',
|
||||
tipApproved: '合同已生效,可查看签约结果。',
|
||||
tipNeedSign: '待您完成签名后进入审批流程。',
|
||||
tipPending: '已提交签约信息,等待审批结果。',
|
||||
tipRejected: '合同未通过审批,请联系管理员处理。',
|
||||
tipDefault: '请关注合同最新状态。',
|
||||
actionSign: '去签约',
|
||||
actionViewDetail: '查看详情'
|
||||
},
|
||||
en: {
|
||||
navTitle: 'My Contracts',
|
||||
overviewTitle: 'Contract Overview',
|
||||
overviewSubtitle: 'Check stay contracts, signing status, and effective period',
|
||||
pendingMetricLabel: 'Pending Sign / Review',
|
||||
displayMetricLabel: 'Displayed',
|
||||
loadingTitle: 'Loading contracts',
|
||||
loadingDesc: 'Syncing your contract data. Please wait.',
|
||||
contractTitle: 'Stay Contract',
|
||||
relatedOrderLabel: 'Related Order',
|
||||
signStatusLabel: 'Signing Status',
|
||||
signed: 'Signed',
|
||||
unsigned: 'Unsigned',
|
||||
contractPeriodLabel: 'Contract Period',
|
||||
recordTipLabel: 'Notes',
|
||||
mySignatureLabel: 'My Signature',
|
||||
emptyTitle: 'No contract record found',
|
||||
emptyDesc: 'Switch filters or wait for new contract data to be generated.',
|
||||
tabAll: 'All',
|
||||
tabPending: 'Pending Sign',
|
||||
statusRejected: 'Rejected',
|
||||
statusPending: 'Pending Review',
|
||||
statusApproved: 'Approved',
|
||||
statusProcessing: 'Processing',
|
||||
dateRangeJoiner: ' to ',
|
||||
tipApproved: 'The contract is effective now. You can view the signing result.',
|
||||
tipNeedSign: 'Please complete your signature to enter the review process.',
|
||||
tipPending: 'Signing information has been submitted and is waiting for review.',
|
||||
tipRejected: 'The contract did not pass review. Please contact the administrator.',
|
||||
tipDefault: 'Please pay attention to the latest contract status.',
|
||||
actionSign: 'Sign Now',
|
||||
actionViewDetail: 'View Detail'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentTab: 'all',
|
||||
@@ -241,13 +173,10 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
t(key, params) {
|
||||
return this.$tm('pkgService.my_contract.my_contract', key, params)
|
||||
},
|
||||
syncTabs() {
|
||||
this.tabs = [
|
||||
{ label: this.t('tabAll'), value: 'all' },
|
||||
{ label: this.t('tabPending'), value: 'pending' }
|
||||
{ label: this.$tr('全部'), value: 'all' },
|
||||
{ label: this.$tr('待签约'), value: 'pending' }
|
||||
]
|
||||
},
|
||||
getStoreUser() {
|
||||
@@ -316,11 +245,11 @@ export default {
|
||||
},
|
||||
getStatusText(status) {
|
||||
const map = {
|
||||
'-1': this.t('statusRejected'),
|
||||
'0': this.t('statusPending'),
|
||||
'1': this.t('statusApproved')
|
||||
'-1': this.$tr('已拒绝'),
|
||||
'0': this.$tr('待审批'),
|
||||
'1': this.$tr('已通过')
|
||||
}
|
||||
return map[String(status)] || this.t('statusProcessing')
|
||||
return map[String(status)] || this.$tr('处理中')
|
||||
},
|
||||
getDisplayStatusText(item = {}) {
|
||||
if (this.language !== 'en' && item.approvalStatusDesc) {
|
||||
@@ -340,28 +269,28 @@ export default {
|
||||
if (!start && !end) {
|
||||
return '--'
|
||||
}
|
||||
return `${this.formatDate(start)}${this.t('dateRangeJoiner')}${this.formatDate(end)}`
|
||||
return `${this.formatDate(start)}${this.$tr(' 至 ')}${this.formatDate(end)}`
|
||||
},
|
||||
getStatusTip(item = {}) {
|
||||
if (Number(item.approvalStatus) === 1) {
|
||||
return this.t('tipApproved')
|
||||
return this.$tr('合同已生效,可查看签约结果。')
|
||||
}
|
||||
if (Number(item.approvalStatus) === 0 && !item.signImageUrl) {
|
||||
return this.t('tipNeedSign')
|
||||
return this.$tr('待您完成签名后进入审批流程。')
|
||||
}
|
||||
if (Number(item.approvalStatus) === 0) {
|
||||
return this.t('tipPending')
|
||||
return this.$tr('已提交签约信息,等待审批结果。')
|
||||
}
|
||||
if (Number(item.approvalStatus) === -1) {
|
||||
return this.t('tipRejected')
|
||||
return this.$tr('合同未通过审批,请联系管理员处理。')
|
||||
}
|
||||
return this.t('tipDefault')
|
||||
return this.$tr('请关注合同最新状态。')
|
||||
},
|
||||
resolveActionText(item = {}) {
|
||||
if (this.shouldShowSignAction(item)) {
|
||||
return this.t('actionSign')
|
||||
return this.$tr('去签约')
|
||||
}
|
||||
return this.t('actionViewDetail')
|
||||
return this.$tr('查看详情')
|
||||
},
|
||||
shouldShowSignAction(item = {}) {
|
||||
return Number(item.approvalStatus) === 0 && !item.signImageUrl
|
||||
|
||||
Reference in New Issue
Block a user