优化权限
This commit is contained in:
parent
117df7d7bd
commit
429283e542
|
|
@ -5,10 +5,10 @@ ENV = development
|
|||
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
|
||||
|
||||
# 正式ws
|
||||
# VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
|
||||
|
||||
# 本地ws
|
||||
VITE_API_WSS = 'ws://192.168.1.31:2348'
|
||||
# VITE_API_WSS = 'ws://192.168.1.31:2348'
|
||||
|
||||
# 正式 php
|
||||
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
||||
|
|
@ -20,10 +20,10 @@ VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
|
|||
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
||||
|
||||
# 本地调试连接
|
||||
VITE_API_URL = 'http://192.168.1.31/'
|
||||
# VITE_API_URL = 'http://192.168.1.31/'
|
||||
|
||||
# 线上测试
|
||||
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
|
||||
# 线上正式
|
||||
# VITE_API_URL = 'https://cashier.sxczgkj.com'
|
||||
VITE_API_URL = 'https://cashier.sxczgkj.com'
|
||||
16160
dist-electron/main.js
16160
dist-electron/main.js
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "vite-electron",
|
||||
"private": true,
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.5",
|
||||
"main": "dist-electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "chcp 65001 && vite",
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ onMounted(() => {
|
|||
if (store.userInfo && store.userInfo.id) {
|
||||
goodsStore.initGoods()
|
||||
store.getShopInfo()
|
||||
store.shopPagePermissionMineAjax()
|
||||
}
|
||||
|
||||
ipcRenderer.on('showCloseDialog', (event, arg) => {
|
||||
|
|
|
|||
|
|
@ -393,3 +393,14 @@ export function shopUserDetail(params) {
|
|||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前员工已拥有页面路径
|
||||
*/
|
||||
export function shopPagePermissionMine(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/account/admin/shopPagePermission/mine",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,29 @@
|
|||
<template>
|
||||
<div class="left_menu_wrap">
|
||||
<div class="item first" :class="{ online: socketStore.online }" @click="connectWsHandle">
|
||||
<el-icon class="icon">
|
||||
<Monitor />
|
||||
</el-icon>
|
||||
<el-text :type="socketStore.online ? 'success' : 'danger'">
|
||||
<template v-if="socketStore.online">
|
||||
在线
|
||||
</template>
|
||||
<template v-else>
|
||||
离线
|
||||
</template>
|
||||
</el-text>
|
||||
<div class="top_item_wra">
|
||||
<div class="item first" :class="{ online: socketStore.online }" @click="connectWsHandle">
|
||||
<el-icon class="icon">
|
||||
<Monitor />
|
||||
</el-icon>
|
||||
<el-text :type="socketStore.online ? 'success' : 'danger'">
|
||||
{{ socketStore.online ? '在线' : '离线' }}
|
||||
</el-text>
|
||||
</div>
|
||||
<router-link class="item" :class="{ active: route.path == item.path }" v-for="item in store.menus"
|
||||
:key="item.path" :to="item.path">
|
||||
<el-icon class="icon">
|
||||
<component :is="item.icon" />
|
||||
</el-icon>
|
||||
<el-text class="text">{{ item.label }}</el-text>
|
||||
</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>
|
||||
<router-link class="item" :class="{ active: route.path == item.path }" v-for="item in menus" :key="item.path"
|
||||
:to="item.path">
|
||||
<el-icon class="icon">
|
||||
<component :is="item.icon" />
|
||||
</el-icon>
|
||||
<el-text class="text">{{ item.label }}</el-text>
|
||||
</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" @click="moreref.show()">
|
||||
<el-icon class="icon">
|
||||
<Operation />
|
||||
</el-icon>
|
||||
|
|
@ -42,62 +39,20 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useSocket } from '@/store/socket.js'
|
||||
import { useUser } from '@/store/user.js'
|
||||
import more from '@/components/more.vue'
|
||||
import callNumber from './callNumber.vue'
|
||||
import work from '@/views/work/index.vue'
|
||||
|
||||
const socketStore = useSocket()
|
||||
|
||||
const route = useRoute()
|
||||
const moreref = ref(null)
|
||||
const callNumberRef = ref(null)
|
||||
const workRef = ref(null)
|
||||
|
||||
const menus = ref([
|
||||
{
|
||||
label: '收银',
|
||||
path: '/',
|
||||
icon: 'ShoppingCartFull'
|
||||
},
|
||||
{
|
||||
label: '台桌',
|
||||
path: '/table',
|
||||
icon: 'Reading'
|
||||
},
|
||||
{
|
||||
label: '团购',
|
||||
path: '/group_buy',
|
||||
icon: 'Handbag'
|
||||
},
|
||||
{
|
||||
label: '订单',
|
||||
path: '/order',
|
||||
icon: 'Tickets'
|
||||
},
|
||||
// {
|
||||
// label: '网络',
|
||||
// path: '/internat',
|
||||
// icon: 'Paperclip'
|
||||
// },
|
||||
{
|
||||
label: '会员',
|
||||
path: '/member',
|
||||
icon: 'User'
|
||||
},
|
||||
{
|
||||
label: '排队',
|
||||
path: '/queue',
|
||||
icon: 'Timer'
|
||||
},
|
||||
// {
|
||||
// label: '交班',
|
||||
// path: '/work',
|
||||
// icon: 'SwitchButton'
|
||||
// }
|
||||
])
|
||||
const store = useUser()
|
||||
|
||||
// 更新叫号记录
|
||||
function updateCallNumber() {
|
||||
|
|
@ -110,7 +65,6 @@ function openCall() {
|
|||
|
||||
// 手动重新连接ws
|
||||
function connectWsHandle() {
|
||||
// if (socketStore.online) return
|
||||
location.reload()
|
||||
}
|
||||
|
||||
|
|
@ -203,9 +157,16 @@ defineExpose({
|
|||
background-color: #555;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.top_item_wra {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
|
@ -237,10 +198,6 @@ defineExpose({
|
|||
}
|
||||
}
|
||||
|
||||
&.more {
|
||||
margin-top: 90px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: #999;
|
||||
font-size: 22px;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
<template>
|
||||
<el-dialog v-model="showDialog" title="发现新版本" top="30vh" width="500" :close-on-click-modal="false"
|
||||
<el-dialog v-model="showDialog" :title="`发现新版本v${newVersionRef}`" top="30vh" width="500" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" :show-close="false">
|
||||
<div class="message">
|
||||
{{ updataInfo.message }}
|
||||
</div>
|
||||
<div class="message" v-html="updataInfo.message"></div>
|
||||
<div class="progress_wrap" style="padding-top: 20px;">
|
||||
<el-progress :percentage="uploadPro" :stroke-width="15" striped :striped-flow="uploadPro < 100" />
|
||||
</div>
|
||||
|
|
@ -44,6 +42,7 @@ const updataInfo = ref({})
|
|||
const isUpload = ref(false)
|
||||
const uploadPro = ref(0)
|
||||
const uploadSucess = ref(false)
|
||||
const newVersionRef = ref('')
|
||||
|
||||
// 关闭更新弹窗,下次登录在提示
|
||||
function closeHandle() {
|
||||
|
|
@ -59,17 +58,17 @@ async function findVersionAjax() {
|
|||
if (res && res.version) {
|
||||
const newVersion = res.version;
|
||||
const oldVersion = packageData.version;
|
||||
|
||||
console.log('当前版本:', oldVersion);
|
||||
console.log('获取版本:', newVersion);
|
||||
|
||||
const result = compareVersions(newVersion, oldVersion);
|
||||
if (result > 0) {
|
||||
console.log(`${newVersion} 比 ${oldVersion} 大`);
|
||||
if (!updateFlag) {
|
||||
newVersionRef.value = newVersion
|
||||
showDialog.value = true
|
||||
updataInfo.value = res
|
||||
}
|
||||
} else if (result < 0) {
|
||||
console.log(`${newVersion} 比 ${oldVersion} 小`);
|
||||
} else {
|
||||
console.log(`${newVersion} 与 ${oldVersion} 相等`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -77,7 +76,7 @@ async function findVersionAjax() {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 比较版本号
|
||||
function compareVersions(version1, version2) {
|
||||
const v1 = version1.split('.').map(Number);
|
||||
const v2 = version2.split('.').map(Number);
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ export const useGoods = defineStore("goods", {
|
|||
// 获取订单列表
|
||||
async historyOrderAjax(tableCode = "", orderId = "") {
|
||||
try {
|
||||
const store = useUser();
|
||||
const res = await historyOrder({
|
||||
tableCode: tableCode,
|
||||
orderId: orderId,
|
||||
|
|
@ -223,7 +224,7 @@ export const useGoods = defineStore("goods", {
|
|||
if (userInfo.id) {
|
||||
this.vipUserInfo = userInfo;
|
||||
|
||||
if (userInfo.isVip) {
|
||||
if (userInfo.isVip && store.shopInfo.isMemberPrice) {
|
||||
this.showVipPrice = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,55 @@ import {
|
|||
shopInfo_detail,
|
||||
logout,
|
||||
shopExtendDetail,
|
||||
shopPagePermissionMine,
|
||||
} from "@/api/account.js";
|
||||
import useStorage from "@/utils/useStorage";
|
||||
import { useSocket } from "@/store/socket.js";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
export const useUser = defineStore("user", {
|
||||
state: () => ({
|
||||
userInfo: useStorage.get("userInfo"),
|
||||
shopInfo: useStorage.get("shopInfo"),
|
||||
token: useStorage.get("token"),
|
||||
loginType: useStorage.get("loginType") || 0,
|
||||
menus: [
|
||||
{
|
||||
label: "收银",
|
||||
path: "/",
|
||||
state: 0,
|
||||
icon: "ShoppingCartFull",
|
||||
},
|
||||
],
|
||||
menuList: [
|
||||
{
|
||||
label: "台桌",
|
||||
path: "/table",
|
||||
icon: "Reading",
|
||||
},
|
||||
{
|
||||
label: "团购",
|
||||
path: "/group_buy",
|
||||
icon: "Handbag",
|
||||
},
|
||||
{
|
||||
label: "订单",
|
||||
path: "/order",
|
||||
icon: "Tickets",
|
||||
},
|
||||
{
|
||||
label: "会员",
|
||||
path: "/member",
|
||||
icon: "User",
|
||||
},
|
||||
{
|
||||
label: "排队",
|
||||
path: "/queue",
|
||||
icon: "Timer",
|
||||
},
|
||||
],
|
||||
route: null,
|
||||
router: null,
|
||||
}),
|
||||
actions: {
|
||||
// 登录
|
||||
|
|
@ -28,9 +68,54 @@ export const useUser = defineStore("user", {
|
|||
ticketLogo: logo ? logo.value : "",
|
||||
});
|
||||
this.shopInfo = useStorage.get("shopInfo");
|
||||
useStorage.set("loginType", param.loginType);
|
||||
this.shopPagePermissionMineAjax(param.loginType);
|
||||
return await this.shopStaffInfo();
|
||||
});
|
||||
},
|
||||
// 初始化路由信息
|
||||
initRoute() {
|
||||
this.route = useRoute();
|
||||
this.router = useRouter();
|
||||
},
|
||||
// 获取当前员工已拥有页面路径
|
||||
async shopPagePermissionMineAjax(loginType = useStorage.get("loginType")) {
|
||||
try {
|
||||
if (this.route == null) {
|
||||
this.initRoute();
|
||||
}
|
||||
if (loginType == 0) {
|
||||
this.menus[0].state = 1;
|
||||
this.menus.push(...this.menuList);
|
||||
} else {
|
||||
const res = await shopPagePermissionMine();
|
||||
|
||||
let pathFlag = true;
|
||||
res.map((item) => {
|
||||
if (item.path == "/") {
|
||||
this.menus[0].state = 1;
|
||||
}
|
||||
|
||||
if (this.route.path != item.path) {
|
||||
pathFlag = false;
|
||||
}
|
||||
|
||||
this.menuList.map((menu) => {
|
||||
if (item.path === menu.path) {
|
||||
this.menus.push(menu);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
console.log("当前路由===", this.route);
|
||||
if (!pathFlag) {
|
||||
this.router.push("/");
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("获取当前员工已拥有页面路径失败===", error);
|
||||
}
|
||||
},
|
||||
// 获取用户信息
|
||||
async shopStaffInfo() {
|
||||
try {
|
||||
|
|
@ -47,7 +132,10 @@ export const useUser = defineStore("user", {
|
|||
const res = await shopInfo_detail();
|
||||
// 获取标签小票的logo
|
||||
const logo = await shopExtendDetail({ autoKey: "ticket_logo" });
|
||||
useStorage.set("shopInfo", { ...res, ticketLogo: logo ? logo.value : "" });
|
||||
useStorage.set("shopInfo", {
|
||||
...res,
|
||||
ticketLogo: logo ? logo.value : "",
|
||||
});
|
||||
this.shopInfo = useStorage.get("shopInfo");
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -57,9 +145,7 @@ export const useUser = defineStore("user", {
|
|||
async logout() {
|
||||
try {
|
||||
const socket = useSocket();
|
||||
|
||||
await logout();
|
||||
|
||||
socket.close();
|
||||
|
||||
useStorage.del("userInfo");
|
||||
|
|
@ -70,6 +156,14 @@ export const useUser = defineStore("user", {
|
|||
this.userInfo = {};
|
||||
this.shopInfo = {};
|
||||
this.token = "";
|
||||
this.menus = [
|
||||
{
|
||||
label: "收银",
|
||||
path: "/",
|
||||
state: 0,
|
||||
icon: "ShoppingCartFull",
|
||||
},
|
||||
];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,11 @@ service.interceptors.response.use(
|
|||
if (+response.data.code == 200) {
|
||||
return response.data.data;
|
||||
} else if (+response.data.code == 501) {
|
||||
useStorage.del("token");
|
||||
useStorage.del("userInfo");
|
||||
useStorage.del("shopInfo");
|
||||
useStorage.del("douyin");
|
||||
ElMessage.error("登录已过期,请重新登录");
|
||||
useStorage.clear();
|
||||
router.replace("/login");
|
||||
window.location.reload();
|
||||
return Promise.reject("登录已过期,请重新登录");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@
|
|||
<div class="print_view">
|
||||
<div class="title t1">{{ printData.shop_name }}</div>
|
||||
<div class="title t2">
|
||||
预结算单【{{ printData.orderInfo.masterId }}】
|
||||
预结算单 <span style="margin-left: 6px;">#{{ printData.orderInfo.orderNum }}</span>
|
||||
</div>
|
||||
<div class="title t2" style="margin-bottom: 20px;">
|
||||
桌号:无
|
||||
</div>
|
||||
<div class="row">订单号:{{ printData.orderInfo.orderNo }}</div>
|
||||
<div class="row">交易时间:{{ printData.createdAt }}</div>
|
||||
|
|
@ -91,16 +94,21 @@
|
|||
</table>
|
||||
<div class="line"></div>
|
||||
<div class="row between">
|
||||
<span>合计:</span>
|
||||
<span>{{ printData.amount }}</span>
|
||||
<span>原价:</span>
|
||||
<span>{{ printData.originAmount }}</span>
|
||||
</div>
|
||||
<div class="row between">
|
||||
<span>余额:</span>
|
||||
<span>0.00</span>
|
||||
<span>折扣:</span>
|
||||
<span>-0.00</span>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="row">备注:{{ printData.remark }}</div>
|
||||
<div class="row">打印时间:{{ printData.printTime }}</div>
|
||||
<div class="row between" style="font-size: 24px;">
|
||||
<span>实付:</span>
|
||||
<span>¥{{ printData.amount }}</span>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="row" style="font-weight: bold;">备注:{{ printData.remark }}</div>
|
||||
<div class="row" style="font-size: 14px;">打印时间:{{ printData.printTime }}</div>
|
||||
</div>
|
||||
<div class="btn_wrap">
|
||||
<div class="btn">
|
||||
|
|
@ -167,28 +175,22 @@ const printData = reactive({
|
|||
carts: [
|
||||
{
|
||||
id: 1,
|
||||
name: "【测试】娃哈哈矿泉水",
|
||||
name: "【测试勿管】娃哈哈矿泉水",
|
||||
skuName: "500ml",
|
||||
salePrice: "1.0",
|
||||
number: "10",
|
||||
totalAmount: "10",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "【测试】柠檬奶茶",
|
||||
skuName: "加冰、加珍珠",
|
||||
salePrice: "10",
|
||||
number: "2",
|
||||
totalAmount: "20",
|
||||
},
|
||||
],
|
||||
amount: "30.00",
|
||||
discountAmount: "30.00",
|
||||
originAmount: '30.00',
|
||||
discountAmount: "0.00",
|
||||
discount: 0,
|
||||
remark: "给我多放点辣椒,谢谢老板",
|
||||
orderInfo: {
|
||||
masterId: "#002",
|
||||
masterId: "",
|
||||
orderNo: "202404021023542223445",
|
||||
orderNum: '12'
|
||||
},
|
||||
deviceName: "",
|
||||
createdAt: "2024-04-02 10:15",
|
||||
|
|
@ -325,10 +327,6 @@ onMounted(() => {
|
|||
&.t1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
&.t2 {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
<swiper-slide v-if="!goodsStore.goodsList.length">
|
||||
<div class="goods_empty" style="padding-top: 15vh;">
|
||||
<el-empty description="暂无商品~" v-if="!goodsStore.goodsList.length" />
|
||||
</div>
|
||||
</swiper-slide>
|
||||
</swiper>
|
||||
</div>
|
||||
<div class="empty">
|
||||
|
|
|
|||
|
|
@ -164,6 +164,10 @@
|
|||
<goods ref="goodsRef" @loading="cartLoading = true" />
|
||||
<!-- ©银收客 v{{ packageData.version }} -->
|
||||
</div>
|
||||
<!-- 无权限遮罩 -->
|
||||
<div class="no_permission" v-if="!store.menus.length || (store.menus.length && !store.menus[0].state)">
|
||||
无操作权限,请联系管理员(;´д`)ゞ
|
||||
</div>
|
||||
</div>
|
||||
<!-- 备注 -->
|
||||
<remarkModal ref="remarkRef" @success="(e) => (remark = e)" />
|
||||
|
|
@ -382,6 +386,26 @@ function clearVipUserHandle() {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.no_permission {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
border-radius: 10px;
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
backdrop-filter: blur(5px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.order_list_wrap {
|
||||
.order_list_item {
|
||||
&:not(:last-child) {
|
||||
|
|
|
|||
|
|
@ -198,13 +198,13 @@ async function captchaAjax() {
|
|||
|
||||
|
||||
onMounted(() => {
|
||||
store.initRoute()
|
||||
global.updateData(false)
|
||||
|
||||
captchaAjax()
|
||||
|
||||
let merchantLoginAccount = useStorage.get('merchantLoginAccount')
|
||||
if (merchantLoginAccount) {
|
||||
form.username = merchantLoginAccount
|
||||
form.loginType = useStorage.get('loginType')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -226,14 +226,15 @@ const infoshopInfoqueryDutys = async () => {
|
|||
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show
|
||||
})
|
||||
|
||||
function show() {
|
||||
dialogVisible.value = true
|
||||
infoshopInfoqueryDutys()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
Loading…
Reference in New Issue