feat: 新增多语言文案、优化导航及工具函数,修复部分业务逻辑
1. 新增多语言资源文件,覆盖文章、预约日期、会员信息、优惠券、表单、购物车、积分商城、分销、AI聊天等多个模块 2. 优化底部导航组件,使用多语言配置替代硬编码文案 3. 重构工具函数,新增从后端数据提取多语言文案的工具方法 4. 修复邀请好友页面的保存提示文案,替换为多语言版本 5. 修复商品SKU组件的提示文案,使用多语言配置 6. 重构AI聊天页面的帮助文档和回复模板,使用多语言配置 7. 优化空状态组件,支持多语言默认文案 8. 修复跳转逻辑,补全参数传递 9. 新增本地开发环境配置
This commit is contained in:
@@ -26,18 +26,18 @@
|
||||
</block>
|
||||
</view>
|
||||
<view class="stock" v-if="goodsDetail.stock_show">
|
||||
库存{{ goodsDetail.stock }}{{ goodsDetail.unit }}</view>
|
||||
{{ $lang('goods.detail.stock') }}{{ goodsDetail.stock }}{{ goodsDetail.unit }}</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="price-wrap">
|
||||
<view class="price font-size-toolbar">{{ goodsDetail.name }}</view>
|
||||
</view>
|
||||
<view class="stock" style="height: auto;">
|
||||
积分:
|
||||
{{ $lang('goods.detail.pointLabel') }}
|
||||
<text class="price-color">{{ goodsDetail.point }}</text>
|
||||
</view>
|
||||
<view class="stock">
|
||||
库存:
|
||||
{{ $lang('goods.detail.stockLabel') }}
|
||||
<text class="color-base-text">{{ goodsDetail.stock }}{{ goodsDetail.unit }}</text>
|
||||
</view>
|
||||
</block>
|
||||
@@ -48,13 +48,13 @@
|
||||
<text class="price price-style large">{{ parseFloat(goodsDetail.presale_deposit).toFixed(2).split('.')[0] }}</text>
|
||||
<text class="unit price-style small">.{{ parseFloat(goodsDetail.presale_deposit).toFixed(2).split('.')[1] }}</text>
|
||||
<view class="balance" v-if="balance > 0">
|
||||
<text>尾款</text>
|
||||
<text>{{ $lang('goods.detail.balanceLabel') }}</text>
|
||||
<text class="unit price-color font-size-tag price-font">¥</text>
|
||||
<text class="price-color price-font">{{ balance }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="stock presale-stock">
|
||||
<block v-if="goodsDetail.stock_show">库存{{ goodsDetail.stock }}{{ goodsDetail.unit }}
|
||||
<block v-if="goodsDetail.stock_show">{{ $lang('goods.detail.stock') }}{{ goodsDetail.stock }}{{ goodsDetail.unit }}
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
@@ -117,11 +117,11 @@
|
||||
<text class="unit price-style small" v-else>.{{ parseFloat(goodsDetail.price).toFixed(2).split('.')[1] }}</text>
|
||||
</block>
|
||||
</view>
|
||||
<view class="stock" v-if="goodsDetail.stock_show">库存{{ goodsDetail.stock }}{{ goodsDetail.unit }}</view>
|
||||
<view class="stock" v-if="goodsDetail.stock_show">{{ $lang('goods.detail.stock') }}{{ goodsDetail.stock }}{{ goodsDetail.unit }}</view>
|
||||
</block>
|
||||
|
||||
<view class="sku-name font-size-tag" v-if="goodsDetail.sku_spec_format">
|
||||
<text class="color-tip">已选规格:</text>
|
||||
<text class="color-tip">{{ $lang('goods.detail.selectedSpec') }}</text>
|
||||
<text v-for="(item, index) in goodsDetail.sku_spec_format" :key="index" class="spec-value">{{ item.spec_value_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -135,13 +135,13 @@
|
||||
<view class="sku-list-wrap" v-if="type == 'pintuan' && goodsDetail.pintuan_type == 'ladder' && !goodsDetail.group_id">
|
||||
<text class="title font-size-base"> </text>
|
||||
<view class="items" :class="{ selected: pintuan_num_field == 'pintuan_num' }" @click="pintuanChange('pintuan_num')">
|
||||
<text>{{ goodsDetail.pintuan_num }}人团</text>
|
||||
<text>{{ $lang('goods.detail.groupOfNum', { num: goodsDetail.pintuan_num }) }}</text>
|
||||
</view>
|
||||
<view class="items" v-if="goodsDetail.pintuan_num_2 > 0" :class="{ selected: pintuan_num_field == 'pintuan_num_2' }" @click="pintuanChange('pintuan_num_2')">
|
||||
<text>{{ goodsDetail.pintuan_num_2 }}人团</text>
|
||||
<text>{{ $lang('goods.detail.groupOfNum', { num: goodsDetail.pintuan_num_2 }) }}</text>
|
||||
</view>
|
||||
<view class="items" v-if="goodsDetail.pintuan_num_3 > 0" :class="{ selected: pintuan_num_field == 'pintuan_num_3' }" @click="pintuanChange('pintuan_num_3')">
|
||||
<text>{{ goodsDetail.pintuan_num_3 }}人团</text>
|
||||
<text>{{ $lang('goods.detail.groupOfNum', { num: goodsDetail.pintuan_num_3 }) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -158,14 +158,14 @@
|
||||
|
||||
<view class="number-wrap">
|
||||
<view class="number-line">
|
||||
<text class="title font-size-base" v-if="type == 'point'">兑换数量</text>
|
||||
<text class="title font-size-base" v-else>购买数量</text>
|
||||
<text class="limit-txt color-base-text" v-if="limitNumber > 0">(每人限购{{ limitNumber }}{{ goodsDetail.unit }})</text>
|
||||
<text class="title font-size-base" v-if="type == 'point'">{{ $lang('goods.detail.exchangeCount') }}</text>
|
||||
<text class="title font-size-base" v-else>{{ $lang('goods.detail.buyCount') }}</text>
|
||||
<text class="limit-txt color-base-text" v-if="limitNumber > 0">({{ $lang('goods.detail.limitPerPerson', { count: limitNumber, unit: goodsDetail.unit }) }})</text>
|
||||
<text v-if="maxBuy > 0 && minBuy > 1" class="limit-txt color-base-text">
|
||||
({{ minBuy }}{{ goodsDetail.unit }}起售,限购{{ maxBuy }}{{ goodsDetail.unit }})
|
||||
({{ $lang('goods.detail.limitBuyRange', { minBuy: minBuy, maxBuy: maxBuy, unit: goodsDetail.unit }) }})
|
||||
</text>
|
||||
<text v-else-if="maxBuy > 0" class="limit-txt color-base-text">(限购{{ maxBuy }}{{ goodsDetail.unit }})</text>
|
||||
<text v-else-if="minBuy > 1" class="limit-txt color-base-text">({{ minBuy }}{{ goodsDetail.unit }}起售)</text>
|
||||
<text v-else-if="maxBuy > 0" class="limit-txt color-base-text">({{ $lang('goods.detail.limitBuyMax', { maxBuy: maxBuy, unit: goodsDetail.unit }) }})</text>
|
||||
<text v-else-if="minBuy > 1" class="limit-txt color-base-text">({{ $lang('goods.detail.minBuyStart', { minBuy: minBuy, unit: goodsDetail.unit }) }})</text>
|
||||
<view class="number">
|
||||
<button type="default" class="decrease color-line-border" :class="{ disabled: decreaseDisabled }" @click="changeNum('-')">-</button>
|
||||
<input type="number" class="uni-input color-line-border font-size-goods-tag" @blur="blur" v-model="number" placeholder="0" @input="keyInput(false)" />
|
||||
@@ -178,34 +178,34 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="footer" @click="confirm()">
|
||||
<button type="primary" v-if="goodsDetail.stock && goodsDetail.stock != 0 && goodsDetail.is_virtual == 0 && type == 'buy_now'" :style="{ background: themeStyle.goods_detail.goods_btn_color_shallow, color : '#fff' }" @click.stop="confirm(true)">加入购物车</button>
|
||||
<button type="primary" v-if="goodsDetail.stock && goodsDetail.stock != 0 && goodsDetail.is_virtual == 0 && type == 'buy_now'" :style="{ background: themeStyle.goods_detail.goods_btn_color_shallow, color : '#fff' }" @click.stop="confirm(true)">{{ $lang('goods.detail.joinCart') }}</button>
|
||||
<block v-if="type == 'point'">
|
||||
<block v-if="goodsDetail.type == 1">
|
||||
<!-- 兑换商品 -->
|
||||
<button v-if="goodsDetail.stock && goodsDetail.stock != 0" type="primary">兑换</button>
|
||||
<button type="primary" v-else disabled="true">库存不足</button>
|
||||
<button v-if="goodsDetail.stock && goodsDetail.stock != 0" type="primary">{{ $lang('goods.detail.exchangeBtn') }}</button>
|
||||
<button type="primary" v-else disabled="true">{{ $lang('goods.detail.stockInsufficient') }}</button>
|
||||
</block>
|
||||
<block v-else-if="goodsDetail.type == 2 || goodsDetail.type == 3">
|
||||
<!-- 兑换优惠券、红包 -->
|
||||
<button type="primary">兑换</button>
|
||||
<button type="primary">{{ $lang('goods.detail.exchangeBtn') }}</button>
|
||||
</block>
|
||||
</block>
|
||||
<block v-else-if="goodsDetail.goods_state == 1">
|
||||
<button type="primary" v-if="goodsDetail.stock && goodsDetail.stock != 0 && type == 'join_cart'">加入购物车</button>
|
||||
<button type="primary" v-else-if="goodsDetail.stock && goodsDetail.stock != 0 && type == 'buy_now'">立即购买</button>
|
||||
<button type="primary" v-else-if="goodsDetail.stock && goodsDetail.stock != 0 && type == 'confirm'">确认</button>
|
||||
<button type="primary" v-if="goodsDetail.stock && goodsDetail.stock != 0 && type == 'join_cart'">{{ $lang('goods.detail.joinCart') }}</button>
|
||||
<button type="primary" v-else-if="goodsDetail.stock && goodsDetail.stock != 0 && type == 'buy_now'">{{ $lang('goods.detail.buynow') }}</button>
|
||||
<button type="primary" v-else-if="goodsDetail.stock && goodsDetail.stock != 0 && type == 'confirm'">{{ $lang('goods.detail.confirmBtn') }}</button>
|
||||
<template v-else-if="goodsDetail.stock && goodsDetail.stock != 0">
|
||||
<template v-if="goodsDetail.buy_num">
|
||||
<button type="primary" v-if="goodsDetail.buy_num <= goodsDetail.stock">立即抢购</button>
|
||||
<button type="primary" v-else disabled="true">库存不足</button>
|
||||
<button type="primary" v-if="goodsDetail.buy_num <= goodsDetail.stock">{{ $lang('goods.detail.rushBuy') }}</button>
|
||||
<button type="primary" v-else disabled="true">{{ $lang('goods.detail.stockInsufficient') }}</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button type="primary">立即抢购</button>
|
||||
<button type="primary">{{ $lang('goods.detail.rushBuy') }}</button>
|
||||
</template>
|
||||
</template>
|
||||
<button type="primary" v-else disabled="true">库存不足</button>
|
||||
<button type="primary" v-else disabled="true">{{ $lang('goods.detail.stockInsufficient') }}</button>
|
||||
</block>
|
||||
<button type="primary" v-else disabled="true">该商品已下架</button>
|
||||
<button type="primary" v-else disabled="true">{{ $lang('goods.detail.offShelves') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup-sku>
|
||||
@@ -707,7 +707,7 @@
|
||||
if (this.$util.inArray(this.skuId + '', this.goodsDetail.activity_sku_ids) == -1) {
|
||||
this.confirmDisabled = true;
|
||||
this.$util.showToast({
|
||||
title: '该规格未参与打包一口价活动'
|
||||
title: this.$lang('goods.detail.specNotInBale')
|
||||
});
|
||||
} else {
|
||||
this.confirmDisabled = false;
|
||||
@@ -771,7 +771,7 @@
|
||||
if (this.$util.inArray(skuId + '', this.goodsDetail.activity_sku_ids) == -1) {
|
||||
this.confirmDisabled = true;
|
||||
this.$util.showToast({
|
||||
title: '该规格未参与打包一口价活动'
|
||||
title: this.$lang('goods.detail.specNotInBale')
|
||||
});
|
||||
} else {
|
||||
this.confirmDisabled = false;
|
||||
@@ -850,7 +850,7 @@
|
||||
} else {
|
||||
if (this.number >= this.goodsDetail.stock) {
|
||||
this.$util.showToast({
|
||||
title: '库存不足'
|
||||
title: this.$lang('goods.detail.stockInsufficient')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -858,14 +858,15 @@
|
||||
if (this.goodsDetail.is_limit == 1 && this.maxBuy > 0) {
|
||||
if (this.goodsDetail.limit_type == 1) {
|
||||
this.$util.showToast({
|
||||
title: '该商品每次最多购买' + this.maxBuy + this.goodsDetail.unit
|
||||
title: this.$lang('goods.detail.maxPurchasePerTime', { count: this.maxBuy, unit: this.goodsDetail.unit })
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.goodsDetail.limit_type == 2) {
|
||||
let message = '该商品每人限购' + this.maxBuy + this.goodsDetail.unit;
|
||||
message += this.goodsDetail.purchased_num > 0 ? ',您已购买了' + this.goodsDetail.purchased_num + this.goodsDetail.unit : '';
|
||||
let message = this.goodsDetail.purchased_num > 0
|
||||
? this.$lang('goods.detail.purchaseLimitWithPurchased', { count: this.maxBuy, unit: this.goodsDetail.unit, purchased: this.goodsDetail.purchased_num })
|
||||
: this.$lang('goods.detail.purchaseLimit', { count: this.maxBuy, unit: this.goodsDetail.unit });
|
||||
this.$util.showToast({
|
||||
title: message
|
||||
});
|
||||
@@ -875,14 +876,14 @@
|
||||
|
||||
if (this.type == 'seckill' && this.goodsDetail.seckill_id && this.goodsDetail.num > 0) {
|
||||
this.$util.showToast({
|
||||
title: '该商品每人限购' + this.goodsDetail.num + this.goodsDetail.unit
|
||||
title: this.$lang('goods.detail.purchaseLimit', { count: this.goodsDetail.num, unit: this.goodsDetail.unit })
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.type == 'presale' && this.goodsDetail.presale_id && this.goodsDetail.presale_num > 0) {
|
||||
this.$util.showToast({
|
||||
title: '该商品每人限购' + this.goodsDetail.presale_num + this.goodsDetail.unit
|
||||
title: this.$lang('goods.detail.purchaseLimit', { count: this.goodsDetail.presale_num, unit: this.goodsDetail.unit })
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -894,7 +895,7 @@
|
||||
} else {
|
||||
if (this.minBuy > 1) {
|
||||
this.$util.showToast({
|
||||
title: '该商品' + this.minBuy + this.goodsDetail.unit + '起售'
|
||||
title: this.$lang('goods.detail.minBuyStart', { minBuy: this.minBuy, unit: this.goodsDetail.unit })
|
||||
});
|
||||
}
|
||||
return;
|
||||
@@ -982,7 +983,7 @@
|
||||
uni.removeStorageSync('delivery');
|
||||
if (this.preview) {
|
||||
this.$util.showToast({
|
||||
title: '预览商品无法购买'
|
||||
title: this.$lang('goods.detail.previewCannotBuy')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -997,43 +998,44 @@
|
||||
this.keyInput(true, () => {
|
||||
if (this.goodsDetail.stock == 0) {
|
||||
this.$util.showToast({
|
||||
title: '商品已售罄'
|
||||
title: this.$lang('goods.detail.soldOut')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.number.length == 0 || this.number <= 0) {
|
||||
this.$util.showToast({
|
||||
title: '购买数量不能小于等于0'
|
||||
title: this.$lang('goods.detail.buyCountNotZero')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.goodsDetail.buy_num > this.goodsDetail.stock) {
|
||||
this.$util.showToast({
|
||||
title: '库存小于最低购买数量'
|
||||
title: this.$lang('goods.detail.stockLessThanMinBuy')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.number > this.goodsDetail.stock) {
|
||||
this.$util.showToast({
|
||||
title: '库存不足'
|
||||
title: this.$lang('goods.detail.stockInsufficient')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.goodsDetail.is_limit == 1 && this.goodsDetail.limit_type == 1 && this.maxBuy > 0 && this.number > this.maxBuy) {
|
||||
this.$util.showToast({
|
||||
title: '该商品每次最多购买' + this.maxBuy + this.goodsDetail.unit
|
||||
title: this.$lang('goods.detail.maxPurchasePerTime', { count: this.maxBuy, unit: this.goodsDetail.unit })
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.goodsDetail.is_limit == 1 && this.goodsDetail.limit_type == 2 && this.maxBuy > 0 &&
|
||||
this.number + this.goodsDetail.purchased_num > this.maxBuy) {
|
||||
let message = '该商品每人限购' + this.maxBuy + this.goodsDetail.unit;
|
||||
message += this.goodsDetail.purchased_num > 0 ? ',您已购买了' + this.goodsDetail.purchased_num + this.goodsDetail.unit : '';
|
||||
let message = this.goodsDetail.purchased_num > 0
|
||||
? this.$lang('goods.detail.purchaseLimitWithPurchased', { count: this.maxBuy, unit: this.goodsDetail.unit, purchased: this.goodsDetail.purchased_num })
|
||||
: this.$lang('goods.detail.purchaseLimit', { count: this.maxBuy, unit: this.goodsDetail.unit });
|
||||
this.$util.showToast({
|
||||
title: message
|
||||
});
|
||||
@@ -1042,7 +1044,7 @@
|
||||
|
||||
if ((this.type == 'join_cart' || isJoinCartBtn) && this.goodsDetail.is_limit == 1 && this.maxBuy > 0 && this.cartNum + this.number > this.maxBuy) {
|
||||
this.$util.showToast({
|
||||
title: '该商品每人限购' + this.maxBuy + this.goodsDetail.unit
|
||||
title: this.$lang('goods.detail.purchaseLimit', { count: this.maxBuy, unit: this.goodsDetail.unit })
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -1070,7 +1072,7 @@
|
||||
var data = res.data;
|
||||
if (data > 0) {
|
||||
this.$util.showToast({
|
||||
title: '加入购物车成功'
|
||||
title: this.$lang('goods.detail.addToCartSuccess')
|
||||
});
|
||||
this.cartNum += this.number;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user