代客下单部分逻辑处理优化,订单管理退款退菜结账跳转功能问题处理
This commit is contained in:
parent
924f296ad1
commit
8c99f49700
|
|
@ -1,5 +1,5 @@
|
||||||
<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">
|
||||||
|
|
@ -105,7 +105,12 @@
|
||||||
<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 :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>
|
||||||
|
<span>
|
||||||
|
{{ scope.row.productName ||'客座费'}}
|
||||||
|
</span>
|
||||||
|
</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' : '']">{{ scope.row.productName }}</span>
|
||||||
<span style="color: #999;">{{
|
<span style="color: #999;">{{
|
||||||
|
|
@ -132,10 +137,14 @@
|
||||||
</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!='refund'">
|
<template v-if="scope.row.status!='unpaid'">
|
||||||
<el-button v-if="detail.status=='closed'||detail.status=='refund'" 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-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>
|
||||||
</template>
|
</template>
|
||||||
<el-button v-if="detail.status=='unpaid'" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -226,6 +235,7 @@ import returnMoney from "@/views/tool/Instead/components/return-money.vue";
|
||||||
import {
|
import {
|
||||||
$returnCart,$returnOrder
|
$returnCart,$returnOrder
|
||||||
} from "@/api/table";
|
} from "@/api/table";
|
||||||
|
import * as $util from '../order_goods_util.js'
|
||||||
export default {
|
export default {
|
||||||
components: { returnCart,returnMoney },
|
components: { returnCart,returnMoney },
|
||||||
|
|
||||||
|
|
@ -270,7 +280,24 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch:{
|
||||||
|
drawer:function(newval){
|
||||||
|
if(!newval){
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
close(){
|
||||||
|
console.log('drawer close')
|
||||||
|
this.$emit('close');
|
||||||
|
},
|
||||||
|
canTuikuan(item){
|
||||||
|
return $util.canTuiKuan(this.detail,item);
|
||||||
|
},
|
||||||
|
canTuicai(item){
|
||||||
|
return $util.canTuicai(this.detail,item);
|
||||||
|
},
|
||||||
async refReturnMoneyConfirm(e){
|
async refReturnMoneyConfirm(e){
|
||||||
const res = await $returnOrder({
|
const res = await $returnOrder({
|
||||||
...e,
|
...e,
|
||||||
|
|
@ -289,7 +316,7 @@ export default {
|
||||||
async refReturnCartConfirm(e){
|
async refReturnCartConfirm(e){
|
||||||
const res = await $returnCart({
|
const res = await $returnCart({
|
||||||
...e,
|
...e,
|
||||||
cartId: this.selGoods.id,
|
cartId: this.selGoods.cartId,
|
||||||
tableId: this.detail.tableId,
|
tableId: this.detail.tableId,
|
||||||
});
|
});
|
||||||
this.$message.success("退菜成功");
|
this.$message.success("退菜成功");
|
||||||
|
|
@ -347,6 +374,18 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.packeFee{
|
||||||
|
width: 40px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 40px;
|
||||||
|
background: #3f9eff;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
.shop_info {
|
.shop_info {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
export function canComputedPackFee(v) {
|
||||||
|
return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding'
|
||||||
|
}
|
||||||
|
export function returnCanComputedGoodsArr(arr) {
|
||||||
|
return arr.filter(v=>canComputedPackFee(v))
|
||||||
|
}
|
||||||
|
export function returnPackFee(arr) {
|
||||||
|
return arr.reduce((prve, cur) => {
|
||||||
|
return prve + cur.packAmount
|
||||||
|
}, 0).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canTuicai(orderInfo,item){
|
||||||
|
return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return'
|
||||||
|
}
|
||||||
|
export function canTuiKuan(orderInfo,item){
|
||||||
|
return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
|
||||||
|
}
|
||||||
|
export function isTui(item){
|
||||||
|
return item.status=='return'||item.status=='refund'||item.status=='refunding'
|
||||||
|
}
|
||||||
|
export function numSum(arr){
|
||||||
|
const sum=arr.reduce((a,b)=>{
|
||||||
|
return a+b*100
|
||||||
|
},0)
|
||||||
|
return (sum/100).toFixed(2)
|
||||||
|
}
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
@current-change="paginationChange" @size-change="sizeChange"
|
@current-change="paginationChange" @size-change="sizeChange"
|
||||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||||
</div>
|
</div>
|
||||||
<orderDetail ref="orderDetail" />
|
<orderDetail ref="orderDetail" @close="getTableData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,8 @@ export default {
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
::v-deep .number-box .el-input__inner {
|
::v-deep .number-box .el-input__inner {
|
||||||
border: none;
|
border: none;
|
||||||
|
padding: 0 2px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.icon-add {
|
.icon-add {
|
||||||
color: #1890ff;
|
color: #1890ff;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,32 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog title="退菜" width="410px" :visible.sync="show" @close="reset" :modal="modal">
|
<el-dialog
|
||||||
<div class="flex u-row-between u-p-b-20 border-bottom">
|
title="退菜"
|
||||||
<span>退菜数量</span>
|
width="410px"
|
||||||
<div class="u-flex">
|
:visible.sync="show"
|
||||||
<number-box v-model="number" :min="1" :max="max"></number-box>
|
@close="reset"
|
||||||
|
:modal="modal"
|
||||||
|
>
|
||||||
|
<div class="u-p-b-16 border-bottom">
|
||||||
|
<div class="flex u-row-between">
|
||||||
|
<span>退菜数量</span>
|
||||||
|
<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-10 u-font-12 color-999">
|
|
||||||
菜品已点数量 {{max}} 份
|
<div class="u-m-t-10 u-font-12 color-999">菜品已点数量 {{ max }} 份</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="u-flex u-flex-wrap tags ">
|
<div class="u-flex u-flex-wrap tags">
|
||||||
<div
|
<div
|
||||||
class="tag"
|
class="tag"
|
||||||
v-for="(tag, index) in tags"
|
v-for="(tag, index) in tags"
|
||||||
|
|
@ -41,28 +54,23 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</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: {
|
||||||
modal:{
|
modal: {
|
||||||
type:Boolean,
|
type: Boolean,
|
||||||
default:true
|
default: true,
|
||||||
},
|
},
|
||||||
goods:{
|
max: {
|
||||||
type:Object,
|
type: Number,
|
||||||
default:()=>{
|
default: 1,
|
||||||
return{}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
max:{
|
|
||||||
type:Number,
|
|
||||||
default:1
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
number:1,
|
number: 1,
|
||||||
isPrint: false,
|
isPrint: false,
|
||||||
tagSel: -1,
|
tagSel: -1,
|
||||||
show: false,
|
show: false,
|
||||||
|
|
@ -72,17 +80,27 @@ export default {
|
||||||
{ label: "等待时间过长", checked: false },
|
{ label: "等待时间过长", checked: false },
|
||||||
],
|
],
|
||||||
note: "",
|
note: "",
|
||||||
|
goods:{
|
||||||
|
productId: -999
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
isSeatFee(){
|
||||||
|
return returnIsSeatFee(this.goods)
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeSel(item) {
|
changeSel(item) {
|
||||||
item.checked = !item.checked;
|
item.checked = !item.checked;
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
this.note = "";
|
this.note = "";
|
||||||
this.number=1;
|
this.number = 1;
|
||||||
console.log(this.number)
|
this.tags.map(v=>{
|
||||||
|
v.checked = false;
|
||||||
|
})
|
||||||
|
console.log(this.number);
|
||||||
},
|
},
|
||||||
delTag(index) {
|
delTag(index) {
|
||||||
this.tags.splice(index, 1);
|
this.tags.splice(index, 1);
|
||||||
|
|
@ -93,22 +111,30 @@ export default {
|
||||||
}
|
}
|
||||||
this.note = tag + "," + this.note;
|
this.note = tag + "," + this.note;
|
||||||
},
|
},
|
||||||
open(note) {
|
open(item) {
|
||||||
|
this.goods = item?item:this.goods;
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.number=1;
|
if (item != "-999") {
|
||||||
|
this.number = 1;
|
||||||
|
} else {
|
||||||
|
this.number = item.num;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
this.number=1;
|
this.number = 1;
|
||||||
},
|
},
|
||||||
confirm() {
|
confirm() {
|
||||||
const selTag=this.tags.filter(item=>item.checked).map(item=>item.label).join(",")
|
const selTag = this.tags
|
||||||
const note=selTag+(this.note.length>0?","+this.note:"");
|
.filter((item) => item.checked)
|
||||||
console.log(note)
|
.map((item) => item.label)
|
||||||
if(!note){
|
.join(",");
|
||||||
|
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
|
||||||
|
console.log(note);
|
||||||
|
if (!note) {
|
||||||
return this.$message.error("请输入退菜原因");
|
return this.$message.error("请输入退菜原因");
|
||||||
}
|
}
|
||||||
this.$emit("confirm", {note:note,num:this.number});
|
this.$emit("confirm", { note: note, num: this.number });
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -120,6 +146,7 @@ export default {
|
||||||
::v-deep .el-dialog__body {
|
::v-deep .el-dialog__body {
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
::v-deep .el-tag {
|
::v-deep .el-tag {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
|
||||||
|
|
@ -1525,7 +1525,8 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
|
// return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
|
||||||
|
return '代客下单'
|
||||||
},
|
},
|
||||||
allGiftMoney() {
|
allGiftMoney() {
|
||||||
const nowprice = this.order.list
|
const nowprice = this.order.list
|
||||||
|
|
@ -1623,11 +1624,9 @@ export default {
|
||||||
const oldackFee = returnPackFee(this.order.old.list);
|
const oldackFee = returnPackFee(this.order.old.list);
|
||||||
const packFee = nowPackFee + oldackFee;
|
const packFee = nowPackFee + oldackFee;
|
||||||
const returnStatus = ["return", "refunding", "refund"];
|
const returnStatus = ["return", "refunding", "refund"];
|
||||||
console.log(this.order.seatFee);
|
|
||||||
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);
|
||||||
console.log(nowPackFee, oldackFee, packFee, seatFee);
|
|
||||||
return (
|
return (
|
||||||
(oldPrice + price + +packFee + seatFee) *
|
(oldPrice + price + +packFee + seatFee) *
|
||||||
this.createOrder.discount
|
this.createOrder.discount
|
||||||
|
|
@ -1708,9 +1707,16 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
table(newval, oldval) {
|
table(newval, oldval) {
|
||||||
|
this.setPostPay();
|
||||||
|
this.setUseType();
|
||||||
if(oldval.tableId&&newval.tableId){
|
if(oldval.tableId&&newval.tableId){
|
||||||
|
this.perpole = 1;
|
||||||
this.isCreateOrder = false;
|
this.isCreateOrder = false;
|
||||||
}
|
}
|
||||||
|
if(this.key=='isJieZhang'){
|
||||||
|
this.isCreateOrder = false;
|
||||||
|
this.key=''
|
||||||
|
}
|
||||||
if (newval && newval.tableId) {
|
if (newval && newval.tableId) {
|
||||||
this.createOrder.data.amount = 0;
|
this.createOrder.data.amount = 0;
|
||||||
this.createOrder.data.id = "";
|
this.createOrder.data.id = "";
|
||||||
|
|
@ -2034,6 +2040,8 @@ export default {
|
||||||
//munchies 先付 restaurant 后付
|
//munchies 先付 restaurant 后付
|
||||||
this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
|
this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
|
||||||
}
|
}
|
||||||
|
console.log('this.postPay')
|
||||||
|
console.log(this.postPay)
|
||||||
},
|
},
|
||||||
//获取店铺信息
|
//获取店铺信息
|
||||||
async getShopInfo() {
|
async getShopInfo() {
|
||||||
|
|
@ -2069,6 +2077,7 @@ export default {
|
||||||
},
|
},
|
||||||
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
||||||
async onTableChange() {
|
async onTableChange() {
|
||||||
|
const perpole=this.perpole || ''
|
||||||
const tableRes = await $returnTableDetail({
|
const tableRes = await $returnTableDetail({
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
});
|
});
|
||||||
|
|
@ -2085,7 +2094,6 @@ export default {
|
||||||
this.table.status == "idle" &&
|
this.table.status == "idle" &&
|
||||||
!this.shopInfo.isTableFee
|
!this.shopInfo.isTableFee
|
||||||
) {
|
) {
|
||||||
this.perpole = 1;
|
|
||||||
await this.changePerpole();
|
await this.changePerpole();
|
||||||
}
|
}
|
||||||
//设置就餐类型
|
//设置就餐类型
|
||||||
|
|
@ -2102,6 +2110,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.getCacheOrder();
|
this.getCacheOrder();
|
||||||
console.log(this.isCreateOrder);
|
console.log(this.isCreateOrder);
|
||||||
|
this.perpole=perpole||this.perpole
|
||||||
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
|
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
|
||||||
//不免餐位费
|
//不免餐位费
|
||||||
await this.changePerpole();
|
await this.changePerpole();
|
||||||
|
|
@ -3130,9 +3139,9 @@ export default {
|
||||||
this.order.seatFee = seatFee
|
this.order.seatFee = seatFee
|
||||||
? {
|
? {
|
||||||
...seatFee,
|
...seatFee,
|
||||||
totalNumber: seatFee.num,
|
totalNumber: seatFee.num||seatFee.number,
|
||||||
number: seatFee.num,
|
num: seatFee.number,
|
||||||
name: seatFee.productName,
|
name: seatFee.name|| seatFee.productName,
|
||||||
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
|
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
|
||||||
}
|
}
|
||||||
: this.order.seatFee;
|
: this.order.seatFee;
|
||||||
|
|
@ -3329,6 +3338,7 @@ export default {
|
||||||
key = params.key,
|
key = params.key,
|
||||||
perpoleNumber = params.num || "";
|
perpoleNumber = params.num || "";
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
this.perpole = perpoleNumber;
|
||||||
|
|
||||||
const shopId = localStorage.getItem("shopId");
|
const shopId = localStorage.getItem("shopId");
|
||||||
const shopInfo = await tbShopInfo(shopId);
|
const shopInfo = await tbShopInfo(shopId);
|
||||||
|
|
@ -3361,7 +3371,6 @@ export default {
|
||||||
console.log(params);
|
console.log(params);
|
||||||
|
|
||||||
if (key == "isJieZhang") {
|
if (key == "isJieZhang") {
|
||||||
this.perpole = perpoleNumber;
|
|
||||||
this.table = params.tableId ? { name: item.name } : "";
|
this.table = params.tableId ? { name: item.name } : "";
|
||||||
if (params.orderId) {
|
if (params.orderId) {
|
||||||
const orderRes = await this.getOrderData(params);
|
const orderRes = await this.getOrderData(params);
|
||||||
|
|
@ -3395,7 +3404,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.perpole = perpoleNumber;
|
|
||||||
this.table = params.tableId ? item : "";
|
this.table = params.tableId ? item : "";
|
||||||
},
|
},
|
||||||
async getOrderData(params) {
|
async getOrderData(params) {
|
||||||
|
|
|
||||||
|
|
@ -107,4 +107,11 @@ export function formatOrderGoodsList(arr){
|
||||||
info: value,
|
info: value,
|
||||||
placeNum: key||1
|
placeNum: key||1
|
||||||
}))
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function returnIsSeatFee(item){
|
||||||
|
if(!item){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return item.productId=="-999"
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue