1.交班新增选择是否打印商品销售数据

This commit is contained in:
gyq 2024-07-23 10:25:20 +08:00
parent a282636266
commit d2183eec37
16 changed files with 412 additions and 400 deletions

View File

@ -14,11 +14,14 @@ VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api' VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api'
# 正式 php 开票
VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
# 阿伟 # 阿伟
# VITE_API_URL = 'http://192.168.2.96:10587/cashier-client' # VITE_API_URL = 'http://192.168.2.96:10587/cashier-client'
# 鹏辉 # 鹏辉
# VITE_API_URL = 'http://192.168.2.41:10589/cashier-client' # VITE_API_URL = 'http://192.168.1.106:10589/cashier-client'
# 测试 # 测试
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' # VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'

View File

@ -7,5 +7,8 @@ VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api' VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api'
# 正式 php 开票
VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
# 线上环境接口地址 # 线上环境接口地址
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/' VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'

View File

@ -10,6 +10,9 @@ VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# 正式 php # 正式 php
VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api' VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api'
# 正式 php 开票
VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
# 测试 # 测试
VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'

View File

@ -1,201 +1 @@
"use strict"; "use strict";const o=require("path"),e=require("electron"),p=require("os");let i;e.app.whenReady().then(()=>{i=new e.BrowserWindow({title:"银收客",width:1024,height:768,fullscreenable:!0,fullscreen:!process.env.VITE_DEV_SERVER_URL,simpleFullscreen:!0,frame:!!process.env.VITE_DEV_SERVER_URL,webPreferences:{nodeIntegration:!0,contextIsolation:!1}}),process.env.VITE_DEV_SERVER_URL?i.loadURL(process.env.VITE_DEV_SERVER_URL):i.loadFile(o.resolve(__dirname,"../dist/index.html")),e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&createWindow()}),e.ipcMain.on("quitHandler",(n,t)=>{i=null,e.app.exit()}),e.ipcMain.on("getPrintList",()=>{i.webContents.getPrintersAsync().then(n=>{i.webContents.send("printList",n)})}),e.ipcMain.on("getOSmacSync",()=>{let n="";p.networkInterfaces().WLAN?(n=p.networkInterfaces().WLAN[0].mac,console.log("wlan.mac===",n)):(n=p.networkInterfaces().以太网[0].mac,console.log("以太网.mac===",n)),i.webContents.send("getOSmacRes",n)});const r=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?r.loadFile(o.join(__dirname,"../public/print.html")):r.loadFile(o.resolve(__dirname,"../dist/print.html")),e.ipcMain.on("printerInfoSync",(n,t)=>{r.webContents.send("getParams",t)}),e.ipcMain.on("printStart",(n,t)=>{console.log(t);let a=JSON.parse(t).deviceName;r.webContents.print({silent:!0,deviceName:a,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const s=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?s.loadFile(o.join(__dirname,"../public/work_print.html")):s.loadFile(o.resolve(__dirname,"../dist/work_print.html")),e.ipcMain.on("printerWorkSync",(n,t)=>{s.webContents.send("getParams",t)}),e.ipcMain.on("printWorkStart",(n,t)=>{let a=JSON.parse(t).deviceName;s.webContents.print({silent:!0,deviceName:a,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const l=new e.BrowserWindow({show:!1,width:360,height:240,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?l.loadFile(o.join(__dirname,"../public/tag_print.html")):l.loadFile(o.resolve(__dirname,"../dist/tag_print.html")),e.ipcMain.on("printerTagSync",(n,t)=>{console.log(t),l.webContents.send("getParams",t)}),e.ipcMain.on("printTagStart",(n,t)=>{let a=JSON.parse(t).deviceName;l.webContents.print({silent:!0,deviceName:a,pageSize:{width:45e3,height:3e4},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})}),e.app.requestSingleInstanceLock()?e.app.on("second-instance",(n,t,c)=>{i&&(i.isMinimized()&&i.restore(),i.focus(),i.show())}):e.app.quit(),i.on("close",n=>{n.preventDefault(),i.webContents.send("showCloseDialog")})});e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&e.app.quit()});
const path = require("path");
const electron = require("electron");
const os = require("os");
let win;
electron.app.whenReady().then(() => {
win = new electron.BrowserWindow({
title: "银收客",
width: 1024,
height: 768,
fullscreenable: true,
fullscreen: process.env.VITE_DEV_SERVER_URL ? false : true,
simpleFullscreen: true,
frame: process.env.VITE_DEV_SERVER_URL ? true : false,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(process.env.VITE_DEV_SERVER_URL);
} else {
win.loadFile(path.resolve(__dirname, "../dist/index.html"));
}
electron.app.on("activate", () => {
if (electron.BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
electron.ipcMain.on("quitHandler", (_, msg) => {
win = null;
electron.app.exit();
});
electron.ipcMain.on("getPrintList", () => {
win.webContents.getPrintersAsync().then((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({
show: false,
width: 464,
height: 1726,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
printWin.loadFile(path.join(__dirname, "../public/print.html"));
} else {
printWin.loadFile(path.resolve(__dirname, "../dist/print.html"));
}
electron.ipcMain.on("printerInfoSync", (event, arg) => {
printWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printStart", (event, arg) => {
console.log(arg);
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
printWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 58e3,
height: 216e3
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
const workPrintWin = new electron.BrowserWindow({
show: false,
width: 464,
height: 1726,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
workPrintWin.loadFile(path.join(__dirname, "../public/work_print.html"));
} else {
workPrintWin.loadFile(path.resolve(__dirname, "../dist/work_print.html"));
}
electron.ipcMain.on("printerWorkSync", (event, arg) => {
workPrintWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printWorkStart", (event, arg) => {
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
workPrintWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 58e3,
height: 216e3
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
const tagPrintWin = new electron.BrowserWindow({
show: false,
width: 360,
height: 240,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
tagPrintWin.loadFile(path.join(__dirname, "../public/tag_print.html"));
} else {
tagPrintWin.loadFile(path.resolve(__dirname, "../dist/tag_print.html"));
}
electron.ipcMain.on("printerTagSync", (event, arg) => {
console.log(arg);
tagPrintWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printTagStart", (event, arg) => {
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
tagPrintWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 45e3,
height: 3e4
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
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();
}
});
}
win.on("close", (e) => {
e.preventDefault();
win.webContents.send("showCloseDialog");
});
});
electron.app.on("window-all-closed", () => {
if (process.platform !== "darwin")
electron.app.quit();
});

View File

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

View File

@ -51,7 +51,7 @@ watch(route, (to) => {
includeList.push(to.name); includeList.push(to.name);
} }
// //
let arr = ["/login", "/device_list", "/add_device", "/add_label", "/webview"]; let arr = ["/login", "/device_list", "/add_device", "/add_label", "/webview", '/workrecord'];
if (arr.includes(to.path)) { if (arr.includes(to.path)) {
hideLeftMenu.value = true; hideLeftMenu.value = true;
} else { } else {

14
src/api/invoice.js Normal file
View File

@ -0,0 +1,14 @@
import request_kp from "@/utils/request_kp.js";
/**
* 开票人列表
* @param {*} data
* @returns
*/
export function issuedby(data) {
return request_kp({
method: "post",
url: "szzpy/issuedby",
data,
});
}

View File

@ -51,3 +51,16 @@ export function handoverData(params) {
params, params,
}); });
} }
/**
* 打印交班数据
* @param {*} params
* @returns
*/
export function handoverprint(params) {
return request({
method: "get",
url: "data/handoverprint",
params,
});
}

View File

@ -20,6 +20,12 @@
</el-icon> </el-icon>
<el-text class="text">{{ item.label }}</el-text> <el-text class="text">{{ item.label }}</el-text>
</router-link> </router-link>
<div class="item" @click="workRef.show()">
<el-icon class="icon">
<component is="SwitchButton" />
</el-icon>
<el-text class="text">交班</el-text>
</div>
<div class="item more" @click="moreref.show()"> <div class="item more" @click="moreref.show()">
<el-icon class="icon"> <el-icon class="icon">
<Operation /> <Operation />
@ -27,6 +33,8 @@
<el-text class="text">更多</el-text> <el-text class="text">更多</el-text>
</div> </div>
</div> </div>
<!-- 交班 -->
<work ref="workRef" />
<!-- 更多 --> <!-- 更多 -->
<more ref="moreref" @openCall="openCall"></more> <more ref="moreref" @openCall="openCall"></more>
<!-- 叫号 --> <!-- 叫号 -->
@ -39,6 +47,7 @@ import { useRoute } from 'vue-router'
import { useSocket } from '@/store/socket.js' import { useSocket } from '@/store/socket.js'
import more from '@/components/more.vue' import more from '@/components/more.vue'
import callNumber from './callNumber.vue' import callNumber from './callNumber.vue'
import work from '@/views/work/index.vue'
const emits = defineEmits(['connectWsHandle']) const emits = defineEmits(['connectWsHandle'])
@ -47,6 +56,8 @@ const socketStore = useSocket()
const route = useRoute() const route = useRoute()
const moreref = ref(null) const moreref = ref(null)
const callNumberRef = ref(null) const callNumberRef = ref(null)
const workRef = ref(null)
const menus = ref([ const menus = ref([
{ {
label: '收银', label: '收银',
@ -78,11 +89,11 @@ const menus = ref([
path: '/member', path: '/member',
icon: 'User' icon: 'User'
}, },
{ // {
label: '交班', // label: '',
path: '/work', // path: '/work',
icon: 'SwitchButton' // icon: 'SwitchButton'
} // }
]) ])
// //

View File

@ -40,9 +40,10 @@ export function clearNoNum(obj) {
* 保留小数n位不进行四舍五入 * 保留小数n位不进行四舍五入
* num你传递过来的数字, * num你传递过来的数字,
* decimal你保留的几位,默认保留小数后两位 * decimal你保留的几位,默认保留小数后两位
* isInt 是否保留0
*/ */
export function formatDecimal(num, decimal = 2) { export function formatDecimal(num, decimal = 2, isInt = false) {
num = num.toString(); num = num.toFixed(3).toString();
const index = num.indexOf("."); const index = num.indexOf(".");
if (index !== -1) { if (index !== -1) {
num = num.substring(0, decimal + index + 1); num = num.substring(0, decimal + index + 1);
@ -50,5 +51,9 @@ export function formatDecimal(num, decimal = 2) {
num = num.substring(0); num = num.substring(0);
} }
//截取后保留两位小数 //截取后保留两位小数
return parseFloat(num).toFixed(decimal); if (isInt) {
return parseFloat(num);
} else {
return parseFloat(num).toFixed(decimal);
}
} }

61
src/utils/request_kp.js Normal file
View File

@ -0,0 +1,61 @@
import axios from "axios";
import { ElMessage } from "element-plus";
import useStorage from "@/utils/useStorage";
import router from "@/router";
const service = axios.create({
baseURL:
import.meta.env.MODE == "development"
? "/kp/"
: import.meta.env.VITE_API_KP_URL,
// withCredentials: true, // 跨域请求时发送 cookies
timeout: 5000, // 请求超时
});
// 请求拦截器
service.interceptors.request.use(
(config) => {
// // 在发送请求之前做些什么 token
// if (useStorage.get("douyin") && useStorage.get("douyin").token) {
// config.headers["bausertoken"] = useStorage.get("douyin").token;
// // config.headers['Content-Type'] = 'application/json'
// }
config.headers["ispc"] = 1;
return config;
},
(error) => {
// 处理请求错误
return Promise.reject(error);
}
);
// 响应拦截器
service.interceptors.response.use(
(response) => {
// 对响应数据做点什么
if (+response.status === 200) {
if (+response.data.code == 1) {
return response.data.data;
} else {
// 响应错误
ElMessage.error(response.data.msg);
return Promise.reject(response.data);
}
}
},
(error) => {
// 对响应错误做点什么
if (error.message.indexOf("timeout") != -1) {
ElMessage.error("网络超时");
} else if (error.message == "Network Error") {
ElMessage.error("网络连接错误");
} else {
console.log(error);
if (error.response.data) ElMessage.error(error.response.statusText);
else ElMessage.error("接口路径找不到");
}
return Promise.reject(error);
}
);
export default service;

View File

@ -72,6 +72,8 @@ import useStorage from "@/utils/useStorage";
import { douyincheckIn } from "@/api/group"; import { douyincheckIn } from "@/api/group";
import { useUser } from "@/store/user.js"; import { useUser } from "@/store/user.js";
import { useSocket } from "@/store/socket.js"; import { useSocket } from "@/store/socket.js";
import { useGlobal } from '@/store/global.js'
const global = useGlobal()
const store = useUser(); const store = useUser();
const socket = useSocket(); const socket = useSocket();
@ -134,6 +136,7 @@ const submitHandle = () => {
clientType: 'pc' clientType: 'pc'
}) })
useStorage.set('douyin', douyin.userInfo) useStorage.set('douyin', douyin.userInfo)
global.updateData(true)
}) })
.catch((err) => { .catch((err) => {
loading.value = false; loading.value = false;
@ -151,7 +154,7 @@ const logout = () => {
}; };
onMounted(() => { onMounted(() => {
passwordType.icon = Hide global.updateData(false)
}) })
</script> </script>

View File

@ -133,8 +133,9 @@
" 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> <!-- <el-button style="flex: 1" @click="invoiveHandle">开发票</el-button> -->
<el-button @click="print('label')" style="flex: 1">重打标签小票</el-button> <el-button @click="print('normal')" style="flex: 1">重打小票</el-button>
<el-button @click="print('label')" style="flex: 1">重打标签</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -277,6 +278,7 @@
<script setup> <script setup>
import { ref, onMounted, reactive } from "vue"; import { ref, onMounted, reactive } from "vue";
import { issuedby } from '@/api/invoice.js'
import { ElMessage, dayjs } from "element-plus"; import { ElMessage, dayjs } from "element-plus";
import { useUser } from "@/store/user.js"; import { useUser } from "@/store/user.js";
import lodash from "lodash"; import lodash from "lodash";
@ -327,6 +329,19 @@ const handlerecharge = () => {
const buttonloading = ref(); //loading const buttonloading = ref(); //loading
//
async function invoiveHandle() {
try {
const res = await issuedby({
store_id: store.userInfo.loginName,
is_pc: 1
})
} catch (error) {
console.log(error);
}
}
// //
function dateConfirm(time) { function dateConfirm(time) {
ordereData.startTime = time[0] ordereData.startTime = time[0]

View File

@ -2,12 +2,12 @@
<el-drawer size="100%" :with-header="false" direction="btt" v-model="dialogVisible"> <el-drawer size="100%" :with-header="false" direction="btt" v-model="dialogVisible">
<div class="box"> <div class="box">
<div class="box_top"> <div class="box_top">
<router-link to="/" class="box_top_left"> <div class="box_top_left" @click="dialogVisible = false">
<el-icon size="20"> <el-icon size="20">
<ArrowLeft /> <ArrowLeft />
</el-icon> </el-icon>
<div style="margin-left: 10px;">返回</div> <div style="margin-left: 10px;">返回</div>
</router-link> </div>
<router-link to='/workrecord' class="box_top_right"> <router-link to='/workrecord' class="box_top_right">
交班记录 交班记录
</router-link> </router-link>
@ -26,7 +26,7 @@
</div> </div>
<div class="box_content_left_top_item_top"> <div class="box_content_left_top_item_top">
<div style="color:#ff5252; font-size: 30px;"> <div style="color:#ff5252; font-size: 30px;">
{{ infoData.amount || 0 }} {{ formatDecimal(infoData.amount || 0) }}
</div> </div>
<div style="margin-top: 6px; color: #666;"> <div style="margin-top: 6px; color: #666;">
营业额 营业额
@ -36,83 +36,95 @@
<div class="box_content_left_top_item"> <div class="box_content_left_top_item">
<div class="box_content_left_top_item_botton"> <div class="box_content_left_top_item_botton">
<div style=" font-size: 20px;"> <div style=" font-size: 20px;">
{{ infoData.cashAmount || 0 }} {{ formatDecimal(infoData.cashAmount || 0) }}
</div> </div>
<div style="margin-top: 6px;"> <div style="margin-top: 6px;">
现金支付 现金支付
</div> </div>
<div style="margin-top: 6px;font-size: 14px;"> <!-- <div style="margin-top: 6px;font-size: 14px;">
查看详情 查看详情
</div> </div> -->
</div> </div>
<div class="box_content_left_top_item_botton"> <div class="box_content_left_top_item_botton">
<div style=" font-size: 20px;"> <div style=" font-size: 20px;">
{{ infoData.returnAmount || 0 }} {{ formatDecimal(infoData.returnAmount || 0) }}
</div> </div>
<div style="margin-top: 6px;"> <div style="margin-top: 6px;">
退款金额 退款金额
</div> </div>
<div style="margin-top: 6px;font-size: 14px;"> <!-- <div style="margin-top: 6px;font-size: 14px;">
查看详情 查看详情
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>
<div class="box_content_left_bottom"> <div class="box_content_left_bottom">
<el-table :data="infoData.detailList" style="width: 100%;" height="400px"> <el-table :data="infoData.detailList" border style="width: 100%;" height="360px">
<el-table-column prop="productName" label="商品名称" /> <el-table-column prop="productName" label="商品名称" />
<el-table-column prop="skuName" label="规格名称" /> <el-table-column prop="skuName" label="规格名称" />
<el-table-column prop="num" label="商品数量" /> <el-table-column prop="num" label="商品数量" />
<el-table-column prop="amount" label="商品金额" /> <el-table-column prop="amount" label="商品金额">
<template v-slot="scope">
{{ formatDecimal(scope.row.amount || 0) }}
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
<div class="box_content_right"> <div class="box_content_right">
<div class="box_content_right_tiem"> <div class="top">
<div class="box_content_right_tiemleft"> <div class="box_content_right_tiem">
上岗时间 <div class="box_content_right_tiemleft">
上岗时间
</div>
<div class="box_content_right_tiemright">
{{ dayjs(infoData.loginTime).format("YYYY-MM-DD HH:mm:ss") }}
</div>
</div> </div>
<div class="box_content_right_tiemright"> <div class="box_content_right_tiem">
{{ dayjs(infoData.loginTime).format("YYYY-MM-DD HH:mm:ss") }} <div class="box_content_right_tiemleft">
交班时间
</div>
<div class="box_content_right_tiemright">
{{ dayjs(infoData.loginOutTime).format("YYYY-MM-DD HH:mm:ss") }}
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
终端名称
</div>
<div class="box_content_right_tiemright">
{{ infoData.equipment || '无' }}
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
备用金
</div>
<div class="box_content_right_tiemright">
{{ infoData.pettyCash || '无' }}
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
收营员
</div>
<div class="box_content_right_tiemright">
{{ infoData.userName || '无' }}
</div>
</div> </div>
</div> </div>
<div class="box_content_right_tiem"> <div class="footer">
<div class="box_content_right_tiemleft"> <div class="is_shop">
交班时间 <div class="button">
<el-checkbox v-model="isPrint" border label="是否打印商品销售数据" style="width: 100%" />
</div>
</div> </div>
<div class="box_content_right_tiemright"> <div class="box_content_right_tiembutton" :loading="loading" @click="exit">
{{ dayjs(infoData.loginOutTime).format("YYYY-MM-DD HH:mm:ss") }} <span v-if="!loading">交班/关班</span>
<span v-else>交班/关班中....</span>
</div> </div>
</div> </div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
终端名称
</div>
<div class="box_content_right_tiemright">
{{ infoData.equipment || '无' }}
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
备用金
</div>
<div class="box_content_right_tiemright">
{{ infoData.pettyCash || '无' }}
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
收营员
</div>
<div class="box_content_right_tiemright">
{{ infoData.userName || '无' }}
</div>
</div>
<div class="box_content_right_tiembutton" :loading="loading" @click="exit">
<span v-if="!loading">交班/关班</span>
<span v-else>交班/关班中....</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -122,23 +134,23 @@
<script setup> <script setup>
import { ipcRenderer } from "electron"; import { ipcRenderer } from "electron";
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { ElMessage, dayjs } from 'element-plus' import { ElMessage, dayjs } from 'element-plus'
import { shopInfoqueryDuty, loginlogout, handoverData } from '@/api/work/index.js' import { shopInfoqueryDuty, loginlogout, handoverData, handoverprint } from '@/api/work/index.js'
import useStorage from '@/utils/useStorage' import useStorage from '@/utils/useStorage'
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { bySubType } from "@/api/device"; import { bySubType } from "@/api/device";
import { useUser } from "@/store/user.js"; import { useUser } from "@/store/user.js";
import { useSocket } from "@/store/socket.js"; import { useSocket } from "@/store/socket.js";
import { formatDecimal } from '@/utils/index.js'
const socket = useSocket(); const socket = useSocket();
const store = useUser(); const store = useUser();
const router = useRouter(); const router = useRouter();
const dialogVisible = ref(true) // const dialogVisible = ref(false) //
// //
const infoData = ref({}) const infoData = ref({})
const loading = ref(false); const loading = ref(false);
@ -146,6 +158,8 @@ const loading = ref(false);
const printList = ref([]); const printList = ref([]);
const localPrintList = ref([]) const localPrintList = ref([])
const isPrint = ref(true)
// //
async function bySubTypeAjax() { async function bySubTypeAjax() {
try { try {
@ -188,6 +202,7 @@ function checkLocalPrint(deviceName) {
const exit = async () => { const exit = async () => {
try { try {
if (printList.value.length) { if (printList.value.length) {
console.log('本地打印');
if (!checkLocalPrint(printList.value[0].config.deviceName)) { if (!checkLocalPrint(printList.value[0].config.deviceName)) {
loading.value = true; loading.value = true;
let res = await loginlogout({ let res = await loginlogout({
@ -196,6 +211,7 @@ const exit = async () => {
// useStorage.clear() // useStorage.clear()
useStorage.del('userInfo') useStorage.del('userInfo')
useStorage.del('token') useStorage.del('token')
useStorage.del('douyin')
ElMessage.success("交班成功"); ElMessage.success("交班成功");
setTimeout(() => { setTimeout(() => {
router.replace({ router.replace({
@ -225,13 +241,24 @@ const exit = async () => {
loading.value = false; loading.value = false;
} }
} else { } else {
console.log('云打印');
loading.value = true; loading.value = true;
let res = await loginlogout({
// 退
await loginlogout({
status: 1 status: 1
}) })
//
await handoverprint({
id: infoData.value.id,
isprintProduct: isPrint.value
})
// useStorage.clear() // useStorage.clear()
useStorage.del('userInfo') useStorage.del('userInfo')
useStorage.del('token') useStorage.del('token')
useStorage.del('douyin')
ElMessage.success("交班成功"); ElMessage.success("交班成功");
setTimeout(() => { setTimeout(() => {
router.replace({ router.replace({
@ -245,6 +272,8 @@ const exit = async () => {
loading.value = false; loading.value = false;
} }
} }
//
const infoshopInfoqueryDutys = async () => { const infoshopInfoqueryDutys = async () => {
try { try {
let res = await shopInfoqueryDuty({ let res = await shopInfoqueryDuty({
@ -253,14 +282,23 @@ const infoshopInfoqueryDutys = async () => {
}) })
infoData.value = res infoData.value = res
} catch (error) { } catch (error) {
console.log(error);
} }
} }
onMounted(() => {
getPrintList() function show() {
bySubTypeAjax() dialogVisible.value = true
infoshopInfoqueryDutys() infoshopInfoqueryDutys()
}
defineExpose({
show
})
onMounted(() => {
// getPrintList()
// bySubTypeAjax()
}) })
</script> </script>
@ -311,7 +349,6 @@ onMounted(() => {
.box_content_left_top { .box_content_left_top {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-bottom: 1px solid #ccc;
padding-bottom: 20px; padding-bottom: 20px;
.box_content_left_top_item { .box_content_left_top_item {
@ -361,21 +398,17 @@ onMounted(() => {
.box_content_right { .box_content_right {
width: 30%; width: 30%;
height: 100%; height: 100%;
background: #fff;
margin-left: 10px; margin-left: 10px;
border-radius: 6px;
padding: 10px 12px;
position: relative; position: relative;
display: flex;
.box_content_right_tiem:nth-child(1) { flex-direction: column;
margin-top: 0; gap: 10px;
}
.box_content_right_tiem { .box_content_right_tiem {
margin-top: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px;
.box_content_right_tiemleft { .box_content_right_tiemleft {
color: #9e9e9e; color: #9e9e9e;
@ -384,11 +417,7 @@ onMounted(() => {
} }
.box_content_right_tiembutton { .box_content_right_tiembutton {
position: absolute;
bottom: 10px;
left: 5%;
background: #ba5050; background: #ba5050;
width: 90%;
border-radius: 5px; border-radius: 5px;
color: #fff; color: #fff;
text-align: center; text-align: center;
@ -399,4 +428,44 @@ onMounted(() => {
} }
} }
} }
.top {
flex: 1;
background-color: #fff;
padding: 10px 0;
border-radius: 6px;
}
.footer {
padding: 10px;
background: #fff;
border-radius: 6px;
}
.is_shop {
.button {
flex: 1;
margin-bottom: 10px;
:deep(.el-checkbox.el-checkbox--large) {
height: var(--el-component-size-large);
background-color: #fff;
}
:deep(.el-checkbox__inner) {
width: 20px;
height: 20px;
&::after {
border-width: 2px;
top: 0;
left: 4px;
}
}
:deep(.el-checkbox__label) {
font-size: var(--el-font-size-base) !important;
}
}
}
</style> </style>

View File

@ -1,130 +1,132 @@
<template> <template>
<el-drawer size="100%" :with-header="false" direction="btt" v-model="record"> <div class="box">
<div class="box"> <div class="box_top" @click="clickrecord">
<div class="box_top" @click="clickrecord"> <div class="box_top_left" @click="router.back()">
<router-link to='/work' class="box_top_left"> <el-icon size="20">
<el-icon size="20"> <ArrowLeft />
<ArrowLeft /> </el-icon>
</el-icon> <div class="box_top_right">
<div class="box_top_right"> 交班记录
交班记录 </div>
</div>
</router-link>
</div> </div>
<div class="box_content"> </div>
<div class="box_content_left"> <div class="box_content">
<div class="box_content_left_top"> <div class="box_content_left">
<div class="box_content_left_top_item"> <div class="box_content_left_top">
<div class="box_content_left_top_item_top"> <div class="box_content_left_top_item">
<div> <div class="box_content_left_top_item_top">
{{ infoData.total }} <div>
</div> {{ infoData.total }}
<div>
交班数
</div>
</div> </div>
<div class="box_content_left_top_item_top"> <div>
<div> 交班数
{{ infoData.amount }} </div>
</div> </div>
<div> <div class="box_content_left_top_item_top">
总收款 <div>
</div> {{ infoData.amount }}
</div>
<div>
总收款
</div> </div>
</div> </div>
</div> </div>
<div class="box_content_left_bouttom"> </div>
<div class="box_content_left_bouttomox"> <div class="box_content_left_bouttom">
<div class="box_content_left_bouttom_item" v-for="(item, index) in infoData.pageInfo.list" <div class="box_content_left_bouttomox">
:key="index"> <div class="box_content_left_bouttom_item" v-for="(item, index) in infoData.pageInfo.list"
<div class="wbox_content_left_bouttom_item_top"> :key="index">
<div> <div class="wbox_content_left_bouttom_item_top">
{{ dayjs(item.loginTime).format("YYYY-MM-DD HH:mm:ss") }} <div>
</div> {{ dayjs(item.loginTime).format("YYYY-MM-DD HH:mm:ss") }}
<div>
{{ item.amount }}
</div>
</div> </div>
<div class="wbox_content_left_bouttom_item_topone"> <div>
<div style="display: flex;"> {{ item.amount }}
<span>收营员</span>
<span style="font-weight: bold;">{{ item.userName }}</span>
</div>
<div style="display: flex;">
<span>总订单数</span>
<span style="font-weight: bold;">{{ item.orderNum }}</span>
</div>
</div> </div>
<div class="wbox_content_left_bouttom_item_topone"> </div>
<div style="display: flex;"> <div class="wbox_content_left_bouttom_item_topone">
<span>起止时间</span> <div style="display: flex;">
<span style="font-weight: bold;"> {{ dayjs(item.loginTime).format("YYYY-MM-DD HH:mm:ss") }}</span> <span>收营员</span>
</div> <span style="font-weight: bold;">{{ item.userName }}</span>
<div style="display: flex;"> </div>
<span>备用金</span> <div style="display: flex;">
<span style="font-weight: bold;">{{ item.pettyCash }}</span> <span>总订单数</span>
</div> <span style="font-weight: bold;">{{ item.orderNum }}</span>
</div>
</div>
<div class="wbox_content_left_bouttom_item_topone">
<div style="display: flex;">
<span>起止时间</span>
<span style="font-weight: bold;"> {{
dayjs(item.loginTime).format("YYYY-MM-DD HH:mm:ss") }}</span>
</div>
<div style="display: flex;">
<span>备用金</span>
<span style="font-weight: bold;">{{ item.pettyCash }}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="box_content_right">
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
上岗时间
</div>
<div class="box_content_right_tiemright">
2024-03-05-19:33
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
交班时间
</div>
<div class="box_content_right_tiemright">
2024-03-05-19:33
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
终端名称
</div>
<div class="box_content_right_tiemright">
POS-1
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
备用金
</div>
<div class="box_content_right_tiemright">
0.00
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
收营员
</div>
<div class="box_content_right_tiemright">
测试
</div>
</div>
<div class="box_content_right_tiembutton">
关班/退出
</div>
</div> -->
</div> </div>
<!-- <div class="box_content_right">
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
上岗时间
</div>
<div class="box_content_right_tiemright">
2024-03-05-19:33
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
交班时间
</div>
<div class="box_content_right_tiemright">
2024-03-05-19:33
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
终端名称
</div>
<div class="box_content_right_tiemright">
POS-1
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
备用金
</div>
<div class="box_content_right_tiemright">
0.00
</div>
</div>
<div class="box_content_right_tiem">
<div class="box_content_right_tiemleft">
收营员
</div>
<div class="box_content_right_tiemright">
测试
</div>
</div>
<div class="box_content_right_tiembutton">
关班/退出
</div>
</div> -->
</div> </div>
</el-drawer> </div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { shopinfoqueryDutyFlow } from '@/api/work/index.js' import { shopinfoqueryDutyFlow } from '@/api/work/index.js'
import { useUser } from "@/store/user.js" import { useUser } from "@/store/user.js"
import { ElMessage, dayjs } from 'element-plus' import { ElMessage, dayjs } from 'element-plus'
const router = useRouter()
const store = useUser() const store = useUser()
const record = ref(true)// const record = ref(true)//
// //
@ -150,8 +152,10 @@ onMounted(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.box { .box {
padding: 16px 0; width: 100%;
height: 100%; padding: 16px;
height: 100vh;
background-color: #efefef;
.box_top { .box_top {
display: flex; display: flex;
@ -160,7 +164,7 @@ onMounted(() => {
background: #fff; background: #fff;
padding: 6px 10px; padding: 6px 10px;
border-radius: 6px; border-radius: 6px;
/* 取消下划线效果 */ /* 取消下划线效果 */
.box_top_left { .box_top_left {
display: flex; display: flex;
@ -214,13 +218,16 @@ onMounted(() => {
.box_content_left_bouttom { .box_content_left_bouttom {
width: 100%; width: 100%;
height: 80%; height: 85%;
padding: 0 20px; padding: 0 20px;
overflow-y: auto;
.box_content_left_bouttomox::after { .box_content_left_bouttomox::after {
content: ''; content: '';
display: inline-block; display: inline-block;
width: 32%; width: 32%;
} }
.box_content_left_bouttomox { .box_content_left_bouttomox {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -20,6 +20,11 @@ export default defineConfig(({ command, mode }) => {
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/php/, ""), rewrite: (path) => path.replace(/^\/php/, ""),
}, },
"/kp": {
target: env.VITE_API_KP_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/kp/, ""),
},
}, },
}, },
plugins: [ plugins: [