Browse Source

feat: 更改项目折扣

黎海 2 years ago
parent
commit
337078f32b

+ 244 - 95
src/pages/confirmOrder/details/index.vue

@@ -104,9 +104,9 @@
104
       <div class="project">
104
       <div class="project">
105
         <div class="project-title">
105
         <div class="project-title">
106
           <div>共<span>{{order_data.project_list?order_data.project_list.length:0}}个</span>项目</div>
106
           <div>共<span>{{order_data.project_list?order_data.project_list.length:0}}个</span>项目</div>
107
-          <div v-if="order_data.type!='one'"
107
+          <!-- <div v-if="order_data.type!='one'"
108
                class="add-project"
108
                class="add-project"
109
-               @click="addProject">添加</div>
109
+               @click="addProject">添加</div> -->
110
         </div>
110
         </div>
111
         <div class="project-list"
111
         <div class="project-list"
112
              :style="isChange?'height:250px':''">
112
              :style="isChange?'height:250px':''">
@@ -121,15 +121,28 @@
121
               </div>
121
               </div>
122
               <div class="project-tips">{{item.product_names}}</div>
122
               <div class="project-tips">{{item.product_names}}</div>
123
               <div class="project-zoom">
123
               <div class="project-zoom">
124
-                <div> <span v-if="item.device_name">{{item.device_name}}({{item.room}}){{item.use_time}}分钟</span></div>
125
-                <div v-if="order_data.type!='one'"><img @click="eidt(item)"
124
+                <el-select v-model="item.tot_name"
125
+                           v-if="item.device_name"
126
+                           @visible-change="openList($event,item,index)"
127
+                           @change="changeRoom($event,item,index)"
128
+                           size="mini"
129
+                           style="min-width: 150px;"
130
+                           :placeholder="item.tot_name">
131
+                  <el-option v-for="i in roomList"
132
+                             :key="i.id"
133
+                             :label="i.tot_name"
134
+                             :value="i.tot_name">
135
+                  </el-option>
136
+                </el-select>
137
+                <!-- <div> <span v-if="item.device_name">{{item.device_name}}({{item.room}}){{item.use_time}}分钟</span></div> -->
138
+                <!-- <div v-if="order_data.type!='one'"><img @click="eidt(item)"
126
                        src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/eidt.png">
139
                        src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/eidt.png">
127
                   <img v-if="order_data.project_list.length>1"
140
                   <img v-if="order_data.project_list.length>1"
128
                        @click="deleteProject(item)"
141
                        @click="deleteProject(item)"
129
                        class="delete"
142
                        class="delete"
130
                        src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/delete.png"
143
                        src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/delete.png"
131
                        alt="">
144
                        alt="">
132
-                </div>
145
+                </div> -->
133
               </div>
146
               </div>
134
             </div>
147
             </div>
135
           </div>
148
           </div>
@@ -139,7 +152,7 @@
139
            v-if="!isChange">
152
            v-if="!isChange">
140
         <div class="cost-title">
153
         <div class="cost-title">
141
           <div>预约费用</div>
154
           <div>预约费用</div>
142
-          <div>¥{{reservationPrice}}</div>
155
+          <div>¥{{order_data.original_price}}</div>
143
         </div>
156
         </div>
144
         <!-- 次卡 -->
157
         <!-- 次卡 -->
145
         <div class="cost-coupon-list">
158
         <div class="cost-coupon-list">
@@ -198,18 +211,10 @@
198
                 <!-- <div class="cou-price">-¥{{price}}</div> -->
211
                 <!-- <div class="cou-price">-¥{{price}}</div> -->
199
               </div>
212
               </div>
200
             </div>
213
             </div>
201
-            <div class="coupon-ps"
202
-                 v-if="discount!=0">
203
-              <div></div>
204
-              <div v-if="discount!=20"
205
-                   class="cou-price"> {{discount==100?'仪器免费体验':'新人5折优惠'}}</div>
206
-              <div class="cou-price"
207
-                   v-else-if=" isSelectCoup.length&&(order_data.project_list.length - isSelectCoup.length)>=3">{{'任意三个项目8折'}}</div>
208
-            </div>
209
           </div>
214
           </div>
210
         </div>
215
         </div>
211
         <div class="over-price">
216
         <div class="over-price">
212
-          合计: <span class="price-num"><span class="min-size">¥</span>{{isSelectCoup.length>0?showMoney:discountPrice}}<span class="min-size"></span></span>
217
+          合计: <span class="price-num"><span class="min-size">¥</span>{{showMoney}}<span class="min-size"></span></span>
213
         </div>
218
         </div>
214
       </div>
219
       </div>
215
       <div class="payment"
220
       <div class="payment"
@@ -453,7 +458,7 @@
453
              @click="choicePayType=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
458
              @click="choicePayType=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
454
                alt=""></div>
459
                alt=""></div>
455
         <div class="pay-title">选择支付方式</div>
460
         <div class="pay-title">选择支付方式</div>
456
-        <div class="pay-price">¥<span>{{isSelectCoup.length>0?showMoney:discountPrice}}</span></div>
461
+        <div class="pay-price">¥<span>{{showMoney}}</span></div>
457
         <div class="pay-list">
462
         <div class="pay-list">
458
           <div class="pay-info"
463
           <div class="pay-info"
459
                v-for="item,index in payList"
464
                v-for="item,index in payList"
@@ -483,7 +488,7 @@
483
                alt=""></div>
488
                alt=""></div>
484
         <div v-if="isPayCode">
489
         <div v-if="isPayCode">
485
           <div class="pay-title">请扫码支付</div>
490
           <div class="pay-title">请扫码支付</div>
486
-          <div class="pay-price">¥<span>{{isSelectCoup.length>0?showMoney:discountPrice}}</span></div>
491
+          <div class="pay-price">¥<span>{{showMoney}}</span></div>
487
           <div class="banner">
492
           <div class="banner">
488
             <div id="qrCode"
493
             <div id="qrCode"
489
                  class="qrCode"
494
                  class="qrCode"
