修改先付订单未支付显示已退款问题

This commit is contained in:
2024-11-13 09:45:36 +08:00
parent bbbe6275ee
commit f3df88236f
4 changed files with 59 additions and 25 deletions

View File

@@ -138,12 +138,12 @@
<el-table-column label="操作">
<template v-slot="scope">
<template v-if="scope.row.status!='unpaid'">
<el-button v-if="canTuikuan(scope.row)" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
<el-button v-if="canTuikuan(detail,scope.row)" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
<span class="color-999" v-else>已退款</span>
</template>
<template v-if="scope.row.status=='unpaid'">
<el-button v-if="canTuicai(scope.row)" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
<span class="color-999" v-else>已退菜</span>
<el-button v-if="canTuicai(detail,scope.row)" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
<span class="color-999" v-if="scope.row=='return'">已退菜</span>
</template>
</template>
</el-table-column>

View File

@@ -165,9 +165,9 @@
<script>
import { $activateByOrderId } from "@/api/table";
import {
returnProductCouponAllPrice,
returnProductCouponAllPrice,returnProductCoupon,
returnProductCouponPrice,
returnFullReductionCouponAllPrice,
returnFullReductionCouponAllPrice,returnNewGoodsList
} from "../util";
let $originFullReductionCoupon = [];
export default {
@@ -327,15 +327,15 @@ export default {
} else {
this.quansSelArr.unshift(row);
}
if(!this.fullReductionCouponSel.id){
return
if (!this.fullReductionCouponSel.id) {
return;
}
if (
this.orderPrice -
this.fullReductionCouponDiscount -
this.goodsDiscount <
this.fullReductionCouponSel.fullAmount
this.fullReductionCouponSel.fullAmount
) {
this.fullReductionCouponSel = { id: "" };
this.quansSelArr.splice(0, 1);
@@ -396,21 +396,16 @@ export default {
memberId: data.memberId,
});
quansRes.fullReductionCoupon = quansRes.fullReductionCoupon.filter(
(v) => this.orderPrice >= v.fullAmount
(v) => {
return this.orderPrice >= v.fullAmount && v.use;
}
);
const canDikouGoodsArr = returnNewGoodsList(this.goodsArr|| [])
$originFullReductionCoupon = quansRes.fullReductionCoupon;
this.quans.productCoupon = quansRes.productCoupon
.map((v) => {
return {
...v,
discountAmount: returnProductCouponPrice(
v,
this.goodsArr,
this.vipUser
),
};
})
.filter((v) => v.discountAmount > 0);
this.quans.productCoupon = quansRes.productCoupon.map(v=>{
const coup = returnProductCoupon(v, canDikouGoodsArr,this.vipUser)
return coup
}).filter(v=>v.use)
// this.quans = quans;
this.filterFullReductionCoupon();
this.quansSelArr = this.propSelCoup;

View File

@@ -639,6 +639,22 @@
>
退菜
</div>
<!-- <div
class="btn"
>
单品改价
</div>
<div
class="btn"
>
等叫
</div>
<div
class="btn no-wrap u-font-12"
>
取消全部等叫
</div> -->
<!-- <div
class="btn"
:class="{ disabled: order.old.list.length <= 0 }"

View File

@@ -139,8 +139,28 @@ export function returnNewGoodsList(arr) {
let goodsMap={}
return arr.filter(v => !isTui(v))
}
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
export function returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
if(!coup.use){
return false
}
const findGoods=goodsArr.filter(v=>v.productId==coup.proId)
if(!findGoods.length){
return false
}
const findGoodsTotalNumber=findGoods.reduce((prve,cur)=>{
return prve+cur.num*1
},0)
const selCoupNumber=selCoupArr.filter(v=>v.proId==coup.proId).reduce((prve,cur)=>{
return prve+cur.num*1
},0)
if(selCoupNumber>=findGoodsTotalNumber){
return false
}
return findGoodsTotalNumber<(coup.num+selCoupNumber)?false:true
}
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
export function returnProductCoupon(coup, goodsArr, vipUser) {
export function returnProductCoupon(coup, goodsArr, vipUser,selCoupArr=[]) {
const newGoodsArr = returnNewGoodsList(goodsArr)
const item = newGoodsArr.find(v => v.productId == coup.proId);
if(!item){
@@ -148,8 +168,11 @@ export function returnProductCoupon(coup, goodsArr, vipUser) {
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
const canUse=!v.use?false:(discountAmount>0)
return { ...coup, discountAmount: price,use:canUse}
const discountAmount=(price*coup.num).toFixed(2)
console.log(discountAmount);
const canUse=!coup.use?false:(discountAmount>0&&returnCoupCanUse(goodsArr,coup,selCoupArr))
// const canUse=discountAmount>0
return { ...coup, discountAmount: discountAmount,use:canUse}
}
/**