|
@@ -505,6 +505,7 @@ export default {
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
submitIds: [],
|
|
submitIds: [],
|
|
|
|
+ checkenProsList:[],
|
|
popupShow: false,
|
|
popupShow: false,
|
|
popupShow0: false,
|
|
popupShow0: false,
|
|
popupShow1: false,
|
|
popupShow1: false,
|
|
@@ -518,7 +519,7 @@ export default {
|
|
source: 2
|
|
source: 2
|
|
},
|
|
},
|
|
productCouponList: [], // 优惠券弹窗列表
|
|
productCouponList: [], // 优惠券弹窗列表
|
|
- isCouponEmpty: false
|
|
|
|
|
|
+ isCouponEmpty: false,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -574,7 +575,9 @@ export default {
|
|
this.skeletonShow = true //预加载圆圈
|
|
this.skeletonShow = true //预加载圆圈
|
|
this.isCheckAll = false //是否全选
|
|
this.isCheckAll = false //是否全选
|
|
this.submitIds = []
|
|
this.submitIds = []
|
|
|
|
+ this.checkenProsList = []
|
|
this.couponPrice = 0
|
|
this.couponPrice = 0
|
|
|
|
+ this.reducedPrice = 0
|
|
this.totalDiscountAmount = 0
|
|
this.totalDiscountAmount = 0
|
|
this.isDiscount = false
|
|
this.isDiscount = false
|
|
this.eligibleCoupons = []
|
|
this.eligibleCoupons = []
|
|
@@ -677,11 +680,13 @@ export default {
|
|
if (pro.isChecked) {
|
|
if (pro.isChecked) {
|
|
if (!this.submitIds.includes(pro.productId * 1)) {
|
|
if (!this.submitIds.includes(pro.productId * 1)) {
|
|
this.submitIds.push(pro.productId)
|
|
this.submitIds.push(pro.productId)
|
|
|
|
+ this.checkenProsList.push(pro)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
var lent = this.submitIds.indexOf(pro.productId * 1)
|
|
var lent = this.submitIds.indexOf(pro.productId * 1)
|
|
if (lent >= 0) {
|
|
if (lent >= 0) {
|
|
this.submitIds.splice(lent, 1)
|
|
this.submitIds.splice(lent, 1)
|
|
|
|
+ this.checkenProsList.splice(lent, 1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.updateProductCheckedAllBtn(item)
|
|
this.updateProductCheckedAllBtn(item)
|
|
@@ -740,12 +745,14 @@ export default {
|
|
pros.isChecked = true
|
|
pros.isChecked = true
|
|
if (!this.submitIds.includes(pros.productId * 1)) {
|
|
if (!this.submitIds.includes(pros.productId * 1)) {
|
|
this.submitIds.push(pros.productId)
|
|
this.submitIds.push(pros.productId)
|
|
|
|
+ this.checkenProsList.push(pros)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
pros.isChecked = false
|
|
pros.isChecked = false
|
|
var lent = this.submitIds.indexOf(pros.productId * 1)
|
|
var lent = this.submitIds.indexOf(pros.productId * 1)
|
|
if (lent >= 0) {
|
|
if (lent >= 0) {
|
|
this.submitIds.splice(lent, 1)
|
|
this.submitIds.splice(lent, 1)
|
|
|
|
+ this.checkenProsList.splice(lent, 1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -792,7 +799,7 @@ export default {
|
|
})
|
|
})
|
|
if(item.promotions.discount == 1){// 支持促销叠加条件的店铺满减 执行
|
|
if(item.promotions.discount == 1){// 支持促销叠加条件的店铺满减 执行
|
|
prosDiscountNum = parseInt(prosPrice/item.promotions.touchPrice) // 店铺满减促销叠加次数 = 店铺合计价格/满减促销价格
|
|
prosDiscountNum = parseInt(prosPrice/item.promotions.touchPrice) // 店铺满减促销叠加次数 = 店铺合计价格/满减促销价格
|
|
- console.log('店铺满减促销叠加通道叠加次数',prosDiscountNum)
|
|
|
|
|
|
+ console.log('店铺满减促销叠加通道叠加次数',`${prosDiscountNum}次`)
|
|
if (prosPrice >= item.promotions.touchPrice) {// 满足店铺满减条件下执行
|
|
if (prosPrice >= item.promotions.touchPrice) {// 满足店铺满减条件下执行
|
|
item.totalPrice = prosPrice - item.promotions.reducedPrice*prosDiscountNum
|
|
item.totalPrice = prosPrice - item.promotions.reducedPrice*prosDiscountNum
|
|
item.reducedPrice = item.promotions.reducedPrice*prosDiscountNum
|
|
item.reducedPrice = item.promotions.reducedPrice*prosDiscountNum
|
|
@@ -802,7 +809,7 @@ export default {
|
|
item.totalPrice = prosPrice
|
|
item.totalPrice = prosPrice
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- console.log('店铺满减非促销叠加通道')
|
|
|
|
|
|
+ console.log('店铺满减促销非叠加通道')
|
|
if (prosPrice >= item.promotions.touchPrice) {// 满足店铺满减条件下执行
|
|
if (prosPrice >= item.promotions.touchPrice) {// 满足店铺满减条件下执行
|
|
item.totalPrice = prosPrice - item.promotions.reducedPrice
|
|
item.totalPrice = prosPrice - item.promotions.reducedPrice
|
|
item.reducedPrice = item.promotions.reducedPrice
|
|
item.reducedPrice = item.promotions.reducedPrice
|
|
@@ -816,18 +823,18 @@ export default {
|
|
//以下为计算除店铺满减以外的单品满减以及正常商品合计
|
|
//以下为计算除店铺满减以外的单品满减以及正常商品合计
|
|
let _totalPrice = 0
|
|
let _totalPrice = 0
|
|
let _reducedPrice = 0
|
|
let _reducedPrice = 0
|
|
- let _discountNum = 0
|
|
|
|
|
|
+ let discountNum = 0
|
|
let _totalOriginalPrice = 0
|
|
let _totalOriginalPrice = 0
|
|
item.cartList.forEach(pros => {
|
|
item.cartList.forEach(pros => {
|
|
let _price = pros.price * pros.number
|
|
let _price = pros.price * pros.number
|
|
_totalOriginalPrice += _price
|
|
_totalOriginalPrice += _price
|
|
if (pros.promotions && pros.promotions.type != 2 && pros.promotions.mode == 2) {
|
|
if (pros.promotions && pros.promotions.type != 2 && pros.promotions.mode == 2) {
|
|
if(pros.promotions.discount == 1){
|
|
if(pros.promotions.discount == 1){
|
|
- _discountNum = parseInt(_price/pros.promotions.touchPrice)
|
|
|
|
- console.log('单品满减促销叠加通道叠加次数',_discountNum)
|
|
|
|
|
|
+ discountNum = parseInt(_price/pros.promotions.touchPrice)
|
|
|
|
+ console.log('单品满减促销叠加通道叠加次数',`${discountNum}次`)
|
|
if (_price >= pros.promotions.touchPrice) {
|
|
if (_price >= pros.promotions.touchPrice) {
|
|
- _price = _price - pros.promotions.reducedPrice*_discountNum
|
|
|
|
- _reducedPrice += pros.promotions.reducedPrice*_discountNum
|
|
|
|
|
|
+ _price = _price - pros.promotions.reducedPrice*discountNum
|
|
|
|
+ _reducedPrice += pros.promotions.reducedPrice*discountNum
|
|
}
|
|
}
|
|
_totalPrice += _price
|
|
_totalPrice += _price
|
|
}else{
|
|
}else{
|
|
@@ -876,12 +883,12 @@ export default {
|
|
if (pros.promotions && pros.promotions.type * 1 === 1 && pros.promotions.mode * 1 === 2) {
|
|
if (pros.promotions && pros.promotions.type * 1 === 1 && pros.promotions.mode * 1 === 2) {
|
|
let _price = pros.price * pros.number
|
|
let _price = pros.price * pros.number
|
|
if(pros.promotions.discount == 1){
|
|
if(pros.promotions.discount == 1){
|
|
- let _discountNum = parseInt(_price/pros.promotions.touchPrice)
|
|
|
|
- console.log('单品满减促销叠加通道叠加次数',_discountNum)
|
|
|
|
|
|
+ let discountNum = parseInt(_price/pros.promotions.touchPrice)
|
|
|
|
+ console.log('单品满减促销叠加通道叠加次数',`${discountNum}次`)
|
|
// 单品满减-重新计算供应商总价/满减金额
|
|
// 单品满减-重新计算供应商总价/满减金额
|
|
if ( _price >= pros.promotions.touchPrice) {
|
|
if ( _price >= pros.promotions.touchPrice) {
|
|
- supplierPrice -= pros.promotions.reducedPrice*_discountNum
|
|
|
|
- supplierReducedPrice += pros.promotions.reducedPrice*_discountNum
|
|
|
|
|
|
+ supplierPrice -= pros.promotions.reducedPrice*discountNum
|
|
|
|
+ supplierReducedPrice += pros.promotions.reducedPrice*discountNum
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
console.log(' 单品满减非促销叠加通道')
|
|
console.log(' 单品满减非促销叠加通道')
|
|
@@ -898,7 +905,7 @@ export default {
|
|
if (item.promotions && item.promotions.mode * 1 === 2) {
|
|
if (item.promotions && item.promotions.mode * 1 === 2) {
|
|
if(item.promotions.discount == 1){// 支持促销叠加条件的店铺满减 执行
|
|
if(item.promotions.discount == 1){// 支持促销叠加条件的店铺满减 执行
|
|
let prosDiscountNum = parseInt(supplierPrice/item.promotions.touchPrice) // 店铺满减促销叠加次数 = 店铺合计价格/满减促销价格
|
|
let prosDiscountNum = parseInt(supplierPrice/item.promotions.touchPrice) // 店铺满减促销叠加次数 = 店铺合计价格/满减促销价格
|
|
- console.log('店铺满减促销叠加通道叠加次数',prosDiscountNum)
|
|
|
|
|
|
+ console.log('店铺满减促销叠加通道叠加次数',`${prosDiscountNum}次`)
|
|
if (supplierPrice >= item.promotions.touchPrice) {
|
|
if (supplierPrice >= item.promotions.touchPrice) {
|
|
supplierPrice -= item.promotions.reducedPrice*prosDiscountNum
|
|
supplierPrice -= item.promotions.reducedPrice*prosDiscountNum
|
|
supplierReducedPrice += item.promotions.reducedPrice*prosDiscountNum
|
|
supplierReducedPrice += item.promotions.reducedPrice*prosDiscountNum
|
|
@@ -924,16 +931,25 @@ export default {
|
|
this.promotionsList.forEach(promotions => {
|
|
this.promotionsList.forEach(promotions => {
|
|
// 凑单满减
|
|
// 凑单满减
|
|
if (promotions.mode === 2 && promotions.type === 2) {
|
|
if (promotions.mode === 2 && promotions.type === 2) {
|
|
- let total = 0
|
|
|
|
|
|
+ let collecTotal = 0
|
|
|
|
+ let collecDiscountNum = 0
|
|
promotions.productList.forEach(pros => {
|
|
promotions.productList.forEach(pros => {
|
|
- if (this.submitIds.includes(pros.productId * 1)) {
|
|
|
|
- total += pros.number * pros.price
|
|
|
|
- }
|
|
|
|
|
|
+ collecTotal += this.collecTotalPrice(pros)
|
|
})
|
|
})
|
|
- if (total >= promotions.touchPrice) {
|
|
|
|
- totalPrice -= promotions.reducedPrice
|
|
|
|
- reducedPrice += promotions.reducedPrice
|
|
|
|
- }
|
|
|
|
|
|
+ if(promotions.discount == 1){// 支持凑单满减促销叠加条件的执行
|
|
|
|
+ collecDiscountNum += parseInt(collecTotal/promotions.touchPrice) // 凑单满减促销叠加次数 = 凑单商品合计价格/凑单满减促销价格
|
|
|
|
+ console.log('凑单促销满减叠加通道叠加次数',`${collecDiscountNum}次`)
|
|
|
|
+ if (collecTotal >= promotions.touchPrice) {
|
|
|
|
+ totalPrice -= promotions.reducedPrice*collecDiscountNum
|
|
|
|
+ reducedPrice += promotions.reducedPrice*collecDiscountNum
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ console.log('凑单促销满减非叠加通道')
|
|
|
|
+ if (collecTotal >= promotions.touchPrice) {
|
|
|
|
+ totalPrice -= promotions.reducedPrice
|
|
|
|
+ reducedPrice += promotions.reducedPrice
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
// 最后勾选的超级会员优惠价
|
|
// 最后勾选的超级会员优惠价
|
|
@@ -944,9 +960,9 @@ export default {
|
|
this.reducedPrice = reducedPrice
|
|
this.reducedPrice = reducedPrice
|
|
// 最终合计价格 = 店铺满减合计 + 单品满减 + 正常合计 + 凑单满减
|
|
// 最终合计价格 = 店铺满减合计 + 单品满减 + 正常合计 + 凑单满减
|
|
this.allPrice = totalPrice
|
|
this.allPrice = totalPrice
|
|
- console.log('最后统计商品原价', this.totalOriginalPrice)
|
|
|
|
- console.log('最后满减金额', this.reducedPrice)
|
|
|
|
- console.log('最终合计价格', this.allPrice)
|
|
|
|
|
|
+ console.log('最后统计商品原价', `${this.totalOriginalPrice}元`)
|
|
|
|
+ console.log('最后满减金额', `${this.reducedPrice}元`)
|
|
|
|
+ console.log('最终合计价格', `${this.allPrice}元`)
|
|
// 计算优惠券
|
|
// 计算优惠券
|
|
if (this.totalCouponList.length > 0) {
|
|
if (this.totalCouponList.length > 0) {
|
|
let eligibleCoupons = this.calculationCoupon()
|
|
let eligibleCoupons = this.calculationCoupon()
|
|
@@ -960,13 +976,18 @@ export default {
|
|
}
|
|
}
|
|
// 最终优惠金额 = 促销优惠金额 + 优惠券优惠金额 + 超级会员优惠金额
|
|
// 最终优惠金额 = 促销优惠金额 + 优惠券优惠金额 + 超级会员优惠金额
|
|
this.totalDiscountAmount = this.reducedPrice + this.couponPrice + this.svipReducedPrice
|
|
this.totalDiscountAmount = this.reducedPrice + this.couponPrice + this.svipReducedPrice
|
|
- console.log('最终优惠金额', this.totalDiscountAmount)
|
|
|
|
|
|
+ console.log('最终优惠金额', `${this.totalDiscountAmount}元`)
|
|
// 控制显示优惠明细
|
|
// 控制显示优惠明细
|
|
- if (this.totalDiscountAmount > 0) {
|
|
|
|
- this.isDiscount = true
|
|
|
|
- } else {
|
|
|
|
- this.isDiscount = false
|
|
|
|
- }
|
|
|
|
|
|
+ this.isDiscount = this.totalDiscountAmount > 0 ? true : false
|
|
|
|
+ },
|
|
|
|
+ collecTotalPrice(pros){// 凑单满减计算勾选的凑单商品总价
|
|
|
|
+ let price
|
|
|
|
+ this.checkenProsList.find(el => {
|
|
|
|
+ if(pros.productId == el.productId ){
|
|
|
|
+ price = el.number * el.price
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return price
|
|
},
|
|
},
|
|
totalCount() {
|
|
totalCount() {
|
|
//计算总数量
|
|
//计算总数量
|