增加代客下单权限校验

This commit is contained in:
2024-10-21 10:58:33 +08:00
parent c86a85473b
commit ec7db7612b
3 changed files with 74 additions and 16 deletions

View File

@@ -102,7 +102,7 @@ export async function hasPermission (params) {
}
params = returnFormatParams(params)
if (!params) {
return infoBox.showToast('未找到相关权限请检查代码或在权限配置文件commons/utils/hasPermission.js文件进行修改或增加')
return Notification.error('未找到相关权限请检查代码或在权限配置文件commons/utils/hasPermission.js文件进行修改或增加')
}
const option = Object.assign({
tips: true,

View File

@@ -229,6 +229,7 @@ import tableDiancan from "./components/table-diancan.vue";
import $status from "./status.js";
import chooseDinersNumber from "./components/table-diancan-components/choose-diners-number.vue";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
import {
tbShopTableGet,
@@ -369,7 +370,12 @@ export default {
onDiancanClose() {
this.tbShopTableGet();
},
diancanShow(item, key) {
async diancanShow(item, key) {
const canXiadan=await hasPermission('允许下单')
if(!canXiadan){
return
}
//key isAddGoods 加菜
//key isPayOrder结账
this.selTable = item;

View File

@@ -1,7 +1,13 @@
<!-- eslint-disable no-empty -->
<template>
<div class="el-dialog">
<div class="bg-fff">
<div class="bg-fff u-relative">
<div
class="u-fixed position-all"
style="z-index: 999"
v-if="!canXiadan"
@click="xiadanClick"
></div>
<div class="flex head row-between flex-y-center u-m-l-20">
<div class="flex" style="width: 500px">
<div class="u-font-16 color-333 font-bold" style="margin-right: 10px">
@@ -299,8 +305,6 @@
></cart-item>
</template>
</div>
</div>
<!-- 已下单菜品列表 -->
<template v-if="order.old.list.length">
@@ -1181,6 +1185,7 @@ import returnCart from "./components/return-cart.vue";
import moneyKeyboard from "./components/money-keyboard.vue";
import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
import {
getGoodsLists,
@@ -1228,6 +1233,10 @@ export default {
},
data() {
return {
//是否允许收款
canShoukuan: false,
//是否允许下单
canXiadan: false,
//是否是单品备注
isDanNote: false,
//店铺信息
@@ -1721,6 +1730,7 @@ export default {
},
},
mounted() {
this.xiadanClick();
// this.getGoods();
// this.getCategory();
// this.refToggle('refScanCode',true)
@@ -1729,6 +1739,13 @@ export default {
this.open(this.$route.query.tableId ? this.$route.query : "");
},
methods: {
async shoukuanClick() {
this.canShoukuan = await hasPermission("允许收款");
},
// 打开页面
async xiadanClick() {
this.canXiadan = await hasPermission("允许下单");
},
changeOrderExtraSel(index, canChangeNumber, placeNum) {
// console.log(index,canChangeNumber,placeNum)
this.order.selIndex = -1;
@@ -1740,6 +1757,10 @@ export default {
if (this.order.list.length <= 0) {
return this.$message("请选择菜品");
}
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
// if(this.isCreateOrder){
// return
// }
@@ -1749,7 +1770,11 @@ export default {
this.order.payType = "";
this.isCreateOrder = true;
},
cashPayClick() {
async cashPayClick() {
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
this.$confirm("是否确认已现金收款:" + this.allPrice + "?", "快捷支付", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -1813,11 +1838,19 @@ export default {
// this.useTypes.sel = "dine-in";
},
async cachePay() {
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
await this.returnCreateOrderData();
this.payBeforeClear({});
this.pays();
},
async scanPayClick() {
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
await this.returnCreateOrderData();
this.payBeforeClear();
this.order.payType = "scanCode";
@@ -1965,9 +1998,10 @@ export default {
});
this.order.selGoods.status = "return";
this.order.old.selIndex = -1;
this.getCart()
this.getCart();
console.log(this.order.selGoods);
},
// 台桌列表
async getTable() {
try {
@@ -2015,7 +2049,11 @@ export default {
ChangeDiscount(discount) {
this.createOrder.discount = discount;
},
disCountShow() {
async disCountShow() {
const canDiscount = await hasPermission("允许打折");
if (!canDiscount) {
return;
}
const { amount } = this.createOrder.data;
this.refToggle("refDiscount", true, {
amount,
@@ -2200,7 +2238,21 @@ export default {
this.isCreateOrder = false;
},
//生成订单
toCreateOrderDebounce(isNowPay) {
async toCreateOrderDebounce(isNowPay) {
if (!isNowPay) {
//仅下单
const canXiadan = await this.xiadanClick();
if (!canXiadan) {
return;
}
}else{
//去结算
const canJiesuan = await this.shoukuanClick();
if (!canJiesuan) {
return;
}
}
console.log(this.createOrder.status);
if (
this.createOrder.status != "" &&
@@ -2216,14 +2268,14 @@ export default {
console.log(this.order.orderId);
let res = "";
try {
const seatFee = await $choseCount({
masterId: this.masterId,
tableId: this.table.tableId,
num: this.perpole,
});
this.order.seatFee = seatFee;
const seatFee = await $choseCount({
masterId: this.masterId,
tableId: this.table.tableId,
num: this.perpole,
});
this.order.seatFee = seatFee;
this.order.seatFee = res;
this.order.seatFee = res;
res = await $createOrder({
masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,