|
@@ -6,7 +6,7 @@
|
6
|
6
|
<span>选择案场:</span>
|
7
|
7
|
<div class="flex-item">
|
8
|
8
|
<div style="width:50%">
|
9
|
|
- <el-select v-model="cardInfo.CaseId" placeholder="请选择" @change="caseChange">
|
|
9
|
+ <el-select v-model="cardInfo.CaseId" placeholder="请选择" @change="caseChange" :disabled="disabled">
|
10
|
10
|
<el-option
|
11
|
11
|
v-for="item in cases"
|
12
|
12
|
:key="item.CaseId"
|
|
@@ -21,13 +21,15 @@
|
21
|
21
|
<span>卡图片:</span>
|
22
|
22
|
<div class="flex-item">
|
23
|
23
|
<div>
|
|
24
|
+ <a v-if="cardInfo.CardImageUrl && cardInfo.CardImageUrl.indexOf('.mp4') > -1" :href="cardInfo.CardImageUrl" target="blank" style="line-height:40px;">{{cardInfo.CardImageUrl}}</a>
|
24
|
25
|
<el-upload
|
25
|
26
|
class="avatar-uploader"
|
26
|
27
|
:action='$api.file.image.url'
|
27
|
28
|
:show-file-list="false"
|
28
|
29
|
: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>
|
|
30
|
+ <img v-if="cardInfo.CardImageUrl && cardInfo.CardImageUrl.indexOf('.mp4') === -1" :src="cardInfo.CardImageUrl" class="avatar">
|
|
31
|
+ <el-button type="primary" size="mini" v-if="!cardInfo.CardImageUrl || cardInfo.CardImageUrl.indexOf('.mp4') > -1">{{cardInfo.CardImageUrl.indexOf('.mp4') > -1 ? '更换' : '上传'}}文件</el-button>
|
|
32
|
+ <!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
|
31
|
33
|
</el-upload>
|
32
|
34
|
</div>
|
33
|
35
|
</div>
|
|
@@ -38,12 +40,28 @@
|
38
|
40
|
<div style="width:200px;">
|
39
|
41
|
<el-input
|
40
|
42
|
placeholder="请输入"
|
41
|
|
- v-model="cardInfo.CardName"
|
42
|
|
- clearable>
|
|
43
|
+ v-model="cardInfo.GymCardName"
|
|
44
|
+ clearable
|
|
45
|
+ :disabled="disabled">
|
43
|
46
|
</el-input>
|
44
|
47
|
</div>
|
45
|
48
|
</div>
|
46
|
49
|
</li>
|
|
50
|
+ <li class="flex-h">
|
|
51
|
+ <span>卡类型:</span>
|
|
52
|
+ <div class="flex-item">
|
|
53
|
+ <div>
|
|
54
|
+ <el-select v-model="cardInfo.GymTypeId" placeholder="请选择" :disabled="disabled">
|
|
55
|
+ <el-option
|
|
56
|
+ v-for="item in GymTypeList"
|
|
57
|
+ :key="item.id"
|
|
58
|
+ :label="item.name"
|
|
59
|
+ :value="item.id">
|
|
60
|
+ </el-option>
|
|
61
|
+ </el-select>
|
|
62
|
+ </div>
|
|
63
|
+ </div>
|
|
64
|
+ </li>
|
47
|
65
|
<li class="flex-h">
|
48
|
66
|
<span>卡价格:</span>
|
49
|
67
|
<div class="flex-item">
|
|
@@ -51,7 +69,8 @@
|
51
|
69
|
<el-input
|
52
|
70
|
placeholder="请输入"
|
53
|
71
|
v-model="cardInfo.Price"
|
54
|
|
- clearable>
|
|
72
|
+ clearable
|
|
73
|
+ :disabled="disabled">
|
55
|
74
|
</el-input>
|
56
|
75
|
</div>
|
57
|
76
|
</div>
|
|
@@ -63,7 +82,8 @@
|
63
|
82
|
<el-input
|
64
|
83
|
placeholder="请输入"
|
65
|
84
|
v-model="cardInfo.TotalCount"
|
66
|
|
- clearable>
|
|
85
|
+ clearable
|
|
86
|
+ :disabled="disabled">
|
67
|
87
|
</el-input>
|
68
|
88
|
</div>
|
69
|
89
|
</div>
|
|
@@ -72,9 +92,9 @@
|
72
|
92
|
<span>发送类型:</span>
|
73
|
93
|
<div class="flex-item">
|
74
|
94
|
<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>
|
|
95
|
+ <el-radio v-model="cardInfo.SendType" label="channel" :disabled="disabled">渠道</el-radio>
|
|
96
|
+ <el-radio v-model="cardInfo.SendType" label="case" :disabled="disabled">案场</el-radio>
|
|
97
|
+ <el-radio v-model="cardInfo.SendType" label="system" :disabled="disabled">系统</el-radio>
|
78
|
98
|
</div>
|
79
|
99
|
</div>
|
80
|
100
|
</li>
|
|
@@ -82,7 +102,7 @@
|
82
|
102
|
<span>选择渠道:</span>
|
83
|
103
|
<div class="flex-item">
|
84
|
104
|
<div style="width:50%">
|
85
|
|
- <el-select v-model="cardInfo.ChannelId" placeholder="请选择">
|
|
105
|
+ <el-select v-model="cardInfo.ChannelId" placeholder="请选择" :disabled="disabled">
|
86
|
106
|
<el-option
|
87
|
107
|
v-for="item in channelList"
|
88
|
108
|
:key="item.ChannelId"
|
|
@@ -93,66 +113,28 @@
|
93
|
113
|
</div>
|
94
|
114
|
</div>
|
95
|
115
|
</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
|
116
|
<li class="flex-h">
|
113
|
117
|
<span>卡有效时间:</span>
|
114
|
118
|
<div class="flex-item">
|
115
|
119
|
<div>
|
116
|
120
|
<div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
|
117
|
|
- <!-- <el-date-picker
|
|
121
|
+ <el-date-picker
|
118
|
122
|
v-model="cardInfo.StartDate"
|
119
|
123
|
type="date"
|
120
|
|
- placeholder="选择起始日期">
|
|
124
|
+ placeholder="选择起始日期"
|
|
125
|
+ :disabled="disabled">
|
121
|
126
|
</el-date-picker>
|
122
|
127
|
<span style="line-height:40px;">至</span>
|
123
|
128
|
<el-date-picker
|
124
|
129
|
v-model="cardInfo.EndDate"
|
125
|
130
|
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">
|
|
131
|
+ placeholder="选择截止日期"
|
|
132
|
+ :disabled="disabled">
|
135
|
133
|
</el-date-picker>
|
136
|
134
|
</div>
|
137
|
135
|
</div>
|
138
|
136
|
</div>
|
139
|
137
|
</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
|
138
|
<li class="flex-h">
|
157
|
139
|
<span>分享描述:</span>
|
158
|
140
|
<div class="flex-item">
|
|
@@ -161,7 +143,7 @@
|
161
|
143
|
type="textarea"
|
162
|
144
|
:rows="2"
|
163
|
145
|
placeholder="请输入"
|
164
|
|
- v-model="cardInfo.Share.CardShareInfo">
|
|
146
|
+ v-model="cardInfo.CardShareInfo">
|
165
|
147
|
</el-input>
|
166
|
148
|
</div>
|
167
|
149
|
</div>
|
|
@@ -174,7 +156,7 @@
|
174
|
156
|
type="textarea"
|
175
|
157
|
:rows="2"
|
176
|
158
|
placeholder="请输入"
|
177
|
|
- v-model="cardInfo.Share.CardUseRule">
|
|
159
|
+ v-model="cardInfo.CardUseRule">
|
178
|
160
|
</el-input>
|
179
|
161
|
</div>
|
180
|
162
|
</div>
|
|
@@ -187,7 +169,7 @@
|
187
|
169
|
type="textarea"
|
188
|
170
|
:rows="2"
|
189
|
171
|
placeholder="请输入"
|
190
|
|
- v-model="cardInfo.Share.CardUseInstruction">
|
|
172
|
+ v-model="cardInfo.CardUseInstruction">
|
191
|
173
|
</el-input>
|
192
|
174
|
</div>
|
193
|
175
|
</div>
|
|
@@ -203,51 +185,52 @@
|
203
|
185
|
|
204
|
186
|
<script>
|
205
|
187
|
import { mapState, createNamespacedHelpers } from 'vuex'
|
206
|
|
-const { mapActions: mapCardActions } = createNamespacedHelpers('card')
|
|
188
|
+const { mapActions: mapGymCardActions } = createNamespacedHelpers('gymcard')
|
207
|
189
|
const { mapState: mapChannelState, mapActions: mapChannelActions } = createNamespacedHelpers('channel')
|
208
|
|
-const { mapActions: mapCourseActions } = createNamespacedHelpers('course')
|
209
|
190
|
|
210
|
191
|
export default {
|
211
|
192
|
name: '',
|
212
|
193
|
data () {
|
213
|
194
|
return {
|
|
195
|
+ disabled: false,
|
214
|
196
|
date: '',
|
215
|
197
|
courseList: [],
|
216
|
198
|
videoOff: false,
|
217
|
199
|
total: 0,
|
218
|
200
|
type: this.$route.query.type,
|
219
|
201
|
isEdit: this.$route.query.id === undefined ? 0 : 1,
|
|
202
|
+ GymTypeList: [{ // 卡类型
|
|
203
|
+ id: 'once',
|
|
204
|
+ name: '次卡'
|
|
205
|
+ }, {
|
|
206
|
+ id: 'month',
|
|
207
|
+ name: '月卡'
|
|
208
|
+ }, {
|
|
209
|
+ id: 'quarter',
|
|
210
|
+ name: '季卡'
|
|
211
|
+ }, {
|
|
212
|
+ id: 'year',
|
|
213
|
+ name: '年卡'
|
|
214
|
+ }],
|
220
|
215
|
ChannelList: [], // 渠道列表
|
221
|
216
|
TypeList: [], // 类型列表
|
222
|
217
|
GoodsList: [], // 商品列表
|
223
|
|
- currentList: [{
|
224
|
|
- Name: 'ccc',
|
225
|
|
- Type: 'xxx'
|
226
|
|
- }], // 指定商品数据
|
227
|
218
|
cardInfo: {
|
228
|
|
- CardName: '',
|
|
219
|
+ GymCardId: '',
|
|
220
|
+ CardImageUrl: '',
|
|
221
|
+ GymCardName: '',
|
|
222
|
+ GymTypeId: '',
|
|
223
|
+ Price: '',
|
|
224
|
+ TotalCount: '',
|
229
|
225
|
SendType: '',
|
230
|
|
- VideoUrl: '',
|
231
|
|
- Price: ' ',
|
|
226
|
+ ChannelId: '',
|
232
|
227
|
StartDate: '',
|
233
|
228
|
EndDate: '',
|
234
|
|
- TotalCount: '',
|
|
229
|
+ CardShareInfo: '',
|
|
230
|
+ CardUseRule: '',
|
|
231
|
+ CardUseInstruction: '',
|
235
|
232
|
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: ''
|
|
233
|
+ OrgId: ''
|
251
|
234
|
},
|
252
|
235
|
postData: {
|
253
|
236
|
page: 1,
|
|
@@ -262,32 +245,15 @@ export default {
|
262
|
245
|
page: 1,
|
263
|
246
|
pagesize: 10000
|
264
|
247
|
}).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
|
|
- })
|
|
248
|
+ if (this.$route.query.id) {
|
|
249
|
+ this.disabled = true
|
|
250
|
+ this.getGymCardById({
|
|
251
|
+ id: this.$route.query.id
|
|
252
|
+ }).then((res) => {
|
|
253
|
+ // console.log(JSON.stringify(res.Card))
|
|
254
|
+ this.cardInfo = res
|
|
255
|
+ })
|
|
256
|
+ }
|
291
|
257
|
})
|
292
|
258
|
})
|
293
|
259
|
},
|
|
@@ -300,17 +266,6 @@ export default {
|
300
|
266
|
defaultCaseId: x => x.app.cases.default,
|
301
|
267
|
OrgId: x => x.app.user.OrgId,
|
302
|
268
|
}),
|
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
|
269
|
CaseId: {
|
315
|
270
|
get () {
|
316
|
271
|
return this.postData.caseid || this.defaultCaseId
|
|
@@ -321,13 +276,10 @@ export default {
|
321
|
276
|
}
|
322
|
277
|
},
|
323
|
278
|
methods: {
|
324
|
|
- ...mapCardActions([
|
325
|
|
- 'addCard',
|
326
|
|
- 'getCardById',
|
327
|
|
- 'editCard',
|
328
|
|
- ]),
|
329
|
|
- ...mapCourseActions([
|
330
|
|
- 'GetCourseList',
|
|
279
|
+ ...mapGymCardActions([
|
|
280
|
+ 'addGymCard',
|
|
281
|
+ 'getGymCardById',
|
|
282
|
+ 'editGymCard',
|
331
|
283
|
]),
|
332
|
284
|
...mapChannelActions([
|
333
|
285
|
'GetChannelListList',
|
|
@@ -338,82 +290,39 @@ export default {
|
338
|
290
|
page: 1,
|
339
|
291
|
pagesize: 10000
|
340
|
292
|
})
|
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
|
293
|
this.cardInfo.ChannelId = ''
|
354
|
294
|
},
|
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
|
295
|
submit () { // 保存
|
367
|
296
|
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
|
297
|
this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
|
379
|
298
|
console.log(JSON.stringify(this.cardInfo))
|
380
|
|
- this.editCard(this.cardInfo).then((res) => {
|
|
299
|
+ this.editGymCard(this.cardInfo).then((res) => {
|
381
|
300
|
this.$alert('操作成功', '提示', {
|
382
|
301
|
confirmButtonText: '确定',
|
383
|
302
|
callback: action => {
|
384
|
|
- this.$router.push({ name: 'cardList' })
|
|
303
|
+ this.$router.push({ name: 'bodyBuildingCardManager' })
|
385
|
304
|
}
|
386
|
305
|
})
|
387
|
306
|
})
|
388
|
307
|
} else {
|
389
|
308
|
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
|
309
|
this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
|
401
|
310
|
console.log(JSON.stringify(this.cardInfo))
|
402
|
|
- this.addCard(this.cardInfo).then((res) => {
|
|
311
|
+ this.addGymCard(this.cardInfo).then((res) => {
|
403
|
312
|
this.$alert('操作成功', '提示', {
|
404
|
313
|
confirmButtonText: '确定',
|
405
|
314
|
callback: action => {
|
406
|
|
- this.$router.push({ name: 'cardList' })
|
|
315
|
+ this.$router.push({ name: 'bodyBuildingCardManager' })
|
407
|
316
|
}
|
408
|
317
|
})
|
409
|
318
|
})
|
410
|
319
|
}
|
411
|
320
|
},
|
412
|
321
|
cancel () { // 取消
|
413
|
|
- this.$router.push({ name: 'couponList' })
|
|
322
|
+ this.$router.push({ name: 'bodyBuildingCardManager' })
|
414
|
323
|
},
|
415
|
324
|
handleAvatarSuccess (res, file) {
|
416
|
|
- this.cardInfo.Images[0].CardImageUrl = res.result.url
|
|
325
|
+ this.cardInfo.CardImageUrl = res.result.url
|
417
|
326
|
},
|
418
|
327
|
}
|
419
|
328
|
}
|