|
@@ -42,7 +42,8 @@
|
|
uniPopup,
|
|
uniPopup,
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
- console.log(this.pData);
|
|
|
|
|
|
+ console.log('this.pData',JSON.parse(JSON.stringify(this.pData)));
|
|
|
|
+ if(this.pData.product.stock>0){this.total = 1};
|
|
},
|
|
},
|
|
props:{
|
|
props:{
|
|
visible: {
|
|
visible: {
|
|
@@ -59,7 +60,7 @@
|
|
loading:false,
|
|
loading:false,
|
|
loadStatus:'loading',
|
|
loadStatus:'loading',
|
|
min:1,
|
|
min:1,
|
|
- total:1,
|
|
|
|
|
|
+ total:0,
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -80,6 +81,10 @@
|
|
this.total = 1
|
|
this.total = 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(this.total>=this.pData.product.stock){
|
|
|
|
+ this.$api.msg('超出最大库存');
|
|
|
|
+ this.total = this.pData.product.stock;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//数量计算
|
|
//数量计算
|
|
calcValue(type,total){
|
|
calcValue(type,total){
|
|
@@ -89,10 +94,19 @@
|
|
this.total = 1
|
|
this.total = 1
|
|
}
|
|
}
|
|
} else if (type === "add") {
|
|
} else if (type === "add") {
|
|
|
|
+ // console.log('total',total);
|
|
|
|
+ if(total>=this.pData.product.stock){
|
|
|
|
+ this.$api.msg('超出最大库存');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
this.total++;
|
|
this.total++;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
submit(){
|
|
submit(){
|
|
|
|
+ if(this.total<=0){
|
|
|
|
+ this.$api.msg('商品数量不能小于1');
|
|
|
|
+ return;
|
|
|
|
+ };
|
|
this.$emit('closeModal',true)
|
|
this.$emit('closeModal',true)
|
|
bus.$emit('toDetailPage', {
|
|
bus.$emit('toDetailPage', {
|
|
data: {
|
|
data: {
|