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

110 lines
3.8 KiB
Vue

<template>
<view :style="themeColor">
<common-payment :api="api" create-data-key="orderCreateData" ref="payment"></common-payment>
</view>
</template>
<script>
import commonPayment from './_components/common-payment/common-payment.vue';
export default {
components: {
commonPayment
},
data() {
return {
api: {
payment: '/api/ordercreate/payment',
calculate: '/api/ordercreate/calculate',
create: '/api/ordercreate/create',
}
}
},
provide() {
return {
promotion: this.promotion.bind(this)
}
},
onShow() {
if (this.$refs.payment) this.$refs.payment.pageShow();
},
methods: {
/**
* 处理活动信息 如不需要则定义为空方法
*/
promotion(data){
if (data.promotion && data.promotion.manjian && data.promotion.manjian.length) {
let promotionStr = {title: this.$lang('promotion.title'), content: ''}
data.promotion.manjian.forEach((mItem,mIndex)=>{
let promotion = '';
let content = {};
let limit = mItem.type == 0 ? this.$lang('promotion.yuan') : this.$lang('promotion.piece');
if(mItem.rule){
var item = mItem.discount_array.rule;
item.limit = mItem.type == 0 ? parseFloat(item.limit).toFixed(2) : parseInt(item.limit);
// 满减
if (item.discount_money != undefined) {
if (content.manjian == undefined) {
content.manjian = this.$lang('promotion.manjianFirst', { limit: item.limit, unit: limit, money: item.discount_money });
} else {
content.manjian += this.$lang('promotion.manjianMore', { limit: item.limit, unit: limit, money: item.discount_money });
}
}
// 满送优惠券
if (item.coupon && item.coupon_list) {
let text = '';
item.coupon_list.forEach((couponItem, couponIndex) => {
if (couponItem.type == 'discount') {
if (text == '') text = this.$lang('promotion.couponDiscountFirst', { num: couponItem.give_num, discount: parseFloat(couponItem.discount) });
else text += this.$lang('promotion.couponDiscountMore', { num: couponItem.give_num, discount: parseFloat(couponItem.discount) });
} else {
if (text == '') text = this.$lang('promotion.couponMoneyFirst', { num: couponItem.give_num, money: parseFloat(couponItem.money) });
else text += this.$lang('promotion.couponMoneyMore', { num: couponItem.give_num, money: parseFloat(couponItem.money) });
}
})
if (content.mansong == undefined) {
content.mansong = this.$lang('promotion.mansongFirst', { limit: item.limit, unit: limit, text: text });
} else {
content.mansong += this.$lang('promotion.mansongMore', { limit: item.limit, unit: limit, text: text });
}
}
// 满送积分
if (item.point) {
let point_text = this.$lang('promotion.pointGain', { point: item.point });
if(content.point_text == undefined) {
content.point_text = this.$lang('promotion.pointFirst', { limit: item.limit, unit: limit, pointText: point_text });
}else {
content.point_text += this.$lang('promotion.pointMore', { limit: item.limit, unit: limit, pointText: point_text });
}
}
// 包邮
if (item.free_shipping != undefined) {
if (content.free_shipping == undefined) {
content.free_shipping = this.$lang('promotion.freeShipping', { limit: item.limit, unit: limit });
}
}
}
promotion = Object.values(content).join('\n');
promotionStr.content = promotionStr.content + promotion + '\n';
})
return (promotionStr.content ? promotionStr : null);
}
}
}
};
</script>
<style scoped lang="scss">
::v-deep .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none;
max-height: unset !important;
overflow-y: hidden !important;
}
::v-deep .uni-popup__wrapper {
border-radius: 20rpx 20rpx 0 0;
}
::v-deep .uni-popup {
z-index: 8;
}
</style>