代客下单新逻辑梳理
This commit is contained in:
parent
c6fed2af32
commit
8403afd685
|
|
@ -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'
|
||||||
|
|
|
||||||
|
|
@ -130,14 +130,14 @@
|
||||||
¥{{ scope.row.priceAmount }}
|
¥{{ scope.row.priceAmount }}
|
||||||
</template>
|
</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!='refund'">
|
<template v-if="scope.row.status!='refund'">
|
||||||
<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="detail.status=='closed'||detail.status=='refund'" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-button v-if="detail.status=='unpaid'" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<!-- </el-tab-pane> -->
|
<!-- </el-tab-pane> -->
|
||||||
|
|
@ -280,6 +280,7 @@ export default {
|
||||||
num:e.num
|
num:e.num
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
this.$message.success("退款成功");
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
update(){
|
update(){
|
||||||
|
|
@ -291,6 +292,7 @@ export default {
|
||||||
cartId: this.selGoods.id,
|
cartId: this.selGoods.id,
|
||||||
tableId: this.detail.tableId,
|
tableId: this.detail.tableId,
|
||||||
});
|
});
|
||||||
|
this.$message.success("退菜成功");
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
tuikuan(item){
|
tuikuan(item){
|
||||||
|
|
|
||||||
|
|
@ -146,9 +146,12 @@
|
||||||
{{ scope.row.createdAt | timeFilter }}
|
{{ scope.row.createdAt | timeFilter }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="100">
|
<el-table-column label="操作">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
<div class="u-flex gap-10">
|
||||||
|
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
||||||
|
<el-button v-if="scope.row.status == 'unpaid'" type="primary" size="mini" @click="payOrder(scope.row)">结账</el-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -247,6 +250,21 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//结账
|
||||||
|
payOrder(order){
|
||||||
|
console.log(order);
|
||||||
|
this.$router.push({
|
||||||
|
path: "/tool/Instead/index",
|
||||||
|
query: {
|
||||||
|
table_name: order.tableName,
|
||||||
|
tableId: order.tableId,
|
||||||
|
useType: order.useType,
|
||||||
|
masterId: order.masterId,
|
||||||
|
orderId: order.id,
|
||||||
|
key:'isJieZhang'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
// 获取订单汇总
|
// 获取订单汇总
|
||||||
async payCount() {
|
async payCount() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||||
<span v-else> ¥{{ item.totalAmount }}</span>
|
<span v-else> ¥{{ (item.salePrice*item.number+(item.packAmount||0)).toFixed(2) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ export default {
|
||||||
}
|
}
|
||||||
if (curretnMoney > money) {
|
if (curretnMoney > money) {
|
||||||
this.$message.error("实收金额不能大于总金额");
|
this.$message.error("实收金额不能大于总金额");
|
||||||
this.form.curretnMoney = 0;
|
this.form.curretnMoney = form.money;
|
||||||
}
|
}
|
||||||
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||||
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,12 @@
|
||||||
trigger="click"
|
trigger="click"
|
||||||
v-model="tableShow"
|
v-model="tableShow"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
placeholder="请输入内容"
|
placeholder="请输入内容"
|
||||||
prefix-icon="el-icon-search"
|
prefix-icon="el-icon-search"
|
||||||
v-model="tableSearchText"
|
v-model="tableSearchText"
|
||||||
@input="searchInput">
|
@input="searchInput"
|
||||||
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
|
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
|
||||||
<div
|
<div
|
||||||
|
|
@ -233,7 +234,9 @@
|
||||||
|
|
||||||
<div class="u-flex">
|
<div class="u-flex">
|
||||||
<div class="u-p-r-14 border-r u-m-r-14">
|
<div class="u-p-r-14 border-r u-m-r-14">
|
||||||
<template v-if="!shopInfo.isTableFee">
|
<template
|
||||||
|
v-if="!shopInfo.isTableFee && key != 'isJieZhang'"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="u-flex cur-pointer"
|
class="u-flex cur-pointer"
|
||||||
@click="
|
@click="
|
||||||
|
|
@ -404,7 +407,7 @@
|
||||||
<div class="flex mt-14">
|
<div class="flex mt-14">
|
||||||
<template v-if="table">
|
<template v-if="table">
|
||||||
<template v-if="!postPay">
|
<template v-if="!postPay">
|
||||||
<template v-if="isCreateOrder">
|
<template v-if="!postPay&& isCreateOrder && table && table.tableId">
|
||||||
<!-- <template v-if="false"> -->
|
<!-- <template v-if="false"> -->
|
||||||
<button
|
<button
|
||||||
class="my-btn flex-1 default"
|
class="my-btn flex-1 default"
|
||||||
|
|
@ -414,26 +417,28 @@
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<button
|
<template v-if="key != 'isJieZhang'">
|
||||||
class="my-btn flex-1 primary"
|
<button
|
||||||
@click="scanPayClick"
|
class="my-btn flex-1 primary"
|
||||||
>
|
@click="scanPayClick"
|
||||||
<span>微信/支付宝</span>
|
>
|
||||||
</button>
|
<span>微信/支付宝</span>
|
||||||
<div style="width: 15px"></div>
|
</button>
|
||||||
<button
|
<div style="width: 15px"></div>
|
||||||
class="my-btn flex-1 primary"
|
<button
|
||||||
@click="cashPayClick"
|
class="my-btn flex-1 primary"
|
||||||
>
|
@click="cashPayClick"
|
||||||
<span>现金</span>
|
>
|
||||||
</button>
|
<span>现金</span>
|
||||||
<div style="width: 15px"></div>
|
</button>
|
||||||
<button
|
<div style="width: 15px"></div>
|
||||||
class="my-btn flex-1 default"
|
<button
|
||||||
@click="morePayClick"
|
class="my-btn flex-1 default"
|
||||||
>
|
@click="morePayClick"
|
||||||
<span>更多支付</span>
|
>
|
||||||
</button>
|
<span>更多支付</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
@ -590,7 +595,7 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
<div
|
<div
|
||||||
class="btn"
|
class="btn"
|
||||||
:class="{ disabled: order.selIndex < 0 }"
|
:class="{ disabled: order.selIndex < 0 && key != 'isJieZhang' }"
|
||||||
@click="refNoteShow(true)"
|
@click="refNoteShow(true)"
|
||||||
>
|
>
|
||||||
单品备注
|
单品备注
|
||||||
|
|
@ -1254,6 +1259,7 @@ import moneyKeyboard from "./components/money-keyboard.vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { tbShopInfo } from "@/api/user";
|
import { tbShopInfo } from "@/api/user";
|
||||||
import { hasPermission } from "@/utils/limits.js";
|
import { hasPermission } from "@/utils/limits.js";
|
||||||
|
import { tbOrderInfoDetail } from "@/api/order";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getGoodsLists,
|
getGoodsLists,
|
||||||
|
|
@ -1283,12 +1289,15 @@ import {
|
||||||
isCanBuy,
|
isCanBuy,
|
||||||
arrayContainsAll,
|
arrayContainsAll,
|
||||||
generateCombinations,
|
generateCombinations,
|
||||||
returnReverseVal,$strMatch,
|
returnReverseVal,
|
||||||
|
$strMatch,
|
||||||
returnGiftArr,
|
returnGiftArr,
|
||||||
|
returnPackFee,
|
||||||
|
formatOrderGoodsList
|
||||||
} from "./util.js";
|
} from "./util.js";
|
||||||
import { $status } from "@/utils/table.js";
|
import { $status } from "@/utils/table.js";
|
||||||
|
|
||||||
let $originTableList=[]
|
let $originTableList = [];
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
returnCart,
|
returnCart,
|
||||||
|
|
@ -1305,7 +1314,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//台桌搜索文字
|
//台桌搜索文字
|
||||||
tableSearchText:"",
|
tableSearchText: "",
|
||||||
//是否允许收款
|
//是否允许收款
|
||||||
canShoukuan: false,
|
canShoukuan: false,
|
||||||
//是否允许下单
|
//是否允许下单
|
||||||
|
|
@ -1605,12 +1614,18 @@ export default {
|
||||||
.reduce((a, b) => {
|
.reduce((a, b) => {
|
||||||
return a + b.number * b.salePrice;
|
return a + b.number * b.salePrice;
|
||||||
}, 0);
|
}, 0);
|
||||||
return (
|
|
||||||
oldPrice +
|
const nowPackFee = returnPackFee(this.order.list, false);
|
||||||
price +
|
const oldackFee = returnPackFee(this.order.old.list);
|
||||||
+this.order.packFee.totalAmount +
|
const packFee = nowPackFee + oldackFee;
|
||||||
|
const returnStatus = ["return", "refunding", "refund"];
|
||||||
|
const seatFee =
|
||||||
this.order.seatFee.totalAmount *
|
this.order.seatFee.totalAmount *
|
||||||
(this.order.seatFee.status == "return" ? 0 : 1)
|
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
|
||||||
|
console.log(nowPackFee, oldackFee, packFee, seatFee);
|
||||||
|
return (
|
||||||
|
(oldPrice + price + +packFee + seatFee) *
|
||||||
|
this.createOrder.discount
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
},
|
},
|
||||||
allNumber() {
|
allNumber() {
|
||||||
|
|
@ -1687,8 +1702,10 @@ export default {
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
table(oldval, newval) {
|
table(newval, oldval) {
|
||||||
this.onTableChange();
|
if (newval&&newval.tableId) {
|
||||||
|
this.onTableChange();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
masterId: function (val) {
|
masterId: function (val) {
|
||||||
console.log(val);
|
console.log(val);
|
||||||
|
|
@ -1699,15 +1716,15 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vipUser.id": async function (val) {
|
"vipUser.id": async function (val) {
|
||||||
if (!this.table.tableId) {
|
// if (!this.table.tableId) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
let masterId = this.order.masterId;
|
// let masterId = this.order.masterId;
|
||||||
if (!masterId) {
|
// if (!masterId) {
|
||||||
const res = await this.getMasterId();
|
// const res = await this.getMasterId();
|
||||||
masterId = res.masterId;
|
// masterId = res.masterId;
|
||||||
}
|
// }
|
||||||
this.masterId = masterId;
|
// this.masterId = masterId;
|
||||||
$setUser({
|
$setUser({
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
|
|
@ -1826,13 +1843,15 @@ export default {
|
||||||
// this.getCategory();
|
// this.getCategory();
|
||||||
// this.refToggle('refScanCode',true)
|
// this.refToggle('refScanCode',true)
|
||||||
// this.refToggle("refDiscount", true);
|
// this.refToggle("refDiscount", true);
|
||||||
console.log(this.$route.query.tableId);
|
// this.open(this.$route.query.tableId ? this.$route.query : "");
|
||||||
this.open(this.$route.query.tableId ? this.$route.query : "");
|
this.open(this.$route.query);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
searchInput(e){
|
searchInput(e) {
|
||||||
console.log(e)
|
console.log(e);
|
||||||
this.tableList=$originTableList.filter(v=>$strMatch(v.name,e.trim()))
|
this.tableList = $originTableList.filter((v) =>
|
||||||
|
$strMatch(v.name, e.trim())
|
||||||
|
);
|
||||||
},
|
},
|
||||||
returnTableColor(key) {
|
returnTableColor(key) {
|
||||||
const item = $status[key];
|
const item = $status[key];
|
||||||
|
|
@ -1861,7 +1880,8 @@ export default {
|
||||||
this.order.extra.selIndex = index;
|
this.order.extra.selIndex = index;
|
||||||
},
|
},
|
||||||
async morePayClick() {
|
async morePayClick() {
|
||||||
if (this.order.list.length <= 0) {
|
|
||||||
|
if (this.order.list.length <= 0 && !this.createOrder.data) {
|
||||||
return this.$message("请选择菜品");
|
return this.$message("请选择菜品");
|
||||||
}
|
}
|
||||||
const canJiesuan = await this.shoukuanClick();
|
const canJiesuan = await this.shoukuanClick();
|
||||||
|
|
@ -1871,13 +1891,14 @@ export default {
|
||||||
// if(this.isCreateOrder){
|
// if(this.isCreateOrder){
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
const res = await this.returnCreateOrderData();
|
await this.returnCreateOrderData();
|
||||||
this.payBeforeClear();
|
this.payBeforeClear();
|
||||||
this.createOrder.data = res;
|
// this.order.payType = "";
|
||||||
this.order.payType = "";
|
|
||||||
this.isCreateOrder = true;
|
|
||||||
},
|
},
|
||||||
async cashPayClick() {
|
async cashPayClick() {
|
||||||
|
if(!this.createOrder.data.id&&this.order.list.length <= 0){
|
||||||
|
return this.$message("没有要结算的订单或商品!");
|
||||||
|
}
|
||||||
const canJiesuan = await this.shoukuanClick();
|
const canJiesuan = await this.shoukuanClick();
|
||||||
if (!canJiesuan) {
|
if (!canJiesuan) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1892,6 +1913,13 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async returnCreateOrderData() {
|
async returnCreateOrderData() {
|
||||||
|
if (this.key == "isJieZhang"||this.order.list.length <= 0) {
|
||||||
|
//结账来的下单或者已经生成订单
|
||||||
|
// this.order.old.list = formatOrderGoodsList(this.createOrder.data.detailList||[]);
|
||||||
|
this.isCreateOrder=true
|
||||||
|
return this.createOrder.data;
|
||||||
|
}
|
||||||
|
this.order.list = [];
|
||||||
const res = await $createOrder({
|
const res = await $createOrder({
|
||||||
masterId: this.order.masterId || this.masterId,
|
masterId: this.order.masterId || this.masterId,
|
||||||
vipUserId: this.vipUser.id,
|
vipUserId: this.vipUser.id,
|
||||||
|
|
@ -1900,6 +1928,9 @@ export default {
|
||||||
postPay: this.postPay,
|
postPay: this.postPay,
|
||||||
orderld: this.order.orderId,
|
orderld: this.order.orderId,
|
||||||
});
|
});
|
||||||
|
this.isCreateOrder=true
|
||||||
|
this.order.old.list = formatOrderGoodsList(res.detailList||[]);
|
||||||
|
this.getOrderData({orderId:res.id})
|
||||||
this.createOrder.data = res;
|
this.createOrder.data = res;
|
||||||
this.createOrder.discount = 1;
|
this.createOrder.discount = 1;
|
||||||
// const lastItem = this.order.old.list[this.order.old.list.length - 1];
|
// const lastItem = this.order.old.list[this.order.old.list.length - 1];
|
||||||
|
|
@ -1908,27 +1939,22 @@ export default {
|
||||||
// ...this.order.old.list,
|
// ...this.order.old.list,
|
||||||
// { info: this.order.list, placeNum: nowPlaceNum + 1 },
|
// { info: this.order.list, placeNum: nowPlaceNum + 1 },
|
||||||
// ];
|
// ];
|
||||||
this.order.list = [];
|
console.log(this.order.old.list);
|
||||||
this.order.old.list = [];
|
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
async payBeforeClear() {
|
async payBeforeClear() {
|
||||||
this.getMasterId().then((res) => {
|
|
||||||
this.masterId = res.masterId;
|
|
||||||
});
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.order.list = [];
|
|
||||||
this.order.query.page = 1;
|
this.order.query.page = 1;
|
||||||
this.goods.total = 0;
|
this.goods.total = 0;
|
||||||
this.order.list = [];
|
this.order.list = [];
|
||||||
this.order.selIndex = -1;
|
this.order.selIndex = -1;
|
||||||
this.order.selPlaceNum = -1;
|
this.order.selPlaceNum = -1;
|
||||||
this.order.selGoods = "";
|
this.order.selGoods = "";
|
||||||
this.order.seatFee = { totalAmount: 0 }; //餐位费
|
|
||||||
this.prveOrder.list = [];
|
this.prveOrder.list = [];
|
||||||
this.prveOrder.selIndex = -1;
|
this.prveOrder.selIndex = -1;
|
||||||
this.order.old.selIndex = -1;
|
this.order.old.selIndex = -1;
|
||||||
this.isCreateOrder = false;
|
// this.isCreateOrder = false;
|
||||||
this.createOrder.status = "";
|
this.createOrder.status = "";
|
||||||
this.createOrder.code = "";
|
this.createOrder.code = "";
|
||||||
this.note.content = "";
|
this.note.content = "";
|
||||||
|
|
@ -1942,7 +1968,6 @@ export default {
|
||||||
this.key = "";
|
this.key = "";
|
||||||
this.order.orderId = "";
|
this.order.orderId = "";
|
||||||
this.perpole = "";
|
this.perpole = "";
|
||||||
// this.useTypes.sel = "dine-in";
|
|
||||||
},
|
},
|
||||||
async cachePay() {
|
async cachePay() {
|
||||||
const canJiesuan = await this.shoukuanClick();
|
const canJiesuan = await this.shoukuanClick();
|
||||||
|
|
@ -1954,12 +1979,14 @@ export default {
|
||||||
this.pays();
|
this.pays();
|
||||||
},
|
},
|
||||||
async scanPayClick() {
|
async scanPayClick() {
|
||||||
|
if(!this.createOrder.data.id&&this.order.list.length <= 0 ){
|
||||||
|
return this.$message("没有要结算的订单或商品!");
|
||||||
|
}
|
||||||
const canJiesuan = await this.shoukuanClick();
|
const canJiesuan = await this.shoukuanClick();
|
||||||
if (!canJiesuan) {
|
if (!canJiesuan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const order = await this.returnCreateOrderData();
|
const order = await this.returnCreateOrderData();
|
||||||
console.log(this.createOrder.data);
|
|
||||||
this.order.payType = "scanCode";
|
this.order.payType = "scanCode";
|
||||||
this.payTypeItemClick({ payType: "scanCode", order });
|
this.payTypeItemClick({ payType: "scanCode", order });
|
||||||
this.payBeforeClear();
|
this.payBeforeClear();
|
||||||
|
|
@ -2099,15 +2126,17 @@ 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.id,
|
cartId:this.order.selGoods.cartId,
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
});
|
});
|
||||||
this.order.selGoods.status = "return";
|
this.order.selGoods.status = "return";
|
||||||
this.order.old.selIndex = -1;
|
this.order.old.selIndex = -1;
|
||||||
this.getCart();
|
// this.getCart();
|
||||||
console.log(this.order.selGoods);
|
this.getOrderData()
|
||||||
|
// console.log(this.order.selGoods);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 台桌列表
|
// 台桌列表
|
||||||
|
|
@ -2120,16 +2149,16 @@ export default {
|
||||||
this.tableList = content.filter(
|
this.tableList = content.filter(
|
||||||
(v) => v.status != "closed" && v.status != "cleaning"
|
(v) => v.status != "closed" && v.status != "cleaning"
|
||||||
);
|
);
|
||||||
$originTableList=this.tableList
|
$originTableList = this.tableList;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async changeTable(item) {
|
async changeTable(item) {
|
||||||
console.log(this.table);
|
|
||||||
if (this.table || this.order.list.length <= 0) {
|
if (this.table || this.order.list.length <= 0) {
|
||||||
this.table = item;
|
this.table = item;
|
||||||
this.tableShow = false;
|
this.tableShow = false;
|
||||||
|
console.log(this.table);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item.status != "idle") {
|
if (item.status != "idle") {
|
||||||
|
|
@ -2230,7 +2259,7 @@ export default {
|
||||||
isSellOut(item) {
|
isSellOut(item) {
|
||||||
return (
|
return (
|
||||||
item.isPauseSale ||
|
item.isPauseSale ||
|
||||||
(item.typeEnum !== "sku" &&
|
(
|
||||||
(item.isStock == 1 ? item.stockNumber <= 0 : false))
|
(item.isStock == 1 ? item.stockNumber <= 0 : false))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -2547,7 +2576,9 @@ export default {
|
||||||
//右侧控制按钮点击事件
|
//右侧控制按钮点击事件
|
||||||
orderBtnsClick(key) {
|
orderBtnsClick(key) {
|
||||||
const orderGoods = this.order.list[this.order.selIndex];
|
const orderGoods = this.order.list[this.order.selIndex];
|
||||||
this.createOrderClose();
|
if (this.key != "isJieZhang"&&this.postPay) {
|
||||||
|
this.createOrderClose();
|
||||||
|
}
|
||||||
if (key === "sku") {
|
if (key === "sku") {
|
||||||
this.selGoods.title = orderGoods.name;
|
this.selGoods.title = orderGoods.name;
|
||||||
this.selGoods.isEdit = true;
|
this.selGoods.isEdit = true;
|
||||||
|
|
@ -2721,8 +2752,8 @@ export default {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.getCacheOrder();
|
this.getCacheOrder();
|
||||||
});
|
});
|
||||||
const masterIdRes = await this.getMasterId();
|
await this.getMasterId();
|
||||||
this.masterId = masterIdRes.masterId;
|
|
||||||
},
|
},
|
||||||
// 删除购物车商品
|
// 删除购物车商品
|
||||||
removeCart() {
|
removeCart() {
|
||||||
|
|
@ -3277,6 +3308,18 @@ export default {
|
||||||
this.$goodsData = goods;
|
this.$goodsData = goods;
|
||||||
},
|
},
|
||||||
async open(params) {
|
async open(params) {
|
||||||
|
const item = {
|
||||||
|
name: params.table_name,
|
||||||
|
tableId: params.tableId,
|
||||||
|
useType: params.useType,
|
||||||
|
maxCapacity: params.maxCapacity * 1,
|
||||||
|
masterId: params.masterId,
|
||||||
|
orderId: params.orderId,
|
||||||
|
},
|
||||||
|
key = params.key,
|
||||||
|
perpoleNumber = params.num || "";
|
||||||
|
this.key = key;
|
||||||
|
|
||||||
const shopId = localStorage.getItem("shopId");
|
const shopId = localStorage.getItem("shopId");
|
||||||
const shopInfo = await tbShopInfo(shopId);
|
const shopInfo = await tbShopInfo(shopId);
|
||||||
for (let i in shopInfo.eatModel) {
|
for (let i in shopInfo.eatModel) {
|
||||||
|
|
@ -3290,28 +3333,40 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.shopInfo = shopInfo;
|
this.shopInfo = shopInfo;
|
||||||
this.setPostPay();
|
if (!params.masterId) {
|
||||||
|
await this.getMasterId();
|
||||||
|
this.getCart()
|
||||||
|
} else {
|
||||||
|
this.masterId = params.masterId;
|
||||||
|
}
|
||||||
|
if (key == "isJieZhang") {
|
||||||
|
this.postPay = false;
|
||||||
|
} else {
|
||||||
|
this.setPostPay();
|
||||||
|
}
|
||||||
this.setUseType();
|
this.setUseType();
|
||||||
this.getGoods();
|
this.getGoods();
|
||||||
this.getCategory();
|
this.getCategory();
|
||||||
this.getTable();
|
this.getTable();
|
||||||
console.log(params);
|
console.log(params);
|
||||||
const res = await this.getMasterId();
|
if (key == "isJieZhang") {
|
||||||
console.log(res);
|
this.perpole = perpoleNumber;
|
||||||
if (!params) {
|
this.table = params.tableId ? { name: item.name } : "";
|
||||||
//无台桌代客下单
|
if (params.orderId) {
|
||||||
|
const orderRes = await this.getOrderData(params);
|
||||||
|
if (orderRes.status != "unpaid") {
|
||||||
|
this.$router.replace({ path: "/tool/Instead/index" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.isCreateOrder = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item = {
|
// this.getCart();
|
||||||
name: params.table_name,
|
// this.getCacheOrder();
|
||||||
tableId: params.tableId,
|
// if (!params) {
|
||||||
useType: params.useType,
|
// //无台桌代客下单
|
||||||
maxCapacity: params.maxCapacity * 1,
|
// return;
|
||||||
masterId: params.masterId,
|
// }
|
||||||
orderId: params.orderId,
|
|
||||||
},
|
|
||||||
key = params.key,
|
|
||||||
perpoleNumber = params.num;
|
|
||||||
//有台桌时的代客下单
|
//有台桌时的代客下单
|
||||||
if (item && item.useType) {
|
if (item && item.useType) {
|
||||||
localStorage.setItem("useType", item.useType);
|
localStorage.setItem("useType", item.useType);
|
||||||
|
|
@ -3320,17 +3375,72 @@ export default {
|
||||||
? item.useType
|
? item.useType
|
||||||
: item.useType.replace(/-after|-before/g, "");
|
: item.useType.replace(/-after|-before/g, "");
|
||||||
}
|
}
|
||||||
this.key = key;
|
this.isCreateOrder =
|
||||||
this.isCreateOrder = this.key == "isPayOrder" ? true : false;
|
this.key == "isPayOrder" || this.key == "isJieZhang" ? true : false;
|
||||||
|
|
||||||
this.perpole = perpoleNumber;
|
this.perpole = perpoleNumber;
|
||||||
this.table = item;
|
this.table = params.tableId ? { name: item.name } : "";
|
||||||
this.masterId = item.masterId;
|
},
|
||||||
|
async getOrderData(params) {
|
||||||
|
const res = await tbOrderInfoDetail(params?params.orderId:this.createOrder.data.id);
|
||||||
|
if (res.status != "unpaid") {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
this.createOrder.data = res;
|
||||||
|
this.order.packFee.totalAmount = res.seatInfo || { totalAmount: 0 };
|
||||||
|
const goodsMap = {};
|
||||||
|
for (let i in res.detailList) {
|
||||||
|
const goods = res.detailList[i];
|
||||||
|
if (goods.productId != "-999") {
|
||||||
|
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||||
|
goodsMap[goods.placeNum].push(goods);
|
||||||
|
} else {
|
||||||
|
goodsMap[goods.placeNum] = [goods];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.order.seatFee = res.seatInfo
|
||||||
|
? {
|
||||||
|
...res.seatInfo,
|
||||||
|
totalNumber: res.seatInfo.num,
|
||||||
|
number: res.seatInfo.num,
|
||||||
|
name: res.seatInfo.productName,
|
||||||
|
totalAmount: res.seatInfo.priceAmount,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
name: "客座费",
|
||||||
|
number: res.seatCount||0,
|
||||||
|
totalNumber: res.seatCount||0,
|
||||||
|
totalAmount: res.seatAmount||0,
|
||||||
|
status: "",
|
||||||
|
};
|
||||||
|
console.log(this.order.seatFee);
|
||||||
|
this.order.old.list = Object.entries(goodsMap).map(([key, value]) => ({
|
||||||
|
info: value.map((v) => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
coverImg: v.productImg,
|
||||||
|
name: v.productName,
|
||||||
|
specSnap: v.productSkuName,
|
||||||
|
number: v.num,
|
||||||
|
totalAmount: v.priceAmount,
|
||||||
|
salePrice: v.price,
|
||||||
|
isGift: v.gift ? "true" : "false",
|
||||||
|
isPack: v.pack ? "true" : "false",
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
placeNum: key,
|
||||||
|
}));
|
||||||
|
console.log(this.order.old.list);
|
||||||
|
return res;
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
this.reset()
|
||||||
if (this.table.tableId) {
|
if (this.table.tableId) {
|
||||||
this.$router.replace({ path: "/tool/table_list" });
|
this.$router.replace({ path: "/tool/table_list" });
|
||||||
} else {
|
} else {
|
||||||
this.$router.go(0);
|
this.$router.replace({ path: "/tool/Instead/index" });
|
||||||
|
// this.$router.go(0);
|
||||||
// this.reset();
|
// this.reset();
|
||||||
// this.$router.replace({ path: "/tool/Instead/index" });
|
// this.$router.replace({ path: "/tool/Instead/index" });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,34 @@
|
||||||
|
//计算打包费
|
||||||
|
export function returnPackFee(arr, isOld = true) {
|
||||||
|
if (isOld) {
|
||||||
|
return arr.reduce((a, b) => {
|
||||||
|
const bTotal = b.info
|
||||||
|
.filter((v) => v.isGift !== "true" && v.status !== "return")
|
||||||
|
.reduce((prve, cur) => {
|
||||||
|
return prve + (cur.packFee || cur.packAmount||0);
|
||||||
|
}, 0);
|
||||||
|
return a + bTotal;
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
return arr.filter(v => v.status !== 'return' && v.isGift !== 'true').reduce((a, b) => {
|
||||||
|
return a + (b.packFee || b.packAmount||0);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
//判断商品是否可以下单
|
//判断商品是否可以下单
|
||||||
export function isCanBuy(skuGoods,goods) {
|
export function isCanBuy(skuGoods, goods) {
|
||||||
if(goods.typeEnum=='normal'){
|
if (goods.typeEnum == 'normal') {
|
||||||
//单规格
|
//单规格
|
||||||
return goods.isGrounding&&goods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
|
return goods.isGrounding && goods.isPauseSale == 0 && (goods.isStock ? goods.stockNumber > 0 : true);
|
||||||
}else{
|
} else {
|
||||||
//多规格
|
//多规格
|
||||||
return goods.isGrounding&&goods.isPauseSale==0&&skuGoods.isGrounding&&skuGoods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
|
return goods.isGrounding && goods.isPauseSale == 0 && skuGoods.isGrounding && skuGoods.isPauseSale == 0 && (goods.isStock ? goods.stockNumber > 0 : true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//字符匹配
|
//字符匹配
|
||||||
export function $strMatch(matchStr,str){
|
export function $strMatch(matchStr, str) {
|
||||||
return matchStr.toLowerCase().includes(str.toLowerCase())
|
return matchStr.toLowerCase().includes(str.toLowerCase())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,15 +77,34 @@ export function returnReverseVal(val, isReturnString = true) {
|
||||||
return reverseNewval;
|
return reverseNewval;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function returnGiftArr(arr){
|
export function returnGiftArr(arr) {
|
||||||
let result=[]
|
let result = []
|
||||||
for(let i=0;i<arr.length;i++){
|
for (let i = 0; i < arr.length; i++) {
|
||||||
const info=arr[i].info
|
const info = arr[i].info
|
||||||
for(let j=0;j<info.length;j++){
|
for (let j = 0; j < info.length; j++) {
|
||||||
if(info[j].isGift==='true'){
|
if (info[j].isGift === 'true') {
|
||||||
result.push(info[j])
|
result.push(info[j])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatOrderGoodsList(arr){
|
||||||
|
const goodsMap = {}
|
||||||
|
for (let i in arr) {
|
||||||
|
const goods = arr[i]
|
||||||
|
if (goods.productName != '客座费') {
|
||||||
|
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||||
|
goodsMap[goods.placeNum||1].push(goods)
|
||||||
|
} else {
|
||||||
|
goodsMap[goods.placeNum||1] = [goods]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return Object.entries(goodsMap).map(([key, value]) => ({
|
||||||
|
info: value,
|
||||||
|
placeNum: key||1
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue