营销管理-商品推荐-商品分类多选

master
wangdong 6 months ago
parent db1be5aac6
commit 9b5839b626
  1. 5
      src/common/model/goods/Index.js
  2. 56
      src/views/market/Recommended.vue

@ -97,8 +97,9 @@ export default {
'is_points_discount', 'is_enable_grade', 'is_alone_grade', 'is_ind_dealer',
'dealer_money_type', 'first_money', 'second_money', 'third_money', 'cmmdty_model','is_check','goods_source','delivery_time','is_in_store'
])
console.log(goodsFormData, 100)
return {
...goodsFormData,
...goodsFormData
}
},
@ -122,6 +123,7 @@ export default {
goodsFormData['restrict_total'] = goodsInfo['restrict_total']
goodsFormData['restrict_single'] = goodsInfo['restrict_single']
}
console.log(goodsFormData, 126)
return goodsFormData
},
@ -139,6 +141,7 @@ export default {
CategoryModel.getCategoryTreeSelect()
.then(list => {
this.formData.categoryList = list
console.log(this.formData.categoryList)
resolve()
})
})

@ -22,7 +22,16 @@
<div v-show="record.params.source === 'auto'">
<a-form-model-item label="商品分类" :labelCol="labelCol" :wrapperCol="wrapperCol" required>
<SelectCategory v-model="record.params.auto.category" />
<!-- <SelectCategory v-model="record.params.auto.category" /> -->
<a-tree-select
v-model="record.params.auto.category"
placeholder="请选择商品分类"
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }"
:treeData="categoryList"
treeCheckable
treeCheckStrictly
allowClear
></a-tree-select>
</a-form-model-item>
<a-form-model-item label="商品排序" :labelCol="labelCol" :wrapperCol="wrapperCol" required>
@ -33,7 +42,7 @@
</a-radio-group>
</a-form-model-item>
<a-form-model-item label="显示数量" :labelCol="labelCol" :wrapperCol="wrapperCol" required>
<!-- <a-form-model-item label="显示数量" :labelCol="labelCol" :wrapperCol="wrapperCol" required>
<a-input-number
v-model="record.params.auto.showNum"
:min="0"
@ -41,7 +50,7 @@
autocomplete="off"
/>
<span class="ml-10"></span>
</a-form-model-item>
</a-form-model-item> -->
</div>
<div v-show="record.params.source === 'choice'">
@ -50,7 +59,7 @@
</a-form-model-item>
</div>
<a-divider orientation="left">样式设置</a-divider>
<!-- <a-divider orientation="left">样式设置</a-divider>
<a-form-model-item label="标题内容" :labelCol="labelCol" :wrapperCol="wrapperCol" required>
<a-input v-model="record.style.title" />
<div class="form-item-help">
@ -74,7 +83,7 @@
<a-checkbox v-show="record.style.column === 1" value="sellingPoint">商品卖点</a-checkbox>
<a-checkbox v-show="record.style.column === 1" value="goodsSales">商品销量</a-checkbox>
</a-checkbox-group>
</a-form-model-item>
</a-form-model-item> -->
<a-form-model-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }">
<a-button type="primary" :loading="confirmLoading" @click="handleSubmit">保存</a-button>
@ -88,7 +97,8 @@
import { cloneDeep } from 'lodash'
import * as Api from '@/api/setting/store'
import * as GoodsApi from '@/api/goods'
import { SelectGoods, SelectCategory } from '@/components'
import CategoryModel from '@/common/model/Category'
import { SelectGoods } from '@/components'
import { SettingEnum } from '@/common/enum/store'
//
@ -114,8 +124,7 @@ const defaultData = {
export default {
components: {
SelectGoods,
SelectCategory
SelectGoods
},
data () {
return {
@ -131,7 +140,8 @@ export default {
//
record: cloneDeep(defaultData),
//
choiceGoodsList: []
choiceGoodsList: [],
categoryList: []
}
},
//
@ -140,14 +150,32 @@ export default {
await this.getDetail()
//
await this.getChoiceGoodsList()
this.getCategoryList()
},
methods: {
//
getCategoryList() {
this.isLoading = true
CategoryModel.getCategoryTreeSelect()
.then((list) => {
console.log(list)
this.categoryList = list
})
.finally(() => (this.isLoading = false))
},
//
async getDetail () {
this.isLoading = true
await Api.detail(this.key)
.then(result => this.record = result.data.values)
.then(result => {
console.log(result)
if (result.data.values.params.auto.category) {
result.data.values.params.auto.category = result.data.values.params.auto.category.map(item => { return { value: item } })
} else {
result.data.values.params.auto.category = []
}
this.record = result.data.values
})
.finally(() => this.isLoading = false)
},
@ -165,7 +193,11 @@ export default {
//
handleSubmit (e) {
this.confirmLoading = true
Api.update(this.key, { form: this.record })
const data = { ...this.record }
// eslint-disable-next-line no-unused-expressions
data.params.auto.category.length > 0 ? data.params.auto.category = data.params.auto.category.map(item => item.value) : data.params.auto.category = []
console.log(data.params.auto.category)
Api.update(this.key, { form: data })
.then(result => this.$message.success(result.message, 1.5))
.finally(result => this.confirmLoading = false)
},

Loading…
Cancel
Save