@@ -255,10 +260,22 @@ async function getcoup() {
quans.value.coupon = res
.filter((v) => v.type != 2)
.filter((coupon) => {
- return UTILS.returnCouponCanUse(canDikouGoodsArr, coupon, orderPrice.value, props.user);
+ return UTILS.returnCouponCanUse({
+ canDikouGoodsArr,
+ coupon,
+ orderPrice: orderPrice.value,
+ user: props.user,
+ selCoupon: quansSelArr.value,
+ });
})
.map((v) => {
- const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, props.user);
+ const discount = UTILS.returnCouponDiscount(
+ canDikouGoodsArr,
+ v,
+ props.user,
+ orderPrice.value,
+ quansSelArr.value
+ );
return {
...v,
discount,
@@ -268,11 +285,23 @@ async function getcoup() {
quans.value.productCoupon = res
.filter((v) => v.type == 2)
.filter((coupon) => {
- return UTILS.returnCouponCanUse(canDikouGoodsArr, coupon, orderPrice.value, props.user);
+ return UTILS.returnCouponCanUse({
+ canDikouGoodsArr,
+ coupon,
+ orderPrice: orderPrice.value,
+ user: props.user,
+ selCoupon: [],
+ });
})
.map((v) => {
const findGoods = goodsArr.find((goods) => goods.productId == v.proId);
- const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, props.user);
+ const discount = UTILS.returnCouponDiscount(
+ canDikouGoodsArr,
+ v,
+ props.user,
+ orderPrice.value,
+ []
+ );
return {
...v,
productImg: findGoods ? findGoods.productImg : "",
@@ -320,6 +349,19 @@ defineExpose({
close,
open,
});
+
+watch(
+ () => activeName.value,
+ () => {
+ getcoup();
+ }
+);
+watch(
+ () => quansSelArr.value,
+ () => {
+ getcoup();
+ }
+);