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

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="操作"> <el-table-column label="操作">
<template v-slot="scope"> <template v-slot="scope">
<template v-if="scope.row.status!='unpaid'"> <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> <span class="color-999" v-else>已退款</span>
</template> </template>
<template v-if="scope.row.status=='unpaid'"> <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> <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-else>已退菜</span> <span class="color-999" v-if="scope.row=='return'">已退菜</span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>

View File

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

View File

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

View File

@@ -139,8 +139,28 @@ export function returnNewGoodsList(arr) {
let goodsMap={} let goodsMap={}
return arr.filter(v => !isTui(v)) 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 newGoodsArr = returnNewGoodsList(goodsArr)
const item = newGoodsArr.find(v => v.productId == coup.proId); const item = newGoodsArr.find(v => v.productId == coup.proId);
if(!item){ if(!item){
@@ -148,8 +168,11 @@ export function returnProductCoupon(coup, goodsArr, vipUser) {
} }
const memberPrice = item.memberPrice ? item.memberPrice : item.price; const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0; const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
const canUse=!v.use?false:(discountAmount>0) const discountAmount=(price*coup.num).toFixed(2)
return { ...coup, discountAmount: price,use:canUse} console.log(discountAmount);
const canUse=!coup.use?false:(discountAmount>0&&returnCoupCanUse(goodsArr,coup,selCoupArr))
// const canUse=discountAmount>0
return { ...coup, discountAmount: discountAmount,use:canUse}
} }
/** /**