|
@@ -1,13 +1,12 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="subPage">
|
3
|
3
|
<form class="mainForm">
|
4
|
|
- <h1 style="font-size:22px;">{{isEdit === 0 ? '新建' : '编辑'}}{{type === 'course' ? '课程体验卡' : '健身卡'}}</h1>
|
5
|
4
|
<ul>
|
6
|
5
|
<li class="flex-h">
|
7
|
6
|
<span>选择案场:</span>
|
8
|
7
|
<div class="flex-item">
|
9
|
8
|
<div style="width:50%">
|
10
|
|
- <el-select v-model="cardInfo.CaseId" placeholder="请选择">
|
|
9
|
+ <el-select v-model="cardInfo.CaseId" placeholder="请选择" @change="caseChange">
|
11
|
10
|
<el-option
|
12
|
11
|
v-for="item in cases"
|
13
|
12
|
:key="item.CaseId"
|
|
@@ -79,16 +78,32 @@
|
79
|
78
|
</div>
|
80
|
79
|
</div>
|
81
|
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>
|
82
|
96
|
<li class="flex-h">
|
83
|
|
- <span>目标商品:</span>
|
|
97
|
+ <span>目标课程:</span>
|
84
|
98
|
<div class="flex-item">
|
85
|
99
|
<div>
|
86
|
100
|
<el-select v-model="cardInfo.Targets[0].TargetId" placeholder="请选择">
|
87
|
101
|
<el-option
|
88
|
|
- v-for="item in GoodsList"
|
89
|
|
- :key="item.id"
|
90
|
|
- :label="item.name"
|
91
|
|
- :value="item.id">
|
|
102
|
+ v-for="item in courseList"
|
|
103
|
+ :key="item.CourseId"
|
|
104
|
+ :label="item.CourseName"
|
|
105
|
+ :value="item.CourseId"
|
|
106
|
+ :disabled="item.Status !== 1">
|
92
|
107
|
</el-option>
|
93
|
108
|
</el-select>
|
94
|
109
|
</div>
|
|
@@ -99,7 +114,7 @@
|
99
|
114
|
<div class="flex-item">
|
100
|
115
|
<div>
|
101
|
116
|
<div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
|
102
|
|
- <el-date-picker
|
|
117
|
+ <!-- <el-date-picker
|
103
|
118
|
v-model="cardInfo.StartDate"
|
104
|
119
|
type="date"
|
105
|
120
|
placeholder="选择起始日期">
|
|
@@ -109,6 +124,14 @@
|
109
|
124
|
v-model="cardInfo.EndDate"
|
110
|
125
|
type="date"
|
111
|
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">
|
112
|
135
|
</el-date-picker>
|
113
|
136
|
</div>
|
114
|
137
|
</div>
|
|
@@ -117,7 +140,17 @@
|
117
|
140
|
<li class="flex-h">
|
118
|
141
|
<span>视频:</span>
|
119
|
142
|
<div class="flex-item">
|
120
|
|
- <div></div>
|
|
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>
|
121
|
154
|
</div>
|
122
|
155
|
</li>
|
123
|
156
|
<li class="flex-h">
|
|
@@ -169,12 +202,18 @@
|
169
|
202
|
</template>
|
170
|
203
|
|
171
|
204
|
<script>
|
172
|
|
-import { mapState } from 'vuex'
|
|
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')
|
173
|
209
|
|
174
|
210
|
export default {
|
175
|
211
|
name: '',
|
176
|
212
|
data () {
|
177
|
213
|
return {
|
|
214
|
+ date: '',
|
|
215
|
+ courseList: [],
|
|
216
|
+ videoOff: false,
|
178
|
217
|
total: 0,
|
179
|
218
|
type: this.$route.query.type,
|
180
|
219
|
isEdit: this.$route.query.id === undefined ? 0 : 1,
|
|
@@ -199,9 +238,6 @@ export default {
|
199
|
238
|
Status: '',
|
200
|
239
|
CaseId: '',
|
201
|
240
|
OrgId: '',
|
202
|
|
- CreateDate: '',
|
203
|
|
- CreateUser: '',
|
204
|
|
- IsOver: '',
|
205
|
241
|
Share: {
|
206
|
242
|
CardShareInfo: '',
|
207
|
243
|
CardUseRule: '',
|
|
@@ -223,13 +259,42 @@ export default {
|
223
|
259
|
}
|
224
|
260
|
},
|
225
|
261
|
mounted () {
|
226
|
|
- this.$nextTick(function () { })
|
|
262
|
+ this.$nextTick(function () {
|
|
263
|
+ this.GetChannelListList({
|
|
264
|
+ caseid: this.defaultCaseId,
|
|
265
|
+ page: 1,
|
|
266
|
+ pagesize: 10000
|
|
267
|
+ })
|
|
268
|
+ this.GetCourseList({
|
|
269
|
+ caseid: this.defaultCaseId,
|
|
270
|
+ page: 1,
|
|
271
|
+ pagesize: 10000
|
|
272
|
+ }).then((res) => {
|
|
273
|
+ // console.log(JSON.stringify(res))
|
|
274
|
+ this.courseList = res.list
|
|
275
|
+ })
|
|
276
|
+ })
|
227
|
277
|
},
|
228
|
278
|
computed: {
|
|
279
|
+ ...mapChannelState({
|
|
280
|
+ channelList: x => x.channelList,
|
|
281
|
+ }),
|
229
|
282
|
...mapState({
|
230
|
283
|
cases: x => x.app.cases.list,
|
231
|
|
- defaultCaseId: x => x.app.cases.default
|
|
284
|
+ defaultCaseId: x => x.app.cases.default,
|
|
285
|
+ OrgId: x => x.app.user.OrgId,
|
232
|
286
|
}),
|
|
287
|
+ pickerOptions () {
|
|
288
|
+ const courseId = this.cardInfo.Targets[0].TargetId
|
|
289
|
+ const couse = (this.courseList || []).filter(x => x.CourseId === courseId)[0] || {}
|
|
290
|
+ const beginDate = new Date(couse.BeginDate).getTime()
|
|
291
|
+ const endDate = new Date(couse.EndDate).getTime()
|
|
292
|
+ return {
|
|
293
|
+ disabledDate (time) {
|
|
294
|
+ return time.getTime() < beginDate || time.getTime() > endDate
|
|
295
|
+ }
|
|
296
|
+ }
|
|
297
|
+ },
|
233
|
298
|
CaseId: {
|
234
|
299
|
get () {
|
235
|
300
|
return this.postData.caseid || this.defaultCaseId
|
|
@@ -240,20 +305,65 @@ export default {
|
240
|
305
|
}
|
241
|
306
|
},
|
242
|
307
|
methods: {
|
|
308
|
+ ...mapCardActions([
|
|
309
|
+ 'addCard',
|
|
310
|
+ 'getCardById',
|
|
311
|
+ 'editCard',
|
|
312
|
+ ]),
|
|
313
|
+ ...mapCourseActions([
|
|
314
|
+ 'GetCourseList',
|
|
315
|
+ ]),
|
|
316
|
+ ...mapChannelActions([
|
|
317
|
+ 'GetChannelListList',
|
|
318
|
+ ]),
|
|
319
|
+ caseChange () { // 选择案场
|
|
320
|
+ this.GetChannelListList({
|
|
321
|
+ caseid: this.cardInfo.CaseId,
|
|
322
|
+ page: 1,
|
|
323
|
+ pagesize: 10000
|
|
324
|
+ })
|
|
325
|
+ this.GetCourseList({
|
|
326
|
+ caseid: this.cardInfo.CaseId,
|
|
327
|
+ page: 1,
|
|
328
|
+ pagesize: 10000
|
|
329
|
+ }).then((res) => {
|
|
330
|
+ this.courseList = res.list
|
|
331
|
+ })
|
|
332
|
+ this.cardInfo.Targets = [{
|
|
333
|
+ TargetType: '',
|
|
334
|
+ TargetId: '',
|
|
335
|
+ TargetName: ''
|
|
336
|
+ }]
|
|
337
|
+ this.cardInfo.ChannelId = ''
|
|
338
|
+ },
|
|
339
|
+ deleteVideo () { // 删除视频
|
|
340
|
+ this.cardInfo.VideoUrl = ''
|
|
341
|
+ this.videoOff = false
|
|
342
|
+ },
|
|
343
|
+ videoSuccess (res, file) {
|
|
344
|
+ this.videoOff = true
|
|
345
|
+ this.cardInfo.VideoUrl = res.result.url
|
|
346
|
+ },
|
243
|
347
|
addGoods () { // 添加指定商品
|
244
|
348
|
this.centerDialogVisible = true
|
245
|
349
|
},
|
246
|
350
|
submit () { // 保存
|
247
|
|
- // 1
|
|
351
|
+ if (this.$route.query.id) {
|
|
352
|
+ // 1
|
|
353
|
+ } else {
|
|
354
|
+ this.cardInfo.OrgId = this.OrgId
|
|
355
|
+ console.log(JSON.stringify(this.cardInfo))
|
|
356
|
+ this.addCard({
|
|
357
|
+ info: this.cardInfo
|
|
358
|
+ }).then((res) => {
|
|
359
|
+ })
|
|
360
|
+ }
|
248
|
361
|
},
|
249
|
362
|
cancel () { // 取消
|
250
|
363
|
this.$router.push({ name: 'couponList' })
|
251
|
364
|
},
|
252
|
|
- deleteGoodsItem () { // 删除指定商品item
|
253
|
|
- // 1
|
254
|
|
- },
|
255
|
365
|
handleAvatarSuccess (res, file) {
|
256
|
|
- this.postData.Img = res.result.url
|
|
366
|
+ this.cardInfo.Images[0].CardImageUrl = res.result.url
|
257
|
367
|
},
|
258
|
368
|
}
|
259
|
369
|
}
|
|
@@ -266,4 +376,7 @@ export default {
|
266
|
376
|
margin-right: 10px;
|
267
|
377
|
}
|
268
|
378
|
}
|
|
379
|
+.mainForm > ul > li > div > div > button {
|
|
380
|
+ margin-top: 0;
|
|
381
|
+}
|
269
|
382
|
</style>
|