From c8651a7dd1530cf5e279610a88094bc67159b7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=9F=91=E8=9E=82?= Date: Sun, 26 Apr 2026 22:05:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(ecom-dmb):=20=E5=95=86=E5=93=81=E5=8D=A1?= =?UTF-8?q?=E7=89=87UI=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 瀑布流宽度560→700,breakpoints对应调整 - 规格表格横向滚动,操作列sticky固定右侧 - 规格名称列min-width:180px防止挤压换行 - 成本输入框替换为InputNumber带controls箭头 - 成本同步弹窗UI对标设计稿(警告提示条、选中卡片样式、成本快照列) - 时间范围默认空值,需用户手动选择 --- .../product/components/ProductCard.vue | 390 ++++++++++++++---- .../product/views/ProductGridView/index.vue | 8 +- 2 files changed, 322 insertions(+), 76 deletions(-) diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/product/components/ProductCard.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/product/components/ProductCard.vue index e45045c2..a49ef9a3 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/product/components/ProductCard.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/product/components/ProductCard.vue @@ -14,11 +14,12 @@ import { Form, Image, Input, + InputNumber, message, Popconfirm, TreeSelect, } from 'ant-design-vue'; -import dayjs from 'dayjs'; + import TextArea from 'ant-design-vue/es/input/TextArea'; import { updateProductApi } from '#/api/ecommerce/product'; @@ -59,10 +60,7 @@ async function openSyncModal(costChangedSpecIds: number[]) { const specs = await getProductSpecsByIdsApi(costChangedSpecIds); pendingCostChangedSpecs.value = specs ?? []; selectedSyncSpecIds.value = costChangedSpecIds; - syncFormData.value = [ - dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'), - dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'), - ]; + syncFormData.value = undefined; syncModalApi.open(); } catch (error) { console.error('获取规格详情失败:', error); @@ -73,8 +71,24 @@ async function openSyncModal(costChangedSpecIds: number[]) { const pendingCostChangedSpecs = ref([]); const selectedSyncSpecIds = ref([]); +function toggleSpec(specId: number) { + const idx = selectedSyncSpecIds.value.indexOf(specId); + if (idx === -1) { + selectedSyncSpecIds.value.push(specId); + } else { + selectedSyncSpecIds.value.splice(idx, 1); + } +} + async function handleSyncConfirm() { - if (selectedSyncSpecIds.value.length === 0 || !syncFormData.value) return; + if (selectedSyncSpecIds.value.length === 0) { + message.warning('请至少选择一个规格'); + return; + } + if (!syncFormData.value || syncFormData.value[0] == null || syncFormData.value[1] == null) { + message.warning('请选择同步时间范围'); + return; + } try { syncModalApi.setState?.({ confirmLoading: true }); const [startDate, endDate] = syncFormData.value; @@ -216,12 +230,6 @@ const displaySpecs = computed(() => { const formatCost = (val?: number) => `¥${(val ?? 0).toFixed(2)}`; -const handleCostInput = (field: 'productCost' | 'shippingCost' | 'otherCost', specIndex: number, e: Event) => { - const raw = (e.target as HTMLInputElement).value; - const num = Number(raw); - draft.value.specs[specIndex]![field] = Number.isFinite(num) && num >= 0 ? num : 0; -}; - function addSpec() { draft.value.specs.push({ id: -Date.now(), @@ -465,7 +473,7 @@ const saveEdit = async () => { 商品成本 运费成本 其他成本 - + 操作
{ {{ formatCost(spec.productCost) }} - - ¥ - - + {{ formatCost(spec.shippingCost) }} - - ¥ - - + {{ formatCost(spec.otherCost) }} - - ¥ - - +