|
@@ -2,16 +2,25 @@
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="main animate__animated animate__backInRight">
|
|
|
- <el-col :span="24" class="one"> <span>平台商品</span> </el-col>
|
|
|
+ <el-col :span="24" class="one"> <span>活动标题</span> </el-col>
|
|
|
<el-col :span="24" class="two">
|
|
|
- <el-autocomplete v-model="goods" :fetch-suggestions="querySearchAsync" placeholder="请输入商品名称"
|
|
|
- @select="handleSelect"></el-autocomplete>
|
|
|
+ <!-- <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1> -->
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="thr">
|
|
|
<el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="four">
|
|
|
- <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @add="toAdd">
|
|
|
+ <data-table
|
|
|
+ :select="true"
|
|
|
+ :selected="selected"
|
|
|
+ @handleSelect="handleSelect"
|
|
|
+ :fields="fields"
|
|
|
+ :opera="opera"
|
|
|
+ @query="search"
|
|
|
+ :data="list"
|
|
|
+ :total="total"
|
|
|
+ @del="toDel"
|
|
|
+ >
|
|
|
</data-table>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
@@ -24,103 +33,68 @@ const _ = require('lodash');
|
|
|
import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions } = createNamespacedHelpers('goodsJoinAct');
|
|
|
const { mapActions: dictData } = createNamespacedHelpers('dictData');
|
|
|
-const { mapActions: goods } = createNamespacedHelpers('goods');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
- components: {},
|
|
|
+ components: {
|
|
|
+ // search1: () => import('./parts/search-1.vue'),
|
|
|
+ },
|
|
|
data: function () {
|
|
|
const that = this;
|
|
|
return {
|
|
|
// 列表
|
|
|
- opera: [{ label: '添加', method: 'add' }],
|
|
|
+ opera: [{ label: '删除', method: 'del', confirm: true, type: 'danger' }],
|
|
|
fields: [
|
|
|
{ label: '活动标题', model: 'title' },
|
|
|
{ label: '活动时间', model: 'act_time.value' },
|
|
|
- {
|
|
|
- label: '是否开启',
|
|
|
- model: 'is_use',
|
|
|
- format: (i) => {
|
|
|
- let data = that.isuseList.find((f) => f.value == i);
|
|
|
- if (data) return data.label;
|
|
|
- else return '暂无';
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- label: '是否在首页显示',
|
|
|
- model: 'show_index',
|
|
|
- format: (i) => {
|
|
|
- let data = that.isuseList.find((f) => f.value == i);
|
|
|
- if (data) return data.label;
|
|
|
- else return '暂无';
|
|
|
- },
|
|
|
- },
|
|
|
],
|
|
|
list: [],
|
|
|
total: 0,
|
|
|
- // 商品搜索
|
|
|
- goods: '',
|
|
|
- goodsList: [],
|
|
|
- // 是否开启
|
|
|
- isuseList: [],
|
|
|
+ // 查询
|
|
|
+ searchForm: {},
|
|
|
+ // 多选值
|
|
|
+ selected: [],
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
|
- await this.searchOther();
|
|
|
await this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
...dictData({ dictQuery: 'query' }),
|
|
|
- ...goods({ gQuery: 'query' }),
|
|
|
...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
|
|
|
// 查询
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
const condition = _.cloneDeep(this.searchForm);
|
|
|
- let res = await this.gQuery({ skip, limit, ...condition, ...info });
|
|
|
+ let res = await this.query({ skip, limit, ...condition, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
- this.$set(this, 'goodsList', res.data);
|
|
|
- // this.$set(this, 'total', res.total);
|
|
|
+ this.$set(this, 'list', res.data);
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
}
|
|
|
},
|
|
|
- // 点击选中
|
|
|
- handleSelect(item) {
|
|
|
- console.log(item);
|
|
|
- },
|
|
|
- querySearchAsync(queryString, cb) {
|
|
|
- console.log(queryString);
|
|
|
- console.log(cb);
|
|
|
- // var restaurants = this.restaurants;
|
|
|
- // var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
|
|
|
-
|
|
|
- // clearTimeout(this.timeout);
|
|
|
- // this.timeout = setTimeout(() => {
|
|
|
- // cb(results);
|
|
|
- // }, 3000 * Math.random());
|
|
|
- },
|
|
|
// 新增
|
|
|
- toAdd({ data }) {
|
|
|
- console.log(data);
|
|
|
+ toAdd() {
|
|
|
+ this.$router.push({ path: '/system/act/goosDetail' });
|
|
|
},
|
|
|
- // 重置
|
|
|
- toClose() {
|
|
|
- this.goods = '';
|
|
|
- this.search();
|
|
|
- },
|
|
|
- // 查询其他信息
|
|
|
- async searchOther() {
|
|
|
- let res;
|
|
|
- // 是否使用
|
|
|
- res = await this.dictQuery({ code: 'use' });
|
|
|
+ // 删除
|
|
|
+ async toDel({ data }) {
|
|
|
+ let res = await this.delete(data._id);
|
|
|
if (this.$checkRes(res)) {
|
|
|
- this.$set(this, `isuseList`, res.data);
|
|
|
+ this.$message({ type: `success`, message: `刪除信息成功` });
|
|
|
+ this.search();
|
|
|
}
|
|
|
},
|
|
|
+ // // 重置
|
|
|
+ // toClose() {
|
|
|
+ // this.searchForm = {};
|
|
|
+ // this.search();
|
|
|
+ // },
|
|
|
+ // 多选
|
|
|
+ handleSelect(data) {
|
|
|
+ this.$set(this, `selected`, data);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
- id() {
|
|
|
- return this.$route.query.id;
|
|
|
- },
|
|
|
},
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|