From 00ff1749d9409a9ca0b03d7ec777b80c455b60b3 Mon Sep 17 00:00:00 2001 From: yf <770153798@qq.com> Date: Mon, 16 Dec 2024 15:22:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrderAddProductStep/ProductItem2.vue | 14 +++--- .../OrderAddProductStep/ProductItem3.vue | 13 +++--- .../OrderAddProductStep/ProductSkuList.vue | 45 ++++++++++++------- .../components/OrderAddProductStep/index.vue | 7 +-- .../src/views/oms/order/createorder/index.vue | 4 +- 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue index dd0310f..a891ea0 100644 --- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue +++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue @@ -26,12 +26,12 @@ @@ -145,13 +145,14 @@ const addItem = () => { addRow(); } const addRow=(row={})=>{ - + console.log( "formData.value",formData.value) + const tmpForm = formData.value ?? {}; that.tableList.push({ orderQty: 1, //@ts-ignore - previewImage: formData.value.previewImage, + previewImage: tmpForm.previewImage, draftDesignId: "", - ...formData.value, + ...tmpForm, ...row, key: Math.random().toString(36).substring(2), }) @@ -163,17 +164,16 @@ useEmitt({ if(formData.value && that.tableList && that.tableList.length > 0 && formData.value.productId === that.tableList[0].productId){ that = resetFields(); - } }, }); const init = (list = [])=>{ if(list){ + that.tableList = []; for (let i = 0; i < list.length; i++) { addRow(list[i]) } } - } const querySearch = (queryString: string, cb: any) => { const results = queryString ? that.itemList.filter(t => t.toString() diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem3.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem3.vue index 636e193..1a2f873 100644 --- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem3.vue +++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem3.vue @@ -45,6 +45,7 @@ class="inline-input w-50" :placeholder="t('createOrder.placeSkuInputSize')" @select="handleSelect" + @change="changeData" /> @@ -53,13 +54,13 @@ @@ -242,13 +243,14 @@ const addRow=(row={})=>{ } } } + const tmpForm = formData.value ?? {}; that.tableList.push({ orderQty: 1, labelSize: "", //@ts-ignore - previewImage: formData.value.previewImage, + previewImage: tmpForm.previewImage, draftDesignId: "", - ...formData.value, + ...tmpForm, ...row, key: Math.random().toString(36).substring(2), }) @@ -266,6 +268,7 @@ useEmitt({ }); const init = (list = [])=>{ if(list){ + that.tableList = []; for (let i = 0; i < list.length; i++) { addRow(list[i]) } @@ -286,7 +289,7 @@ const querySearch = (queryString: string, cb: any) => { cb(res) } const handleSelect = (item: RestaurantItem) => { - console.log(item) + changeData() } const selectable = (row:any) => { diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue index f51a0e3..2998be5 100644 --- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue +++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue @@ -4,8 +4,8 @@
{{t('createOrder.btnAddSku')}} + v-show="that.templateType !== '2' && that.tableData.length > 0" + @click="addSku">{{ t('createOrder.btnAddSku') }}
@@ -48,6 +48,7 @@ import ProductItem3 from "./ProductItem3.vue" import {ProductInfoApi} from "@/api/oms/productinfo"; import {useResetFields} from "@/hooks/ext"; import {useI18n} from "vue-i18n"; + const {t} = useI18n() const emit = defineEmits(['change']) const productItem2Ref = ref(); @@ -85,6 +86,9 @@ const addSku = () => { propInfo: '{}', // 动态信息信息 specInfo: JSON.parse(JSON.stringify(that.specInfo)), }) + if(that.templateType === '3'){ + productItem3Ref.value.init(that.tableData); + } } const itemType = () => { // @@ -94,13 +98,13 @@ const itemType = () => { } } const init = (row) => { + that.tableData = row.productSkuList; that.productId = row.productId that.listKey = row.key if (that.productId) { //@ts-ignore ProductInfoApi.getProductInfo(that.productId).then(res => { - console.log("res", res) that.specInfo = { specSizeWidth: res.specSizeWidth, specSizeHeight: res.specSizeHeight, @@ -113,23 +117,30 @@ const init = (row) => { if (res.templateType !== '1') { that.cover = res.cover } - console.log("that.tableData.length", that.tableData.length) - if (that.tableData.length === 0) { - addSku(); - if (res.templateType === '2') { - // 初始化 - setTimeout(() => { - productItem2Ref.value.init(that.tableData); - }, 100) - } else if (res.templateType === '3') { - // 初始化 - setTimeout(() => { + + if (res.templateType === '2') { + // 初始化 + setTimeout(() => { + if (that.tableData.length === 0) { + addSku(); + } + productItem2Ref.value.init(that.tableData); + }, 100) + } else if (res.templateType === '3') { + // 初始化 + setTimeout(() => { + if (that.tableData.length === 0) { + addSku(); + }else { productItem3Ref.value.init(that.tableData); - }, 100) + } + + }, 100) + } else { + if (that.tableData.length === 0) { + addSku(); } } - - }) } diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/index.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/index.vue index d6095cc..2c73af9 100644 --- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/index.vue +++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/index.vue @@ -34,10 +34,11 @@ const that = reactive({ selectRow: null, }) const rowClick = (row) => { - console.log("init",row) + + const tmp = JSON.parse(JSON.stringify(row)) that.selectRow = { productSkuList: [], - ...row, + ...tmp, } //@ts-nocheck skuListRef.value.init(that.selectRow) @@ -55,7 +56,6 @@ const changeDetails = (tableData)=>{ }) } listRef.value.setSelectRow(that.selectRow) - } const getTableData = () => { @@ -70,6 +70,7 @@ const getTableData = () => { } const init = (saleOrderEntry)=>{ listRef.value.init(saleOrderEntry) + } defineExpose({ getTableData, diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue index 5f3eab5..528df4f 100644 --- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue +++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue @@ -672,7 +672,8 @@ const submitPreHandler = (showMsg = true) => { return; } item.productSkuList.forEach((item2, i2) => { - if (!item2.previewImage) { + console.log("item2",item2) + if (item2.productTemplateType === '1' && !item2.previewImage) { const t = ` Please review row${index + 1} ‘${item.productName}’SKU ${i2 + 1}`; if (showMsg) { useMessage().warning(t) @@ -804,6 +805,7 @@ onMounted(async () => { ...formData.value, id: queryParams.id } + console.log("res.saleOrderEntry",res.saleOrderEntry) stepRef.value.init(res.saleOrderEntry ?? []); }