feat: 代客下单修改退款退菜
This commit is contained in:
parent
ef358f33bb
commit
d7ab9c3627
|
|
@ -165,7 +165,8 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
const discount_sale_amount = cur.discount_sale_amount * 1 || 0
|
const discount_sale_amount = cur.discount_sale_amount * 1 || 0
|
||||||
const memberPrice = cur.skuData ? (cur.skuData.memberPrice || cur.skuData.salePrice) : 0
|
const memberPrice = cur.skuData ? (cur.skuData.memberPrice || cur.skuData.salePrice) : 0
|
||||||
const price = (discount_sale_amount || cur.salePrice || 0)
|
const price = (discount_sale_amount || cur.salePrice || 0)
|
||||||
return prve + cur.number * (discount_sale_amount || (useVipPrice.value ? memberPrice : price))
|
const number = (cur.number - cur.returnNum)
|
||||||
|
return prve + (number <= 0 ? 0 : number) * (discount_sale_amount || (useVipPrice.value ? memberPrice : price))
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
return total
|
return total
|
||||||
|
|
@ -392,6 +393,7 @@ export const useCartsStore = defineStore("carts", () => {
|
||||||
newData[i] = data[i].map((v: any) => {
|
newData[i] = data[i].map((v: any) => {
|
||||||
const skuData = getProductDetails({ product_id: v.productId, sku_id: v.skuId })
|
const skuData = getProductDetails({ product_id: v.productId, sku_id: v.skuId })
|
||||||
return {
|
return {
|
||||||
|
...v,
|
||||||
...skuData,
|
...skuData,
|
||||||
placeNum: v.placeNum,
|
placeNum: v.placeNum,
|
||||||
number: v.num,
|
number: v.num,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="da" v-if="item.is_print || item.is_print === null">打</span>
|
<span class="da" v-if="item.is_print || item.is_print === null">打</span>
|
||||||
<span class="isWaitCall" v-if="item.is_wait_call">等</span>
|
<span class="isWaitCall" v-if="item.is_wait_call">等</span>
|
||||||
<span class="tui" v-if="item.status === 'return'">退</span>
|
<span class="tui" v-if="item.returnNum">
|
||||||
|
退
|
||||||
|
<span class="number">{{ item.returnNum * 1 }}</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex u-col-top">
|
<div class="flex u-col-top">
|
||||||
<div class="img">
|
<div class="img">
|
||||||
|
|
@ -350,7 +353,19 @@ onMounted(() => {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.tui {
|
||||||
|
.number {
|
||||||
|
background: #f56c6c;
|
||||||
|
color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
left: -7px;
|
||||||
|
top: -7px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.da {
|
.da {
|
||||||
background: #35ac6a;
|
background: #35ac6a;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ const controls = ref([
|
||||||
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
{ label: "整单等叫", key: "", disabled: false, per: "all-wating" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const emits = defineEmits(["noteClick", "changePriceClick", "packClick"]);
|
const emits = defineEmits(["noteClick", "changePriceClick", "packClick", "return"]);
|
||||||
function controlsClick(item) {
|
function controlsClick(item) {
|
||||||
switch (item.key) {
|
switch (item.key) {
|
||||||
case "is_gift":
|
case "is_gift":
|
||||||
|
|
@ -99,7 +99,12 @@ const canEdit = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function btnDisabled(item) {
|
function btnDisabled(item) {
|
||||||
return !perList.value.includes(item.per);
|
const canClick = perList.value.includes(item.per);
|
||||||
|
if (item.key == "return") {
|
||||||
|
return !canClick || carts.selCart.returnNum >= carts.selCart.number;
|
||||||
|
} else {
|
||||||
|
return !canClick;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function returnLabel(item) {
|
function returnLabel(item) {
|
||||||
if (item.key == "is_gift") {
|
if (item.key == "is_gift") {
|
||||||
|
|
|
||||||
|
|
@ -31,19 +31,14 @@
|
||||||
<div class="score">
|
<div class="score">
|
||||||
<div class="u-flex u-col-center u-m-t-10">
|
<div class="u-flex u-col-center u-m-t-10">
|
||||||
<span class="u-font-14 font-bold u-m-r-20">积分抵扣</span>
|
<span class="u-font-14 font-bold u-m-r-20">积分抵扣</span>
|
||||||
<el-radio-group
|
<el-radio-group v-model="score.sel" size="small" class="">
|
||||||
:disabled="!pointsRes.usable"
|
|
||||||
v-model="score.sel"
|
|
||||||
size="small"
|
|
||||||
class=""
|
|
||||||
>
|
|
||||||
<el-radio :value="-1">
|
<el-radio :value="-1">
|
||||||
<span class="u-font-14">不使用</span>
|
<span class="u-font-14">不使用</span>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<el-radio :value="0">
|
<el-radio :value="0" :disabled="!pointsRes.usable">
|
||||||
<span class="u-font-14">全部抵扣</span>
|
<span class="u-font-14">全部抵扣</span>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<el-radio :value="1">
|
<el-radio :value="1" :disabled="!pointsRes.usable">
|
||||||
<span class="u-font-14">部分抵扣</span>
|
<span class="u-font-14">部分抵扣</span>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
|
@ -503,6 +498,9 @@ function refScanPayOpen(payType) {
|
||||||
async function getPaytype() {
|
async function getPaytype() {
|
||||||
const res = await payTypeApi.getList();
|
const res = await payTypeApi.getList();
|
||||||
payTypes.list = res;
|
payTypes.list = res;
|
||||||
|
if (currentpayMoney.value * 1 <= 0) {
|
||||||
|
payTypes.sel = payTypes.list.findIndex((v) => v.payType == "cash");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function nowPayClick(payType) {
|
function nowPayClick(payType) {
|
||||||
payType = payType || payTypes.list[payTypes.sel].payType;
|
payType = payType || payTypes.list[payTypes.sel].payType;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog title="退菜" width="410px" v-model="show" @close="reset" :modal="modal">
|
||||||
|
<div class="u-p-b-16">
|
||||||
|
<div class="flex u-row-between">
|
||||||
|
<span>菜品名称</span>
|
||||||
|
<div class="u-flex">
|
||||||
|
{{ goods.name || "" }}
|
||||||
|
</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 class="u-p-b-16 border-bottom">
|
||||||
|
<div class="flex u-row-between">
|
||||||
|
<span>退菜数量</span>
|
||||||
|
<div class="u-flex" v-if="!isSeatFee">
|
||||||
|
<el-input-number v-model="number" :min="1" step-strictly :max="max"></el-input-number>
|
||||||
|
</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 class="u-m-t-10 u-font-12 color-999">菜品已点数量 {{ max }} 份</div>
|
||||||
|
<div class="u-m-t-26">
|
||||||
|
<div>
|
||||||
|
<span>退菜原因</span>
|
||||||
|
<span class="color-red">*</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="u-flex u-flex-wrap tags">
|
||||||
|
<div
|
||||||
|
class="tag"
|
||||||
|
v-for="(tag, index) in tags"
|
||||||
|
@click="changeSel(tag)"
|
||||||
|
:key="index"
|
||||||
|
:class="{ active: tag.checked }"
|
||||||
|
>
|
||||||
|
{{ tag.label }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="u-m-t-20">
|
||||||
|
<el-input v-model="note" placeholder="请输入自定义备注"></el-input>
|
||||||
|
</div>
|
||||||
|
<div class="u-m-t-20">
|
||||||
|
<el-checkbox v-model="isPrint">打印退菜单</el-checkbox>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div>
|
||||||
|
<el-button @click="close">取消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
modal: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
max: 1,
|
||||||
|
number: 1,
|
||||||
|
isPrint: false,
|
||||||
|
tagSel: -1,
|
||||||
|
show: false,
|
||||||
|
tags: [
|
||||||
|
{ label: "不想要了", checked: false },
|
||||||
|
{ label: "食材不足", checked: false },
|
||||||
|
{ label: "等待时间过长", checked: false },
|
||||||
|
],
|
||||||
|
note: "",
|
||||||
|
goods: {
|
||||||
|
productId: -999,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isSeatFee() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeSel(item) {
|
||||||
|
item.checked = !item.checked;
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.note = "";
|
||||||
|
this.number = 1;
|
||||||
|
this.tags.map((v) => {
|
||||||
|
v.checked = false;
|
||||||
|
});
|
||||||
|
console.log(this.number);
|
||||||
|
},
|
||||||
|
delTag(index) {
|
||||||
|
this.tags.splice(index, 1);
|
||||||
|
},
|
||||||
|
addNote(tag) {
|
||||||
|
if (this.note.length <= 0) {
|
||||||
|
return (this.note = tag);
|
||||||
|
}
|
||||||
|
this.note = tag + "," + this.note;
|
||||||
|
},
|
||||||
|
open(item) {
|
||||||
|
this.goods = item ? item : this.goods;
|
||||||
|
this.max = item.num - item.returnNum;
|
||||||
|
this.show = true;
|
||||||
|
if (item.productId != "-999") {
|
||||||
|
this.number = 1;
|
||||||
|
} else {
|
||||||
|
this.number = this.max;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.show = false;
|
||||||
|
this.number = 1;
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
const selTag = this.tags
|
||||||
|
.filter((item) => item.checked)
|
||||||
|
.map((item) => item.label)
|
||||||
|
.join(",");
|
||||||
|
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
|
||||||
|
console.log(note);
|
||||||
|
if (!note) {
|
||||||
|
return ElMessage.error("请输入退菜原因");
|
||||||
|
}
|
||||||
|
this.$emit("confirm", {
|
||||||
|
refundReason: note,
|
||||||
|
refundAmount: 0,
|
||||||
|
refundDetails: [{ id: this.goods.id, num: this.number, returnAmount: 0 }],
|
||||||
|
});
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-dialog__body) {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
margin-top: 14px;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
:deep(.el-tag) {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 35px;
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
|
.tags {
|
||||||
|
.tag {
|
||||||
|
margin: 10px 10px 0 0;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 10px 13px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #000;
|
||||||
|
cursor: pointer;
|
||||||
|
&.active {
|
||||||
|
color: #1890ff;
|
||||||
|
background: #e8f4ff;
|
||||||
|
border-color: #a3d3ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:deep(.number-box .el-input__inner::-webkit-inner-spin-button) {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
:deep(.number-box .el-input__inner::-webkit-outer-spin-button) {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
@noteClick="showNote"
|
@noteClick="showNote"
|
||||||
@packClick="showPack"
|
@packClick="showPack"
|
||||||
@changePriceClick="showChangePrice"
|
@changePriceClick="showChangePrice"
|
||||||
@return="showReturn"
|
@return="refReturnCartShow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
|
@ -205,6 +205,8 @@
|
||||||
|
|
||||||
<!-- 就餐人数 -->
|
<!-- 就餐人数 -->
|
||||||
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
||||||
|
<!-- 退菜 -->
|
||||||
|
<returnCart ref="refReturnCart" @confirm="refReturnCartConfirm"></returnCart>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|
@ -214,6 +216,7 @@ import note from "./components/note.vue";
|
||||||
import Order from "./components/order.vue";
|
import Order from "./components/order.vue";
|
||||||
import pack from "./components/pack.vue";
|
import pack from "./components/pack.vue";
|
||||||
import changePrice from "./components/popup-cart-changePrice.vue";
|
import changePrice from "./components/popup-cart-changePrice.vue";
|
||||||
|
import returnCart from "./components/return-cart.vue";
|
||||||
import chooseUser from "./components/choose-user.vue";
|
import chooseUser from "./components/choose-user.vue";
|
||||||
import changeWeight from "./components/popup-weight-goods.vue";
|
import changeWeight from "./components/popup-weight-goods.vue";
|
||||||
import changeTaocan from "./components/popup-taocan-goods.vue";
|
import changeTaocan from "./components/popup-taocan-goods.vue";
|
||||||
|
|
@ -230,20 +233,45 @@ import shopUserApi from "@/api/account/shopUser";
|
||||||
import { useCartsStore } from "@/store/modules/carts";
|
import { useCartsStore } from "@/store/modules/carts";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
|
|
||||||
import { ElLoading } from "element-plus";
|
import { ElLoading, ElMessage } from "element-plus";
|
||||||
|
|
||||||
const carts = useCartsStore();
|
const carts = useCartsStore();
|
||||||
const shopUser = useUserStore();
|
const shopUser = useUserStore();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
//退菜
|
||||||
|
const refReturnCart = ref();
|
||||||
|
async function refReturnCartConfirm(e) {
|
||||||
|
console.log(e);
|
||||||
|
const res = await orderApi.refundOrder({
|
||||||
|
...e,
|
||||||
|
orderId: oldOrder.value.id,
|
||||||
|
});
|
||||||
|
ElMessage({
|
||||||
|
type: res ? "success" : "error",
|
||||||
|
text: res ? "退菜成功" : "操作失败",
|
||||||
|
});
|
||||||
|
if (res) {
|
||||||
|
// 获取历史订单数据
|
||||||
|
const res1 = await orderApi.getHistoryList({
|
||||||
|
orderId: oldOrder.value.id,
|
||||||
|
});
|
||||||
|
oldOrder.value = res1;
|
||||||
|
orderInfo.value = res1;
|
||||||
|
carts.setOldOrder(res1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function refReturnCartShow(e) {
|
||||||
|
const memberPrice = e.memberPrice || e.salePrice;
|
||||||
|
refReturnCart.value.open({
|
||||||
|
...e,
|
||||||
|
price: e.discount_sale_amount || (carts.useVipPrice ? memberPrice : e.salePrice),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//整单备注
|
//整单备注
|
||||||
const remark = ref("");
|
const remark = ref("");
|
||||||
//退菜
|
|
||||||
function showReturn(cart) {
|
|
||||||
console.log(cart);
|
|
||||||
}
|
|
||||||
|
|
||||||
//就餐人数
|
//就餐人数
|
||||||
let perpole = ref("");
|
let perpole = ref("");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue