修复bug,更新代码,优化键盘监听和订单统计

This commit is contained in:
zmj 2024-06-13 14:11:33 +08:00
parent becc875a4c
commit 316de611c7
5 changed files with 50 additions and 19 deletions

8
helper.json Normal file
View File

@ -0,0 +1,8 @@
{
"path": {
"root": "@=src",
"api": "src/api",
"request": "../utils/request"
},
"api": []
}

View File

@ -19,49 +19,49 @@ const user_channel = connection.subscribe(`store_merchant_${userStore.userInfo.s
// user-2message // user-2message
user_channel.on('message', function (data) { user_channel.on('message', function (data) {
console.log("收到消息--",data); console.log("收到消息--", data);
try { try {
if(data?.content?.type=='cash_register'&&data?.content?.msg=="您有一笔订单已支付"){ if (data?.content?.type == 'cash_register' && data?.content?.msg == "您有一笔订单已支付") {
mitt.emit('pay_success', data?.content?.data); mitt.emit('pay_success', data?.content?.data);
} }
if(data?.content?.type=='store_merchant'&&data?.content?.msg=="您有一笔新的订单"){ if (data?.content?.type == 'store_merchant' && data?.content?.msg == "您有一笔新的订单") {
mitt.emit('new_order', data?.content); mitt.emit('new_order', data?.content);
} }
if(data?.content?.type=='platform_print'){ if (data?.content?.type == 'platform_print') {
mitt.emit('letPrintReceipt', data?.content?.data); mitt.emit('letPrintReceipt', data?.content?.data);
} }
} catch (error) { } catch (error) {
} }
}); });
// 线 // 线
user_channel.on('close', function () { user_channel.on('close', function () {
}); });
// setTimeout(()=>{ // setTimeout(()=>{
// mitt.emit('new_order'); // mitt.emit('new_order');
// }, 2000) // }, 2000)
const KeyboardEvent = (e)=>{ const KeyboardEvent = (e) => {
console.log('按下', e.keyCode); console.log('按下', e.keyCode);
if(e.keyCode == 16) mitt.emit('shift'); if (e.keyCode == 16) mitt.emit('shift');
if(e.keyCode == 120) mitt.emit('F9'); if (e.keyCode == 120) mitt.emit('F9');
if(e.keyCode == 13) mitt.emit('enter'); if (e.keyCode == 13) mitt.emit('enter');
if(e.keyCode == 37) mitt.emit('left'); if (e.keyCode == 37) mitt.emit('left');
if(e.keyCode == 39) mitt.emit('right'); if (e.keyCode == 39) mitt.emit('right');
if(e.keyCode == 38) mitt.emit('up'); if (e.keyCode == 38) mitt.emit('up');
if(e.keyCode == 40) mitt.emit('down'); if (e.keyCode == 40) mitt.emit('down');
if(e.keyCode == 46) mitt.emit('delete'); if (e.keyCode == 46) mitt.emit('delete');
if(e.keyCode == 45) mitt.emit('insert'); if (e.keyCode == 45) mitt.emit('insert');
} }
onMounted(()=>{ onMounted(() => {
window.addEventListener('keydown', KeyboardEvent); window.addEventListener('keydown', KeyboardEvent);
console.log('开启键盘监听'); console.log('开启键盘监听');
}) })
onUnmounted(()=>{ onUnmounted(() => {
window.removeEventListener('keydown', KeyboardEvent); window.removeEventListener('keydown', KeyboardEvent);
console.log('关闭键盘监听'); console.log('关闭键盘监听');
}) })
@ -97,13 +97,16 @@ onUnmounted(()=>{
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: #001529; background-color: #001529;
.el-header { .el-header {
color: #fff; color: #fff;
height: 4rem; height: 4rem;
} }
.el-aside { .el-aside {
color: #fff; color: #fff;
} }
.el-main { .el-main {
background-color: #f5f5f5; background-color: #f5f5f5;
width: calc(100vw - 6.25rem); width: calc(100vw - 6.25rem);
@ -111,7 +114,7 @@ onUnmounted(()=>{
border-radius: 2rem 0 0 0; border-radius: 2rem 0 0 0;
overflow-y: scroll; overflow-y: scroll;
padding: 1rem; padding: 1rem;
.my-main { .my-main {
height: 100%; height: 100%;
width: 100%; width: 100%;

View File

@ -70,6 +70,12 @@ const list = ref([
ico: "FullScreen", ico: "FullScreen",
count: 0, count: 0,
}, },
{
name: "statistics",
title: "盈收统计 ",
ico: "TrendCharts",
count: 0,
},
// { name: "purchaseOrder", title: "", ico: "Van", count: 0 }, // { name: "purchaseOrder", title: "", ico: "Van", count: 0 },
// { name: "orderCount", title: "", ico: "DocumentRemove", count: 0 }, // { name: "orderCount", title: "", ico: "DocumentRemove", count: 0 },
// { name: "wallet", title: "", ico: "Wallet", count: 0 }, // { name: "wallet", title: "", ico: "Wallet", count: 0 },

View File

@ -53,6 +53,12 @@ const routes = [
meta: { title: '订单核销' }, meta: { title: '订单核销' },
component: () => import('@/views/convert/index.vue'), component: () => import('@/views/convert/index.vue'),
}, },
{
path: '/statistics',
name: 'statistics',
meta: { title: '盈收统计' },
component: () => import('@/views/statistics/index.vue'),
},
{ {
path: '/test', path: '/test',
name: 'test', name: 'test',

View File

@ -0,0 +1,8 @@
<template>
我是统计
</template>
<script lang="ts" setup>
import { ref, reactive } from "vue"
</script>