This commit is contained in:
gyq
2024-07-12 16:36:28 +08:00
parent bb554a28d2
commit 8c1e1d3fbc
12 changed files with 304 additions and 342 deletions

View File

@@ -3,10 +3,10 @@ ENV = development
# 正式ws # 正式ws
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client' # VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
#测试ws #测试ws
# VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client' VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# 阿伟本地ws # 阿伟本地ws
# VITE_API_WSS = 'ws://192.168.2.17:9998/client' # VITE_API_WSS = 'ws://192.168.2.17:9998/client'

View File

@@ -2,16 +2,16 @@
ENV = production ENV = production
# 正式ws # 正式ws
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client' # VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
#测试ws #测试ws
# VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client' VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# 测试 php # 测试 php
VITE_API_PHP_URL = 'http://192.168.2.33:1666/index.php/api' VITE_API_PHP_URL = 'http://192.168.2.33:1666/index.php/api'
# 测试 # 测试
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# 线上环境接口地址 # 线上环境接口地址
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/' # VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'

View File

@@ -1,6 +1,7 @@
"use strict"; "use strict";
const path = require("path"); const path = require("path");
const electron = require("electron"); const electron = require("electron");
const os = require("os");
let win; let win;
electron.app.whenReady().then(() => { electron.app.whenReady().then(() => {
win = new electron.BrowserWindow({ win = new electron.BrowserWindow({
@@ -35,6 +36,17 @@ electron.app.whenReady().then(() => {
win.webContents.send("printList", res); win.webContents.send("printList", res);
}); });
}); });
electron.ipcMain.on("getOSmacSync", () => {
let mac = "";
if (os.networkInterfaces().WLAN) {
mac = os.networkInterfaces().WLAN[0].mac;
console.log("wlan.mac===", mac);
} else {
mac = os.networkInterfaces()["以太网"][0].mac;
console.log("以太网.mac===", mac);
}
win.webContents.send("getOSmacRes", mac);
});
const printWin = new electron.BrowserWindow({ const printWin = new electron.BrowserWindow({
show: false, show: false,
width: 464, width: 464,
@@ -123,7 +135,7 @@ electron.app.whenReady().then(() => {
}); });
const tagPrintWin = new electron.BrowserWindow({ const tagPrintWin = new electron.BrowserWindow({
show: false, show: false,
width: 320, width: 360,
height: 240, height: 240,
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
@@ -146,7 +158,7 @@ electron.app.whenReady().then(() => {
silent: true, silent: true,
deviceName: name, deviceName: name,
pageSize: { pageSize: {
width: 4e4, width: 45e3,
height: 3e4 height: 3e4
}, },
scaleFactor: 80, scaleFactor: 80,
@@ -164,6 +176,19 @@ electron.app.whenReady().then(() => {
} }
}); });
}); });
const gotTheLock = electron.app.requestSingleInstanceLock();
if (!gotTheLock) {
electron.app.quit();
} else {
electron.app.on("second-instance", (event, commandLine, workingDirectory) => {
if (win) {
if (win.isMinimized())
win.restore();
win.focus();
win.show();
}
});
}
}); });
electron.app.on("window-all-closed", () => { electron.app.on("window-all-closed", () => {
if (process.platform !== "darwin") if (process.platform !== "darwin")

View File

@@ -1,5 +1,6 @@
import path from "path"; import path from "path";
import { app, BrowserWindow, ipcMain } from "electron"; import { app, BrowserWindow, ipcMain, net } from "electron";
import os from "os";
// const SerialPort = require("serialport"); // const SerialPort = require("serialport");
let win; let win;
@@ -40,6 +41,16 @@ app.whenReady().then(() => {
app.quit(); app.quit();
}); });
// 监听网络在线事件
// net.on("online", () => {
// console.log("网络连接恢复");
// });
// // 监听网络离线事件
// net.on("offline", () => {
// console.log("网络连接断开");
// });
// 给渲染进程返回打印机列表 // 给渲染进程返回打印机列表
ipcMain.on("getPrintList", () => { ipcMain.on("getPrintList", () => {
win.webContents.getPrintersAsync().then((res) => { win.webContents.getPrintersAsync().then((res) => {
@@ -47,6 +58,19 @@ app.whenReady().then(() => {
}); });
}); });
// 获取本机mac
ipcMain.on("getOSmacSync", () => {
let mac = "";
if (os.networkInterfaces().WLAN) {
mac = os.networkInterfaces().WLAN[0].mac;
console.log("wlan.mac===", mac);
} else {
mac = os.networkInterfaces()["以太网"][0].mac;
console.log("以太网.mac===", mac);
}
win.webContents.send("getOSmacRes", mac);
});
// ipcMain.on("getSerialPort", () => { // ipcMain.on("getSerialPort", () => {
// SerialPort.SerialPort.list().then( // SerialPort.SerialPort.list().then(
// (ports) => { // (ports) => {
@@ -165,7 +189,7 @@ app.whenReady().then(() => {
// 标签小票的窗口 // 标签小票的窗口
const tagPrintWin = new BrowserWindow({ const tagPrintWin = new BrowserWindow({
show: false, show: false,
width: 320, width: 360,
height: 240, height: 240,
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
@@ -196,7 +220,7 @@ app.whenReady().then(() => {
silent: true, silent: true,
deviceName: name, deviceName: name,
pageSize: { pageSize: {
width: 40000, width: 45000,
height: 30000, height: 30000,
}, },
scaleFactor: 80, scaleFactor: 80,
@@ -214,8 +238,21 @@ app.whenReady().then(() => {
}, },
}); });
}); });
});
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit();
} else {
app.on("second-instance", (event, commandLine, workingDirectory) => {
// 当运行第二个实例时,将会聚焦到mainWindow这个窗口
if (win) {
if (win.isMinimized()) win.restore();
win.focus();
win.show();
}
});
}
});
app.on("window-all-closed", () => { app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit(); if (process.platform !== "darwin") app.quit();
}); });

