优化台桌下单问题
This commit is contained in:
@@ -63,7 +63,8 @@ import skuModal from '@/components/skuModal.vue'
|
||||
import { useShop } from '@/store/shop.js'
|
||||
|
||||
const shopStore = useShop()
|
||||
|
||||
console.log('---------')
|
||||
console.log(shopStore)
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="number" @click="takeFoodCodeRef.show()">
|
||||
<el-text class="t">{{ masterId }}</el-text>
|
||||
</div>
|
||||
<div class="select_user" @click="fastCashierRef.show()"
|
||||
<div class="select_user" @click="quickCashHandle"
|
||||
v-if="!global.orderMemberInfo.telephone && !global.tableInfo.id">
|
||||
<div class="left">
|
||||
<el-icon class="icon">
|
||||
@@ -32,7 +32,10 @@
|
||||
<div class="t" v-if="global.orderMemberInfo.telephone">
|
||||
会员:{{ global.orderMemberInfo.telephone }}
|
||||
</div>
|
||||
<div class="t" v-if="global.tableInfo.id">台桌:{{ global.tableInfo.name }}</div>
|
||||
<div class="t" v-if="global.tableInfo.id">
|
||||
台桌:{{ global.tableInfo.name }}
|
||||
<span v-if="global.tableInfo.num">/{{ global.tableInfo.num }}人</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-icon class="arrow">
|
||||
@@ -107,7 +110,8 @@
|
||||
<el-button icon="Edit" @click="remarkRef.show()"></el-button>
|
||||
<div class="button">
|
||||
<div class="btn" v-if="shopStore.info.registerType == 'restaurant'">
|
||||
<el-button type="primary" style="width: 100%;" :disabled="!cartList.length" @click="createOrderHandle(0)">
|
||||
<el-button type="primary" style="width: 100%;" :disabled="!cartList.length" v-loading="createOrderLoading"
|
||||
@click="createOrderHandle(0)">
|
||||
<template v-if="!createOrderLoading">
|
||||
仅下单</template>
|
||||
<template v-else>下单中...</template>
|
||||
@@ -182,6 +186,8 @@ import {
|
||||
createOrder,
|
||||
} from "@/api/product";
|
||||
|
||||
import { orderChoseCount } from '@/api/table.js'
|
||||
|
||||
import { queryShopInfo, staffPermission } from '@/api/user.js'
|
||||
|
||||
// 商品列表
|
||||
@@ -224,6 +230,16 @@ const masterId = ref("");
|
||||
// 挂单量
|
||||
const pendingCartNum = ref(0);
|
||||
|
||||
// 快捷收银
|
||||
async function quickCashHandle() {
|
||||
try {
|
||||
await staffPermission('yun_xu_shou_kuan')
|
||||
fastCashierRef.value.show()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 生成订单
|
||||
async function createOrderHandle(t = 0) {
|
||||
try {
|
||||
@@ -245,6 +261,7 @@ async function createOrderHandle(t = 0) {
|
||||
|
||||
if (shopStore.info.registerType == 'restaurant' && t == 0) {
|
||||
ElMessage.success('下单成功')
|
||||
queryCartAjax()
|
||||
} else {
|
||||
settleAccountRef.value.show();
|
||||
}
|
||||
@@ -335,6 +352,7 @@ async function delCartHandle(params) {
|
||||
cartLoading.value = false;
|
||||
cartListActive.value = 0;
|
||||
} catch (error) {
|
||||
cartLoading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
@@ -418,8 +436,7 @@ async function queryCartAjax() {
|
||||
masterId: masterId.value,
|
||||
shopId: store.userInfo.shopId,
|
||||
tableId: global.tableInfo.qrcode || '',
|
||||
vipUserId: global.orderMemberInfo.id || '',
|
||||
num: ''
|
||||
vipUserId: global.orderMemberInfo.id || ''
|
||||
});
|
||||
|
||||
if (!res.list.length) {
|
||||
@@ -465,8 +482,23 @@ async function queryCartAjax() {
|
||||
}
|
||||
}
|
||||
|
||||
// 增加点餐人数
|
||||
async function addTableNum() {
|
||||
try {
|
||||
const res = await orderChoseCount({
|
||||
masterId: masterId.value,
|
||||
shopId: store.userInfo.shopId,
|
||||
tableId: global.tableInfo.qrcode,
|
||||
num: global.tableInfo.num
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取取餐码
|
||||
async function createCodeAjax(type = "0") {
|
||||
console.log(1111)
|
||||
try {
|
||||
// if (!process.env.VITE_DEV_SERVER_URL) {
|
||||
// masterId.value = '#20'
|
||||
@@ -486,7 +518,11 @@ async function createCodeAjax(type = "0") {
|
||||
});
|
||||
masterId.value = res.code;
|
||||
}
|
||||
queryCartAjax();
|
||||
|
||||
if (global.tableInfo.num) {
|
||||
await addTableNum()
|
||||
}
|
||||
await queryCartAjax();
|
||||
|
||||
if (type == 1) {
|
||||
// 结算订单 清楚商品所有红点
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="demo_tabs_div">
|
||||
<el-input v-model="tableData.phone" placeholder="请输入手机号" @input="inputChange" clearable @focus="
|
||||
global.updateData(false)" @blur="global.updateData(true)" />
|
||||
<el-button style="margin-left: 10px;" type="primary" @click="memberaddshow = true">添加</el-button>
|
||||
<el-button style="margin-left: 10px;" type="primary" @click="addMemberHandle">添加</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="tableData.list" style="width: 100%;margin-top: 10px;height:80%;"
|
||||
@@ -85,7 +85,7 @@
|
||||
<div class="orderbox_right_button" v-if="props.membershow == '0'">
|
||||
<!-- <el-button style="width: 100%;" @click="toHome">创建订单</el-button> -->
|
||||
<!-- <el-button style="width: 60%;" type="primary" @click="recharge = true">账户充值</el-button> -->
|
||||
<el-button style="width: 100%;" type="primary" @click="userChargeRef.show()">账户充值</el-button>
|
||||
<el-button style="width: 100%;" type="primary" @click="menberAddNnum">账户充值</el-button>
|
||||
</div>
|
||||
<div class="orderbox_right_button" v-if="props.membershow == '1'">
|
||||
<router-link to="/" style="width: 35%;">
|
||||
@@ -176,6 +176,7 @@ import payCard from '@/components/payCard/payCard.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import useStorage from '@/utils/useStorage'
|
||||
import userCharge from './components/userCharge.vue'
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
const global = useGlobal()
|
||||
@@ -238,6 +239,26 @@ const payCarddialogVisible = ref(false)
|
||||
|
||||
const orderId = ref('')
|
||||
|
||||
// 添加会员
|
||||
async function addMemberHandle() {
|
||||
try {
|
||||
await staffPermission('yun_xu_guan_li_hui_yuan_xin_xi')
|
||||
memberaddshow.value = true
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 账户充值
|
||||
async function menberAddNnum() {
|
||||
try {
|
||||
await staffPermission('yun_xu_xiu_gai_hui_yuan_yu_e')
|
||||
userChargeRef.value.show()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 退款成功
|
||||
function refundSuccess() {
|
||||
asyncqueryMembermember()
|
||||
|
||||
@@ -60,12 +60,12 @@
|
||||
<div class="people_num_wrap" v-show="showPeopleNum">
|
||||
<div class="title">应选择就餐人数</div>
|
||||
<div class="num_btns">
|
||||
<div class="item" :class="{ active: peopleNum == item }" v-for="item in 8"
|
||||
@click="peopleNum = item">{{ item }}人</div>
|
||||
<div class="item" :class="{ active: peopleNum == 'custom' }">
|
||||
<div class="item" :class="{ active: peopleNum == item }"
|
||||
v-for="item in props.tableInfo.maxCapacity" @click="peopleNum = item">{{ item }}人</div>
|
||||
<!-- <div class="item" :class="{ active: peopleNum == 'custom' }">
|
||||
<input class="ipt" @focus="inputFocus" placeholder="自定义" v-model="peopleNumInputValue"
|
||||
@change="" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%;"
|
||||
@@ -92,6 +92,9 @@ import { formatDecimal } from '@/utils/index.js'
|
||||
import settleAccount from "@/views/home/components/settleAccount.vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { clearTable } from '@/api/table.js'
|
||||
import { useShop } from '@/store/shop.js'
|
||||
|
||||
const shopStore = useShop()
|
||||
|
||||
const router = useRouter()
|
||||
const global = useGlobal()
|
||||
@@ -143,7 +146,11 @@ function showPayHandle() {
|
||||
|
||||
// 显示就就餐人数
|
||||
function showPeopleNumHandle() {
|
||||
showPeopleNum.value = true
|
||||
if (shopStore.info.isTableFee == 1) {
|
||||
orderDownHandle()
|
||||
} else {
|
||||
showPeopleNum.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 清理桌台
|
||||
@@ -202,17 +209,16 @@ function isPositiveInteger(num) {
|
||||
|
||||
// 选择人数后确认下单
|
||||
function orderDownHandle() {
|
||||
if (peopleNum.value == 'custom') {
|
||||
if (!isPositiveInteger(parseFloat(peopleNumInputValue.value))) {
|
||||
ElMessage.error('请输入有效的就餐人数')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// if (peopleNum.value == 'custom') {
|
||||
// if (!isPositiveInteger(parseFloat(peopleNumInputValue.value))) {
|
||||
// ElMessage.error('请输入有效的就餐人数')
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// 直接点单
|
||||
global.setOrderTable({
|
||||
...props.tableInfo,
|
||||
num: peopleNum.value == 'custom' ? peopleNumInputValue.value : peopleNum.value
|
||||
num: peopleNum.value
|
||||
})
|
||||
router.push({
|
||||
name: 'home',
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
</el-icon>
|
||||
<div style="margin-left: 4px;">返回</div>
|
||||
</div>
|
||||
<router-link to='/workrecord' class="box_top_right">
|
||||
<div class="box_top_right" @click="checkRecord">
|
||||
交班记录
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content">
|
||||
<div class="box_content_left">
|
||||
@@ -146,6 +146,8 @@ import { useUser } from "@/store/user.js";
|
||||
import { useSocket } from "@/store/socket.js";
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
|
||||
const printStore = usePrint();
|
||||
|
||||
const socket = useSocket();
|
||||
@@ -161,10 +163,21 @@ const loading = ref(false);
|
||||
|
||||
const isPrint = ref(true)
|
||||
|
||||
// 查看交班记录
|
||||
async function checkRecord() {
|
||||
try {
|
||||
const res = await staffPermission('yun_xu_cha_kan_suo_you_jiao_ban_ji_lu')
|
||||
router.push('/workrecord')
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 开始交班
|
||||
const exit = async () => {
|
||||
try {
|
||||
await staffPermission('yun_xu_jiao_ban')
|
||||
|
||||
let data = {}
|
||||
// 获取交班打印小票数据
|
||||
data = await handoverData({
|
||||
|
||||
Reference in New Issue
Block a user