refactor(merch): 替换硬编码文本为国际化语言包
1. 将商品详情页的"立即咨询"替换为$lang('merch.consultNow')
2. 新增商品相关国际化文案并替换原有硬编码字符串
3. 统一使用多语言函数处理页面文本内容
This commit is contained in:
@@ -362,7 +362,7 @@ export default {
|
||||
//获取满减信息
|
||||
getManjian(data) {
|
||||
this.manjian = data;
|
||||
let limit = data.type == 0 ? '元' : '件';
|
||||
let limit = data.type == 0 ? this.$lang('goods.yuan') : this.$lang('goods.piece');
|
||||
Object.keys(data.rule_json).forEach((key) => {
|
||||
var item = data.rule_json[key];
|
||||
if (item.coupon_data) {
|
||||
@@ -374,40 +374,40 @@ export default {
|
||||
// 满减
|
||||
if (item.discount_money != undefined) {
|
||||
if (this.manjian.manjian == undefined) {
|
||||
this.manjian.manjian = '满' + item.limit + limit + '减' + item.discount_money + '元';
|
||||
this.manjian.manjian = this.$lang('goods.spendLimitMinus', { limit: item.limit, unit: limit, money: item.discount_money });
|
||||
} else {
|
||||
this.manjian.manjian += ';满' + item.limit + limit + '减' + item.discount_money + '元';
|
||||
this.manjian.manjian += this.$lang('goods.semicolonSpendLimitMinus', { limit: item.limit, unit: limit, money: item.discount_money });
|
||||
}
|
||||
}
|
||||
// 满送
|
||||
if (item.point != undefined || item.coupon != undefined) {
|
||||
let text = '';
|
||||
if (item.point != undefined) {
|
||||
text = '送' + item.point + '积分';
|
||||
text = this.$lang('goods.givePoints', { points: item.point });
|
||||
}
|
||||
if (item.coupon != undefined && item.coupon_data != undefined) {
|
||||
item.coupon_data.forEach((couponItem, couponIndex) => {
|
||||
if (couponItem.type == 'discount') {
|
||||
if (text == '') text = '送' + item.coupon_num[couponIndex] + '张' + parseFloat(couponItem.discount) + '折优惠券';
|
||||
else text += '、送' + item.coupon_num[couponIndex] + '张' + parseFloat(couponItem.discount) + '折优惠券';
|
||||
if (text == '') text = this.$lang('goods.giveDiscountCoupon', { num: item.coupon_num[couponIndex], discount: parseFloat(couponItem.discount) });
|
||||
else text += this.$lang('goods.andGiveDiscountCoupon', { num: item.coupon_num[couponIndex], discount: parseFloat(couponItem.discount) });
|
||||
} else {
|
||||
if (text == '') text = '送' + item.coupon_num[couponIndex] + '张' + parseFloat(couponItem.money) + '元优惠券';
|
||||
else text += '、送' + item.coupon_num[couponIndex] + '张' + parseFloat(couponItem.money) + '元优惠券';
|
||||
if (text == '') text = this.$lang('goods.giveMoneyCoupon', { num: item.coupon_num[couponIndex], money: parseFloat(couponItem.money) });
|
||||
else text += this.$lang('goods.andGiveMoneyCoupon', { num: item.coupon_num[couponIndex], money: parseFloat(couponItem.money) });
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.manjian.mansong == undefined) {
|
||||
this.manjian.mansong = '满' + item.limit + limit + text;
|
||||
this.manjian.mansong = this.$lang('goods.spendLimit', { limit: item.limit, unit: limit }) + text;
|
||||
} else {
|
||||
this.manjian.mansong += ';' + '满' + item.limit + limit + text;
|
||||
this.manjian.mansong += this.$lang('goods.semicolonSpend') + this.$lang('goods.spendLimit', { limit: item.limit, unit: limit }) + text;
|
||||
}
|
||||
}
|
||||
// 包邮
|
||||
if (item.free_shipping != undefined) {
|
||||
if (this.manjian.free_shipping == undefined) {
|
||||
this.manjian.free_shipping = '满' + item.limit + limit + '包邮';
|
||||
this.manjian.free_shipping = this.$lang('goods.spendLimitFreeShipping', { limit: item.limit, unit: limit });
|
||||
} else {
|
||||
this.manjian.free_shipping += ';满' + item.limit + limit + '包邮';
|
||||
this.manjian.free_shipping += this.$lang('goods.semicolonSpendLimitFreeShipping', { limit: item.limit, unit: limit });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user