diff --git a/src/common/model/goods/Index.js b/src/common/model/goods/Index.js
index 79764cf..1d19f04 100644
--- a/src/common/model/goods/Index.js
+++ b/src/common/model/goods/Index.js
@@ -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()
})
})
diff --git a/src/views/market/Recommended.vue b/src/views/market/Recommended.vue
index d709630..fb98bb9 100644
--- a/src/views/market/Recommended.vue
+++ b/src/views/market/Recommended.vue
@@ -22,7 +22,16 @@
-
+
+
@@ -33,7 +42,7 @@
-
+
@@ -50,7 +59,7 @@
- 样式设置
+
保存
@@ -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)
},