修改订单管理优惠金额计算,修复订单退款时客座费部分退款问题

This commit is contained in:
YeMingfei666 2024-11-20 18:25:37 +08:00
parent d9cf881b62
commit 9969251050
4 changed files with 180 additions and 85 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

@ -1,7 +1,13 @@
<template> <template>
<el-drawer title="订单详情" size="50%" :visible.sync="drawer" direction="rtl" v-loading="loading" > <el-drawer
title="订单详情"
size="50%"
:visible.sync="drawer"
direction="rtl"
v-loading="loading"
>
<div class="header"> <div class="header">
<div class="title" style="text-align: center;">收银订单</div> <div class="title" style="text-align: center">收银订单</div>
<div class="container"> <div class="container">
<div class="info_content"> <div class="info_content">
<div class="item"> <div class="item">
@ -72,15 +78,20 @@
<div class="row"> <div class="row">
<div>打包费{{ detail.packFee || "-" }}</div> <div>打包费{{ detail.packFee || "-" }}</div>
<div>订单原价{{ detail.originAmount }}</div> <div>订单原价{{ detail.originAmount }}</div>
<div>优惠金额{{ detail.userCouponAmount || "-" }}</div> <div>优惠金额{{ youHuiJinE }}</div>
<div> <div>
实收金额<span style="color: red;">{{ detail.payAmount }}</span> 实收金额<span style="color: red">{{ detail.payAmount }}</span>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div> <div>
退款金额{{ detail.refundAmount }} 退款金额{{ detail.refundAmount }}
<span style="color: #FF9731;cursor: pointer;" v-if="detail.isRefund" @click="type = '3'">退款详情></span> <span
style="color: #ff9731; cursor: pointer"
v-if="detail.isRefund"
@click="type = '3'"
>退款详情></span
>
</div> </div>
<div>支付方式{{ detail.payType }}</div> <div>支付方式{{ detail.payType }}</div>
</div> </div>
@ -100,20 +111,26 @@
</div> --> </div> -->
</div> </div>
<div> <div>
<div style="margin-bottom: 16px;font-size:16px;">商品信息</div> <div style="margin-bottom: 16px; font-size: 16px">商品信息</div>
<el-table :data="detail.detailList"> <el-table :data="detail.detailList">
<el-table-column label="商品"> <el-table-column label="商品">
<template v-slot="scope"> <template v-slot="scope">
<div class="shop_info"> <div class="shop_info">
<el-image v-if="scope.row.productSkuId!='-999'" :src="scope.row.productImg" style="width: 40px;height: 40px;"></el-image> <el-image
v-if="scope.row.productSkuId != '-999'"
:src="scope.row.productImg"
style="width: 40px; height: 40px"
></el-image>
<div class="packeFee" v-else> <div class="packeFee" v-else>
<span> <span>
{{ scope.row.productName ||'客座费'}} {{ scope.row.productName || "客座费" }}
</span> </span>
</div> </div>
<div class="info"> <div class="info">
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">{{ scope.row.productName }}</span> <span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">{{
<span style="color: #999;">{{ scope.row.productName
}}</span>
<span style="color: #999">{{
scope.row.productSkuName scope.row.productSkuName
}}</span> }}</span>
</div> </div>
@ -121,29 +138,37 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量"> <el-table-column label="数量">
<template v-slot="scope"> <template v-slot="scope"> x{{ scope.row.num }} </template>
x{{ scope.row.num }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="单价"> <el-table-column label="单价">
<template v-slot="scope"> <template v-slot="scope"> {{ scope.row.price }}/ </template>
{{ scope.row.price }}/
</template>
</el-table-column> </el-table-column>
<el-table-column label="小计"> <el-table-column label="小计">
<template v-slot="scope"> <template v-slot="scope"> {{ scope.row.priceAmount }} </template>
{{ scope.row.priceAmount }}
</template>
</el-table-column> </el-table-column>
<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="detail.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(scope.row)"
type="text"
size="mini"
@click="tuikuan(scope.row)"
><span>退款</span></el-button
>
<span class="color-999" v-if="isTui(scope.row)">已退款</span> <span class="color-999" v-if="isTui(scope.row)">已退款</span>
</template> </template>
<template v-if="scope.row.status=='unpaid'"> <template v-if="detail.status == 'unpaid'">
<el-button v-if="canTuicai(scope.row)" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button> <el-button
<span class="color-999" v-if="scope.row=='return'">已退菜</span> v-if="canTuicai(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>
</template> </template>
</el-table-column> </el-table-column>
@ -211,13 +236,13 @@
<!-- </el-tabs> --> <!-- </el-tabs> -->
</div> </div>
<return-cart <return-cart
:modal="false" :modal="false"
ref="refReturnCart" ref="refReturnCart"
:max="selGoods.num" :max="selGoods.num"
@confirm="refReturnCartConfirm" @confirm="refReturnCartConfirm"
></return-cart> ></return-cart>
<return-money <return-money
:modal="false" :modal="false"
ref="refReturnMoney" ref="refReturnMoney"
:max="selGoods.num" :max="selGoods.num"
:goods="selGoods" :goods="selGoods"
@ -232,12 +257,10 @@ import dayjs from "dayjs";
import { tbOrderInfoDetail, tbOrderInfoData } from "@/api/order"; import { tbOrderInfoDetail, tbOrderInfoData } from "@/api/order";
import returnCart from "@/views/tool/Instead/components/return-cart.vue"; import returnCart from "@/views/tool/Instead/components/return-cart.vue";
import returnMoney from "@/views/tool/Instead/components/return-money.vue"; import returnMoney from "@/views/tool/Instead/components/return-money.vue";
import { import { $returnCart, $returnOrder } from "@/api/table";
$returnCart,$returnOrder import * as $util from "../order_goods_util.js";
} from "@/api/table";
import * as $util from '../order_goods_util.js'
export default { export default {
components: { returnCart,returnMoney }, components: { returnCart, returnMoney },
data() { data() {
return { return {
@ -247,27 +270,27 @@ export default {
detail: "", detail: "",
loading: false, loading: false,
refoundList: [], refoundList: [],
selGoods:{num:1} selGoods: { num: 1 },
}; };
}, },
filters: { filters: {
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;
} else { } else {
return t; return t;
} }
}, },
sendTypeFilter(t) { sendTypeFilter(t) {
if (t) { if (t) {
return orderEnum.sendType.find(item => item.key == t).label; return orderEnum.sendType.find((item) => item.key == t).label;
} else { } else {
return t; return t;
} }
}, },
statusFilter(t) { statusFilter(t) {
if (t) { if (t) {
return t && orderEnum.status.find(item => item.key == t).label; return t && orderEnum.status.find((item) => item.key == t).label;
} else { } else {
return t; return t;
} }
@ -278,45 +301,85 @@ export default {
} else { } else {
return "-"; return "-";
} }
} },
}, },
watch:{ watch: {
drawer:function(newval){ drawer: function (newval) {
if(!newval){ if (!newval) {
this.close(); this.close();
} }
} },
},
computed: {
vipDiscountAmount() {
if (!this.detail.memberId) {
return 0;
}
if (this.detail.status == "unpaid") {
return this.detail.detailList
.filter((v) => !$util.isTui(v) && v.productId != "-999")
.reduce((prve, cur) => {
if (!cur.isMember) {
return prve + 0;
} else {
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price;
return prve + (cur.price - memberPrice) * cur.num;
}
}, 0)
.toFixed(2);
}
return 0
},
youHuiJinE() {
console.log(this.vipDiscountAmount);
const discountAmount=this.detail.discountAmount;
const calcDiscountAmount=(this.detail.originAmount*(1-this.detail.discountRatio)).toFixed(2);
console.log(this.detail.originAmount*(1-this.detail.discountRatio))
const n = $util.numSum([
this.vipDiscountAmount,
(discountAmount?discountAmount:calcDiscountAmount),
this.detail.productCouponDiscountAmount,
this.detail.fullCouponDiscountAmount,
this.detail.pointsDiscountAmount,
]);
if (n * 1 <= 0) {
return "-";
}
return n;
},
}, },
methods: { methods: {
close(){ close() {
console.log('drawer close') console.log("drawer close");
this.$emit('close'); this.$emit("close");
}, },
isTui(item){ isTui(item) {
return $util.isTui(item); return $util.isTui(item);
}, },
canTuikuan(item){ canTuikuan(item) {
return $util.canTuiKuan(this.detail,item); return $util.canTuiKuan(this.detail, item);
}, },
canTuicai(item){ canTuicai(item) {
return $util.canTuicai(this.detail,item); return $util.canTuicai(this.detail, item);
}, },
async refReturnMoneyConfirm(e){ async refReturnMoneyConfirm(e) {
const res = await $returnOrder({ const res = await $returnOrder({
...e, ...e,
orderId:this.detail.id, orderId: this.detail.id,
orderDetails:[{ orderDetails: [
id:this.selGoods.id, {
num:e.num id: this.selGoods.id,
}] num: e.num,
},
],
}); });
this.$message.success("退款成功"); this.$message.success("退款成功");
this.update(); this.update();
}, },
update(){ update() {
this.tbOrderInfoDetail(this.detail.id); this.tbOrderInfoDetail(this.detail.id);
}, },
async refReturnCartConfirm(e){ async refReturnCartConfirm(e) {
const res = await $returnCart({ const res = await $returnCart({
...e, ...e,
cartId: this.selGoods.cartId, cartId: this.selGoods.cartId,
@ -325,13 +388,13 @@ export default {
this.$message.success("退菜成功"); this.$message.success("退菜成功");
this.update(); this.update();
}, },
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);
}, },
tuiCai(item){ tuiCai(item) {
this.selGoods=item; this.selGoods = item;
console.log(item); console.log(item);
this.$refs.refReturnCart.open(item); this.$refs.refReturnCart.open(item);
}, },
@ -348,7 +411,7 @@ export default {
source: this.detail.id, source: this.detail.id,
page: 0, page: 0,
pageSize: 500, pageSize: 500,
orderType: "0" orderType: "0",
}); });
this.refoundList = res.content; this.refoundList = res.content;
} catch (error) { } catch (error) {
@ -371,23 +434,23 @@ export default {
this.type = "1"; this.type = "1";
this.detail = ""; this.detail = "";
this.tbOrderInfoDetail(obj.id); this.tbOrderInfoDetail(obj.id);
} },
} },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.packeFee{ .packeFee {
width: 40px; width: 40px;
box-sizing: border-box; box-sizing: border-box;
height: 40px; height: 40px;
background: #3f9eff; background: #3f9eff;
color: #fff; color: #fff;
font-size: 12px; font-size: 12px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
} }
.shop_info { .shop_info {
display: flex; display: flex;

View File

@ -12,10 +12,18 @@
<div class="u-flex color-999 u-m-t-4"> <div class="u-flex color-999 u-m-t-4">
{{ goods.productSkuName||'' }} {{ goods.productSkuName||'' }}
</div> </div>
<div class="flex u-row-between u-p-b-16 u-m-t-10 border-bottom"> <div class="u-p-b-16 border-bottom">
<span>退款数量</span> <div class="flex u-row-between">
<div class="u-flex"> <span>退款数量</span>
<number-box v-model="number" :min="1" :max="max"></number-box> <div class="u-flex" v-if="!isSeatFee">
<number-box v-model="number" :min="1" :max="max"></number-box>
</div>
<div class="u-flex" v-else>
{{ number }}
</div>
</div>
<div class="u-font-12 color-999 u-m-t-8" v-if="isSeatFee">
<div><span class="color-red">*</span><span>客座费只能全退</span> </div>
</div> </div>
</div> </div>
<div class="u-m-t-12 u-font-12 color-999">菜品已点数量 {{ max }} </div> <div class="u-m-t-12 u-font-12 color-999">菜品已点数量 {{ max }} </div>
@ -25,7 +33,7 @@
</div> </div>
<div class="u-flex u-m-t-12 "> <div class="u-flex u-m-t-12 ">
<span>退款金额</span> <span>退款金额</span>
<span class="color-red font-bold">{{ goods.price * number|to2 }}</span> <span class="color-red font-bold">{{ tuikuanJine }}</span>
</div> </div>
<div class="u-m-t-26"> <div class="u-m-t-26">
<div><span>退款原因</span> <span class="color-red">*</span></div> <div><span>退款原因</span> <span class="color-red">*</span></div>
@ -57,6 +65,8 @@
</template> </template>
<script> <script>
import numberBox from "./number-box.vue"; import numberBox from "./number-box.vue";
import {returnIsSeatFee} from '../util.js'
export default { export default {
components: { numberBox }, components: { numberBox },
props: { props: {
@ -64,12 +74,6 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
goods: {
type: Object,
default: () => {
return {};
},
},
max: { max: {
type: Number, type: Number,
default: 1, default: 1,
@ -87,8 +91,20 @@ export default {
{ label: "等待时间过长", checked: false }, { label: "等待时间过长", checked: false },
], ],
note: "", note: "",
goods:{
productId: -999
}
}; };
}, },
computed:{
tuikuanJine(){
const danjia=(this.goods.priceAmount||0)/this.goods.num
return (danjia*this.number).toFixed(2);
},
isSeatFee(){
return returnIsSeatFee(this.goods)
}
},
filters:{ filters:{
to2(val){ to2(val){
return val.toFixed(2); return val.toFixed(2);
@ -112,9 +128,15 @@ export default {
} }
this.note = tag + "," + this.note; this.note = tag + "," + this.note;
}, },
open(note) { open(item) {
this.goods = item?item:this.goods;
console.log(item)
this.show = true; this.show = true;
this.number = 1; if (item.productId != "-999") {
this.number = 1;
} else {
this.number = item.num;
}
}, },
close() { close() {
this.show = false; this.show = false;

View File

@ -2054,6 +2054,9 @@ 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)){
return ;
}
$setUser({ $setUser({
tableId: this.table.tableId, tableId: this.table.tableId,
masterId: this.masterId, masterId: this.masterId,
@ -4510,6 +4513,13 @@ input[type="number"]::-webkit-outer-spin-button {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
} }
::v-deep input[aria-hidden="true"] {
display: none !important;
}
::v-deep .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 {
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;