refactor: 整理多页面语言包调用路径,统一翻译键层级

1. 调整品牌专区、商品评价、搜索、优惠券等页面的语言翻译引用,将零散翻译项归类到对应模块下
2. 优化auth.js中的语言包路径引用,修正模块命名空间
3. 清理zh-cn/en-us品牌语言包的冗余嵌套结构
This commit is contained in:
2026-07-03 11:23:05 +08:00
parent 6470912498
commit 2a2161c9d9
7 changed files with 61 additions and 65 deletions

View File

@@ -33,7 +33,7 @@ export default {
} else { } else {
fallbackFunc && fallbackFunc(res); fallbackFunc && fallbackFunc(res);
this.$util.showToast({ this.$util.showToast({
title: res.message ? res.message : this.$lang('common.auth.miniProgramConfigError') title: res.message ? res.message : this.$lang('auth.miniProgramConfigError')
}); });
} }
} }
@@ -74,7 +74,7 @@ export default {
} else { } else {
fallbackFunc && fallbackFunc(res); fallbackFunc && fallbackFunc(res);
this.$util.showToast({ this.$util.showToast({
title: res.message ? res.message : this.$lang('common.auth.miniProgramConfigError') title: res.message ? res.message : this.$lang('auth.miniProgramConfigError')
}); });
} }
} }

View File

@@ -2,8 +2,6 @@ export const lang = {
//title为每个页面的标题 //title为每个页面的标题
title: 'Brand Zone', title: 'Brand Zone',
// goods/brand.vue page new translation items // goods/brand.vue page new translation items
brand: {
// No more brands // No more brands
noMoreBrand: 'No more brands, go to the homepage', noMoreBrand: 'No more brands, go to the homepage',
},
} }

View File

@@ -2,8 +2,6 @@ export const lang = {
//title为每个页面的标题 //title为每个页面的标题
title: '品牌专区', title: '品牌专区',
// goods/brand.vue 页面新增翻译项 // goods/brand.vue 页面新增翻译项
brand: {
// 没有更多品牌了 // 没有更多品牌了
noMoreBrand: '暂无更多品牌,去首页看看吧', noMoreBrand: '暂无更多品牌,去首页看看吧',
},
} }

View File

