@@ -385,7 +385,7 @@
},
setSub(item, type) {
let cartKey = this.cartData.goods_list.findIndex(row => row.goods_id === item.goods_id)
- if (type === 2 ) {
+ if (type === 2 && cartKey<0) {
this.setShopIngAdd(item.goods_id, item.category_id, '', 1,item)
} else {
this.setShopIngNumber(item.goods_id, item.category_id, type, '', 1,item)
@@ -401,10 +401,15 @@
'number': number,
}).then(res => {
this.isAjax = false
- if(item){
- ++item.num;
+ if(res.code===1){
+ if(item){
+ ++item.num;
+ }
+ this.getShopIngList()
+ }else {
+ tools.error(res.msg)
}
- this.getShopIngList()
+
}).catch(() => {
})
@@ -419,11 +424,22 @@
'operation': operation === 2 ? 1 : 2,
- --item.num;
+ this.isAjax = false
+ if(operation===2){
+ --item.num;
- this.isAjax = false