代客下单

1.增加删除挂单判断当前挂单是否为当前订单
2.修复备注问题
This commit is contained in:
YeMingfei666 2024-08-23 18:14:37 +08:00
parent ec75feddce
commit f2c73eca9a
2 changed files with 127 additions and 41 deletions

View File

@ -83,8 +83,8 @@ export default {
const newTags=new Set([this.note,...originTags])
console.log(newTags)
localStorage.setItem("tags", JSON.stringify([...newTags]));
this.$emit('confirm',this.note)
}
this.$emit('confirm',this.note)
this.close()
}
},
@ -93,7 +93,11 @@ export default {
</script>
<style lang="scss" scoped>
::v-deep.el-tag {
::v-deep .el-dialog__body{
margin-bottom: 14px;
margin-top: 14px;
}
::v-deep .el-tag {
margin-top: 10px;
margin-right: 10px;
margin-bottom: 5px;

View File

@ -22,9 +22,44 @@
<el-dropdown-item :command="true">后付费</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<span @click="toggleFullScreen" class="flex flex-xy-center cur-pointer full-screen" >
<svg v-if="!isFullScreen" t="1724396447139" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8943" width="128" height="128"><path d="M358.4 768H426.666667v85.333333H213.333333v-213.333333h85.333334v68.266667l128-128 59.733333 59.733333-128 128z m345.6 0l-128-128 59.733333-59.733333 132.266667 132.266666V640h85.333333v213.333333h-213.333333v-85.333333h64zM358.4 298.666667l128 128-59.733333 59.733333-128-128V426.666667H213.333333V213.333333h213.333334v85.333334H358.4z m345.6 0H640V213.333333h213.333333v213.333334h-85.333333V354.133333l-132.266667 132.266667-59.733333-59.733333 128-128z" fill="#666666" p-id="8944"></path></svg>
<svg v-else t="1724396479520" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9141" width="128" height="128"><path d="M298.666667 631.466667H226.133333v-81.066667h217.6v204.8h-85.333333v-68.266667l-128 128L170.666667 759.466667l128-128z m422.4 0l128 128-59.733334 59.733333-128-128v68.266667h-85.333333V554.666667h217.6v81.066666h-72.533333zM298.666667 341.333333L187.733333 230.4 243.2 170.666667l115.2 115.2V217.6h85.333333v204.8H226.133333V341.333333H298.666667z m430.933333 0h64v81.066667h-217.6V217.6h85.333333v72.533333L780.8 170.666667l59.733333 59.733333L729.6 341.333333z" fill="#666666" p-id="9142"></path></svg>
<span
@click="toggleFullScreen"
class="flex flex-xy-center cur-pointer full-screen"
>
<svg
v-if="!isFullScreen"
t="1724396447139"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="8943"
width="128"
height="128"
>
<path
d="M358.4 768H426.666667v85.333333H213.333333v-213.333333h85.333334v68.266667l128-128 59.733333 59.733333-128 128z m345.6 0l-128-128 59.733333-59.733333 132.266667 132.266666V640h85.333333v213.333333h-213.333333v-85.333333h64zM358.4 298.666667l128 128-59.733333 59.733333-128-128V426.666667H213.333333V213.333333h213.333334v85.333334H358.4z m345.6 0H640V213.333333h213.333333v213.333334h-85.333333V354.133333l-132.266667 132.266667-59.733333-59.733333 128-128z"
fill="#666666"
p-id="8944"
></path>
</svg>
<svg
v-else
t="1724396479520"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="9141"
width="128"
height="128"
>
<path
d="M298.666667 631.466667H226.133333v-81.066667h217.6v204.8h-85.333333v-68.266667l-128 128L170.666667 759.466667l128-128z m422.4 0l128 128-59.733334 59.733333-128-128v68.266667h-85.333333V554.666667h217.6v81.066666h-72.533333zM298.666667 341.333333L187.733333 230.4 243.2 170.666667l115.2 115.2V217.6h85.333333v204.8H226.133333V341.333333H298.666667z m430.933333 0h64v81.066667h-217.6V217.6h85.333333v72.533333L780.8 170.666667l59.733333 59.733333L729.6 341.333333z"
fill="#666666"
p-id="9142"
></path>
</svg>
</span>
</div>
@ -1041,8 +1076,10 @@ export default {
},
data() {
return {
//
isPrverOrder: false,
//
isFullScreen:false,
isFullScreen: false,
moneyKeyboard: {
show: true,
title: "支付",
@ -1406,27 +1443,32 @@ export default {
let element = document.documentElement;
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) { /* Firefox */
} else if (element.mozRequestFullScreen) {
/* Firefox */
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
} else if (element.webkitRequestFullscreen) {
/* Chrome, Safari & Opera */
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) { /* IE/Edge */
} else if (element.msRequestFullscreen) {
/* IE/Edge */
element.msRequestFullscreen();
}
this.isFullScreen=true
this.isFullScreen = true;
},
exitFullScreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) { /* Firefox */
} else if (document.mozCancelFullScreen) {
/* Firefox */
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */
} else if (document.webkitExitFullscreen) {
/* Chrome, Safari and Opera */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) { /* IE/Edge */
} else if (document.msExitFullscreen) {
/* IE/Edge */
document.msExitFullscreen();
}
this.isFullScreen=false
this.isFullScreen = false;
},
//
openMoneyKeyboard() {
@ -1511,8 +1553,11 @@ export default {
return this.close();
}
this.createOrder.data = res;
const { masterId } = await this.getMasterId();
this.masterId = masterId;
if (!this.isPrverOrder) {
const { masterId } = await this.getMasterId();
this.masterId = masterId;
}
this.isCreateOrder = true;
},
@ -1657,11 +1702,13 @@ export default {
// tableId:this.table.tableId,
// masterId:order.carList[0].masterId
// })
const { masterId, tableId, userId } = await $cacheOrder({
const { masterId, tableId, userId, remark } = await $cacheOrder({
orderId: this.prveOrder.list[this.prveOrder.sel].orderId,
isPending: false,
});
this.masterId = masterId;
this.isPrverOrder = true;
console.log(masterId);
const { records } = await getCart({
masterId,
@ -1673,16 +1720,36 @@ export default {
this.order.masterId = masterId;
this.order.list = records;
this.prveOrder.show = false;
this.note.content = remark || "";
// this.delPrveOrder(false);
},
//
async delPrveOrder(isRequest = true) {
const { sel } = this.prveOrder;
const order = this.prveOrder.list[sel];
const orderMasterId = order.carList[0].masterId;
//
const nowOrderIsPrverOrder =this.isPrverOrder && orderMasterId === this.masterId
if (nowOrderIsPrverOrder) {
const res= await this.$confirm("您正在删除当前购物车订单,是否删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).catch(err=>{
console.log(err)
})
if(!res){
return
}
}
if (isRequest) {
const res = await $delOrder({
orderId: order.orderId,
});
if(nowOrderIsPrverOrder){
this.note.content=''
this.order.list=[]
}
this.$notify({
message: "删除成功",
type: "success",
@ -1692,21 +1759,22 @@ export default {
this.prveOrder.sel = sel - 1 <= 0 ? 0 : sel - 1;
},
//
async cacheOrderShow() {
async cacheOrderShow() {
this.prveOrder.show = true;
const res=await this.getCacheOrder(true)
const res = await this.getCacheOrder(true);
this.prveOrder.list = res;
if(this.prveOrder.list.length&&this.prveOrder.sel!==-1){
const item=this.prveOrder.list[this.prveOrder.sel]
console.log(item)
if(item){
this.prveOrder.selCart=item.carList
if (this.prveOrder.list.length && this.prveOrder.sel !== -1) {
const item = this.prveOrder.list[this.prveOrder.sel];
console.log(item);
if (item) {
this.prveOrder.selCart = item.carList;
}
}
},
//
async getCacheOrder(isReturn=false) {
if(isReturn){
async getCacheOrder(isReturn = false) {
this.createOrderClose();
if (isReturn) {
return $getCacheOrder({ tableId: this.table.tableId });
}
const res = await $getCacheOrder({ tableId: this.table.tableId });
@ -1714,15 +1782,22 @@ export default {
},
//
async saveOrder() {
this.createOrderClose();
const res = await $cacheOrder({
masterId: this.masterId,
tableId: this.table.tableId,
vipUserId: this.vipUser.id,
isPending: true,
note: this.note.content,
});
this.isPrverOrder = false;
this.order.masterId = "";
this.order.list = [];
this.order.selIndex = -1;
this.note.content = "";
this.$nextTick(() => {
this.getCacheOrder();
});
const masterIdRes = await this.getMasterId();
this.masterId = masterIdRes.masterId;
},
@ -2047,6 +2122,7 @@ export default {
this.vipUser = { id: "" };
this.allPack = false;
this.note.content = "";
this.isPrverOrder = false;
},
//
async getCart() {
@ -2283,7 +2359,13 @@ export default {
async getGoods() {
const res = await getGoodsLists(this.goods.query);
console.log(res);
this.goods.list = res.records;
this.goods.list = res.records.filter((v) => {
let isShow = true;
if (v.typeEnum !== "sku") {
isShow = v.specList.length >= 1;
}
return isShow;
});
this.goods.total = res.total;
this.$goodsData = res;
},
@ -2293,6 +2375,7 @@ export default {
const res = await this.getMasterId();
this.masterId = res.masterId;
this.getCart();
this.getGoods();
// this.getPrveCart();
this.getCacheOrder();
},
@ -2334,15 +2417,15 @@ input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.full-screen{
.full-screen {
margin-left: 10px;
svg{
svg {
width: 24px;
height: 24px;
}
&:hover{
path{
fill: #1890ff;
&:hover {
path {
fill: #1890ff;
}
}
}
@ -2501,7 +2584,7 @@ input[type="number"]::-webkit-outer-spin-button {
align-items: center;
background-color: #efefef;
}
::v-deep .el-dialog__body{
::v-deep .el-dialog__body {
padding: 0 20px;
}
.absolute {
@ -2827,8 +2910,7 @@ input[type="number"]::-webkit-outer-spin-button {
margin: 0 10px 10px 0;
cursor: pointer;
}
.tag-group{
.tag-group {
}
::v-deep .tag-group .el-tag {
@ -2976,7 +3058,7 @@ input[type="number"]::-webkit-outer-spin-button {
.diancan {
display: flex;
height: calc(100vh - 75px) ;
height: calc(100vh - 75px);
.choose-user {
padding: 10px 0;
border-bottom: 1px solid #ebebeb;
@ -3065,7 +3147,7 @@ input[type="number"]::-webkit-outer-spin-button {
display: flex;
flex-direction: column;
justify-content: center;
min-width: 70px;
min-width: 70px;
.specSnap {
color: #999;
@ -3100,9 +3182,9 @@ input[type="number"]::-webkit-outer-spin-button {
flex: 1;
background-color: #f7f7fa;
margin-left: 20px;
padding: 0 15px 14px 15px ;
padding: 0 15px 14px 15px;
overflow-x: hidden;
overflow-y: scroll;
overflow-y: scroll;
.goods-list {
display: flex;
flex-wrap: wrap;
@ -3502,7 +3584,7 @@ input[type="number"]::-webkit-outer-spin-button {
.cashier_box {
display: flex;
width: 100%;
padding-top: 14px;
flex: 1;
background: #f7f7fa;
position: relative;