@@ -508,6 +513,7 @@
508
 import minePupop from '../../../components/minePupop/index.vue'
513
 import minePupop from '../../../components/minePupop/index.vue'
509
 import QRCode from 'qrcodejs2'
514
 import QRCode from 'qrcodejs2'
510
 import api from '../../../server/home'
515
 import api from '../../../server/home'
516
+import internal from 'assert';
511
 
517
 
512
 export default {
518
 export default {
513
   components: { minePupop },
519
   components: { minePupop },
@@ -519,6 +525,7 @@ export default {
519
       unSelect: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png',
525
       unSelect: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png',
520
       userInfo: {
526
       userInfo: {
521
       },
527
       },
528
+      value: '',
522
       // 问题标签
529
       // 问题标签
523
       problem: '',
530
       problem: '',
524
       //面部标签
531
       //面部标签
@@ -624,9 +631,10 @@ export default {
624
       // 下面是支付的数据
631
       // 下面是支付的数据
625
       showMoney: 0, // 价值总额
632
       showMoney: 0, // 价值总额
626
       discountPrice: 0,//活动后金额
633
       discountPrice: 0,//活动后金额
627
-      discount: 0,//折扣类型
634
+      discountList: [],//折扣类型
628
       device_name: '',//支付成功后的设备
635
       device_name: '',//支付成功后的设备
629
       room: '',//设备房间
636
       room: '',//设备房间
637
+      roomList: [],//设备房间列表
630
       user_id: '',
638
       user_id: '',
631
       // showRuleText: 10086,
639
       // showRuleText: 10086,
632
 
640
 
@@ -665,6 +673,7 @@ export default {
665
         res.data.order_data.project_list.forEach(e => {
673
         res.data.order_data.project_list.forEach(e => {
666
           e["isCard"] = false
674
           e["isCard"] = false
667
           e["isCoupon"] = false
675
           e["isCoupon"] = false
676
+          e["tot_name"] = `${e.device_name}(${e.room})`
668
         })
677
         })
669
         this.order_data = res.data.order_data
678
         this.order_data = res.data.order_data
670
         if (this.order_data.coupon_list.length > 0) {
679
         if (this.order_data.coupon_list.length > 0) {
@@ -672,18 +681,9 @@ export default {
672
         }
681
         }
673
         this.showMoney = res.data.order_data.price
682
         this.showMoney = res.data.order_data.price
674
         this.poreList = res.data.detail_list
683
         this.poreList = res.data.detail_list
675
-        this.order_data['discountPrice'] = 0
676
-        //折扣类型,0.无折扣,20.任意三个项目8折,50.新人五折活动,100.仪器免费使用权益
677
-        this.order_data.project_list.forEach(item => {
678
-          if (this.discount == 20) {
679
-            this.order_data.discountPrice += Number(item.price) * 0.8
680
-          } else if (this.discount == 50) {
681
-            this.order_data.discountPrice += Number(item.price) * 0.5
682
-          } else if (this.discount == 0) {
683
-            this.order_data.discountPrice = this.showMoney
684
-          }
685
-        })
686
-        this.discountPrice = Number(this.order_data.discountPrice).toFixed(2)
684
+        this.order_data['discountPrice'] = this.order_data.price
685
+        this.discountPrice = this.order_data.price
686
+        this.calculateMoney()
687
         this.calculationPrice()
687
         this.calculationPrice()
688
       })
688
       })
689
     },
689
     },
@@ -698,18 +698,51 @@ export default {
698
         }
698
         }
699
       })
699
       })
700
     },
700
     },
