1.优化商品分类 2.其他优化

This commit is contained in:
gyq
2025-03-27 13:57:15 +08:00
parent 48280f92df
commit e13727e6ff
12 changed files with 16226 additions and 66 deletions

View File

@@ -19,27 +19,11 @@ VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
# 正式 php 开票 # 正式 php 开票
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api' VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 杰哥 # 本地调试连接
# VITE_API_URL = 'http://192.168.1.34:10589/cashier-client' VITE_API_URL = 'http://192.168.1.31/'
# 测试 # 线上测试
# VITE_API_URL = 'https://cashier-client.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 = 'http://192.168.1.35/'
# 阿伟
# VITE_API_URL = 'http://192.168.1.21:8000/'
# 测试
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn' # VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
# 正式 # 线上正式
VITE_API_URL = 'https://cashier.sxczgkj.com' # VITE_API_URL = 'https://cashier.sxczgkj.com'

View File

@@ -11,7 +11,4 @@ VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api' VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 线上环境接口地址 # 线上环境接口地址
VITE_API_URL = 'https://cashier.sxczgkj.com/' VITE_API_URL = 'https://cashier.sxczgkj.com/'
# 预发布接口
# VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client/'

View File

@@ -1,4 +1,4 @@
# 线上环境 # 测试环境
ENV = test ENV = test
# 测试ws # 测试ws

File diff suppressed because one or more lines are too long

View File

@@ -67,7 +67,7 @@ body {
font-weight: bold; font-weight: bold;
} }
.print_view .number_wrap .info { .print_view .number_wrap .info {
margin-left: 10px; font-weight: bold;
padding-bottom: 2px; padding-bottom: 2px;
} }
.print_view .time { .print_view .time {

View File

@@ -53,7 +53,7 @@ body {
font-weight: bold; font-weight: bold;
} }
.info { .info {
margin-left: 10px; font-weight: bold;
padding-bottom: 2px; padding-bottom: 2px;
} }
} }

View File

@@ -13,7 +13,7 @@
收银员{{ store.userInfo.name }} 收银员{{ store.userInfo.name }}
</div> </div>
<div> <div>
<span style="color: #666">{{ dayjs(store.userInfo.loginTime).format('YYYY-MM-DD HH:mm:ss') }}</span> <span style="color: #999">{{ dayjs(store.userInfo.loginTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div> </div>
</div> </div>
<!-- <div class="drawerbox_bo_top_ring"> <!-- <div class="drawerbox_bo_top_ring">
@@ -32,7 +32,7 @@
</div> --> </div> -->
</div> </div>
<div class="drawerbox_bo_box"> <div class="drawerbox_bo_box">
<div style="padding: 10px; color: #999; font-weight: bold">系统</div> <!-- <div style="padding: 10px 0; color: #999; font-weight: bold">系统</div> -->
<div class="drawerbox_bo_box_itemb_felx"> <div class="drawerbox_bo_box_itemb_felx">
<!-- <div class="drawerbox_bo_box_itembox"> <!-- <div class="drawerbox_bo_box_itembox">
<div class="drawerbox_bo_box_icon"> <div class="drawerbox_bo_box_icon">
@@ -178,7 +178,7 @@ defineExpose({
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #47484b;
.drawerbox_bo_top_left { .drawerbox_bo_top_left {
display: flex; display: flex;
@@ -212,12 +212,12 @@ defineExpose({
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
padding: 20px 0;
.drawerbox_bo_box_itembox { .drawerbox_bo_box_itembox {
width: 20%;
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
flex-direction: column;
margin-right: 20px; margin-right: 20px;
margin-bottom: 30px; margin-bottom: 30px;

View File

@@ -337,7 +337,7 @@ export const useGoods = defineStore("goods", {
setTimeout(() => { setTimeout(() => {
this.goodsListLoading = false; this.goodsListLoading = false;
}, 1000); }, 500);
}, },
// 获取购物车列表,数据必须由长链接返回 // 获取购物车列表,数据必须由长链接返回
async getCartList(arr) { async getCartList(arr) {

View File

@@ -207,6 +207,7 @@ export const useSocket = defineStore("socket", {
this.orderList.splice(0, 1); this.orderList.splice(0, 1);
} }
} catch (error) { } catch (error) {
this.orderList.splice(0, 1);
console.log(error); console.log(error);
} }
}, 2000); }, 2000);

View File

@@ -72,7 +72,7 @@
</div> </div>
<div class="number_wrap"> <div class="number_wrap">
<!-- <div class="num" v-if="printData.outNumber">{{ printData.outNumber }}</div> --> <!-- <div class="num" v-if="printData.outNumber">{{ printData.outNumber }}</div> -->
<div class="info" v-if="printData.masterId">座位号{{ printData.masterId }}</div> <div class="info">座位号{{ printData.masterId }}</div>
</div> </div>
<div class="shop_info"> <div class="shop_info">
<div class="name">{{ printData.name }}</div> <div class="name">{{ printData.name }}</div>
@@ -83,7 +83,7 @@
</div> </div>
<div class="btn_wrap"> <div class="btn_wrap">
<div class="btn"> <div class="btn">
<el-button plain style="width: 100%" @click="printHandle"> <el-button plain style="width: 100%" :loading="printLoading" @click="printHandle">
打印测试小票 打印测试小票
</el-button> </el-button>
</div> </div>
@@ -120,6 +120,7 @@ const store = useUser();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const printLoading = ref(false);
const classifyRef = ref(null); const classifyRef = ref(null);
const printList = ref([]); const printList = ref([]);
const feets = ref([0, 1, 2, 3, 4, 5, 8]); const feets = ref([0, 1, 2, 3, 4, 5, 8]);
@@ -168,11 +169,15 @@ const printHandle = _.throttle(function () {
ElMessage.error("请选择打印设备"); ElMessage.error("请选择打印设备");
return; return;
} }
printLoading.value = true;
printData.value.deviceName = form.value.address printData.value.deviceName = form.value.address
ipcRenderer.send( ipcRenderer.send(
"printerTagSync", "printerTagSync",
JSON.stringify(printData.value) JSON.stringify(printData.value)
); );
setTimeout(() => {
printLoading.value = false;
}, 1000);
}, 1500, { leading: true, trailing: false }) }, 1500, { leading: true, trailing: false })
// 提交打印机 // 提交打印机
@@ -313,8 +318,8 @@ onMounted(() => {
} }
.info { .info {
margin-left: 12px;
padding-bottom: 4px; padding-bottom: 4px;
font-weight: bold;
} }
} }

View File

@@ -1,8 +1,8 @@
<!-- 商品列表 --> <!-- 商品列表 -->
<template> <template>
<div class="header"> <div class="header">
<div class="menus scroll-x"> <div class="menus scroll-x" ref="tabScrollRef">
<div class="item" :class="{ active: goodsStore.categoryIndex == index }" <div class="item tab-item" :class="{ active: goodsStore.categoryIndex == index }"
v-for="(item, index) in goodsStore.categoryList" :key="item.id" @click="changeCategory(index)"> v-for="(item, index) in goodsStore.categoryList" :key="item.id" @click="changeCategory(index)">
<el-icon v-if="item.id === ''" class="icon" :class="{ active: goodsStore.goodsListLoading }"> <el-icon v-if="item.id === ''" class="icon" :class="{ active: goodsStore.goodsListLoading }">
<RefreshRight /> <RefreshRight />
@@ -241,26 +241,23 @@
<script setup> <script setup>
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { Search } from '@element-plus/icons-vue' import { Search } from '@element-plus/icons-vue'
import { nextTick, onMounted, ref } from 'vue' import { ref, watch, onMounted } from 'vue'
import _ from 'lodash' import _ from 'lodash'
import useStorage from "@/utils/useStorage"; import useStorage from "@/utils/useStorage";
import skuModal from '@/components/skuModal.vue' import skuModal from '@/components/skuModal.vue'
import WeightModal from './weightModal.vue' import WeightModal from './weightModal.vue'
import GroupModal from './groupModal.vue' import GroupModal from './groupModal.vue'
import { queryCategory, queryNewCommodityInfo, queryProductSku, productStatus, productStock, getUnitList, temporaryDishes } from '@/api/product' import { queryProductSku, productStock, getUnitList } from '@/api/product'
import { useUser } from "@/store/user.js" import { useUser } from "@/store/user.js"
import { useGoods } from '@/store/goods.js' import { useGoods } from '@/store/goods.js'
import { Swiper, SwiperSlide } from 'swiper/vue' import { Swiper, SwiperSlide } from 'swiper/vue'
import "swiper/swiper-bundle.css"; import "swiper/swiper-bundle.css";
import { staffPermission } from '@/api/user.js' import { staffPermission } from '@/api/user.js'
import { useGlobal } from '@/store/global.js' import { clearNoNum } from '@/utils/index.js'
import { inputFilterFloat, clearNoNum } from '@/utils/index.js'
import { productOnOff, markIsSoldOut } from '@/api/product_new.js' import { productOnOff, markIsSoldOut } from '@/api/product_new.js'
const swiperRef = ref(null) const swiperRef = ref(null)
const global = useGlobal()
const store = useUser() const store = useUser()
const goodsStore = useGoods() const goodsStore = useGoods()
@@ -271,15 +268,20 @@ const props = defineProps({
} }
}) })
watch(() => goodsStore.categoryList, (newVal, oldVal) => {
if (newVal.length) {
setTimeout(() => {
tabContentAni(goodsStore.categoryIndex)
}, 300)
}
})
const emit = defineEmits(['success', 'loading']) const emit = defineEmits(['success', 'loading'])
const skuModalRef = ref(null) const skuModalRef = ref(null)
const shopListType = ref('img') const shopListType = ref('img')
const categorys = ref([])
const categorysActive = ref(0)
const commdityName = ref('') const commdityName = ref('')
const loading = ref(false) const loading = ref(false)
@@ -579,10 +581,43 @@ function localUpdateShopListType() {
}) })
} }
// 切换分类 // 切换分类;
function changeCategory(index) { function changeCategory(index) {
showPopover.value = false showPopover.value = false
goodsStore.setCategoryIndex(index) goodsStore.setCategoryIndex(index)
tabContentAni(index)
}
// 使tab平滑居中
const tabScrollRef = ref(null);
const activeTab = ref(0)
function tabContentAni(index) {
activeTab.value = index;
const tabScroll = tabScrollRef.value;
const tabItems = tabScroll.querySelectorAll('.tab-item');
const clickedTab = tabItems[index];
const containerWidth = tabScroll.offsetWidth;
const tabWidth = clickedTab.offsetWidth;
// 使用 getBoundingClientRect 获取更准确的位置
const tabRect = clickedTab.getBoundingClientRect();
const containerRect = tabScroll.getBoundingClientRect();
const tabOffsetLeft = tabRect.left - containerRect.left + tabScroll.scrollLeft;
// 计算需要滚动到的位置,使点击的 tab 居中
let scrollTo = tabOffsetLeft - (containerWidth - tabWidth) / 2;
// 确保滚动位置不会小于 0
scrollTo = Math.max(0, scrollTo);
// 确保滚动位置不会超过最大可滚动距离
const maxScroll = tabScroll.scrollWidth - containerWidth;
scrollTo = Math.min(scrollTo, maxScroll);
// 平滑滚动到计算的位置
tabScroll.scrollTo({
left: scrollTo,
behavior: 'smooth'
});
} }
// 更新商品数据 // 更新商品数据
@@ -779,6 +814,12 @@ defineExpose({
clearDot, clearDot,
showPackage showPackage
}) })
onMounted(() => {
if (goodsStore.categoryList.length) {
tabContentAni(goodsStore.categoryIndex)
}
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -134,12 +134,12 @@ async function printHandle(type) {
default: default:
break; break;
} }
setTimeout(() => {
printLoading.value = false;
}, 1500);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
setTimeout(() => {
printLoading.value = false;
}, 1500);
} }
async function show(row) { async function show(row) {