From cf23ffbbfec320ef61a861081eb5bd9a6bdef37c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 18 Jun 2023 20:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=99=90=E8=B4=AD=E3=80=81?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9A=84=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/productWindow/index.vue | 13 ++----- .../goods_combination_details/index.vue | 37 +++++++++--------- .../goods_combination_status/index.vue | 28 ++++++------- pages/activity/goods_seckill/index.vue | 1 - .../activity/goods_seckill_details/index.vue | 39 +++++++++---------- 5 files changed, 54 insertions(+), 64 deletions(-) diff --git a/components/productWindow/index.vue b/components/productWindow/index.vue index 445dc350..e9732906 100644 --- a/components/productWindow/index.vue +++ b/components/productWindow/index.vue @@ -13,7 +13,7 @@ {{ fen2yuan(attr.productSelect.price) }} 库存: {{ attr.productSelect.stock }} - 限量: {{ attr.productSelect.quota }} + 限购: {{ attr.productSelect.limitCount }} @@ -48,8 +48,7 @@ + = attr.productSelect.stock) || (attr.productSelect.cart_num >= attr.productSelect.limitCount) ? "on":""' @click='CartNumAdd'>+ @@ -57,10 +56,10 @@ - 我要参团 已售罄 + v-else-if="iSbnt && attr.productSelect.stock <= 0">已售罄 确定 @@ -79,10 +78,6 @@ type: Object, default: () => {} }, - limitNum: { // 是否展示限售 - type: Number, - value: 0 - }, isShow: { // 是否展示库存 type: Number, value: 0 diff --git a/pages/activity/goods_combination_details/index.vue b/pages/activity/goods_combination_details/index.vue index 00b57b22..4b8ab28c 100644 --- a/pages/activity/goods_combination_details/index.vue +++ b/pages/activity/goods_combination_details/index.vue @@ -65,7 +65,7 @@ - + @@ -176,11 +176,11 @@ 单独购买 未开始 - + 单独购买 立即购买 - + 单独购买 已售罄 @@ -197,7 +197,6 @@ product.skuId === sku.id); if (product) { sku.price = product.combinationPrice; - sku.quota = product.quota; - sku.limitCount = product.limitCount; } else { // 找不到可能是没配置,则不能发起拼团 - sku.quota = 0; - sku.limitCount = 0; + sku.stock = 0; + } + // 设置限购数量 + if (this.activity.totalLimitCount > 0 && this.activity.singleLimitCount > 0) { + sku.limitCount = Math.min(this.activity.totalLimitCount, this.activity.singleLimitCount); + } else if (this.activity.totalLimitCount > 0) { + sku.limitCount = this.activity.totalLimitCount; + } else if (this.activity.singleLimitCount > 0) { + sku.limitCount = this.activity.singleLimitCount; } }); @@ -598,9 +601,7 @@ this.$set(this.attr.productSelect, "price", sku.price); this.$set(this.attr.productSelect, "stock", sku.stock); this.$set(this.attr.productSelect, "cart_num", 1); - // 拼团活动特有字段 - this.$set(this.attr.productSelect, "quota", sku.quota); - this.$set(this.attr.productSelect, "limitCount", sku.limitCount); + this.$set(this.attr.productSelect, "limitCount", sku.limitCount); // 拼团活动特有字段 this.$set(this, "attrValue", skuKey.join(",")); }, /** @@ -632,7 +633,6 @@ this.$set(this.attr.productSelect, "picUrl", sku.picUrl); this.$set(this.attr.productSelect, "price", sku.price); this.$set(this.attr.productSelect, "stock", sku.stock); - this.$set(this.attr.productSelect, "quota", sku.quota); this.$set(this.attr.productSelect, "limitCount", sku.limitCount); this.$set(this.attr.productSelect, "cart_num", 1); // SKU 关联属性 @@ -654,17 +654,16 @@ // 设置数量 let stock = sku.stock || 0; - let quota = sku.quota || 0; let limitCount = sku.limitCount; if (changeValue) { sku.cart_num++; - if (limitCount !== undefined && sku.cart_num > limitCount) { + if (limitCount > 0 && sku.cart_num > limitCount) { this.$set(this.attr.productSelect, "cart_num", limitCount); this.$util.Tips({ title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}` }); - } else if (sku.cart_num > stock || sku.cart_num > quota) { - this.$set(this.attr.productSelect, "cart_num", Math.min(stock, quota)); + } else if (sku.cart_num > stock) { + this.$set(this.attr.productSelect, "cart_num", stock); } } else { sku.cart_num--; @@ -682,7 +681,7 @@ // 判断是否超限购 let sku = this.attr.productSelect; let limitCount = sku.limitCount; - if (limitCount !== undefined && number > limitCount) { + if (limitCount > 0 && number > limitCount) { this.$set(this.attr.productSelect, "cart_num", limitCount); this.$util.Tips({ title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}` @@ -1076,7 +1075,7 @@ const query = wx.createSelectorQuery().in(this); const idView = "#past" + i; query.select(idView).boundingClientRect(); - query.exec(function(res) { + query.exec(res => { const top = res[0].top; const height = res[0].height; topArr.push(top); diff --git a/pages/activity/goods_combination_status/index.vue b/pages/activity/goods_combination_status/index.vue index 990800b2..8e93c577 100644 --- a/pages/activity/goods_combination_status/index.vue +++ b/pages/activity/goods_combination_status/index.vue @@ -111,7 +111,6 @@ product.skuId === sku.id); if (product) { sku.price = product.combinationPrice; - sku.quota = product.quota; - sku.limitCount = product.limitCount; } else { // 找不到可能是没配置,则不能发起拼团 - sku.quota = 0; - sku.limitCount = 0; + sku.stock = 0; + } + // 设置限购数量 + if (this.activity.totalLimitCount > 0 && this.activity.singleLimitCount > 0) { + sku.limitCount = Math.min(this.activity.totalLimitCount, this.activity.singleLimitCount); + } else if (this.activity.totalLimitCount > 0) { + sku.limitCount = this.activity.totalLimitCount; + } else if (this.activity.singleLimitCount > 0) { + sku.limitCount = this.activity.singleLimitCount; } }); @@ -402,9 +406,7 @@ this.$set(this.attr.productSelect, "price", sku.price); this.$set(this.attr.productSelect, "stock", sku.stock); this.$set(this.attr.productSelect, "cart_num", 1); - // 拼团活动特有字段 - this.$set(this.attr.productSelect, "quota", sku.quota); - this.$set(this.attr.productSelect, "limitCount", sku.limitCount); + this.$set(this.attr.productSelect, "limitCount", sku.limitCount); // 拼团活动特有字段 this.$set(this, "attrValue", skuKey.join(",")); }, /** @@ -436,7 +438,6 @@ this.$set(this.attr.productSelect, "picUrl", sku.picUrl); this.$set(this.attr.productSelect, "price", sku.price); this.$set(this.attr.productSelect, "stock", sku.stock); - this.$set(this.attr.productSelect, "quota", sku.quota); this.$set(this.attr.productSelect, "limitCount", sku.limitCount); this.$set(this.attr.productSelect, "cart_num", 1); // SKU 关联属性 @@ -458,17 +459,16 @@ // 设置数量 let stock = sku.stock || 0; - let quota = sku.quota || 0; let limitCount = sku.limitCount; if (changeValue) { sku.cart_num++; - if (limitCount !== undefined && sku.cart_num > limitCount) { + if (limitCount > 0 && sku.cart_num > limitCount) { this.$set(this.attr.productSelect, "cart_num", limitCount); this.$util.Tips({ title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}` }); - } else if (sku.cart_num > stock || sku.cart_num > quota) { - this.$set(this.attr.productSelect, "cart_num", Math.min(stock, quota)); + } else if (sku.cart_num > stock) { + this.$set(this.attr.productSelect, "cart_num", stock); } } else { sku.cart_num--; @@ -487,7 +487,7 @@ // 判断是否超限购 let sku = this.attr.productSelect; let limitCount = sku.limitCount; - if (limitCount !== undefined && number > limitCount) { + if (limitCount > 0 && number > limitCount) { this.$set(this.attr.productSelect, "cart_num", limitCount); this.$util.Tips({ title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}` diff --git a/pages/activity/goods_seckill/index.vue b/pages/activity/goods_seckill/index.vue index 4a1bb152..47f2af7c 100644 --- a/pages/activity/goods_seckill/index.vue +++ b/pages/activity/goods_seckill/index.vue @@ -183,7 +183,6 @@ } } -