701
-    isSelectCard (item, index) {
702
-      let isSelect = false
703
-      let isRepeat = false
704
-      this.cardList.forEach(res => {
705
-        if (res.isSelect && item.id != res.id && item.name == res.name) {
706
-          isRepeat = true
701
+    openList (e, item, index) {
702
+      console.log(e, item, index, 'e,item,index');
703
+      if (e) {
704
+        this.value = ''
705
+        this.roomList = []
706
+        let params = {
707
+          id: this.id,
708
+          project_id: item.id
709
+        }
710
+        api.getDevice_list(params).then(res => {
711
+          if (res.code == 200) {
712
+            res.data.list.forEach(item => {
713
+              item['tot_name'] = `${item.name}(${item.room})`
714
+            })
715
+            this.roomList = res.data.list
716
+          }
717
+        })
718
+      }
719
+    },
720
+    changeRoom (e, item, index) {
721
+      let _id = 0
722
+      this.roomList.forEach(res => {
723
+        if (res.tot_name == e) {
724
+          _id = res.id
707
         }
725
         }
708
       })
726
       })
709
-      if (isRepeat) {
710
-        this.$message.error("不能选择相同的次卡");
711
-        return
727
+      console.log(e, item, index, 'e,item,index');
728
+      let params = {
729
+        id: this.id,
730
+        project_id: item.id,
731
+        device_id: _id
712
       }
732
       }
733
+      api.device_change(params).then(res => {
734
+        if (res.code == 200) {
735
+          this.$message({
736
+            message: `${res.msg}`,
737
+            type: "success"
738
+          });
739
+          this.getOrderInfo()
740
+        }
741
+      })
742
+    },
743
+    isSelectCard (item, index) {
744
+      let isSelect = false
745
+      let isRepeat = false
713
       this.isSelectCoup.forEach(e => {
746
       this.isSelectCoup.forEach(e => {
714
         if (item.project_ids.indexOf(e.projectids) > -1) {
747
         if (item.project_ids.indexOf(e.projectids) > -1) {
715
           isSelect = true
748
           isSelect = true
@@ -720,15 +753,27 @@ export default {
720
         return
753
         return
721
       }
754
       }
722
       console.log(item);
755
       console.log(item);
756
+      this.cardList.forEach(res => {
757
+        if (res.isSelect && item.id != res.id && JSON.stringify(item.project_ids) == JSON.stringify(res.project_ids)) {
758
+          isRepeat = true
759
+          return
760
+        }
761
+      })
762
+      if (isRepeat) {
763
+        this.$message.error("不能选择相同的次卡");
764
+        return
765
+      }
723
       this.cardList[index].isSelect = !this.cardList[index].isSelect
766
       this.cardList[index].isSelect = !this.cardList[index].isSelect
767
+
724
     },
768
     },
725
     //确定选择的次卡
769
     //确定选择的次卡
726
     isCardAdd () {
770
     isCardAdd () {
727
       let isSelectCardList = []
771
       let isSelectCardList = []
728
       let project_list = this.order_data.project_list
772
       let project_list = this.order_data.project_list
773
+      let price = this.order_data.price
729
       let card_data = []
774
       let card_data = []
730
-       let price =this.order_data.price
731
-        console.log(price,'price');
775
+      let card_data_info = {}
776
+      console.log(price, 'price');
732
       if (this.isSelectCoup.length > 0) {
777
       if (this.isSelectCoup.length > 0) {
733
         this.isSelectCoup.forEach(res => {
778
         this.isSelectCoup.forEach(res => {
734
           this.order_data.project_list.forEach(item => {
779
           this.order_data.project_list.forEach(item => {
@@ -738,42 +783,43 @@ export default {
738
           })
783
           })
739
         })
784
         })
740
       }
785
       }
741
-      project_list.forEach(res => {
786
+      console.log(price, 'pricepriceprice3');
787
+
788
+      project_list.forEach((res,index) => {
742
         this.cardList.forEach(e => {
789
         this.cardList.forEach(e => {
743
           if (e.isSelect && e.project_ids.indexOf(res.id) > -1) {
790
           if (e.isSelect && e.project_ids.indexOf(res.id) > -1) {
744
             price = price - res.price
791
             price = price - res.price
792
+            console.log(price);
745
             price = price.toFixed(2)
793
             price = price.toFixed(2)
746
             isSelectCardList.push(res)
794
             isSelectCardList.push(res)
747
-          }
748
-        })
749
-      })
750
-      isSelectCardList.forEach(e => {
751
-        this.cardList.forEach(res => {
752
-          let card_data_info = {}
753
-          if (res.isSelect, res.project_ids.indexOf(e.id) > -1) {
754
             card_data_info = {
795
             card_data_info = {
755
-              id: e.id,
756
-              card_id: res.id
796
+              id: res.id,
797
+              card_id: e.id
757
             }
798
             }
758
             card_data.push(card_data_info)
799
             card_data.push(card_data_info)
759
           }
800
           }
760
         })
801
         })
761
       })
802
       })
762
-       if (isSelectCardList.length==0&&this.isSelectCoup.length==0) {
763
-        price = price- this.order_data.discountPrice
764
-       }
765
 
803
 
766
-      this.card_data = card_data
804
+
805
+      if (isSelectCardList.length == 0 && this.isSelectCoup.length == 0 && this.order_data.project_list.length > 2) {
806
+        price = price - this.order_data.discountPrice
807
+      }
808
+
809
+      console.log(price, 'pricepriceprice');
767
       if (price < 0) {
810
       if (price < 0) {
768
         price = 0
811
         price = 0
769
       }
812
       }
770
       // if (this.isSelectCoup.length > 0) {
813
       // if (this.isSelectCoup.length > 0) {
771
-        this.showMoney = price
814
+      this.showMoney = price
815
+      this.discountPrice = price
816
+      this.card_data = card_data
772
       // } else {
817
       // } else {
773
       //   this.discountPrice = price
818
       //   this.discountPrice = price
774
       // }
819
       // }
775
       this.isSelectCardList = isSelectCardList
820
       this.isSelectCardList = isSelectCardList
776
       this.isCard = false
821
       this.isCard = false
822
+      this.calculateMoney()
777
     },
823
     },
778
     getProjectClassify () {
824
     getProjectClassify () {
779
       api.projectClassify({ user_id: this.userInfo.user_id }).then(res => {
825
       api.projectClassify({ user_id: this.userInfo.user_id }).then(res => {
@@ -956,12 +1002,12 @@ export default {
956
           this.getOrderInfo()
1002
           this.getOrderInfo()
957
           this.isTs = false
1003
           this.isTs = false
958
           this.isChange = false
1004
           this.isChange = false
959
-          if (type&&type=='delete') {
1005
+          if (type && type == 'delete') {
960
             this.order_data.project_list.splice(index, 1)
1006
             this.order_data.project_list.splice(index, 1)
961
-           this.$message({
962
-            message: '删除成功',
963
-            type: 'success'
964
-          });
1007
+            this.$message({
1008
+              message: '删除成功',
1009
+              type: 'success'
1010
+            });
965
           }
1011
           }
966
         }
1012
         }
967
       })
1013
       })
@@ -1079,11 +1125,11 @@ export default {
1079
         return res.isSelect == true
1125
         return res.isSelect == true
1080
       })
1126
       })
1081
       // 卡券,项目券数据包, id:订单项目ID, coupon_id:优惠券ID, 如:[{ "id": 1220, coupon_id: 199 }]isSelectCoup
1127
       // 卡券,项目券数据包, id:订单项目ID, coupon_id:优惠券ID, 如:[{ "id": 1220, coupon_id: 199 }]isSelectCoup
1082
-      this.discount = this.card_data.length>0?0:this.discount
1128
+      this.discountList = this.card_data.length > 0 ? 0 : this.discountList
1083
       let params = {
1129
       let params = {
1084
         id: this.id,
1130
         id: this.id,
1085
         pay_way: payWayList[0].pay_way,
1131
         pay_way: payWayList[0].pay_way,
1086
-        discount: this.discount
1132
+        discountList: this.discountList
1087
       }
1133
       }
1088
 
1134
 
1089
       let coupon_data = []
1135
       let coupon_data = []
@@ -1174,10 +1220,12 @@ export default {
1174
       })
1220
       })
1175
       let isReturn = false
1221
       let isReturn = false
1176
       this.isSelectCardList.forEach(value => {
1222
       this.isSelectCardList.forEach(value => {
1177
-        if (item.project_ids.indexOf(value.id) > -1) {
1223
+        console.log(value, 'value');
1224
+        if (value.id && item.project_ids.indexOf(value.id) > -1) {
1178
           isReturn = true
1225
           isReturn = true
1179
         }
1226
         }
1180
       })
1227
       })
1228
+      console.log(isReturn, item.type, this.card_data.length);
1181
       if (isReturn || (item.type != 4 && this.card_data.length != 0)) {
1229
       if (isReturn || (item.type != 4 && this.card_data.length != 0)) {
1182
         this.$message.error('该项目已选择次卡');
1230
         this.$message.error('该项目已选择次卡');
1183
         return
1231
         return
@@ -1290,11 +1338,12 @@ export default {
1290
                   // isSelectCoup.
1338
                   // isSelectCoup.
1291
                   productDiscount[k].isSelect = false
1339
                   productDiscount[k].isSelect = false
1292
                   // isSelectCoup.splice(isSelectCoup.length-1,1);
1340
                   // isSelectCoup.splice(isSelectCoup.length-1,1);
1293
-                  this.isSelectCoup.forEach((items, index) => {
1294
-                    if (items.id == productDiscount[k].id) {
1295
-                      this.isSelectCoup.splice(index, 1)
1296
-                    }
1297
-                  })
1341
+                  // this.isSelectCoup.forEach((items, index) => {
1342
+                  //   if (items.id == productDiscount[k].id) {
1343
+                  //     console.log(items.id,'items.id');
1344
+                  //     this.isSelectCoup.splice(index, 1)
1345
+                  //   }
1346
+                  // })
1298
                   this.$message.error('没有适合的项目!');
1347
                   this.$message.error('没有适合的项目!');
1299
                 }
1348
                 }
1300
               }
1349
               }
