Browse Source

会员和协议单位价格计算

gqx 2 years ago
parent
commit
39b279421c
1 changed files with 85 additions and 7 deletions
  1. 85 7
      src/views/room/modules/checkIn/BillRoomForm.vue

+ 85 - 7
src/views/room/modules/checkIn/BillRoomForm.vue

@@ -502,6 +502,7 @@
                       placeholder="会员"
                       option-label-prop="label"
                       v-model="model.orderInfo.vipCustomerId"
+                      @change="vipCustomerIdChange(model.orderInfo.vipCustomerId)"
                     >
                       <a-select-option
                         :key="item.id"
@@ -720,9 +721,6 @@
                               <a-select-option :value="1">
                                 押金
                               </a-select-option>
-                              <a-select-option :value="3">
-                                押金2
-                              </a-select-option>
                             </a-select>
                           </div>
                         </template>
@@ -1033,6 +1031,7 @@ export default {
           vipCustomerId: "",
           customerType: 1,
           contractTeamProtocolName: "",
+          customerSource: "",
         },
         roomIds: [],
         livingRoomDayPrices: [],
@@ -1224,6 +1223,7 @@ export default {
     // },
     cPhone: {
       handler: function (val, old) {
+        console.log(val, old);
         var index = this.model.roomIds.findIndex((t) => t.id == this.activeKey);
         if (index >= 0) {
           var find = this.model.roomIds[index];
@@ -1364,9 +1364,6 @@ export default {
     //  this.getcesRoomLayout();
   },
   methods: {
-    modalAgreementUnitTableOk(e) {
-      this.model.orderInfo.contractTeamProtocolName = e.name;
-    },
     contractTeamIdChange(e) {
       this.model.orderInfo.contractTeamId = e;
       getAction("/business/busMarketAgreementCustomer/list", {
@@ -1377,10 +1374,88 @@ export default {
           if (list && list.length > 0) {
             this.model.orderInfo.contractTeamProtocolName = list[0].name;
             this.model.orderInfo.contractTeamProtocolId = list[0].id;
+            var info = list[0];
+            if (info.fixedDiscount == 1 && info.discount > 0) {
+              if (this.model.roomPrices && this.model.roomPrices.length > 0) {
+                var i = 0;
+                this.model.roomPrices.forEach((t) => {
+                  t.prefPrice = (t.marketPrice * info.discount) / 100;
+                  t.roomFee = t.prefPrice * t.day;
+                  var editPrice = [];
+                  if (t.editPrice && t.editPrice.length > 0) {
+                    t.editPrice.forEach((p) => {
+                      editPrice.push(t.prefPrice);
+                    });
+                    t.editPrice = editPrice;
+                  }
+                  this.editPriceIndex = i;
+                  this.editPriceOk();
+                  i++;
+                  console.log("t", t);
+                });
+              }
+            }
           }
         }
       });
     },
+    vipCustomerIdChange(vipCustomerId) {
+      var find = this.busMemberCardList.find((t) => t.id == vipCustomerId);
+      getAction("/org.jeecg.modules.business/busMarketMember/queryById", {
+        id: find.gradeId,
+      }).then((res) => {
+        if (res.success) {
+          var info = res.result;
+          if (info) {
+            if (info.type == 0 && info.discount > 0) {
+              if (this.model.roomPrices && this.model.roomPrices.length > 0) {
+                var i = 0;
+                this.model.roomPrices.forEach((t) => {
+                  t.prefPrice = (t.marketPrice * info.discount) / 100;
+                  t.roomFee = t.prefPrice * t.day;
+                  var editPrice = [];
+                  if (t.editPrice && t.editPrice.length > 0) {
+                    t.editPrice.forEach((p) => {
+                      editPrice.push(t.prefPrice);
+                    });
+                    t.editPrice = editPrice;
+                  }
+                  this.editPriceIndex = i;
+                  this.editPriceOk();
+                  i++;
+                  console.log("t", t);
+                });
+              }
+            }
+          }
+        }
+      });
+    },
+    modalAgreementUnitTableOk(e) {
+      var info = e;
+      this.model.orderInfo.contractTeamProtocolName = info.name;
+      this.model.orderInfo.contractTeamProtocolId = info.id;
+      if (info.fixedDiscount == 1 && info.discount > 0) {
+        if (this.model.roomPrices && this.model.roomPrices.length > 0) {
+          var i = 0;
+          this.model.roomPrices.forEach((t) => {
+            t.prefPrice = (t.marketPrice * info.discount) / 100;
+            t.roomFee = t.prefPrice * t.day;
+            var editPrice = [];
+            if (t.editPrice && t.editPrice.length > 0) {
+              t.editPrice.forEach((p) => {
+                editPrice.push(t.prefPrice);
+              });
+              t.editPrice = editPrice;
+            }
+            this.editPriceIndex = i;
+            this.editPriceOk();
+            i++;
+            console.log("t", t);
+          });
+        }
+      }
+    },
     showRuZhuHistory(phone) {
       this.$refs.modalHistoryInfo.add(phone);
       this.$refs.modalHistoryInfo.title = "历史入住信息";
@@ -1851,6 +1926,7 @@ export default {
         roomIds: [...roomIds, ...newRoomIds],
         roomPrices: this.model.roomPrices,
         orderFees: this.model.orderFees,
+        orderInfo: this.model.orderInfo,
       });
       if (!this.otherRoomSync) {
         if (this.modelDefault.roomIds && this.modelDefault.roomIds.length > 0) {
@@ -1920,7 +1996,9 @@ export default {
         await this.getbusRoomPayType();
       }
       if (this.customerSourceList) {
-        this.model.orderInfo.customerSource = this.customerSourceList[0].id;
+        if (!this.model.orderInfo.customerSource) {
+          this.model.orderInfo.customerSource = this.customerSourceList[0].id;
+        }
       }
       if (this.model.roomIds && this.model.roomIds.length > 0) {
         this.activeKey = this.model.roomIds[0].id;