Bladeren bron

押金是否均摊计算,押金房费是否分开收款计算

gqx 2 jaren geleden
bovenliggende
commit
a1488a17d5
1 gewijzigde bestanden met toevoegingen van 84 en 4 verwijderingen
  1. 84 4
      src/views/room/modules/checkIn/BillRoomForm.vue

+ 84 - 4
src/views/room/modules/checkIn/BillRoomForm.vue

@@ -682,6 +682,9 @@
                               <a-select-option :value="1">
                                 押金
                               </a-select-option>
+                              <a-select-option :value="3">
+                                押金2
+                              </a-select-option>
                             </a-select>
                           </div>
                         </template>
@@ -708,7 +711,7 @@
                           <div>
                             <a-input-number
                               v-model="record.money"
-                              :min="1"
+                              :min="0"
                               @change="presetNumChange($event, record)"
                             />
                           </div>
@@ -717,9 +720,10 @@
                       <div
                         style="color: rgba(255, 141, 26, 1); font-weight: 200"
                       >
-                        <!-- <p style="margin-bottom: 2px">
-                          实收:支付宝600.00元;微信292.00元;现金1000.00元;会员卡400元。
-                        </p> -->
+                        <p style="margin-bottom: 2px">
+                          <template></template>
+                          实收:{{ orderFeesText }}
+                        </p>
                         <p style="margin-bottom: 2px">
                           合计实款:{{ orderFeesAmout.toFixed(2) }}
                         </p>
@@ -1101,6 +1105,81 @@ export default {
     orderFeesArrearsAmout() {
       return this.orderFeesAmout - this.amount;
     },
+    orderFeesText() {
+      var text = "";
+      this.model.orderFees.forEach((item) => {
+        var find = this.payTypeList.find((t) => t.id == item.payType);
+        if (find) {
+          text += find.name + ":" + item.money + "元;";
+        }
+      });
+      return text;
+    },
+  },
+  watch: {
+    depositSplit(value) {
+      if (!value) {
+        var yajin = this.model.roomPrices.reduce((sum, val) => {
+          let total = sum + val.deposit;
+          return isNaN(total) ? 0 : total;
+        }, 0);
+        this.model.roomPrices.forEach((t) => {
+          t.deposit = 0;
+        });
+        this.model.roomPrices[0].deposit = yajin;
+      } else {
+        this.model.roomPrices.forEach((t) => {
+          t.deposit = this.compuleDeposit(t.marketPrice);
+        });
+      }
+    },
+    paymentSplit(value) {
+      if (!value) {
+        var list2 = this.model.orderFees.filter(
+          (t) => t.subjectType == 2 && (!t.add || t.add != 1)
+        );
+        var list1 = this.model.orderFees.filter((t) => t.subjectType == 1);
+        var list = this.model.orderFees.filter(
+          (t) =>
+            (t.subjectType != 1 && t.subjectType != 2) || (t.add && t.add == 1)
+        );
+        list2.forEach((t) => {
+          var yjList = list1.filter((b) => b.roomId == t.roomId);
+          var yajin = yjList.reduce((sum, val) => {
+            let total = sum + val.money;
+            return isNaN(total) ? 0 : total;
+          }, 0);
+          t.yajing = yajin;
+          t.money += yajin;
+          t.receivable = t.money;
+        });
+        this.model.orderFees = [...list, ...list2];
+      } else {
+        var list2 = this.model.orderFees.filter(
+          (t) => t.subjectType == 2 && (!t.add || t.add != 1)
+        );
+        var list1 = [];
+
+        var list = this.model.orderFees.filter(
+          (t) =>
+            (t.subjectType != 1 && t.subjectType != 2) || (t.add && t.add == 1)
+        );
+        list2.forEach((t) => {
+          if (t.yajing && t.yajing > 0) {
+            t.money -= t.yajing;
+            t.receivable = t.money;
+            var item = JSON.parse(JSON.stringify(t));
+            item.subjectType = 1;
+            item.money = t.yajing;
+            item.yajing = 0;
+            item.receivable = item.money;
+            list1.push(item);
+          }
+        });
+        list = [...list, ...list1];
+        this.model.orderFees = [...list, ...list2];
+      }
+    },
   },
   created() {
     var _info = JSON.parse(localStorage.getItem("storeInfo"));
@@ -1508,6 +1587,7 @@ export default {
     pulsFee() {
       var payType = this.payTypeList[0];
       this.model.orderFees.push({
+        add: 1,
         subjectType: 2,
         subjectTypeLabel: "预收房费",
         payType: payType ? payType.id : "",