diff --git a/package.json b/package.json index a7d7665..7e43748 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vite-electron", "private": true, - "version": "2.0.18", + "version": "2.0.19", "main": "dist-electron/main.js", "scripts": { "dev": "chcp 65001 && vite", diff --git a/src/components/payCard/payCard.vue b/src/components/payCard/payCard.vue index 4a42abc..4166a82 100644 --- a/src/components/payCard/payCard.vue +++ b/src/components/payCard/payCard.vue @@ -15,9 +15,9 @@
商品原价:¥{{ goodsStore.cartInfo.costSummary.goodsRealAmount || 0 }} 餐位费:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.seatFee || 0) - }} + }} 打包费:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.packFee || 0) - }} + }} 优惠:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.totalDiscountAmount || 0) }} - +
@@ -190,7 +200,7 @@ async function getOrderDetail() { let total = 0 res.cartList.forEach(item => { - total += +item.payAmount - (item.returnAmount || 0) + total += +item.payAmount - (item.returnNum * item.price) }) orderInfo.value.orderAmount = formatDecimal(total) } diff --git a/src/views/table/index.vue b/src/views/table/index.vue index f204653..8590265 100644 --- a/src/views/table/index.vue +++ b/src/views/table/index.vue @@ -25,12 +25,12 @@
-
- - - - +
+
全部
+
+ {{ item.name }} +
@@ -87,7 +87,7 @@ import { shopArea, shopTable } from "@/api/account.js"; import countCard from '@/views/table/components/countCard.vue' import tableInfo from '@/views/table/components/tableInfo.vue' -import { ref, onMounted, onUnmounted } from 'vue' +import { ref, onMounted, onUnmounted, nextTick } from 'vue' import { dayjs } from 'element-plus' import tableStatusList from './statusList.js' import { formatDecimal } from '@/utils/index.js' @@ -149,6 +149,43 @@ function tabChange(item, index) { shopTableAjax() } +const tabItemActive = ref(-1) +function tabItemChange(item, index) { + tabItemActive.value = index + if (index == -1) { + area.value = '' + } else { + area.value = item.id + } + shopTableAjax() + + nextTick(() => { + scrollTabToCenter() + }) +} + +// 自动居中滚动 +const tabHeadRef = ref(null) +function scrollTabToCenter() { + const container = tabHeadRef.value + if (!container) return + + // 获取当前激活的 item + const activeItem = container.querySelector('.item.active') + if (!activeItem) return + + // 计算居中位置 + const containerWidth = container.offsetWidth + const itemWidth = activeItem.offsetWidth + const itemLeft = activeItem.offsetLeft + + // 滚动到中间(核心公式) + container.scrollTo({ + left: itemLeft - containerWidth / 2 + itemWidth / 2, + behavior: 'smooth' // 丝滑滚动 + }) +} + // 计算当前的时间差 function countTime(t) { if (!t) return '0小时1分' @@ -374,12 +411,46 @@ onUnmounted(() => { padding: var(--el-font-size-base); .tab_head { + width: calc(100vw - 125px); padding-bottom: var(--el-font-size-base); + overflow-x: auto; + white-space: nowrap; + + /* 隐藏滚动条(通用) */ + scrollbar-width: none; + -ms-overflow-style: none; + + + .item { + height: 42px; + display: inline-flex; + align-items: center; + padding: 4px 12px; + border-radius: 4px; + background-color: #f5f5f5; + margin-right: 10px; + + &.active { + background-color: var(--primary-color); + color: #fff; + } + + &:hover { + cursor: pointer; + background-color: var(--primary-color); + color: #fff; + } + } + } + + /* 隐藏滚动条(Chrome / Electron / Edge) */ + .tab_head::-webkit-scrollbar { + display: none !important; } .overflow_y { // height: calc(100vh - 220px); - height: calc(100vh - 160px); + height: calc(100vh - 162px); overflow-y: auto; } @@ -424,6 +495,21 @@ onUnmounted(() => { justify-content: space-between; padding: 0 10px; color: #fff; + gap: 4px; + + span:nth-child(1) { + /* 核心:最多两行,超出... */ + display: -webkit-box; + -webkit-line-clamp: 2; + /* 最多2行 */ + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; + + /* 保证换行正常 */ + white-space: normal; + word-break: break-all; + } } .tab_cont {