fix: 优惠券修改

This commit is contained in:
2025-09-28 13:26:39 +08:00
parent a82f116918
commit 0df2d7198f
6 changed files with 376 additions and 277 deletions

View File

@@ -77,7 +77,7 @@ const state = reactive({
show: false,
query: {
name: "",
isVip: 1,
// isVip: 1,
},
tableData: {
data: [],

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog width="700px" :title="title" v-model="show" top="20px" @close="reset">
<el-dialog width="900px" :title="title" v-model="show" top="20px" @close="reset">
<div class="u-p-15">
<div class="">
<el-tabs v-model="activeName" @tab-click="tabClick">
@@ -20,11 +20,16 @@
{{ UTILS.returnCoupType(scope.row) }}
</template>
</el-table-column>
<el-table-column prop="discountAmount" label="抵扣">
<el-table-column prop="discountAmount" label="抵扣" align="center">
<template v-slot="scope">
<span class="color-red">{{ scope.row.discountAmount }}</span>
</template>
</el-table-column>
<el-table-column prop="discountAmount" label="最大抵扣金额" align="center">
<template v-slot="scope">
<span class="color-red">{{ scope.row.maxDiscountAmount }}</span>
</template>
</el-table-column>
<el-table-column prop="discountAmount" label="限制" width="180">
<template v-slot="scope">
<div class="u-flex">
@@ -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();
}
);
</script>
<style lang="scss" scoped>