|
|
|
@ -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) |
|
|
|
|
}, |
|
|
|
|