View File

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

View File

@@ -9,24 +9,25 @@
html, html,
body { body {
width: 100%; width: 100vw;
height: 100%; height: 100vh;
} }
body { body {
padding: 2mm; padding: 10px;
} }
#app { #app {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
} }
.print_view { .print_view {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; padding-left: 12px;
} }
.print_view .ewm { .print_view .ewm {
width: 50px; width: 50px;
@@ -59,12 +60,12 @@ body {
align-items: flex-end; align-items: flex-end;
} }
.print_view .number_wrap .num { .print_view .number_wrap .num {
font-size: 18px; font-size: 14px;
font-weight: bold; font-weight: bold;
} }
.print_view .number_wrap .info { .print_view .number_wrap .info {
margin-left: 12px; margin-left: 10px;
padding-bottom: 4px; padding-bottom: 2px;
} }
.print_view .time { .print_view .time {
font-weight: bold; font-weight: bold;

View File

@@ -7,21 +7,22 @@
} }
html, html,
body { body {
width: 100%; width: 100vw;
height: 100%; height: 100vh;
} }
body { body {
padding: 2mm; padding: 10px;
} }
#app{ #app {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
} }
.print_view { .print_view {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; padding-left: 12px;
.ewm { .ewm {
$size: 50px; $size: 50px;
width: $size; width: $size;
@@ -46,12 +47,12 @@ body {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
.num { .num {
font-size: 18px; font-size: 14px;
font-weight: bold; font-weight: bold;
} }
.info { .info {
margin-left: 12px; margin-left: 10px;
padding-bottom: 4px; padding-bottom: 2px;
} }
} }
.time { .time {

View File

@@ -22,6 +22,7 @@
</template> </template>
<script setup> <script setup>
import _ from 'lodash'
import { ref, reactive, watch, onMounted } from "vue"; import { ref, reactive, watch, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import leftMenu from "@/components/leftMenu.vue"; import leftMenu from "@/components/leftMenu.vue";
@@ -162,6 +163,20 @@ async function getBarCode(e) {
} }
} }
// 获取网络状态
const updateInfo = _.throttle(function (isOnLine) {
console.log(isOnLine);
if (store.userInfo && store.userInfo.shopId) {
if (isOnLine) {
console.log('有网了重新连接ws~');
socket.init();
} else {
socket.close();
console.log('网络连接失败~');
}
}
}, 100, { leading: true, trailing: false })
onMounted(() => { onMounted(() => {
document.addEventListener("keydown", (e) => { document.addEventListener("keydown", (e) => {
getBarCode(e); getBarCode(e);
@@ -171,6 +186,11 @@ onMounted(() => {
if (store.userInfo && store.userInfo.shopId) { if (store.userInfo && store.userInfo.shopId) {
socket.init(); socket.init();
} }
// 监听网络在线状态
window.addEventListener("onLine", updateInfo(true))
// 监听网络离线
window.addEventListener("offLine", updateInfo(false))
}); });
</script> </script>
@@ -203,28 +223,20 @@ onMounted(() => {
--b-darker: calc(var(--b) * 0.8); --b-darker: calc(var(--b) * 0.8);
--primary-color: rgb(var(--r), var(--g), var(--b)); --primary-color: rgb(var(--r), var(--g), var(--b));
--primary-color-hover: rgb( --primary-color-hover: rgb(var(--r-lighter3),
var(--r-lighter3),
var(--g-lighter3), var(--g-lighter3),
var(--b-lighter3) var(--b-lighter3));
);
--el-color-primary: var(--primary-color) !important; --el-color-primary: var(--primary-color) !important;
--el-button-hover-bg-color: var(--primary-color) !important; --el-button-hover-bg-color: var(--primary-color) !important;
--el-color-primary-light-3: rgb( --el-color-primary-light-3: rgb(var(--r-lighter),
var(--r-lighter),
var(--g-lighter), var(--g-lighter),
var(--b-lighter) var(--b-lighter)) !important;
) !important; --el-color-primary-dark-2: rgb(var(--r-darker),
--el-color-primary-dark-2: rgb(
var(--r-darker),
var(--g-darker), var(--g-darker),
var(--b-darker) var(--b-darker)) !important;
) !important; --el-color-primary-light-5: rgb(var(--r-lighter2),
--el-color-primary-light-5: rgb(
var(--r-lighter2),
var(--g-lighter2), var(--g-lighter2),
var(--b-lighter2) var(--b-lighter2)) !important;
) !important;
--el-font-size-base: 16px !important; --el-font-size-base: 16px !important;
--el-message-close-size: var(--el-font-size-base) !important; --el-message-close-size: var(--el-font-size-base) !important;
@@ -279,8 +291,7 @@ html {
background-color: #555; background-color: #555;
margin-right: 0 !important; margin-right: 0 !important;
padding-bottom: 20px !important; padding-bottom: 20px !important;
border-radius: var(--el-dialog-border-radius) var(--el-dialog-border-radius) 0 border-radius: var(--el-dialog-border-radius) var(--el-dialog-border-radius) 0 0;
0;
} }
.el-dialog__title { .el-dialog__title {
@@ -301,8 +312,7 @@ html {
} }
.el-dialog__body { .el-dialog__body {
padding: calc(var(--el-dialog-padding-primary) + 10px) padding: calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);
var(--el-dialog-padding-primary);
} }
.el-dialog__header { .el-dialog__header {
@@ -390,7 +400,7 @@ html {
display: flex; display: flex;
width: 200%; width: 200%;
& > div { &>div {
width: 50%; width: 50%;
} }

View File

@@ -80,7 +80,8 @@
<takeFoodCode <takeFoodCode
ref="takeFoodCodeRef" ref="takeFoodCodeRef"
title="支付密码" title="支付密码"
type="password" :type="2"
input-type="password"
placeholder="请输入支付密码" placeholder="请输入支付密码"
@success="passwordSuccess" @success="passwordSuccess"
/> />
@@ -141,7 +142,7 @@ function payTypeChange(index, item) {
if (money.value > 0) { if (money.value > 0) {
scanModalRef.value.show(); scanModalRef.value.show();
} else { } else {
ElMessage.error("请输入大于0的金额"); ElMessage.error("请输入金额");
return; return;
} }
} }
@@ -173,13 +174,13 @@ async function confirmOrder() {
try { try {
if (payList.value[payActive.value].payType == "scanCode") { if (payList.value[payActive.value].payType == "scanCode") {
if (money.value <= 0) { if (money.value <= 0) {
ElMessage.error("请输入大于0的金额"); ElMessage.error("请输入金额");
return; return;
} }
scanModalRef.value.show(); scanModalRef.value.show();
} else { } else {
if (money.value <= 0) { if (money.value <= 0) {
ElMessage.error("请输入大于0的金额"); ElMessage.error("请输入金额");
return; return;
} }
switch (payList.value[payActive.value].payType) { switch (payList.value[payActive.value].payType) {

View File

@@ -1,7 +1,7 @@
<!-- 取餐号组件 --> <!-- 取餐号组件 -->
<template> <template>
<el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne"> <el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne">
<el-input :type="props.type" v-model="number" :placeholder="props.placeholder" readonly></el-input> <el-input :type="props.inputType" v-model="number" :placeholder="props.placeholder" readonly></el-input>
<div class="keybord_wrap"> <div class="keybord_wrap">
<div v-for="item in 9" :key="item"> <div v-for="item in 9" :key="item">
<el-button plain type="info" style="width: 100%" @click="inputHandle(item)">{{ item }}</el-button> <el-button plain type="info" style="width: 100%" @click="inputHandle(item)">{{ item }}</el-button>
@@ -24,11 +24,16 @@
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
import { ElMessage } from "element-plus";
const props = defineProps({ const props = defineProps({
type: { type: {
type: [String, Number],
default: 1, // 1取餐号 2密码
},
inputType: {
type: String, type: String,
default: "text", default: 'text'
}, },
title: { title: {
type: String, type: String,
@@ -66,8 +71,19 @@ function delHandle() {
// 确认 // 确认
function confirmHandle() { function confirmHandle() {
if (!number.value) return
if (props.type == 2) {
if (number.value.length < 6) {
ElMessage.error('请输入正确的密码')
return
} else {
emit("success", number.value); emit("success", number.value);
dialogVisible.value = false; dialogVisible.value = false;
}
} else {
emit("success", number.value);
dialogVisible.value = false;
}
} }
defineExpose({ defineExpose({

View File

@@ -4,6 +4,7 @@ import { usePrint } from "@/store/print.js";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import useStorage from "@/utils/useStorage"; import useStorage from "@/utils/useStorage";
import ReconnectingWebSocket from "reconnecting-websocket"; import ReconnectingWebSocket from "reconnecting-websocket";
import { ipcRenderer } from "electron";
export const useSocket = defineStore({ export const useSocket = defineStore({
id: "socket", id: "socket",
@@ -17,8 +18,12 @@ export const useSocket = defineStore({
// 创建uuid // 创建uuid
createUUID() { createUUID() {
if (!useStorage.get("uuid")) { if (!useStorage.get("uuid")) {
useStorage.set("uuid", uuidv4()); ipcRenderer.send("getOSmacSync");
// useStorage.set("uuid", uuidv4());
ipcRenderer.on("getOSmacRes", (event, arg) => {
useStorage.set("uuid", arg);
this.uuid = useStorage.get("uuid"); this.uuid = useStorage.get("uuid");
});
} else { } else {
this.uuid = useStorage.get("uuid"); this.uuid = useStorage.get("uuid");
} }
@@ -46,11 +51,8 @@ export const useSocket = defineStore({
this.ws.addEventListener("open", (event) => { this.ws.addEventListener("open", (event) => {
console.log("wss连接成功"); console.log("wss连接成功");
this.online = true; this.online = true;
// 清除心跳 // 清除心跳
this.clearHeartBeat(); this.clearHeartBeat();
this.startheartbeat();
this.ws.send( this.ws.send(
JSON.stringify({ JSON.stringify({
type: "connect", type: "connect",
@@ -58,6 +60,7 @@ export const useSocket = defineStore({
clientId: this.uuid, clientId: this.uuid,
}) })
); );
this.startheartbeat();
}); });
this.ws.addEventListener("message", (e) => { this.ws.addEventListener("message", (e) => {
@@ -72,9 +75,10 @@ export const useSocket = defineStore({
); );
// 接收订单消息,打印小票 // 接收订单消息,打印小票
// printBill(data) // printBill(data)
// 打印标签小票 // 打印标签小票
printStore.labelPrint(data); printStore.labelPrint(data);
} else if (data.type == "heartbeat") {
console.log("接收心跳");
} }
}); });

View File

@@ -1,162 +1,91 @@
<template> <template>
<div class="orderbox"> <div class="orderbox">
<div class="orderbox_left"> <div class="orderbox_left">
<el-tabs <el-tabs v-model="ordereData.status" class="demo-tabs" @tab-click="handleClick">
v-model="ordereData.status"
class="demo-tabs"
@tab-click="handleClick"
>
<el-tab-pane label="全部" name=""> <el-tab-pane label="全部" name="">
<div class="demo_tabs_div"> <div class="demo_tabs_div">
<el-input <el-input v-model="ordereData.orderNo" placeholder="请输入订单号查询" @input="inputChange" clearable
v-model="ordereData.orderNo" @focus="global.updateData(false)" @blur="global.updateData(true)" />
placeholder="请输入订单号查询"
@input="inputChange"
clearable
@focus="global.updateData(false)"
@blur="global.updateData(true)"
/>
<!-- <el-button style="margin-left: 10px;" type="primary" @click="onSubmit">搜索</el-button> --> <!-- <el-button style="margin-left: 10px;" type="primary" @click="onSubmit">搜索</el-button> -->
</div> </div>
<add <add :loading="loadingboxshow" :ordereData="ordereData" @emititemboxshow="emititemboxshow"
:loading="loadingboxshow" v-if="ordereData.list.length">
:ordereData="ordereData"
@emititemboxshow="emititemboxshow"
v-if="ordereData.list.length"
>
</add> </add>
<div v-else style="width: 100%; text-align: center; margin: 30px 0"> <div v-else style="width: 100%; text-align: center; margin: 30px 0">
暂无数据 暂无数据
</div> </div>
<el-pagination <el-pagination v-if="ordereData.list.length" layout="prev, pager, next, jumper" style="margin-top: 20px"
v-if="ordereData.list.length" :total="Number(ordereData.total)" @current-change="handleCurrentChange" />
layout="prev, pager, next, jumper"
style="margin-top: 20px"
:total="Number(ordereData.total)"
@current-change="handleCurrentChange"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="销售" name="closed"> <el-tab-pane label="销售" name="closed">
<add <add :ordereData="ordereData" @emititemboxshow="emititemboxshow" v-if="ordereData.list.length">
:ordereData="ordereData"
@emititemboxshow="emititemboxshow"
v-if="ordereData.list.length"
>
</add> </add>
<div v-else style="width: 100%; text-align: center; margin: 30px 0"> <div v-else style="width: 100%; text-align: center; margin: 30px 0">
暂无数据 暂无数据
</div> </div>
<el-pagination <el-pagination v-if="ordereData.list.length" layout="prev, pager, next, jumper" style="margin-top: 20px"
v-if="ordereData.list.length" :total="Number(ordereData.total)" @current-change="handleCurrentChange" />
layout="prev, pager, next, jumper"
style="margin-top: 20px"
:total="Number(ordereData.total)"
@current-change="handleCurrentChange"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="退单" name="refund"> <el-tab-pane label="退单" name="refund">
<add <add :ordereData="ordereData" @emititemboxshow="emititemboxshow" v-if="ordereData.list.length">
:ordereData="ordereData"
@emititemboxshow="emititemboxshow"
v-if="ordereData.list.length"
>
</add> </add>
<div v-else style="width: 100%; text-align: center; margin: 30px 0"> <div v-else style="width: 100%; text-align: center; margin: 30px 0">
暂无数据 暂无数据
</div> </div>
<el-pagination <el-pagination v-if="ordereData.list.length" layout="prev, pager, next, jumper" style="margin-top: 20px"
v-if="ordereData.list.length" :total="Number(ordereData.total)" @current-change="handleCurrentChange" />
layout="prev, pager, next, jumper"
style="margin-top: 20px"
:total="Number(ordereData.total)"
@current-change="handleCurrentChange"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="快捷收银" name="cash"> <el-tab-pane label="快捷收银" name="cash">
<cashTable /> <cashTable />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
<div <div class="orderbox_right" v-if="itemboxshow" v-loading="orderDetaildata.loading" :loading="loadingboxshow">
class="orderbox_right"
v-if="itemboxshow"
v-loading="orderDetaildata.loading"
:loading="loadingboxshow"
>
<div class="orderbox_right_top"> <div class="orderbox_right_top">
<span>堂食订单</span> <span>堂食订单</span>
<el-icon <el-icon :size="32" style="color: var(--primary-color)" @click="itemboxshow = false">
:size="32"
style="color: var(--primary-color)"
@click="itemboxshow = false"
>
<CircleCloseFilled /> <CircleCloseFilled />
</el-icon> </el-icon>
</div> </div>
<div class="tableDataclass"> <div class="tableDataclass">
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">订单号</span <span class="span">订单号</span><span class="nunber">{{ orderDetaildata.orderNo }}</span>
><span class="nunber">{{ orderDetaildata.orderNo }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">收银员</span <span class="span">收银员</span><span class="nunber">{{ orderDetaildata.userName }}</span>
><span class="nunber">{{ orderDetaildata.userName }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">创建时间</span <span class="span">创建时间</span><span class="nunber">{{
><span class="nunber">{{
dayjs(orderDetaildata.createdAt).format("YYYY-MM-DD HH:mm:ss") dayjs(orderDetaildata.createdAt).format("YYYY-MM-DD HH:mm:ss")
}}</span> }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">终端</span <span class="span">终端</span><span class="nunber">{{ orderDetaildata.zdNo }}</span>
><span class="nunber">{{ orderDetaildata.zdNo }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">会员</span <span class="span">会员</span><span class="nunber">{{ orderDetaildata.memberName }}</span>
><span class="nunber">{{ orderDetaildata.memberName }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">台桌</span <span class="span">台桌</span><span class="nunber">{{ orderDetaildata.tableId }}</span>
><span class="nunber">{{ orderDetaildata.tableId }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">流水号</span <span class="span">流水号</span><span class="nunber">{{ orderDetaildata.masterId }}</span>
><span class="nunber">{{ orderDetaildata.masterId }}</span>
</div> </div>
<div <div class="orderbox_right_top" style="margin-top: 20px; border-bottom: 2px solid #ccc">
class="orderbox_right_top"
style="margin-top: 20px; border-bottom: 2px solid #ccc"
>
<span>合计</span> <span>合计</span>
<span>{{ orderDetaildata.orderAmount }}</span> <span>{{ orderDetaildata.orderAmount }}</span>
</div> </div>
<div <div class="orderbox_right_top" style="margin-top: 20px; border-bottom: 2px solid #ccc">
class="orderbox_right_top" <span style="font-size: 16px" v-if="orderDetaildata.status == 'pending'">挂单</span>
style="margin-top: 20px; border-bottom: 2px solid #ccc" <span style="font-size: 16px; color: red" v-if="
>
<span
style="font-size: 16px"
v-if="orderDetaildata.status == 'pending'"
>挂单</span
>
<span
style="font-size: 16px; color: red"
v-if="
orderDetaildata.status == 'refund' && orderDetaildata.status == 'refund' &&
orderDetaildata.orderType == 'return' orderDetaildata.orderType == 'return'
" ">退单</span>
>退单</span <span style="font-size: 16px; color: #21c36b" v-if="
>
<span
style="font-size: 16px; color: #21c36b"
v-if="
orderDetaildata.orderType != 'return' && orderDetaildata.orderType != 'return' &&
(orderDetaildata.status == 'refund' || (orderDetaildata.status == 'refund' ||
orderDetaildata.status == 'closed') orderDetaildata.status == 'closed')
" ">订单完成</span>
>订单完成</span
>
</div> </div>
<div class="orderbox_right_top" style="margin-top: 20px"> <div class="orderbox_right_top" style="margin-top: 20px">
<span>商品明细</span> <span>商品明细</span>
@@ -168,19 +97,13 @@
<div>单价</div> <div>单价</div>
<div>小计</div> <div>小计</div>
</div> </div>
<div <div class="orderbox_right_list_item" style="margin-top: 20px"
class="orderbox_right_list_item" v-for="(item, index) in orderDetaildata.detailList" :key="index">
style="margin-top: 20px"
v-for="(item, index) in orderDetaildata.detailList"
:key="index"
>
<div>{{ item.productName }} {{ item.productSkuName }}</div> <div>{{ item.productName }} {{ item.productSkuName }}</div>
<div style="text-align: center">{{ item.num }}</div> <div style="text-align: center">{{ item.num }}</div>
<div style="text-align: center">{{ item.price }}</div> <div style="text-align: center">{{ item.price }}</div>
<div v-if="item.status == 'refund'"> <div v-if="item.status == 'refund'">
<span style="border: 2px solid red; color: red; padding: 4px 2px" <span style="border: 2px solid red; color: red; padding: 4px 2px">已退</span>
>已退</span
>
</div> </div>
<div v-else>{{ item.priceAmount }}</div> <div v-else>{{ item.priceAmount }}</div>
</div> </div>
@@ -189,42 +112,26 @@
<div class="orderbox_right_button" ref="reforderboxrightbutton"> <div class="orderbox_right_button" ref="reforderboxrightbutton">
<div class="orderbox_right_buttonbutton"> <div class="orderbox_right_buttonbutton">
<el-button <el-button style="width: 100%" type="warning" :loading="callLoading" @click="callNumberHandle">
style="width: 100%"
type="warning"
:loading="callLoading"
@click="callNumberHandle"
>
叫号 叫号
</el-button> </el-button>
</div> </div>
<div class="orderbox_right_buttonbutton"> <div class="orderbox_right_buttonbutton">
<el-button <el-button style="width: 100%" v-if="
style="width: 100%"
v-if="
orderDetaildata.orderType != 'return' && orderDetaildata.orderType != 'return' &&
(orderDetaildata.status == 'refund' || (orderDetaildata.status == 'refund' ||
orderDetaildata.status == 'closed') orderDetaildata.status == 'closed')
" " type="primary" @click="recharge = true">退单</el-button>
type="primary"
@click="recharge = true"
>退单</el-button
>
</div> </div>
<div class="orderbox_right_buttonbutton"> <div class="orderbox_right_buttonbutton">
<el-button @click="print('normal')" style="flex: 1" <el-button @click="print('normal')" style="flex: 1">重打收银打票</el-button>
>重打收银打票</el-button <el-button @click="print('label')" style="flex: 1">重打标签小票</el-button>
>
<el-button @click="print('label')" style="flex: 1"
>重打标签小票</el-button
>
</div> </div>
</div> </div>
</div> </div>
<div class="orderbox_rightbox" v-else> <div class="orderbox_rightbox" v-else>
<div class="orderbox_rightbox_top"> <div class="orderbox_rightbox_top">
<div <div style="
style="
padding: 6px; padding: 6px;
background: #187ead; background: #187ead;
border-radius: 50%; border-radius: 50%;
@@ -233,8 +140,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
" ">
>
<el-icon :size="30" color="#fff"> <el-icon :size="30" color="#fff">
<Document /> <Document />
</el-icon> </el-icon>
@@ -269,23 +175,11 @@
</div> </div>
</div> --> </div> -->
</div> </div>
<el-dialog <el-dialog v-model="recharge" title="退单" width="800" :before-close="handlerecharge">
v-model="recharge"
title="退单"
width="800"
:before-close="handlerecharge"
>
<div class="recharge_footer"> <div class="recharge_footer">
<div class="recharge_footer_item"> <div class="recharge_footer_item">
<el-input <el-input v-model="remark" style="width: 100%" :rows="2" type="textarea" placeholder="请输入退单原因"
v-model="remark" @focus="global.updateData(false)" @blur="global.updateData(true)" />
style="width: 100%"
:rows="2"
type="textarea"
placeholder="请输入退单原因"
@focus="global.updateData(false)"
@blur="global.updateData(true)"
/>
<div class="recharge_footer_items" @click="remark = '顾客取消'"> <div class="recharge_footer_items" @click="remark = '顾客取消'">
<div>顾客取消</div> <div>顾客取消</div>
</div> </div>
@@ -322,41 +216,22 @@
</div> </div>
<div class="recharge_footer_itemright_botton"> <div class="recharge_footer_itemright_botton">
<div class="recharge_footer_itemright_botton_top"> <div class="recharge_footer_itemright_botton_top">
<el-checkbox <el-checkbox @change="changezong" v-model="changechecked" size="large" /><span
@change="changezong" style="margin-left: 10px">全选,共项目</span>
v-model="changechecked"
size="large"
/><span style="margin-left: 10px">全选,共项目</span>
</div> </div>
<div <div class="recharge_footer_itemright_botton_item" v-for="(item, index) in orderDetaildata.detailList"
class="recharge_footer_itemright_botton_item" :key="index">
v-for="(item, index) in orderDetaildata.detailList"
:key="index"
>
<div class="recharge_footer_itemright_botton_itemone"> <div class="recharge_footer_itemright_botton_itemone">
<el-checkbox <el-checkbox @change="changezong(item, index, 1, 'quan')"
@change="changezong(item, index, 1, 'quan')" :disabled="item.status == 'refund' ? true : false" v-model="item.checked" size="large" />
:disabled="item.status == 'refund' ? true : false"
v-model="item.checked"
size="large"
/>
<span style="margin-left: 10px">{{ item.productName }}</span> <span style="margin-left: 10px">{{ item.productName }}</span>
</div> </div>
<div class="recharge_footer_itemright_botton_itemtow"> <div class="recharge_footer_itemright_botton_itemtow">
<!-- {{ item.num }} --> <!-- {{ item.num }} -->
<el-input-number <el-input-number v-model="item.num" :min="1" size="small"
v-model="item.num" :disabled="item.status == 'refund' ? true : false" :max="item.maxnum" @change="(currentValue, oldValue) =>
:min="1"
size="small"
:disabled="item.status == 'refund' ? true : false"
:max="item.maxnum"
@change="
(currentValue, oldValue) =>
changezong(item, index, 1, 'num', currentValue, oldValue) changezong(item, index, 1, 'num', currentValue, oldValue)
" " @focus="global.updateData(false)" @blur="global.updateData(true)" />
@focus="global.updateData(false)"
@blur="global.updateData(true)"
/>
<!-- @change="changezong(item, index, 1, 'num')" --> <!-- @change="changezong(item, index, 1, 'num')" -->
</div> </div>
<div class="recharge_footer_itemright_botton_itemthere"> <div class="recharge_footer_itemright_botton_itemthere">
@@ -374,12 +249,8 @@
</div> </div>
</div> </div>
<div class="recharge_footer_itemright_botton_boxtow"> <div class="recharge_footer_itemright_botton_boxtow">
<el-button <el-button type="primary" style="width: 100%; height: 100%" :loading="buttonloading"
type="primary" @click="payreturnOrderclick">
style="width: 100%; height: 100%"
:loading="buttonloading"
@click="payreturnOrderclick"
>
<span v-if="!buttonloading">支付退回</span> <span v-if="!buttonloading">支付退回</span>
<span v-else>支付退回...</span> <span v-else>支付退回...</span>
</el-button> </el-button>
@@ -389,13 +260,7 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
<takeFoodCode <takeFoodCode ref="takeFoodCodeRef" title="支付密码" type="password" placeholder="请输入支付密码" @success="passwordSuccess" />
ref="takeFoodCodeRef"
title="支付密码"
type="password"
placeholder="请输入支付密码"
@success="passwordSuccess"
/>
</template> </template>
<script setup> <script setup>
@@ -467,7 +332,8 @@ async function passwordSuccess(pwd) {
return item && item; return item && item;
}); });
if (arr.length != 0) { if (arr.length != 0) {
await payreturnOrder(arr, md5(pwd)); // await payreturnOrder(arr, md5(pwd));
await payreturnOrder(arr, '');
changechecked.value = false; changechecked.value = false;
recharge.value = false; recharge.value = false;
itemboxshow.value = false; itemboxshow.value = false;
@@ -492,7 +358,8 @@ const payreturnOrderclick = lodash.debounce(
ElMessage.error("退款金额不能为0"); ElMessage.error("退款金额不能为0");
return false; return false;
} }
takeFoodCodeRef.value.show(); // takeFoodCodeRef.value.show();
passwordSuccess()
}, },
500, 500,
{ leading: true, trailing: false } { leading: true, trailing: false }