feat:国际化多语言适配
This commit is contained in:
+24
-20
@@ -2,27 +2,27 @@
|
||||
<view class="deposit-container">
|
||||
<!-- 押金金额卡片 -->
|
||||
<view class="deposit-card">
|
||||
<view class="title">押金余额</view>
|
||||
<view class="title">{{ $t('deposit.depositBalance') }}</view>
|
||||
<view class="amount">¥{{ depositAmount }}</view>
|
||||
<button class="withdraw-btn" @click="handleWithdraw" :disabled="depositAmount <= 0">提现</button>
|
||||
<button class="withdraw-btn" @click="handleWithdraw" :disabled="depositAmount <= 0">{{ $t('deposit.withdraw') }}</button>
|
||||
</view>
|
||||
|
||||
<!-- 提现说明 -->
|
||||
<view class="notice-card">
|
||||
<view class="notice-title">
|
||||
<view class="dot"></view>
|
||||
<text>提现说明</text>
|
||||
<text>{{ $t('deposit.withdrawNotice') }}</text>
|
||||
</view>
|
||||
<view class="notice-content">
|
||||
<view class="notice-item">1. 提现金额将原路退回支付账户</view>
|
||||
<view class="notice-item">2. 提现申请提交后预计0-7个工作日到账</view>
|
||||
<view class="notice-item">3. 如超时未收到,请联系客服处理</view>
|
||||
<view class="notice-item">1. {{ $t('deposit.withdrawNotice1') }}</view>
|
||||
<view class="notice-item">2. {{ $t('deposit.withdrawNotice2') }}</view>
|
||||
<view class="notice-item">3. {{ $t('deposit.withdrawNotice3') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 押金记录 -->
|
||||
<view class="record-card" v-if="records.length > 0">
|
||||
<view class="record-title">押金记录</view>
|
||||
<view class="record-title">{{ $t('deposit.depositRecord') }}</view>
|
||||
<view class="record-list">
|
||||
<view class="record-item" v-for="(item, index) in records" :key="index">
|
||||
<view class="record-info">
|
||||
@@ -53,6 +53,10 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 设置页面标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.$t('deposit.title')
|
||||
})
|
||||
// this.loadUserInfo()
|
||||
},
|
||||
onShow() {
|
||||
@@ -84,7 +88,7 @@ export default {
|
||||
} catch (error) {
|
||||
console.error('获取用户信息失败:', error)
|
||||
uni.showToast({
|
||||
title: '获取用户信息失败',
|
||||
title: this.$t('user.getUserInfoFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
@@ -92,7 +96,7 @@ export default {
|
||||
async handleWithdraw() {
|
||||
if (parseFloat(this.depositAmount) <= 0) {
|
||||
uni.showToast({
|
||||
title: '无可提现余额',
|
||||
title: this.$t('deposit.noBalance'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
@@ -111,12 +115,12 @@ export default {
|
||||
// }
|
||||
|
||||
uni.showModal({
|
||||
title: '确认提现',
|
||||
content: '押金将原路退回,预计0-7个工作日到账',
|
||||
title: this.$t('deposit.confirmWithdraw'),
|
||||
content: this.$t('deposit.withdrawDesc'),
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '提现中...'
|
||||
title: this.$t('deposit.withdrawing')
|
||||
})
|
||||
|
||||
try {
|
||||
@@ -127,7 +131,7 @@ export default {
|
||||
if (result.code === 200) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '提现申请已提交',
|
||||
title: this.$t('deposit.withdrawSubmitted'),
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
@@ -144,26 +148,26 @@ export default {
|
||||
this.loadUserInfo()
|
||||
}, 1500)
|
||||
} else {
|
||||
throw new Error(result.msg || '提现失败')
|
||||
throw new Error(result.msg || this.$t('deposit.withdrawFailed'))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提现失败:', error)
|
||||
uni.hideLoading()
|
||||
|
||||
// 更详细的错误处理
|
||||
let errorMessage = '提现失败,请稍后再试';
|
||||
let errorMessage = this.$t('deposit.withdrawFailed');
|
||||
|
||||
// 如果有具体错误信息,使用它
|
||||
if (error.message) {
|
||||
// 常见错误消息处理
|
||||
if (error.message.includes('尚未归还')) {
|
||||
errorMessage = '当前订单尚未归还,请归还后再提现';
|
||||
errorMessage = this.$t('deposit.orderNotReturned');
|
||||
} else if (error.message.includes('已退还')) {
|
||||
errorMessage = '押金已退还,无需重复提现';
|
||||
errorMessage = this.$t('deposit.alreadyRefunded');
|
||||
} else if (error.message.includes('处理中')) {
|
||||
errorMessage = '押金退还处理中,请耐心等待';
|
||||
errorMessage = this.$t('deposit.refundProcessing');
|
||||
} else if (error.message.includes('余额为0')) {
|
||||
errorMessage = '账户余额为0,无法提现';
|
||||
errorMessage = this.$t('deposit.noBalance');
|
||||
} else {
|
||||
// 使用后端返回的具体错误消息
|
||||
errorMessage = error.message;
|
||||
@@ -172,7 +176,7 @@ export default {
|
||||
|
||||
// 显示错误提示
|
||||
uni.showModal({
|
||||
title: '提现失败',
|
||||
title: this.$t('deposit.withdrawFailed'),
|
||||
content: errorMessage,
|
||||
showCancel: false
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user