@@ -1323,45 +1372,141 @@ export default {
1323
           _price = _price + Number(res.price)
1372
           _price = _price + Number(res.price)
1324
         })
1373
         })
1325
       }
1374
       }
1326
-      console.log(this.order_data.original_price,_price,'_price_price');
1375
+      console.log(this.order_data.original_price, _price, '_price_price');
1327
       let money = this.isSelectCardList.length > 0 ? this.order_data.original_price - _price : Number(this.order_data.original_price)
1376
       let money = this.isSelectCardList.length > 0 ? this.order_data.original_price - _price : Number(this.order_data.original_price)
1328
-      console.log(money,'========');
1377
+      console.log(money, '========');
1329
       let isSelectCoup = this.isSelectCoup
1378
       let isSelectCoup = this.isSelectCoup
1330
       let project_list = this.order_data.project_list //这里是项目列表
1379
       let project_list = this.order_data.project_list //这里是项目列表
1331
 
1380
 
1332
-      if (isSelectCoup.length == 0) {
1333
-        this.showMoney = money.toFixed(2)
1334
-        return
1335
-      }
1336
 
1381
 
1337
       // 如果是项目
1382
       // 如果是项目
1338
-      if (isSelectCoup[0].type == 4) {
1339
-        for (let i = 0; i < project_list.length; i++) {
1340
-          if (project_list[i].cardId) {
1383
+      if (this.isSelectCoup.length > 0) {
1384
+
1385
+        if (isSelectCoup[0].type == 4) {
1386
+          for (let i = 0; i < project_list.length; i++) {
1387
+            if (project_list[i].cardId) {
1388
+              money = money - Number(project_list[i].price)
1389
+            }
1390
+          }
1391
+          this.showMoney = money.toFixed(2)
1392
+          console.log(this.showMoney, 'this.showMoney');
1393
+        } else if (isSelectCoup[0].type == 3) {
1394
+          for (let i = 0; i < project_list.length; i++) {
1341
             money = money - Number(project_list[i].price)
1395
             money = money - Number(project_list[i].price)
1342
           }
1396
           }
1397
+        } else {
1398
+          money = money - Number(isSelectCoup[0].price)
1343
         }
1399
         }
1344
-        this.showMoney = money.toFixed(2)
1345
-        console.log(this.showMoney, 'this.showMoney');
1346
-        if (this.order_data.project_list.length - this.isSelectCoup.length >= 3) {
1347
-          console.log(money, 'money');
1348
-          money = (money * 0.8).toFixed(2)
1349
-          console.log(money, 'money');
1400
+      }
1350
 
1401
 
1351
-        }
1352
-      } else if (isSelectCoup[0].type == 3) {
1353
-        for (let i = 0; i < project_list.length; i++) {
1354
-          money = money - Number(project_list[i].price)
1355
-        }
1402
+      console.log(this.showMoney, 'showMoney', money);
1356
 
1403
 
1357
-      } else {
1358
-        money = money - Number(isSelectCoup[0].price)
1404
+
1405
+      /**
1406
+     * type:1项目,2设备分类,3耗材
1407
+     * discount_type:折扣条件,1数量/类型,2金额
1408
+     */
1409
+      let notSelectId = []
1410
+      this.isSelectCoup.forEach(item => {
1411
+        notSelectId.push(item.projectids)
1412
+      })
1413
+      let cardIdList = []
1414
+      this.isSelectCardList.forEach(res=>{
1415
+        cardIdList.push(res.id)
1416
+      })
1417
+      //去除选择优惠券或者次卡的项目
1418
+      let _project_list = project_list.filter(res => {
1419
+
1420
+        return notSelectId.toString().indexOf(res.id)<0 && cardIdList.toString().indexOf(res.id)<0
1421
+      })
1422
+      console.log(_project_list,'_project_list');
1423
+      let devicePrice = 0 //满足折扣设备的项目总金额
1424
+      let productPrice = 0 //耗材总金额
1425
+      //满足折扣设备的项目
1426
+      let deviceList = _project_list.filter(item => {
1427
+        return item.device_type_id == item.device_id
1428
+      })
1429
+      if (deviceList.length > 0) {
1430
+        deviceList.forEach(item => {
1431
+          devicePrice = devicePrice + Number(item.price)
1432
+        })
1359
       }
1433
       }
