更新起批量, 修复价格bug

This commit is contained in:
weipengfei 2024-06-18 09:12:16 +08:00
parent bb6210fd7a
commit 558b7a04ea
1 changed files with 138 additions and 131 deletions

View File

@ -14,11 +14,14 @@
</view>
<view class="row">
<view>商品价格</view>
<view>¥ {{datas.sell}}</view>
<view>¥ {{datas.price}}</view>
</view>
<view class="row">
<view>小计</view>
<view style="color: #F55726;">¥ {{subtotal}}</view>
<view style="color: #F55726;" v-if="+datas.cart_num<+datas.batch">
{{`${datas.batch}${datas.unit_name}起批`}}
</view>
<view style="color: #F55726;" v-else>¥ {{subtotal}}</view>
</view>
<view v-if="datas.is_bulk" class="row">
<view>购买重量<text style="color: #F55726;">*</text></view>
@ -70,8 +73,10 @@
cart_num: ''
});
const setData = (e) => {
console.log(e)
console.log(e);
datas.value = e;
if (e.batch) datas.value.cart_num = e.batch;
else datas.value.cart_num = '';
}
const emit = defineEmits(['close', 'change']);
@ -80,6 +85,8 @@
}
const change = () => {
if (+datas.value.cart_num < +datas.value.batch) return uni.$u.toast(
`购买数量不能小于${datas.value.cart_num}${datas.value.unit_name}`);
if (subtotal.value <= 0) {
uni.$u.toast('金额不可小于等于0');
datas.value.cart_num = '';