修改订单详情金额展示

This commit is contained in:
YeMingfei666 2024-11-23 17:44:21 +08:00
parent 862812caa3
commit 5076efee3a
7 changed files with 199 additions and 77 deletions

View File

@ -5,9 +5,9 @@ ENV = 'development'
# VUE_APP_BASE_API = 'http://192.168.2.42:8000' # VUE_APP_BASE_API = 'http://192.168.2.42:8000'
# VUE_APP_BASE_API = 'http://192.168.2.133:8000' # VUE_APP_BASE_API = 'http://192.168.2.133:8000'
# 测试 # 测试
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn' VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
#预发布 #预发布
VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn' # VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
# 生产 # 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn' # VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'

View File

@ -141,10 +141,25 @@
<template v-slot="scope"> x{{ scope.row.num }} </template> <template v-slot="scope"> x{{ scope.row.num }} </template>
</el-table-column> </el-table-column>
<el-table-column label="单价"> <el-table-column label="单价">
<template v-slot="scope"> {{ scope.row.price }}/ </template> <template v-slot="scope">
{{ scope.row.price }}
<!-- <template v-if="isUseCalcPrice(scope.row)">
<div class=""> {{ (scope.row.canReturnAmount / scope.row.num) |to2 }}</div>
<div class="line-th"> {{ scope.row.price }}</div>
</template>
<template v-else>
<div v-if="isShowGoodsVipPrice(scope.row)">
<div class="" > {{ scope.row.memberPrice }}</div>
<div class="line-th"> {{ scope.row.price }}</div>
</div>
<div v-else>
<div class="" > {{ scope.row.price }}</div>
</div>
</template> -->
</template>
</el-table-column> </el-table-column>
<el-table-column label="小计"> <el-table-column label="小计">
<template v-slot="scope"> {{ scope.row.priceAmount }} </template> <template v-slot="scope"> {{ scope.row.canReturnAmount }} </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template v-slot="scope"> <template v-slot="scope">
@ -274,6 +289,9 @@ export default {
}; };
}, },
filters: { filters: {
to2(n){
return Number(n).toFixed(2)
},
orderTypeFilter(t) { orderTypeFilter(t) {
if (t) { if (t) {
return t && orderEnum.orderType.find((item) => item.key == t).label; return t && orderEnum.orderType.find((item) => item.key == t).label;
@ -349,6 +367,12 @@ export default {
}, },
}, },
methods: { methods: {
isShowGoodsVipPrice(item){
return $util.isShowGoodsVipPrice(item);
},
isUseCalcPrice(item){
return $util.isUseCalcPrice(this.detail,item);
},
close() { close() {
console.log("drawer close"); console.log("drawer close");
this.$emit("close"); this.$emit("close");
@ -391,7 +415,7 @@ export default {
tuikuan(item) { tuikuan(item) {
this.selGoods = item; this.selGoods = item;
console.log(item); console.log(item);
this.$refs.refReturnMoney.open(item); this.$refs.refReturnMoney.open({...item,priceAmount:item.canReturnAmount});
}, },
tuiCai(item) { tuiCai(item) {
this.selGoods = item; this.selGoods = item;
@ -488,7 +512,9 @@ export default {
} }
} }
} }
.line-th{
text-decoration: line-through;
}
.container { .container {
padding: 0 20px; padding: 0 20px;
font-size: 14px; font-size: 14px;

View File

@ -18,7 +18,7 @@ export function canTuicai(orderInfo,item){
} }
export function canTuiKuan(orderInfo,item){ export function canTuiKuan(orderInfo,item){
// return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding' // return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
return orderInfo.status=='closed'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding' && !item.userCouponId return orderInfo.status=='closed'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
} }
export function isTui(item){ export function isTui(item){
return item.status=='return'||item.status=='refund'||item.status=='refunding' return item.status=='return'||item.status=='refund'||item.status=='refunding'
@ -29,3 +29,16 @@ export function numSum(arr){
},0) },0)
return (sum/100).toFixed(2) return (sum/100).toFixed(2)
} }
//是否使用计算的会员价
export function isUseCalcPrice(order,item){
console.log(order)
if(order.fullCouponDiscountAmount>0||order.pointsDiscountAmount>0){
return true
}else{
return false
}
}
//商品列表是否展示会员价
export function isShowGoodsVipPrice(item){
return item.isMember==1&&item.memberPrice&&item.memberPrice!=item.price
}

View File

@ -3,7 +3,7 @@
<div class="u-p-15"> <div class="u-p-15">
<div class="u-m-t-20"> <div class="u-m-t-20">
<el-form label-width="90px" label-position="left"> <el-form label-width="90px" label-position="left">
<el-form-item label="总价"> <el-form-item label="应付金额">
<div class="color-red u-font-18 font-600">{{ form.money }}</div> <div class="color-red u-font-18 font-600">{{ form.money }}</div>
<!-- <el-input :value="form.money" disabled> </el-input> --> <!-- <el-input :value="form.money" disabled> </el-input> -->
</el-form-item> </el-form-item>

View File

@ -286,11 +286,13 @@ export default {
// //
const arr = this.quans.productCoupon.filter((v) => v.proId == row.proId); const arr = this.quans.productCoupon.filter((v) => v.proId == row.proId);
const index = arr.findIndex((v) => v.id == row.id); const index = arr.findIndex((v) => v.id == row.id);
const item=this.goodsArr.find((v) => v.productId == row.proId);
if (index != -1) { if (index != -1) {
const n=returnProductCoupAllPrice( const n=returnProductCoupAllPrice(
$goodsPayPriceMap[row.proId], $goodsPayPriceMap[row.proId],
index, index,
row.num row.num,
item.isMember
) )
return (n*this.discount).toFixed(2); return (n*this.discount).toFixed(2);
} else { } else {
@ -385,7 +387,7 @@ export default {
.catch(() => {}); .catch(() => {});
} }
if (this.fullReductionCouponSel.fullAmount > payPrice) { if (this.fullReductionCouponSel.fullAmount > payPrice) {
this.$confirm( this.$confirm(
"选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券", "选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券",
"提示", "提示",
{ {
@ -399,7 +401,11 @@ export default {
id: "", id: "",
}; };
}) })
.catch(() => {}); .catch(() => {
item.checked=false
const index = this.quansSelArr.findIndex((v) => v.id == item.id);
this.quansSelArr.splice(index, 1);
});
} }
} }
item.checked = !item.checked; item.checked = !item.checked;
@ -441,7 +447,6 @@ export default {
async open(data, propSelCoup) { async open(data, propSelCoup) {
console.log(data); console.log(data);
this.orderPrice = data.orderPrice; this.orderPrice = data.orderPrice;
this.discount=data.discount||1
this.quansSelArr = [...propSelCoup]; this.quansSelArr = [...propSelCoup];
$goodsPayPriceMap = returnGoodsPayPriceMap(this.goodsArr || []); $goodsPayPriceMap = returnGoodsPayPriceMap(this.goodsArr || []);
if (data.memberId) { if (data.memberId) {

View File

@ -1065,16 +1065,11 @@
</div> </div>
<div class="detail_form_item"> <div class="detail_form_item">
<div class="left">积分抵扣</div> <div class="left">积分抵扣</div>
<div class="right">-{{ points.toMoney | to2 }}</div> <div class="right">-{{ pointsDiscountAmount | to2 }}</div>
</div> </div>
<div class="detail_form_item"> <div class="detail_form_item">
<div class="left">整单改价</div> <div class="left">整单改价</div>
<div class="right"> <div class="right">-{{ gaijia | to2 }}</div>
-{{
((1 - createOrder.discount) * createOrder.data.amount)
| to2
}}
</div>
</div> </div>
<div class="detail_form_item" v-if="createOrder.data.packFee"> <div class="detail_form_item" v-if="createOrder.data.packFee">
<div class="left">打包费</div> <div class="left">打包费</div>
@ -1718,6 +1713,22 @@ export default {
}; };
}, },
computed: { computed: {
pointsDiscountAmount() {
if (this.points.selected) {
return this.points.toMoney;
} else {
return 0;
}
},
gaijia() {
const disCountOriginPrice =
this.createOrder.data.amount - this.coupdiscount;
const disocunt = (1 - this.createOrder.discount) * disCountOriginPrice;
return disocunt.toFixed(2);
},
pointsCanDicountMoney() {
return (this.yinFuJinE - this.points.toMoney).toFixed(2);
},
isShowVipPrice() { isShowVipPrice() {
if (!this.shopInfo.isMemberPrice) { if (!this.shopInfo.isMemberPrice) {
return false; return false;
@ -1725,44 +1736,22 @@ export default {
return this.vipUser.isVip ? true : false; return this.vipUser.isVip ? true : false;
}, },
coupdiscount() { coupdiscount() {
return (this.createOrder.discount*returnCouponAllPrice( const n = this.quansSelArr.reduce((prve, cur) => {
this.quansSelArr, return prve + cur.discountAmount * 1;
this.createOrder.data.detailList || [], }, 0);
this.vipUser return n;
)).toFixed(2)
}, },
goodsDisCount() {
const goodsQuanArr = this.quansSelArr.filter((v) => v.type == 2);
let result = 0;
if (goodsQuanArr.length < 0) {
result = 0;
} else {
result = goodsQuanArr.reduce((a, b) => {
const item = this.createOrder.data.detailList.find(
(v) => v.productId == b.proId
);
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item
? this.vipUser.isVip
? memberPrice
: item.price
: 0;
return a + price;
}, 0);
}
return result.toFixed(2);
},
currentPayMoney() { currentPayMoney() {
const amount = this.createOrder.data.amount || 0; const amount = this.createOrder.data.amount || 0;
const discount = this.createOrder.discount || 1; const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney) // const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
const total = (amount) * this.createOrder.discount - this.coupdiscount; const total = amount - this.gaijia - this.coupdiscount;
return total <= 0 ? 0 : total; return total <= 0 ? 0 : total;
}, },
yinFuJinE() { yinFuJinE() {
const total = this.currentPayMoney - (this.points.toMoney || 0); const total =
console.log(total) this.currentPayMoney - (this.points.selected ? this.points.toMoney : 0);
console.log(total);
if (this.isCreateOrder) { if (this.isCreateOrder) {
return total.toFixed(2); return total.toFixed(2);
} else { } else {
@ -1886,13 +1875,20 @@ export default {
const seatFee = const seatFee =
this.order.seatFee.totalAmount * this.order.seatFee.totalAmount *
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1); (returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
// return (
// (oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
// this.createOrder.discount
// ).toFixed(2);
return ( return (
(oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) * oldPrice +
this.createOrder.discount price +
+packFee +
seatFee -
this.youhuiAllPrice
).toFixed(2); ).toFixed(2);
}, },
vipDiscountPrice() { vipDiscountPrice() {
if (!this.vipUser.isVip) { if (!this.vipUser.isVip || !this.shopInfo.isMemberPrice) {
return 0; return 0;
} }
const oldMemberPrice = this.order.old.list.reduce((a, b) => { const oldMemberPrice = this.order.old.list.reduce((a, b) => {
@ -1990,10 +1986,15 @@ export default {
this.goods.status = "loadmore"; this.goods.status = "loadmore";
this.getGoods(); this.getGoods();
}, },
pointsCanDicountMoney: function (newval) {
this.getCalcUsablePoints();
},
currentPayMoney: function (newval) { currentPayMoney: function (newval) {
if (this.createOrder.data.memberId || this.vipUser.id) { if (this.createOrder.data.memberId || this.vipUser.id) {
this.getCalcUsablePoints().then((res) => { this.getCalcUsablePoints().then((res) => {
this.pointsValueChange(this.points.value); if (this.points.selected) {
this.pointsValueChange(this.points.value);
}
}); });
} }
}, },
@ -2054,8 +2055,12 @@ export default {
if (this.order.status == "finish") { if (this.order.status == "finish") {
return; return;
} }
if(!this.table.tableId&&(this.order.list.length<=0&&this.order.old.list.length<=0)){ if (
return ; !this.table.tableId &&
this.order.list.length <= 0 &&
this.order.old.list.length <= 0
) {
return;
} }
$setUser({ $setUser({
tableId: this.table.tableId, tableId: this.table.tableId,
@ -2194,13 +2199,18 @@ export default {
// //
const arr = this.quansSelArr.filter((v) => v.proId == row.proId); const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
const index = arr.findIndex((v) => v.id == row.id); const index = arr.findIndex((v) => v.id == row.id);
const item = this.createOrder.data.detailList.find(
(v) => v.productId == row.proId
);
if (index != -1) { if (index != -1) {
const n=returnProductCoupAllPrice( const n = returnProductCoupAllPrice(
$goodsPayPriceMap[row.proId], $goodsPayPriceMap[row.proId],
index, index,
row.num row.num,
) item.isMember
return (n*this.createOrder.discount).toFixed(2); );
return (n * this.createOrder.discount).toFixed(2);
} else { } else {
return 0; return 0;
} }
@ -2213,6 +2223,13 @@ export default {
console.log(index); console.log(index);
if (index != -1) { if (index != -1) {
this.quansSelArr.splice(index, 1); this.quansSelArr.splice(index, 1);
this.quansSelArr
.map((v, index) => {
return {
...v,
discountAmount:v.type==2?this.returnProDiscount(v):v.discountAmount,
};
});
} }
}, },
async getCalcUsablePoints() { async getCalcUsablePoints() {
@ -2232,6 +2249,9 @@ export default {
this.vipUser.accountPoints, this.vipUser.accountPoints,
this.points.res.maxUsablePoints || 0 this.points.res.maxUsablePoints || 0
); );
if(!pointsRes.usable){
this.points.selected=false
}
} }
return pointsRes; return pointsRes;
}, },
@ -2266,13 +2286,21 @@ export default {
id: this.createOrder.data.id, id: this.createOrder.data.id,
memberId: this.createOrder.data.memberId || this.vipUser.id, memberId: this.createOrder.data.memberId || this.vipUser.id,
orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2), orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2),
discount:this.createOrder.discount discount: this.createOrder.discount,
}, },
[...this.quansSelArr] [...this.quansSelArr]
); );
}, },
quansConfirm(e, goodsPayPriceMap) { quansConfirm(e, goodsPayPriceMap) {
console.log(e); console.log(e);
this.createOrder.discount = 1;
this.points.selected = "";
e.map((v, index) => {
return {
...v,
discountAmount:v.type==2? this.returnProDiscount(v):v.discountAmount,
};
});
this.quansSelArr = [...e]; this.quansSelArr = [...e];
$goodsPayPriceMap = goodsPayPriceMap; $goodsPayPriceMap = goodsPayPriceMap;
}, },
@ -2320,7 +2348,7 @@ export default {
// return // return
// } // }
await this.returnCreateOrderData(); await this.returnCreateOrderData();
this.payBeforeClear(); // this.payBeforeClear();
// this.order.payType = ""; // this.order.payType = "";
}, },
async cashPayClick() { async cashPayClick() {
@ -2413,10 +2441,13 @@ export default {
if (!canJiesuan) { if (!canJiesuan) {
return; return;
} }
const order = await this.returnCreateOrderData(); if (!this.isCreateOrder) {
this.order.payType = "scanCode"; const order = await this.returnCreateOrderData();
this.payTypeItemClick({ payType: "scanCode", order }); this.order.payType = "scanCode";
this.payBeforeClear(); this.payTypeItemClick({ payType: "scanCode", order });
return;
}
this.payTypeItemClick({ payType: "scanCode" });
}, },
async changeOrderUseType(useType) { async changeOrderUseType(useType) {
if (useType && this.order.list.length) { if (useType && this.order.list.length) {
@ -2553,10 +2584,11 @@ export default {
}, },
//退 //退
async refReturnCartConfirm(e) { async refReturnCartConfirm(e) {
console.log(this.order.selGoods);
const res = await $returnCart({ const res = await $returnCart({
...e, ...e,
cartId: this.order.selGoods.cartId, cartId: this.isCreateOrder
? this.order.selGoods.id
: this.order.selGoods.cartId,
tableId: this.table.tableId, tableId: this.table.tableId,
}); });
this.order.selGoods.status = "return"; this.order.selGoods.status = "return";
@ -2675,14 +2707,41 @@ export default {
} }
}, },
ChangeDiscount(discount) { ChangeDiscount(discount) {
const fullCoupIndex = this.quansSelArr.findIndex((v) => v.type == 1);
const fullCoup = this.quansSelArr[fullCoupIndex];
this.createOrder.discount = discount; this.createOrder.discount = discount;
if (fullCoup && this.yinFuJinE < fullCoup.fullAmount) {
return this.$confirm(
"改价后价格不满足满减券最低满减需求" + fullCoup.fullAmount + "元",
"提示",
{
confirmButtonText: "删除满减券",
cancelButtonText: "取消改价",
type: "warning",
}
)
.then(() => {
this.quansSelArr.splice(fullCoupIndex, 1);
this.createOrder.discount = discount;
})
.catch((action) => {
this.createOrder.discount = 1;
this.$message({
type: "info",
message: "已取消改价",
});
});
}
}, },
async disCountShow() { async disCountShow() {
const canDiscount = await hasPermission("允许打折"); const canDiscount = await hasPermission("允许打折");
if (!canDiscount) { if (!canDiscount) {
return; return;
} }
const amount = this.createOrder.data.amount; const amount = (this.createOrder.data.amount - this.coupdiscount).toFixed(
2
);
console.log(amount);
this.refToggle("refDiscount", true, { this.refToggle("refDiscount", true, {
amount, amount,
discount: this.createOrder.discount * 100, discount: this.createOrder.discount * 100,
@ -4516,11 +4575,13 @@ input[type="number"]::-webkit-outer-spin-button {
font-weight: 600; font-weight: 600;
} }
::v-deep input[aria-hidden="true"] { ::v-deep input[aria-hidden="true"] {
display: none !important; display: none !important;
} }
::v-deep .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner { ::v-deep
box-shadow: none !important; .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
.el-radio__inner {
box-shadow: none !important;
} }
::v-deep .categorys .el-tag--plain.el-tag--info { ::v-deep .categorys .el-tag--plain.el-tag--info {

View File

@ -91,11 +91,12 @@ export function returnProductPayPrice(goods,vipUser){
return price return price
} }
//返回商品券抵扣的商品价格 //返回商品券抵扣的商品价格
export function returnProductCoupAllPrice(productPriceArr,startIndex,num){ export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMember=true){
console.log(productPriceArr);
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{ return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
let curPrice=0 let curPrice=0
if(typeof cur==='object'){ if(typeof cur==='object'){
curPrice=cur.memberPrice*1 curPrice=isMember?cur.memberPrice*1:cur.price
}else{ }else{
curPrice=cur*1 curPrice=cur*1
} }
@ -216,9 +217,9 @@ export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) { export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
return coupArr.map(v => { return coupArr.map(v => {
if (v.id == selCoup.id) { if (v.id == selCoup.id) {
return v return {...v,use:true}
} }
const isfullAmount = payPrice >= v.fullAmount * 1 const isfullAmount = payPrice*1 >= v.fullAmount * 1
if(payPrice<=0){ if(payPrice<=0){
return { return {
...v, ...v,
@ -229,5 +230,21 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
...v, ...v,
use: v.use && isfullAmount use: v.use && isfullAmount
} }
}) }).filter(v => v.use)
}
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
export function returnCanUseNumProductCoup(coupArr,){
let productCoup = coupArr.filter(v => v.type == 2)
//商品券分组
let coupMap={}
for(let i in productCoup){
const coup=productCoup[i]
if(coupMap.hasOwnProperty(coup.proId)){
coupMap[coup.proId].push(coup)
}else{
coupMap[coup.proId]=[coup]
}
}
return arr
} }