1360
-      console.log(this.showMoney, 'showMoney', money);
1361
-      this.showMoney = money < 0 ? 0 : money
1362
-    },
1434
+      //拥有耗材的项目
1435
+      let productList = _project_list.filter(item => {
1436
+        return item.product_name != ""
1437
+      })
1438
+      if (productList.length > 0) {
1439
+        productList.forEach(item => {
1440
+          productPrice = productPrice + Number(item.product_price)
1441
+        })
1442
+      }
1443
+      if (this.discountList.length > 0) {
1444
+        let discountList = this.discountList
1445
+        //计算所有的折扣金额
1446
+        discountList.forEach(item => {
1447
+          let priceSet = 0,
1448
+            initmoney = money,
1449
+            _initmoney = money
1450
+          if (item.type == 1 && item.discount_type == 1 && _project_list.length >= item.num) {
1451
+            initmoney = initmoney * item.discount_rate / 10
1452
+            priceSet = _initmoney - initmoney
1453
+            item["priceSet"] = priceSet
1454
+          } else if (item.type == 1 && item.discount_type == 2 && money > Number(item.amount)) {
1455
+            initmoney = initmoney * item.discount_rate / 10
1456
+            priceSet = _initmoney - initmoney
1457
+            item["priceSet"] = priceSet
1458
+          } else if (item.type == 2 && item.discount_type == 2 && devicePrice > Number(item.amount)) {
1459
+            //满足条件的项目折扣
1460
+            initmoney = (initmoney - devicePrice) + devicePrice * item.discount_rate / 10
1461
+            priceSet = _initmoney - initmoney
1462
+            item["priceSet"] = priceSet
1363
 
1463
 
1464
+          } else if (item.type == 3 && item.discount_type == 1 && productList.length >= item.num) {
1465
+            //满足条件的项目折扣
1466
+            initmoney = (initmoney - productPrice) + productPrice * item.discount_rate / 10
1467
+            priceSet = _initmoney - initmoney
1468
+            item["priceSet"] = priceSet
1364
 
1469
 
1470
+          } else if (item.type == 3 && item.discount_type == 2 && productPrice >= item.amount) {
1471
+            //满足条件的项目折扣
1472
+            initmoney = (initmoney - productPrice) + productPrice * item.discount_rate / 10
1473
+            priceSet = _initmoney - initmoney
1474
+            item["priceSet"] = priceSet
1475
+          }
1476
+        })
1477
+        console.log(discountList, 'discountList');
1478
+        //排序,最优折扣放第一位
1479
+        discountList = discountList.sort(this.compare("priceSet"))
1480
+
1481
+        let discountInfo = discountList[0]
1482
+
1483
+        if (discountInfo.type == 1 && discountInfo.discount_type == 1 && _project_list.length >= discountInfo.num) {
1484
+          money = money * discountInfo.discount_rate / 10
1485
+        } else if (discountInfo.type == 1 && discountInfo.discount_type == 2 && money > Number(discountInfo.amount)) {
1486
+          money = money * discountInfo.discount_rate / 10
1487
+        } else if (discountInfo.type == 2 && discountInfo.discount_type == 2 && devicePrice > Number(discountInfo.amount)) {
1488
+          //满足条件的项目折扣
1489
+          money = (money - devicePrice) + devicePrice * discountInfo.discount_rate / 10
1490
+        } else if (discountInfo.type == 3 && discountInfo.discount_type == 1 && productList.length >= discountInfo.num) {
1491
+          //满足条件的项目折扣
1492
+          money = (money - productPrice) + productPrice * discountInfo.discount_rate / 10
1493
+        } else if (discountInfo.type == 3 && discountInfo.discount_type == 2 && productPrice >= discountInfo.amount) {
1494
+          //满足条件的项目折扣
1495
+          money = (money - productPrice) + productPrice * discountInfo.discount_rate / 10
1496
+        }
1497
+      }
1498
+
1499
+      this.showMoney = money.toFixed(2) < 0 ? 0.00 : money.toFixed(2)
1500
+    },
1501
+
1502
+    //排序
1503
+    compare (property) {
1504
+      return function (obj1, obj2) {
1505
+        var value1 = obj1[property];
1506
+        var value2 = obj2[property];
1507
+        return value2 - value1; // 降序
1508
+      }
1509
+    },
1365
     changeActive (e) {
1510
     changeActive (e) {
1366
       this.active = e
1511
       this.active = e
1367
     },
1512
     },
@@ -1398,7 +1543,7 @@ export default {
1398
     //获取订单折扣类型
1543
     //获取订单折扣类型
1399
     getOrderDiscount () {
1544
     getOrderDiscount () {
1400
       api.getOrderDiscount({ id: this.id }).then(res => {
1545
       api.getOrderDiscount({ id: this.id }).then(res => {
1401
-        this.discount = res.data.discount
1546
+        this.discountList = res.data.list
1402
         this.getOrderInfo()
1547
         this.getOrderInfo()
1403
       })
1548
       })
1404
     },
1549
     },
@@ -1803,6 +1948,7 @@ export default {
1803
               line-height: 18px;
1948
               line-height: 18px;
1804
             }
1949
             }
1805
             .project-zoom {
1950
             .project-zoom {
1951
+              margin-top: 8px;
1806
               font-size: 14px;
1952
               font-size: 14px;
1807
               font-family: PingFangSC-Regular, PingFang SC;
1953
               font-family: PingFangSC-Regular, PingFang SC;
1808
               font-weight: 400;
1954
               font-weight: 400;
@@ -1817,6 +1963,9 @@ export default {
1817
               .delete {
1963
               .delete {
1818
                 margin-left: 10px;
1964
                 margin-left: 10px;
1819
               }
1965
               }
1966
+              /deep/ .el-input__inner {
1967
+                color: #fa7d22;
1968
+              }
1820
             }
1969
             }
1821
           }
1970
           }
1822
         }
1971
         }

