refactor: replace hardcoded text with language package entries

Replace all inline hardcoded Chinese strings in multiple Vue pages with corresponding language package keys, to unify text management and support multi-language switching.
This commit is contained in:
2026-06-22 11:23:53 +08:00
parent 014046bc9e
commit cc39e06161
19 changed files with 191 additions and 191 deletions

View File

@@ -11,7 +11,7 @@
</uni-grid-item>
</uni-grid>
</view>
<view v-if="brandList.length == 0"><ns-empty text="暂无更多品牌,去首页看看吧"></ns-empty></view>
<view v-if="brandList.length == 0"><ns-empty :text="$lang('brand.noMoreBrand')"></ns-empty></view>
</block>
</mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover>
@@ -76,7 +76,7 @@ export default {
}
},
onShareAppMessage(res) {
var title = '你想要的大牌都在这里';
var title = this.$lang('brand.shareTitle');
var path = '/pages_tool/goods/brand';
return {
title: title,

View File

@@ -3,11 +3,11 @@
<view class="cf-container color-line-border">
<view class="tab">
<view @click="changeSort(1)"><text
:class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">全部</text></view>
:class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('coupon.all') }}</text></view>
<view @click="changeSort(2, 'reward')"><text
:class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">满减券</text></view>
:class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('coupon.rewardCoupon') }}</text></view>
<view @click="changeSort(3, 'discount')"><text
:class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">折扣券</text></view>
:class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">{{ $lang('coupon.discountCoupon') }}</text></view>
<!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> -->
</view>
</view>
@@ -29,22 +29,22 @@
<view class="use_price price-font" v-else-if="item.type == 'discount'"
:class="{ disabled: item.useState == 2 }">
{{ parseFloat(item.discount) }}
<text>折</text>
<text>{{ $lang('coupon.discountSuffix') }}</text>
</view>
<view class="use_condition font-size-tag" v-if="item.at_least > 0"
:class="{ disabled: item.useState == 2 }">满{{ item.at_least }}元可用</view>
:class="{ disabled: item.useState == 2 }">{{ $lang('coupon.availableOver', { amount: item.at_least }) }}</view>
<view class="use_condition font-size-tag" v-else
:class="{ disabled: item.useState == 2 }">无门槛优惠券</view>
:class="{ disabled: item.useState == 2 }">{{ $lang('coupon.noThresholdCoupon') }}</view>
</view>
</view>
<view class="item-info">
<view class="use_title">
<view class="title">{{ item.coupon_name }}</view>
<view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3"
:class="{ disabled: item.useState == 2 }">指定商品</view>
<view class="max_price" v-else :class="{ disabled: item.useState == 2 }">全场商品</view>
:class="{ disabled: item.useState == 2 }">{{ $lang('coupon.designatedGoods') }}</view>
<view class="max_price" v-else :class="{ disabled: item.useState == 2 }">{{ $lang('coupon.allGoods') }}</view>
<view class="max_price" v-if="item.discount_limit != '0.00'">
(最大优惠{{ item.discount_limit }}元)
({{ $lang('coupon.maxDiscount', { amount: item.discount_limit }) }})
</view>
<view class="max_price" :class="{ disabled: item.useState == 2 }">{{
item.use_channel_name }}</view>
@@ -53,21 +53,21 @@
</view> -->
</view>
<view class="use_time" v-if="item.validity_type == 0">
有效期:{{ $util.timeStampTurnTime(item.end_time) }}</view>
{{ $lang('coupon.validUntil') }}:{{ $util.timeStampTurnTime(item.end_time) }}</view>
<view class="use_time" v-else-if="item.validity_type == 1">
有效期:领取之日起{{ item.fixed_term }}日内有效</view>
<view class="use_time" v-else>有效期:长期有效</view>
{{ $lang('coupon.validDays') }}:{{ $lang('coupon.validWithinDays', { days: item.fixed_term }) }}</view>
<view class="use_time" v-else>{{ $lang('coupon.validUntil') }}:{{ $lang('coupon.permanentValid') }}</view>
</view>
<view class="item-btn">
<view v-if="item.useState == 0" @click.stop="receiveCoupon(item, index)">领取</view>
<view v-if="item.useState == 1" @click.stop="toGoodsList(item, index)">去使用</view>
<view v-if="item.receivedType == 'out'" class="disabled">已抢光</view>
<view v-if="item.receivedType == 'expire'" class="disabled">已过期</view>
<view v-if="item.receivedType == 'limit'" class="disabled">已达上限</view>
<view v-if="item.useState == 0" @click.stop="receiveCoupon(item, index)">{{ $lang('coupon.receive') }}</view>
<view v-if="item.useState == 1" @click.stop="toGoodsList(item, index)">{{ $lang('coupon.goUse') }}</view>
<view v-if="item.receivedType == 'out'" class="disabled">{{ $lang('coupon.soldOut') }}</view>
<view v-if="item.receivedType == 'expire'" class="disabled">{{ $lang('coupon.expired') }}</view>
<view v-if="item.receivedType == 'limit'" class="disabled">{{ $lang('coupon.limitReached') }}</view>
</view>
</view>
</view>
<view v-if="list.length == 0"><ns-empty text="暂无可领取的优惠券" :isIndex="false"></ns-empty></view>
<view v-if="list.length == 0"><ns-empty :text="$lang('coupon.noAvailableCoupon')" :isIndex="false"></ns-empty></view>
</block>
</mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover>
@@ -99,7 +99,7 @@ export default {
setTimeout(() => {
if (!this.addonIsExist.coupon) {
this.$util.showToast({
title: '商家未开启优惠券',
title: this.$lang('coupon.notEnabled'),
mask: true,
duration: 2000
});
@@ -173,7 +173,7 @@ export default {
},
success: res => {
this.couponBtnSwitch = false;
let msg = '领取成功,快去使用吧';
let msg = this.$lang('coupon.receiveSuccess');
let list = this.list;
if (res.code < 0) msg = res.message;

View File

@@ -7,24 +7,24 @@
<view class="get-coupon">
<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-else-if="info.type == 'discount'">{{ info.discount }}折</view>
<text v-if="info.at_least > 0" class="color-tip">满{{ info.at_least }}元使用</text>
<text v-else class="color-tip">无门槛优惠券</text>
<view v-if="info.validity_type == 0" class="color-tip">有效期至 {{ $util.timeStampTurnTime(info.end_time) }}</view>
<view v-else-if="info.validity_type == 1" class="color-tip">领取之日起{{ info.fixed_term }}天内有效</view>
<view v-else class="color-tip">长期有效</view>
<view class="color-base-text coupon-price" v-else-if="info.type == 'discount'">{{ info.discount }}{{ $lang('coupon.discountSuffix') }}</view>
<text v-if="info.at_least > 0" class="color-tip">{{ $lang('coupon.useOver', { amount: info.at_least }) }}</text>
<text v-else class="color-tip">{{ $lang('coupon.noThresholdCoupon') }}</text>
<view v-if="info.validity_type == 0" class="color-tip">{{ $lang('coupon.validUntil') }} {{ $util.timeStampTurnTime(info.end_time) }}</view>
<view v-else-if="info.validity_type == 1" class="color-tip">{{ $lang('coupon.validWithinDays', { days: info.fixed_term }) }}</view>
<view v-else class="color-tip">{{ $lang('coupon.permanentValid') }}</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 class="w-460 truncate">适用门店:{{ info.use_store_name}}</view>
<view class="w-460 truncate">{{ $lang('coupon.applyStore') }}:{{ info.use_store_name}}</view>
</view>
<view class="get-span" @click="receiveGoodsCoupon(info.coupon_type_id)">
<button type="primary" v-if="isCanReceive">{{ button }}</button>
<button type="primary" disabled v-if="!isCanReceive">{{ button }}</button>
</view>
<view class="color-tip font-size-goods-tag tips">注:扫描二维码或点击右上角进行分享</view>
<view class="color-tip font-size-goods-tag tips">{{ $lang('coupon.scanShareTip') }}</view>
</view>
</view>
<loading-cover ref="loadingCover"></loading-cover>
@@ -42,7 +42,7 @@
info: {},
couponTypeId: 0,
path: '',
button: '领取',
button: this.$lang('coupon.receive'),
uid: 0,
couponBtnSwitch: false, //获取优惠券防止重复提交
receivedNum: 0,
@@ -53,7 +53,7 @@
setTimeout( () => {
if (!this.addonIsExist.coupon) {
this.$util.showToast({
title: '商家未开启优惠券',
title: this.$lang('coupon.notEnabled'),
mask: true,
duration: 2000
});
@@ -152,7 +152,7 @@
let msg = res.message;
this.receivedType = data.type;
if (res.code == 0) {
msg = '领取成功';
msg = this.$lang('coupon.receiveSuccess');
this.receivedNum += 1;
}
this.buttonRefresh();
@@ -181,18 +181,18 @@
});
},
buttonRefresh() {
this.button = '领取';
this.button = this.$lang('coupon.receive');
if (this.info.count <= this.info.lead_count || this.receivedType == 'out') {
this.button = '来迟了该优惠券已被领取完了!';
this.button = this.$lang('coupon.soldOutTip');
}
if (this.info.status == 2 || this.receivedType == 'expire') {
this.button = '该优惠券活动已结束!';
this.button = this.$lang('coupon.endedTip');
}
if (this.info.status == 3) {
this.button = '该优惠券活动已关闭';
this.button = this.$lang('coupon.closedTip');
}
if (this.receivedType == 'limit'){
this.button = '该优惠券领取已达到上限!';
this.button = this.$lang('coupon.limitTip');
}
},
/**
@@ -204,14 +204,14 @@
var title = '';
if (this.info.type == 'reward') {
title = '恭喜您获得一张' + this.info.money + '元的优惠券';
title = this.$lang('coupon.shareRewardTitle', { money: this.info.money });
} else if (this.info.type == 'discount') {
title = '恭喜您获得一张' + this.info.discount + '折优惠券';
title = this.$lang('coupon.shareDiscountTitle', { discount: this.info.discount });
}
if (this.info.at_least > 0) {
var desc = `满${this.info.at_least}元可用`;
var desc = this.$lang('coupon.availableOver', { amount: this.info.at_least });
} else {
var desc = `无门槛优惠券`;
var desc = this.$lang('coupon.noThresholdCoupon');
}
this.$util.setPublicShare({
title: title,
@@ -239,14 +239,14 @@
onShareAppMessage(res) {
var title = '';
if (this.info.type == 'reward') {
title = '恭喜您获得一张' + this.info.money + '元的优惠券';
title = this.$lang('coupon.shareRewardTitle', { money: this.info.money });
} else if (this.info.type == 'discount') {
title = '恭喜您获得一张' + this.info.discount + '折优惠券';
title = this.$lang('coupon.shareDiscountTitle', { discount: this.info.discount });
}
if (this.info.at_least > 0) {
title += `,满${this.info.at_least}元可用`;
title += this.$lang('coupon.shareAvailableOver', { amount: this.info.at_least });
} else {
title += `,无门槛优惠券`;
title += this.$lang('coupon.shareNoThreshold');
}
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;

View File

@@ -44,12 +44,12 @@
</scroll-view>
<view v-if="item.explain_first != ''" class="time shop-reply-box">
<view class="shop-reply">商家回复:</view>
<view class="shop-reply">{{ $lang('evaluate.sellerReply') }}</view>
<view class="cont">{{ item.explain_first }}</view>
</view>
<template v-if="item.again_content != '' && item.again_is_audit == 1">
<view class="review-evaluation color-base-text">追加评价</view>
<view class="review-evaluation color-base-text">{{ $lang('evaluate.addEvaluate') }}</view>
<view class="cont">{{ item.again_content }}</view>
<scroll-view scroll-x="true">
<view class="evaluate-img" v-if="item.again_images.length > 0">
@@ -66,7 +66,7 @@
</view>
</template>
</view>
<view v-if="list.length == 0"><ns-empty text="暂无商品评价"></ns-empty></view>
<view v-if="list.length == 0"><ns-empty :text="$lang('evaluate.noGoodsEvaluate')"></ns-empty></view>
</block>
</mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover>
@@ -79,7 +79,7 @@ export default {
return {
goodsId: 0,
list: [],
evaluateList: [{ name: '全部', value: 0, count: 0 }, { name: '好评', value: 1, count: 0 }, { name: '中评', value: 2, count: 0 }, { name: '差评', value: 3, count: 0 }],
evaluateList: [{ name: this.$lang('evaluate.all'), value: 0, count: 0 }, { name: this.$lang('evaluate.goodReview'), value: 1, count: 0 }, { name: this.$lang('evaluate.mediumReview'), value: 2, count: 0 }, { name: this.$lang('evaluate.badReview'), value: 3, count: 0 }],
evaluateTab: 0,
mescroll_type: {}
};

View File

@@ -2,7 +2,7 @@
<view class="page" :style="themeColor">
<view class="closeBox">
<image :src="$util.img('public/uniapp/goods/not_exist.png')" mode="widthFix" show-menu-by-longpress></image>
<text class="close-title">您查看的商品不存在,可能已下架或被删除</text>
<text class="close-title">{{ $lang('goods.goodsNotExist') }}</text>
</view>
</view>
</template>

View File

@@ -12,7 +12,7 @@
<view class="history" v-if="historyList.length">
<view class="history-box">
<view class="history-top">
<view class="title">历史搜索</view>
<view class="title">{{ $lang('goods.historySearch') }}</view>
<view class="icon iconfont icon-icon7" @click="deleteHistoryList"></view>
</view>
<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-box">
<view class="history-top">
<view class="title">热门搜索</view>
<view class="title">{{ $lang('goods.hotSearch') }}</view>
</view>
<view class="history-bottom">
<view class="history-li" v-for="(item, index) in hotList" :key="index" @click="otherSearch(item)" @longtap="deleteItem(item)">
@@ -82,8 +82,8 @@
//删除所有历史记录
deleteHistoryList() {
uni.showModal({
title: '提示',
content: '确认删除全部历史记录?',
title: this.$lang('form.tip'),
content: this.$lang('goods.confirmDeleteAllHistory'),
success: res => {
if (res.confirm) {
uni.setStorageSync('search', []);
@@ -95,8 +95,8 @@
//删除历史记录的某一项
deleteItem(e) {
uni.showModal({
title: '提示',
content: '确认删除该条历史记录?',
title: this.$lang('form.tip'),
content: this.$lang('goods.confirmDeleteHistory'),
success: res => {
if (res.confirm) {
let array = uni.getStorageSync('search');
@@ -162,7 +162,7 @@
} else {
if (this.searchWords == '') {
this.$util.showToast({
title: '搜索内容不能为空哦'
title: this.$lang('goods.searchContentNotEmpty')
});
} else {
this.$util.redirectTo('/pages_goods/list', {