Fix:2585 【商城小程序】购物车--商品数量增减超出库存或少于最低拿货数时,增加提示“商品数量超出库存”和“商品数量不能减少了呦~”

This commit is contained in:
linxi
2024-11-29 10:13:30 +08:00
parent 952a332ba1
commit 9353aad39f
+12
View File
@@ -194,6 +194,7 @@
iconStyle="color: #fff"
class="num-step"
@change="e => changeNumHandle(index, gIndex, good, e)"
@overlimit="overlimit"
>
<template v-slot:minus>
<view class="v12-minus-btn v12-font-bold flex jc-center ai-center">
@@ -549,6 +550,7 @@ export default {
changeNumHandle(index, gIndex, good, e) {
const { type } = e
const value = good.cartNum + (type === 'plus' ? 1 : -1)
console.log('index', value);
const id = good.id
// uni.showLoading()
changeCartNum(id, value).then(res => {
@@ -563,6 +565,16 @@ export default {
}, 3000)
})
},
overlimit(e) {
const tip = {
'plus': '商品数量超出库存',
'minus': '商品数量不能减少了呦~'
}
uni.showToast({
title: tip[e],
icon: 'none'
})
},
handleIds() {
if (this.selectCount === 0) {
uni.showToast({