quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<template>
  <div class="user">
    <!--搜索表单-->
    <div class="common-seach-wrap">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="活动名称">
          <el-input v-model="formInline.search" placeholder="请输入活动名称"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="common-level-rail">
      <el-button type="primary" @click="addClick" v-auth="'/plus/invitation/add'">添加活动</el-button>
    </div>
    <div class="common-form">活动列表</div>
    <div class="product-content point-list">
      <el-form ref="form" :model="form" label-width="100px">
        <div class="table-wrap">
          <el-table :data="tableData" border style="width: 100%" v-loading="loading">
            <el-table-column prop="name" label="活动名称" width="200"></el-table-column>
            <el-table-column prop="start_time" label="开始时间"></el-table-column>
            <el-table-column prop="end_time" label="结束时间"></el-table-column>
            <el-table-column prop="partake_num" label="参与人数" width="150"></el-table-column>
            <el-table-column prop="text" label="状态">
 
            </el-table-column>
            <el-table-column fixed="right" label="操作">
              <template slot-scope="scope">
                <el-button v-auth="'/plus/invitation/edit'" @click="editClick(scope.row.invitation_gift_id)" type="text"
                  size="small">
                  编辑
                </el-button>
 
                <el-button v-if="scope.row.status==0" v-auth="'/plus/invitation/send'" @click="sendClick(scope.row.invitation_gift_id)"
                  type="text" size="small"> 发布
                </el-button>
 
 
                <el-button v-else="" v-auth="'/plus/invitation/end'" @click="endClick(scope.row.invitation_gift_id)"
                  type="text" size="small"> 终止
                </el-button>
 
                <el-button v-auth="'/plus/invitation/partake'" @click="partakeClick(scope.row.invitation_gift_id)"
                  type="text" size="small"> 参与记录
                </el-button>
 
                <!--   <el-button
                                           @click="editClick(scope.row.invitation_gift_id)" type="text"
                                           size="small"> 推广
                                </el-button> -->
 
 
                <el-popover placement="bottom" title="推广码" width="200px" @show="popoverFunc(scope.row.invitation_gift_id)"
                  trigger="click">
                  <div><img width="200px" :src="path"></div>
                  <el-button slot="reference" v-auth="'/plus/invitation/pushs'" type="text" size="small">推广</el-button>
                </el-popover>
 
 
 
 
                <el-button v-auth="'/plus/invitation/del'" @click="deleteClick(scope.row.invitation_gift_id)" type="text"
                  size="small"> 删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-form>
      <!--分页-->
      <div class="pagination">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" background :current-page="curPage"
          :page-size="pageSize" layout="total, prev, pager, next, jumper" :total="totalDataNumber">
        </el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
  import InvitationGiftApi from '@/api/invitationgift.js';
  export default {
    data() {
      return {
        formInline: {
          search: '',
        },
        form: {},
        tableData: [],
        /*一页多少条*/
        pageSize: 20,
        /*一共多少条数据*/
        totalDataNumber: 0,
        /*当前是第几页*/
        curPage: 1,
        /*是否加载完成*/
        loading: true,
        path: '',
      };
    },
    created() {
      /*获取列表*/
      this.getTableList();
    },
    methods: {
      /*获取列表*/
      getTableList() {
        let self = this;
        let Params = {};
        Params.search = self.formInline.search;
        Params.page = self.curPage;
        InvitationGiftApi.InvitationList(Params, true)
          .then(data => {
            self.loading = false;
            self.tableData = data.data.list.data;
            self.totalDataNumber = data.data.list.total
          })
          .catch(error => {
            self.loading = false;
          });
      },
      /*选择第几页*/
      handleCurrentChange(val) {
        let self = this;
        self.curPage = val;
        self.loading = true;
        self.getTableList();
      },
 
      /*每页多少条*/
      handleSizeChange(val) {
        let self = this;
        self.curPage = 1;
        self.pageSize = val;
        self.getTableList();
      },
 
      /*添加*/
      addClick() {
        this.$router.push('/plus/invitation/add');
      },
      /*购买记录*/
      orderClick(e) {
        let self = this;
        this.$router.push({
          path: '/plus/invitation/orderlist',
          query: {
            gift_package_id: e
          }
        })
      },
      /*编辑*/
      editClick(e) {
        let self = this;
        this.$router.push({
          path: '/plus/invitation/edit',
          query: {
            invitation_gift_id: e
          }
        })
      },
 
      /* 查询*/
      onSubmit() {
        let self = this;
        let params = self.form;
        self.loading = true;
        self.getTableList();
      },
 
      /*删除*/
      deleteClick(e) {
        let self = this;
        self.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          self.loading = true;
          InvitationGiftApi.del({
            id: e
          }, true).then(data => {
            self.loading = false;
            self.$message({
              message: data.msg,
              type: 'success'
            });
            self.getTableList();
 
          }).catch(error => {
            self.loading = false;
          });
 
        }).catch(() => {
          self.loading = false;
        });
      },
 
      /*发布*/
      sendClick(e) {
        let self = this;
        self.loading = true;
        InvitationGiftApi.send({
          id: e
        }, true).then(data => {
          self.loading = false;
          self.$message({
            message: data.msg,
            type: 'success'
          });
          self.getTableList();
 
        }).catch(error => {
          self.loading = false;
        });
      },
      /*终止*/
      endClick(e) {
        let self = this;
        self.loading = true;
        InvitationGiftApi.end({
          id: e
        }, true).then(data => {
          self.loading = false;
          self.$message({
            message: data.msg,
            type: 'success'
          });
          self.getTableList();
 
        }).catch(error => {
          self.loading = false;
        });
      },
      /*推广*/
      popoverFunc(e) {
        let self = this;
        self.loading = true;
        InvitationGiftApi.qrcode({
          id: e
        }, true).then(data => {
          self.loading = false;
          self.path = data.data.qrcode;
 
        }).catch(error => {
          self.loading = false;
        });
      },
      /*参与记录*/
      partakeClick(e) {
        let self = this;
        this.$router.push({
          path: '/plus/invitation/partake',
          query: {
            invitation_gift_id: e
          }
        })
      }
    }
  };
</script>
 
<style>
  .point-list .el-input-number--mini {
    width: auto;
  }
</style>