+ 42 - 19
src/pages/customerMan/details/index.vue

@@ -4,33 +4,49 @@
4
       <div class="user-info">
4
       <div class="user-info">
5
         <div class="title">
5
         <div class="title">
6
           <div class="txt">个人信息</div>
6
           <div class="txt">个人信息</div>
7
-          <div class="test-record" @click="toTestRecord" v-if="userInfo.analysis_id">测肤记录</div>
7
+          <div class="test-record"
8
+               @click="toTestRecord"
9
+               v-if="userInfo.analysis_id">测肤记录</div>
8
         </div>
10
         </div>
9
         <div class="detail-info">
11
         <div class="detail-info">
10
           <div class="user-img">
12
           <div class="user-img">
11
-            <img :src="userInfo.avatar_url" alt="">
13
+            <img :src="userInfo.avatar_url"
14
+                 alt="">
12
           </div>
15
           </div>
13
           <div class="user-span">
16
           <div class="user-span">
14
             <div class="info">
17
             <div class="info">
15
-              <div class="name"><span>{{userInfo.nickname}}</span></div>
18
+              <div class="name"><span>{{userInfo.nickname | ellipsis(3)}}</span></div>
16
               <div class="sex"><img :src="gender"
19
               <div class="sex"><img :src="gender"
17
-                    alt=""></div>
18
-              <div class="age"><span>{{userInfo.skin_age}}</span><span>肤龄</span></div>
20
+                     alt=""></div>
21
+              <div class="age"><span>{{userInfo.skin_age}}</span><span class="min-size">肤龄</span></div>
19
             </div>
22
             </div>
20
             <div class="real-name">姓名:
23
             <div class="real-name">姓名:
21
               <span v-show="!nameInpVisible">{{userInfo.real_name}}</span>
24
               <span v-show="!nameInpVisible">{{userInfo.real_name}}</span>
22
-              <el-input size="mini" ref="realNameInp" v-show="nameInpVisible" @change="updateRealName" v-model="userInfo.real_name" type="text"></el-input>
23
-              <img class="edit-name" @click="editName" src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/eidt.png" alt="" srcset="">
25
+              <el-input size="mini"
26
+                        ref="realNameInp"
27
+                        v-show="nameInpVisible"
28
+                        @change="updateRealName"
29
+                        v-model="userInfo.real_name"
30
+                        type="text"></el-input>
31
+              <img class="edit-name"
32
+                   @click="editName"
33
+                   src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/eidt.png"
34
+                   alt=""
35
+                   srcset="">
24
             </div>
36
             </div>
25
             <div class="skin-type">肤质:<span>{{userInfo.skin_type}}</span></div>
37
             <div class="skin-type">肤质:<span>{{userInfo.skin_type}}</span></div>
26
             <div class="skin-color">肤色:<span>{{userInfo.skin_color}}</span></div>
38
             <div class="skin-color">肤色:<span>{{userInfo.skin_color}}</span></div>
27
-            <div class="skin-color">上传报告时间:<span>{{userInfo.check_time}}</span></div>
39
+
28
           </div>
40
           </div>
29
         </div>
41
         </div>
30
       </div>
42
       </div>
31
 
43
 
32
       <div class="personage-data">
44
       <div class="personage-data">
33
         <div class="myDataList">
45
         <div class="myDataList">
46
+          上传报告时间:
47
+          <span>{{userInfo.check_time}}</span>
48
+        </div>
49
+        <div class="myDataList">
34
           出生日期:
50
           出生日期:
35
           <span>{{userInfo.birthday}}</span>
51
           <span>{{userInfo.birthday}}</span>
36
         </div>
52
         </div>
@@ -49,6 +65,11 @@
49
           <span>{{userInfo.store_name}}</span>
65
           <span>{{userInfo.store_name}}</span>
50
         </div>
66
         </div>
51
 
67
 
68
+         <div class="myDataList coupon-num">
69
+          次卡数量:
70
+          <span>{{order_total.card_order}}</span>
71
+        </div>
72
+
52
         <div class="myDataList coupon-num">
73
         <div class="myDataList coupon-num">
53
           优惠券数量:
74
           优惠券数量:
54
           <span>{{userInfo.card_num}}</span>
75
           <span>{{userInfo.card_num}}</span>
@@ -66,7 +87,8 @@
66
           积分:
87
           积分:
67
           <span>{{userInfo.coin}}</span>
88
           <span>{{userInfo.coin}}</span>
68
         </div>
89
         </div>
69
-        <div class="myDataList" @click="remarkPupopVisible=true">
90
+        <div class="myDataList"
91
+             @click="remarkPupopVisible=true">
70
           备注:
92
           备注:
71
           <span>{{userInfo.remark | ellipsis(20)}}</span>
93
           <span>{{userInfo.remark | ellipsis(20)}}</span>
72
         </div>
94
         </div>
@@ -169,7 +191,7 @@
169
         </div>
191
         </div>
170
       </div>
192
       </div>
171
     </div>
193
     </div>
172
-        <!-- 备注 -->
194
+    <!-- 备注 -->
173
     <mine-pupop :show="remarkPupopVisible">
195
     <mine-pupop :show="remarkPupopVisible">
174
       <div class="block">
196
       <div class="block">
175
         <div class="delete-pupop"
197
         <div class="delete-pupop"
@@ -183,7 +205,8 @@
183
                   placeholder="备注"
205
                   placeholder="备注"
184
                   v-model="userInfo.remark"></textarea>
206
                   v-model="userInfo.remark"></textarea>
185
         <div class="noticeSubmit">
207
         <div class="noticeSubmit">
186
-          <div class="submit-notice" @click="submitRemark">确定</div>
208
+          <div class="submit-notice"
209
+               @click="submitRemark">确定</div>
187
         </div>
210
         </div>
188
       </div>
211
       </div>
189
     </mine-pupop>
212
     </mine-pupop>
@@ -332,7 +355,7 @@ export default {
332
       this.nameInpVisible = true
355
       this.nameInpVisible = true
333
       this.$refs.realNameInp.focus()
356
       this.$refs.realNameInp.focus()
334
     },
