feat: 起订倍数修改
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user