代课下单
This commit is contained in:
parent
1bd0b0daa9
commit
9782256a84
|
|
@ -1,10 +1,10 @@
|
||||||
// 代客下单
|
// 代客下单
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
//就餐形式,默认堂食后付费
|
//就餐形式,默认堂食后付费
|
||||||
const useType='dine-in-after'
|
const useType = 'dine-in-after'
|
||||||
function getUseType(){
|
function getUseType() {
|
||||||
const type=localStorage.getItem("useType")
|
const type = localStorage.getItem("useType")
|
||||||
return type?type:useType
|
return type ? type : useType
|
||||||
}
|
}
|
||||||
|
|
||||||
// 购物车-临时菜添加
|
// 购物车-临时菜添加
|
||||||
|
|
@ -12,9 +12,9 @@ export function $temporaryDishes(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/place/temporaryDishes',
|
url: '/api/place/temporaryDishes',
|
||||||
method: "post",
|
method: "post",
|
||||||
data:{
|
data: {
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
useType:getUseType(),
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -24,12 +24,27 @@ export function $updatePrice(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/place/updatePrice',
|
url: '/api/place/updatePrice',
|
||||||
method: "put",
|
method: "put",
|
||||||
data:{
|
data: {
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 购物车-转桌/并桌
|
||||||
|
*/
|
||||||
|
export function placeswitch(data) {
|
||||||
|
return request({
|
||||||
|
url: `/api/place/switch`,
|
||||||
|
method: "put",
|
||||||
|
data: {
|
||||||
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: localStorage.getItem("useType"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 团购券-获取可使用团购券列表
|
// 团购券-获取可使用团购券列表
|
||||||
|
|
||||||
|
|
@ -37,7 +52,7 @@ export function $thirdPartyCoupon(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/thirdPartyCoupon/list',
|
url: '/api/thirdPartyCoupon/list',
|
||||||
method: "get",
|
method: "get",
|
||||||
params:{
|
params: {
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +63,7 @@ export function $checkCoupon(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/place/checkCoupon',
|
url: '/api/place/checkCoupon',
|
||||||
method: "post",
|
method: "post",
|
||||||
data:{
|
data: {
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
|
|
@ -59,8 +74,8 @@ export function $waitCall(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/place/waitCall',
|
url: '/api/place/waitCall',
|
||||||
method: "put",
|
method: "put",
|
||||||
data:{
|
data: {
|
||||||
useType:getUseType(),
|
useType: getUseType(),
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
<template>
|
||||||
|
<div class="select_desk">
|
||||||
|
<el-dialog title="请选择商品" :visible.sync="show">
|
||||||
|
<div style="padding: 10px 0;display: flex;justify-content: space-between;align-items: center;">
|
||||||
|
<el-checkbox v-model="isFull">并桌</el-checkbox>
|
||||||
|
<el-select v-model="targetTableId" placeholder="请选择目标台桌">
|
||||||
|
<el-option v-for="item in originTableList" :key="item.tableId" :label="item.name"
|
||||||
|
:value="item.tableId" @click="changeTable(item, index)">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div v-if="!isFull">
|
||||||
|
<div v-if="itemdata.list.length > 0">
|
||||||
|
<el-table ref="reftransfertoPinpin" :data="itemdata.list" tooltip-effect="dark" style="width: 100%"
|
||||||
|
@selection-change="handleSelectionChange($event)">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column label="图片" prop="coverImg">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-image style="width: 50px; height: 50px" :src="scope.row.coverImg"
|
||||||
|
fit="cover"></el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="名称" prop="name" />
|
||||||
|
<el-table-column prop="number" label="数量" />
|
||||||
|
<el-table-column prop="price" label="价格">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>
|
||||||
|
¥{{ (scope.row.salePrice * scope.row.number).toFixed(2) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div v-for="(orderItem, orderIndex) in itemdata.old.list" :key="orderIndex">
|
||||||
|
<h4>第{{ orderItem.placeNum }}次下单商品</h4>
|
||||||
|
<el-table ref="reftransfertoPinpin" :data="orderItem.info" tooltip-effect="dark"
|
||||||
|
style="width: 100%" @selection-change="handleSelectionChange($event, orderIndex)">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column label="图片" prop="coverImg">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-image style="width: 50px; height: 50px" :src="scope.row.coverImg"
|
||||||
|
fit="cover"></el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="名称" prop="name" />
|
||||||
|
<el-table-column prop="number" label="数量" />
|
||||||
|
<el-table-column prop="price" label="价格">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>
|
||||||
|
¥{{ (scope.row.salePrice * scope.row.number).toFixed(2) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="buttonbox">
|
||||||
|
<el-button type="primary" @click="confirm">确定</el-button>
|
||||||
|
<el-button @click="toggleSelection">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { placeswitch } from "@/api/Instead";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
itemdata: {},
|
||||||
|
list: [],
|
||||||
|
masterId: '',
|
||||||
|
currentTableId: '',
|
||||||
|
targetTableId: '',
|
||||||
|
originTableList: [],//桌台列表
|
||||||
|
multipleSelection: [],
|
||||||
|
isFull: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toggleSelection() {
|
||||||
|
if (this.itemdata.list.length > 0) {
|
||||||
|
this.$refs.reftransfertoPinpinclearSelection();
|
||||||
|
} else {
|
||||||
|
this.$refs.reftransfertoPinpin.forEach((a) => {
|
||||||
|
a.clearSelection();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSelectionChange(val, index) {
|
||||||
|
try {
|
||||||
|
if (this.itemdata.list.length > 0) {
|
||||||
|
this.multipleSelection = val
|
||||||
|
} else {
|
||||||
|
this.itemdata.old.list.forEach((a, i) => {
|
||||||
|
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) { }
|
||||||
|
},
|
||||||
|
async confirm() {
|
||||||
|
console.log(this.itemdata, this.multipleSelection)
|
||||||
|
if (!this.targetTableId) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选择目标台桌!',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
await placeswitch({
|
||||||
|
masterId: this.masterId,
|
||||||
|
orderId: this.itemdata.orderId,//当前台桌订单id 可选
|
||||||
|
cartIds: this.isFull ? '' : this.multipleSelection.flatMap(subArray => subArray.map(item => item.cartId)),//转单的购物车商品 并桌时可不传 可选
|
||||||
|
isFull: this.isFull,//并台会将全部购物车商品转入,默认为false 可选
|
||||||
|
currentTableId: this.currentTableId,
|
||||||
|
targetTableId: this.targetTableId,
|
||||||
|
|
||||||
|
})
|
||||||
|
this.$forceUpdate();
|
||||||
|
this.$emit("transfertoPinpin");
|
||||||
|
this.show = false;
|
||||||
|
|
||||||
|
},
|
||||||
|
open(item, masterId, currentTableId, originTableList) {
|
||||||
|
this.itemdata = item
|
||||||
|
this.masterId = masterId//取餐码
|
||||||
|
this.currentTableId = currentTableId//当前桌台id
|
||||||
|
this.originTableList = originTableList//台桌列表
|
||||||
|
try {
|
||||||
|
if (this.itemdata.list.length > 0) {
|
||||||
|
this.$refs.reftransfertoPinpinclearSelection();
|
||||||
|
} else {
|
||||||
|
this.$refs.reftransfertoPinpin.forEach((a) => {
|
||||||
|
a.clearSelection();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) { }
|
||||||
|
this.show = true;
|
||||||
|
},
|
||||||
|
returnTableColor(key) {
|
||||||
|
const item = $status[key];
|
||||||
|
return item ? item.type : "";
|
||||||
|
},
|
||||||
|
changeTable(item, index) {
|
||||||
|
console.log(item, index)
|
||||||
|
},
|
||||||
|
searchInput(e) {
|
||||||
|
console.log(e);
|
||||||
|
// this.tableList = $originTableList.filter((v) =>
|
||||||
|
// $strMatch(v.name, e.trim())
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep.el-button {
|
||||||
|
padding: 12px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select_desk {
|
||||||
|
.box {
|
||||||
|
margin: 20px 10px;
|
||||||
|
|
||||||
|
.boxspan {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonbox {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px 0;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -379,7 +379,7 @@
|
||||||
删除
|
删除
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn" :class="{ disabled: !order.list.length || order.old.list.length }" @click="saveOrder">
|
<!-- <div class="btn" :class="{ disabled: !order.list.length || order.old.list.length }" @click="saveOrder">
|
||||||
存单
|
存单
|
||||||
</div>
|
</div>
|
||||||
<div class="btn relative" :class="{
|
<div class="btn relative" :class="{
|
||||||
|
|
@ -389,7 +389,7 @@
|
||||||
<span class="prve-car-len" v-if="prveOrder.list.length">{{
|
<span class="prve-car-len" v-if="prveOrder.list.length">{{
|
||||||
prveOrder.list.length
|
prveOrder.list.length
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<!-- <div
|
<!-- <div
|
||||||
class="btn"
|
class="btn"
|
||||||
|
|
@ -434,7 +434,11 @@
|
||||||
:class="{ disabled: isCreateOrder }">
|
:class="{ disabled: isCreateOrder }">
|
||||||
{{ returnWaingAllText }}
|
{{ returnWaingAllText }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="btn no-wrap u-font-12" @click="clicktransfertoPinpin()"
|
||||||
|
v-if="table.name && useTypes.sel == 'dine-in'">
|
||||||
|
转桌/并桌
|
||||||
|
</div>
|
||||||
|
<!-- -->
|
||||||
<!-- <div
|
<!-- <div
|
||||||
class="btn"
|
class="btn"
|
||||||
:class="{ disabled: order.old.list.length <= 0 }"
|
:class="{ disabled: order.old.list.length <= 0 }"
|
||||||
|
|
@ -1022,6 +1026,8 @@
|
||||||
</popup-weight-goods>
|
</popup-weight-goods>
|
||||||
<!-- 可选套餐 -->
|
<!-- 可选套餐 -->
|
||||||
<dialogpackage ref="refdialogpackage" @dialogpackageconfirm="dialogpackageconfirm"></dialogpackage>
|
<dialogpackage ref="refdialogpackage" @dialogpackageconfirm="dialogpackageconfirm"></dialogpackage>
|
||||||
|
<!-- 并桌/转桌 -->
|
||||||
|
<transfertoPinpin ref="refransfertoPinpin" @transfertoPinpin="xiadanClick"></transfertoPinpin>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -1046,6 +1052,8 @@ import tuanQuanTable from "./components/tuan-quan-table.vue";
|
||||||
import popupChooseGuazhang from "./components/popup-choose-guazhang.vue";
|
import popupChooseGuazhang from "./components/popup-choose-guazhang.vue";
|
||||||
import popupWeightGoods from "./components/popup-weight-goods.vue";
|
import popupWeightGoods from "./components/popup-weight-goods.vue";
|
||||||
import dialogpackage from "./components/dialogpackage.vue";
|
import dialogpackage from "./components/dialogpackage.vue";
|
||||||
|
import transfertoPinpin from "./components/transfertoPinpin.vue";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
@ -1122,7 +1130,8 @@ export default {
|
||||||
cartItem,
|
cartItem,
|
||||||
chooseDinersNumber,
|
chooseDinersNumber,
|
||||||
PopupChooseGuazhang,
|
PopupChooseGuazhang,
|
||||||
dialogpackage
|
dialogpackage,
|
||||||
|
transfertoPinpin
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -2881,7 +2890,18 @@ export default {
|
||||||
// return { ...v, cart: JSON.parse(v.cart) };
|
// return { ...v, cart: JSON.parse(v.cart) };
|
||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
|
clicktransfertoPinpin() {
|
||||||
|
if (this.order.list.length < 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '请先选择商品!',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log(this.order, this.masterId, this.table.tableId, this.tableList)
|
||||||
|
// 订单信息,取餐码,用餐类型,台桌列表,桌台号id
|
||||||
|
this.$refs.refransfertoPinpin.open(this.order, this.masterId, this.table.tableId, this.tableList);
|
||||||
|
},
|
||||||
//右侧控制按钮点击事件
|
//右侧控制按钮点击事件
|
||||||
async orderBtnsClick(key) {
|
async orderBtnsClick(key) {
|
||||||
const orderGoods = this.order.list[this.order.selIndex];
|
const orderGoods = this.order.list[this.order.selIndex];
|
||||||
|
|
@ -3438,8 +3458,8 @@ export default {
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
// this.goods.list = [];
|
// this.goods.list = [];
|
||||||
this.isAllWaitCall=false;
|
this.isAllWaitCall = false;
|
||||||
this.selQuan=[];
|
this.selQuan = [];
|
||||||
this.guazhangRen = "";
|
this.guazhangRen = "";
|
||||||
this.order.status = "";
|
this.order.status = "";
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue