细节修改

master
fanfan 5 months ago
parent e38c45b4da
commit 9ba3f0f03e
  1. 4
      src/components/SelectImage/SelectImage.vue
  2. 18
      src/views/goods/Create.vue
  3. 26
      src/views/goods/modules/Update.vue

@ -4,7 +4,7 @@
<!-- draggable是拖拽组件 -->
<draggable v-if="selectedItems.length" v-model="selectedItems" @start="drag=true" @end="drag=false" @update="onUpdate">
<transition-group class="draggable-item" type="transition" :name="'flip-list'">
<div v-for="(item, index) in selectedItems" :key="item.file_id>0?item.file_id:item.id" class="file-item" :style="{ width: `${width}px`, height: `${width}px` }">
<div v-for="(item, index) in selectedItems" :key="item.file_id>0?item.file_id:index" class="file-item" :style="{ width: `${width}px`, height: `${width}px` }">
<!-- 预览图 -->
<a :href="item.preview_url" target="_blank">
<div class="img-cover" :style="{ backgroundImage: `url('${item.preview_url}')` }"></div>
@ -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 {

@ -18,7 +18,7 @@
<a-form-item label="商品SKU" :labelCol="labelCol" :wrapperCol="wrapperCol">
<div style=" display: flex;align-items: center;width:100%">
<a-input style="width:242px" placeholder="输入商品SKU" v-decorator="['goods_no', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<div class="action-item">
<div class="action-item" style="margin-left:15px">
<a-button type="primary" @click="handInfo">一键获取</a-button>
</div>
</div>
@ -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

@ -18,7 +18,7 @@
<a-form-item label="商品SKU" :labelCol="labelCol" :wrapperCol="wrapperCol">
<div style=" display: flex;align-items: center;width:100%">
<a-input style="width:242px" placeholder="输入商品SKU" v-decorator="['goods_no', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<div class="action-item">
<div class="action-item" style="margin-left:15px">
<a-button type="primary" @click="handInfo">一键获取</a-button>
</div>
</div>
@ -240,8 +240,8 @@
</div>
</a-form-item>
<a-form-item label="下单须知" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入下单须知" v-decorator="['remark']" />
</a-form-item>
<a-input placeholder="请输入下单须知" v-decorator="['remark']" />
</a-form-item>
<a-form-item label="初始销量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端展示的销量 = 初始销量 + 实际销量">
<a-input-number v-decorator="['sales_initial', { initialValue: 0 }]" />
</a-form-item>
@ -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'],

Loading…
Cancel
Save