@@ -69,6 +69,12 @@
>
+
+
+ {{ scope.row.id }}
+
+
+
@@ -280,6 +286,7 @@ async function getcoup() {
let noUseGoodsCoupon = [];
let noUseDiscountCoupon = [];
+ console.log("orderPrice", orderPrice.value);
for (let i = 0; i < couponList.length; i++) {
const coupon = couponList[i];
const selCoupon =
@@ -289,7 +296,7 @@ async function getcoup() {
const canuseResult = UTILS.returnCouponCanUse({
canDikouGoodsArr,
coupon,
- orderPrice: orderPrice.value,
+ goodsOrderPrice: orderPrice.value,
user: props.user,
selCoupon,
shopInfo: shopUser.userInfo,
@@ -323,7 +330,7 @@ async function getcoup() {
v,
props.user,
orderPrice.value,
- quansSelArr.value,
+ quansSelArr.value.filter((v) => v.type != 2),
shopUser.userInfo
);
return {
@@ -339,7 +346,7 @@ async function getcoup() {
v,
props.user,
orderPrice.value,
- quansSelArr.value,
+ quansSelArr.value.filter((v) => v.type == 2),
shopUser.userInfo
);
return {
@@ -426,6 +433,15 @@ function updateSelCoupon() {
};
});
otherCoupon = otherCoupon.map((v) => {
+ const canuseResult = UTILS.returnCouponCanUse({
+ canDikouGoodsArr,
+ coupon: v,
+ orderPrice: orderPrice.value,
+ user: props.user,
+ selCoupon: goodsCoupon,
+ shopInfo: shopUser.userInfo,
+ });
+
const discount = UTILS.returnCouponDiscount(
canDikouGoodsArr,
v,
@@ -436,12 +452,35 @@ function updateSelCoupon() {
);
return {
...v,
+ canuseResult,
discount,
discountAmount: discount ? discount.discountPrice : v.discountAmount,
};
});
- couponSel.value = otherCoupon[0];
+ if (!otherCoupon[0].canuseResult.canUse) {
+ couponSel.value = { id: "" };
+ ElMessageBox.confirm(
+ `选择该券后优惠券${otherCoupon[0].name}不可用,不可用原因:${otherCoupon[0].canuseResult.reason}`,
+ "提示",
+ {
+ type: "warning",
+ showCancelButton: true,
+ cancelButtonText: "取消当前券的选择",
+ confirmButtonText: "剔除不可用的优惠券",
+ }
+ )
+ .then(() => {
+ couponSel.value = { id: "" };
+ goodsCouponSel.value = goodsCoupon[0];
+ })
+ .catch(() => {
+ goodsCouponSel.value = { id: "" };
+ couponSel.value = otherCoupon[0];
+ });
+ return;
+ }
goodsCouponSel.value = goodsCoupon[0];
+ couponSel.value = otherCoupon[0];
}
}