From 9c625a594be102cc3f42e5d0e1178238aa8c280b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=BD=A6=E7=A5=96?= <605893810@qq.com> Date: Tue, 9 Sep 2025 22:53:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B5=B7=E8=AE=A2=E5=80=8D=E6=95=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order_package/order_submit/order_submit.vue | 11 +++++++++-- pages/other_package/productInfo/productInfo.vue | 14 +++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/pages/order_package/order_submit/order_submit.vue b/pages/order_package/order_submit/order_submit.vue index cb09de0..fa7e080 100644 --- a/pages/order_package/order_submit/order_submit.vue +++ b/pages/order_package/order_submit/order_submit.vue @@ -496,7 +496,14 @@ export default { * @param {Object} index 需要修改的数据节点 */ async quantityFun(type, index, addIndex, pIndex) { + console.log("数量进行增加删除---",this.orderInfo,) + const data = this.orderInfo.shops[index].addrTimes[addIndex].goods[pIndex]; + + // 起订倍数 + const minBuyNum =data.minBuyNum || 1; // 起订倍数 + const step = Math.max(minBuyNum, 1); + let currentQuantity = Number(data.num);// 当前数量 let currentTotalPrice = Number(data.totalPrice);// 当前金额 let currentAmount = Number(this.orderInfo.amount);// 总金额 @@ -507,13 +514,13 @@ export default { message: "不能再减拉,不能小于最低购买数量~", }); } else { - currentQuantity = currentQuantity - 1; + currentQuantity = currentQuantity - step; currentAmount = currentAmount - data.unitPrice; currentTotalPrice = currentTotalPrice - data.unitPrice; } } else if (type === "add") { // 需要判断一下库存 - currentQuantity = currentQuantity + 1; + currentQuantity = currentQuantity + step; currentAmount = currentAmount + data.unitPrice; currentTotalPrice = currentTotalPrice + data.unitPrice; } diff --git a/pages/other_package/productInfo/productInfo.vue b/pages/other_package/productInfo/productInfo.vue index 8f6442f..07bb71e 100644 --- a/pages/other_package/productInfo/productInfo.vue +++ b/pages/other_package/productInfo/productInfo.vue @@ -158,7 +158,7 @@ :class="oItem.inventory === 0 ? 'item_Warp item_Warp_no_warp' : item.selectVal === oItem.n ? 'item_Warp item_Warp_yes_warp' : 'item_Warp'" v-for="(oItem, oIndex) in item.items" :key="oItem.n" - @click="clickSpecification(index, oItem)" + @click="clickSpecification(index,item, oItem)" > {{ oItem.n }} @@ -433,10 +433,13 @@ export default { } }, //改变规格的样式 - clickSpecification(pIndex, oItem) { - // if(oItem.inventory<=0){ - // return; - // } + clickSpecification(pIndex,item, oItem) { + console.log("改变规格的样式",item,oItem,this.specificationTempl) + + const currentSelectSpecification = this.specificationTempl.find(ele=>ele.combTypes == item.type && ele.combNames == oItem.n); + console.log("当前规格",currentSelectSpecification) + this.orderInfo.quantity = currentSelectSpecification?.minBuyNum || 1; + this.specificationList[pIndex].selectVal = oItem.n; // 计算规格的价格 this.selectSpecificationFun(pIndex, oItem); @@ -467,6 +470,7 @@ export default { quantityFun(type) { let currentQuantity = this.orderInfo.quantity; // 当前数量 const minBuyNum = this.selectSpecificationTempl.minBuyNum || 1; // 当前起订量,默认为1 + console.log(' 当前起订量,默认为1',currentQuantity,minBuyNum) // 确保起订量至少为1 const step = Math.max(minBuyNum, 1);