diff --git a/src/api/goods/index.js b/src/api/goods/index.js index 74fb413..e6ad5e3 100644 --- a/src/api/goods/index.js +++ b/src/api/goods/index.js @@ -14,7 +14,16 @@ const api = { exportData: '/goods/import', setStorePrice: 'store/setStorePrice', getStorePriceInfo: 'store/getStorePriceInfo', - pool: '/goods/pool' + pool: '/goods/pool', + collector:'/goods/collector' +} + +export function getCollector (params) { + return axios({ + url: api.collector, + method: 'get', + params + }) } /** * 更新状态 diff --git a/src/components/SelectImage/SelectImage.vue b/src/components/SelectImage/SelectImage.vue index 8033bef..8ccc528 100644 --- a/src/components/SelectImage/SelectImage.vue +++ b/src/components/SelectImage/SelectImage.vue @@ -1,55 +1,28 @@ diff --git a/src/views/goods/Create.vue b/src/views/goods/Create.vue index 3324d94..097aee9 100644 --- a/src/views/goods/Create.vue +++ b/src/views/goods/Create.vue @@ -15,14 +15,14 @@ - + @@ -38,7 +38,7 @@ - + @@ -86,9 +86,9 @@ - - - + @@ -407,7 +407,7 @@ export default { } ], // 城市总数 - citysCount: null + citysCount: null, } }, // 初始化数据 @@ -419,12 +419,43 @@ 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() { - let obj = { - goods_name: '测试', - goods_price: 123 + const { form } = this + const goods_no = form.getFieldValue('goods_no') + if (goods_no) { + let param = { + sku: goods_no + } + 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 + let obj = { + goods_name: result.data.name, + content: result.data.content, + goods_price: result.data.proxyPrice, + } + this.form.setFieldsValue(obj) + this.isLoading = false + }) + .catch(() => { + this.isLoading = false + }) + .finally(() => (this.isLoading = false)) + } else { + this.$message.warning('请输入商品SKU', 1.5) } - this.form.setFieldsValue(obj) }, // 手动强制更新页面 onForceUpdate(bool = false) { diff --git a/src/views/goods/modules/Update.vue b/src/views/goods/modules/Update.vue index c208e3e..9f268fc 100644 --- a/src/views/goods/modules/Update.vue +++ b/src/views/goods/modules/Update.vue @@ -1,568 +1,356 @@