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

640 lines
15 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 class="page" :style="themeColor">
<view>
<!-- <view class="recharge-title">充值</view>
<view class="account-box">
<view class="label">账户余额</view>
<view class="value"><text class="price-font">{{balanceInfo.balance}}</text><text>元</text></view>
</view> -->
<view class="recharge-box">
<view class="recharge-box-title">{{ $lang('rechargeAmount') }}
<view @click="toOrderList"><text class="color-base-text" style="color:#1db03b !important">{{ $lang('rechargeRecords') }}</text></view>
</view>
<view class="box-content">
<view class="money">
<text class="label">¥</text>
<view class="input-box">
<input class="reg-input" v-model="payMoney" :placeholder="$lang('placeholderEnterAmount')" placeholder-style="font-size:32rpx;color:#969696;font-weight:500"></input>
</view>
</view>
<view v-if="list.length" class="content-item" v-for="(item, index) in list" :key="index" @click="itemClick(index, item.recharge_id, item.buy_price)" :class="isIndex == index ? 'active' : ''">
<view class="price1 ">
<text class="price-font">{{ parseFloat(item.face_value).toFixed(0) }}</text>
<text>{{ $lang('yuan') }}</text>
</view>
<view class="price2">{{ $lang('salePrice', { price: item.buy_price }) }}</view>
</view>
<!-- <view class="content-item" @click="openRecharge()">
<view class="price1 ">
<text class="other">其他金额</text>
</view>
</view> -->
</view>
<!-- <view class="box-text" v-if="isIndex !== -1">
注:充值 {{ list[isIndex].face_value }} 元赠送:
<text>{{ list[isIndex].point }} 积分,</text>
<text>{{ list[isIndex].growth }} 成长值</text>
<text v-if="list[isIndex].coupon_id != ''">,优惠券X{{ list[isIndex].coupon_id.split(',').length }}</text>
</view> -->
</view>
</view>
<!-- <view class="explain">
<view class="title">充值说明</view>
<view class="explain_list">
<view v-for="(item,index) in list" :key="index" v-if="item.point || item.growth || item.coupon_id != ''">
充值 {{ item.face_value }} 元赠送:
<text v-if="item.point">{{ item.point }} 积分,</text>
<text v-if="item.growth">{{ item.growth }} 成长值</text>
<text v-if="item.coupon_id != ''">,优惠券X{{ item.coupon_id.split(',').length }}</text>
</view>
<view>
充值任意金额后,会存到您的账户资金中
</view>
</view>
</view> -->
<uni-popup ref="rechargePopup" type="bottom">
<view class="rechargeList">
<view class="tip">{{ $lang('pleaseEnterAmount') }}</view>
<view class="input color-tip">
{{keywordsInfo.price?keywordsInfo.price:$lang('amount')}}<text class="color-base-text">{{ $lang('yuan') }}</text>
</view>
<view class="input color-tip">
<text class="color-base-text" v-if="payMoney > 0">{{ $lang('salePrice', { price: payMoney }) }}</text>
</view>
<view class="keywords">
<view class="keywords-left">
<view class="active" @click="keywordsDown(1)">1</view>
<view class="active" @click="keywordsDown(2)">2</view>
<view class="active" @click="keywordsDown(3)">3</view>
<view class="active" @click="keywordsDown(4)">4</view>
<view class="active" @click="keywordsDown(5)">5</view>
<view class="active" @click="keywordsDown(6)">6</view>
<view class="active" @click="keywordsDown(7)">7</view>
<view class="active" @click="keywordsDown(8)">8</view>
<view class="active" @click="keywordsDown(9)">9</view>
<view class=""></view>
<view class="active" @click="keywordsDown(0)">0</view>
<view class=""></view>
</view>
<view class="keywords-right">
<view @click="delPrice"><text class="iconfont icon-close"></text></view>
<view class="color-base-bg" @click="keywordsPayment()">{{ $lang('confirmRecharge') }}</view>
</view>
</view>
</view>
</uni-popup>
<!-- 选择支付方式弹窗 -->
<ns-payment ref="choosePaymentPopup" :payMoney="payMoney" @confirm="toPay"></ns-payment>
<view style="background: #fff;width: 100%;position: fixed;bottom: 0rpx;">
<button class="add-account" type="primary" @click="submitPayment" >{{ $lang('recharge') }}</button>
</view>
<!-- <button class="add-account" type="primary" :disabled="recharge_id > 0 ? false : true" @click="openChoosePayment">充值</button> -->
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
balanceInfo: {
balance: 0,
balance_money: 0
},
isIndex: -1,
recharge_id: '',
amount: '',
payMoney: '',
keywordsInfo: {
price: 0,
minPrice: 1,
maxPrice: 30
}
};
},
onShow() {
this.getUserInfo();
this.getData();
},
methods: {
openRecharge() {
this.isIndex = -1;
this.payMoney = 0;
this.keywordsInfo.price = 0;
this.recharge_id = '';
this.$refs.rechargePopup.open()
},
submitPayment(){
this.isIndex = -1;
this.keywordsInfo.price = 0;
this.recharge_id = '';
this.amount = this.payMoney;
this.openChoosePayment()
},
toOrderList() {
this.$util.redirectTo('/pages_tool/recharge/order_list');
},
//点击每一个
itemClick(index, id, buy_price) {
if (this.amount) this.amount = '';
this.isIndex = index;
this.recharge_id = id;
this.payMoney = parseFloat(buy_price);
},
//键盘点击
keywordsDown(val) {
var temp = this.keywordsInfo.price == 0 ? val : this.keywordsInfo.price + '' + val, tempamount = temp
this.keywordsInfo.price = temp;
this.payMoney = tempamount;
},
delPrice() {
var temp = this.keywordsInfo.price.toString()
if (temp.length) {
this.keywordsInfo.price = temp.slice(0, temp.length - 1)
if (this.keywordsInfo.price.length > 0) {
this.payMoney = this.keywordsInfo.price;
} else {
this.payMoney = '';
}
}
},
keywordsPayment() {
if (this.keywordsInfo.price > 0) {
this.amount = this.payMoney;
this.$refs.rechargePopup.close()
this.openChoosePayment()
} else {
this.$util.showToast({
title: this.$lang('pleaseEnterAmount')
})
}
},
//输入框聚焦
cumberFocus() {
this.isIndex = -1;
},
getUserInfo() {
this.$api.sendRequest({
url: '/api/memberaccount/info',
data: {
account_type: 'balance,balance_money'
},
success: res => {
if (res.data) {
this.balanceInfo = res.data;
} else {
this.$util.showToast({
title: res.message
});
}
}
});
},
getData() {
this.$api.sendRequest({
url: '/memberrecharge/api/memberrecharge/page',
data: {
page_size: 100,
page: 1
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
//设置列表数据
this.list = newArr; //追加新数据
if(this.list.length > 0){
this.isIndex = 0;
this.recharge_id = this.list[0]['recharge_id'];
this.payMoney = parseFloat(this.list[0]['buy_price']);
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: () => {
//联网失败的回调
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
toPay() {
if (this.recharge_id !== '') {
this.$api.sendRequest({
url: '/memberrecharge/api/ordercreate/create',
data: {
recharge_id: this.recharge_id
},
success: res => {
if (res.data && res.code == 0) {
this.$refs.choosePaymentPopup.getPayInfo(res.data);
} else {
this.$util.showToast({
title: res.message
});
}
}
});
} else if (this.amount !== '') {
this.$api.sendRequest({
url: '/memberrecharge/api/ordercreate/create',
data: {
recharge_id: 0,
face_value: this.amount
},
success: res => {
if (res.data && res.code == 0) {
this.$refs.choosePaymentPopup.getPayInfo(res.data);
} else {
this.$util.showToast({
title: res.message
});
}
}
});
} else {
this.$util.showToast({
title: this.$lang('pleaseSelectPackage')
});
}
},
imageError(index) {
this.list[index].cover_img = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
// 显示选择支付方式弹框
openChoosePayment() {
uni.setStorageSync('paySource', 'recharge');
if (this.amount !== '') this.payMoney = parseFloat(this.amount);
this.$refs.choosePaymentPopup.open();
}
}
};
</script>
<style lang="scss">
.page{
// min-height: 100vh;
// // width: 100%;
// background-color: #FFFFFF;
// padding: 32rpx;
box-sizing: border-box;
}
::v-deep .mescroll-uni-fixed {
bottom: 280rpx !important;
}
.recharge-title{
font-size: 60rpx;
font-weight: bold;
}
.account-box{
margin-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: baseline;
border-bottom: 2rpx solid #F6F6F6;
padding-bottom: 20rpx;
.label{
font-size:30rpx;
font-weight:bold;
}
.value{
text{
font-size: 28rpx;
font-weight: bold;
}
.price-font{
font-size: 60rpx;
font-weight: bold;
}
}
}
.explain {
margin-top: 80rpx;
padding: $padding 0;
background-color: #fff;
border-radius: $border-radius;
.title {
font-size: 32rpx;
font-weight: bold;
}
.explain_list {
view {
font-size: $font-size-sub;
color: $color-tip;
}
}
}
.rechargeList {
.tip {
padding: $margin-both;
text-align: center;
font-size: $font-size-toolbar;
}
.input {
text-align: center;
text {
margin-left: 10rpx;
}
margin-bottom: $margin-updown;
}
.keywords {
display: flex;
border-top: 1px solid $color-line;
margin-top: $margin-updown;
.keywords-left {
flex: 1;
display: flex;
flex-wrap: wrap;
>view {
width: calc((100% - 3px) / 3);
text-align: center;
height: 112rpx;
line-height: 112rpx;
border-right: 1px solid $color-line;
border-bottom: 1px solid $color-line;
font-size: 40rpx;
&.active:active {
background-color: rgba($color: #000000, $alpha: 0.5);
}
}
}
.keywords-right {
display: flex;
flex-wrap: wrap;
flex-direction: column;
width: 200rpx;
text-align: center;
>view {
flex: 1;
line-height: 228rpx;
&:last-child {
color: #fff
}
}
}
}
}
.recharge-price {
width: calc(100% - 60rpx);
background-color: #ffffff;
margin: 20rpx 30rpx 0;
border-radius: 10rpx;
padding: 30rpx 30rpx 25rpx;
box-sizing: border-box;
.recharge-price-title {
font-size: $font-size-base;
color: $color-title;
line-height: 1;
}
.recharge-price-custom {
border-bottom: 1px solid #dddddd;
padding-bottom: 20rpx;
display: flex;
align-items: center;
margin-top: 45rpx;
text {
font-size: 54rpx;
color: $color-title;
line-height: 1;
}
input {
font-size: 54rpx;
line-height: 1;
}
}
.recharge-price-desc {
display: flex;
margin-top: 16rpx;
align-items: center;
image {
width: 34rpx;
height: 34rpx;
margin-right: 13rpx;
}
text {
font-size: $font-size-sub;
color: $color-tip;
line-height: 1;
}
}
}
.recharge-box {
padding:28rpx 24rpx 32rpx;
background: #fff;
height: 100%;
box-sizing: border-box;
border-radius: 24rpx;
margin: 32rpx;
.recharge-box-title {
font-size: $font-size-base;
color: #212121;
line-height: 1;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 28rpx;
}
.box-title {
text-align: center;
font-size: $font-size-toolbar;
}
.box-custom {
width: 226rpx;
border-bottom: 1px solid #dddddd;
margin: 0 auto;
margin-top: 49rpx;
line-height: 1;
padding-bottom: 10rpx;
box-sizing: border-box;
.pla-number {
font-size: 30rpx;
}
input {
height: 97rpx;
width: 100%;
font-size: 62rpx;
color: #000;
text-align: center;
line-height: 1;
}
}
.box-content {
width: 100%;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
max-height: 50vh;
overflow-y: scroll;
.money{
width: 100%;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-align: end;
-webkit-align-items: flex-end;
align-items: flex-end;
.label{
width: 30px;
font-size: 30px;
text-align: center;
line-height: 42px;
padding-bottom: 2px;
color: #212121;
font-weight: 600;
-webkit-flex-shrink: 0;
flex-shrink: 0;
}
.input-box{
width: 0;
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
.reg-input {
height: 48px !important;
font-size: 34px !important;
line-height: 48px !important;
height: 48px;
font-weight: 700 !important;
color: #212121;
}
}
}
.content-item {
width: calc((100% - 48rpx) / 3);
margin-right: 24rpx;
height: 142rpx;
margin-top: 25rpx;
border-radius: 16rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: $color-title;
box-sizing: border-box;
text-align: center;
background: #F7F7FB;
&:nth-child(3n) {
margin-right: 0;
}
.price1 {
font-size: $font-size-base;
display: flex;
align-items: flex-end;
color: #333333;
text:first-child {
font-size: 40rpx;
line-height: 1;
}
text:nth-child(2) {
font-size: $font-size-base;
line-height: 1;
}
.other{
font-size: 32rpx!important;
color: #666666;
}
}
.price2 {
font-size: $font-size-tag;
color: #666666;
line-height: 1;
margin-top: 16rpx;
}
&.color-base-bg {
.price1,
.price2 {
color: #ffffff !important;
}
}
&.active{
background: linear-gradient(136deg, var(--promotion-aux-color) 0%, var(--promotion-color) 100%);
.price1,
.price2 {
color: #ffffff !important;
}
}
}
}
.box-text {
margin-top: 40rpx;
font-size: $font-size-sub;
color: var(--main-color);
}
}
.add-account {
margin: 0;
margin-top: 5vh;
height: 76rpx;
line-height: 76rpx;
// width: 100%;
border-radius: 90rpx;
background: #1db03b!important;
color:#fff !important;
font-size: 28rpx;
margin: 18rpx 24rpx;
}
</style>