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) }} - - ¥ - - +