|
@@ -99,7 +99,7 @@ export default {
|
|
|
limit: 10,
|
|
|
// info部分
|
|
|
infoFields: [
|
|
|
- { label: '店铺名称', model: 'shop', custom: true },
|
|
|
+ { label: '商铺名称', model: 'shop', custom: true },
|
|
|
{ label: '商品名称', model: 'name' },
|
|
|
{ label: '商品分类', model: 'tags', custom: true },
|
|
|
{ label: '活动标签', model: 'act_tags', type: 'selectMany' },
|
|
@@ -113,7 +113,9 @@ export default {
|
|
|
{ label: '商品介绍', model: 'brief', custom: true },
|
|
|
],
|
|
|
|
|
|
- rules: {},
|
|
|
+ rules: {
|
|
|
+ shop: [{ required: true, message: '请选择商铺名称', trigger: 'change' }],
|
|
|
+ },
|
|
|
form: {},
|
|
|
// 商品分类
|
|
|
tagsList: [],
|
|
@@ -149,6 +151,22 @@ export default {
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
},
|
|
|
+ // 去编辑
|
|
|
+ async toEdit({ data }) {
|
|
|
+ const res = await this.fetch(data._id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ if (data.shop) {
|
|
|
+ let res = await this.shopFetch(data.shop._id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.shopList.push(res.data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(this, `form`, res.data);
|
|
|
+ this.view = 'info';
|
|
|
+ } else {
|
|
|
+ this.$message.error('未找到指定数据');
|
|
|
+ }
|
|
|
+ },
|
|
|
// 多选
|
|
|
handleSelect(data) {
|
|
|
this.$emit('handleSelect');
|
|
@@ -177,7 +195,6 @@ export default {
|
|
|
initAddData() {
|
|
|
const obj = {
|
|
|
status: '1',
|
|
|
- shop: _.get(this.shop, '_id'),
|
|
|
};
|
|
|
this.$set(this, 'form', obj);
|
|
|
},
|