From 9ba3f0f03eedb4246ae9c4bad81b0e5c91635a7c Mon Sep 17 00:00:00 2001 From: fanfan Date: Wed, 19 Jun 2024 16:46:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SelectImage/SelectImage.vue | 4 ++-- src/views/goods/Create.vue | 18 ++++----------- src/views/goods/modules/Update.vue | 26 ++++++---------------- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/components/SelectImage/SelectImage.vue b/src/components/SelectImage/SelectImage.vue index 8ccc528..a3d3f0a 100644 --- a/src/components/SelectImage/SelectImage.vue +++ b/src/components/SelectImage/SelectImage.vue @@ -4,7 +4,7 @@ -
+
@@ -119,7 +119,7 @@ export default { let fileId = [] const list = multiple ? selectedItems.map(item => item) : selectedItems[0].file_id list.forEach(function (item) { - fileId.push({ file_id: item.file_id, image: item.preview_url }) + fileId.push({ file_id: item.file_id, preview_url: item.preview_url }) }) return this.$emit('change', fileId, selectedItems) } else { diff --git a/src/views/goods/Create.vue b/src/views/goods/Create.vue index 0850ed4..bf92a06 100644 --- a/src/views/goods/Create.vue +++ b/src/views/goods/Create.vue @@ -18,7 +18,7 @@
-
+
一键获取
@@ -422,13 +422,6 @@ export default { }) }, methods: { - generateRandomDigits(length) { - let result = ''; - for (let i = 0; i < length; i++) { - result += Math.floor(Math.random() * 10); // 生成0-9的随机数字 - } - return result; - }, handInfo() { const { form } = this const goods_no = form.getFieldValue('goods_no') @@ -438,16 +431,13 @@ export default { } this.isLoading = true GoodsApi.getCollector(param).then((result) => { - if (result.data.goods_images.length > 0) { - result.data.goods_images.forEach(item => { - item.id = Number(this.generateRandomDigits(7)) - }); - } - this.$refs.childComponent.selectedItems= result.data.goods_images + this.$refs.childComponent.selectedItems = result.data.goods_images let obj = { goods_name: result.data.name, content: result.data.content, goods_price: result.data.proxyPrice, + imagesIds: result.data.goods_images, + goods_images: result.data.goods_images, } this.form.setFieldsValue(obj) this.isLoading = false diff --git a/src/views/goods/modules/Update.vue b/src/views/goods/modules/Update.vue index 2924a2a..482cf93 100644 --- a/src/views/goods/modules/Update.vue +++ b/src/views/goods/modules/Update.vue @@ -18,7 +18,7 @@
-
+
一键获取
@@ -240,8 +240,8 @@
- - + + @@ -423,31 +423,19 @@ export default { } }, methods: { - generateRandomDigits(length) { - let result = ''; - for (let i = 0; i < length; i++) { - result += Math.floor(Math.random() * 10); // 生成0-9的随机数字 - } - return result; - }, handInfo() { const { form } = this const goods_no = form.getFieldValue('goods_no') - this.formData.goods.goods_no = goods_no + this.formData.goods.goods_no = goods_no if (goods_no) { let param = { sku: goods_no } this.isLoading = true GoodsApi.getCollector(param).then((result) => { - this.formData.goods.goods_images = [] - if (result.data.goods_images.length > 0) { - result.data.goods_images.forEach(item => { - item.id = Number(this.generateRandomDigits(7)) - }); - } + this.formData.goods.imagesIds=result.data.goods_images this.formData.goods.goods_images = result.data.goods_images - this.$refs.childComponent.selectedItems= result.data.goods_images + this.$refs.childComponent.selectedItems = result.data.goods_images this.formData.goods.goods_name = result.data.name this.formData.goods.content = result.data.content this.formData.goods.goods_price = result.data.proxyPrice @@ -579,7 +567,7 @@ export default { 'delivery_type', 'is_brand', 'is_in_store', - 'goods_no' + 'goods_no' ], ['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price'], ['content'],