许成详 6 years ago
parent
commit
8c1ebe0222

+ 67
- 28
src/pages/system/cardAndCouponManager/cardManager/edit.vue View File

6
           <span>选择案场:<em>*</em></span>
6
           <span>选择案场:<em>*</em></span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%">
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="isEdit">
10
                 <el-option
10
                 <el-option
11
                   v-for="item in cases"
11
                   v-for="item in cases"
12
                   :key="item.CaseId"
12
                   :key="item.CaseId"
22
           <div class="flex-item">
22
           <div class="flex-item">
23
             <div>
23
             <div>
24
               <el-upload
24
               <el-upload
25
+                :disabled="isEdit"
25
                 class="avatar-uploader"
26
                 class="avatar-uploader"
26
                 action='string'
27
                 action='string'
27
                 :http-request="toolClass.upload"
28
                 :http-request="toolClass.upload"
50
           <div class="flex-item">
51
           <div class="flex-item">
51
             <div style="width:200px;">
52
             <div style="width:200px;">
52
               <el-input
53
               <el-input
54
+                :disabled="isEdit"
53
                 placeholder="请输入"
55
                 placeholder="请输入"
54
                 v-model="cardInfo.Price"
56
                 v-model="cardInfo.Price"
55
                 clearable>
57
                 clearable>
62
           <div class="flex-item">
64
           <div class="flex-item">
63
             <div style="width:200px;">
65
             <div style="width:200px;">
64
               <el-input
66
               <el-input
67
+                :disabled="isEdit"
65
                 placeholder="请输入"
68
                 placeholder="请输入"
66
                 v-model="cardInfo.TotalCount"
69
                 v-model="cardInfo.TotalCount"
67
                 clearable>
70
                 clearable>
73
           <span>发送类型:<em>*</em></span>
76
           <span>发送类型:<em>*</em></span>
74
           <div class="flex-item">
77
           <div class="flex-item">
75
             <div>
78
             <div>
76
-              <el-radio v-model="cardInfo.SendType" label="channel">渠道</el-radio>
77
-              <el-radio v-model="cardInfo.SendType" label="case">案场</el-radio>
78
-              <el-radio v-model="cardInfo.SendType" label="system">系统</el-radio>
79
+              <el-radio v-model="cardInfo.SendType" label="channel" :disabled="isEdit">渠道</el-radio>
80
+              <el-radio v-model="cardInfo.SendType" label="case" :disabled="isEdit">案场</el-radio>
81
+              <el-radio v-model="cardInfo.SendType" label="system" :disabled="isEdit">系统</el-radio>
79
             </div>
82
             </div>
80
           </div>
83
           </div>
81
         </li>
84
         </li>
83
           <span>选择渠道:<em>*</em></span>
86
           <span>选择渠道:<em>*</em></span>
84
           <div class="flex-item">
87
           <div class="flex-item">
85
             <div style="width:50%">
88
             <div style="width:50%">
86
-              <el-select v-model="cardInfo.ChannelId" placeholder="请选择">
89
+              <el-select v-model="cardInfo.ChannelId" placeholder="请选择" :disabled="isEdit">
87
                 <el-option
90
                 <el-option
88
                   v-for="item in channelList"
91
                   v-for="item in channelList"
89
                   :key="item.ChannelId"
92
                   :key="item.ChannelId"
98
           <span>目标课程:<em>*</em></span>
101
           <span>目标课程:<em>*</em></span>
99
           <div class="flex-item">
102
           <div class="flex-item">
100
             <div>
103
             <div>
101
-              <el-select v-model="cardInfo.Targets[0].TargetId" placeholder="请选择">
104
+              <el-select v-model="cardInfo.Targets[0].TargetId" placeholder="请选择" :disabled="isEdit">
102
                 <el-option
105
                 <el-option
103
                   v-for="item in courseList"
106
                   v-for="item in courseList"
104
                   :key="item.CourseId"
107
                   :key="item.CourseId"
115
           <div class="flex-item">
118
           <div class="flex-item">
116
             <div>
119
             <div>
117
               <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
120
               <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
118
-                <el-date-picker
121
+                <!-- <el-date-picker
122
+                  :disabled="isEdit"
119
                   v-model="date"
123
                   v-model="date"
120
                   type="daterange"
124
                   type="daterange"
121
                   range-separator="至"
125
                   range-separator="至"
122
                   start-placeholder="开始日期"
