优化台桌下单问题

This commit is contained in:
gyq 2024-10-30 16:00:08 +08:00
parent 773a2cf2c9
commit 8935b9d2f2
11 changed files with 158 additions and 15880 deletions

View File

@ -2,10 +2,10 @@
ENV = development
# 正式ws
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
#测试ws
VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# 阿伟本地ws
# VITE_API_WSS = 'ws://192.168.2.17:9998/client'
@ -29,7 +29,7 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# VITE_API_URL = 'http://192.168.1.34:10589/cashier-client'
# 测试
VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# 预发布
# VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client'
@ -37,4 +37,4 @@ VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# VITE_API_URL = 'https://36z1017t45.goho.co/cashier-client'
# 正式
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'

View File

@ -20,9 +20,10 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# 预发布
VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client'
# VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client'
# 张松本地
# VITE_API_URL = 'https://36z1017t45.goho.co/cashier-client'
# 正式
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "vite-electron",
"private": true,
"version": "1.4.23",
"version": "1.4.25",
"main": "dist-electron/main.js",
"scripts": {
"dev": "chcp 65001 && vite",

View File

@ -38,3 +38,16 @@ export function clearTable(data) {
data,
});
}
/**
* 选择用餐人数
* @param {*} params
* @returns
*/
export function orderChoseCount(data) {
return request({
method: "put",
url: "/order/choseCount",
data,
});
}

View File

@ -95,6 +95,7 @@ import { clearNoNum, formatDecimal } from '@/utils'
import scanModal from '@/components/payCard/scanModal.vue'
import { ElMessage } from "element-plus";
import { useGlobal } from '@/store/global.js'
import { staffPermission } from '@/api/user.js'
const global = useGlobal()
@ -148,26 +149,33 @@ function scanCodeSuccess() {
}
//
function payTypeChange(index, item) {
if (item.disabled) return
payActive.value = index
payType.value = item.payType
if (item.payType == 'scanCode') {
scanModalRef.value.show()
}
if (item.payType == 'vipPay') {
showDialog.value = true
getMemberList()
}
if (payList.value[payActive.value].payType == 'deposit' && !global.orderMemberInfo.id) {
scanModalRef.value.show()
async function payTypeChange(index, item) {
try {
await staffPermission('yun_xu_shou_kuan')
if (item.disabled) return
payActive.value = index
payType.value = item.payType
if (item.payType == 'scanCode') {
scanModalRef.value.show()
}
if (item.payType == 'vipPay') {
showDialog.value = true
getMemberList()
}
if (payList.value[payActive.value].payType == 'deposit' && !global.orderMemberInfo.id) {
scanModalRef.value.show()
}
} catch (error) {
console.log(error);
}
}
//
async function confirmOrder() {
if (payLoading.value) return
try {
await staffPermission('yun_xu_shou_kuan')
if (payLoading.value) return
if (payList.value[payActive.value].payType == 'scanCode') {
scanModalRef.value.show()
} else {

View File

@ -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,

View File

@ -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) {
//

View File

@ -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()

View File

@ -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',

View File

@ -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({