@@ -3,11 +3,11 @@
<view class="cf-container color-line-border"> <view class="cf-container color-line-border">
<view class="tab"> <view class="tab">
<view @click="changeSort(1)"><text <view @click="changeSort(1)"><text
:class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('tabAll') }}</text></view> :class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('goods.coupon.tabAll') }}</text></view>
<view @click="changeSort(2, 'reward')"><text <view @click="changeSort(2, 'reward')"><text
:class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('tabReward') }}</text></view> :class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('goods.coupon.tabReward') }}</text></view>
<view @click="changeSort(3, 'discount')"><text <view @click="changeSort(3, 'discount')"><text
:class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('tabDiscount') }}</text></view> :class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('goods.coupon.tabDiscount') }}</text></view>
<!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> --> <!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> -->
</view> </view>
</view> </view>
@@ -28,22 +28,22 @@
</view> </view>
<view class="use_price price-font" v-else-if="item.type == 'discount'" <view class="use_price price-font" v-else-if="item.type == 'discount'"
:class="{ disabled: item.useState == 2 }"> :class="{ disabled: item.useState == 2 }">
{{ $lang('discountText', { discount: parseFloat(item.discount) }) }} {{ $lang('goods.coupon.discountText', { discount: parseFloat(item.discount) }) }}
</view> </view>
<view class="use_condition font-size-tag" v-if="item.at_least > 0" <view class="use_condition font-size-tag" v-if="item.at_least > 0"
:class="{ disabled: item.useState == 2 }">{{ $lang('minSpendAvailable', { atLeast: item.at_least }) }}</view> :class="{ disabled: item.useState == 2 }">{{ $lang('goods.coupon.minSpendAvailable', { atLeast: item.at_least }) }}</view>
<view class="use_condition font-size-tag" v-else <view class="use_condition font-size-tag" v-else
:class="{ disabled: item.useState == 2 }">{{ $lang('noThresholdCoupon') }}</view> :class="{ disabled: item.useState == 2 }">{{ $lang('goods.coupon.noThresholdCoupon') }}</view>
</view> </view>
</view> </view>
<view class="item-info"> <view class="item-info">
<view class="use_title"> <view class="use_title">
<view class="title">{{ item.coupon_name }}</view> <view class="title">{{ item.coupon_name }}</view>
<view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3" <view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3"
:class="{ disabled: item.useState == 2 }">{{ $lang('specifiedGoods') }}</view> :class="{ disabled: item.useState == 2 }">{{ $lang('goods.coupon.specifiedGoods') }}</view>
<view class="max_price" v-else :class="{ disabled: item.useState == 2 }">{{ $lang('allGoods') }}</view> <view class="max_price" v-else :class="{ disabled: item.useState == 2 }">{{ $lang('goods.coupon.allGoods') }}</view>
<view class="max_price" v-if="item.discount_limit != '0.00'"> <view class="max_price" v-if="item.discount_limit != '0.00'">
{{ $lang('maxDiscount', { amount: item.discount_limit }) }} {{ $lang('goods.coupon.maxDiscount', { amount: item.discount_limit }) }}
</view> </view>
<view class="max_price" :class="{ disabled: item.useState == 2 }">{{ <view class="max_price" :class="{ disabled: item.useState == 2 }">{{
item.use_channel_name }}</view> item.use_channel_name }}</view>
@@ -52,21 +52,21 @@
</view> --> </view> -->
</view> </view>
<view class="use_time" v-if="item.validity_type == 0"> <view class="use_time" v-if="item.validity_type == 0">
{{ $lang('validPeriodDate', { date: $util.timeStampTurnTime(item.end_time) }) }}</view> {{ $lang('goods.coupon.validPeriodDate', { date: $util.timeStampTurnTime(item.end_time) }) }}</view>
<view class="use_time" v-else-if="item.validity_type == 1"> <view class="use_time" v-else-if="item.validity_type == 1">
{{ $lang('validPeriodDays', { days: item.fixed_term }) }}</view> {{ $lang('goods.coupon.validPeriodDays', { days: item.fixed_term }) }}</view>
<view class="use_time" v-else>{{ $lang('validPeriodLong') }}</view> <view class="use_time" v-else>{{ $lang('goods.coupon.validPeriodLong') }}</view>
</view> </view>
<view class="item-btn"> <view class="item-btn">
<view v-if="item.useState == 0" @click.stop="receiveCoupon(item, index)">{{ $lang('receive') }}</view> <view v-if="item.useState == 0" @click.stop="receiveCoupon(item, index)">{{ $lang('goods.coupon.receive') }}</view>
<view v-if="item.useState == 1" @click.stop="toGoodsList(item, index)">{{ $lang('useNow') }}</view> <view v-if="item.useState == 1" @click.stop="toGoodsList(item, index)">{{ $lang('goods.coupon.useNow') }}</view>
<view v-if="item.receivedType == 'out'" class="disabled">{{ $lang('soldOut') }}</view> <view v-if="item.receivedType == 'out'" class="disabled">{{ $lang('goods.coupon.soldOut') }}</view>
<view v-if="item.receivedType == 'expire'" class="disabled">{{ $lang('expired') }}</view> <view v-if="item.receivedType == 'expire'" class="disabled">{{ $lang('goods.coupon.expired') }}</view>
<view v-if="item.receivedType == 'limit'" class="disabled">{{ $lang('limitReached') }}</view> <view v-if="item.receivedType == 'limit'" class="disabled">{{ $lang('goods.coupon.limitReached') }}</view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="list.length == 0"><ns-empty :text="$lang('emptyText')" :isIndex="false"></ns-empty></view> <view v-if="list.length == 0"><ns-empty :text="$lang('goods.coupon.emptyText')" :isIndex="false"></ns-empty></view>
</block> </block>
</mescroll-uni> </mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover> <loading-cover ref="loadingCover"></loading-cover>
@@ -98,7 +98,7 @@ export default {
setTimeout(() => { setTimeout(() => {
if (!this.addonIsExist.coupon) { if (!this.addonIsExist.coupon) {
this.$util.showToast({ this.$util.showToast({
title: this.$lang('merchantNotEnabled'), title: this.$lang('goods.coupon.merchantNotEnabled'),
mask: true, mask: true,
duration: 2000 duration: 2000
}); });
@@ -172,7 +172,7 @@ export default {
}, },
success: res => { success: res => {
this.couponBtnSwitch = false; this.couponBtnSwitch = false;
let msg = this.$lang('receiveSuccess'); let msg = this.$lang('goods.coupon.receiveSuccess');
let list = this.list; let list = this.list;
if (res.code < 0) msg = res.message; if (res.code < 0) msg = res.message;

View File

@@ -7,24 +7,24 @@
<view class="get-coupon"> <view class="get-coupon">
<text class="coupon-name">{{ info.coupon_name }}</text> <text class="coupon-name">{{ info.coupon_name }}</text>
<view class="color-base-text coupon-price" v-if="info.type == 'reward'">¥{{ info.money }}</view> <view class="color-base-text coupon-price" v-if="info.type == 'reward'">¥{{ info.money }}</view>
<view class="color-base-text coupon-price" v-else-if="info.type == 'discount'">{{ $lang('discountText', { discount: info.discount }) }}</view> <view class="color-base-text coupon-price" v-else-if="info.type == 'discount'">{{ $lang('goods.coupon_receive.discountText', { discount: info.discount }) }}</view>
<text v-if="info.at_least > 0" class="color-tip">{{ $lang('minSpendUsage', { atLeast: info.at_least }) }}</text> <text v-if="info.at_least > 0" class="color-tip">{{ $lang('goods.coupon_receive.minSpendUsage', { atLeast: info.at_least }) }}</text>
<text v-else class="color-tip">{{ $lang('noThresholdCoupon') }}</text> <text v-else class="color-tip">{{ $lang('goods.coupon_receive.noThresholdCoupon') }}</text>
<view v-if="info.validity_type == 0" class="color-tip">{{ $lang('validUntil', { endTime: $util.timeStampTurnTime(info.end_time) }) }}</view> <view v-if="info.validity_type == 0" class="color-tip">{{ $lang('goods.coupon_receive.validUntil', { endTime: $util.timeStampTurnTime(info.end_time) }) }}</view>
<view v-else-if="info.validity_type == 1" class="color-tip">{{ $lang('validDaysAfterReceive', { fixedTerm: info.fixed_term }) }}</view> <view v-else-if="info.validity_type == 1" class="color-tip">{{ $lang('goods.coupon_receive.validDaysAfterReceive', { fixedTerm: info.fixed_term }) }}</view>
<view v-else class="color-tip">{{ $lang('longTermValid') }}</view> <view v-else class="color-tip">{{ $lang('goods.coupon_receive.longTermValid') }}</view>
<!-- 适用场景: --> <!-- 适用场景: -->
<view class="color-tip truncate" v-if="info.use_channel!='all'">{{ info.use_channel_name }}</view> <view class="color-tip truncate" v-if="info.use_channel!='all'">{{ info.use_channel_name }}</view>
<!-- 适用门店: --> <!-- 适用门店: -->
<view v-if="info.use_channel!='online' &&info.use_store!='all'" class="color-tip"> <view v-if="info.use_channel!='online' &&info.use_store!='all'" class="color-tip">
<view class="w-460 truncate">{{ $lang('applicableStores', { storeName: info.use_store_name }) }}</view> <view class="w-460 truncate">{{ $lang('goods.coupon_receive.applicableStores', { storeName: info.use_store_name }) }}</view>
</view> </view>
<view class="get-span" @click="receiveGoodsCoupon(info.coupon_type_id)"> <view class="get-span" @click="receiveGoodsCoupon(info.coupon_type_id)">
<button type="primary" v-if="isCanReceive">{{ button }}</button> <button type="primary" v-if="isCanReceive">{{ button }}</button>
<button type="primary" disabled v-if="!isCanReceive">{{ button }}</button> <button type="primary" disabled v-if="!isCanReceive">{{ button }}</button>
</view> </view>
<view class="color-tip font-size-goods-tag tips">{{ $lang('scanShareTip') }}</view> <view class="color-tip font-size-goods-tag tips">{{ $lang('goods.coupon_receive.scanShareTip') }}</view>
</view> </view>
</view> </view>
<loading-cover ref="loadingCover"></loading-cover> <loading-cover ref="loadingCover"></loading-cover>
@@ -50,11 +50,11 @@
}; };
}, },
onLoad(data) { onLoad(data) {
this.button = this.$lang('receive'); this.button = this.$lang('goods.coupon_receive.receive');
setTimeout( () => { setTimeout( () => {
if (!this.addonIsExist.coupon) { if (!this.addonIsExist.coupon) {
this.$util.showToast({ this.$util.showToast({
title: this.$lang('merchantNotEnabled'), title: this.$lang('goods.coupon_receive.merchantNotEnabled'),
mask: true, mask: true,
duration: 2000 duration: 2000
}); });
@@ -153,7 +153,7 @@
let msg = res.message; let msg = res.message;
this.receivedType = data.type; this.receivedType = data.type;
if (res.code == 0) { if (res.code == 0) {
msg = this.$lang('receiveSuccess'); msg = this.$lang('goods.coupon_receive.receiveSuccess');
this.receivedNum += 1; this.receivedNum += 1;
} }
this.buttonRefresh(); this.buttonRefresh();
@@ -182,18 +182,18 @@
}); });
}, },
buttonRefresh() { buttonRefresh() {
this.button = this.$lang('receive'); this.button = this.$lang('goods.coupon_receive.receive');
if (this.info.count <= this.info.lead_count || this.receivedType == 'out') { if (this.info.count <= this.info.lead_count || this.receivedType == 'out') {
this.button = this.$lang('couponSoldOut'); this.button = this.$lang('goods.coupon_receive.couponSoldOut');
} }
if (this.info.status == 2 || this.receivedType == 'expire') { if (this.info.status == 2 || this.receivedType == 'expire') {
this.button = this.$lang('activityEnded'); this.button = this.$lang('goods.coupon_receive.activityEnded');
} }
if (this.info.status == 3) { if (this.info.status == 3) {
this.button = this.$lang('activityClosed'); this.button = this.$lang('goods.coupon_receive.activityClosed');
} }
if (this.receivedType == 'limit'){ if (this.receivedType == 'limit'){
this.button = this.$lang('receiveLimitReached'); this.button = this.$lang('goods.coupon_receive.receiveLimitReached');
} }
}, },
/** /**
@@ -205,14 +205,14 @@
var title = ''; var title = '';
if (this.info.type == 'reward') { if (this.info.type == 'reward') {
title = this.$lang('congratsMoneyCoupon', { money: this.info.money }); title = this.$lang('goods.coupon_receive.congratsMoneyCoupon', { money: this.info.money });
} else if (this.info.type == 'discount') { } else if (this.info.type == 'discount') {
title = this.$lang('congratsDiscountCoupon', { discount: this.info.discount }); title = this.$lang('goods.coupon_receive.congratsDiscountCoupon', { discount: this.info.discount });
} }
if (this.info.at_least > 0) { if (this.info.at_least > 0) {
var desc = this.$lang('minSpendAvailable', { atLeast: this.info.at_least }); var desc = this.$lang('goods.coupon_receive.minSpendAvailable', { atLeast: this.info.at_least });
} else { } else {
var desc = this.$lang('noThresholdCoupon'); var desc = this.$lang('goods.coupon_receive.noThresholdCoupon');
} }
this.$util.setPublicShare({ this.$util.setPublicShare({
title: title, title: title,
@@ -240,14 +240,14 @@
onShareAppMessage(res) { onShareAppMessage(res) {
var title = ''; var title = '';
if (this.info.type == 'reward') { if (this.info.type == 'reward') {
title = this.$lang('congratsMoneyCoupon', { money: this.info.money }); title = this.$lang('goods.coupon_receive.congratsMoneyCoupon', { money: this.info.money });
} else if (this.info.type == 'discount') { } else if (this.info.type == 'discount') {
title = this.$lang('congratsDiscountCoupon', { discount: this.info.discount }); title = this.$lang('goods.coupon_receive.congratsDiscountCoupon', { discount: this.info.discount });
} }
if (this.info.at_least > 0) { if (this.info.at_least > 0) {
title += ',' + this.$lang('minSpendAvailable', { atLeast: this.info.at_least }); title += ',' + this.$lang('goods.coupon_receive.minSpendAvailable', { atLeast: this.info.at_least });
} else { } else {
title += ',' + this.$lang('noThresholdCoupon'); title += ',' + this.$lang('goods.coupon_receive.noThresholdCoupon');
} }
var path = '/pages_tool/goods/coupon_receive?coupon_type_id=' + this.couponTypeId; var path = '/pages_tool/goods/coupon_receive?coupon_type_id=' + this.couponTypeId;
if (this.memberInfo && this.memberInfo.member_id) path += '&source_member=' + this.memberInfo.member_id; if (this.memberInfo && this.memberInfo.member_id) path += '&source_member=' + this.memberInfo.member_id;

View File

@@ -44,12 +44,12 @@
</scroll-view> </scroll-view>
<view v-if="item.explain_first != ''" class="time shop-reply-box"> <view v-if="item.explain_first != ''" class="time shop-reply-box">
<view class="shop-reply">{{ $lang('shopReply') }}</view> <view class="shop-reply">{{ $lang('goods.evaluate.shopReply') }}</view>
<view class="cont">{{ item.explain_first }}</view> <view class="cont">{{ item.explain_first }}</view>
</view> </view>
<template v-if="item.again_content != '' && item.again_is_audit == 1"> <template v-if="item.again_content != '' && item.again_is_audit == 1">
<view class="review-evaluation color-base-text">{{ $lang('additionalReview') }}</view> <view class="review-evaluation color-base-text">{{ $lang('goods.evaluate.additionalReview') }}</view>
<view class="cont">{{ item.again_content }}</view> <view class="cont">{{ item.again_content }}</view>
<scroll-view scroll-x="true"> <scroll-view scroll-x="true">
<view class="evaluate-img" v-if="item.again_images.length > 0"> <view class="evaluate-img" v-if="item.again_images.length > 0">
@@ -61,12 +61,12 @@
</scroll-view> </scroll-view>
<view v-if="item.again_explain != ''" class="time shop-reply-box"> <view v-if="item.again_explain != ''" class="time shop-reply-box">
<view class="shop-reply" v-if="item.again_explain != ''">{{ $lang('shopReply') }}</view> <view class="shop-reply" v-if="item.again_explain != ''">{{ $lang('goods.evaluate.shopReply') }}</view>
<view class="cont">{{ item.again_explain }}</view> <view class="cont">{{ item.again_explain }}</view>
</view> </view>
</template> </template>
</view> </view>
<view v-if="list.length == 0"><ns-empty :text="$lang('emptyText')"></ns-empty></view> <view v-if="list.length == 0"><ns-empty :text="$lang('goods.evaluate.emptyText')"></ns-empty></view>
</block> </block>
</mescroll-uni> </mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover> <loading-cover ref="loadingCover"></loading-cover>

View File

@@ -12,7 +12,7 @@
<view class="history" v-if="historyList.length"> <view class="history" v-if="historyList.length">
<view class="history-box"> <view class="history-box">
<view class="history-top"> <view class="history-top">
<view class="title">{{ $lang('history') }}</view> <view class="title">{{ $lang('goods.search.history') }}</view>
<view class="icon iconfont icon-icon7" @click="deleteHistoryList"></view> <view class="icon iconfont icon-icon7" @click="deleteHistoryList"></view>
</view> </view>
<view class="history-bottom " id="history-list" :style="{ maxHeight: !isAllHistory ? '100%' : '168rpx' }"> <view class="history-bottom " id="history-list" :style="{ maxHeight: !isAllHistory ? '100%' : '168rpx' }">
@@ -30,7 +30,7 @@
<view class="history" v-if="hotList.length"> <view class="history" v-if="hotList.length">
<view class="history-box"> <view class="history-box">
<view class="history-top"> <view class="history-top">
<view class="title">{{ $lang('hot') }}</view> <view class="title">{{ $lang('goods.search.hot') }}</view>
</view> </view>
<view class="history-bottom"> <view class="history-bottom">
<view class="history-li" v-for="(item, index) in hotList" :key="index" @click="otherSearch(item)" @longtap="deleteItem(item)"> <view class="history-li" v-for="(item, index) in hotList" :key="index" @click="otherSearch(item)" @longtap="deleteItem(item)">
@@ -82,8 +82,8 @@
//删除所有历史记录 //删除所有历史记录
deleteHistoryList() { deleteHistoryList() {
uni.showModal({ uni.showModal({
title: this.$lang('tip'), title: this.$lang('goods.search.tip'),
content: this.$lang('confirmDeleteAllHistory'), content: this.$lang('goods.search.confirmDeleteAllHistory'),
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
uni.setStorageSync('search', []); uni.setStorageSync('search', []);
@@ -95,8 +95,8 @@
//删除历史记录的某一项 //删除历史记录的某一项
deleteItem(e) { deleteItem(e) {
uni.showModal({ uni.showModal({
title: this.$lang('tip'), title: this.$lang('goods.search.tip'),
content: this.$lang('confirmDeleteHistory'), content: this.$lang('goods.search.confirmDeleteHistory'),
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
let array = uni.getStorageSync('search'); let array = uni.getStorageSync('search');
@@ -162,7 +162,7 @@
} else { } else {
if (this.searchWords == '') { if (this.searchWords == '') {
this.$util.showToast({ this.$util.showToast({
title: this.$lang('searchContentEmpty') title: this.$lang('goods.search.searchContentEmpty')
}); });
} else { } else {
this.$util.redirectTo('/pages_goods/list', { this.$util.redirectTo('/pages_goods/list', {