Просмотр исходного кода

结账退房时检查物品租借是否归还

gqx лет назад: 2
Родитель
Сommit
7886853f17
2 измененных файлов с 109 добавлено и 60 удалено
  1. 6 1
      src/views/room/leasegoods.vue
  2. 103 59
      src/views/room/modules/checkIn/BillRoomInfo.vue

+ 6 - 1
src/views/room/leasegoods.vue

@@ -215,7 +215,12 @@ export default {
   },
   methods: {
     handleAdd() {
-      this.$refs.modalForm.add(this.livingOrderId);
+      var id = null;
+      if (this.livingOrderId) {
+        var ids = this.livingOrderId.split(",");
+        id = ids[0];
+      }
+      this.$refs.modalForm.add(id);
       this.$refs.modalForm.title = "新增";
       this.$refs.modalForm.disableSubmit = false;
     },

+ 103 - 59
src/views/room/modules/checkIn/BillRoomInfo.vue

@@ -895,18 +895,28 @@ export default {
       this.$refs.modalSelectCheckInRoomOrder.livingRoomId = find.roomId;
     },
     addLeaseGoods() {
-      if (this.selectRoomId === "1") {
-        this.$message.warning("请先选择房间");
-        return;
-      }
+      // if (this.selectRoomId === "1") {
+      //   this.$message.warning("请先选择房间");
+      //   return;
+      // }
       var index = this.model.livingRoomIds.findLastIndex(
         (t) => t.roomId == this.selectRoomId
       );
       var find = this.model.livingRoomIds[index];
+      var livingOrderId = "";
+      if (find.roomId != "1") {
+        livingOrderId = find.livingOrder.id;
+      } else {
+        this.model.livingRoomIds
+          .filter((t) => t.roomId != "1")
+          .forEach((t) => {
+            livingOrderId += t.livingOrder.id + ",";
+          });
+      }
       this.$refs.modalLeaseGoods.add();
       this.$refs.modalLeaseGoods.title = "客人留言";
       this.$refs.modalLeaseGoods.disableSubmit = false;
-      this.$refs.modalLeaseGoods.livingOrderId = find.livingOrder.id;
+      this.$refs.modalLeaseGoods.livingOrderId = livingOrderId; //find.livingOrder.id;
     },
     addMessage() {
       if (this.selectRoomId === "1") {
@@ -1145,65 +1155,99 @@ export default {
       this.selectedRowKeys = selectedRowKeys;
       this.selectionRows = selectionRows;
     },
-    handleAdd() {
-      var list = this.paymentList.filter((t) => t.subjectType === 1);
-      var deposit = list.reduce(function (total, item) {
-        return total + item.money;
-      }, 0);
-
-      var list2 = this.paymentList.filter((t) => t.subjectType === 2);
-      var sum = list2.reduce(function (total, item) {
-        return total + item.money;
-      }, 0);
-
-      var list3 = this.feesList.filter((t) => t.subjectType === 3);
-      var sum2 = list3.reduce(function (total, item) {
-        return total + item.money;
-      }, 0);
+    async handleAdd() {
+      var that = this;
       var index = this.model.livingRoomIds.findLastIndex(
         (t) => t.roomId == this.selectRoomId
       );
       var livingRoom = this.model.livingRoomIds[index];
-      if (this.paymentAmount - this.feesAmount > 0) {
-        this.$refs.modalRefundForm.edit({
-          billRefund: this.paymentAmount - this.feesAmount,
-          deposit: deposit - (sum - sum2),
-          roomFee: sum - sum2,
-          money: this.paymentAmount - this.feesAmount,
-          subjectType: 5,
-          feeType: 2,
-          bookingOrderId: this.model.orderInfo.id,
-          livingOrderId:
-            livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
-          vipCustomerId: livingRoom.livingOrder.vipCustomerId,
-          contractTeamId: livingRoom.livingOrder.contractTeamId,
-          contractTeamProtocolId: livingRoom.livingOrder.contractTeamProtocolId,
-        });
-        this.$refs.modalRefundForm.title = "结账退款";
-        this.$refs.modalRefundForm.disableSubmit = false;
+      var livingOrderId = "";
+      if (livingRoom.roomId != "1") {
+        livingOrderId = livingRoom.livingOrder.id;
       } else {
-        this.$refs.modalPaymentForm.edit({
-          billAmount: parseFloat(
-            Math.abs(this.paymentAmount - this.feesAmount).toFixed(2)
-          ),
-          deposit: deposit - (sum - sum2),
-          roomFee: parseFloat(
-            Math.abs(this.paymentAmount - this.feesAmount).toFixed(2)
-          ),
-          subjectType: 5,
-          feeType: 2,
-          bookingOrderId: this.model.orderInfo.id,
-          livingOrderId:
-            livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
-          preferentialType: 1,
-          couponFirstAmount: 0,
-          discount: 9,
-          vipCustomerId: livingRoom.livingOrder.vipCustomerId,
-          contractTeamId: livingRoom.livingOrder.contractTeamId,
-          contractTeamProtocolId: livingRoom.livingOrder.contractTeamProtocolId,
-        });
-        this.$refs.modalPaymentForm.title = "结账收款";
-        this.$refs.modalPaymentForm.disableSubmit = false;
+        this.model.livingRoomIds
+          .filter((t) => t.roomId != "1")
+          .forEach((t) => {
+            livingOrderId += t.livingOrder.id + ",";
+          });
+      }
+      /*判断是否有租借物品未归还*/
+      var count = 0;
+      await getAction("/order/cesOrderLeaseGoods/checkReturnGoods", {
+        livingOrderId: livingOrderId,
+      }).then((res) => {
+        if (res.success) {
+          if (res.result && res.result > 0) {
+            count = res.result;
+            that.$confirm({
+              title: "提示",
+              content: "您还有" + count + "件物品未归还,是否跳转物品租借页面?",
+              onOk: function () {
+                that.addLeaseGoods();
+              },
+              onCancel() {},
+            });
+          }
+        }
+      });
+      if (count == 0) {
+        var list = this.paymentList.filter((t) => t.subjectType === 1);
+        var deposit = list.reduce(function (total, item) {
+          return total + item.money;
+        }, 0);
+
+        var list2 = this.paymentList.filter((t) => t.subjectType === 2);
+        var sum = list2.reduce(function (total, item) {
+          return total + item.money;
+        }, 0);
+
+        var list3 = this.feesList.filter((t) => t.subjectType === 3);
+        var sum2 = list3.reduce(function (total, item) {
+          return total + item.money;
+        }, 0);
+        if (this.paymentAmount - this.feesAmount > 0) {
+          this.$refs.modalRefundForm.edit({
+            billRefund: this.paymentAmount - this.feesAmount,
+            deposit: deposit - (sum - sum2),
+            roomFee: sum - sum2,
+            money: this.paymentAmount - this.feesAmount,
+            subjectType: 5,
+            feeType: 2,
+            bookingOrderId: this.model.orderInfo.id,
+            livingOrderId:
+              livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
+            vipCustomerId: livingRoom.livingOrder.vipCustomerId,
+            contractTeamId: livingRoom.livingOrder.contractTeamId,
+            contractTeamProtocolId:
+              livingRoom.livingOrder.contractTeamProtocolId,
+          });
+          this.$refs.modalRefundForm.title = "结账退款";
+          this.$refs.modalRefundForm.disableSubmit = false;
+        } else {
+          this.$refs.modalPaymentForm.edit({
+            billAmount: parseFloat(
+              Math.abs(this.paymentAmount - this.feesAmount).toFixed(2)
+            ),
+            deposit: deposit - (sum - sum2),
+            roomFee: parseFloat(
+              Math.abs(this.paymentAmount - this.feesAmount).toFixed(2)
+            ),
+            subjectType: 5,
+            feeType: 2,
+            bookingOrderId: this.model.orderInfo.id,
+            livingOrderId:
+              livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
+            preferentialType: 1,
+            couponFirstAmount: 0,
+            discount: 9,
+            vipCustomerId: livingRoom.livingOrder.vipCustomerId,
+            contractTeamId: livingRoom.livingOrder.contractTeamId,
+            contractTeamProtocolId:
+              livingRoom.livingOrder.contractTeamProtocolId,
+          });
+          this.$refs.modalPaymentForm.title = "结账收款";
+          this.$refs.modalPaymentForm.disableSubmit = false;
+        }
       }
     },
     puls() {