126
                   start-placeholder="开始日期"
123
                   end-placeholder="结束日期">
127
                   end-placeholder="结束日期">
128
+                </el-date-picker> -->
129
+                <el-date-picker
130
+                  :disabled="isEdit"
131
+                  v-model="cardInfo.StartDate"
132
+                  type="date"
133
+                  placeholder="选择起始日期">
134
+                </el-date-picker>
135
+                <span style="line-height:40px;">至</span>
136
+                <el-date-picker
137
+                  :disabled="isEdit"
138
+                  v-model="cardInfo.EndDate"
139
+                  type="date"
140
+                  placeholder="选择截止日期">
124
                 </el-date-picker>
141
                 </el-date-picker>
125
               </div>
142
               </div>
126
             </div>
143
             </div>
132
             <div style="vertical-align: middle;">
149
             <div style="vertical-align: middle;">
133
               <a style="line-height: 40px;" v-if="videoOff" :href="cardInfo.VideoUrl" target="blank">{{cardInfo.VideoUrl}}</a>
150
               <a style="line-height: 40px;" v-if="videoOff" :href="cardInfo.VideoUrl" target="blank">{{cardInfo.VideoUrl}}</a>
134
               <el-upload
151
               <el-upload
152
+                :disabled="isEdit"
135
                 class="avatar-uploader"
153
                 class="avatar-uploader"
136
                 action='string'
154
                 action='string'
137
                 :http-request="toolClass.upload"
155
                 :http-request="toolClass.upload"
206
       videoOff: false,
224
       videoOff: false,
207
       total: 0,
225
       total: 0,
208
       type: this.$route.query.type,
226
       type: this.$route.query.type,
209
-      isEdit: this.$route.query.id === undefined ? 0 : 1,
227
+      isEdit: !!this.$route.query.id,
210
       ChannelList: [], // 渠道列表
228
       ChannelList: [], // 渠道列表
211
       TypeList: [], // 类型列表
229
       TypeList: [], // 类型列表
212
       GoodsList: [], // 商品列表
230
       GoodsList: [], // 商品列表
256
             this.getCardById({
274
             this.getCardById({
257
               id: this.$route.query.id
275
               id: this.$route.query.id
258
             }).then((res) => {
276
             }).then((res) => {
259
-              // console.log(JSON.stringify(res.Card))
260
-              this.cardInfo = res.Card
261
-              if (res.Card.VideoUrl) {
262
-                this.videoOff = true
263
-              }
264
-              if (res.Card.Images === null) {
265
-                this.cardInfo.Images = [{
266
-                  CardImageUrl: ''
267
-                }]
268
-              }
269
-              if (res.Card.StartDate) {
270
-                this.date = [res.Card.StartDate, res.Card.EndDate]
277
+              if (res.Card.CaseId !== '') {
278
+                var aRes = res
279
+                this.GetChannelListList({
280
+                  caseid: res.Card.CaseId,
281
+                  page: 1,
282
+                  pagesize: 10000
283
+                }).then((res) => {
284
+                  this.cardInfo = aRes.Card
285
+                  if (aRes.Card.VideoUrl) {
286
+                    this.videoOff = true
287
+                  }
288
+                  if (aRes.Card.Images === null) {
289
+                    this.cardInfo.Images = [{
290
+                      CardImageUrl: ''
291
+                    }]
292
+                  }
293
+                  if (aRes.Card.StartDate) {
294
+                    this.date = [aRes.Card.StartDate, aRes.Card.EndDate]
295
+                  }
296
+                })
297
+              } else {
298
+                this.cardInfo = res.Card
299
+                if (res.Card.VideoUrl) {
300
+                  this.videoOff = true
301
+                }
302
+                if (res.Card.Images === null) {
303
+                  this.cardInfo.Images = [{
304
+                    CardImageUrl: ''
305
+                  }]
306
+                }
307
+                if (res.Card.StartDate) {
308
+                  this.date = [res.Card.StartDate, res.Card.EndDate]
309
+                }
271
               }
310
               }
272
             })
311
             })
273
           }
312
           }
439
     },
478
     },
