许成详 6 years ago
parent
commit
98f852edee

+ 3
- 3
config/index.js View File

@@ -13,10 +13,10 @@ module.exports = {
13 13
       '/api': {
14 14
         // target: 'https://dp.huiju360.com.cn/hj_operations',
15 15
         // target: 'http://192.168.0.62:8080', //wf
16
-        //target: 'http://127.0.0.1:8080', 
17
-        target: 'http://192.168.0.62:8080', //wf
16
+        // target: 'http://127.0.0.1:8080', 
17
+        // target: 'http://192.168.0.62:8080', //wf
18 18
         // target: 'http://192.168.0.11', //ys
19
-        // target: 'http://192.168.0.125:8080', //hyq
19
+        target: 'http://192.168.0.125:8080', //hyq
20 20
         // target: 'http://dev.ycjcjy.com/', //frp
21 21
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
22 22
         // pathRewrite: {

+ 125
- 31
src/pages/system/cardAndCouponManager/cardManager/edit.vue View File

@@ -3,7 +3,7 @@
3 3
     <form class="mainForm">
4 4
       <ul>
5 5
         <li class="flex-h">
6
-          <span>选择案场:</span>
6
+          <span>选择案场:<em>*</em></span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%">
9 9
               <el-select v-model="cardInfo.CaseId" placeholder="请选择" @change="caseChange">
@@ -18,7 +18,7 @@
18 18
           </div>
19 19
         </li>
20 20
         <li class="flex-h">
21
-          <span>卡图片:</span>
21
+          <span>卡图片:<em>*</em></span>
22 22
           <div class="flex-item">
23 23
             <div>
24 24
               <el-upload
@@ -34,7 +34,7 @@
34 34
           </div>
35 35
         </li>
36 36
         <li class="flex-h">
37
-          <span>卡名称:</span>
37
+          <span>卡名称:<em>*</em></span>
38 38
           <div class="flex-item">
39 39
             <div style="width:200px;">
40 40
               <el-input
@@ -46,7 +46,7 @@
46 46
           </div>
47 47
         </li>
48 48
         <li class="flex-h">
49
-          <span>卡价格:</span>
49
+          <span>卡价格:<em>*</em></span>
50 50
           <div class="flex-item">
51 51
             <div style="width:200px;">
52 52
               <el-input
@@ -58,7 +58,7 @@
58 58
           </div>
59 59
         </li>
60 60
         <li class="flex-h">
61
-          <span>总张数:</span>
61
+          <span>总张数:<em>*</em></span>
62 62
           <div class="flex-item">
63 63
             <div style="width:200px;">
64 64
               <el-input
@@ -70,7 +70,7 @@
70 70
           </div>
71 71
         </li>
72 72
         <li class="flex-h">
73
-          <span>发送类型:</span>
73
+          <span>发送类型:<em>*</em></span>
74 74
           <div class="flex-item">
75 75
             <div>
76 76
               <el-radio v-model="cardInfo.SendType" label="channel">渠道</el-radio>
@@ -80,7 +80,7 @@
80 80
           </div>
81 81
         </li>
82 82
         <li class="flex-h" v-if="cardInfo.SendType === 'channel'">
83
-          <span>选择渠道:</span>
83
+          <span>选择渠道:<em>*</em></span>
84 84
           <div class="flex-item">
85 85
             <div style="width:50%">
86 86
               <el-select v-model="cardInfo.ChannelId" placeholder="请选择">
@@ -95,7 +95,7 @@
95 95
           </div>
96 96
         </li>
97 97
         <li class="flex-h">
98
-          <span>目标课程:</span>
98
+          <span>目标课程:<em>*</em></span>
99 99
           <div class="flex-item">
100 100
             <div>
101 101
               <el-select v-model="cardInfo.Targets[0].TargetId" placeholder="请选择">
@@ -111,21 +111,10 @@
111 111
           </div>
112 112
         </li>
113 113
         <li class="flex-h">
114
-          <span>卡有效时间:</span>
114
+          <span>卡有效时间:<em>*</em></span>
115 115
           <div class="flex-item">
116 116
             <div>
117 117
               <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
118
-                <!-- <el-date-picker
119
-                  v-model="cardInfo.StartDate"
120
-                  type="date"
121
-                  placeholder="选择起始日期">
122
-                </el-date-picker>
123
-                <span style="line-height:40px;">至</span>
124
-                <el-date-picker
125
-                  v-model="cardInfo.EndDate"
126
-                  type="date"
127
-                  placeholder="选择截止日期">
128
-                </el-date-picker> -->
129 118
                 <el-date-picker
130 119
                   v-model="date"
131 120
                   type="daterange"
@@ -139,7 +128,7 @@
139 128
           </div>
140 129
         </li>
141 130
         <li class="flex-h" v-if="cardInfo.SendType !== 'case' && cardInfo.SendType !== 'system'">
142
-          <span>视频:</span>
131
+          <span>视频:<em>*</em></span>
143 132
           <div class="flex-item">
144 133
             <div style="vertical-align: middle;">
145 134
               <a style="line-height: 40px;" v-if="videoOff" :href="cardInfo.VideoUrl" target="blank">{{cardInfo.VideoUrl}}</a>
@@ -156,7 +145,7 @@
156 145
           </div>
157 146
         </li>
158 147
         <li class="flex-h">
159
-          <span>分享描述:</span>
148
+          <span>分享描述:<em>*</em></span>
160 149
           <div class="flex-item">
161 150
             <div>
162 151
               <el-input
@@ -169,7 +158,7 @@
169 158
           </div>
170 159
         </li>
171 160
         <li class="flex-h">
172
-          <span>规则描述:</span>
161
+          <span>规则描述:<em>*</em></span>
173 162
           <div class="flex-item">
174 163
             <div>
175 164
               <el-input
@@ -182,7 +171,7 @@
182 171
           </div>
183 172
         </li>
184 173
         <li class="flex-h">
185
-          <span>使用说明:</span>
174
+          <span>使用说明:<em>*</em></span>
186 175
           <div class="flex-item">
187 176
             <div>
188 177
               <el-input
@@ -236,7 +225,11 @@ export default {
236 225
         TotalCount: '',
237 226
         CaseId: '',
238 227
         OrgId: '',
239
-        Share: {},
228
+        Share: {
229
+          CardShareInfo: '',
230
+          CardUseRule: '',
231
+          CardUseInstruction: '',
232
+        },
240 233
         Images: null,
241 234
         Targets: [{}],
242 235
         ChannelId: ''
@@ -355,7 +348,110 @@ export default {
355 348
     addGoods () { // 添加指定商品
356 349
       this.centerDialogVisible = true
357 350
     },
351
+    checkInfo () { // 校验表单信息
352
+      if (this.cardInfo.CaseId === '') {
353
+        this.$message({
354
+          type: 'error',
355
+          message: '案场不能为空'
356
+        })
357
+        return false
358
+      }
359
+      if (this.cardInfo.Images === '') {
360
+        this.$message({
361
+          type: 'error',
362
+          message: '卡图片不能为空'
363
+        })
364
+        return false
365
+      }
366
+      if (this.cardInfo.CardName === '') {
367
+        this.$message({
368
+          type: 'error',
369
+          message: '卡名称不能为空'
370
+        })
371
+        return false
372
+      }
373
+      if (this.cardInfo.Price === '') {
374
+        this.$message({
375
+          type: 'error',
376
+          message: '卡价格不能为空'
377
+        })
378
+        return false
379
+      }
380
+      if (this.cardInfo.TotalCount === '') {
381
+        this.$message({
382
+          type: 'error',
383
+          message: '总张数不能为空'
384
+        })
385
+        return false
386
+      }
387
+      if (this.cardInfo.SendType === '') {
388
+        this.$message({
389
+          type: 'error',
390
+          message: '发送类型不能为空'
391
+        })
392
+        return false
393
+      }
394
+      if (this.cardInfo.SendType === 'channel' && this.cardInfo.ChannelId === '') {
395
+        this.$message({
396
+          type: 'error',
397
+          message: '渠道不能为空'
398
+        })
399
+        return false
400
+      }
401
+      if (this.cardInfo.Targets[0].TargetId === '') {
402
+        this.$message({
403
+          type: 'error',
404
+          message: '目标课程不能为空'
405
+        })
406
+        return false
407
+      }
408
+      if (this.cardInfo.StartDate === '') {
409
+        this.$message({
410
+          type: 'error',
411
+          message: '开始时间不能为空'
412
+        })
413
+        return false
414
+      }
415
+      if (this.cardInfo.EndDate === '') {
416
+        this.$message({
417
+          type: 'error',
418
+          message: '截止时间不能为空'
419
+        })
420
+        return false
421
+      }
422
+      if (this.cardInfo.SendType === 'channel' && this.cardInfo.VideoUrl === '') {
423
+        this.$message({
424
+          type: 'error',
425
+          message: '视频不能为空'
426
+        })
427
+        return false
428
+      }
429
+      if (this.cardInfo.Share.CardShareInfo === '') {
430
+        this.$message({
431
+          type: 'error',
432
+          message: '分享描述不能为空'
433
+        })
434
+        return false
435
+      }
436
+      if (this.cardInfo.Share.CardUseRule === '') {
437
+        this.$message({
438
+          type: 'error',
439
+          message: '使用规则不能为空'
440
+        })
441
+        return false
442
+      }
443
+      if (this.cardInfo.Share.CardUseInstruction === '') {
444
+        this.$message({
445
+          type: 'error',
446
+          message: '使用说明不能为空'
447
+        })
448
+        return false
449
+      }
450
+    },
358 451
     submit () { // 保存
452
+      if (!this.checkInfo()) {
453
+        return false
454
+      }
359 455
       if (this.$route.query.id) {
360 456
         if (this.date !== '') {
361 457
           this.cardInfo.StartDate = this.date[0]
@@ -368,14 +464,12 @@ export default {
368 464
           }
369 465
         }
370 466
         this.cardInfo.TotalCount = this.cardInfo.TotalCount - 0
371
-        console.log(JSON.stringify(this.cardInfo))
372 467
         this.editCard(this.cardInfo).then((res) => {
373
-          this.$alert('操作成功', '提示', {
374
-            confirmButtonText: '确定',
375
-            callback: action => {
376
-              this.$router.push({ name: 'cardList' })
377
-            }
468
+          this.$message({
469
+            type: 'success',
470
+            message: '操作成功'
378 471
           })
472
+          this.$router.push({ name: 'cardList' })
379 473
         })
380 474
       } else {
381 475
         this.cardInfo.OrgId = this.OrgId

+ 111
- 15
src/pages/system/cardAndCouponManager/couponManager/edit.vue View File

@@ -4,7 +4,7 @@
4 4
       <!-- <h1 style="font-size:22px;">{{isEdit === 0 ? '新建' : '编辑'}}{{couponInfo.CouponType === 'goods' ? '饮品优惠券' : '课程优惠券'}}</h1> -->
5 5
       <ul>
6 6
         <li class="flex-h">
7
-          <span>选择案场:</span>
7
+          <span>选择案场:<em>*</em></span>
8 8
           <div class="flex-item">
9 9
             <div style="width:50%">
10 10
               <el-select v-model="couponInfo.CaseId" placeholder="请选择" @change="caseChange">
@@ -19,7 +19,7 @@
19 19
           </div>
20 20
         </li>
21 21
         <li class="flex-h">
22
-          <span>券图片:</span>
22
+          <span>券图片:<em>*</em></span>
23 23
           <div class="flex-item">
24 24
             <div>
25 25
               <el-upload
@@ -35,7 +35,7 @@
35 35
           </div>
36 36
         </li>
37 37
         <li class="flex-h">
38
-          <span>券名称:</span>
38
+          <span>券名称:<em>*</em></span>
39 39
           <div class="flex-item">
40 40
             <div style="width:200px;">
41 41
               <el-input
@@ -47,7 +47,7 @@
47 47
           </div>
48 48
         </li>
49 49
         <li class="flex-h">
50
-          <span>券类型:</span>
50
+          <span>券类型:<em>*</em></span>
51 51
           <div class="flex-item">
52 52
             <div style="width:50%">
53 53
               <el-select v-model="couponInfo.CouponType" placeholder="请选择" @change="couponTypeChange">
@@ -62,7 +62,7 @@
62 62
           </div>
63 63
         </li>
64 64
         <li class="flex-h">
65
-          <span>券价格:</span>
65
+          <span>券价格:<em>*</em></span>
66 66
           <div class="flex-item">
67 67
             <div style="width:200px;">
68 68
               <el-input
@@ -74,7 +74,7 @@
74 74
           </div>
75 75
         </li>
76 76
         <li class="flex-h">
77
-          <span>总张数:</span>
77
+          <span>总张数:<em>*</em></span>
78 78
           <div class="flex-item">
79 79
             <div style="width:200px;">
80 80
               <el-input
@@ -86,7 +86,7 @@
86 86
           </div>
87 87
         </li>
88 88
         <li class="flex-h">
89
-          <span>发送类型:</span>
89
+          <span>发送类型:<em>*</em></span>
90 90
           <div class="flex-item">
91 91
             <div>
92 92
               <el-radio v-model="couponInfo.SendType" label="channel">渠道</el-radio>
@@ -96,7 +96,7 @@
96 96
           </div>
97 97
         </li>
98 98
         <li class="flex-h" v-if="couponInfo.SendType === 'channel'">
99
-          <span>选择渠道:</span>
99
+          <span>选择渠道:<em>*</em></span>
100 100
           <div class="flex-item">
101 101
             <div style="width:50%">
102 102
               <el-select v-model="couponInfo.ChannelId" placeholder="请选择">
@@ -111,7 +111,7 @@
111 111
           </div>
112 112
         </li>
113 113
         <li class="flex-h">
114
-          <span>目标商品:</span>
114
+          <span>目标商品:<em>*</em></span>
115 115
           <div class="flex-item">
116 116
             <div>
117 117
               <el-radio v-model="couponInfo.IsAll" label="1">全部商品</el-radio>
@@ -153,7 +153,7 @@
153 153
           </div>
154 154
         </li>
155 155
         <li class="flex-h" v-if="couponInfo.CouponType === 'goods'">
156
-          <span>券有效时间:</span>
156
+          <span>券有效时间:<em>*</em></span>
157 157
           <div class="flex-item">
158 158
             <div>
159 159
               <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
@@ -185,7 +185,7 @@
185 185
           </div>
186 186
         </li>
187 187
         <li class="flex-h" v-if="couponInfo.CouponType === 'course'">
188
-          <span>券有效时间:</span>
188
+          <span>券有效时间:<em>*</em></span>
189 189
           <div class="flex-item">
190 190
             <div>
191 191
               <el-date-picker
@@ -203,7 +203,7 @@
203 203
           </div>
204 204
         </li>
205 205
         <li class="flex-h" v-if="couponInfo.SendType !== 'case' && couponInfo.SendType !== 'system'">
206
-          <span>视频:</span>
206
+          <span>视频:<em>*</em></span>
207 207
           <div class="flex-item">
208 208
             <div style="vertical-align: middle;">
209 209
               <a style="line-height: 40px;" v-if="videoOff" :href="couponInfo.VideoUrl" target="blank">{{couponInfo.VideoUrl}}</a>
@@ -220,7 +220,7 @@
220 220
           </div>
221 221
         </li>
222 222
         <li class="flex-h">
223
-          <span>分享描述:</span>
223
+          <span>分享描述:<em>*</em></span>
224 224
           <div class="flex-item">
225 225
             <div>
226 226
               <el-input
@@ -233,7 +233,7 @@
233 233
           </div>
234 234
         </li>
235 235
         <li class="flex-h">
236
-          <span>规则描述:</span>
236
+          <span>规则描述:<em>*</em></span>
237 237
           <div class="flex-item">
238 238
             <div>
239 239
               <el-input
@@ -246,7 +246,7 @@
246 246
           </div>
247 247
         </li>
248 248
         <li class="flex-h">
249
-          <span>使用说明:</span>
249
+          <span>使用说明:<em>*</em></span>
250 250
           <div class="flex-item">
251 251
             <div>
252 252
               <el-input
@@ -578,7 +578,103 @@ export default {
578 578
         })
579 579
       }
580 580
     },
581
+    checkInfo () { // 校验表单信息
582
+      if (this.couponInfo.CaseId === '') {
583
+        this.$message({
584
+          type: 'error',
585
+          message: '案场不能为空'
586
+        })
587
+        return false
588
+      }
589
+      if (this.couponInfo.Images[0].CouponImageUrl === '') {
590
+        this.$message({
591
+          type: 'error',
592
+          message: '券图片不能为空'
593
+        })
594
+        return false
595
+      }
596
+      if (this.couponInfo.CouponName === '') {
597
+        this.$message({
598
+          type: 'error',
599
+          message: '券名称不能为空'
600
+        })
601
+        return false
602
+      }
603
+      if (this.couponInfo.CouponType === '') {
604
+        this.$message({
605
+          type: 'error',
606
+          message: '券类型不能为空'
607
+        })
608
+        return false
609
+      }
610
+      if (this.couponInfo.Price === '') {
611
+        this.$message({
612
+          type: 'error',
613
+          message: '券价格不能为空'
614
+        })
615
+        return false
616
+      }
617
+      if (this.couponInfo.TotalCount === '') {
618
+        this.$message({
619
+          type: 'error',
620
+          message: '总张数不能为空'
621
+        })
622
+        return false
623
+      }
624
+      if (this.couponInfo.SendType === '') {
625
+        this.$message({
626
+          type: 'error',
627
+          message: '发送类型不能为空'
628
+        })
629
+        return false
630
+      }
631
+      if (this.couponInfo.SendType === 'channel' && this.couponInfo.ChannelId === '') {
632
+        this.$message({
633
+          type: 'error',
634
+          message: '渠道不能为空'
635
+        })
636
+        return false
637
+      }
638
+      if (this.couponInfo.IsAll === 0 && this.couponInfo.Targets[0].TargetId === '') {
639
+        this.$message({
640
+          type: 'error',
641
+          message: '目标商品不能为空'
642
+        })
643
+        return false
644
+      }
645
+      if (this.couponInfo.SendType === 'channel' && this.couponInfo.VideoUrl === '') {
646
+        this.$message({
647
+          type: 'error',
648
+          message: '视频不能为空'
649
+        })
650
+        return false
651
+      }
652
+      if (this.couponInfo.Share.CouponShareInfo === '') {
653
+        this.$message({
654
+          type: 'error',
655
+          message: '分享描述不能为空'
656
+        })
657
+        return false
658
+      }
659
+      if (this.couponInfo.Share.UseRule === '') {
660
+        this.$message({
661
+          type: 'error',
662
+          message: '使用规则不能为空'
663
+        })
664
+        return false
665
+      }
666
+      if (this.couponInfo.Share.UseInstruction === '') {
667
+        this.$message({
668
+          type: 'error',
669
+          message: '使用说明不能为空'
670
+        })
671
+        return false
672
+      }
673
+    },
581 674
     submit () { // 保存
675
+      if (!this.checkInfo()) {
676
+        return false
677
+      }
582 678
       if (this.$route.query.id) {
583 679
         if (this.couponInfo.ValidDays) {
584 680
           this.couponInfo.StartDate = undefined