feat:国际化多语言适配

This commit is contained in:
2025-10-29 15:48:40 +08:00
parent 985d739324
commit 3d67dc928d
41 changed files with 2636 additions and 2801 deletions
+26 -19
View File
@@ -3,27 +3,27 @@
<!-- 支付成功状态 -->
<view class="status-card">
<view class="status-icon success"></view>
<view class="status-text">支付成功</view>
<view class="status-desc">您的订单已支付成功</view>
<view class="status-text">{{ $t('success.paymentSuccess') }}</view>
<view class="status-desc">{{ $t('success.paymentSuccessDesc') }}</view>
</view>
<!-- 订单信息 -->
<view class="order-card">
<view class="card-title">订单信息</view>
<view class="card-title">{{ $t('success.orderInfo') }}</view>
<view class="info-item">
<text class="label">订单号</text>
<text class="label">{{ $t('order.orderNo') }}</text>
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
</view>
<view class="info-item">
<text class="label">设备号</text>
<text class="label">{{ $t('order.deviceNo') }}</text>
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
</view>
<view class="info-item">
<text class="label">支付金额</text>
<text class="label">{{ $t('success.paymentAmount') }}</text>
<text class="value">{{ orderInfo.amount || '0.00' }}</text>
</view>
<view class="info-item">
<text class="label">支付时间</text>
<text class="label">{{ $t('success.paymentTime') }}</text>
<text class="value">{{ orderInfo.payTime || '-' }}</text>
</view>
</view>
@@ -38,8 +38,8 @@
<!-- 操作按钮 -->
<view class="button-group">
<button class="primary-btn" @click="goToHome">返回首页</button>
<button class="secondary-btn" @click="goToOrderList">查看订单</button>
<button class="primary-btn" @click="goToHome">{{ $t('success.backToHome') }}</button>
<button class="secondary-btn" @click="goToOrderList">{{ $t('success.viewOrder') }}</button>
</view>
</view>
</template>
@@ -54,11 +54,18 @@ export default {
orderId: '',
orderInfo: {},
isLoading: true,
deviceMessage: '正在准备您的设备,请稍候...',
deviceMessage: '',
hasTriggeredDevice: false
}
},
onLoad(options) {
// 设置页面标题
uni.setNavigationBarTitle({
title: this.$t('success.paymentSuccess')
})
this.deviceMessage = this.$t('success.preparingDevice')
if (options && options.orderId) {
this.orderId = options.orderId
this.loadOrderInfo()
@@ -70,7 +77,7 @@ export default {
})
} else {
uni.showToast({
title: '订单信息不存在',
title: this.$t('order.orderNotExist'),
icon: 'none'
})
setTimeout(() => {
@@ -82,7 +89,7 @@ export default {
async loadOrderInfo() {
try {
uni.showLoading({
title: '加载中'
title: this.$t('common.loading')
})
const res = await queryById(this.orderId)
@@ -118,7 +125,7 @@ export default {
} catch (error) {
uni.hideLoading()
uni.showToast({
title: error.message || '获取订单信息失败',
title: error.message || this.$t('order.getOrderFailed'),
icon: 'none'
})
}
@@ -134,7 +141,7 @@ export default {
this.hasTriggeredDevice = true
uni.$emit('orderSuccess:' + this.orderId)
this.isLoading = true
this.deviceMessage = '正在准备您的设备,请稍候...'
this.deviceMessage = this.$t('success.preparingDevice')
try {
console.log(`准备触发弹出风扇,orderId: ${this.orderId}`)
@@ -144,19 +151,19 @@ export default {
console.log('确认支付并弹出风扇结果:', JSON.stringify(result))
if (result && result.code === 200) {
this.deviceMessage = '设备已弹出,请取走您的风扇'
this.deviceMessage = this.$t('success.deviceReady')
uni.showToast({
title: '风扇已弹出',
title: this.$t('success.deviceReady'),
icon: 'success'
})
} else {
throw new Error((result && result.msg) || '弹出风扇失败')
throw new Error((result && result.msg) || this.$t('success.deviceFailed'))
}
} catch (error) {
console.error('弹出风扇错误:', error)
this.deviceMessage = '弹出设备失败,请联系客服'
this.deviceMessage = this.$t('success.deviceFailed')
uni.showToast({
title: error.message || '弹出风扇失败,请联系客服',
title: error.message || this.$t('success.deviceFailed'),
icon: 'none'
})
} finally {