feat: 新增多语言文案与组件国际化适配

本次提交完成了大量多语言相关的新增与优化工作:
1. 新增充值、案例、会员资产、订单等页面的中文/英文翻译文案
2. 新增企业微信客服、时间选择、支付弹窗等组件的多语言包
3. 优化工具函数与自定义页面的多语言适配,替换硬编码提示文案
4. 新增会员等级规则、积分商品、退款管理等页面的国际化支持
5. 修复企业微信JS-SDK的错误提示文案硬编码问题
This commit is contained in:
2026-06-26 09:09:46 +08:00
parent 2d8846c64c
commit 066ca61d97
97 changed files with 2704 additions and 716 deletions

View File

@@ -34,7 +34,7 @@
</view>
<view class="box">
<text v-if="item.val != ''">{{ item.val }}</text>
<text v-else class="color-tip">请选择</text>
<text v-else class="color-tip">{{ $lang('components.nsForm.selectPlaceholder') }}</text>
</view>
<text class="iconfont icon-right"></text>
</view>
@@ -188,7 +188,7 @@
<view class="box">
<pick-regions :default-regions="item.default_regions" :select-arr="item.select_arr" @getRegions="handleGetRegions($event, index)">
<view class="select-address " :class="{ empty: !item.val, 'color-tip': !item.val }">
{{ item.val ? item.val : item.select_arr == '2' ? '请选择省市' : '请选择省市区/县' }}
{{ item.val ? item.val : (item.select_arr == '2' ? $lang('components.nsForm.selectProvinceCity') : $lang('components.nsForm.selectProvinceCityDistrict')) }}
</view>
</pick-regions>
</view>
@@ -365,7 +365,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请输入' + item.value.title
title: this.$lang('components.nsForm.pleaseInput', { title: item.value.title })
});
break;
}
@@ -375,13 +375,13 @@
verify = !item.value.required;
if (verify == false) {
this.$util.showToast({
title: '身份证输入不合法'
title: this.$lang('components.nsForm.idCardInvalid')
});
return false;
}
if (verify == true && item.val != '') {
this.$util.showToast({
title: '身份证输入不合法'
title: this.$lang('components.nsForm.idCardInvalid')
});
return false;
}
@@ -392,13 +392,13 @@
verify = !item.value.required;
if (verify == false) {
this.$util.showToast({
title: '手机号输入不合法'
title: this.$lang('components.nsForm.mobileInvalid')
});
return false;
}
if (verify == true && item.val != '') {
this.$util.showToast({
title: '手机号输入不合法'
title: this.$lang('components.nsForm.mobileInvalid')
});
return false;
}
@@ -409,7 +409,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请输入' + item.value.title
title: this.$lang('components.nsForm.pleaseInput', { title: item.value.title })
});
break;
}
@@ -419,7 +419,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请选择' + item.value.title
title: this.$lang('components.nsForm.pleaseSelect', { title: item.value.title })
});
break;
}
@@ -429,7 +429,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请至少选择一个' + item.value.title
title: this.$lang('components.nsForm.pleaseSelectAtLeastOne', { title: item.value.title })
});
break;
}
@@ -439,7 +439,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请至少上传一张' + item.value.title
title: this.$lang('components.nsForm.pleaseUploadAtLeastOne', { title: item.value.title })
});
break;
}
@@ -449,7 +449,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请选择' + item.value.title
title: this.$lang('components.nsForm.pleaseSelect', { title: item.value.title })
});
break;
}
@@ -459,7 +459,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请选择' + item.value.title
title: this.$lang('components.nsForm.pleaseSelect', { title: item.value.title })
});
break;
}
@@ -467,7 +467,7 @@
if (this.$util.timeTurnTimeStamp(item.start_date) > this.$util.timeTurnTimeStamp(item.end_date)) {
verify = false;
this.$util.showToast({
title: '结束日期不能小于开始日期'
title: this.$lang('components.nsForm.endDateBeforeStartDate')
});
break;
}
@@ -477,7 +477,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请选择' + item.value.title
title: this.$lang('components.nsForm.pleaseSelect', { title: item.value.title })
});
break;
}
@@ -487,7 +487,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请选择' + item.value.title
title: this.$lang('components.nsForm.pleaseSelect', { title: item.value.title })
});
break;
}
@@ -495,7 +495,7 @@
if (item.start_time >= item.end_time) {
verify = false;
this.$util.showToast({
title: '结束时间必须大于开始时间'
title: this.$lang('components.nsForm.endTimeBeforeStartTime')
});
break;
}
@@ -505,7 +505,7 @@
if (item.value.required && !item.val) {
verify = false;
this.$util.showToast({
title: '请选择' + item.value.title
title: this.$lang('components.nsForm.pleaseSelect', { title: item.value.title })
});
break;
}
@@ -542,7 +542,7 @@
res.forEach(v => {
if (this.formData[index].img_lists.length >= Number(this.formData[index].value.max_count)) {
this.$util.showToast({
title: '最多上传' + this.formData[index].value.max_count + '张图片'
title: this.$lang('components.nsForm.maxUploadImages', { max: this.formData[index].value.max_count })
});
return false;
} else {
@@ -560,7 +560,7 @@
addImg(index) {
if (this.formData[index].img_lists.length >= Number(this.formData[index].value.max_count)) {
this.$util.showToast({
title: '最多上传' + this.formData[index].value.max_count + '张图片'
title: this.$lang('components.nsForm.maxUploadImages', { max: this.formData[index].value.max_count })
});
return false;
}

View File

@@ -4,19 +4,19 @@
<uni-popup ref="choosePaymentPopup" type="center" :mask-click="false">
<view class="choose-payment-popup popup" @touchmove.prevent.stop>
<view class="popup-header">
<text class="tit">支付方式</text>
<text class="tit">{{ $lang('components.nsPayment.paymentMethod') }}</text>
<text class="iconfont icon-close" @click="close()"></text>
</view>
<scroll-view scroll-y="true" class="popup-body" :class="{ 'safe-area': isIphoneX }">
<view class="pay-money">
<!-- <text class="unit">{{ $lang('common.currencySymbol') }}</text> -->
<text class="money">支付金额{{ payMoney | moneyFormat }}元</text>
<text class="money">{{ $lang('components.nsPayment.payAmount', { amount: payMoney | moneyFormat }) }}</text>
</view>
<view class="payment-item" v-if="balanceDeduct > 0 && balanceConfig == 1 && sale">
<view class="iconfont icon-yue"></view>
<view class="info-wrap">
<text class="name">余额抵扣</text>
<view class="money">可用¥{{ balanceDeduct }}</view>
<text class="name">{{ $lang('components.nsPayment.balanceDeduction') }}</text>
<view class="money">{{ $lang('components.nsPayment.availableBalance', { amount: balanceDeduct }) }}</view>
</view>
<ns-switch class="balance-switch" @change="useBalance" :checked="isBalance == 1"></ns-switch>
</view>
@@ -31,12 +31,12 @@
</view>
</block>
<block v-else>
<view class="empty">平台尚未配置支付方式!</view>
<view class="empty">{{ $lang('components.nsPayment.noPaymentMethod') }}</view>
</block>
</block>
</scroll-view>
<view class="popup-footer" :class="{ 'bottom-safe-area': isIphoneX }">
<view class="confirm-btn color-base-bg" @click="confirm()">确认支付</view>
<view class="confirm-btn color-base-bg" @click="confirm()">{{ $lang('components.nsPayment.confirmPay') }}</view>
</view>
</view>
</uni-popup>
@@ -72,12 +72,12 @@ export default {
payIndex: 0,
// #ifdef H5
payTypeList: [{
name: '支付宝支付',
name: this.$lang('components.nsPayment.alipay'),
icon: 'icon-zhifubaozhifu-',
type: 'alipay'
},
{
name: '微信支付',
name: this.$lang('components.nsPayment.wechatpay'),
icon: 'icon-weixin1',
type: 'wechatpay'
}
@@ -86,7 +86,7 @@ export default {
// #endif
// #ifdef MP-WEIXIN
payTypeList: [{
name: '微信支付',
name: this.$lang('components.nsPayment.wechatpay'),
provider: 'wxpay',
icon: 'icon-weixin1',
type: 'wechatpay'
@@ -95,7 +95,7 @@ export default {
// #endif
// #ifdef MP-ALIPAY
payTypeList: [{
name: '支付宝支付',
name: this.$lang('components.nsPayment.alipay'),
icon: 'icon-zhifubaozhifu-',
type: 'alipay',
provider: 'alipay'
@@ -108,11 +108,12 @@ export default {
};
},
created(e) {
let url;
// #ifdef H5
let url = window.location.href
url = window.location.href
// #endif
// #ifndef H5
let url = getCurrentPages()[getCurrentPages().length - 1].route
url = getCurrentPages()[getCurrentPages().length - 1].route
// #endif
let list = url.match('presale/order_list/order_list')
let detail = url.match('presale/order_detail/order_detail')
@@ -158,12 +159,12 @@ export default {
confirm() {
if (this.payTypeList.length == 0 && this.payMoney > 0) {
this.$util.showToast({
title: '请选择支付方式!'
title: this.$lang('components.nsPayment.pleaseSelectPaymentMethod')
});
return;
}
uni.showLoading({
title: '支付中...',
title: this.$lang('components.nsPayment.paying'),
mask: true
});
this.$refs.choosePaymentPopup.close();
@@ -182,7 +183,7 @@ export default {
this.pay();
} else {
this.$util.showToast({
title: '未获取到支付信息!'
title: this.$lang('components.nsPayment.payInfoNotFound')
});
setTimeout(() => {
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
@@ -295,7 +296,7 @@ export default {
},
res => {
this.$util.showToast({
title: '您已取消支付'
title: this.$lang('components.nsPayment.paymentCancelled')
});
setTimeout(() => {
this.$util.redirectTo('/pages_tool/pay/result', {
@@ -392,10 +393,10 @@ export default {
fail: res => {
this.flag = false;
if (res.errMsg == 'requestOrderPayment:fail cancel') {
this.$util.showToast({ title: '您已取消支付' });
this.$util.showToast({ title: this.$lang('components.nsPayment.paymentCancelled') });
} else {
uni.showModal({
content: '支付失败,失败原因: ' + res.errMsg,
content: this.$lang('components.nsPayment.paymentFailed', { reason: res.errMsg }),
showCancel: false
});
}
@@ -428,10 +429,10 @@ export default {
fail: res => {
this.flag = false;
if (res.errMsg == 'requestPayment:fail cancel') {
this.$util.showToast({ title: '您已取消支付' });
this.$util.showToast({ title: this.$lang('components.nsPayment.paymentCancelled') });
} else {
uni.showModal({
content: '支付失败,失败原因: ' + res.errMsg,
content: this.$lang('components.nsPayment.paymentFailed', { reason: res.errMsg }),
showCancel: false
});
}

View File

@@ -3,8 +3,8 @@
<uni-popup type="bottom" ref="selectTime">
<view class="box">
<view class="title">
<block v-if="obj.delivery && obj.delivery.delivery_type == 'local'">选择送达时间</block>
<block v-if="obj.delivery && obj.delivery.delivery_type == 'store'">选择自提时间</block>
<block v-if="obj.delivery && obj.delivery.delivery_type == 'local'">{{ $lang('components.nsSelectTime.selectDeliveryTime') }}</block>
<block v-if="obj.delivery && obj.delivery.delivery_type == 'store'">{{ $lang('components.nsSelectTime.selectPickupTime') }}</block>
<text class="iconfont icon-close" @click="close"></text>
</view>
<view class="body">
@@ -86,7 +86,7 @@ export default {
this.key = this.keyJudge;
let obj = this.dayData[this.key];
obj.time = this.timeData[this.keys];
let time = obj.time.replace('立即配送(','').replace(')','');
let time = obj.time.replace(this.$lang('components.nsSelectTime.immediateDeliveryPrefix'),'').replace(this.$lang('components.nsSelectTime.immediateDeliverySuffix'),'');
var dateTime = new Date();
var format = time.split('-');
@@ -145,7 +145,15 @@ export default {
let num = 1; //记录循环执行过的次数
let mostDay = this.obj.dataTime.most_day ? this.obj.dataTime.most_day + 1 : 1; // 最多可预约天数
let startTime = parseInt(today.getTime() / 1000);
let week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let week = [
this.$lang('components.nsSelectTime.sunday'),
this.$lang('components.nsSelectTime.monday'),
this.$lang('components.nsSelectTime.tuesday'),
this.$lang('components.nsSelectTime.wednesday'),
this.$lang('components.nsSelectTime.thursday'),
this.$lang('components.nsSelectTime.friday'),
this.$lang('components.nsSelectTime.saturday'),
];
if (obj.time_week && obj.time_week.length == 7) {
//判断是否七天全有
judge = true;
@@ -170,7 +178,7 @@ export default {
i = i - 1;
} else {
objects = {
title: this.obj.dataTime.advance_day == 0 ? '今天' : '',
title: this.obj.dataTime.advance_day == 0 ? this.$lang('components.nsSelectTime.today') : '',
type: 'special',
month: nowMonth + '月' + nowDate + '日',
Day: '(' + dayStr + ')'
@@ -182,7 +190,7 @@ export default {
case 2:
if (i == 0 || i == 1) {
objects = {
title: this.obj.dataTime.advance_day == 0 ? '明天' : '',
title: this.obj.dataTime.advance_day == 0 ? this.$lang('components.nsSelectTime.tomorrow') : '',
month: nowMonth + '月' + nowDate + '日',
Day: '(' + dayStr + ')'
};
@@ -267,7 +275,7 @@ export default {
if (time <= item.end_time) {
let text = '';
if (this.obj.delivery.delivery_type == 'local' && i == 0) {
text = '立即配送('+ this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval) + ')';
text = this.$lang('components.nsSelectTime.immediateDeliveryPrefix') + this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval) + this.$lang('components.nsSelectTime.immediateDeliverySuffix');
} else {
text = this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval);
}

View File

@@ -4,19 +4,19 @@
<uni-popup ref="choosePaymentPopup" type="center" v-if="payInfo" :mask-click="false">
<view class="choose-payment-popup popup" @touchmove.prevent.stop>
<view class="popup-header">
<text class="tit">支付方式</text>
<text class="tit">{{ $lang('components.payment.title') }}</text>
<text class="iconfont icon-close" @click="close()"></text>
</view>
<scroll-view scroll-y="true" class="popup-body">
<view class="pay-money">
<text class="money">支付金额{{ payMoney|moneyFormat }}元</text>
<text class="money">{{ $lang('components.payment.payAmount', { money: parseFloat(payMoney).toFixed(2) }) }}</text>
</view>
<view class="payment-item" v-if="balanceDeduct > 0 && balanceUsable && balanceConfig == 1">
<view class="iconfont icon-yue"></view>
<view class="info-wrap">
<text class="name">余额支付</text>
<view class="money">可用¥{{ balanceDeduct|moneyFormat }}</view>
<text class="name">{{ $lang('components.payment.balancePay') }}</text>
<view class="money">{{ $lang('components.payment.availableBalance', { symbol: $lang('common.currencySymbol'), balance: parseFloat(balanceDeduct).toFixed(2) }) }}</view>
</view>
<ns-switch class="balance-switch" @change="useBalance" :checked="isBalance == 1"></ns-switch>
</view>
@@ -24,17 +24,17 @@
<block v-if="payTypeList.length">
<view class="payment-item" v-for="(item, index) in payTypeList" :key="index" @click="payIndex = index">
<view class="iconfont" :class="item.icon"></view>
<text class="name">{{ item.name }}</text>
<text class="name">{{ $lang('components.payment.' + item.type) }}</text>
<text class="iconfont" :class="payIndex == index ? 'icon-yuan_checked color-base-text' : 'icon-checkboxblank'"></text>
</view>
</block>
<block v-else>
<view class="empty">平台尚未配置支付方式!</view>
<view class="empty">{{ $lang('components.payment.noPaymentMethod') }}</view>
</block>
</block>
</scroll-view>
<view class="popup-footer">
<view class="confirm-btn color-base-bg" @click="confirm()">确认支付</view>
<view class="confirm-btn color-base-bg" @click="confirm()">{{ $lang('components.payment.confirmPay') }}</view>
</view>
</view>
</uni-popup>
@@ -135,12 +135,12 @@
confirm() {
if (this.payTypeList.length == 0 && this.payMoney > 0) {
this.$util.showToast({
title: '请选择支付方式!'
title: this.$lang('components.payment.pleaseSelectPayMethod')
});
return;
}
uni.showLoading({
title: '支付中...',
title: this.$lang('components.payment.paying'),
mask: true
});
this.pay();
@@ -161,7 +161,7 @@
})
} else {
this.$util.showToast({
title: '未获取到支付信息!'
title: this.$lang('components.payment.payInfoNotFound')
});
}
}
@@ -294,7 +294,7 @@
},
res => {
this.$util.showToast({
title: '您已取消支付'
title: this.$lang('components.payment.payCancelled')
});
this.resetpay();
}
@@ -378,12 +378,12 @@
this.flag = false;
if (res.errMsg == 'requestOrderPayment:fail cancel') {
this.$util.showToast({
title: '您已取消支付'
title: this.$lang('components.payment.payCancelled')
});
this.resetpay();
} else {
uni.showModal({
content: '支付失败,失败原因: ' + res.errMsg,
content: this.$lang('components.payment.payFailed', { reason: res.errMsg }),
showCancel: false
});
setTimeout(() => {
@@ -406,12 +406,12 @@
this.flag = false;
if (res.errMsg == 'requestPayment:fail cancel') {
this.$util.showToast({
title: '您已取消支付'
title: this.$lang('components.payment.payCancelled')
});
this.resetpay();
} else {
uni.showModal({
content: '支付失败,失败原因: ' + res.errMsg,
content: this.$lang('components.payment.payFailed', { reason: res.errMsg }),
showCancel: false
});
setTimeout(() => {

View File

@@ -2,24 +2,24 @@
<view>
<view class="privacy-mask" v-if="showPop">
<view class="privacy-wrap">
<view class="privacy-title">用户隐私保护提示</view>
<view class="privacy-desc">
感谢您使用{{ appName }},在使用前您应当阅读并同意
<text class="privacy-link" @tap="openPrivacyContract">{{ privacyContractName }}</text>
<!-- #ifdef QUICKAPP-WEBVIEW || H5 -->
<text class="privacy-link" @tap="openPrivacyService">{{ privacyServiceName }}</text>
<!-- #endif -->
,当点击同意并继续时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力;如您不同意,将无法继续使用{{ appName }}相关功能。
</view>
<view class="privacy-button-flex">
<button class="privacy-button-btn bg-disagree" @tap="handleDisagree">不同意</button>
<!-- #ifdef QUICKAPP-WEBVIEW || MP-WEIXIN -->
<button id="agree-btn" class="privacy-button-btn bg-agree" open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgree">同意并继续</button>
<!-- #endif -->
<!-- #ifdef WEB || H5 -->
<button id="agree-btn" class="privacy-button-btn bg-agree" @tap="handleAgree" @click="handleAgree">同意并继续</button>
<!-- #endif -->
<view class="privacy-title">{{ $lang('components.privacyPopup.title') }}</view>
<view class="privacy-desc">
{{ $lang('components.privacyPopup.descPrefix', { appName: appName }) }}
<text class="privacy-link" @tap="openPrivacyContract">{{ privacyContractName }}</text>
<!-- #ifdef QUICKAPP-WEBVIEW || H5 -->
<text class="privacy-link" @tap="openPrivacyService">{{ privacyServiceName }}</text>
<!-- #endif -->
{{ $lang('components.privacyPopup.descSuffix', { appName: appName }) }}
</view>
<view class="privacy-button-flex">
<button class="privacy-button-btn bg-disagree" @tap="handleDisagree">{{ $lang('components.privacyPopup.disagreeBtn') }}</button>
<!-- #ifdef QUICKAPP-WEBVIEW || MP-WEIXIN -->
<button id="agree-btn" class="privacy-button-btn bg-agree" open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgree">{{ $lang('components.privacyPopup.agreeBtn') }}</button>
<!-- #endif -->
<!-- #ifdef WEB || H5 -->
<button id="agree-btn" class="privacy-button-btn bg-agree" @tap="handleAgree" @click="handleAgree">{{ $lang('components.privacyPopup.agreeBtn') }}</button>
<!-- #endif -->
</view>
</view>
</view>
@@ -43,12 +43,12 @@ export default {
showPop: false,
privacyAuthorization: null,
privacyResolves: new Set(),
privacyContractName: '用户隐私保护指引',
appName: '本小程序',
privacyContractName: this.$lang('components.privacyPopup.defaultContractNameMp'),
appName: this.$lang('components.privacyPopup.defaultAppNameMp'),
// #ifdef WEB || H5
appName: '本应用',
privacyContractName: '《隐私条款》',
privacyServiceName: '《用户服务协议》',
appName: this.$lang('components.privacyPopup.defaultAppNameH5'),
privacyContractName: this.$lang('components.privacyPopup.defaultContractNameH5'),
privacyServiceName: this.$lang('components.privacyPopup.defaultServiceNameH5'),
// #endif
}
},
@@ -250,7 +250,7 @@ export default {
uni.setStorageSync('privacyAgreed', true);
uni.showModal({
content: '未同意隐私协议,无法使用相关功能',
content: this.$lang('components.privacyPopup.disagreeTip'),
success: () => {
this.$emit('disagree')
}

View File

@@ -11,59 +11,61 @@
<scroll-view scroll-y="true" class="register-box">
<view class="reward-content">
<view class="reward-item" v-if="reward.point > 0">
<view class="head">积分奖励</view>
<view class="head">{{ $lang('components.registerReward.pointReward') }}</view>
<view class="content">
<view class="info">
<view>
<text class="num">{{ reward.point }}</text>
<text class="type">积分</text>
<text class="type">{{ $lang('components.registerReward.points') }}</text>
</view>
<view class="desc">用于下单时抵现或兑换商品等</view>
<view class="desc">{{ $lang('components.registerReward.pointDesc') }}</view>
</view>
<view class="tip" @click="closeRewardPopup('point')">立即查看</view>
<view class="tip" @click="closeRewardPopup('point')">{{ $lang('components.registerReward.viewNow') }}</view>
</view>
</view>
<view class="reward-item" v-if="reward.growth > 0">
<view class="head">成长值</view>
<view class="head">{{ $lang('components.registerReward.growthValue') }}</view>
<view class="content">
<view class="info">
<view>
<text class="num">{{ reward.growth }}</text>
<text class="type">成长值</text>
<text class="type">{{ $lang('components.registerReward.growthValue') }}</text>
</view>
<view class="desc">用于提升会员等级</view>
<view class="desc">{{ $lang('components.registerReward.growthDesc') }}</view>
</view>
<view class="tip" @click="closeRewardPopup('growth')">立即查看</view>
<view class="tip" @click="closeRewardPopup('growth')">{{ $lang('components.registerReward.viewNow') }}</view>
</view>
</view>
<view class="reward-item" v-if="reward.balance > 0">
<view class="head">红包奖励</view>
<view class="head">{{ $lang('components.registerReward.balanceReward') }}</view>
<view class="content">
<view class="info">
<view>
<text class="num">{{ reward.balance }}</text>
<text class="type">元</text>
<text class="type">{{ $lang('components.registerReward.yuan') }}</text>
</view>
<view class="desc">不可提现下单时可用</view>
<view class="desc">{{ $lang('components.registerReward.balanceDesc') }}</view>
</view>
<view class="tip" @click="closeRewardPopup('balance')">立即查看</view>
<view class="tip" @click="closeRewardPopup('balance')">{{ $lang('components.registerReward.viewNow') }}</view>
</view>
</view>
<view class="reward-item" v-if="reward.coupon_list.length > 0">
<view class="head">优惠券奖励</view>
<view class="head">{{ $lang('components.registerReward.couponReward') }}</view>
<view class="content" v-for="(item, index) in reward.coupon_list" :key="index">
<view class="info">
<view>
<text class="num coupon-name">{{ item.coupon_name }}</text>
</view>
<view class="desc" v-if="item.at_least > 0">
满{{ item.at_least }}{{ item.type == 'discount' ? '打' + item.discount + '折' : '减' + item.money }}
<template v-if="item.type == 'discount'">{{ $lang('components.registerReward.couponMinSpendDiscount', { atLeast: item.at_least, discount: item.discount }) }}</template>
<template v-else>{{ $lang('components.registerReward.couponMinSpendReduce', { atLeast: item.at_least, money: item.money }) }}</template>
</view>
<view class="desc" v-else>
无门槛,{{ item.type == 'discount' ? '打' + item.discount + '折' : '减' + item.money }}
<template v-if="item.type == 'discount'">{{ $lang('components.registerReward.couponNoThresholdDiscount', { discount: item.discount }) }}</template>
<template v-else>{{ $lang('components.registerReward.couponNoThresholdReduce', { money: item.money }) }}</template>
</view>
</view>
<view class="tip" @click="closeRewardPopup('coupon')">立即查看</view>
<view class="tip" @click="closeRewardPopup('coupon')">{{ $lang('components.registerReward.viewNow') }}</view>
</view>
</view>
</view>

View File

@@ -6,21 +6,21 @@
hover-class="none"
class="contact-button"
@click="addWxWorkContact">
<text class="btn-text">{{ btnText }}</text>
<text class="btn-text">{{ displayBtnText }}</text>
</button>
<!-- 确认弹窗 -->
<uni-popup ref="confirmPopup" type="center">
<view class="confirm-popup">
<view class="popup-header">
<text>添加企业微信客服</text>
<text>{{ $lang('components.wxworkContact.popupTitle') }}</text>
</view>
<view class="popup-body">
<text>点击确定后将跳转至企业微信,添加专业客服为您服务</text>
<text>{{ $lang('components.wxworkContact.popupContent') }}</text>
</view>
<view class="popup-footer">
<button class="cancel-btn" @click="closePopup">取消</button>
<button class="confirm-btn" @click="confirmAdd">确定</button>
<button class="cancel-btn" @click="closePopup">{{ $lang('components.wxworkContact.cancelBtn') }}</button>
<button class="confirm-btn" @click="confirmAdd">{{ $lang('components.wxworkContact.confirmBtn') }}</button>
</view>
</view>
</uni-popup>
@@ -36,7 +36,7 @@
// 按钮文字
btnText: {
type: String,
default: '添加企业微信客服'
default: ''
},
// 企业ID(必需)
corpId: {
@@ -84,6 +84,11 @@
wxWorkSDK: null
};
},
computed: {
displayBtnText() {
return this.btnText || this.$lang('components.wxworkContact.defaultBtnText');
}
},
mounted() {
this.initWxWork();
},
@@ -142,7 +147,7 @@
// 方案2:使用SDK打开用户资料
this.openUserProfile(contactId);
} else {
this.showError('未配置企业微信客服信息');
this.showError(this.$lang('components.wxworkContact.notConfigured'));
}
// #endif
@@ -151,7 +156,7 @@
// H5环境直接跳转
window.location.href = contactUrl;
} else {
this.showError('未配置企业微信客服信息');
this.showError(this.$lang('components.wxworkContact.notConfigured'));
}
// #endif
},
@@ -165,13 +170,13 @@
path: `pages/contacts/externalContactDetail?url=${encodeURIComponent(contactUrl)}`,
success: () => {
this.$util.showToast({
title: '跳转成功',
title: this.$lang('components.wxworkContact.jumpSuccess'),
icon: 'success'
});
},
fail: (err) => {
console.error('跳转企业微信失败:', err);
this.showError('跳转失败,请检查企业微信配置');
this.showError(this.$lang('components.wxworkContact.jumpFailed'));
}
});
},
@@ -179,10 +184,10 @@
/**
* 打开用户资料
*/
openUserProfile(contactId) {
if (!this.wxWorkSDK) {
this.showError('企业微信SDK未初始化');
return;
openUserProfile(contactId) {
if (!this.wxWorkSDK) {
this.showError(this.$lang('components.wxworkContact.sdkNotInitialized'));
return;
}
this.wxWorkSDK.addContact({
@@ -190,7 +195,7 @@
}, (res) => {
}, (err) => {
console.error('打开用户资料失败:', err);
this.showError('打开用户资料失败');
this.showError(this.$lang('components.wxworkContact.openProfileFailed'));
});
},
@@ -199,7 +204,7 @@
*/
showError(message) {
uni.showModal({
title: '提示',
title: this.$lang('components.wxworkContact.tipTitle'),
content: message,
showCancel: false
});