feat: 新增多语言文案、优化导航及工具函数,修复部分业务逻辑
1. 新增多语言资源文件,覆盖文章、预约日期、会员信息、优惠券、表单、购物车、积分商城、分销、AI聊天等多个模块 2. 优化底部导航组件,使用多语言配置替代硬编码文案 3. 重构工具函数,新增从后端数据提取多语言文案的工具方法 4. 修复邀请好友页面的保存提示文案,替换为多语言版本 5. 修复商品SKU组件的提示文案,使用多语言配置 6. 重构AI聊天页面的帮助文档和回复模板,使用多语言配置 7. 优化空状态组件,支持多语言默认文案 8. 修复跳转逻辑,补全参数传递 9. 新增本地开发环境配置
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view class="empty" :class="{ fixed: fixed }">
|
||||
<view class="empty_img"><image :src="$util.img('public/uniapp/common/common-empty.png')" mode="aspectFit" show-menu-by-longpress></image></view>
|
||||
<view class="color-tip margin-top title" :style="{ color: textColor + ' !important' }">{{ text }}</view>
|
||||
<view class="color-tip margin-bottom font-size-sub">{{ subText }}</view>
|
||||
<button type="primary" size="mini" class="button mini" @click="goIndex()" v-if="isIndex">{{ emptyBtn.text }}</button>
|
||||
<view class="color-tip margin-top title" :style="{ color: textColor + ' !important' }">{{ displayText }}</view>
|
||||
<view class="color-tip margin-bottom font-size-sub">{{ displaySubText }}</view>
|
||||
<button type="primary" size="mini" class="button mini" @click="goIndex()" v-if="isIndex">{{ displayBtnText }}</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
props: {
|
||||
text: {
|
||||
type: String,
|
||||
default: '暂无相关数据'
|
||||
default: ''
|
||||
},
|
||||
subText: {
|
||||
type: String,
|
||||
@@ -28,7 +28,7 @@ export default {
|
||||
emptyBtn: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return { text: '去逛逛' };
|
||||
return { text: '' };
|
||||
}
|
||||
},
|
||||
fixed: {
|
||||
@@ -40,6 +40,22 @@ export default {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 显示文案:优先用 prop 传入的,没有则用语言包默认值
|
||||
displayText() {
|
||||
return this.text || this.$lang('common.mescrollEmpty') || '暂无相关数据';
|
||||
},
|
||||
displaySubText() {
|
||||
return this.subText || '';
|
||||
},
|
||||
displayBtnText() {
|
||||
return (this.emptyBtn && this.emptyBtn.text) || this.$lang('toGoodsCategoryPage') || '去逛逛';
|
||||
},
|
||||
// 建立 componentRefresh 依赖,切语言时自动更新
|
||||
_i18nRefresh() {
|
||||
return this.componentRefresh;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goIndex() {
|
||||
if (this.emptyBtn.url) {
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
goodsDetail.en_goods_name : goodsDetail.goods_name) }}</view>
|
||||
<view class="other-info">
|
||||
<view class="stock color-tip" v-if="goodsDetail.stock_show">
|
||||
库存{{ goodsDetail.stock }}{{ goodsDetail.unit }}</view>
|
||||
<view class="starting-num" v-if="parseFloat(goodsDetail.min_buy)">
|
||||
起售{{ goodsDetail.min_buy }}件
|
||||
</view>
|
||||
{{ $lang('goods.detail.stock') }}{{ goodsDetail.stock }}{{ goodsDetail.unit }}</view>
|
||||
<view class="starting-num" v-if="parseFloat(goodsDetail.min_buy)">
|
||||
{{ $lang('goods.detail.startingNum', { num: goodsDetail.min_buy }) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -43,7 +43,7 @@
|
||||
<view class="footer">
|
||||
<view class="sku-name font-size-goods-tag">
|
||||
<template v-if="goodsDetail.sku_spec_format" class="color-tip">
|
||||
已选择:
|
||||
{{ $lang('goods.detail.selected') }}
|
||||
<text class="color-tip" v-for="(item, index) in goodsDetail.sku_spec_format"
|
||||
:key="index">{{ item.spec_value_name }}</text>
|
||||
</template>
|
||||
@@ -72,8 +72,8 @@
|
||||
<view v-else-if="number == 0 && isLoad">
|
||||
<view class="num-action">
|
||||
<button type="primary" v-if="goodsDetail.stock && goodsDetail.stock != 0"
|
||||
@click="confirm($event)">加入购物车</button>
|
||||
<button type="primary" disabled="true" v-else>确定</button>
|
||||
@click="confirm($event)">{{ $lang('goods.detail.joinCart') }}</button>
|
||||
<button type="primary" disabled="true" v-else>{{ $lang('goods.detail.confirmBtn') }}</button>
|
||||
<view class="click-event"></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -261,7 +261,7 @@ export default {
|
||||
} else {
|
||||
if (this.number >= this.goodsDetail.stock) {
|
||||
this.$util.showToast({
|
||||
title: '库存不足'
|
||||
title: this.$lang('goods.detail.stockInsufficient')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -269,14 +269,15 @@ export default {
|
||||
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
|
||||
});
|
||||
@@ -375,7 +376,7 @@ export default {
|
||||
}
|
||||
if (this.goodsDetail.goods_state == 0) {
|
||||
this.$util.showToast({
|
||||
title: '商品已下架'
|
||||
title: this.$lang('goods.detail.goodsOffShelves')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -385,14 +386,14 @@ export default {
|
||||
this.keyInput(true, () => {
|
||||
if (this.goodsDetail.stock == 0) {
|
||||
this.$util.showToast({
|
||||
title: '商品已售罄'
|
||||
title: this.$lang('goods.detail.soldOut')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.number > this.goodsDetail.stock) {
|
||||
this.$util.showToast({
|
||||
title: '库存不足'
|
||||
title: this.$lang('goods.detail.stockInsufficient')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -400,15 +401,16 @@ export default {
|
||||
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
|
||||
});
|
||||
@@ -456,7 +458,7 @@ export default {
|
||||
this.$store.dispatch('cartCalculate');
|
||||
this.$emit('refresh');
|
||||
this.$util.showToast({
|
||||
title: '加入购物车成功'
|
||||
title: this.$lang('goods.detail.addToCartSuccess')
|
||||
});
|
||||
}
|
||||
this.btnSwitch = false;
|
||||
|
||||
@@ -67,13 +67,13 @@ export default {
|
||||
let cart_id = cart ? cart.cart_id : 0;
|
||||
if (_num > parseInt(data.stock)) {
|
||||
this.$util.showToast({
|
||||
title: '商品库存不足'
|
||||
title: this.$lang('goods.detail.goodsStockInsufficient')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (data.is_limit && data.max_buy && _num > parseInt(data.max_buy)) {
|
||||
this.$util.showToast({
|
||||
title: `该商品每人限购${data.max_buy}${data.unit || '件'}`
|
||||
title: this.$lang('goods.detail.purchaseLimit', { count: data.max_buy, unit: data.unit || '件' })
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ export default {
|
||||
res.data;
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: "商品添加购物车成功"
|
||||
title: this.$lang('goods.detail.goodsAddCartSuccess')
|
||||
});
|
||||
this.$store.commit('setCartChange');
|
||||
this.$store.dispatch('cartCalculate');
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -7,35 +7,35 @@
|
||||
<!-- #ifdef H5 -->
|
||||
<template v-if="forceBindingMobileControl">
|
||||
<view class="head">
|
||||
<text class="title">检测到您还未绑定手机号</text>
|
||||
<text class="color-tip tips">为了方便您接收订单等信息,需要绑定手机号</text>
|
||||
<text class="title">{{ $lang('components.ns-login.bindMobileTitle') }}</text>
|
||||
<text class="color-tip tips">{{ $lang('components.ns-login.bindMobileTip') }}</text>
|
||||
<text class="iconfont icon-close color-tip" @click="cancelCompleteInfo"></text>
|
||||
</view>
|
||||
<view class="item-wrap">
|
||||
<text class="label">手机号</text>
|
||||
<input type="number" placeholder="请输入手机号" v-model="formData.mobile" maxlength="11" />
|
||||
<text class="label">{{ $lang('components.ns-login.mobileLabel') }}</text>
|
||||
<input type="number" :placeholder="$lang('components.ns-login.mobilePlaceholder')" v-model="formData.mobile" maxlength="11" />
|
||||
</view>
|
||||
<view class="item-wrap" v-if="isOpenCaptcha">
|
||||
<text class="label">验证码</text>
|
||||
<input type="number" placeholder="请输入验证码" v-model="formData.vercode" maxlength="4" />
|
||||
<text class="label">{{ $lang('components.ns-login.captchaLabel') }}</text>
|
||||
<input type="number" :placeholder="$lang('components.ns-login.captchaPlaceholder')" v-model="formData.vercode" maxlength="4" />
|
||||
<image :src="captcha.img" class="captcha" @click="getCaptcha" show-menu-by-longpress></image>
|
||||
</view>
|
||||
<view class="item-wrap">
|
||||
<text class="label">动态码</text>
|
||||
<input type="number" placeholder="请输入动态码" v-model="formData.dynacode" maxlength="4" />
|
||||
<text class="label">{{ $lang('components.ns-login.dynacodeLabel') }}</text>
|
||||
<input type="number" :placeholder="$lang('components.ns-login.dynacodePlaceholder')" v-model="formData.dynacode" maxlength="4" />
|
||||
<view class="send color-base-text" @click="sendMobileCode">{{ dynacodeData.codeText }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<button type="default" class="save-btn" @click="saveH5" :disabled="isDisabled">保存</button>
|
||||
<button type="default" class="save-btn" @click="saveH5" :disabled="isDisabled">{{ $lang('components.ns-login.save') }}</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifdef MP -->
|
||||
<view class="head">
|
||||
<text class="title">欢迎来到 {{ site_name }}</text>
|
||||
<text class="title">{{ $lang('components.ns-login.welcomeTitle', { siteName: site_name }) }}</text>
|
||||
<text class="color-tip tips">
|
||||
<template>{{ forceBindingMobileControl ? '使用手机号登录,' : '注册登录,' }}</template>
|
||||
获得订单、售后等服务。
|
||||
<template>{{ forceBindingMobileControl ? $lang('components.ns-login.loginWithMobile') : $lang('components.ns-login.registerLogin') }}</template>
|
||||
{{ $lang('components.ns-login.getServicesTip') }}
|
||||
</text>
|
||||
<text class="iconfont icon-close color-tip" @click="cancelCompleteInfo"></text>
|
||||
</view>
|
||||
@@ -46,11 +46,11 @@
|
||||
:class="isAgree ? 'icon-fuxuankuang1 color-base-text' : 'icon-fuxuankuang2'"
|
||||
@click="isAgree = !isAgree"></view>
|
||||
<view style="text-align: left; margin-left: 10rpx; padding-top: 2rpx; font-size: 28rpx;">
|
||||
我同意
|
||||
{{ $lang('components.ns-login.agree') }}
|
||||
<text style="color: #4395ff;"
|
||||
@click="tourl('/pages_tool/agreement/contenr?type=0')">《隐私条款》</text>
|
||||
@click="tourl('/pages_tool/agreement/contenr?type=0')">{{ $lang('components.ns-login.privacyPolicy') }}</text>
|
||||
<text style="color: #4395ff;"
|
||||
@click="tourl('/pages_tool/agreement/contenr?type=1')">《用户服务协议》</text>
|
||||
@click="tourl('/pages_tool/agreement/contenr?type=1')">{{ $lang('components.ns-login.userServiceAgreement') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -58,25 +58,25 @@
|
||||
<block v-if="isAgree">
|
||||
<button class="auth-login save-btn border-0" style="border: none;" open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber">
|
||||
<text style="color: #fff; font-size: 30rpx;">同意隐私协议并授权手机号</text>
|
||||
<text style="color: #fff; font-size: 30rpx;">{{ $lang('components.ns-login.agreeAndAuthorizeMobile') }}</text>
|
||||
</button>
|
||||
</block>
|
||||
<block v-else>
|
||||
<button class="auth-login save-btn border-0" style="border: none;" @click="authno">
|
||||
<text style="color: #fff; font-size: 30rpx;">授权手机号码</text>
|
||||
<text style="color: #fff; font-size: 30rpx;">{{ $lang('components.ns-login.authorizeMobile') }}</text>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<view @click="closeLogin"
|
||||
style="font-size: 30rpx; color: #888; text-align: center; padding-top: 10rpx;">
|
||||
暂不登录
|
||||
{{ $lang('components.ns-login.notNow') }}
|
||||
</view>
|
||||
|
||||
<!-- 昵称和头像模式 -->
|
||||
<template v-if="enableNickAndAvatar">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="item-wrap">
|
||||
<text class="label">头像</text>
|
||||
<text class="label">{{ $lang('components.ns-login.avatarLabel') }}</text>
|
||||
<button open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<image :src="avatarUrl ? avatarUrl : $util.getDefaultImage().head"
|
||||
@error="avatarUrl = $util.getDefaultImage().head" mode="aspectFill" show-menu-by-longpress/>
|
||||
@@ -84,15 +84,15 @@
|
||||
</button>
|
||||
</view>
|
||||
<view class="item-wrap">
|
||||
<text class="label">昵称</text>
|
||||
<input type="nickname" placeholder="请输入昵称" v-model="nickName" @blur="blurNickName"
|
||||
<text class="label">{{ $lang('components.ns-login.nicknameLabel') }}</text>
|
||||
<input type="nickname" :placeholder="$lang('components.ns-login.nicknamePlaceholder')" v-model="nickName" @blur="blurNickName"
|
||||
maxlength="50" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<view class="item-wrap">
|
||||
<text class="label">头像</text>
|
||||
<text class="label">{{ $lang('components.ns-login.avatarLabel') }}</text>
|
||||
<button open-type="getAuthorize" scope="userInfo" @getAuthorize="aliappGetUserinfo"
|
||||
:plain="true" class="border-0">
|
||||
<image :src="avatarUrl ? avatarUrl : $util.getDefaultImage().head"
|
||||
@@ -101,21 +101,21 @@
|
||||
</button>
|
||||
</view>
|
||||
<view class="item-wrap">
|
||||
<text class="label">昵称</text>
|
||||
<input type="nickname" placeholder="请输入昵称" v-model="nickName" @blur="blurNickName"
|
||||
<text class="label">{{ $lang('components.ns-login.nicknameLabel') }}</text>
|
||||
<input type="nickname" :placeholder="$lang('components.ns-login.nicknamePlaceholder')" v-model="nickName" @blur="blurNickName"
|
||||
maxlength="50" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<view class="item-wrap" v-if="forceBindingMobileControl">
|
||||
<text class="label">手机号</text>
|
||||
<text class="label">{{ $lang('components.ns-login.mobileLabel') }}</text>
|
||||
<button open-type="getPhoneNumber" :plain="true" class="auth-login border-0"
|
||||
@getphonenumber="getPhoneNumber">
|
||||
<text class="mobile" v-if="formData.mobile">{{ formData.mobile }}</text>
|
||||
<text class="color-base-text" v-else>获取手机号</text>
|
||||
<text class="color-base-text" v-else>{{ $lang('components.ns-login.getMobile') }}</text>
|
||||
</button>
|
||||
</view>
|
||||
<button type="default" class="save-btn" @click="saveMp" :disabled="isDisabled">保存</button>
|
||||
<button type="default" class="save-btn" @click="saveMp" :disabled="isDisabled">{{ $lang('components.ns-login.save') }}</button>
|
||||
</template>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
@@ -166,7 +166,7 @@ export default {
|
||||
dynacodeData: {
|
||||
seconds: 120,
|
||||
timer: null,
|
||||
codeText: '获取动态码',
|
||||
codeText: '',
|
||||
isSend: false
|
||||
},
|
||||
// 小程序获取手机号所需数据
|
||||
@@ -223,12 +223,14 @@ export default {
|
||||
if (siteInfo) {
|
||||
this.site_name = siteInfo.site_name;
|
||||
}
|
||||
// 初始化动态码按钮文字
|
||||
this.dynacodeData.codeText = this.$lang('components.ns-login.getDynacode');
|
||||
},
|
||||
methods: {
|
||||
// 同意协议
|
||||
authno() {
|
||||
if (!this.isAgree) {
|
||||
this.$util.showToast({ title: '请确认相关协议' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-login.pleaseConfirmAgreement') });
|
||||
}
|
||||
},
|
||||
|
||||
@@ -324,7 +326,7 @@ export default {
|
||||
},
|
||||
fail: () => {
|
||||
this.$util.showToast({
|
||||
title: '上传失败'
|
||||
title: this.$lang('components.ns-login.uploadFailed')
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -386,17 +388,17 @@ export default {
|
||||
var rule = [{
|
||||
name: 'mobile',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入手机号'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterMobile')
|
||||
}, {
|
||||
name: 'mobile',
|
||||
checkType: 'phoneno',
|
||||
errorMsg: '请输入正确的手机号'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterCorrectMobile')
|
||||
}];
|
||||
if (this.isOpenCaptcha == 1) {
|
||||
rule.push({
|
||||
name: 'captcha_code',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入验证码'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterCaptcha')
|
||||
});
|
||||
}
|
||||
var checkRes = validate.check(data, rule);
|
||||
@@ -411,7 +413,7 @@ export default {
|
||||
if (this.dynacodeData.seconds == 120) {
|
||||
this.dynacodeData.timer = setInterval(() => {
|
||||
this.dynacodeData.seconds--;
|
||||
this.dynacodeData.codeText = this.dynacodeData.seconds + 's后可重新获取';
|
||||
this.dynacodeData.codeText = this.$lang('components.ns-login.resendAfter', { seconds: this.dynacodeData.seconds });
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@@ -430,7 +432,7 @@ export default {
|
||||
},
|
||||
fail: () => {
|
||||
this.$util.showToast({
|
||||
title: 'request:fail'
|
||||
title: this.$lang('components.ns-login.requestFail')
|
||||
});
|
||||
this.refreshDynacodeData();
|
||||
}
|
||||
@@ -444,7 +446,7 @@ export default {
|
||||
this.dynacodeData = {
|
||||
seconds: 120,
|
||||
timer: null,
|
||||
codeText: '获取动态码',
|
||||
codeText: this.$lang('components.ns-login.getDynacode'),
|
||||
isSend: false
|
||||
};
|
||||
},
|
||||
@@ -455,23 +457,23 @@ export default {
|
||||
let rule = [{
|
||||
name: 'mobile',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入手机号'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterMobile')
|
||||
}, {
|
||||
name: 'mobile',
|
||||
checkType: 'phoneno',
|
||||
errorMsg: '请输入正确的手机号'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterCorrectMobile')
|
||||
}];
|
||||
if (this.isOpenCaptcha == 1) {
|
||||
if (this.captcha.id != '') rule.push({
|
||||
name: 'captcha_code',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入验证码'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterCaptcha')
|
||||
});
|
||||
}
|
||||
rule.push({
|
||||
name: 'code',
|
||||
checkType: 'required',
|
||||
errorMsg: '请输入动态码'
|
||||
errorMsg: this.$lang('components.ns-login.pleaseEnterDynacode')
|
||||
});
|
||||
|
||||
var checkRes = validate.check(data, rule);
|
||||
@@ -594,7 +596,7 @@ export default {
|
||||
},
|
||||
fail: res => {
|
||||
this.$util.showToast({
|
||||
title: 'request:fail'
|
||||
title: this.$lang('components.ns-login.requestFail')
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -603,7 +605,7 @@ export default {
|
||||
// 授权登录
|
||||
authLogin(data, type = 'authLogin') {
|
||||
uni.showLoading({
|
||||
title: '登录中'
|
||||
title: this.$lang('components.ns-login.loggingIn')
|
||||
});
|
||||
uni.setStorageSync('authInfo', data);
|
||||
if (uni.getStorageSync('source_member')) data.source_member = uni.getStorageSync('source_member');
|
||||
@@ -643,7 +645,7 @@ export default {
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
this.$util.showToast({
|
||||
title: '登录失败'
|
||||
title: this.$lang('components.ns-login.loginFailed')
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -669,12 +671,12 @@ export default {
|
||||
// 微信小程序保存数据
|
||||
saveMp() {
|
||||
if (this.formData.mobile === '') {
|
||||
this.$util.showToast({ title: '请授权您的手机号码' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-login.pleaseAuthorizeMobile') });
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.nickName.length == 0 && this.enableNickAndAvatar) {
|
||||
this.$util.showToast({ title: '请输入昵称' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-login.pleaseEnterNickname') });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -715,7 +717,7 @@ export default {
|
||||
},
|
||||
fail: () => {
|
||||
this.$util.showToast({
|
||||
title: '头像拉取失败'
|
||||
title: this.$lang('components.ns-login.avatarPullFailed')
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<view :class="['box', 'align-left']" :style="item._boxAlignStyle">
|
||||
<input
|
||||
type="text"
|
||||
:placeholder="item.value.placeholder || '请输入提示语'"
|
||||
:placeholder="item.value.placeholder || $lang('components.ns-newform.inputPlaceholder')"
|
||||
placeholder-class="placeholder color-tip"
|
||||
v-model="item.val"
|
||||
/>
|
||||
@@ -28,7 +28,7 @@
|
||||
</view>
|
||||
<view :class="['box', 'align-left']" :style="item._boxAlignStyle">
|
||||
<textarea
|
||||
:placeholder="item.value.placeholder || '请输入提示语'"
|
||||
:placeholder="item.value.placeholder || $lang('components.ns-newform.inputPlaceholder')"
|
||||
placeholder-class="placeholder color-tip"
|
||||
v-model="item.val"
|
||||
></textarea>
|
||||
@@ -50,7 +50,7 @@
|
||||
</view>
|
||||
<view :class="['box', 'box-flex', 'align-right']">
|
||||
<text v-if="item.val != ''">{{ item.val }}</text>
|
||||
<text v-else class="color-tip">{{ item.value.placeholder || '请选择' }}</text>
|
||||
<text v-else class="color-tip">{{ item.value.placeholder || $lang('components.ns-newform.selectPlaceholder') }}</text>
|
||||
<text class="iconfont icon-right"></text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -146,7 +146,7 @@
|
||||
@change="bindDateChange($event, index)"
|
||||
>
|
||||
<view :class="['uni-input', !item.val ? 'color-tip' : '']">
|
||||
{{ item.val ? item.val : (item.value.placeholder || '请选择日期') }}
|
||||
{{ item.val ? item.val : (item.value.placeholder || $lang('components.ns-newform.datePlaceholder')) }}
|
||||
</view>
|
||||
</picker>
|
||||
<text class="iconfont icon-right"></text>
|
||||
@@ -170,7 +170,7 @@
|
||||
>
|
||||
<view class="picker-box">
|
||||
<view :class="['uni-input', !item.start_date ? 'color-tip' : '']">
|
||||
{{ item.start_date ? item.start_date : (item.value.placeholder_start || '开始日期') }}
|
||||
{{ item.start_date ? item.start_date : (item.value.placeholder_start || $lang('components.ns-newform.startDate')) }}
|
||||
</view>
|
||||
</view>
|
||||
</picker>
|
||||
@@ -184,7 +184,7 @@
|
||||
>
|
||||
<view class="picker-box">
|
||||
<view :class="['uni-input', !item.end_date ? 'color-tip' : '']">
|
||||
{{ item.end_date ? item.end_date : (item.value.placeholder_end || '结束日期') }}
|
||||
{{ item.end_date ? item.end_date : (item.value.placeholder_end || $lang('components.ns-newform.endDate')) }}
|
||||
</view>
|
||||
</view>
|
||||
</picker>
|
||||
@@ -207,7 +207,7 @@
|
||||
@change="bindTimeChange($event, index)"
|
||||
>
|
||||
<view :class="['uni-input', !item.val ? 'color-tip' : '']">
|
||||
{{ item.val ? item.val : (item.value.placeholder || '请选择时间') }}
|
||||
{{ item.val ? item.val : (item.value.placeholder || $lang('components.ns-newform.timePlaceholder')) }}
|
||||
</view>
|
||||
</picker>
|
||||
<text class="iconfont icon-right"></text>
|
||||
@@ -231,7 +231,7 @@
|
||||
>
|
||||
<view class="picker-box">
|
||||
<view :class="['uni-input', !item.start_time ? 'color-tip' : '']">
|
||||
{{ item.start_time ? item.start_time : (item.value.placeholder_start || '开始时间') }}
|
||||
{{ item.start_time ? item.start_time : (item.value.placeholder_start || $lang('components.ns-newform.startTime')) }}
|
||||
</view>
|
||||
</view>
|
||||
</picker>
|
||||
@@ -245,7 +245,7 @@
|
||||
>
|
||||
<view class="picker-box">
|
||||
<view :class="['uni-input', !item.end_time ? 'color-tip' : '']">
|
||||
{{ item.end_time ? item.end_time : (item.value.placeholder_end || '结束时间') }}
|
||||
{{ item.end_time ? item.end_time : (item.value.placeholder_end || $lang('components.ns-newform.endTime')) }}
|
||||
</view>
|
||||
</view>
|
||||
</picker>
|
||||
@@ -268,7 +268,7 @@
|
||||
@getRegions="handleGetRegions($event, index)"
|
||||
>
|
||||
<view :class="['select-address', !item.val ? 'empty' : '', !item.val ? 'color-tip' : '']">
|
||||
{{ item.val ? item.val : (item.value.placeholder || (item.value.default_type == 1 ? '请选择省市' : '请选择省市区')) }}
|
||||
{{ item.val ? item.val : (item.value.placeholder || (item.value.default_type == 1 ? $lang('components.ns-newform.selectProvinceCity') : $lang('components.ns-newform.selectProvinceCityDistrict'))) }}
|
||||
</view>
|
||||
</pick-regions>
|
||||
<text class="iconfont icon-right"></text>
|
||||
@@ -788,89 +788,89 @@ export default {
|
||||
|
||||
if (item.controller == 'Text') {
|
||||
if (item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请输入' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseInput', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.name == 'ID_CARD' && !/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(item.val)) {
|
||||
if (!item.value.required) {
|
||||
this.$util.showToast({ title: '身份证输入不合法' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.idCardInvalid') });
|
||||
return false;
|
||||
}
|
||||
if (item.val != '') {
|
||||
this.$util.showToast({ title: '身份证输入不合法' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.idCardInvalid') });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.name == 'MOBILE' && !this.$util.verifyMobile(item.val)) {
|
||||
if (!item.value.required) {
|
||||
this.$util.showToast({ title: '手机号输入不合法' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.mobileInvalid') });
|
||||
return false;
|
||||
}
|
||||
if (item.val != '') {
|
||||
this.$util.showToast({ title: '手机号输入不合法' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.mobileInvalid') });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item.controller == 'Textarea' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请输入' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseInput', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.controller == 'Select' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请选择' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelect', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.controller == 'Checkbox' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请至少选择一个' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelectAtLeastOne', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.controller == 'Img' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请至少上传一张' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseUploadAtLeastOne', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.controller == 'Date' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请选择' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelect', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.controller == 'Datelimit') {
|
||||
if (item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请选择' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelect', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.$util.timeTurnTimeStamp(item.start_date) > this.$util.timeTurnTimeStamp(item.end_date)) {
|
||||
this.$util.showToast({ title: '结束日期不能小于开始日期' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.endDateBeforeStartDate') });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.controller == 'Time' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请选择' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelect', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.controller == 'Timelimit') {
|
||||
if (item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请选择' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelect', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.start_time >= item.end_time) {
|
||||
this.$util.showToast({ title: '结束时间必须大于开始时间' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.endTimeBeforeStartTime') });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.controller == 'City' && item.value.required && !item.val) {
|
||||
this.$util.showToast({ title: '请选择' + item.value.title });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.pleaseSelect', { title: item.value.title }) });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -902,7 +902,7 @@ export default {
|
||||
if (res.length > 0) {
|
||||
res.forEach(function(img) {
|
||||
if (self.formData[index].img_lists.length >= Number(self.formData[index].value.max_count)) {
|
||||
self.$util.showToast({ title: '最多上传' + self.formData[index].value.max_count + '张图片' });
|
||||
self.$util.showToast({ title: self.$lang('components.ns-newform.maxUploadImages', { max: self.formData[index].value.max_count }) });
|
||||
return false;
|
||||
}
|
||||
self.formData[index].img_lists.push(img);
|
||||
@@ -916,7 +916,7 @@ export default {
|
||||
addImg(index) {
|
||||
let self = this;
|
||||
if (this.formData[index].img_lists.length >= Number(this.formData[index].value.max_count)) {
|
||||
this.$util.showToast({ title: '最多上传' + this.formData[index].value.max_count + '张图片' });
|
||||
this.$util.showToast({ title: this.$lang('components.ns-newform.maxUploadImages', { max: this.formData[index].value.max_count }) });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</scroll-view>
|
||||
<div class="appointed-day">
|
||||
<uni-datetime-picker type="date" :start="pickerStartDay" :end="pickerEndDay" @change="change">
|
||||
<text class="day-box">指定日期</text>
|
||||
<text class="day-box">{{ $lang('components.yuyueDate.appointedDate') }}</text>
|
||||
<text class="iconfont iconyoujiantou"></text>
|
||||
</uni-datetime-picker>
|
||||
</div>
|
||||
@@ -46,7 +46,7 @@
|
||||
<view class="item-box" :class="{ disable: item.disable || item.isInclude, active: item.time == timeQuanBegin || item.time == timeQuanEnd }" @click="handleSelectQuantum(_index, item)">
|
||||
<!-- :style="{ color: item.time == timeQuanBegin || item.time == timeQuanEnd ? selectedItemColor : '#333' }" -->
|
||||
<text>{{ item.time }}</text>
|
||||
<text class="all">{{ item.disable ? disableText : undisableText }}</text>
|
||||
<text class="all">{{ item.disable ? disableTextI18n : undisableTextI18n }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
@@ -173,7 +173,7 @@
|
||||
return {
|
||||
pickerStartDay: '', // 指定开始日期
|
||||
pickerEndDay: '', // 指定结束日期
|
||||
orderDateTime: '暂无选择', // 选中时间
|
||||
orderDateTime: '', // 选中时间
|
||||
orderTimeArr: {}, //多选的时间
|
||||
dateArr: [], //日期数据
|
||||
timeArr: [], //时间数据
|
||||
@@ -187,6 +187,18 @@
|
||||
timeQuanEnd: '' //时间段结束时间
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
disableTextI18n() {
|
||||
return this.disableText && this.disableText !== '已约满'
|
||||
? this.disableText
|
||||
: this.$lang('components.yuyueDate.fullyBooked');
|
||||
},
|
||||
undisableTextI18n() {
|
||||
return this.undisableText && this.undisableText !== '可预约'
|
||||
? this.undisableText
|
||||
: this.$lang('components.yuyueDate.available');
|
||||
},
|
||||
},
|
||||
created(props) {
|
||||
this.selectDate = this.nowDate = currentTime().date;
|
||||
this.pickerStartDay = currentTime().year + '-' + currentTime().date;
|
||||
@@ -213,7 +225,7 @@
|
||||
let index = new Date(e).getDay();
|
||||
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
|
||||
uni.showToast({
|
||||
title: weekBox[index] + '不可以预约',
|
||||
title: this.$lang('components.yuyueDate.weekdayCannotBook', { weekday: weekBox[index] }),
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
@@ -280,7 +292,7 @@
|
||||
this.isSection && (item.isInclude = false);
|
||||
});
|
||||
|
||||
this.orderDateTime = isFullTime ? '暂无选择' : this.selectDate;
|
||||
this.orderDateTime = isFullTime ? this.$lang('components.yuyueDate.noSelection') : this.selectDate;
|
||||
this.timeActive = -1;
|
||||
for (let i = 0, len = this.timeArr.length; i < len; i++) {
|
||||
if (!this.timeArr[i].disable) {
|
||||
@@ -301,7 +313,7 @@
|
||||
let index = new Date(item.timeStamp).getDay();
|
||||
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
|
||||
uni.showToast({
|
||||
title: weekBox[index] + '不可以预约',
|
||||
title: this.$lang('components.yuyueDate.weekdayCannotBook', { weekday: weekBox[index] }),
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user