许成详 6 gadus atpakaļ
vecāks
revīzija
f15dd6787a

+ 16245
- 0
package-lock.json
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1
- 0
package.json Parādīt failu

@@ -17,6 +17,7 @@
17 17
   "dependencies": {
18 18
     "@antv/g2": "^3.2.7",
19 19
     "axios": "^0.18.0",
20
+    "clipboard": "^2.0.1",
20 21
     "element-ui": "^2.4.5",
21 22
     "g2-vue": "^1.0.1",
22 23
     "js-base64": "^2.4.8",

+ 432
- 0
src/pages/system/cardAndCouponManager/bodyBuildingCardManager/edit.vue Parādīt failu

@@ -0,0 +1,432 @@
1
+<template>
2
+  <div class="subPage">
3
+    <form class="mainForm">
4
+      <ul>
5
+        <li class="flex-h">
6
+          <span>选择案场:</span>
7
+          <div class="flex-item">
8
+            <div style="width:50%">
9
+              <el-select v-model="cardInfo.CaseId" placeholder="请选择" @change="caseChange">
10
+                <el-option
11
+                  v-for="item in cases"
12
+                  :key="item.CaseId"
13
+                  :label="item.CaseName"
14
+                  :value="item.CaseId">
15
+                </el-option>
16
+              </el-select>
17
+            </div>
18
+          </div>
19
+        </li>
20
+        <li class="flex-h">
21
+          <span>卡图片:</span>
22
+          <div class="flex-item">
23
+            <div>
24
+              <el-upload
25
+                class="avatar-uploader"
26
+                :action='$api.file.image.url'
27
+                :show-file-list="false"
28
+                :on-success="handleAvatarSuccess">
29
+                <img v-if="cardInfo.Images" :src="cardInfo.Images[0].CardImageUrl" class="avatar">
30
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
31
+              </el-upload>
32
+            </div>
33
+          </div>
34
+        </li>
35
+        <li class="flex-h">
36
+          <span>卡名称:</span>
37
+          <div class="flex-item">
38
+            <div style="width:200px;">
39
+              <el-input
40
+                placeholder="请输入"
41
+                v-model="cardInfo.CardName"
42
+                clearable>
43
+              </el-input>
44
+            </div>
45
+          </div>
46
+        </li>
47
+        <li class="flex-h">
48
+          <span>卡价格:</span>
49
+          <div class="flex-item">
50
+            <div style="width:200px;">
51
+              <el-input
52
+                placeholder="请输入"
53
+                v-model="cardInfo.Price"
54
+                clearable>
55
+              </el-input>
56
+            </div>
57
+          </div>
58
+        </li>
59
+        <li class="flex-h">
60
+          <span>总张数:</span>
61
+          <div class="flex-item">
62
+            <div style="width:200px;">
63
+              <el-input
64
+                placeholder="请输入"
65
+                v-model="cardInfo.TotalCount"
66
+                clearable>
67
+              </el-input>
68
+            </div>
69
+          </div>
70
+        </li>
71
+        <li class="flex-h">
72
+          <span>发送类型:</span>
73
+          <div class="flex-item">
74
+            <div>
75
+              <el-radio v-model="cardInfo.SendType" label="channel">渠道</el-radio>
76
+              <el-radio v-model="cardInfo.SendType" label="case">案场</el-radio>
77
+              <el-radio v-model="cardInfo.SendType" label="system">系统</el-radio>
78
+            </div>
79
+          </div>
80
+        </li>
81
+        <li class="flex-h" v-if="cardInfo.SendType === 'channel'">
82
+          <span>选择渠道:</span>
83
+          <div class="flex-item">
84
+            <div style="width:50%">
85
+              <el-select v-model="cardInfo.ChannelId" placeholder="请选择">
86
+                <el-option
87
+                  v-for="item in channelList"
88
+                  :key="item.ChannelId"
89
+                  :label="item.ChannelName"
90
+                  :value="item.ChannelId">
91
+                </el-option>
92
+              </el-select>
93
+            </div>
94
+          </div>
95
+        </li>
96
+        <li class="flex-h">
97
+          <span>目标课程:</span>
98
+          <div class="flex-item">
99
+            <div>
100
+              <el-select v-model="cardInfo.Targets[0].TargetId" placeholder="请选择">
101
+                <el-option
102
+                  v-for="item in courseList"
103
+                  :key="item.CourseId"
104
+                  :label="item.CourseName"
105
+                  :value="item.CourseId"
106
+                  :disabled="item.Status !== 1">
107
+                </el-option>
108
+              </el-select>
109
+            </div>
110
+          </div>
111
+        </li>
112
+        <li class="flex-h">
113
+          <span>卡有效时间:</span>
114
+          <div class="flex-item">
115
+            <div>
116
+              <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
117
+                <!-- <el-date-picker
118
+                  v-model="cardInfo.StartDate"
119
+                  type="date"
120
+                  placeholder="选择起始日期">
121
+                </el-date-picker>
122
+                <span style="line-height:40px;">至</span>
123
+                <el-date-picker
124
+                  v-model="cardInfo.EndDate"
125
+                  type="date"
126
+                  placeholder="选择截止日期">
127
+                </el-date-picker> -->
128
+                <el-date-picker
129
+                  v-model="date"
130
+                  type="daterange"
131
+                  range-separator="至"
132
+                  start-placeholder="开始日期"
133
+                  end-placeholder="结束日期"
134
+                  :picker-options="pickerOptions">
135
+                </el-date-picker>
136
+              </div>
137
+            </div>
138
+          </div>
139
+        </li>
140
+        <li class="flex-h">
141
+          <span>视频:</span>
142
+          <div class="flex-item">
143
+            <div style="vertical-align: middle;">
144
+              <a style="line-height: 40px;" v-if="videoOff" :href="cardInfo.VideoUrl" target="blank">{{cardInfo.VideoUrl}}</a>
145
+              <el-upload
146
+                class="avatar-uploader"
147
+                :action='$api.file.image.url'
148
+                :show-file-list="false"
149
+                :on-success="videoSuccess">
150
+                <a style="line-height: 40px;padding: 0 10px;">{{videoOff ? '更换' : '添加'}}视频</a>
151
+              </el-upload>
152
+              <el-button v-if="videoOff" type="danger" @click="deleteVideo">删除视频</el-button>
153
+            </div>
154
+          </div>
155
+        </li>
156
+        <li class="flex-h">
157
+          <span>分享描述:</span>
158
+          <div class="flex-item">
159
+            <div>
160
+              <el-input
161
+                type="textarea"
162
+                :rows="2"
163
+                placeholder="请输入"
164
+                v-model="cardInfo.Share.CardShareInfo">
165
+              </el-input>
166
+            </div>
167
+          </div>
168
+        </li>
169
+        <li class="flex-h">
170
+          <span>规则描述:</span>
171
+          <div class="flex-item">
172
+            <div>
173
+              <el-input
174
+                type="textarea"
175
+                :rows="2"
176
+                placeholder="请输入"
177
+                v-model="cardInfo.Share.CardUseRule">
178
+              </el-input>
179
+            </div>
180
+          </div>
181
+        </li>
182
+        <li class="flex-h">
183
+          <span>使用说明:</span>
184
+          <div class="flex-item">
185
+            <div>
186
+              <el-input
187
+                type="textarea"
188
+                :rows="2"
189
+                placeholder="请输入"
190
+                v-model="cardInfo.Share.CardUseInstruction">
191
+              </el-input>
192
+            </div>
193
+          </div>
194
+        </li>
195
+        <li style="text-align:center">
196
+          <el-button type="primary" size="mini" @click="submit">保存</el-button>
197
+          <el-button type="danger" size="mini" @click="cancel">取消</el-button>
198
+        </li>
199
+      </ul>
200
+    </form>
201
+  </div>
202
+</template>
203
+
204
+<script>
205
+import { mapState, createNamespacedHelpers } from 'vuex'
206
+const { mapActions: mapCardActions } = createNamespacedHelpers('card')
207
+const { mapState: mapChannelState, mapActions: mapChannelActions } = createNamespacedHelpers('channel')
208
+const { mapActions: mapCourseActions } = createNamespacedHelpers('course')
209
+
210
+export default {
211
+  name: '',
212
+  data () {
213
+    return {
214
+      date: '',
215
+      courseList: [],
216
+      videoOff: false,
217
+      total: 0,
218
+      type: this.$route.query.type,
219
+      isEdit: this.$route.query.id === undefined ? 0 : 1,
220
+      ChannelList: [], // 渠道列表
221
+      TypeList: [], // 类型列表
222
+      GoodsList: [], // 商品列表
223
+      currentList: [{
224
+        Name: 'ccc',
225
+        Type: 'xxx'
226
+      }], // 指定商品数据
227
+      cardInfo: {
228
+        CardName: '',
229
+        SendType: '',
230
+        VideoUrl: '',
231
+        Price: ' ',
232
+        StartDate: '',
233
+        EndDate: '',
234
+        TotalCount: '',
235
+        CaseId: '',
236
+        OrgId: '',
237
+        Share: {
238
+          CardShareInfo: '',
239
+          CardUseRule: '',
240
+          CardUseInstruction: ''
241
+        },
242
+        Images: [{
243
+          CardImageUrl: ''
244
+        }],
245
+        Targets: [{
246
+          TargetType: '',
247
+          TargetId: '',
248
+          TargetName: ''
249
+        }],
250
+        ChannelId: ''
251
+      },
252
+      postData: {
253
+        page: 1,
254
+        pagesize: 10,
255
+      },
256
+    }
257
+  },
258
+  mounted () {
259
+    this.$nextTick(function () {
260
+      this.GetChannelListList({
261
+        caseid: this.defaultCaseId,
262
+        page: 1,
263
+        pagesize: 10000
264
+      }).then(() => {
265
+        this.GetCourseList({
266
+          caseid: this.defaultCaseId,
267
+          page: 1,
268
+          pagesize: 10000
269
+        }).then((res) => {
270
+          this.courseList = res.list
271
+          if (this.$route.query.id) {
272
+            this.getCardById({
273
+              id: this.$route.query.id
274
+            }).then((res) => {
275
+              // console.log(JSON.stringify(res.Card))
276
+              this.cardInfo = res.Card
277
+              if (res.Card.VideoUrl) {
278
+                this.videoOff = true
279
+              }
280
+              if (res.Card.Images === null) {
281
+                this.cardInfo.Images = [{
282
+                  CardImageUrl: ''
283
+                }]
284
+              }
285
+              if (res.Card.StartDate) {
286
+                this.date = [res.Card.StartDate, res.Card.EndDate]
287
+              }
288
+            })
289
+          }
290
+        })
291
+      })
292
+    })
293
+  },
294
+  computed: {
295
+    ...mapChannelState({
296
+      channelList: x => x.channelList,
297
+    }),
298
+    ...mapState({
299
+      cases: x => x.app.cases.list,
300
+      defaultCaseId: x => x.app.cases.default,
301
+      OrgId: x => x.app.user.OrgId,
302
+    }),
303
+    pickerOptions () {
304
+      const courseId = this.cardInfo.Targets[0].TargetId
305
+      const couse = (this.courseList || []).filter(x => x.CourseId === courseId)[0] || {}
306
+      const beginDate = new Date(couse.BeginDate).getTime()
307
+      const endDate = new Date(couse.EndDate).getTime()
308
+      return {
309
+        disabledDate (time) {
310
+          return time.getTime() < beginDate || time.getTime() > endDate
311
+        }
312
+      }
313
+    },
314
+    CaseId: {
315
+      get () {
316
+        return this.postData.caseid || this.defaultCaseId
317
+      },
318
+      set (val) {
319
+        this.postData.caseid = val
320
+      }
321
+    }
322
+  },
323
+  methods: {
324
+    ...mapCardActions([
325
+      'addCard',
326
+      'getCardById',
327
+      'editCard',
328
+    ]),
329
+    ...mapCourseActions([
330
+      'GetCourseList',
331
+    ]),
332
+    ...mapChannelActions([
333
+      'GetChannelListList',
334
+    ]),
335
+    caseChange () { // 选择案场
336
+      this.GetChannelListList({
337
+        caseid: this.cardInfo.CaseId,
338
+        page: 1,
339
+        pagesize: 10000
340
+      })
341
+      this.GetCourseList({
342
+        caseid: this.cardInfo.CaseId,
343
+        page: 1,
344
+        pagesize: 10000
345
+      }).then((res) => {
346
+        this.courseList = res.list
347
+      })
348
+      this.cardInfo.Targets = [{
349
+        TargetType: '',
350
+        TargetId: '',
351
+        TargetName: ''
352
+      }]
353
+      this.cardInfo.ChannelId = ''
354
+    },
355
+    deleteVideo () { // 删除视频
356
+      this.cardInfo.VideoUrl = ''
357
+      this.videoOff = false
358
+    },
359
+    videoSuccess (res, file) {
360
+      this.videoOff = true
361
+      this.cardInfo.VideoUrl = res.result.url
362
+    },
363
+    addGoods () { // 添加指定商品
364
+      this.centerDialogVisible = true
365
+    },
366
+    submit () { // 保存
367
+      if (this.$route.query.id) {
368
+        if (this.date !== '') {
369
+          this.cardInfo.StartDate = this.date[0]
370
+          this.cardInfo.EndDate = this.date[1]
371
+        }
372
+        for (var x = 0; x < this.courseList.length; x++) {
373
+          if (this.courseList[x].CourseId === this.cardInfo.Targets[0].TargetId) {
374
+            this.cardInfo.Targets[0].TargetType = this.courseList[x].CourseType
375
+            this.cardInfo.Targets[0].TargetName = this.courseList[x].CourseName
376
+          }
377
+        }
378
+        this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
379
+        console.log(JSON.stringify(this.cardInfo))
380
+        this.editCard(this.cardInfo).then((res) => {
381
+          this.$alert('操作成功', '提示', {
382
+            confirmButtonText: '确定',
383
+            callback: action => {
384
+              this.$router.push({ name: 'cardList' })
385
+            }
386
+          })
387
+        })
388
+      } else {
389
+        this.cardInfo.OrgId = this.OrgId
390
+        if (this.date !== '') {
391
+          this.cardInfo.StartDate = this.date[0]
392
+          this.cardInfo.EndDate = this.date[1]
393
+        }
394
+        for (var n = 0; n < this.courseList.length; n++) {
395
+          if (this.courseList[n].CourseId === this.cardInfo.Targets[0].TargetId) {
396
+            this.cardInfo.Targets[0].TargetType = this.courseList[n].CourseType
397
+            this.cardInfo.Targets[0].TargetName = this.courseList[n].CourseName
398
+          }
399
+        }
400
+        this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
401
+        console.log(JSON.stringify(this.cardInfo))
402
+        this.addCard(this.cardInfo).then((res) => {
403
+          this.$alert('操作成功', '提示', {
404
+            confirmButtonText: '确定',
405
+            callback: action => {
406
+              this.$router.push({ name: 'cardList' })
407
+            }
408
+          })
409
+        })
410
+      }
411
+    },
412
+    cancel () { // 取消
413
+      this.$router.push({ name: 'couponList' })
414
+    },
415
+    handleAvatarSuccess (res, file) {
416
+      this.cardInfo.Images[0].CardImageUrl = res.result.url
417
+    },
418
+  }
419
+}
420
+</script>
421
+
422
+<!-- Add "scoped" attribute to limit CSS to this component only -->
423
+<style lang="scss" scoped>
424
+.addLine {
425
+  > * {
426
+    margin-right: 10px;
427
+  }
428
+}
429
+.mainForm > ul > li > div > div > button {
430
+  margin-top: 0;
431
+}
432
+</style>

+ 398
- 0
src/pages/system/cardAndCouponManager/bodyBuildingCardManager/index.vue Parādīt failu

@@ -0,0 +1,398 @@
1
+<template>
2
+  <div class="subPage">
3
+    <div class="system-table-search">
4
+      <div class="flex-h">
5
+        <div class="flex-item flex-h">
6
+          <el-button size="mini" type="success" @click="addCard">新增健身卡</el-button>
7
+        </div>
8
+        <ul>
9
+          <li>
10
+            <el-select v-model="CaseId" placeholder="请选择案场">
11
+              <el-option
12
+                v-for="item in cases"
13
+                :key="item.CaseId"
14
+                :label="item.CaseName"
15
+                :value="item.CaseId">
16
+              </el-option>
17
+            </el-select>
18
+          </li>
19
+        </ul>
20
+        <el-button
21
+          size="mini"
22
+          type="primary" @click="search">搜索</el-button>
23
+      </div>
24
+      <div class="moreFilter"></div>
25
+    </div>
26
+    <div class="system-table-box">
27
+      <el-table
28
+        :data="cardList.list"
29
+        stripe
30
+        style="width: 100%">
31
+        <el-table-column
32
+          prop="CardName"
33
+          label="卡名称">
34
+        </el-table-column>
35
+        <!-- <el-table-column
36
+          prop="xxx"
37
+          label="卡类型">
38
+        </el-table-column> -->
39
+        <el-table-column
40
+          prop="Price"
41
+          label="卡价格">
42
+        </el-table-column>
43
+        <el-table-column
44
+          prop="StartDate"
45
+          label="有效期"
46
+          width="150">
47
+          <template slot-scope="scope">
48
+            <span style="width:100%;display:block;text-align:center;white-space: nowrap;">{{toolClass.dateFormat(scope.row.StartDate)}}</span>
49
+            <span style="width:100%;display:block;text-align:center;white-space: nowrap;">至</span>
50
+            <span style="width:100%;display:block;text-align:center;white-space: nowrap;">{{toolClass.dateFormat(scope.row.EndDate)}}</span>
51
+          </template>
52
+        </el-table-column>
53
+        <el-table-column
54
+          prop="SendType"
55
+          label="发放类型">
56
+        </el-table-column>
57
+        <el-table-column
58
+          prop="TotalCount"
59
+          label="总数量">
60
+        </el-table-column>
61
+        <el-table-column
62
+          prop="SentCount"
63
+          label="已发">
64
+        </el-table-column>
65
+        <el-table-column
66
+          prop="UsedCount"
67
+          label="实际使用">
68
+        </el-table-column>
69
+        <el-table-column
70
+          prop="Status"
71
+          label="状态">
72
+          <template slot-scope="scope">
73
+            {{scope.row.Status == 1 ? '正常' : '已过期'}}
74
+          </template>
75
+        </el-table-column>
76
+        <el-table-column label="操作" fixed='right' width="350">
77
+          <template slot-scope="scope">
78
+            <el-button
79
+              size="mini"
80
+              type="warning"
81
+              @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
82
+            <el-button
83
+              size="mini"
84
+              type="danger"
85
+              @click="sendCard(scope.$index, scope.row)">赠送客户</el-button>
86
+            <a class="copyBtn" :data-clipboard-text="'www.baidu.com'" :ref="'copy' + scope.$index" @click="toCopy(scope.$index, scope.row)">点击复制链接</a>
87
+          </template>
88
+        </el-table-column>
89
+      </el-table>
90
+    </div>
91
+    <el-pagination
92
+      @current-change="handleCurrentChange"
93
+      :current-page.sync="postData.page"
94
+      :page-size="postData.pagesize"
95
+      layout="prev, pager, next, jumper"
96
+      :total="total">
97
+    </el-pagination>
98
+    <el-dialog
99
+      title="选择赠送客户"
100
+      :visible.sync="centerDialogVisible"
101
+      width="800px"
102
+      center>
103
+      <div>
104
+        <ul class="dialogSearchList flex-h" style="margin-bottom:10px;">
105
+          <li class="flex-item">
106
+            <el-input
107
+              placeholder="请输入用户名"
108
+              v-model="dialogPostData.username"
109
+              clearable>
110
+            </el-input>
111
+          </li>
112
+          <li class="flex-item">
113
+            <el-input
114
+              placeholder="请输入手机号"
115
+              v-model="dialogPostData.phone"
116
+              clearable>
117
+            </el-input>
118
+          </li>
119
+          <li class="flex-item">
120
+            <el-input
121
+              placeholder="请输入推荐人"
122
+              v-model="dialogPostData.recommendname"
123
+              clearable>
124
+            </el-input>
125
+          </li>
126
+          <li>
127
+            <el-button type="primary" @click="dialogSearch">搜索</el-button>
128
+          </li>
129
+        </ul>
130
+        <ul class="dialogSearchList flex-h">
131
+          <li class="flex-item">
132
+            <el-date-picker
133
+              v-model="dialogPostData.begindate"
134
+              type="date"
135
+              placeholder="选择起始日期">
136
+            </el-date-picker>
137
+            <el-date-picker
138
+              v-model="dialogPostData.enddate"
139
+              type="date"
140
+              placeholder="选择截止日期">
141
+            </el-date-picker>
142
+          </li>
143
+        </ul>
144
+      </div>
145
+      <div>
146
+        <el-table
147
+          ref="multipleTable"
148
+          :data="customers.list"
149
+          tooltip-effect="dark"
150
+          style="width: 100%"
151
+          @selection-change="handleSelectionChange">
152
+          <el-table-column
153
+            type="selection">
154
+          </el-table-column>
155
+          <el-table-column
156
+            prop="Name"
157
+            label="姓名">
158
+          </el-table-column>
159
+          <el-table-column
160
+            prop="CustomerName"
161
+            label="微信昵称">
162
+          </el-table-column>
163
+          <el-table-column
164
+            prop="Phone"
165
+            label="手机号">
166
+          </el-table-column>
167
+          <el-table-column
168
+            prop="CreatDate"
169
+            label="创建时间">
170
+            <template slot-scope="scope">
171
+              <span>{{toolClass.dateFormat(scope.row.CreateDate, 'yyyy-MM-dd')}}</span>
172
+            </template>
173
+          </el-table-column>
174
+          <el-table-column
175
+            prop="RecommendName"
176
+            label="推荐人">
177
+          </el-table-column>
178
+        </el-table>
179
+      </div>
180
+      <div>
181
+        <el-pagination
182
+          @current-change="handleCurrentChangeDialog"
183
+          :current-page.sync="dialogPostData.page"
184
+          :page-size="dialogPostData.pagesize"
185
+          layout="prev, pager, next, jumper"
186
+          :total="dialogTotal">
187
+        </el-pagination>
188
+      </div>
189
+      <span slot="footer" class="dialog-footer">
190
+        <el-button @click="closeDialog">取 消</el-button>
191
+        <el-button type="primary" @click="toSendCard">确 定</el-button>
192
+      </span>
193
+    </el-dialog>
194
+    <el-dialog
195
+      title="手动复制"
196
+      :visible.sync="copyDialogVisible"
197
+      width="300px"
198
+      center>
199
+      <div>
200
+        <el-input
201
+          placeholder="请输入内容"
202
+          v-model="currentCopyUrl"
203
+          clearable>
204
+        </el-input>
205
+        <!-- <a :data-clipboard-text="currentCopyUrl" ref="copy" @click="toCopy">复制链接</a> -->
206
+      </div>
207
+      <span slot="footer" class="dialog-footer">
208
+        <el-button type="primary" @click="copyDialogVisible = false">确 定</el-button>
209
+      </span>
210
+    </el-dialog>
211
+  </div>
212
+</template>
213
+
214
+<script>
215
+import Clipboard from 'clipboard'
216
+import { mapState, createNamespacedHelpers } from 'vuex'
217
+const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('card')
218
+const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('customer')
219
+
220
+export default {
221
+  name: '',
222
+  data () {
223
+    return {
224
+      currentCopyUrl: '',
225
+      copyDialogVisible: false,
226
+      selectCustomer: [],
227
+      dialogTotal: 0,
228
+      dialogPostData: {
229
+        username: '',
230
+        phone: '',
231
+        recommendname: '',
232
+        begindate: '',
233
+        enddate: '',
234
+        page: 1, // 当前页码
235
+        pagesize: 10, // 请求数据量
236
+      },
237
+      customerList: [],
238
+      centerDialogVisible: false,
239
+      total: 0,
240
+      postData: { // 表格搜索条件
241
+        caseid: '', // 案场id
242
+        page: 1, // 当前页码
243
+        pagesize: 10, // 请求数据量
244
+      },
245
+    }
246
+  },
247
+  mounted () {
248
+    this.$nextTick(function () {
249
+      this.getList()
250
+    })
251
+  },
252
+  computed: {
253
+    ...mapCardState({
254
+      cardList: x => x.cardList,
255
+    }),
256
+    ...mapState({
257
+      cases: x => x.app.cases.list,
258
+      defaultCaseId: x => x.app.cases.default
259
+    }),
260
+    ...mapCustomerState({
261
+      customers: x => x.customers,
262
+    }),
263
+    CaseId: {
264
+      get () {
265
+        return this.postData.caseid || this.defaultCaseId
266
+      },
267
+      set (val) {
268
+        this.postData.caseid = val
269
+      }
270
+    }
271
+  },
272
+  methods: {
273
+    ...mapCardActions([
274
+      'GetCardList',
275
+      'giveCard',
276
+    ]),
277
+    ...mapCustomerActions([
278
+      'GetCustomerList',
279
+      'SetCustomerListNull',
280
+    ]),
281
+    toSendHistory () { // 查看赠送记录
282
+      this.$router.push({ name: 'givingRecords' })
283
+    },
284
+    dialogSearch () { // 赠送客户搜索
285
+      this.GetCustomerList(this.dialogPostData)
286
+    },
287
+    handleCurrentChangeDialog (val) {
288
+      this.dialogPostData.page = val
289
+      this.GetCustomerList(this.dialogPostData)
290
+    },
291
+    handleSelectionChange (val) {
292
+      // console.log(val)
293
+      this.selectCustomer = val
294
+    },
295
+    toSendCard () { // 赠送卡
296
+      if (this.selectCustomer.length) {
297
+        this.selectCustomer = this.selectCustomer.map(x => x.CustomerId).join(',')
298
+        this.giveCard({
299
+          id: this.currentCardId,
300
+          users: this.selectCustomer,
301
+        }).then(res => {
302
+          this.$message({
303
+            type: 'success',
304
+            message: '赠送成功!'
305
+          })
306
+          this.centerDialogVisible = false
307
+          this.selectCustomer = []
308
+          if (this.customers.list.length) {
309
+            this.customers.list = []
310
+          }
311
+          this.getList()
312
+        })
313
+      } else {
314
+        this.$message({
315
+          type: 'error',
316
+          message: '请先选择需要赠送的客户!'
317
+        })
318
+      }
319
+    },
320
+    closeDialog () { // 关闭弹窗
321
+      this.centerDialogVisible = false
322
+      if (this.customers.list.length) {
323
+        this.customers.list = []
324
+      }
325
+    },
326
+    sendCard (index, row) { // 赠送卡弹窗
327
+      this.currentCardId = row.CardId
328
+      this.centerDialogVisible = true
329
+    },
330
+    search () { // 搜索
331
+      this.postData.page = 1
332
+      this.currentList = []
333
+      this.getList()
334
+    },
335
+    getList () { // 获取列表
336
+      this.GetCardList({
337
+        ...this.postData,
338
+        caseid: this.CaseId || this.defaultCaseId
339
+      }).then((res) => {
340
+        this.total = res.pagenum
341
+        // console.log(JSON.stringify(res))
342
+      })
343
+    },
344
+    handleCurrentChange (val) { // 跳转到分页
345
+      this.getList()
346
+    },
347
+    handleEdit (index, row) { // 编辑
348
+      this.$router.push({ name: 'editCard', query: { id: row.CardId } })
349
+    },
350
+    // handleCopy (url) { // 复制弹窗
351
+    //   this.currentCopyUrl = url
352
+    //   this.copyDialogVisible = true
353
+    // },
354
+    toCopy (index, row) { // 复制
355
+      console.log(1)
356
+      var clipboard = new Clipboard(this.$refs['copy' + index])
357
+      clipboard.on('success', e => {
358
+        console.log('复制成功')
359
+        clipboard.destroy()
360
+      })
361
+      clipboard.on('error', e => {
362
+        console.log('该浏览器不支持自动复制')
363
+        clipboard.destroy()
364
+      })
365
+    },
366
+    addCard () {
367
+      this.$router.push({ name: 'editCard', query: {} })
368
+    }
369
+  }
370
+}
371
+</script>
372
+
373
+<!-- Add "scoped" attribute to limit CSS to this component only -->
374
+<style lang="scss" scoped>
375
+@import "page.scss";
376
+.dialogSearchList {
377
+  align-items: center;
378
+  > li {
379
+    font-size: 0;
380
+    margin-left: 10px;
381
+    &:first-child {
382
+      margin-left: 0;
383
+    }
384
+    > *:nth-child(2) {
385
+      margin-left: 10px;
386
+    }
387
+  }
388
+}
389
+.copyBtn{
390
+  line-height: 29px;
391
+  border-radius: 3px;
392
+  color: #fff;
393
+  background: #67c23a;
394
+  display: inline-block;
395
+  padding: 0 15px;
396
+  margin-left: 10px;
397
+}
398
+</style>

+ 27
- 0
src/pages/system/cardAndCouponManager/bodyBuildingCardManager/page.scss Parādīt failu

@@ -0,0 +1,27 @@
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
+

+ 44
- 26
src/pages/system/cardAndCouponManager/cardManager/index.vue Parādīt failu

@@ -84,10 +84,7 @@
84 84
               size="mini"
85 85
               type="danger"
86 86
               @click="sendCard(scope.$index, scope.row)">赠送客户</el-button>
87
-            <el-button
88
-              size="mini"
89
-              type="success"
90
-              @click="handleDelete(scope.$index, scope.row)">点击复制链接</el-button>
87
+            <a class="copyBtn" :data-clipboard-text="'www.baidu.com'" :ref="'copy' + scope.$index" @click="toCopy(scope.$index, scope.row)">点击复制链接</a>
91 88
           </template>
92 89
         </el-table-column>
93 90
       </el-table>
@@ -195,10 +192,28 @@
195 192
         <el-button type="primary" @click="toSendCard">确 定</el-button>
196 193
       </span>
197 194
     </el-dialog>
195
+    <el-dialog
196
+      title="手动复制"
197
+      :visible.sync="copyDialogVisible"
198
+      width="300px"
199
+      center>
200
+      <div>
201
+        <el-input
202
+          placeholder="请输入内容"
203
+          v-model="currentCopyUrl"
204
+          clearable>
205
+        </el-input>
206
+        <!-- <a :data-clipboard-text="currentCopyUrl" ref="copy" @click="toCopy">复制链接</a> -->
207
+      </div>
208
+      <span slot="footer" class="dialog-footer">
209
+        <el-button type="primary" @click="copyDialogVisible = false">确 定</el-button>
210
+      </span>
211
+    </el-dialog>
198 212
   </div>
199 213
 </template>
200 214
 
201 215
 <script>
216
+import Clipboard from 'clipboard'
202 217
 import { mapState, createNamespacedHelpers } from 'vuex'
203 218
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('card')
204 219
 const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('customer')
@@ -207,6 +222,8 @@ export default {
207 222
   name: '',
208 223
   data () {
209 224
     return {
225
+      currentCopyUrl: '',
226
+      copyDialogVisible: false,
210 227
       selectCustomer: [],
211 228
       dialogTotal: 0,
212 229
       dialogPostData: {
@@ -331,28 +348,20 @@ export default {
331 348
     handleEdit (index, row) { // 编辑
332 349
       this.$router.push({ name: 'editCard', query: { id: row.CardId } })
333 350
     },
334
-    handleDelete (index, row) { // 删除
335
-      let name = '确认删除渠道“' + row.ChannelName + '”?'
336
-      this.$confirm(name, '提示', {
337
-        confirmButtonText: '确定',
338
-        cancelButtonText: '取消',
339
-        type: 'warning'
340
-      }).then(() => {
341
-        this.$ajax(this.$api.channelManager.deleteChannel.url, {
342
-          method: this.$api.channelManager.deleteChannel.method,
343
-          urlData: { channelId: row.ChannelId }
344
-        }).then(res => {
345
-          this.$message({
346
-            type: 'success',
347
-            message: '删除成功!'
348
-          })
349
-          this.search()
350
-        })
351
-      }).catch(() => {
352
-        this.$message({
353
-          type: 'info',
354
-          message: '已取消删除'
355
-        })
351
+    // handleCopy (url) { // 复制弹窗
352
+    //   this.currentCopyUrl = url
353
+    //   this.copyDialogVisible = true
354
+    // },
355
+    toCopy (index, row) { // 复制
356
+      console.log(1)
357
+      var clipboard = new Clipboard(this.$refs['copy' + index])
358
+      clipboard.on('success', e => {
359
+        console.log('复制成功')
360
+        clipboard.destroy()
361
+      })
362
+      clipboard.on('error', e => {
363
+        console.log('该浏览器不支持自动复制')
364
+        clipboard.destroy()
356 365
       })
357 366
     },
358 367
     addCard () {
@@ -378,4 +387,13 @@ export default {
378 387
     }
379 388
   }
380 389
 }
390
+.copyBtn{
391
+  line-height: 29px;
392
+  border-radius: 3px;
393
+  color: #fff;
394
+  background: #67c23a;
395
+  display: inline-block;
396
+  padding: 0 15px;
397
+  margin-left: 10px;
398
+}
381 399
 </style>

+ 12
- 0
src/pages/system/page.js Parādīt failu

@@ -92,6 +92,8 @@ import cardList from './cardAndCouponManager/cardManager/index' // 卡列表
92 92
 import editCard from './cardAndCouponManager/cardManager/edit' // 编辑卡
93 93
 import couponList from './cardAndCouponManager/couponManager/index' // 券列表
94 94
 import editCoupon from './cardAndCouponManager/couponManager/edit' // 编辑券
95
+import bodyBuildingCardManager from './cardAndCouponManager/bodyBuildingCardManager/index' // 健身卡列表
96
+import editBodyBuildingCard from './cardAndCouponManager/bodyBuildingCardManager/edit' // 健身卡编辑
95 97
 import givingRecords from './cardAndCouponManager/givingRecords' // 赠送记录
96 98
 import vipList from './cardAndCouponManager/vipManager/index' // vip列表
97 99
 import editVip from './cardAndCouponManager/vipManager/edit' // 编辑vip
@@ -514,6 +516,16 @@ export default {
514 516
             component: editCoupon,
515 517
             children: []
516 518
           }]
519
+        }, { // 健身卡列表
520
+          path: 'bodyBuildingCardManager',
521
+          name: 'bodyBuildingCardManager',
522
+          component: bodyBuildingCardManager,
523
+          children: [{ // 编辑健身卡
524
+            path: 'editBodyBuildingCard',
525
+            name: 'editBodyBuildingCard',
526
+            component: editBodyBuildingCard,
527
+            children: []
528
+          }]
517 529
         }, { // 赠送记录
518 530
           path: 'givingRecords',
519 531
           name: 'givingRecords',

+ 3
- 2
src/store/app.js Parādīt failu

@@ -56,7 +56,8 @@ export default {
56 56
       default: '',
57 57
     },
58 58
     roles: [],
59
-    user: {}
59
+    user: {},
60
+    clientUrl: '',
60 61
   },
61 62
   mutations: {
62 63
     init (state, data) { // 这里的state对应着上面这个state
@@ -64,7 +65,7 @@ export default {
64 65
       state.roles = data.roles
65 66
       state.user = data.user
66 67
       state.menus = packChildren(data.menus)
67
-
68
+      state.clientUrl = data.clienturl
68 69
       let defaultCase = ''
69 70
       for (let i = 0; i < data.cases.length; i++) {
70 71
         if (data.cases[i].IsBelong === 1) {