i18n: 替换所有硬编码文本为多语言配置

将项目中各处的硬编码字符串替换为国际化语言包调用,统一管理页面和组件的文案内容,方便后续多语言适配与维护
This commit is contained in:
2026-06-22 17:53:38 +08:00
parent 47098bddda
commit 4715f06b2f
19 changed files with 109 additions and 100 deletions

View File

@@ -236,7 +236,7 @@ export default {
handleUnifiedKefuClick() { handleUnifiedKefuClick() {
this.customerService.handleUnifiedKefuClick({ this.customerService.handleUnifiedKefuClick({
sendMessageTitle: '来自悬浮按钮的咨询', sendMessageTitle: this.$lang('kefu.hoverNavConsult'),
sendMessagePath: '/pages/index/index' sendMessagePath: '/pages/index/index'
}); });
} }

View File

@@ -36,8 +36,13 @@ export default {
methods: { methods: {
getText() { getText() {
let self = this; let self = this;
let timeVal = _time_.getFormatTime(self.textVal, self.maxDate); let timeVal = _time_.getFormatTime(self.textVal, self.maxDate, {
if (timeVal && (timeVal.endsWith('刚刚') || timeVal.endsWith('分钟前'))) { justNow: self.$lang('time.justNow'),
minutesAgo: self.$lang('time.minutesAgo'),
hoursAgo: self.$lang('time.hoursAgo'),
daysAgo: self.$lang('time.daysAgo')
});
if (timeVal && (timeVal.endsWith(self.$lang('time.justNow')) || timeVal.endsWith(self.$lang('time.minutesAgo')))) {
setTimeout(() => { setTimeout(() => {
let temp = self.textVal; let temp = self.textVal;
self.textVal = ''; self.textVal = '';

View File

@@ -89,17 +89,18 @@ timeProto.getLastDate = function(constTime) {
return date.getFullYear() + '-' + month + '-' + day; return date.getFullYear() + '-' + month + '-' + day;
} }
const resDateStr = function(timer, constTime) { const resDateStr = function(timer, constTime, i18n) {
const t = i18n || { justNow: "刚刚", minutesAgo: "分钟前", hoursAgo: "小时前", daysAgo: "天前" }
let _just = function(timer) { let _just = function(timer) {
if (timer <= 0 || Math.floor(timer / 60) <= 0) { if (timer <= 0 || Math.floor(timer / 60) <= 0) {
return "刚刚" return t.justNow
} else return 'next'; } else return 'next';
} }
let _mm = function(timer) { let _mm = function(timer) {
if (timer < 3600) { if (timer < 3600) {
return Math.floor(timer / 60) + "分钟前" return Math.floor(timer / 60) + t.minutesAgo
} else return 'next'; } else return 'next';
} }
let _hh = function(timer, constTime) { let _hh = function(timer, constTime) {
@@ -107,7 +108,7 @@ const resDateStr = function(timer, constTime) {
if (timer >= 3600 && (constTime - today >= 0)) { if (timer >= 3600 && (constTime - today >= 0)) {
//可切换显示模式 //可切换显示模式
// return "今天 " + new Date(constTime).pattern("HH:mm"); // return "今天 " + new Date(constTime).pattern("HH:mm");
return Math.floor(timer / 60 / 60) + "小时前"; return Math.floor(timer / 60 / 60) + t.hoursAgo;
} else { } else {
return 'next' return 'next'
}; };
@@ -116,7 +117,7 @@ const resDateStr = function(timer, constTime) {
let today = _time_.getTodayUnix(); let today = _time_.getTodayUnix();
timer = (today - constTime) / 1000; timer = (today - constTime) / 1000;
if (timer / 86400 <= 31) { if (timer / 86400 <= 31) {
return Math.ceil(timer / 86400) + "天前" return Math.ceil(timer / 86400) + t.daysAgo
} else return 'next'; } else return 'next';
} }
let _dlast = function(timer, constTime) { let _dlast = function(timer, constTime) {

View File

@@ -41,8 +41,8 @@ export default {
}, },
noMoreSize: 2, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5 noMoreSize: 2, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
empty: { empty: {
tip: '~ 空空如也 ~', // 提示 tip: '~ ' + this.$lang('mescroll.emptyTip') + ' ~', // 提示
btnText: '去看看' btnText: this.$lang('mescroll.goBrowse')
}, },
onScroll: true onScroll: true
}, },

View File

@@ -147,7 +147,7 @@ export default {
success: res => { success: res => {
if (res.code >= 0) { if (res.code >= 0) {
let item = res.data; let item = res.data;
item.unit = item.unit || '件'; item.unit = item.unit || this.$lang('goods.piece');
if (item.sku_images) item.sku_images = item.sku_images.split(','); if (item.sku_images) item.sku_images = item.sku_images.split(',');
else item.sku_images = []; else item.sku_images = [];

View File

@@ -72,12 +72,12 @@ export default {
payIndex: 0, payIndex: 0,
// #ifdef H5 // #ifdef H5
payTypeList: [{ payTypeList: [{
name: '支付宝支付', name: this.$lang('payment.alipayPay'),
icon: 'icon-zhifubaozhifu-', icon: 'icon-zhifubaozhifu-',
type: 'alipay' type: 'alipay'
}, },
{ {
name: '微信支付', name: this.$lang('payment.wechatPay'),
icon: 'icon-weixin1', icon: 'icon-weixin1',
type: 'wechatpay' type: 'wechatpay'
} }
@@ -86,7 +86,7 @@ export default {
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
payTypeList: [{ payTypeList: [{
name: '微信支付', name: this.$lang('payment.wechatPay'),
provider: 'wxpay', provider: 'wxpay',
icon: 'icon-weixin1', icon: 'icon-weixin1',
type: 'wechatpay' type: 'wechatpay'
@@ -95,7 +95,7 @@ export default {
// #endif // #endif
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
payTypeList: [{ payTypeList: [{
name: '支付宝支付', name: this.$lang('payment.alipayPay'),
icon: 'icon-zhifubaozhifu-', icon: 'icon-zhifubaozhifu-',
type: 'alipay', type: 'alipay',
provider: 'alipay' provider: 'alipay'

View File

@@ -145,7 +145,7 @@ export default {
let num = 1; //记录循环执行过的次数 let num = 1; //记录循环执行过的次数
let mostDay = this.obj.dataTime.most_day ? this.obj.dataTime.most_day + 1 : 1; // 最多可预约天数 let mostDay = this.obj.dataTime.most_day ? this.obj.dataTime.most_day + 1 : 1; // 最多可预约天数
let startTime = parseInt(today.getTime() / 1000); let startTime = parseInt(today.getTime() / 1000);
let week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; let week = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
if (obj.time_week && obj.time_week.length == 7) { if (obj.time_week && obj.time_week.length == 7) {
//判断是否七天全有 //判断是否七天全有
judge = true; judge = true;
@@ -170,9 +170,9 @@ export default {
i = i - 1; i = i - 1;
} else { } else {
objects = { objects = {
title: this.obj.dataTime.advance_day == 0 ? '今天' : '', title: this.obj.dataTime.advance_day == 0 ? this.$lang('date.today') : '',
type: 'special', type: 'special',
month: nowMonth + '月' + nowDate + '日', month: nowMonth + this.$lang('date.month') + nowDate + this.$lang('date.day'),
Day: '(' + dayStr + ')' Day: '(' + dayStr + ')'
}; };
this.dayData.push(objects); //左侧日期数据处理 this.dayData.push(objects); //左侧日期数据处理
@@ -182,8 +182,8 @@ export default {
case 2: case 2:
if (i == 0 || i == 1) { if (i == 0 || i == 1) {
objects = { objects = {
title: this.obj.dataTime.advance_day == 0 ? '明天' : '', title: this.obj.dataTime.advance_day == 0 ? this.$lang('date.tomorrow') : '',
month: nowMonth + '月' + nowDate + '日', month: nowMonth + this.$lang('date.month') + nowDate + this.$lang('date.day'),
Day: '(' + dayStr + ')' Day: '(' + dayStr + ')'
}; };
this.dayData.push(objects); //左侧日期数据处理 this.dayData.push(objects); //左侧日期数据处理
@@ -192,7 +192,7 @@ export default {
default: default:
objects = { objects = {
title: '', title: '',
month: nowMonth + '月' + nowDate + '日', month: nowMonth + this.$lang('date.month') + nowDate + this.$lang('date.day'),
Day: '(' + dayStr + ')' Day: '(' + dayStr + ')'
}; };
this.dayData.push(objects); //左侧日期数据处理 this.dayData.push(objects); //左侧日期数据处理
@@ -267,7 +267,7 @@ export default {
if (time <= item.end_time) { if (time <= item.end_time) {
let text = ''; let text = '';
if (this.obj.delivery.delivery_type == 'local' && i == 0) { if (this.obj.delivery.delivery_type == 'local' && i == 0) {
text = '立即配送('+ this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval) + ')'; text = this.$lang('delivery.immediate') + '('+ this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval) + ')';
} else { } else {
text = this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval); text = this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval);
} }

View File

@@ -63,12 +63,12 @@
payIndex: 0, payIndex: 0,
// #ifdef H5 // #ifdef H5
payTypeList: [{ payTypeList: [{
name: '支付宝支付', name: this.$lang('payment.alipayPay'),
icon: 'icon-zhifubaozhifu-', icon: 'icon-zhifubaozhifu-',
type: 'alipay' type: 'alipay'
}, },
{ {
name: '微信支付', name: this.$lang('payment.wechatPay'),
icon: 'icon-weixin1', icon: 'icon-weixin1',
type: 'wechatpay' type: 'wechatpay'
} }
@@ -77,7 +77,7 @@
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
payTypeList: [{ payTypeList: [{
name: '微信支付', name: this.$lang('payment.wechatPay'),
provider: 'wxpay', provider: 'wxpay',
icon: 'icon-weixin1', icon: 'icon-weixin1',
type: 'wechatpay' type: 'wechatpay'
@@ -85,7 +85,7 @@
// #endif // #endif
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
payTypeList: [{ payTypeList: [{
name: '支付宝支付', name: this.$lang('payment.alipayPay'),
icon: 'icon-zhifubaozhifu-', icon: 'icon-zhifubaozhifu-',
type: 'alipay', type: 'alipay',
provider: 'alipay' provider: 'alipay'

View File

@@ -43,12 +43,12 @@ export default {
showPop: false, showPop: false,
privacyAuthorization: null, privacyAuthorization: null,
privacyResolves: new Set(), privacyResolves: new Set(),
privacyContractName: '用户隐私保护指引', privacyContractName: this.$lang('privacy.contractName'),
appName: '本小程序', appName: this.$lang('privacy.miniAppName'),
// #ifdef WEB || H5 // #ifdef WEB || H5
appName: '本应用', appName: this.$lang('privacy.appName'),
privacyContractName: '《隐私条款》', privacyContractName: this.$lang('privacy.termsTitle'),
privacyServiceName: '《用户服务协议》', privacyServiceName: this.$lang('privacy.serviceTerms'),
// #endif // #endif
} }
}, },

View File

@@ -142,7 +142,7 @@
// 方案2:使用SDK打开用户资料 // 方案2:使用SDK打开用户资料
this.openUserProfile(contactId); this.openUserProfile(contactId);
} else { } else {
this.showError('未配置企业微信客服信息'); this.showError(this.$lang('wxwork.notConfigured'));
} }
// #endif // #endif
@@ -151,7 +151,7 @@
// H5环境直接跳转 // H5环境直接跳转
window.location.href = contactUrl; window.location.href = contactUrl;
} else { } else {
this.showError('未配置企业微信客服信息'); this.showError(this.$lang('wxwork.notConfigured'));
} }
// #endif // #endif
}, },
@@ -171,7 +171,7 @@
}, },
fail: (err) => { fail: (err) => {
console.error('跳转企业微信失败:', err); console.error('跳转企业微信失败:', err);
this.showError('跳转失败,请检查企业微信配置'); this.showError(this.$lang('wxwork.jumpFailed'));
} }
}); });
}, },
@@ -181,7 +181,7 @@
*/ */
openUserProfile(contactId) { openUserProfile(contactId) {
if (!this.wxWorkSDK) { if (!this.wxWorkSDK) {
this.showError('企业微信SDK未初始化'); this.showError(this.$lang('wxwork.sdkNotInit'));
return; return;
} }
@@ -190,7 +190,7 @@
}, (res) => { }, (res) => {
}, (err) => { }, (err) => {
console.error('打开用户资料失败:', err); console.error('打开用户资料失败:', err);
this.showError('打开用户资料失败'); this.showError(this.$lang('wxwork.openProfileFailed'));
}); });
}, },

View File

@@ -23,7 +23,7 @@ export function currentTime() {
} }
//时间戳转日期 //时间戳转日期
export function timeStamp(time) { export function timeStamp(time, dayNames) {
const dates = new Date(time) const dates = new Date(time)
const year = dates.getFullYear() const year = dates.getFullYear()
const month = dates.getMonth() + 1 const month = dates.getMonth() + 1
@@ -31,32 +31,33 @@ export function timeStamp(time) {
const day = dates.getDay() const day = dates.getDay()
const hour = dates.getHours() const hour = dates.getHours()
const min = dates.getMinutes() const min = dates.getMinutes()
const days = ['日', '一', '二', '三', '四', '五', '六'] const days = dayNames || ['日', '一', '二', '三', '四', '五', '六']
return { return {
allDate: `${year}/${strFormat(month)}/${strFormat(date)}`, allDate: `${year}/${strFormat(month)}/${strFormat(date)}`,
date: `${strFormat(month)}-${strFormat(date)}`, //返回的日期 07-01,${strFormat(year)}-${strFormat(month)}-${strFormat(date)} date: `${strFormat(month)}-${strFormat(date)}`, //返回的日期 07-01,${strFormat(year)}-${strFormat(month)}-${strFormat(date)}
day: `周${days[day]}`, //返回的礼拜天数 星期一 day: `${days[day]}`, //返回的礼拜天数 星期一
hour: strFormat(hour) + ':' + strFormat(min) // + ':00' //返回的时钟 08:00 hour: strFormat(hour) + ':' + strFormat(min) // + ':00' //返回的时钟 08:00
} }
} }
//获取最近7天的日期和礼拜天数 //获取最近7天的日期和礼拜天数
export function initData(appointedDay = '') { export function initData(appointedDay = '', dayNames) {
const time = [] const time = []
const date = appointedDay ? new Date(appointedDay) : new Date() const date = appointedDay ? new Date(appointedDay) : new Date()
const now = date.getTime() //获取当前日期的时间戳 const now = date.getTime() //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000 //一天的时间戳 let timeStr = 3600 * 24 * 1000 //一天的时间戳
const defaults = dayNames || { today: "今天", tomorrow: "明天", dayAfterTomorrow: "后天" }
let obj = { let obj = {
0: "今天", 0: defaults.today,
1: "明天", 1: defaults.tomorrow,
2: "后天" 2: defaults.dayAfterTomorrow
} }
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
const timeObj = {} const timeObj = {}
timeObj.date = timeStamp(now + timeStr * i).date //保存日期 timeObj.date = timeStamp(now + timeStr * i, dayNames).date //保存日期
timeObj.timeStamp = now + timeStr * i //保存时间戳 timeObj.timeStamp = now + timeStr * i //保存时间戳
timeObj.week = appointedDay == '' ? (obj[i] ?? timeStamp(now + timeStr * i).day) : timeStamp(now + timeStr * i) timeObj.week = appointedDay == '' ? (obj[i] ?? timeStamp(now + timeStr * i, dayNames).day) : timeStamp(now + timeStr * i, dayNames)
.day .day
time.push(timeObj) time.push(timeObj)
} }

View File

@@ -173,7 +173,7 @@
return { return {
pickerStartDay: '', // 指定开始日期 pickerStartDay: '', // 指定开始日期
pickerEndDay: '', // 指定结束日期 pickerEndDay: '', // 指定结束日期
orderDateTime: '暂无选择', // 选中时间 orderDateTime: this.$lang('date.noSelection'), // 选中时间
orderTimeArr: {}, //多选的时间 orderTimeArr: {}, //多选的时间
dateArr: [], //日期数据 dateArr: [], //日期数据
timeArr: [], //时间数据 timeArr: [], //时间数据
@@ -188,14 +188,16 @@
}; };
}, },
created(props) { created(props) {
const dayNames = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
const dayLabels = { today: this.$lang('date.today'), tomorrow: this.$lang('date.tomorrow'), dayAfterTomorrow: this.$lang('date.dayAfterTomorrow') };
this.selectDate = this.nowDate = currentTime().date; this.selectDate = this.nowDate = currentTime().date;
this.pickerStartDay = currentTime().year + '-' + currentTime().date; this.pickerStartDay = currentTime().year + '-' + currentTime().date;
const now = new Date(this.pickerStartDay).getTime(); //获取当前日期的时间戳 const now = new Date(this.pickerStartDay).getTime(); //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000; //一天的时间戳 let timeStr = 3600 * 24 * 1000; //一天的时间戳
let day = 90; // 未来3个月 let day = 90; // 未来3个月
this.pickerEndDay = timeStamp(now + timeStr * day).allDate; this.pickerEndDay = timeStamp(now + timeStr * day, dayNames).allDate;
this.initOnload(); this.initOnload();
this.dateArr = initData(); // 日期栏初始化 this.dateArr = initData('', dayLabels); // 日期栏初始化
}, },
methods: { methods: {
open() { open() {
@@ -209,18 +211,18 @@
let date = e.split("-"); let date = e.split("-");
date = date[1] + "-" + date[2]; date = date[1] + "-" + date[2];
if (this.disableWeek.length && date >= weekDate()[0] && date <= weekDate()[1]) { if (this.disableWeek.length && date >= weekDate()[0] && date <= weekDate()[1]) {
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let index = new Date(e).getDay(); let index = new Date(e).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) { if (this.disableWeek.indexOf(weekBox[index]) != -1) {
uni.showToast({ uni.showToast({
title: weekBox[index] + '不可以预约', title: weekBox[index] + this.$lang('date.cannotReserve'),
icon: 'none' icon: 'none'
}) })
return false; return false;
} }
} }
this.initOnload(e); this.initOnload(e);
this.dateArr = initData(e); // 日期栏初始化 this.dateArr = initData(e, { today: this.$lang('date.today'), tomorrow: this.$lang('date.tomorrow'), dayAfterTomorrow: this.$lang('date.dayAfterTomorrow') }); // 日期栏初始化
this.selectDateEvent(0, this.dateArr[0]); this.selectDateEvent(0, this.dateArr[0]);
}, },
initOnload(appointedDay) { initOnload(appointedDay) {
@@ -231,7 +233,7 @@
// 判断默认是不能选择的周,则都禁止选中 // 判断默认是不能选择的周,则都禁止选中
if (this.disableWeek.length && this.selectDate >= weekDate()[0] && this.selectDate <= if (this.disableWeek.length && this.selectDate >= weekDate()[0] && this.selectDate <=
weekDate()[1]) { weekDate()[1]) {
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let date = currentTime().year + '-' + this.selectDate; let date = currentTime().year + '-' + this.selectDate;
let index = new Date(date).getDay(); let index = new Date(date).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) { if (this.disableWeek.indexOf(weekBox[index]) != -1) {
@@ -280,7 +282,7 @@
this.isSection && (item.isInclude = false); this.isSection && (item.isInclude = false);
}); });
this.orderDateTime = isFullTime ? '暂无选择' : this.selectDate; this.orderDateTime = isFullTime ? this.$lang('date.noSelection') : this.selectDate;
this.timeActive = -1; this.timeActive = -1;
for (let i = 0, len = this.timeArr.length; i < len; i++) { for (let i = 0, len = this.timeArr.length; i < len; i++) {
if (!this.timeArr[i].disable) { if (!this.timeArr[i].disable) {
@@ -297,11 +299,11 @@
// 日期选择事件 // 日期选择事件
selectDateEvent(index, item) { selectDateEvent(index, item) {
if (this.disableWeek.length && item.date >= weekDate()[0] && item.date <= weekDate()[1]) { if (this.disableWeek.length && item.date >= weekDate()[0] && item.date <= weekDate()[1]) {
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let index = new Date(item.timeStamp).getDay(); let index = new Date(item.timeStamp).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) { if (this.disableWeek.indexOf(weekBox[index]) != -1) {
uni.showToast({ uni.showToast({
title: weekBox[index] + '不可以预约', title: weekBox[index] + this.$lang('date.cannotReserve'),
icon: 'none' icon: 'none'
}) })
return false; return false;

View File

@@ -118,8 +118,8 @@ export default {
} catch (e) {} } catch (e) {}
if (v && v.commitId) { if (v && v.commitId) {
uni.showModal({ uni.showModal({
title: '构建版本信息', title: this.$lang('common.buildVersion'),
content: `提交 ID: ${v.commitId}\n构建时间: ${v.buildTime}`, content: this.$lang('common.buildVersionDesc', { commitId: v.commitId, buildTime: v.buildTime }),
showCancel: false showCancel: false
}); });
} else { } else {

View File

@@ -282,7 +282,7 @@ export default {
//生成海报 //生成海报
getGoodsPoster() { getGoodsPoster() {
uni.showLoading({ uni.showLoading({
'title': '海报生成中...' 'title': this.$lang('goods.posterGenerating')
}) })
//活动海报信息 //活动海报信息
if (this.memberInfo && this.memberInfo.member_id) this.posterParams.source_member = this.memberInfo.member_id; if (this.memberInfo && this.memberInfo.member_id) this.posterParams.source_member = this.memberInfo.member_id;
@@ -348,12 +348,12 @@ export default {
filePath: res.tempFilePath, filePath: res.tempFilePath,
success: () => { success: () => {
this.$util.showToast({ this.$util.showToast({
title: "保存成功" title: this.$lang('common.saveSuccess')
}); });
}, },
fail: (err) => { fail: (err) => {
this.$util.showToast({ this.$util.showToast({
title: "保存失败,请稍后重试" title: this.$lang('common.saveFailed')
}); });
} }
}); });
@@ -361,7 +361,7 @@ export default {
}, },
fail: (err) => { fail: (err) => {
this.$util.showToast({ this.$util.showToast({
title: "保存失败,请稍后重试" title: this.$lang('common.saveFailed')
}); });
} }
}); });

View File

@@ -48,11 +48,11 @@ export default {
// 如果后台没配置,用默认值 // 如果后台没配置,用默认值
this.mpShareData = { this.mpShareData = {
appMessage: { appMessage: {
title: '发现超多好物,快来看看', title: this.$lang('goods.shareTitle'),
path: '/pages_goods/category' path: '/pages_goods/category'
}, },
timeLine: { timeLine: {
title: '发现超多好物,快来看看', title: this.$lang('goods.shareTitle'),
query: '/pages_goods/category' query: '/pages_goods/category'
} }
}; };
@@ -92,19 +92,19 @@ export default {
}, },
onShareAppMessage() { onShareAppMessage() {
return this.mpShareData?.appMessage || { return this.mpShareData?.appMessage || {
title: '发现超多好物,快来看看', title: this.$lang('goods.shareTitle'),
path: '/pages_goods/category' path: '/pages_goods/category'
}; };
}, },
onShareTimeline() { onShareTimeline() {
return this.mpShareData?.timeLine || { return this.mpShareData?.timeLine || {
title: '发现超多好物,快来看看', title: this.$lang('goods.shareTitle'),
query: '/pages_goods/category' query: '/pages_goods/category'
}; };
}, },
onAddToFavorites() { onAddToFavorites() {
return { return {
title: '发现超多好物,快来看看', title: this.$lang('goods.shareTitle'),
path: '/pages_goods/category' path: '/pages_goods/category'
}; };
} }

View File

@@ -128,10 +128,10 @@
<!-- <view class="group-wrap card-info" v-if="goodsSkuDetail.goods_class == 5 && goodsSkuDetail.card_info && goodsSkuDetail.card_info.relation_goods.length"> <!-- <view class="group-wrap card-info" v-if="goodsSkuDetail.goods_class == 5 && goodsSkuDetail.card_info && goodsSkuDetail.card_info.relation_goods.length">
<view class="card-title">- 套餐包含以下的服务及商品 -</view> <view class="card-title">- 套餐包含以下的服务及商品 -</view>
<view class="card-desc" v-if="goodsSkuDetail.card_info.card_type == 'timecard' || goodsSkuDetail.card_info.card_type == 'commoncard'"> <view class="card-desc" v-if="goodsSkuDetail.card_info.card_type == 'timecard' || goodsSkuDetail.card_info.card_type == 'commoncard'">
{{ goodsSkuDetail.card_info.card_type == 'commoncard' ? '卡项内项目/商品总的可用次数为' + goodsSkuDetail.card_info.common_num + ' ,' : '' }} {{ goodsSkuDetail.card_info.card_type == 'commoncard' ? $lang('goods.cardTotalCount', { count: goodsSkuDetail.card_info.common_num }) + ' ,' : '' }}
{{ goodsSkuDetail.card_info.card_type == 'timecard' ? '次数不限 ,' : '' }} 有效期为{{ {{ goodsSkuDetail.card_info.card_type == 'timecard' ? $lang('goods.unlimitedCount') + ' ,' : '' }} {{ $lang('goods.validPeriod') }}{{
(goodsSkuDetail.card_info.validity_type == 0 && '永久') || (goodsSkuDetail.card_info.validity_type == 0 && $lang('goods.permanent')) ||
(goodsSkuDetail.card_info.validity_type == 1 && goodsSkuDetail.card_info.validity_day + '天') || (goodsSkuDetail.card_info.validity_type == 1 && goodsSkuDetail.card_info.validity_day + $lang('common.days')) ||
(goodsSkuDetail.card_info.validity_type == 2 && $util.timeStampTurnTime(goodsSkuDetail.card_info.validity_time)) (goodsSkuDetail.card_info.validity_type == 2 && $util.timeStampTurnTime(goodsSkuDetail.card_info.validity_time))
}} }}
</view> </view>
@@ -149,7 +149,7 @@
</view> </view>
</view> </view>
<view class="card-off" @click="cardOff = !cardOff" v-if="goodsSkuDetail.card_info.relation_goods.length > 1"> <view class="card-off" @click="cardOff = !cardOff" v-if="goodsSkuDetail.card_info.relation_goods.length > 1">
<text>{{ cardOff ? '收起' : '展开' }}</text> <text>{{ cardOff ? $lang('common.collapse') : $lang('common.expand') }}</text>
<text class="icondiy" :class="[cardOff ? 'icon-system-jiantoushang' : 'icon-system-jiantouxia']"></text> <text class="icondiy" :class="[cardOff ? 'icon-system-jiantoushang' : 'icon-system-jiantouxia']"></text>
</view> </view>
</view> --> </view> -->
@@ -173,11 +173,11 @@
<view v-if="item.type == 'reward'"> <view v-if="item.type == 'reward'">
{{ {{
parseFloat(item.at_least) > 0 parseFloat(item.at_least) > 0
? '满' + decimalPointFormat(item.at_least) + '减' + decimalPointFormat(item.money) ? $lang('goods.fullReduce', { atLeast: decimalPointFormat(item.at_least), money: decimalPointFormat(item.money) })
: '无门槛使用' + decimalPointFormat(item.money) : $lang('goods.noThresholdUse', { money: decimalPointFormat(item.money) })
}} }}
</view> </view>
<view v-else-if="item.type == 'discount'">{{ '满' + decimalPointFormat(item.at_least) + '打' + parseFloat(item.discount)+'折' }}</view> <view v-else-if="item.type == 'discount'">{{ $lang('goods.fullDiscount', { atLeast: decimalPointFormat(item.at_least), discount: parseFloat(item.discount) }) }}</view>
</view> </view>
</view> </view>
<text class="iconfont icon-right"></text> <text class="iconfont icon-right"></text>
@@ -588,7 +588,7 @@ export default {
data: '021-51815181', data: '021-51815181',
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: '复制成功', title: this.$lang('common.copySuccess'),
icon: 'success' icon: 'success'
}); });
this.closeContactPopup(); this.closeContactPopup();

View File

@@ -233,14 +233,14 @@ export default {
} }
if (cart_id.length == 0) { if (cart_id.length == 0) {
this.$util.showToast({ this.$util.showToast({
title: '请选择要删除的商品' title: this.$lang('cart.selectGoodsToDelete')
}); });
return; return;
} }
uni.showModal({ uni.showModal({
title: '提示', title: this.$lang('common.tip'),
content: cart_id.length > 1 ? '确定要删除这些商品吗?' : '确定要删除该商品吗?', content: cart_id.length > 1 ? this.$lang('cart.confirmDeleteSelected') : this.$lang('cart.confirmDeleteOne'),
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
cart_id = cart_id.toString(); cart_id = cart_id.toString();
@@ -381,8 +381,8 @@ export default {
*/ */
clearInvalidGoods() { clearInvalidGoods() {
uni.showModal({ uni.showModal({
title: '提示', title: this.$lang('common.tip'),
content: '确定要清空这些商品吗?', content: this.$lang('cart.confirmClearInvalid'),
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
var cart_ids = []; var cart_ids = [];
@@ -432,11 +432,11 @@ export default {
if (event.type == 'plus') { if (event.type == 'plus') {
if (data.max_buy > 0 && data.max_buy < data.stock) { if (data.max_buy > 0 && data.max_buy < data.stock) {
this.$util.showToast({ this.$util.showToast({
title: '该商品每人限购' + data.max_buy + '件' title: this.$lang('cart.personLimit', { count: data.max_buy })
}); });
} else { } else {
this.$util.showToast({ this.$util.showToast({
title: '库存不足' title: this.$lang('sku.insufficientStock')
}); });
} }
} else { } else {

View File

@@ -318,9 +318,9 @@ export default {
let list = this.couponList; let list = this.couponList;
if (res.data.is_exist == 1 && res.code < 0) { if (res.data.is_exist == 1 && res.code < 0) {
msg = '您已领取过该优惠券,快去使用吧'; msg = this.$lang('goods.couponAlreadyClaimed');
} else if (res.code == 0) { } else if (res.code == 0) {
msg = '领取成功,快去使用吧'; msg = this.$lang('goods.couponClaimSuccess');
} else { } else {
msg = res.message; msg = res.message;
} }

View File

@@ -37,7 +37,7 @@ export default {
fontWeight: false, fontWeight: false,
padding: 0, padding: 0,
cartEvent: "detail", cartEvent: "detail",
text: "购买", text: this.$lang('goods.buy'),
textColor: "#FFFFFF", textColor: "#FFFFFF",
theme: "default", theme: "default",
aroundRadius: 25, aroundRadius: 25,
@@ -75,7 +75,7 @@ export default {
if(this.langstatus == 1){ if(this.langstatus == 1){
// this.$langConfig.refresh(); // this.$langConfig.refresh();
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title:uni.getStorageSync('lang') == 'en-us'?'Goods List':'商品列表' title: this.$lang('goods.goodsList')
}) })
} }
} }
@@ -123,7 +123,7 @@ export default {
* 转发分享 * 转发分享
*/ */
onShareAppMessage(res) { onShareAppMessage(res) {
var title = '搜索到' + this.count + '件“' + this.keyword + this.category_title + this.coupon_name + '”相关的优质商品'; var title = this.$lang('goods.searchResultCount', { count: this.count, keyword: this.keyword + this.category_title + this.coupon_name });'”相关的优质商品';
let route = this.$util.getCurrentShareRoute(this.memberInfo ? this.memberInfo.member_id : 0); let route = this.$util.getCurrentShareRoute(this.memberInfo ? this.memberInfo.member_id : 0);
var path = route.path; var path = route.path;
return { return {
@@ -137,7 +137,7 @@ export default {
}, },
// 分享到微信朋友圈 // 分享到微信朋友圈
onShareTimeline() { onShareTimeline() {
var title = '搜索到' + this.count + '件“' + this.keyword + this.category_title + this.coupon_name + '”相关的优质商品'; var title = this.$lang('goods.searchResultCount', { count: this.count, keyword: this.keyword + this.category_title + this.coupon_name });'”相关的优质商品';
let route = this.$util.getCurrentShareRoute(this.memberInfo ? this.memberInfo.member_id : 0); let route = this.$util.getCurrentShareRoute(this.memberInfo ? this.memberInfo.member_id : 0);
var query = route.query; var query = route.query;
return { return {
@@ -362,26 +362,26 @@ export default {
// } // }
if (!Number(this.maxPrice) && this.maxPrice) { if (!Number(this.maxPrice) && this.maxPrice) {
this.$util.showToast({ this.$util.showToast({
title: '请输入最高价' title: this.$lang('goods.inputMaxPrice')
}); });
return; return;
} }
if (Number(this.minPrice) < 0 || Number(this.maxPrice) < 0) { if (Number(this.minPrice) < 0 || Number(this.maxPrice) < 0) {
this.$util.showToast({ this.$util.showToast({
title: '筛选价格不能小于0' title: this.$lang('goods.priceNotNegative')
}); });
return; return;
} }
if (this.minPrice != '' && Number(this.minPrice) > Number(this.maxPrice) && this.maxPrice) { if (this.minPrice != '' && Number(this.minPrice) > Number(this.maxPrice) && this.maxPrice) {
this.$util.showToast({ this.$util.showToast({
title: '最低价不能大于最高价' title: this.$lang('goods.minNotGreaterMax')
}); });
return; return;
} }
if (this.maxPrice != '' && Number(this.maxPrice) < Number(this.minPrice)) { if (this.maxPrice != '' && Number(this.maxPrice) < Number(this.minPrice)) {
this.$util.showToast({ this.$util.showToast({
title: '最高价不能小于最低价' title: this.$lang('goods.maxNotLessMin')
}); });
return; return;
} }