357
     },
335
-    async updateRealName() {
358
+    async updateRealName () {
336
       let resp = await api.updateUserProfile({
359
       let resp = await api.updateUserProfile({
337
         id: this.id,
360
         id: this.id,
338
         real_name: this.userInfo.real_name
361
         real_name: this.userInfo.real_name
@@ -396,7 +419,7 @@ export default {
396
         }
419
         }
397
         .test-record {
420
         .test-record {
398
           font-size: 12px;
421
           font-size: 12px;
399
-          color: #FA7D22;
422
+          color: #fa7d22;
400
         }
423
         }
401
       }
424
       }
402
       .detail-info {
425
       .detail-info {
@@ -410,6 +433,7 @@ export default {
410
           }
433
           }
411
         }
434
         }
412
         .user-span {
435
         .user-span {
436
+          flex: 1;
413
           margin-left: 12px;
437
           margin-left: 12px;
414
 
438
 
415
           span {
439
           span {
@@ -420,7 +444,7 @@ export default {
420
             justify-content: space-between;
444
             justify-content: space-between;
421
 
445
 
422
             .name {
446
             .name {
423
-              font-size: 16px;
447
+              font-size: 14px;
424
             }
448
             }
425
             .sex {
449
             .sex {
426
               img {
450
               img {
@@ -429,9 +453,9 @@ export default {
429
               }
453
               }
430
             }
454
             }
431
             .age {
455
             .age {
432
-              margin-left: 13px;
456
+              margin-left: 4px;
433
               span:nth-child(1) {
457
               span:nth-child(1) {
434
-                font-size: 22px;
458
+                font-size: 14px;
435
               }
459
               }
436
               span:nth-child(2) {
460
               span:nth-child(2) {
437
                 margin-left: 4px;
461
                 margin-left: 4px;
@@ -460,7 +484,7 @@ export default {
460
       }
484
       }
461
     }
485
     }
462
     .personage-data {
486
     .personage-data {
463
-      margin-top: 30px;
487
+      margin-top: 14px;
464
       .myDataList {
488
       .myDataList {
465
         margin-top: 15px;
489
         margin-top: 15px;
466
         .bigSixe {
490
         .bigSixe {
@@ -476,7 +500,7 @@ export default {
476
       }
500
       }
477
       .coupon-num {
501
       .coupon-num {
478
         span {
502
         span {
479
-          color: #FA7D22;
503
+          color: #fa7d22;
480
           font-size: 16px;
504
           font-size: 16px;
481
           font-weight: 500;
505
           font-weight: 500;
482
         }
506
         }
@@ -911,7 +935,6 @@ export default {
911
       justify-content: center;
935
       justify-content: center;
912
     }
936
     }
913
 
937
 
914
-
915
     .submit-notice {
938
     .submit-notice {
916
       width: 100px;
939
       width: 100px;
917
       height: 29px;
940
       height: 29px;

+ 69 - 4
src/pages/historicalOrder/details/index.vue

@@ -80,7 +80,22 @@
80
                 </div>
80
                 </div>
81
               </div>
81
               </div>
82
               <div class="project-tips">{{item.product_names}}</div>
82
               <div class="project-tips">{{item.product_names}}</div>
83
-              <div class="project-zoom">{{item.room}}{{item.use_time}}分钟</div>
83
+              <div class="project-zoom">
84
+                <el-select v-model="item.tot_name"
85
+                           v-if="order_data.status<3"
86
+                           @visible-change="openList($event,item,index)"
87
+                           @change="changeRoom($event,item,index)"
88
+                           size="mini"
89
+                           style="min-width: 150px;"
90
+                           :placeholder="item.tot_name">
91
+                  <el-option v-for="i in roomList"
92
+                             :key="i.id"
93
+                             :label="i.tot_name"
94
+                             :value="i.tot_name">
95
+                  </el-option>
96
+                </el-select>
97
+                <div v-else>{{item.tot_name}}</div>
98
+              </div>
84
             </div>
99
             </div>
85
           </div>
100
           </div>
86
         </div>
101
         </div>
@@ -99,7 +114,8 @@
99
                      alt />
114
                      alt />
100
               </div>
115
               </div>
101
               <div class="coupon-title">次卡</div>
116
               <div class="coupon-title">次卡</div>
102
-              <div class="coupon-tip" v-if="coupon_list.length>0">已选择次卡</div>
117
+              <div class="coupon-tip"
118
+                   v-if="coupon_list.length>0">已选择次卡</div>
103
             </div>
119
             </div>
104
             <div class="on-icon">></div>
120
             <div class="on-icon">></div>
105
           </div>
121
           </div>
@@ -117,7 +133,8 @@
117
                      alt />
133
                      alt />
118
               </div>
134
               </div>
119
               <div class="coupon-title">优惠卷</div>
135
               <div class="coupon-title">优惠卷</div>
120
-              <div class="coupon-tip" v-if="coupon_list.length>0">已选推荐优惠</div>
136
+              <div class="coupon-tip"
137
+                   v-if="coupon_list.length>0">已选推荐优惠</div>
121
             </div>
138
             </div>
122
             <div class="on-icon">></div>
139
             <div class="on-icon">></div>
123
           </div>
140
           </div>
@@ -139,7 +156,6 @@
139
     </div>
156
     </div>
140
   </div>
157
   </div>
141
 </template>
158
 </template>
142
-
143
 <script>
159
 <script>
144
 import api from "../../../server/home";
160
 import api from "../../../server/home";
145
 export default {
161
 export default {
@@ -160,6 +176,7 @@ export default {
160
       isPupop: false,
176
       isPupop: false,
161
       id: "",
177
       id: "",
162
       problem: '',
178
       problem: '',
179
+      roomList: [],//设备房间列表
163
     };
180
     };
164
   },
181
   },
165
   computed: {
182
   computed: {
@@ -176,6 +193,9 @@ export default {
176
     getOrderInfo () {
193
     getOrderInfo () {
177
       api.getOrderInfo({ id: this.id }).then(res => {
194
       api.getOrderInfo({ id: this.id }).then(res => {
178
         this.userInfo = res.data.user;
195
         this.userInfo = res.data.user;
196
+        res.data.order_data.project_list.forEach(e => {
197
+          e["tot_name"] = `${e.device_name}(${e.room})`
198
+        })
179
         this.order_data = res.data.order_data;
199
         this.order_data = res.data.order_data;
180
         this.problem = res.data.skin_name
200
         this.problem = res.data.skin_name
181
         let _problem = []
201
         let _problem = []
@@ -193,6 +213,48 @@ export default {
193
       });
213
       });
194
     },
214
     },
195
 
215
 
216
+    openList (e, item, index) {
217
+      console.log(e, item, index, 'e,item,index');
218
+      if (e) {
219
+        this.value = ''
220
+        this.roomList = []
221
+        let params = {
222
+          id: this.id,
223
+          project_id: item.id
224
+        }
225
+        api.getDevice_list(params).then(res => {
226
+          if (res.code == 200) {
227
+            res.data.list.forEach(item => {
228
+              item['tot_name'] = `${item.name}(${item.room})`
229
+            })
230
+            this.roomList = res.data.list
231
+          }
232
+        })
233
+      }
234
+    },
235
+    changeRoom (e, item, index) {
236
+      let _id = 0
237
+      this.roomList.forEach(res => {
238
+        if (res.tot_name == e) {
239
+          _id = res.id
240
+        }
241
+      })
242
+      console.log(e, item, index, 'e,item,index');
243
+      let params = {
244
+        id: this.id,
245
+        project_id: item.id,
246
+        device_id: _id
247
+      }
248
+      api.device_change(params).then(res => {
249
+        if (res.code == 200) {
250
+          this.$message({
251
+            message: `${res.msg}`,
252
+            type: "success"
253
+          });
254
+          this.getOrderInfo()
255
+        }
256
+      })
257
+    },
196
     onOperation (index) {
258
     onOperation (index) {
197
       if (this.programmeList[index].onSelect) {
259
       if (this.programmeList[index].onSelect) {
198
         this.$set(
260
         this.$set(
@@ -579,6 +641,9 @@ export default {
579
               font-weight: 400;
641
               font-weight: 400;
580
               color: #fa7d22;
642
               color: #fa7d22;
581
               line-height: 18px;
643
               line-height: 18px;
644
+              /deep/ .el-input__inner {
645
+                color: #fa7d22;
646
+              }
582
             }
647
             }
583
           }
648
           }
584
         }
649
         }

+ 1 - 0
src/pages/home/detailList/index.vue

@@ -138,6 +138,7 @@ export default {
138
         border-bottom: 2px #f5f5f5 solid;
138
         border-bottom: 2px #f5f5f5 solid;
139
       }
139
       }
140
       .project-wrapper {
140
       .project-wrapper {
141
+        flex: 1;
141
         display: flex;
142
         display: flex;
142
         flex-wrap: wrap;
143
         flex-wrap: wrap;
143
         .project {
144
         .project {

+ 6 - 0
src/server/home.js

@@ -81,6 +81,12 @@ export default class Home {
81
   static addUpdate (parms) {
81
   static addUpdate (parms) {
82
     return $http.post(url.addUpdate, parms);
82
     return $http.post(url.addUpdate, parms);
83
   }
83
   }
84
+  static getDevice_list (parms) {
85
+    return $http.get(url.getDevice_list, parms);
86
+  }
87
+  static device_change (parms) {
88
+    return $http.post(url.device_change, parms);
89
+  }
84
 
90
 
85
   // 获取历史订单
91
   // 获取历史订单
86
   static getOrderList (parms) {
92
   static getOrderList (parms) {

+ 5 - 1
src/server/urls.js

@@ -38,7 +38,7 @@ export default {
38
   //支付状态
38
   //支付状态
39
   payStatus: '/v2/pad/order/pay_status',
39
   payStatus: '/v2/pad/order/pay_status',
40
   //活动折扣
40
   //活动折扣
41
-  getOrderDiscount: '/v2/pad/order/discount',
41
+  getOrderDiscount: '/v3/pad/order/discount',
42
   //获取项目分类
42
   //获取项目分类
43
   projectClassify: '/v2/pad/project/classify',
43
   projectClassify: '/v2/pad/project/classify',
44
   //删除项目和耗材
44
   //删除项目和耗材
@@ -55,6 +55,10 @@ export default {
55
   cardUpdate:'/v2/pad/card/update',
55
   cardUpdate:'/v2/pad/card/update',
56
   //获取项目可用的次卡
56
   //获取项目可用的次卡
57
   getOrderCard:'/v2/pad/order/card',
57
   getOrderCard:'/v2/pad/order/card',
58
+  //获取可更换的设备
59
+  getDevice_list:'/v2/pad/order/device_list',
60
+  //更改设备
61
+  device_change:'/v2/pad/order/device_change',
58
 
62
 
59
   /**
63
   /**
60
    *  by ListKer
64
    *  by ListKer

+ 4 - 4
vue.config.js

@@ -4,11 +4,11 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
 
4
 
5
 module.exports = {
5
 module.exports = {
6
   // 测试
6
   // 测试
7
-  publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/test_pad/dist' :
8
-    process.env.env_config === 'test' ? '/vapps/calory/' : '/dist/',
9
-  // 正式
10
-  // publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/dist' :
7
+  // publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/test_pad/dist' :
11
   //   process.env.env_config === 'test' ? '/vapps/calory/' : '/dist/',
8
   //   process.env.env_config === 'test' ? '/vapps/calory/' : '/dist/',
9
+  // 正式
10
+  publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/dist' :
11
+    process.env.env_config === 'test' ? '/vapps/calory/' : '/dist/',
12
   // 设置跨域
12
   // 设置跨域
13
   crossorigin: 'anonymous',
13
   crossorigin: 'anonymous',
14
   /**
14
   /**