Fix:2585 【商城小程序】购物车--商品数量增减超出库存或少于最低拿货数时,增加提示“商品数量超出库存”和“商品数量不能减少了呦~”
This commit is contained in:
@@ -194,6 +194,7 @@
|
|||||||
iconStyle="color: #fff"
|
iconStyle="color: #fff"
|
||||||
class="num-step"
|
class="num-step"
|
||||||
@change="e => changeNumHandle(index, gIndex, good, e)"
|
@change="e => changeNumHandle(index, gIndex, good, e)"
|
||||||
|
@overlimit="overlimit"
|
||||||
>
|
>
|
||||||
<template v-slot:minus>
|
<template v-slot:minus>
|
||||||
<view class="v12-minus-btn v12-font-bold flex jc-center ai-center">
|
<view class="v12-minus-btn v12-font-bold flex jc-center ai-center">
|
||||||
@@ -549,6 +550,7 @@ export default {
|
|||||||
changeNumHandle(index, gIndex, good, e) {
|
changeNumHandle(index, gIndex, good, e) {
|
||||||
const { type } = e
|
const { type } = e
|
||||||
const value = good.cartNum + (type === 'plus' ? 1 : -1)
|
const value = good.cartNum + (type === 'plus' ? 1 : -1)
|
||||||
|
console.log('index', value);
|
||||||
const id = good.id
|
const id = good.id
|
||||||
// uni.showLoading()
|
// uni.showLoading()
|
||||||
changeCartNum(id, value).then(res => {
|
changeCartNum(id, value).then(res => {
|
||||||
@@ -563,6 +565,16 @@ export default {
|
|||||||
}, 3000)
|
}, 3000)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
overlimit(e) {
|
||||||
|
const tip = {
|
||||||
|
'plus': '商品数量超出库存',
|
||||||
|
'minus': '商品数量不能减少了呦~'
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: tip[e],
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
},
|
||||||
handleIds() {
|
handleIds() {
|
||||||
if (this.selectCount === 0) {
|
if (this.selectCount === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
Reference in New Issue
Block a user