440
     submit () { // 保存
479
     submit () { // 保存
441
       if (this.$route.query.id) {
480
       if (this.$route.query.id) {
442
-        if (this.date !== '') {
443
-          this.cardInfo.StartDate = this.date[0]
444
-          this.cardInfo.EndDate = this.date[1]
445
-        }
481
+        // if (this.date !== '') {
482
+        //   this.cardInfo.StartDate = this.date[0]
483
+        //   this.cardInfo.EndDate = this.date[1]
484
+        // }
446
         this.courseList = this.courseList || []
485
         this.courseList = this.courseList || []
447
         for (var x = 0; x < this.courseList.length; x++) {
486
         for (var x = 0; x < this.courseList.length; x++) {
448
           if (this.courseList[x].CourseId === this.cardInfo.Targets[0].TargetId) {
487
           if (this.courseList[x].CourseId === this.cardInfo.Targets[0].TargetId) {
463
         })
502
         })
464
       } else {
503
       } else {
465
         this.cardInfo.OrgId = this.OrgId
504
         this.cardInfo.OrgId = this.OrgId
466
-        if (this.date !== '') {
467
-          this.cardInfo.StartDate = this.date[0]
468
-          this.cardInfo.EndDate = this.date[1]
469
-        }
505
+        // if (this.date !== '') {
506
+        //   this.cardInfo.StartDate = this.date[0]
507
+        //   this.cardInfo.EndDate = this.date[1]
508
+        // }
470
         this.courseList = this.courseList || []
509
         this.courseList = this.courseList || []
471
         for (var n = 0; n < this.courseList.length; n++) {
510
         for (var n = 0; n < this.courseList.length; n++) {
472
           if (this.courseList[n].CourseId === this.cardInfo.Targets[0].TargetId) {
511
           if (this.courseList[n].CourseId === this.cardInfo.Targets[0].TargetId) {

+ 24
- 16
src/pages/system/cardAndCouponManager/couponManager/edit.vue View File

7
           <span>选择案场:<em>*</em></span>
7
           <span>选择案场:<em>*</em></span>
8
           <div class="flex-item">
8
           <div class="flex-item">
9
             <div style="width:50%">
9
             <div style="width:50%">
10
-              <el-select v-model="couponInfo.CaseId" placeholder="请选择" @change="caseChange">
10
+              <el-select v-model="couponInfo.CaseId" placeholder="请选择" @change="caseChange" :disabled="isEdit">
11
                 <el-option
11
                 <el-option
12
                   v-for="item in cases"
12
                   v-for="item in cases"
13
                   :key="item.CaseId"
13
                   :key="item.CaseId"
23
           <div class="flex-item">
23
           <div class="flex-item">
24
             <div>
24
             <div>
25
               <el-upload
25
               <el-upload
26
+                :disabled="isEdit"
26
                 class="avatar-uploader"
27
                 class="avatar-uploader"
27
                 action='string'
28
                 action='string'
28
                 :http-request="toolClass.upload"
29
                 :http-request="toolClass.upload"
50
           <span>券类型:<em>*</em></span>
51
           <span>券类型:<em>*</em></span>
51
           <div class="flex-item">
52
           <div class="flex-item">
52
             <div style="width:50%">
53
             <div style="width:50%">
53
-              <el-select v-model="couponInfo.CouponType" placeholder="请选择" @change="couponTypeChange">
54
+              <el-select v-model="couponInfo.CouponType" placeholder="请选择" @change="couponTypeChange" :disabled="isEdit">
54
                 <el-option
55
                 <el-option
55
                   v-for="item in TypeList"
56
                   v-for="item in TypeList"
56
                   :key="item.id"
57
                   :key="item.id"
66
           <div class="flex-item">
67
           <div class="flex-item">
67
             <div style="width:200px;">
68
             <div style="width:200px;">
68
               <el-input
69
               <el-input
70
+                :disabled="isEdit"
69
                 placeholder="请输入"
71
                 placeholder="请输入"
70
                 v-model="couponInfo.Price"
72
                 v-model="couponInfo.Price"
71
                 clearable>
73
                 clearable>
78
           <div class="flex-item">
80
           <div class="flex-item">
79
             <div style="width:200px;">
81
             <div style="width:200px;">
80
               <el-input
82
               <el-input
83
+                :disabled="isEdit"
81
                 placeholder="请输入"
84
                 placeholder="请输入"
82
                 v-model="couponInfo.TotalCount"
85
                 v-model="couponInfo.TotalCount"
83
                 clearable>
86
                 clearable>
89
           <span>发送类型:<em>*</em></span>
92
           <span>发送类型:<em>*</em></span>
90
           <div class="flex-item">
93
           <div class="flex-item">
91
             <div>
94
             <div>
92
-              <el-radio v-model="couponInfo.SendType" label="channel">渠道</el-radio>
93
-              <el-radio v-if="couponInfo.CouponType === 'course'" v-model="couponInfo.SendType" label="case">案场</el-radio>
94
-              <el-radio v-model="couponInfo.SendType" label="system">系统</el-radio>
95
+              <el-radio v-model="couponInfo.SendType" label="channel" :disabled="isEdit">渠道</el-radio>
96
+              <el-radio v-if="couponInfo.CouponType === 'course'" v-model="couponInfo.SendType" label="case" :disabled="isEdit">案场</el-radio>
97
+              <el-radio v-model="couponInfo.SendType" label="system" :disabled="isEdit">系统</el-radio>
95
             </div>
98
             </div>
96
           </div>
99
           </div>
97
         </li>
100
         </li>
99
           <span>选择渠道:<em>*</em></span>
102
           <span>选择渠道:<em>*</em></span>
100
           <div class="flex-item">
103
           <div class="flex-item">
101
             <div style="width:50%">
104
             <div style="width:50%">
102
-              <el-select v-model="couponInfo.ChannelId" placeholder="请选择">
105
+              <el-select v-model="couponInfo.ChannelId" placeholder="请选择" :disabled="isEdit">
103
                 <el-option
106
                 <el-option
104
                   v-for="item in channelList"
107
                   v-for="item in channelList"
105
                   :key="item.ChannelId"
108
                   :key="item.ChannelId"
114
           <span>目标商品:<em>*</em></span>
117
           <span>目标商品:<em>*</em></span>
115
           <div class="flex-item">
118
           <div class="flex-item">
116
             <div>
119
             <div>
117
-              <el-radio v-model="couponInfo.IsAll" label="1">全部商品</el-radio>
118
-              <el-radio v-model="couponInfo.IsAll" label="0">指定商品</el-radio>
120
+              <el-radio v-model="couponInfo.IsAll" label="1" :disabled="isEdit">全部商品</el-radio>
121
+              <el-radio v-model="couponInfo.IsAll" label="0" :disabled="isEdit">指定商品</el-radio>
119
             </div>
122
             </div>
120
           </div>
123
           </div>
121
         </li>
124
         </li>
142
                     <el-button
145
                     <el-button
143
                       size="mini"
146
                       size="mini"
144
                       type="warning"
147
                       type="warning"
145
-                      @click="deleteGoodsItem(scope.$index, scope.row)">删除</el-button>
148
+                      @click="deleteGoodsItem(scope.$index, scope.row)" :disabled="isEdit">删除</el-button>
146
                   </template>
149
                   </template>
147
                 </el-table-column>
150
                 </el-table-column>
148
               </el-table>
151
               </el-table>
149
               <div style="text-align:center;padding:10px 0;">
152
               <div style="text-align:center;padding:10px 0;">
150
-                <el-button type="success" size="mini" @click="addGoods">添加商品</el-button>
153
+                <el-button type="success" size="mini" @click="addGoods" :disabled="isEdit">添加商品</el-button>
151
               </div>
154
               </div>
152
             </div>
155
             </div>
153
           </div>
156
           </div>
157
           <div class="flex-item">
160
           <div class="flex-item">
158
             <div>
161
             <div>
159
               <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
162
               <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
160
-                <el-radio v-model="postData.TimeType" label="1">固定时间</el-radio>
163
+                <el-radio v-model="postData.TimeType" label="1" :disabled="isEdit">固定时间</el-radio>
161
                 <el-date-picker
164
                 <el-date-picker
165
+                  :disabled="isEdit"
162
                   v-model="couponInfo.StartDate"
166
                   v-model="couponInfo.StartDate"
163
                   type="date"
167
                   type="date"
164
                   placeholder="选择起始日期">
168
                   placeholder="选择起始日期">
165
                 </el-date-picker>
169
                 </el-date-picker>
166
                 <span style="line-height:40px;">至</span>
170
                 <span style="line-height:40px;">至</span>
167
                 <el-date-picker
171
                 <el-date-picker
172
+                  :disabled="isEdit"
168
                   v-model="couponInfo.EndDate"
173
                   v-model="couponInfo.EndDate"
169
                   type="date"
174
                   type="date"
170
                   placeholder="选择截止日期">
175
                   placeholder="选择截止日期">
171
                 </el-date-picker>
176
                 </el-date-picker>
172
               </div>
177
               </div>
173
               <div class="addLine flex-h" style="align-item:center;">
178
               <div class="addLine flex-h" style="align-item:center;">
174
-                <el-radio v-model="postData.TimeType" label="2">领取后</el-radio>
179
+                <el-radio v-model="postData.TimeType" label="2" :disabled="isEdit">领取后</el-radio>
175
                 <span style="width:100px;">
180
                 <span style="width:100px;">
176
                   <el-input
181
                   <el-input
182
+                    :disabled="isEdit"
177
                     placeholder="请输入"
183
                     placeholder="请输入"
178
                     v-model="couponInfo.ValidDays"
184
                     v-model="couponInfo.ValidDays"
179
                     clearable>
185
                     clearable>
189
           <div class="flex-item">
195
           <div class="flex-item">
190
             <div>
196
             <div>
191
               <el-date-picker
197
               <el-date-picker
198
+                :disabled="isEdit"
192
                 v-model="couponInfo.StartDate"
199
                 v-model="couponInfo.StartDate"
193
                 type="date"
200
                 type="date"
194
                 placeholder="选择起始日期">
201
                 placeholder="选择起始日期">
195
               </el-date-picker>
202
               </el-date-picker>
196
               <span style="line-height:40px;">至</span>
203
               <span style="line-height:40px;">至</span>
197
               <el-date-picker
204
               <el-date-picker
205
+                :disabled="isEdit"
198
                 v-model="couponInfo.EndDate"
206
                 v-model="couponInfo.EndDate"
199
                 type="date"
207
                 type="date"
200
                 placeholder="选择截止日期">
208
                 placeholder="选择截止日期">
208
             <div style="vertical-align: middle;">
216
             <div style="vertical-align: middle;">
209
               <a style="line-height: 40px;" v-if="videoOff" :href="couponInfo.VideoUrl" target="blank">{{couponInfo.VideoUrl}}</a>
217
               <a style="line-height: 40px;" v-if="videoOff" :href="couponInfo.VideoUrl" target="blank">{{couponInfo.VideoUrl}}</a>
210
               <el-upload
218
               <el-upload
219
+                :disabled="isEdit"
211
                 class="avatar-uploader"
220
                 class="avatar-uploader"
212
                 action='string'
221
                 action='string'
213
                 :http-request="toolClass.upload"
222
                 :http-request="toolClass.upload"
214
                 :show-file-list="false"
223
                 :show-file-list="false"
215
                 :on-success="videoSuccess">
224
                 :on-success="videoSuccess">
216
-                <a style="line-height: 40px;padding: 0 10px;">{{videoOff ? '更换' : '添加'}}视频</a>
225
+                <a style="line-height: 40px;padding: 0 10px;" :disabled="isEdit">{{videoOff ? '更换' : '添加'}}视频</a>
217
               </el-upload>
226
               </el-upload>
218
-              <el-button v-if="videoOff" type="danger" @click="deleteVideo">删除视频</el-button>
227
+              <el-button v-if="videoOff" type="danger" @click="deleteVideo" :disabled="isEdit">删除视频</el-button>
219
             </div>
228
             </div>
220
           </div>
229
           </div>
221
         </li>
230
         </li>
373
       total: 0,
382
       total: 0,
374
       centerDialogVisible: false,
383
       centerDialogVisible: false,
375
       type: this.$route.query.type || '', // goods、course
384
       type: this.$route.query.type || '', // goods、course
376
-      isEdit: this.$route.query.id === undefined ? 0 : 1,
385
+      isEdit: !!this.$route.query.id,
377
       ChannelList: [], // 渠道列表
386
       ChannelList: [], // 渠道列表
378
       TypeList: [{ // 类型列表
387
       TypeList: [{ // 类型列表
379
         value: '商品券',
388
         value: '商品券',
429
               id: this.$route.query.id
438
               id: this.$route.query.id
430
             }).then((res) => {
439
             }).then((res) => {
431
               // console.log(JSON.stringify(res))
440
               // console.log(JSON.stringify(res))
432
-
433
               if (res.coupon.CaseId !== '') {
441
               if (res.coupon.CaseId !== '') {
434
                 var aRes = res
442
                 var aRes = res
435
                 this.GetChannelListList({
443
                 this.GetChannelListList({