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
+19 -16
View File
@@ -11,18 +11,18 @@
<view class="payment-badge wx-score" v-if="order.payWay == 'wx_score_pay'">
<image src="/static/images/wxpayflag.png" mode="aspectFit" class="badge-icon"></image>
<view class="badge-text">
<text>微信支付分</text>
<text>{{ $t('order.wxPayScore') }}</text>
<text class="divider">|</text>
<text class="highlight">免押租借</text>
<text class="highlight">{{ $t('order.depositFree') }}</text>
</view>
</view>
<view class="payment-badge member" v-else-if="order.payWay == 'wx_member_pay'">
<text class="badge-text">会员订单</text>
<text class="badge-text">{{ $t('order.memberOrder') }}</text>
</view>
<view class="payment-badge deposit" v-else>
<text class="badge-text">微信支付</text>
<text class="badge-text">{{ $t('order.wxPay') }}</text>
<text class="divider">|</text>
<text class="badge-text">押金租借</text>
<text class="badge-text">{{ $t('order.depositPay') }}</text>
</view>
</view>
</view>
@@ -39,11 +39,11 @@
<!-- 订单时间信息 -->
<view class="order-times">
<view class="time-row">
<text class="time-label">租借地点</text>
<text class="time-label">{{ $t('order.rentLocation') }}</text>
<text class="time-value">{{ order.deviceName || order.positionName }}</text>
</view>
<view class="time-row">
<text class="time-label">租借时间</text>
<text class="time-label">{{ $t('order.rentTime') }}</text>
<text class="time-value">{{ order.startTime }}</text>
</view>
<view class="arrow" @click="onDetails">
@@ -59,7 +59,7 @@
<!-- 订单底部 -->
<view class="order-footer">
<view class="footer-left">
<view v-if="isInUse" class="renting"><text class="dot"></text>租借中</view>
<view v-if="isInUse" class="renting"><text class="dot"></text>{{ $t('order.renting') }}</view>
<view v-else-if="isFinished" class="meta">
<view class="meta-item"><text class="dot"></text>{{ usedDurationText }}</view>
<view class="meta-item"><text class="currency"></text>{{ displayAmount }}</view>
@@ -68,19 +68,22 @@
<view class="actions">
<!-- 待支付状态显示支付和取消按钮 -->
<view v-if="isWaitingForPayment" class="action-item primary" @click="onPay">立即支付</view>
<view v-if="isWaitingForPayment" class="action-item secondary" @click="onCancel">取消订单</view>
<view v-if="isWaitingForPayment" class="action-item primary" @click="onPay">{{ $t('order.payNow') }}</view>
<view v-if="isWaitingForPayment" class="action-item secondary" @click="onCancel">{{ $t('order.cancelOrder') }}</view>
<!-- 使用中状态显示归还设备按钮 -->
<view v-if="isInUse" class="action-item primary" @click="onReturn">快速归还</view>
<view v-if="isInUse" class="action-item primary" @click="onReturn">{{ $t('order.quickReturn') }}</view>
<!-- 查看详情按钮对所有订单都显示 -->
<!-- <view class="action-item secondary" >查看详情</view> -->
<!-- <view class="action-item secondary" >{{ $t('order.viewDetails') }}</view> -->
</view>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
import { computed, getCurrentInstance } from 'vue';
const instance = getCurrentInstance()
const $t = instance?.proxy?.$t || ((key) => key)
const props = defineProps({
order: { type: Object, required: true },
@@ -125,7 +128,7 @@
const isInUse = computed(() => normalizedStatus.value === 'in_used');
const isFinished = computed(() => normalizedStatus.value === 'used_done');
const titleText = computed(() => props.order.deviceName ? '租借风扇' : '租借风扇');
const titleText = computed(() => $t('order.rentFan'));
// 显示金额(优先后端给定字段)
const displayAmount = computed(() => props.order.amount || props.order.payAmount || props.order.actualDeviceAmount || props.order.currentFee || '0.00');
@@ -139,8 +142,8 @@
const minutes = Math.floor(diffMs / 60000);
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
if (hours > 0) return `${hours}小时${mins}分钟`;
return `${mins}分钟`;
if (hours > 0) return `${hours}${$t('time.hour')}${mins}${$t('time.minute')}`;
return `${mins}${$t('time.minute')}`;
});
function parseDate(str) {