Files
lucky_shop/pages_order/payment.vue
ZF sun d6633b698a refactor(order): 替换页面硬编码文本为国际化语言包
将订单相关页面的静态文字全部替换为$lang国际化调用,统一多语言管理,提升项目可维护性和国际化适配能力,涉及订单列表、订单支付、通用订单组件三个页面文件。
2026-06-22 15:07:04 +08:00

110 lines
3.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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('order.fullReduce'), content: ''}
data.promotion.manjian.forEach((mItem,mIndex)=>{
let promotion = '';
let content = {};
let limit = mItem.type == 0 ? this.$lang('common.yuan') : this.$lang('sku.unit');
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('order.fullReduceDesc', { limit: item.limit, type: limit, money: item.discount_money });
} else {
content.manjian += this.$lang('order.fullReduceDesc', { limit: item.limit, type: 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('order.fullSendCoupon', { num: couponItem.give_num, value: parseFloat(couponItem.discount) });
else text += '、' + this.$lang('order.fullSendCoupon', { num: couponItem.give_num, value: parseFloat(couponItem.discount) });
} else {
if (text == '') text = this.$lang('order.fullSendCoupon', { num: couponItem.give_num, value: parseFloat(couponItem.money) });
else text += '、' + this.$lang('order.fullSendCoupon', { num: couponItem.give_num, value: parseFloat(couponItem.money) });
}
})
if (content.mansong == undefined) {
content.mansong = this.$lang('order.fullSend', { limit: item.limit, type: limit }) + text;
} else {
content.mansong += ';' + this.$lang('order.fullSend', { limit: item.limit, type: limit }) + text;
}
}
// 满送积分
if (item.point) {
let point_text = this.$lang('order.fullSendPoint', { point: item.point });
if(content.point_text == undefined) {
content.point_text = this.$lang('order.fullSend', { limit: item.limit, type: limit }) + point_text
}else {
content.point_text += ';' + this.$lang('order.fullSend', { limit: item.limit, type: limit }) + point_text;
}
}
// 包邮
if (item.free_shipping != undefined) {
if (content.free_shipping == undefined) {
content.free_shipping = this.$lang('order.freeShipping', { limit: item.limit, type: 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>