|
@@ -167,6 +167,7 @@
|
|
|
is_quota: 0,
|
|
is_quota: 0,
|
|
|
is_infinite: 0,
|
|
is_infinite: 0,
|
|
|
quota_num: 0,
|
|
quota_num: 0,
|
|
|
|
|
+ payNum: 0,
|
|
|
stock: 0,
|
|
stock: 0,
|
|
|
spec_key: '',
|
|
spec_key: '',
|
|
|
goods_spec_id: '',
|
|
goods_spec_id: '',
|
|
@@ -203,15 +204,15 @@
|
|
|
this.isAjax = false
|
|
this.isAjax = false
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- // 加
|
|
|
|
|
- ++this.popData.num;
|
|
|
|
|
- if (this.popData.is_infinite === 0 && this.popData.num > this.popData.stock) {
|
|
|
|
|
- tools.error('最多购买' + this.popData.quota_num + '件')
|
|
|
|
|
- this.popData.num = this.popData.stock
|
|
|
|
|
- } else if (this.popData.is_quota > 0 && this.popData.num > this.popData.quota_num) {
|
|
|
|
|
- tools.error('限购' + this.popData.quota_num + '件')
|
|
|
|
|
- this.popData.num = this.popData.quota_num
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (this.popData.is_infinite === 0 && this.popData.payNum > this.popData.stock) {
|
|
|
|
|
+ tools.error('最多购买' + this.popData.quota_num + '件')
|
|
|
|
|
+ } else if (this.popData.is_quota > 0 && this.popData.payNum > this.popData.quota_num) {
|
|
|
|
|
+ tools.error('限购' + this.popData.quota_num + '件')
|
|
|
|
|
+ }else {
|
|
|
|
|
+ // 加
|
|
|
|
|
+ ++this.popData.num;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -394,10 +395,6 @@
|
|
|
}
|
|
}
|
|
|
} else if (type === 2) {
|
|
} else if (type === 2) {
|
|
|
// 加
|
|
// 加
|
|
|
- console.log(item)
|
|
|
|
|
- console.log(item.is_infinite)
|
|
|
|
|
- console.log(item.num)
|
|
|
|
|
- console.log(item.stock)
|
|
|
|
|
if (item.is_infinite === 0 && item.num >= item.stock) {
|
|
if (item.is_infinite === 0 && item.num >= item.stock) {
|
|
|
tools.error('最多购买' + item.quota_num + '件')
|
|
tools.error('最多购买' + item.quota_num + '件')
|
|
|
this.isAjax = false
|
|
this.isAjax = false
|
|
@@ -410,9 +407,11 @@
|
|
|
|
|
|
|
|
} else if (type === 3) {
|
|
} else if (type === 3) {
|
|
|
// 选规格
|
|
// 选规格
|
|
|
|
|
+ console.log(item)
|
|
|
this.popData.is_quota = item.is_quota
|
|
this.popData.is_quota = item.is_quota
|
|
|
this.popData.quota_num = item.quota_num
|
|
this.popData.quota_num = item.quota_num
|
|
|
this.popData.is_infinite = item.is_infinite
|
|
this.popData.is_infinite = item.is_infinite
|
|
|
|
|
+ this.popData.payNum = item.num
|
|
|
this.popData.stock = item.stock
|
|
this.popData.stock = item.stock
|
|
|
this.getShopGoodsSpec(item)
|
|
this.getShopGoodsSpec(item)
|
|
|
} else {
|
|
} else {
|
|
@@ -420,19 +419,28 @@
|
|
|
console.log('this.popData.goods_spec_id')
|
|
console.log('this.popData.goods_spec_id')
|
|
|
console.log(this.popData.goods_spec_id)
|
|
console.log(this.popData.goods_spec_id)
|
|
|
if (this.popData.goods_spec_id) {
|
|
if (this.popData.goods_spec_id) {
|
|
|
- let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row
|
|
|
|
|
- .goods_spec_id)
|
|
|
|
|
- console.log(cartKey)
|
|
|
|
|
- let addType = this.popData.num > 0 ? 2 : 1
|
|
|
|
|
- console.log('addType:' + addType)
|
|
|
|
|
- if (addType === 2 && cartKey < 0) {
|
|
|
|
|
- this.setShopIngAdd(this.popData.goods_id, this.popData.goodsItem.category_id, this.popData
|
|
|
|
|
- .goods_spec_id, this.popData.num)
|
|
|
|
|
- } else {
|
|
|
|
|
- this.setShopIngNumber(this.popData.goods_id, this.popData.goodsItem.category_id, type, this
|
|
|
|
|
- .popData
|
|
|
|
|
- .goods_spec_id, this.popData.num)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (this.popData.is_infinite === 0 && this.popData.payNum > this.popData.stock) {
|
|
|
|
|
+ tools.error('最多购买' + this.popData.quota_num + '件')
|
|
|
|
|
+ this.popData.num = this.popData.stock
|
|
|
|
|
+ } else if (this.popData.is_quota > 0 && this.popData.payNum > this.popData.quota_num) {
|
|
|
|
|
+ tools.error('限购' + this.popData.quota_num + '件')
|
|
|
|
|
+ this.popData.num = this.popData.quota_num
|
|
|
|
|
+ }else {
|
|
|
|
|
+ let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row
|
|
|
|
|
+ .goods_spec_id)
|
|
|
|
|
+ console.log(cartKey)
|
|
|
|
|
+ let addType = this.popData.num > 0 ? 2 : 1
|
|
|
|
|
+ console.log('addType:' + addType)
|
|
|
|
|
+ if (addType === 2 && cartKey < 0) {
|
|
|
|
|
+ this.setShopIngAdd(this.popData.goods_id, this.popData.goodsItem.category_id, this.popData
|
|
|
|
|
+ .goods_spec_id, this.popData.num)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.setShopIngNumber(this.popData.goods_id, this.popData.goodsItem.category_id, type, this
|
|
|
|
|
+ .popData
|
|
|
|
|
+ .goods_spec_id, this.popData.num)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
} else {
|
|
} else {
|
|
|
console.log('无规格信息')
|
|
console.log('无规格信息')
|
|
|
}
|
|
}
|