许智捷 2 роки тому
батько
коміт
9cea932333
35 змінених файлів з 2038 додано та 1191 видалено
  1. 1 0
      src/components/layouts/TabLayout.vue
  2. 5 1
      src/mixins/JeecgListMixin.js
  3. 45 20
      src/views/pos/diandan.vue
  4. 351 148
      src/views/pos/modules/Payment.vue
  5. 1 1
      src/views/pos/posInfo.vue
  6. 118 19
      src/views/room/calendarfangtai.vue
  7. 124 36
      src/views/room/fangtailive.vue
  8. 4 4
      src/views/room/guestorders.vue
  9. 320 216
      src/views/room/leasegoods.vue
  10. 229 180
      src/views/room/membermessage.vue
  11. 153 146
      src/views/room/modules/checkIn/BillRoomForm.vue
  12. 73 7
      src/views/room/modules/checkIn/BillRoomInfo.vue
  13. 25 20
      src/views/room/modules/checkIn/BillRoomInfoModal.vue
  14. 10 8
      src/views/room/modules/checkIn/EditCustomerForm.vue
  15. 0 1
      src/views/room/modules/checkIn/EnterAccountModel.vue
  16. 10 0
      src/views/room/modules/checkIn/FeeForm.vue
  17. 17 3
      src/views/room/modules/checkIn/PayOrRefund.vue
  18. 32 13
      src/views/room/modules/checkIn/Payment.vue
  19. 3 2
      src/views/room/modules/checkIn/PaymentModal.vue
  20. 31 7
      src/views/room/modules/checkIn/RefundModal.vue
  21. 118 90
      src/views/room/modules/checkIn/SelectCheckInRoomOrder.vue
  22. 1 1
      src/views/room/modules/checkIn/SelectRoomForm.vue
  23. 1 1
      src/views/room/modules/checkIn/StrikeBalanceModel.vue
  24. 71 28
      src/views/room/modules/checkIn/batchCardDetailCopy.vue
  25. 0 1
      src/views/room/modules/checkIn/batchCardModalCopy.vue
  26. 52 22
      src/views/room/modules/fangtaiModal/exchangeHouses/exchangeHousesForm.vue
  27. 9 7
      src/views/room/modules/leasegoods/leasegoodsModal.vue
  28. 3 3
      src/views/room/modules/membergoodsmanage/membermessageModal.vue
  29. 57 20
      src/views/room/modules/schedule/EditScheduleRoomForm.vue
  30. 5 5
      src/views/room/modules/schedule/ScheduleRoomForm.vue
  31. 3 0
      src/views/room/scheduledetail.vue
  32. 18 15
      src/views/settings/components/roomModules/roomNumSettings/roomNumForm.vue
  33. 6 1
      src/views/settings/components/roomModules/roomNumSettings/roomNumList.vue
  34. 6 5
      src/views/settings/components/roomModules/roomNumSettings/roomNumTable.vue
  35. 136 160
      src/views/stock/depositoryingoods.vue

+ 1 - 0
src/components/layouts/TabLayout.vue

@@ -231,6 +231,7 @@
           this.$message.warning('这是最后一页,不能再关闭了啦')
           return
         }
+        debugger
         console.log("this.pageList ",this.pageList );
         let removeRoute = this.pageList.filter(item => item.fullPath == key)
         this.pageList = this.pageList.filter(item => item.fullPath !== key)

+ 5 - 1
src/mixins/JeecgListMixin.js

@@ -84,11 +84,15 @@ export const JeecgListMixin = {
         this.ipagination.current = 1;
       }
       var params = this.getQueryParams();//查询条件
+      // debugger
       this.loading = true;
       getAction(this.url.list, params).then((res) => {
         if (res.success) {
           //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-          this.dataSource = res.result.records||res.result;
+          this.dataSource = []
+          setTimeout(() => {
+            this.dataSource = res.result.records || res.result;
+          }, 50)
           if(res.result.total)
           {
             this.ipagination.total = res.result.total;

+ 45 - 20
src/views/pos/diandan.vue

@@ -26,13 +26,14 @@
           style=" overflow-y: scroll;"
         >
           <template slot="num" slot-scope="text, record, index">
-            <div>
+            <div style="text-align: center">
               <a-input-number
+                v-if="record.id == null"
                 v-model="record.num"
                 style="width: auto; "
                 :max="record.inventory"
-                @change="(event) => numChange(event, index)"
-              />
+                @change="(event) => numChange(event, index)"/>
+              <span v-else>{{ record.num }}</span>
             </div>
           </template>
           <template slot="required" slot-scope="text, record, index">
@@ -51,11 +52,11 @@
 <!--          <a-button @click="addClear" :disabled="btnDisabled">清空新加</a-button>-->
         </div>
         <div v-else style="display: flex; gap: 5px; flex-flow: wrap">
-          <a-button v-if="posTableState === ''" @click="handleClear" :disabled="btnDisabled">清空</a-button>
+          <a-button  @click="clean" :disabled="btnDisabled">清空</a-button>
           <!-- <a-button @click="handleAdd" :disabled="btnDisabled">备注</a-button> -->
           <!-- <a-button :disabled="btnDisabled">退货</a-button> -->
           <div v-if="posTableId === ''">
-            <a-button v-if="!btnDisabled" @click="handleAdd">挂单</a-button>
+            <a-button v-if="!btnDisabled" @click="pendingOrder">挂单</a-button>
             <a-button v-else @click="handlePickingGoodsOrder">取单</a-button>
           </div>
           <a-button
@@ -424,6 +425,10 @@ export default {
       })
     },
     modalFormOk() {
+      this.clean()
+      this.loadGoods()
+    },
+    clean() {
       this.selectGoodsList = []
       this.selectOrderInfo = {}
       this.selectRoomOrder = {}
@@ -546,9 +551,12 @@ export default {
       this.$refs.modalGoodsForm.title = '新增菜品'
       this.$refs.modalGoodsForm.disableSubmit = false
     },
+    /**
+     * 确认挂房账
+     */
     handleToRoomFeePayment() {
-      let param = this.getParam()
-      postAction('/pos/posOrderGoods/addRoomFee', param).then(resp => {
+      let param = Object.assign({ toRoomFeeOrderId: this.selectRoomOrder.livingOrderId }, this.getParam())
+          postAction('/pos/posOrderGoods/addRoomFee', param).then(resp => {
         if (resp.result === true) {
           this.$message.success('挂账成功')
           this.modalFormOk()
@@ -558,21 +566,23 @@ export default {
       })
     },
     handlePayment() {
-      console.log(this.posTableId)
+      if (!this.selectGoodsList || this.selectGoodsList.length <= 0) {
+        this.$message.warning('请先选择商品')
+        return
+      }
       if (this.posTableId === '') {
-        this.handleAdd((e) => {
-          this.settleAccounts(e)
-        })
+        this.settleAccounts(this.selectOrderInfo.code, this.getParam())
       } else {
-
-        this.settleAccounts(this.selectOrderInfo.code)
+        // 桌台结账时,订单在下单的时候就添加了,不用传参
+        this.settleAccounts(this.selectOrderInfo.code, null)
       }
     },
-    settleAccounts(orderCode) {
+    settleAccounts(orderCode, params) {
       console.log(orderCode)
-      var amount = this.oldSelectGoodsList.reduce(function (total, item) {
+      var amount = this.selectGoodsList.reduce(function (total, item) {
         return total + item.sellingPrice * item.num
       }, 0)
+
       this.$refs.modalPaymentForm.edit({
         billAmount: amount,
         deposit: 0,
@@ -582,14 +592,23 @@ export default {
         preferentialType: 1,
         couponFirstAmount: 0,
         discount: 9,
-        orderCode: orderCode
+        orderCode: orderCode,
+        params: params
       })
       this.$refs.modalPaymentForm.title = 'POS结账'
       this.$refs.modalPaymentForm.disableSubmit = false
     },
+    /**
+     * 下单
+     */
     placeOrder() {
       this.handleAdd()
     },
+    pendingOrder() {
+      this.selectOrderInfo.isPending = true
+      this.handleAdd()
+
+    },
     handleAdd(callback) {
       if (!this.selectGoodsList || this.selectGoodsList.length <= 0) {
         this.$message.warning('请先选择商品')
@@ -613,6 +632,7 @@ export default {
             if (callback) {
               callback(res.result.code)
             }
+            this.clean();
           } else {
             this.$message.warning(res.message)
           }
@@ -624,19 +644,24 @@ export default {
       var _info = JSON.parse(localStorage.getItem('storeInfo'))
       var model = {
         goodsId: this.selectGoods.id,
-        posTableId: this.posTableId
+        posTableId: this.posTableId,
+        id: this.selectOrderInfo.id,
+        posType: this.tabPosTypeId,
+        isPending: this.selectOrderInfo.isPending
       }
       if (_info) {
         model.hotelId = _info.id
       }
-      model.id = this.selectOrderInfo.id
-      model.toRoomFeeOrderId = this.selectRoomOrder.livingOrderId
-      model.posType = this.tabPosTypeId
+
       if (this.remark) {
         model.remarks = this.remark
       }
       var posOrderGoodsDetailList = []
       this.selectGoodsList.forEach((t) => {
+        // 过滤掉订单中已经保存的商品
+        if (t.id != null) {
+          return
+        }
         posOrderGoodsDetailList.push({
           id: t.id,
           goodsId: t.goodsId,

+ 351 - 148
src/views/pos/modules/Payment.vue

@@ -32,16 +32,17 @@
                   <a-radio :value="2"> 减现 </a-radio>
                   <a-radio :value="3"> 打折 </a-radio>
                 </a-radio-group>
-                <template v-if="model.preferentialType === 3"
-                  >打<a-input-number
-                    style="width: 80px"
-                    v-model="model.discount"
-                    :min="1"
-                    :max="9"
-                    decimalSeparator="."
-                    :precision="1"
-                  ></a-input-number
-                  >折
+                <template
+                  v-if="model.preferentialType === 3"
+                >打<a-input-number
+                  style="width: 80px"
+                  v-model="model.discount"
+                  :min="1"
+                  :max="9"
+                  decimalSeparator="."
+                  :precision="1"
+                ></a-input-number
+                >折
                 </template>
               </a-form-model-item>
             </a-col>
@@ -125,7 +126,7 @@
                       placeholder="收款方式"
                       @change="(event) => onChange(event, item)"
                     >
-                      <a-select-option v-if="item2.name.indexOf('会员')<0"
+                      <a-select-option
                         :value="item2.id"
                         v-for="item2 in payTypeList"
                         :key="item2.id"
@@ -146,21 +147,109 @@
                       style="color: #f56c6c"
                       class="dynamic-delete-button"
                       @click="() => remove(index)"
-                  /></a-col>
+                    /></a-col>
                 </a-row>
 
-                <a-row type="flex" v-if="item.isVipMemmber">
-                  <a-col :span="12"> 姓名:{{ memberCard.name }} </a-col>
-                  <a-col :span="12"> 卡号:{{ memberCard.cardNo }} </a-col>
-                  <a-col :span="12">
-                    会员级别: {{ memberCard.gradeName }}</a-col
-                  >
-                  <a-col :span="12"> 余额:{{ memberCard.balance }} </a-col>
-                  <a-col :span="12"> 积分:{{ memberCard.integral }} </a-col>
-                  <!-- <a-col :span="12"> 本次扣后剩余: </a-col>
-                <a-col :span="12"> 本次新增积分: </a-col> -->
-                </a-row>
               </div>
+              <a-row type="flex" v-if="this.isVipMember">
+                <a-card :bordered="true" style="width: 100%; padding: 0 !important">
+                  <p>
+                    <a-form-model-item
+                        label="会员"
+                        :labelCol="{
+                          xs: { span: 24 },
+                          sm: { span: 2 },
+                        }"
+                        :wrapperCol="{
+                          xs: { span: 24 },
+                          sm: { span: 22 },
+                        }"
+                        prop="vipCustomerId">
+                      <a-auto-complete
+                          v-model="vipCustomerData.name"
+                          @select="(e) => handleSelectVip(e)"
+                          @search="handleSearchVip"
+                      >
+                        <template slot="dataSource">
+                          <a-select-option
+                              :key="item.id"
+                              :value="item.id"
+                              :label="item.name"
+                              v-for="(item, index) in busMemberCardList"
+                          >
+                            {{ item.name }}-{{ item.gradeName }}-{{ item.balance }}
+                          </a-select-option>
+                        </template>
+                      </a-auto-complete>
+                    </a-form-model-item>
+                  </p>
+                  <p>
+                    <a-row>
+                      <a-col :span="8">名称:{{ vipCustomerData.name }}</a-col>
+                      <a-col :span="8">电话:{{ vipCustomerData.mobile }}</a-col>
+                      <a-col :span="8">级别:{{ vipCustomerData.gradeName }}</a-col>
+                    </a-row>
+                    <a-row>
+                      <a-col :span="8">余额:{{ vipCustomerData.balance }}</a-col>
+                      <a-col :span="8">积分:{{ vipCustomerData.integral }}</a-col>
+                      <a-col :span="8">卡号:{{ vipCustomerData.cardNo }}</a-col>
+                    </a-row>
+                  </p>
+                </a-card>
+              </a-row>
+              <a-row type="flex" v-if="isAgreementUnit">
+                <a-card :bordered="true" style="width: 100%; padding: 0 !important">
+                  <a-col :span="24">
+                    <a-form-model-item
+                        label="协议单位"
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        prop="contractTeamId"
+                    >
+                      <a-auto-complete
+                          v-model="agreementUnitData.customerName"
+                          @select="(e) => handleSelectAgreementUnit(e)"
+                          @search="handleSearchAgreementUnit"
+                      >
+                        <template slot="dataSource">
+                          <a-select-option
+                              :key="item.id"
+                              :value="item.id"
+                              :label="item.customerName"
+                              v-for="(item, index) in busMarketAgreementUnitList"
+                          >
+                            {{ item.customerName }}
+                          </a-select-option>
+                        </template>
+                      </a-auto-complete>
+                    </a-form-model-item>
+                  </a-col>
+                  <p>
+                    <a-row>
+                      <a-col
+                          :span="12"
+                      >名称:{{ agreementUnitData.customerName }}</a-col
+                      >
+                      <a-col
+                          :span="12"
+                      >签约开始日期:{{
+                          busMarketAgreementCustomer.signTime
+                        }}</a-col
+                      >
+                      <a-col
+                          :span="12"
+                      >签约结束日期:{{
+                          busMarketAgreementCustomer.effective
+                        }}</a-col
+                      >
+                      <a-col
+                          :span="12"
+                      >可用额度:{{ agreementUnitData.balance || 0 }}</a-col
+                      >
+                    </a-row>
+                  </p>
+                </a-card>
+              </a-row>
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
@@ -179,22 +268,23 @@
 </template>
 
 <script>
-import { httpAction, getAction } from "@/api/manage";
-import { validateDuplicateValue } from "@/utils/util";
+import { httpAction, getAction, postAction } from '@/api/manage'
+import { validateDuplicateValue } from '@/utils/util'
 
 export default {
-  name: "Payment",
+  name: 'Payment',
   components: {},
   props: {
-    //表单禁用
+    // 表单禁用
     disabled: {
       type: Boolean,
       default: false,
-      required: false,
-    },
+      required: false
+    }
   },
   data() {
     return {
+
       model: {
         coupon: false,
         discount: 1,
@@ -202,15 +292,16 @@ export default {
         couponType: 1,
         couponFirstAmount: 0,
         billAmount: 0,
-        selectedFeeIds: [],
+        selectedFeeIds: []
       },
+      posOrderGoods: {},
       labelCol: {
         xs: { span: 24 },
-        sm: { span: 5 },
+        sm: { span: 5 }
       },
       wrapperCol: {
         xs: { span: 24 },
-        sm: { span: 16 },
+        sm: { span: 16 }
       },
       confirmLoading: false,
       validatorRules: {
@@ -218,22 +309,22 @@ export default {
           {
             required: true,
             pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-            message: "请输入手机号!",
-          },
+            message: '请输入手机号!'
+          }
         ],
-        cardNo: [{ required: true, message: "请输入会员卡号!" }],
-        gradeId: [{ required: true, message: "请输入等级类型!" }],
-        payType: [{ required: true, message: "请输入付款类型!" }],
-        paymentMethod: [{ required: true, message: "请输入付款方式!" }],
-        customerName: [{ required: true, message: "请输入会员姓名!" }],
-        sex: [{ required: true, message: "请输入性别!" }],
-        certificateType: [{ required: true, message: "请输入证件类型!" }],
-        validity: [{ required: true, message: "请输入有效期!" }],
+        cardNo: [{ required: true, message: '请输入会员卡号!' }],
+        gradeId: [{ required: true, message: '请输入等级类型!' }],
+        payType: [{ required: true, message: '请输入付款类型!' }],
+        paymentMethod: [{ required: true, message: '请输入付款方式!' }],
+        customerName: [{ required: true, message: '请输入会员姓名!' }],
+        sex: [{ required: true, message: '请输入性别!' }],
+        certificateType: [{ required: true, message: '请输入证件类型!' }],
+        validity: [{ required: true, message: '请输入有效期!' }]
       },
       url: {
-        add: "/business/busRoomBookingOrders/booking-to-live",
-        edit: "/business/busMemberCard/edit",
-        queryById: "/business/busMemberCard/queryById",
+        add: '/business/busRoomBookingOrders/booking-to-live',
+        edit: '/business/busMemberCard/edit',
+        queryById: '/business/busMemberCard/queryById'
       },
       gradeList: [],
       paymentMethodList: [],
@@ -241,199 +332,311 @@ export default {
       customerList: [],
       oldcustomerList: [],
       payTypeList: [],
-      memberCard: {},
-      isVipMemmber: false,
+      busMemberCardList: [],
+      vipCustomerData: {},
+      isVipMember: false,
+      busMarketAgreementUnitList: [],
+      // agreementUnitData: { customerName: '' },
+      agreementUnitData: {},
+      isAgreementUnit: false,
+      busMarketAgreementCustomer: {},
+
       payList: [],
-      memeberCouponList: [],
-    };
+      memeberCouponList: []
+    }
   },
   computed: {
     formDisabled() {
-      return this.disabled;
+      return this.disabled
     },
     sumAmount() {
       var sum = this.payList.reduce(function (total, item) {
-        return total + item.money;
-      }, 0);
-      return sum;
+        return total + item.money
+      }, 0)
+      return sum
     },
     couponAmount() {
-      var sum = 0;
+      var sum = 0
       if (this.model.coupon) {
         if (this.model.preferentialType == 1) {
-          sum = Math.floor(this.model.billAmount);
+          sum = Math.floor(this.model.billAmount)
         } else if (this.model.preferentialType == 2) {
-          sum = this.model.billAmount - (this.model.couponFirstAmount || 0);
+          sum = this.model.billAmount - (this.model.couponFirstAmount || 0)
         } else if (this.model.preferentialType == 3) {
           sum = parseFloat(
             ((this.model.billAmount * this.model.discount) / 10).toFixed(2)
-          );
+          )
         }
       } else {
-        sum = this.model.billAmount;
+        sum = this.model.billAmount
       }
-      return sum;
+      return sum
     },
     realityAmount() {
       if (this.model.couponCard) {
         var find = this.memeberCouponList.find(
           (t) => t.id == this.model.couponId
-        );
+        )
         if (find) {
-          return this.couponAmount - find.cost;
+          return this.couponAmount - find.cost
         }
       }
-      return this.couponAmount;
-    },
+      return this.couponAmount
+    }
   },
   created() {
-    var _info = JSON.parse(localStorage.getItem("storeInfo"));
+    var _info = JSON.parse(localStorage.getItem('storeInfo'))
     if (_info) {
-      this.model.hotelId = _info.id;
+      this.model.hotelId = _info.id
     }
-    //备份model原始值
-    this.modelDefault = JSON.parse(JSON.stringify(this.model));
-    getAction("/business/busRoomPayType/list", {
+    // 备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model))
+    getAction('/business/busRoomPayType/list', {
       pageSize: 99999,
-      pageNo: 1,
+      pageNo: 1
     }).then((res) => {
       if (res.success) {
-        this.payTypeList = res.result.records;
+        this.payTypeList = res.result.records
       }
-    });
-    getAction("/business/busMemberCard/list", {
-      id: "11111111",
-    }).then((res) => {
+    })
+    getAction('/business/busMemberCard/list', {}).then((res) => {
       if (res.success) {
         if (res.result.records && res.result.records.length > 0) {
-          this.memberCard = res.result.records[0];
+          this.busMemberCardList = res.result.records
         }
       }
-    });
+    })
+    getAction('/business/busMarketAgreementUnit/list', {
+      pageSize: 99999,
+      pageNo: 1
+    }).then((res) => {
+      if (res.success) {
+        this.busMarketAgreementUnitList = res.result.records
+        this.oldBusMarketAgreementUnitList = JSON.parse(
+            JSON.stringify(res.result.records)
+        )
+        if (this.model.contractTeamId && this.model.contractTeamProtocolId) {
+          // this.handleSelectAgreementUnit(this.model.contractTeamId);
+        }
+      }
+      // this.loading = false
+    })
   },
   methods: {
     getbusRoomPayType() {
-      getAction("/business/busRoomPayType/list", {
+      getAction('/business/busRoomPayType/list', {
         pageSize: 99999,
-        pageNo: 1,
+        pageNo: 1
       }).then((res) => {
         if (res.success) {
-          this.payTypeList = res.result.records;
+          this.payTypeList = res.result.records
           if (this.payTypeList && this.payTypeList.length > 0) {
-            this.$set(this.model, "payType", this.payTypeList[0].id);
+            this.$set(this.model, 'payType', this.payTypeList[0].id)
 
             this.payList = [
               {
                 money: this.realityAmount,
                 payType: this.payTypeList[0].id,
-                isVipMemmber: false,
-              },
-            ];
+              }
+            ]
           }
         }
-      });
+      })
     },
+    // 增加收款项
     puls() {
-      var m = this.realityAmount - this.sumAmount;
+      var m = this.realityAmount - this.sumAmount
       this.payList.push({
         money: parseFloat(m.toFixed(2)),
         payType: this.payTypeList[0].id,
-        isVipMemmber: false,
-      });
+      })
     },
     remove(index) {
-      this.payList.splice(index, 1);
+      this.payList.splice(index, 1)
+      this.hasCardOrAgreement()
     },
     onChange(e, value) {
-      console.log("value", value);
-      console.log("e", e);
-      var find = this.payTypeList.find((t) => t.id == value.payType);
-      value.isVipMemmber = find && find.name == "会员卡";
+      console.log('value', value)
+      console.log('e', e)
+      this.hasCardOrAgreement()
+    },
+    hasCardOrAgreement() {
+      let find1 = this.payTypeList.find((t) => t.name === '会员卡')
+      let index = this.payList.findIndex(e => find1.id === e.payType)
+      this.isVipMember = index !== -1
+      let find2 = this.payTypeList.find((t) => t.name === '单位挂账')
+      let index2 = this.payList.findIndex(e => find2.id === e.payType)
+      this.isAgreementUnit = index2 !== -1
     },
     handleSearch(value) {
-      let result;
+      let result
       if (!value) {
-        result = this.oldcustomerList;
+        result = this.oldcustomerList
       } else {
-        result = this.oldcustomerList.filter((t) => t.name.includes(value));
+        result = this.oldcustomerList.filter((t) => t.name.includes(value))
       }
-      this.customerList = result;
+      this.customerList = result
     },
     handleSelectMember(e) {
-      var find = this.customerList.find((t) => t.id === e);
-      this.model.phone = find.phone;
-      this.model.customerName = find.name;
-      this.model.customerId = find.id;
+      var find = this.customerList.find((t) => t.id === e)
+      this.model.phone = find.phone
+      this.model.customerName = find.name
+      this.model.customerId = find.id
     },
     getMemeberCouponList() {
-      getAction("/business/busMarketCouponsCashUsed/memeberCouponList", {
+      getAction('/business/busMarketCouponsCashUsed/memeberCouponList', {
         pageNo: 1,
         pageSize: 99,
         conditions: 900,
-        mobile: this.model.vipCustomerId,
+        mobile: this.model.vipCustomerId
       }).then((res) => {
         if (res.success) {
-          this.memeberCouponList = res.result.records;
+          this.memeberCouponList = res.result.records
         }
-      });
+      })
     },
     add(livingOrderId, roomId) {
-      this.modelDefault.livingOrderId = livingOrderId;
-      this.modelDefault.roomId = roomId;
-      this.edit(this.modelDefault);
+      this.modelDefault.livingOrderId = livingOrderId
+      this.modelDefault.roomId = roomId
+      this.edit(this.modelDefault)
     },
     edit(record) {
-      this.model = Object.assign({}, record);
-      this.getbusRoomPayType();
+      this.posOrderGoods = record.params
+      this.model = Object.assign({}, record)
+      this.getbusRoomPayType()
       if (this.model.vipCustomerId) {
-        this.getMemeberCouponList();
+        this.getMemeberCouponList()
       }
-      this.visible = true;
+      this.visible = true
+    },
+    handleSelectVip(value) {
+      console.log(value)
+      let result = this.busMemberCardList.find((t) => t.id == value)
+      this.model.vipCustomerId = value
+      this.vipCustomerData = JSON.parse(JSON.stringify(result))
+      // this.vipCustomerIdChange(result.id);
+    },
+    handleSearchVip(value) {
+      let result
+      if (!value) {
+        result = this.oldBusMemberCardList
+      } else {
+        console.log('this.oldBusMemberCardList', this.oldBusMemberCardList)
+        result = this.oldBusMemberCardList.filter((t) => {
+          return (
+              t.name.includes(value) ||
+              (t.cardNo && t.cardNo.includes(value)) ||
+              (t.mobile && t.mobile.includes(value))
+          )
+        })
+      }
+      this.busMemberCardList = JSON.parse(JSON.stringify(result))
+    },
+    handleSelectAgreementUnit(value) {
+      let result = this.busMarketAgreementUnitList.find((t) => t.id == value)
+      this.model.contractTeamId = value
+      this.agreementUnitData = JSON.parse(JSON.stringify(result))
+      this.contractTeamIdChange(value)
+    },
+    handleSearchAgreementUnit(value) {
+      let result
+      if (!value) {
+        result = this.oldBusMarketAgreementUnitList
+      } else {
+        result = this.oldBusMarketAgreementUnitList.filter((t) =>
+            t.customerName.includes(value)
+        )
+      }
+      this.busMarketAgreementUnitList = JSON.parse(JSON.stringify(result))
+    },
+
+    contractTeamIdChange(e) {
+      this.model.contractTeamId = e
+      getAction('/business/busMarketAgreementCustomer/list', {
+        agreementId: this.model.contractTeamId
+      }).then((res) => {
+        if (res.success) {
+          var list = res.result.records
+          if (list && list.length > 0) {
+            this.model.contractTeamProtocolName = list[0].name
+            this.model.contractTeamProtocolId = list[0].id
+            this.busMarketAgreementCustomer = list[0]
+          }
+        }
+      })
     },
+
     submitForm() {
-      const that = this;
+      const that = this
       // 触发表单验证
       this.$refs.form.validate((valid) => {
         if (valid) {
-          console.log("this.realityAmount ", this.realityAmount);
-          console.log("this.sumAmount ", this.sumAmount);
+          console.log('this.realityAmount ', this.realityAmount)
+          console.log('this.sumAmount ', this.sumAmount)
           if (this.realityAmount != this.sumAmount) {
-            that.$message.warning("实收金额和实收合计必须相等");
-            return;
+            that.$message.warning('实收金额和实收合计必须相等')
+            return
+          }
+          if (this.isVipMember && this.vipCustomerData.id == null) {
+            this.$message.warning('请选择会员')
+          }
+          if (this.isAgreementUnit && this.agreementUnitData.id == null) {
+            this.$message.warning('请选择协议单位')
+          }
+          this.confirmLoading = true
+          if (this.posOrderGoods !== null) {
+            // 大厅 点击结账,点击支付后,先添加账单,再添加支付单
+            postAction('/pos/posOrderGoods/add', this.posOrderGoods)
+                .then((res) => {
+                  if (res.success) {
+                    this.$message.success(res.message)
+                    this.model.orderCode = res.result.code
+                    this.addPayment()
+                  } else {
+                    this.$message.warning('添加订单失败')
+                  }
+                }).finally(() => {
+                  this.confirmLoading = false
+                })
+          } else {
+            this.addPayment()
           }
-          var obj = {
-            couponPrice: this.couponAmount.toFixed(2),
-            orderCode: this.model.orderCode,
-            paymentList: [],
-          };
-          var fees = [];
-          this.payList.forEach((item) => {
-            fees.push({
-              payMoney: item.money.toFixed(2),
-              paymentMethod: item.payType,
-              orderId: this.model.orderCode,
-            });
-          });
-          obj.paymentList = fees;
-          that.confirmLoading = true;
-          var url = "/pos/posOrderGoodsPayment/add";
-          httpAction(url, obj, "post")
-            .then((res) => {
-              if (res.success) {
-                that.$message.success("结账成功");
-                that.$emit("ok");
-              } else {
-                that.$message.warning(res.message);
-              }
-            })
-            .finally(() => {
-              that.confirmLoading = false;
-            });
         }
-      });
+      })
     },
-  },
-};
+    addPayment() {
+      var obj = {
+        couponPrice: this.couponAmount.toFixed(2),
+        orderCode: this.model.orderCode,
+        paymentList: [],
+        cardId: this.isVipMember ? this.vipCustomerData.id : null,
+        agreementId: this.isAgreementUnit ? this.agreementUnitData.id : null
+      }
+      var fees = []
+      this.payList.forEach((item) => {
+        fees.push({
+          payMoney: item.money.toFixed(2),
+          paymentMethod: item.payType,
+          orderId: this.model.orderCode
+        })
+      })
+      obj.paymentList = fees
+      var url = '/pos/posOrderGoodsPayment/add'
+      httpAction(url, obj, 'post')
+          .then((res) => {
+            if (res.success) {
+              this.$message.success('结账成功')
+              this.$emit('ok')
+            } else {
+              this.$message.warning(res.message)
+            }
+          })
+          .finally(() => {
+            this.confirmLoading = false
+          })
+    }
+  }
+}
 </script>
 <style scoped>
 .dynamic-delete-button {
@@ -452,4 +655,4 @@ export default {
   cursor: not-allowed;
   opacity: 0.5;
 }
-</style>
+</style>

+ 1 - 1
src/views/pos/posInfo.vue

@@ -70,7 +70,7 @@ export default {
     },
     tabChange(e) {
       if (e !== '1') {
-        this.$refs.diandan.modalFormOk()
+        this.$refs.diandan.clean()
         this.$refs.diandan.posTableId = ''
         this.$refs.diandan.posTableState = -1
       }

+ 118 - 19
src/views/room/calendarfangtai.vue

@@ -17,11 +17,35 @@
         </a-radio-group>
       </a-col>
       <a-col :span="8">
-        <div>
+        <div style="display: flex">
+          <div >
+            <a-popover placement="bottom">
+              <template slot="content">
+                <a-calendar :fullscreen="false" v-model="mStartDate" @change="onPanelChange" />
+              </template>
+              <span style="display: flex;justify-content: center; text-align: center; margin-right: 20px" >起始日期:
+              <div style="border: 1px solid #CDCDCDCC; text-align: center; width: 100px; height: 32px">
+                {{ startDate.format('yyyy-MM-dd') }}
+              </div>
+                </span>
+            </a-popover>
+          </div>
           <a-input placeholder="请输姓名或电话" style="width: 35%" v-model="searchValue"></a-input>
           <a-button @click="findCustomerLocation">查询</a-button>
         </div>
       </a-col>
+      <a-col :span="4">
+        <span>房型:</span>
+        <a-select style="width: 140px" :allowClear="true" v-model:value="chooseLayout" @change="changeState">
+          <a-select-option v-for="item in roomLayouts" :value="item.value">{{ item.label }}</a-select-option>
+        </a-select>
+      </a-col>
+      <a-col :span="4">
+        <span>楼层:</span>
+        <a-select style="width: 140px" :allowClear="true" v-model:value="chooseFloor" @change="changeState">
+          <a-select-option v-for="item in floorList" :value="item.id">{{ item.name }}</a-select-option>
+        </a-select>
+      </a-col>
     </a-row>
     <div class="wrapper-content">
       <div class="row-top">
@@ -63,7 +87,7 @@
           style="flex-direction: column;width: fit-content;width: 210px; height:calc(585px - 9px);overflow-y:auto;overflow-x:hidden;">
           <div class="top-header" style="width: fit-content;" v-for="(item, index) in data" :key="index">
             <div class="left-wrapper">
-              <div class="wrapper-td date-selection left-content" :style="{ height: `${67 * (item.rooms.length)}px`, borderLeft:'none' }">
+              <div class="wrapper-td date-selection left-content" v-if="item.rooms.length > 0" :style="{ height: `${67 * (item.rooms.length)}px`, borderLeft:'none' }">
                 <div class="wrapper-td-flex">
                   {{ item.name }}
                 </div>
@@ -116,8 +140,10 @@
           @scroll="exterHandleScroll" ref="systemForm">
           <div v-for="(sItem, sIndex) in data" :key="sIndex">
             <div v-for="(rItem, rIndex) in sItem.rooms" :key="rIndex" style="height:67px;">
-              <div class="wrapper-item data-row">
-                <div :class="`wrapper-td ${(sIndex + '_' + rIndex + '_' + index) == findIndex ? 'wrapper-tb_true' : ''}`" :key="index" v-for="(item, index) in columns" style="height:67px;"
+              <div class="wrapper-item data-row" >
+                <div :id="`${sIndex}_${rIndex}_${index}`"  tabindex = "0"
+                     class="wrapper-td"
+                     :key="index" v-for="(item, index) in columns" style="height:67px;"
                   @mouseenter="onMouseenter($event, `${sIndex}_${rIndex}_${index}`)" @mouseleave="onMouseleave">
                   <div class="wrapper-td-flex align-left"
                     v-if="tax == `${sIndex}_${rIndex}_${index}` && !inDateRange(`${sIndex}_${rIndex}_${index}`)"
@@ -178,11 +204,11 @@
                         </div>
                       </div>
                     </template>
-                    <div class="wrapper-td-flex align-left"
+                    <div :class="`wrapper-td-flex align-left ${(sIndex + '_' + rIndex + '_' + index) == findIndex ? 'wrapper-tb_true' : ''}`"
                       style="color: aliceblue; height: 100%;font-size: smaller;position: relative;z-index: 99;border-radius: 3px; "
                       :style="{
                         width: `${(inDateRange(`${sIndex}_${rIndex}_${index}`).dayCount * 110) - 4}px`, backgroundColor: ((inDateRange(`${sIndex}_${rIndex}_${index}`).data.settleType < 1 ?
-                          (inDateRange(`${sIndex}_${rIndex}_${index}`).data.isLiving ? 'red' : 'blue') : '#aaa'))
+                          (inDateRange(`${sIndex}_${rIndex}_${index}`).data.isLiving ? '#d32424' : '#2490dc') : '#aaa'))
                       }" @click="handleBillInfo(inDateRange(`${sIndex}_${rIndex}_${index}`).data)">
                       <span style="color: transparent;">a</span>
                       <div
@@ -289,6 +315,7 @@ export default {
     return {
       flag: false,
       data: [],
+      oldData: [],
       columns: [],
       columnsCount: [],
       tax: null,
@@ -305,14 +332,22 @@ export default {
       groupCountArr: [],
       res: null,
       searchValue:'',
-      findIndex:''
+      findIndex:'',
+      roomLayouts: [],
+      floorList: [],
+      chooseLayout: null,
+      chooseFloor: null,
+      // 当前所有房间id集合
+      nowRoomIds: []
     }
   },
-  mounted() {
+  created() {
     this.initColumns()
     setTimeout(() => {
       this.getData()
     }, 200)
+    this.loadLayout()
+
   },
   methods: {
     handleWx(roomInfo) {
@@ -411,8 +446,8 @@ export default {
     onTypeChange(e) {
       console.log(e);
       this.groupType = e.target.value
-      this.data = this.groupType == 1 ? this.res.result.floorRoomVos : this.res.result.layoutRoomVos
-      this.loadDataSource()
+      this.oldData = this.groupType == 1 ? this.res.result.floorRoomVos : this.res.result.layoutRoomVos
+      this.changeState()
     },
     onPanelChange() {
       console.log(this.mStartDate);
@@ -450,6 +485,33 @@ export default {
       this.findIndex = ''
       let find = this.tempOrderIds.find(s => s.data.customerName === this.searchValue || s.data.customerPhone === this.searchValue)
       this.findIndex = find.key
+      document.getElementById(this.findIndex).scrollIntoView({ block: 'center', inline: 'center' })
+    },
+
+    /**
+     * 筛选楼层、房型改变 或 更改房型或楼层排列 时
+     * @param value
+     */
+    changeState(value) {
+      let nowRoomIds = []
+      if (this.groupType === 1) {
+        let newData = this.chooseFloor == null ? this.oldData : this.oldData.filter(e => e.id === this.chooseFloor)
+        this.data = JSON.parse(JSON.stringify(newData))
+        this.data.forEach(e => {
+          e.rooms = this.chooseLayout == null ? e.rooms : e.rooms.filter(ele => ele.layoutId === this.chooseLayout)
+          nowRoomIds = [...nowRoomIds, ...e.rooms.map(obj => obj.id)]
+        })
+      } else {
+        let newData = this.chooseLayout == null ? this.oldData : this.oldData.filter(e => e.id === this.chooseLayout)
+        this.data = JSON.parse(JSON.stringify(newData))
+        this.data.forEach(e => {
+          e.rooms = this.chooseFloor == null ? e.rooms : e.rooms.filter(ele => ele.floorId === this.chooseFloor)
+          nowRoomIds = [...nowRoomIds, ...e.rooms.map(obj => obj.id)]
+        })
+      }
+      this.nowRoomIds = nowRoomIds
+      this.loadDataSource()
+
     },
     checkDateLt(item, type) {
       if (type == 1) return item.date == new Date().format('yyyy-MM-dd')
@@ -501,7 +563,6 @@ export default {
       for (let i = 0; i < 30; i++) {
         end = end.setDate(end.getDate() + 1);
         end = new Date(end);
-
       }
       this.endDate = end
       getAction("/business/busRoomBookingOrders/rili-fangtai", {
@@ -510,12 +571,35 @@ export default {
       }).then(res => {
         console.log('rilifangtai', res);
         this.res = res
+        this.oldData = JSON.parse(JSON.stringify(this.groupType == 1 ? res.result.floorRoomVos : res.result.layoutRoomVos))
         this.data = this.groupType == 1 ? res.result.floorRoomVos : res.result.layoutRoomVos
+        // 预约和居住的订单详情
         this.roomStatuList = res.result.riLiFangTaiVoList
         this.loadDataSource()
-
+        let floorList = []
+        this.oldData.forEach(e => {
+          let floor = {
+            id: e.id,
+            name: e.name,
+          }
+          floorList.push(floor)
+        })
+        this.floorList = floorList
       })
     },
+    loadLayout() {
+      getAction('/rooms/cesRoomLayout/list', { pageNo: 1, pageSize: 100 })
+        .then((res) => {
+          if (res.success) {
+            // this.roomLayouts = res.result.records;
+            var data = [];
+            res.result.records.forEach((item) => {
+              data.push({ label: item.name, value: item.id });
+            });
+            this.roomLayouts = data;
+          }
+        })
+    },
     modalLockRoomFormOk() {
       this.onPanelChange()
     },
@@ -545,18 +629,24 @@ export default {
               })
             }
             let findOrderIndex = this.roomStatuList.findIndex(w => w.roomId == t.id && d.date >= new Date(w.arrivalTime).format('yyyy-MM-dd') && d.date < new Date(w.dueOutTime).format('yyyy-MM-dd'))
+            console.log(findOrderIndex)
+
             if (findOrderIndex > -1) {
+              // 计算房间占用数量
               let fdIndex1 = roomCountObjs.findIndex(c => c.typeId == s.id && c.date == d.date)
               roomCountObjs[fdIndex1].goCount++;
               let tpOrder = JSON.parse(JSON.stringify(this.roomStatuList[findOrderIndex]))
               let findExistOrderIndex = this.tempOrderIds.findIndex(w => w.orderId == tpOrder.orderId)
               if (findExistOrderIndex == -1) {
                 let dayCount = this.getDiffDay(new Date(tpOrder.arrivalTime).format('yyyy-MM-dd'), new Date(tpOrder.dueOutTime).format('yyyy-MM-dd'))
+
                 let livingCount = dayCount
-                if (new Date(tpOrder.arrivalTime).format('yyyy-MM-dd') < this.startDate.format('yyyy-MM-dd') && new Date(tpOrder.dueOutTime).format('yyyy-MM-dd') > this.startDate.format('yyyy-MM-dd')) {
+                // 订单时间到达时间小于开始时间,预离时间大于开始时间
+                if (new Date(tpOrder.arrivalTime).format('yyyy-MM-dd HH:mm:ss') < this.startDate.format('yyyy-MM-dd HH:mm:ss') && new Date(tpOrder.dueOutTime).format('yyyy-MM-dd HH:mm:ss') > this.startDate.format('yyyy-MM-dd HH:mm:ss')) {
                   let dayCountSub = Math.abs(this.getDiffDay(new Date(tpOrder.arrivalTime).format('yyyy-MM-dd'), this.startDate.format('yyyy-MM-dd')))
                   if (dayCountSub > 0) dayCount = dayCount - dayCountSub
-                } else if (new Date(tpOrder.arrivalTime).format('yyyy-MM-dd') < this.endDate.format('yyyy-MM-dd') && new Date(tpOrder.dueOutTime).format('yyyy-MM-dd') > this.endDate.format('yyyy-MM-dd')) {
+                  // 订单时间到达时间小于结束时间,预离时间大于结束时间
+                } else if (new Date(tpOrder.arrivalTime).format('yyyy-MM-dd HH:mm:ss') < this.endDate.format('yyyy-MM-dd HH:mm:ss') && new Date(tpOrder.dueOutTime).format('yyyy-MM-dd HH:mm:ss') > this.endDate.format('yyyy-MM-dd HH:mm:ss')) {
                   let dayCountSub = Math.abs(this.getDiffDay(new Date(tpOrder.arrivalTime).format('yyyy-MM-dd'), this.endDate.format('yyyy-MM-dd')))
                   if (dayCountSub > 0) dayCount = dayCount - dayCountSub
 
@@ -570,7 +660,7 @@ export default {
                   key: `${index}_${rIndex}_${dIndex}`,
                   orderId: tpOrder.orderId,
                   data: tpOrder,
-                  dayCount,
+                  dayCount: dayCount,
                   livingCount: livingCount
                 })
               }
@@ -647,11 +737,20 @@ export default {
 
     },
     countRooms() {
+      debugger
       let countObjs = []
       this.columnsCount = []
+      console.log(this.roomCount, 'roomCount')
+      console.log(this.columns, 'columns')
       this.columns.forEach(s => {
         let dayCountTitle = this.roomCount
+        console.log(this.roomCount)
+        console.log(this.nowRoomIds, 'nowRoomIds')
+
         this.roomStatuList.forEach(r => {
+          if (!this.nowRoomIds.includes(r.roomId)){
+            return
+          }
           if (s.date >= new Date(r.arrivalTime).format('yyyy-MM-dd') && s.date < new Date(r.dueOutTime).format('yyyy-MM-dd')) {
             dayCountTitle -= 1;
           }
@@ -686,10 +785,10 @@ export default {
 
 <style >
 .wrapper-tb_true {
-  border-left: 3px solid #314659 !important;
-  border-top: 3px solid #314659 !important;
-  border-right: 3px solid #314659 !important;
-  border-bottom: 3px solid #314659 !important;
+  border-left: 4px solid #62e110 !important;
+  border-top: 4px solid #62e110 !important;
+  border-right: 4px solid #62e110 !important;
+  border-bottom: 4px solid #62e110 !important;
 }
 
 .wrapper-item {

+ 124 - 36
src/views/room/fangtailive.vue

@@ -217,6 +217,8 @@
                           }}
                         </p>
                         <p>注:{{ roomLive.livingData.livingOrder.remark }}</p>
+                        <p v-if="roomLive.bookingData.releBookingRooms != null && roomLive.bookingData.releBookingRooms.length > 1">关联房:{{ releBookingRoom(roomLive.bookingData.releBookingRooms) }}</p>
+                        <p>对客服务:{{ roomLive.livingData.livingOrder.ddisturb ? "  免打扰" : '' }} {{ roomLive.livingData.livingOrder.dquery ? "  免查询" : ''  }}</p>
                       </template>
                       <template
                         slot="title"
@@ -226,9 +228,9 @@
                       >
                         <p>
                           客人姓名:{{
-                            roomLive.livingData.livingCustomers
+                            roomLive.livingData.livingCustomers && !roomLive.livingData.livingOrder.secrecy
                               ? roomLive.livingData.livingCustomers.customerName
-                              : ''
+                              : '--'
                           }}
                           性别:{{
                             roomLive.livingData.livingCustomers
@@ -379,10 +381,9 @@
                             <div>
                               <span>
                                 {{
-                                  roomLive.livingData.livingCustomers
-                                    ? roomLive.livingData.livingCustomers
-                                      .customerName
-                                    : ''
+                                  roomLive.livingData.livingCustomers && !roomLive.livingData.livingOrder.secrecy
+                                    ? roomLive.livingData.livingCustomers.customerName
+                                    : '-- '
                                 }}
                                 <a-tag
                                   color="pink"
@@ -421,9 +422,9 @@
                               > -->
                               <span
                               >¥{{
-                                roomLive.livingData.price &&
-                                  roomLive.livingData.price.length > 0
-                                  ? roomLive.livingData.price[0].price
+                                roomLive.livingData &&
+                                  roomLive.livingData.livingOrder
+                                  ? roomLive.livingData.livingOrder.xiaoFei
                                   : 0
                               }}/付{{
                                 roomLive.livingData &&
@@ -574,9 +575,9 @@
                             入住
                           </a-menu-item>
                           <a-menu-item
-                              key="19"
-                              v-if="roomLive.bookingData &&
-                                roomLive.bookingData.bookingOrder"
+                            key="19"
+                            v-if="roomLive.bookingData &&
+                              roomLive.bookingData.bookingOrder"
                           >
                             取消预约
                           </a-menu-item>
@@ -627,7 +628,7 @@
                           </template>
                           <a-menu-item
                             key="31"
-                            v-if="roomLive.roomInfo.roomStatus === 2"
+                            v-if="roomLive.roomInfo.roomStatus === 2 || roomLive.roomInfo.roomStatus === 4"
                           >
                             置干净
                           </a-menu-item>
@@ -675,9 +676,9 @@
                             </template>
                             <template v-if="roomLive.roomInfo.roomStatus === 3 || roomLive.roomInfo.roomStatus === 4">
 
-                              <a-menu-item key="97"> 保密房 </a-menu-item>
-                              <a-menu-item key="97"> 免打扰 </a-menu-item>
-                              <a-menu-item key="97"> 免查询 </a-menu-item>
+                              <a-menu-item @click="changeState(roomLive.livingData.livingOrder,1)"> 保密房 </a-menu-item>
+                              <a-menu-item @click="changeState(roomLive.livingData.livingOrder,2)"> 免打扰 </a-menu-item>
+                              <a-menu-item @click="changeState(roomLive.livingData.livingOrder,3)"> 免查询 </a-menu-item>
                             </template>
                           </a-sub-menu>
                           <template v-if="roomLive.roomInfo.roomStatus === 3 || roomLive.roomInfo.roomStatus === 4">
@@ -836,7 +837,7 @@
           对客服务
         </p>
         <a-checkbox-group
-          v-model="checkedCesRoomLayoutList"
+          v-model="checkedStateList"
           :options="['生日', '叫醒', '免打扰', '免查询']"
           @change="checkChange"
         >
@@ -1077,6 +1078,7 @@ export default {
       checkedCustomerSourceList: [],
       cesRoomLayoutList: [],
       checkedCesRoomLayoutList: [],
+      checkedStateList: [],
       roomBuildingFloorTree: [],
       roomStatusColorList: [],
       roomList: [],
@@ -1093,8 +1095,12 @@ export default {
   watch: {
     activeKey(key) {
       console.log('activeKey', key)
+    },
+    '$route'(to, from) {
+      this.loadData()
     }
   },
+
   computed: {
     joinDisabled() {
       // return !this.roomList.some((t) => {
@@ -1116,10 +1122,9 @@ export default {
         })
       })
       if (roomLst.some(t => t.roomInfo.roomStatus != 3 && t.roomInfo.roomStatus != 4)) {
-        console.log(1)
         return true
       }
-      return roomLst.every((c) => c.livingData.livingOrder.isRel)
+      // return roomLst.every((c) => c.livingData.livingOrder.isRel)
     },
     lockDisabled() {
       return !this.roomList.some((t) =>
@@ -1242,6 +1247,7 @@ export default {
       this.roomList.forEach((t) => {
         t.rooms.forEach((c) => {
           if (c.roomInfo.state === 88) {
+            c.roomInfo.layoutName = c.layout.name
             selectRoom.push(c.roomInfo)
           }
         })
@@ -1256,6 +1262,7 @@ export default {
     },
 
     addUnion() {
+      const that = this
       var selectRoom = []
       this.roomList.forEach((t) => {
         t.rooms.forEach((c) => {
@@ -1271,15 +1278,40 @@ export default {
         this.$message.warning('请先选择房间')
         return
       }
-      this.$refs.modalSelectCheckInRoomOrder.add()
-      this.$refs.modalSelectCheckInRoomOrder.title = '请选择需要关联的订单'
-      this.$refs.modalSelectCheckInRoomOrder.disableSubmit = false
-      this.$refs.modalSelectCheckInRoomOrder.livingOrderId =
-        selectRoom[0].livingOrderId
-      this.$refs.modalSelectCheckInRoomOrder.livingRoomId =
-        selectRoom[0].roomId
-      this.$refs.modalSelectCheckInRoomOrder.hotelId =
-          this.roomList[0].hotelId
+      if (selectRoom.length === 1) {
+        this.$refs.modalSelectCheckInRoomOrder.add()
+        this.$refs.modalSelectCheckInRoomOrder.title = '请选择需要关联的订单'
+        this.$refs.modalSelectCheckInRoomOrder.disableSubmit = false
+        this.$refs.modalSelectCheckInRoomOrder.livingOrderId =
+            selectRoom[0].livingOrderId
+        this.$refs.modalSelectCheckInRoomOrder.livingRoomId =
+            selectRoom[0].roomId
+        this.$refs.modalSelectCheckInRoomOrder.hotelId =
+            this.roomList[0].hotelId
+      } else {
+        console.log(selectRoom)
+        this.$confirm({
+          title: '提示',
+          content: '确定关联房间?',
+          onOk: function () {
+            let httpurl =
+                '/business/busRoomBookingOrders/merge-order?livingRoomId=' +
+                selectRoom[0].livingOrderId
+            let livingOrderIds = selectRoom.slice(1).map(t => t.livingOrderId)
+            that.loading = true
+            postAction(httpurl, livingOrderIds).then((res) => {
+              if (res.success) {
+                that.$message.success(res.message)
+                that.loadData()
+              } else {
+                that.$message.warning(res.message)
+              }
+            }).finally(() => {
+              that.loading = false
+            })
+          }
+        })
+      }
     },
     close() {
       this.loadData()
@@ -1295,6 +1327,15 @@ export default {
       }
       return ''
     },
+
+    releBookingRoom(value) {
+      let index = value.findIndex(e => e.isMain)
+      if (index > 0) {
+        [value[0], value[index]] = [value[index], value[0]]
+      }
+      let bookingRooms = value.map(e => e.roomsName)
+      return '主' + bookingRooms.join()
+    },
     checkInCount(rooms) {
       return rooms.filter((t) => t.livingData && t.livingData.livingOrder)
         .length
@@ -1371,6 +1412,7 @@ export default {
         this.$message.warning(e.message)
         return
       }
+      debugger
       this.$refs.ModalBillRoomForm.addList(selectRoom, e.key)
       this.$refs.ModalBillRoomForm.title =
         e.key == '1' ? '散客入住登记' : '团队入住登记'
@@ -1417,6 +1459,10 @@ export default {
           }
         } else {
           roomLive.roomInfo.state = 0
+          if (!this.multipleRoom) {
+            this.checkInBtnDis = false
+            this.scheduleBtnDis = false
+          }
         }
         if (this.multipleRoom) {
           this.checkInBtnDis = false
@@ -1536,6 +1582,7 @@ export default {
           return acc
         }, [])
       }
+      debugger
       if (this.checkedCustomerSourceList.length > 0) {
         list = list.reduce((acc, curr) => {
           const rooms = curr.rooms.filter((room) =>
@@ -1553,6 +1600,13 @@ export default {
           return acc
         }, [])
       }
+      console.log(this.checkedRoomStatusList)
+
+      if (this.checkedStateList.length > 0) {
+        if (this.checkedStateList.includes('免打扰')) {
+        }
+
+      }
       if (this.checkedroomBuildingFloorList.length > 0) {
         list = list.filter(
           (item) =>
@@ -1872,7 +1926,7 @@ export default {
         this.$refs.ModalLockRoom.title = '锁房'
         this.$refs.ModalLockRoom.disableSubmit = false
       } else if (e.key == '51') {
-        //置维修
+        // 置维修
         var selectRoom = [row.roomInfo.id]
         if (selectRoom.length === 0) {
           this.$message.warning('请先选择房间')
@@ -1989,28 +2043,62 @@ export default {
           }
         })
       } else if (e.key == 97) {
+
+
         that.$message.success('设置成功')
       } else if (e.key == 96) {
         let obj = {
           ...row.roomInfo,
           layoutName: row.layout.name,
-          roomInfo: {
-            key1: row.livingData.livingCustomers.customerName,
-            key5: row.livingData.livingCustomers.phone
-          }
+          customerName: row.livingData.livingCustomers.customerName,
+          phone: row.livingData.livingCustomers.phone
         }
         console.log(obj)
-        debugger
         this.$refs.batchCardModalCopy.edit([obj])
       }
     },
+    changeState(livingOrder, state) {
+      console.log(livingOrder)
+      let secrecy = (state === 1 ? !livingOrder.secrecy : livingOrder.secrecy)
+      let ddisturb = state === 2 ? !livingOrder.ddisturb : livingOrder.ddisturb
+      let dquery = state === 3 ? !livingOrder.dquery : livingOrder.dquery
+      let param = {
+        id: livingOrder.id,
+        ddisturb,
+        dquery,
+        secrecy
+      }
+      getAction('/business/busRoomBookingOrders/changeState', param).then(resp => {
+        console.log(resp)
+        if (resp.success) {
+          livingOrder.ddisturb = ddisturb
+          livingOrder.dquery = dquery
+          livingOrder.secrecy = secrecy
+          this.$forceUpdate()
+          this.$message.success(resp.message)
+        } else {
+          this.$message.error(resp.message)
+        }
+      })
+    },
     modalBillRoomFormOk(e) {
       this.loadData()
       console.log('e', e)
       this.YDorder = e.order
       if (this.roomCard) {
-        this.$refs.batchCheckInModal.visible = true
-        this.$refs.batchCheckInModal.edit(e.model)
+        let params = []
+        e.model.roomIds.forEach(ele => {
+          let param = {
+            id: ele.roomId,
+            name: ele.name,
+            layoutName: e.model.roomPrices.find(r => r.roomId === ele.roomId).layoutName,
+            customerName: ele.key1,
+            phone: ele.key5
+          }
+          params.push(param)
+        })
+        this.$refs.batchCardModalCopy.visible = true
+        this.$refs.batchCardModalCopy.edit(params)
       } else {
         this.$refs.ModalBillRoomInfo.add(e.order)
         this.$refs.ModalBillRoomInfo.title = '账单'

+ 4 - 4
src/views/room/guestorders.vue

@@ -125,13 +125,13 @@
 
         <span slot="action" slot-scope="text, record">
           <a @click="handleInfo(record)">查看</a>
-          <a-divider v-if="queryParam.type == 2" type="vertical" />
-          <a v-if="queryParam.type == 2" @click="setOrderStatus(record)"
+          <a-divider v-if="queryParam.type == 2 && queryParam.bookingStatus == 1" type="vertical" />
+          <a v-if="queryParam.type == 2 && queryParam.bookingStatus == 1" @click="setOrderStatus(record)"
             >取消订单</a
           >
 
-          <a-divider type="vertical" v-if="queryParam.type == 2" />
-          <a v-if="queryParam.type == 2" @click="handleInfo(record)">入住</a>
+          <a-divider type="vertical" v-if="queryParam.type == 2 && queryParam.bookingStatus == 1" />
+          <a v-if="queryParam.type == 2 && queryParam.bookingStatus == 1" @click="handleInfo(record)">入住</a>
         </span>
       </a-table>
     </div>

+ 320 - 216
src/views/room/leasegoods.vue

@@ -28,8 +28,11 @@
               style="float: left; overflow: hidden"
               class="table-page-search-submitButtons"
             >
-              <a-button type="primary" @click="searchQuery" icon="search"
-                >查询</a-button
+              <a-button
+                type="primary"
+                @click="searchQuery"
+                icon="search"
+              >查询</a-button
               >
               <!-- <a-button
                 type="primary"
@@ -53,7 +56,7 @@
       <a-table
         ref="table"
         size="middle"
-        :scroll="{ x: true }"
+        :scroll="{ x: 800, y: 350 }"
         bordered
         rowKey="id"
         :columns="columns"
@@ -99,14 +102,12 @@
           </a-button>
         </template> -->
 
-
         <template v-for="col in columns.map(item=> item.dataIndex )" :slot="col" slot-scope="text, record, index">
           <div :key="col">
             <a-input
               v-if="record.editable && col == 'userName' "
               style="margin: -5px 0;width:100px;"
-              :value="text"
-              @change="e => handleChange(e.target.value, record.id, col)"
+              v-model="record.userName"
             />
             <!-- <template v-if="!record.editable && col != 'relay' ">
               {{ text }}
@@ -117,13 +118,13 @@
             <template v-if="!record.editable && col == 'relay' ">
               {{ text==1? '是':'否' }}
             </template> -->
-            <template v-if=" record.editable && col != 'userName' && col != 'roomNo' && col != 'num' && col != 'deposit' && col != 'goodName' ">
-              {{ text }}
-            </template>
-            <template v-if=" !record.editable ">
+            <!--            <template v-if=" record.editable && col != 'userName' && col != 'roomNo' && col != 'num' && col != 'deposit' && col != 'goodName' ">-->
+            <!--              {{ text }}-->
+            <!--            </template>-->
+            <template v-if=" !record.editable && col != 'payType'">
               {{ text }}
             </template>
-            <a-select v-if=" record.editable && col == 'roomNo' " v-model="record.livingOrderId" placeholder="请选择房号">
+            <a-select v-if=" record.editable && col == 'roomNo' " @change="roomChange($event, record)" v-model="record.livingOrderId" placeholder="请选择房号" style="width: 150px;">
               <a-select-option
                 :value="item.livingOrderId"
                 v-for="(item, index) in roomsList"
@@ -132,35 +133,28 @@
                 {{ item.roomName }}/{{ item.customerName }}
               </a-select-option>
             </a-select>
+            <a-select v-if="col == 'payType' " v-model:value="record.payType" style="width: 110px " :disabled="!record.editable">
+              <a-select-option v-for="type in (record.editable ? record.payTypeList : payTypeList)" :value="type.id" :disabled="type.disable">{{ type.name }}</a-select-option>
+            </a-select>
             <a-input-number
               v-if="record.editable && (col == 'num' || col == 'deposit') "
-              style="margin: -5px 0;width:100px;"
+              style="margin: -5px 0;width:100px; width: auto"
               :value="text"
+              :default-value="0"
+              :min="0"
               @change="e => handleChange(e, record.id, col)"
             />
-              <a-select v-if=" record.editable && col == 'goodName' " v-model="record.goodsId" placeholder="请选择物品">
-                <a-select-option
-                  :value="item.id"
-                  v-for="(item, index) in busDictItemList"
-                  :key="item.id"
-                >
-                  {{ item.itemText }}
-                </a-select-option>
-              </a-select>
+            <a-select v-if=" record.editable && col == 'goodName' " style="width: 130px " v-model="record.goodsId" placeholder="请选择物品">
+              <a-select-option
+                :value="item.id"
+                v-for="(item, index) in busDictItemList"
+                :key="item.id"
+              >
+                {{ item.itemText }}
+              </a-select-option>
+            </a-select>
           </div>
         </template>
-        <!-- <span slot="action" slot-scope="text, record">
-          <template v-if="!record.revertDate">
-            <a @click="handleEdit(record)">编辑</a>
-
-            <a-divider type="vertical"
-          /></template>
-          <a @click="handleDelete(record.id)">删除</a>
-          <template v-if="!record.revertDate">
-            <a-divider type="vertical" />
-            <a @click="handleRevert(record.id)">归还</a></template
-          >
-        </span> -->
         <template slot="action" slot-scope="text, record, index">
           <!-- <div>
             <a @click="handleEdit(record)">编辑</a>
@@ -176,28 +170,21 @@
             <a @click="() => save(record.id, record)">保存</a>
             <a-divider :disabled="editingKey !== ''" type="vertical" />
             <!-- <a-popconfirm title="Sure to cancel?" @confirm="() => cancel(record.id)"> -->
-              <a @click="() => cancel(record.id)">取消</a>
+            <a @click="() => cancel(record.id)">取消</a>
             <!-- </a-popconfirm> -->
           </span>
           <span v-else>
             <template v-if="!record.revertDate">
               <a :disabled="editingKey !== ''" @click="edit(record.id)">编辑</a>
 
-              <a-divider :disabled="editingKey !== ''" type="vertical"
-            /></template>
-            <a :disabled="editingKey !== ''" @click="handleDelete(record.id)">删除</a>
+              <a-divider
+                :disabled="editingKey !== ''"
+                type="vertical"
+              /></template>
             <template v-if="!record.revertDate">
               <a-divider :disabled="editingKey !== ''" type="vertical" />
               <a :disabled="editingKey !== ''" @click="handleRevert(record.id)">归还</a></template
             >
-            <!-- <a :disabled="editingKey !== ''" @click="edit(record.id)">编辑</a>
-            <a-divider :disabled="editingKey !== ''" type="vertical" />
-            <a-popconfirm :disabled="editingKey !== ''"
-              title="确定删除吗?"
-              @confirm="() => handleDelete(record.id)"
-            >
-              <a :disabled="editingKey !== ''">删除</a>
-            </a-popconfirm> -->
           </span>
 
         </template>
@@ -212,313 +199,430 @@
 </template>
 
 <script>
-import "@/assets/less/TableExpand.less";
-import { mixinDevice } from "@/utils/mixin";
-import { JeecgListMixin } from "@/mixins/JeecgListMixin";
-import CesOrderLeaseGoodsModal from "./modules/leasegoods/CesOrderLeaseGoodsModal";
-import { httpAction, postAction, getAction } from "@/api/manage";
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import CesOrderLeaseGoodsModal from './modules/leasegoods/CesOrderLeaseGoodsModal'
+import { httpAction, postAction, getAction } from '@/api/manage'
 export default {
-  name: "LeaseGoods",
+  name: 'LeaseGoods',
   mixins: [JeecgListMixin, mixinDevice],
   components: {
-    CesOrderLeaseGoodsModal,
+    CesOrderLeaseGoodsModal
   },
   props: {
     livingOrderId: {
       type: String,
-      default: null,
+      default: null
     },
+    payTypeList: {
+      type: Array,
+      default: []
+    }
   },
   data() {
     return {
-      description: "客单",
+      description: '客单',
       // 表头
       columns: [
         {
-          title: "单号",
-          align: "center",
-          dataIndex: "orderNo",
-          scopedSlots: { customRender: "orderNo" },
+          title: '单号',
+          align: 'center',
+          dataIndex: 'orderNo',
+          width: 147,
+          scopedSlots: { customRender: 'orderNo' }
         },
         {
-          title: "房号",
-          align: "center",
-          dataIndex: "roomNo",
-          scopedSlots: { customRender: "roomNo" },
+          title: '房号',
+          align: 'center',
+          dataIndex: 'roomNo',
+          width: 200,
+          scopedSlots: { customRender: 'roomNo' }
         },
         {
-          title: "姓名",
-          align: "center",
-          dataIndex: "userName",
-          scopedSlots: { customRender: "userName" },
+          title: '姓名',
+          align: 'center',
+          dataIndex: 'userName',
+          width: 147,
+          scopedSlots: { customRender: 'userName' }
         },
         {
-          title: "物品",
-          align: "center",
-          dataIndex: "goodName",
-          scopedSlots: { customRender: "goodName" },
+          title: '物品',
+          align: 'center',
+          dataIndex: 'goodName',
+          width: 170,
+          scopedSlots: { customRender: 'goodName' }
         },
         {
-          title: "数量",
-          align: "center",
-          dataIndex: "num",
-          scopedSlots: { customRender: "num" },
+          title: '数量',
+          align: 'center',
+          dataIndex: 'num',
+          width: 100,
+          scopedSlots: { customRender: 'num' }
         },
         {
-          title: "押金",
-          align: "center",
-          dataIndex: "deposit",
-          scopedSlots: { customRender: "deposit" },
+          title: '押金',
+          align: 'center',
+          dataIndex: 'deposit',
+          width: 100,
+          scopedSlots: { customRender: 'deposit' }
         },
         {
-          title: "租借时间",
-          align: "center",
-          dataIndex: "createDate",
+          title: '支付方式',
+          align: 'center',
+          dataIndex: 'payType',
+          width: 130,
+          scopedSlots: { customRender: 'payType' }
         },
         {
-          title: "归还时间",
-          align: "center",
-          dataIndex: "revertDate",
+          title: '租借时间',
+          align: 'center',
+          width: 147,
+          dataIndex: 'createDate'
         },
         {
-          title: "操作",
-          dataIndex: "action",
-          align: "center",
-          fixed: "right",
+          title: '归还时间',
+          align: 'center',
           width: 147,
-          scopedSlots: { customRender: "action" },
+          dataIndex: 'revertDate'
         },
+        {
+          title: '操作',
+          dataIndex: 'action',
+          align: 'center',
+          fixed: 'right',
+          width: 147,
+          scopedSlots: { customRender: 'action' }
+        }
       ],
       url: {
         list:
-          "/order/cesOrderLeaseGoods/list?livingOrderId=" + this.livingOrderId,
-        delete: "/order/cesOrderLeaseGoods/delete",
-        deleteBatch: "/order/cesOrderLeaseGoods/deleteBatch",
-        exportXlsUrl: "/order/cesOrderLeaseGoods/exportXls",
-        importExcelUrl: "order/cesOrderLeaseGoods/importExcel",
+          '/order/cesOrderLeaseGoods/list?livingOrderId=' + this.livingOrderId,
+        delete: '/order/cesOrderLeaseGoods/delete',
+        deleteBatch: '/order/cesOrderLeaseGoods/deleteBatch',
+        exportXlsUrl: '/order/cesOrderLeaseGoods/exportXls',
+        importExcelUrl: 'order/cesOrderLeaseGoods/importExcel'
       },
       dictOptions: {},
       superFieldList: [],
       hotelList: [],
       datetime: [],
-      dataSourceCopy:[],
+      dataSourceCopy: [],
       roomsList: [],
       isAddOk: true,
-      editingKey: "",
-      busDictItemList: [],
-    };
+      editingKey: '',
+      busDictItemList: []
+    }
   },
   created() {
-    getAction("/business/busRoomBookingOrders/living-orders?status=-1", {
-      current: 1,
-      size: 99999,
+    // getAction("/business/busRoomBookingOrders/living-orders?status=-1", {
+    //   current: 1,
+    //   size: 99999,
+    // }).then((res) => {
+    //   if (res.success) {
+    //     this.roomsList = res.result.records;
+    //     console.log(this.roomsList)
+    //   }
+    // });
+    getAction('/business/busDictItem/list', {
+      dictId: '1659108818476990465'
     }).then((res) => {
       if (res.success) {
-        this.roomsList = res.result.records;
+        this.busDictItemList = res.result.records
       }
-    });
-    getAction("/business/busDictItem/list", {
-      dictId: "1659108818476990465",
-    }).then((res) => {
-      if (res.success) {
-        this.busDictItemList = res.result.records;
-      }
-    });
+    })
   },
   computed: {
     importExcelUrl: function () {
-      return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
-    },
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
+    }
   },
   methods: {
-
+    roomChange(value, record) {
+      let find = this.roomsList.find(
+          (t) => t.livingOrderId === value
+      )
+      console.log(find)
+      record.payTypeList = find.payTypeList
+      this.$forceUpdate()
+    },
     handleChange(value, key, column) {
-      const newData = [...this.dataSource];
-      const target = newData.find(item => key === item.id);
+      console.log('fff', value, key, column)
+      debugger
+      const newData = [...this.dataSource]
+      const target = newData.find(item => key === item.id)
       if (target) {
-        target[column] = value;
-        this.dataSource = newData;
+        target[column] = value
+        this.dataSource = newData
       }
     },
-
+    add(record) {
+      console.log(record)
+      let roomInfoList = []
+      var vipIndex = this.payTypeList.findIndex((t) => t.name.includes('会员'))
+      var danweiIndex = this.payTypeList.findIndex((t) => t.name.includes('单位'))
+      record.forEach(e => {
+        let roomInfo = {
+          roomName: e.roomName,
+          roomId: e.roomId,
+          customerName: e.livingCustomers[0].customerName,
+          vipCustomerId: e.livingOrder.vipCustomerId,
+          contractTeamId: e.livingOrder.contractTeamId,
+          livingOrderId: e.livingOrder.id,
+          payTypeList: []
+        }
+        let payTypeList = JSON.parse(JSON.stringify(this.payTypeList))
+        this.$set(payTypeList[vipIndex], 'disable', e.livingOrder.vipCustomerId == null || e.livingOrder.vipCustomerId === '')
+        this.$set(payTypeList[danweiIndex], 'disable', e.livingOrder.contractTeamId == null || e.livingOrder.contractTeamId == '')
+        roomInfo.payTypeList = payTypeList
+        roomInfoList.push(roomInfo)
+      })
+      this.roomsList = roomInfoList
+      console.log(this.roomsList)
+    },
     edit(key) {
-      const newData = [...this.dataSource];
-      const target = newData.find(item => key === item.id);
-      this.editingKey = key;
+      const newData = [...this.dataSource]
+
+      const target = newData.find(item => key === item.id)
+      this.editingKey = key
       if (target) {
-        target.editable = true;
-        this.dataSource = newData;
+        console.log(this.roomsList)
+        let find = this.roomsList.find(
+            (t) => t.livingOrderId === target.livingOrderId
+        )
+        console.log(find)
+        this.$set(target, 'payTypeList', find.payTypeList)
+        target.editable = true
+        this.dataSource = newData
       }
     },
     save(key) {
-      const that = this;
-      const newData = [...this.dataSource];
-      const newCacheData = [...this.dataSourceCopy];
-      const target = newData.find(item => key === item.id);
-      const targetCache = newCacheData.find(item => key === item.id);
+      const that = this
+      const newData = [...this.dataSource]
+      const newCacheData = [...this.dataSourceCopy]
+      const target = newData.find(item => key === item.id)
+      const targetCache = newCacheData.find(item => key === item.id)
+      console.log(this.dataSource)
       if (!target.goodsId) {
-        that.$message.warning("请选择物品");
+        that.$message.warning('请选择物品')
         return
       }
       if (!target.num) {
-        that.$message.warning("请输入数量");
+        that.$message.warning('请输入数量')
+        return
+      }
+      if (target.deposit == null) {
+        that.$message.warning('请输入押金')
         return
       }
-      if (!target.deposit) {
-        that.$message.warning("请输入押金");
+      if (target.deposit !== 0 && target.payType == null) {
+        that.$message.warning('请选择支付方式')
         return
       }
       if (target && targetCache) {
-        delete target.editable;
-        this.dataSource = newData;
-        Object.assign(targetCache, target);
-        this.dataSourceCopy = newCacheData;
+        delete target.editable
+        this.dataSource = newData
+        Object.assign(targetCache, target)
+        this.dataSourceCopy = newCacheData
       }
-      that.loading = true;
-      let httpurl = "";
-      let method = "";
+      that.loading = true
+      let httpurl = ''
+      let method = ''
       if (!target.id || target.id == 9999) {
-        httpurl += '/order/cesOrderLeaseGoods/add';
-        method = "post";
+        httpurl += '/order/cesOrderLeaseGoods/add'
+        method = 'post'
       } else {
-        httpurl += '/order/cesOrderLeaseGoods/edit';
-        method = "put";
+        httpurl += '/order/cesOrderLeaseGoods/edit'
+        method = 'put'
       }
-      if (target.id==9999) {
+      if (target.id == 9999) {
         delete target.id
+        delete target.payTypeList
       }
       httpAction(httpurl, target, method)
       .then((res) => {
         if (res.success) {
-          that.$message.success(res.message);
+          that.$message.success(res.message)
           // that.$emit("ok");
           // 新增/修改 成功时,重载列表
-          this.loadData();
-          //清空列表选中
+          this.loadData()
+          // 清空列表选中
           this.onClearSelected()
         } else {
-          that.$message.warning(res.message);
+          that.$message.warning(res.message)
         }
       })
       .finally(() => {
-        that.loading = false;
+        that.loading = false
         this.isAddOk = true
-      });
-      console.log("target", target);
-      this.editingKey = '';
+      })
+      console.log('target', target)
+      this.editingKey = ''
     },
     cancel(key) {
-      const newData = [...this.dataSource];
-      const target = newData.find(item => key === item.id);
-      this.editingKey = '';
+      const newData = [...this.dataSource]
+      const target = newData.find(item => key === item.id)
+      this.editingKey = ''
       if (target) {
-        Object.assign(target, this.dataSourceCopy.find(item => key === item.id));
-        delete target.editable;
-        this.dataSource = newData;
+        Object.assign(target, this.dataSourceCopy.find(item => key === item.id))
+        delete target.editable
+        this.dataSource = newData
       }
       if (target.id == 9999) {
         this.dataSource.pop()
-        this.isAddOk = true;
+        this.isAddOk = true
       }
       this.loadData()
     },
-
+    submitForm() {
+      console.log(this.dataSource)
+      if (this.dataSource.some(e => e.id === 9999 && (!e.goodsId || !e.num || e.deposit == null))) {
+        this.$message.warning('请先补全数据')
+        return
+      }
+      let params = []
+      this.dataSource.forEach(e => {
+        if (e.id === 9999) {
+          let target = Object.assign({}, e)
+          delete target.id
+          delete target.editable
+          params.push(target)
+        }
+      })
+      if (params.length === 0) {
+        this.$emit('ok')
+        return
+      }
+      this.loading = true
+      postAction('/order/cesOrderLeaseGoods/addBatch', params)
+          .then((res) => {
+            if (res.success) {
+              this.$message.success(res.message)
+              this.$emit('ok')
+            } else {
+              this.$message.warning(res.message)
+            }
+          })
+          .finally(() => {
+            this.loading = false
+          })
+    },
 
     handleAdd() {
-      var id = null;
-      console.log("this.livingOrderId", this.livingOrderId);
+      var id = null
+      console.log('this.livingOrderId', this.livingOrderId)
       if (this.livingOrderId) {
-        var ids = this.livingOrderId.split(",");
-        id = ids[0];
+        var ids = this.livingOrderId.split(',')
+        id = ids[0]
       }
       // this.$refs.modalForm.add(id);
       // this.$refs.modalForm.title = "新增";
       // this.$refs.modalForm.disableSubmit = false;
       // return
+      console.log(this.roomsList)
       let find = this.roomsList.find(
         (t) => t.livingOrderId === id
-      );
+      )
+      debugger
       let roomId = find.roomId
       this.dataSource.push({
-        id:9999,
+        id: 9999,
         livingOrderId: id,
         relay: 1,
         editable: true,
-        hotelId:JSON.parse(localStorage.getItem("storeInfo")).id,
-        roomId:roomId,
+        hotelId: JSON.parse(localStorage.getItem('storeInfo')).id,
+        roomId: roomId,
+        deposit: 0,
+        num: 1,
+        payTypeList: find.payTypeList
       })
-      this.isAddOk = false;
-      this.editingKey = 9999;
+      this.isAddOk = false
+      this.editingKey = 9999
     },
     onChange(e, dateString) {
-      this.queryParam.startTime = dateString[0];
-      this.queryParam.endTime = dateString[1];
+      this.queryParam.startTime = dateString[0]
+      this.queryParam.endTime = dateString[1]
     },
     handleRevert(id) {
-      var that = this;
-      postAction("/order/cesOrderLeaseGoods/revert", { id: id }).then((res) => {
-        if (res.success) {
-          that.$message.success(res.message);
-          that.loadData();
-        } else {
-          that.$message.warning(res.message);
-        }
-      });
+      var that = this
+      this.$confirm({
+        title: '提示',
+        content: '是否归还押金?',
+        onOk() {
+          postAction('/order/cesOrderLeaseGoods/revert?returnDeposit=true', { id: id }).then((res) => {
+            if (res.success) {
+              that.$message.success(res.message)
+              that.loadData()
+            } else {
+              that.$message.warning(res.message)
+            }
+          })
+        },
+        // onCancel() {
+        //   postAction('/order/cesOrderLeaseGoods/revert?returnDeposit=false', { id: id }).then((res) => {
+        //     if (res.success) {
+        //       that.$message.success(res.message)
+        //       that.loadData()
+        //     } else {
+        //       that.$message.warning(res.message)
+        //     }
+        //   })
+        // }
+      })
     },
     initDictConfig() {},
     getSuperFieldList() {
-      let fieldList = [];
-      fieldList.push({ type: "string", value: "tenantId", text: "关联租户" });
-      fieldList.push({ type: "string", value: "hotelId", text: "关联酒店" });
-      fieldList.push({ type: "int", value: "userId", text: "用户ID" });
+      let fieldList = []
+      fieldList.push({ type: 'string', value: 'tenantId', text: '关联租户' })
+      fieldList.push({ type: 'string', value: 'hotelId', text: '关联酒店' })
+      fieldList.push({ type: 'int', value: 'userId', text: '用户ID' })
       fieldList.push({
-        type: "int",
-        value: "messageType",
-        text: "留言类型 1 投诉 2建议",
-      });
-      fieldList.push({ type: "string", value: "images", text: "图片逗号分隔" });
-      fieldList.push({ type: "string", value: "contentBody", text: "内容" });
-      fieldList.push({ type: "string", value: "userName", text: "姓名" });
-      fieldList.push({ type: "string", value: "userMobile", text: "手机号" });
-      fieldList.push({ type: "string", value: "roomNo", text: "房号" });
-      fieldList.push({ type: "date", value: "createDate", text: "创建时间" });
-      this.superFieldList = fieldList;
+        type: 'int',
+        value: 'messageType',
+        text: '留言类型 1 投诉 2建议'
+      })
+      fieldList.push({ type: 'string', value: 'images', text: '图片逗号分隔' })
+      fieldList.push({ type: 'string', value: 'contentBody', text: '内容' })
+      fieldList.push({ type: 'string', value: 'userName', text: '姓名' })
+      fieldList.push({ type: 'string', value: 'userMobile', text: '手机号' })
+      fieldList.push({ type: 'string', value: 'roomNo', text: '房号' })
+      fieldList.push({ type: 'date', value: 'createDate', text: '创建时间' })
+      this.superFieldList = fieldList
     },
     loadData(arg) {
-      if (this.url.list==2) {
+      if (this.url.list == 2) {
         return
       }
-      if(!this.url.list){
-        this.$message.error("请设置url.list属性!")
+      if (!this.url.list) {
+        this.$message.error('请设置url.list属性!')
         return
       }
-      //加载数据 若传入参数1则加载第一页的内容
+      // 加载数据 若传入参数1则加载第一页的内容
       if (arg === 1) {
-        this.ipagination.current = 1;
+        this.ipagination.current = 1
       }
-      var params = this.getQueryParams();//查询条件
-      this.loading = true;
+      var params = this.getQueryParams()// 查询条件
+      this.loading = true
       getAction(this.url.list, params).then((res) => {
         if (res.success) {
-          //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-          this.dataSource = res.result.records||res.result;
-          this.dataSourceCopy = res.result.records||res.result
-          if(res.result.total)
-          {
-            this.ipagination.total = res.result.total;
-          }else{
-            this.ipagination.total = 0;
+          // update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+          this.dataSource = res.result.records || res.result
+          this.dataSourceCopy = res.result.records || res.result
+          if (res.result.total) {
+            this.ipagination.total = res.result.total
+          } else {
+            this.ipagination.total = 0
           }
-          //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-        }else{
+          // update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+        } else {
           this.$message.warning(res.message)
         }
       }).finally(() => {
         this.loading = false
       })
-    },
-  },
-};
+    }
+  }
+}
 </script>
 <style scoped>
 @import "~@assets/less/common.less";

+ 229 - 180
src/views/room/membermessage.vue

@@ -28,8 +28,11 @@
               style="float: left; overflow: hidden"
               class="table-page-search-submitButtons"
             >
-              <a-button type="primary" @click="searchQuery" icon="search"
-                >查询</a-button
+              <a-button
+                type="primary"
+                @click="searchQuery"
+                icon="search"
+              >查询</a-button
               >
               <!-- <a-button
                 type="primary"
@@ -55,7 +58,8 @@
       <a-table
         ref="table"
         size="middle"
-        :scroll="{ x: true }"
+        :scroll="{ x: 800, y: 350 }"
+        style="height: 450px;"
         bordered
         rowKey="id"
         :columns="columns"
@@ -101,7 +105,6 @@
           </a-button>
         </template> -->
 
-
         <template v-for="col in columns.map(item=> item.dataIndex )" :slot="col" slot-scope="text, record, index">
           <div :key="col">
             <a-input
@@ -111,7 +114,9 @@
               @change="e => handleChange(e.target.value, record.id, col)"
             />
             <template v-if="!record.editable && col != 'relay' ">
-              {{ text }}
+              <span style="text-overflow: ellipsis; max-width: 140px; overflow: hidden; display: inline-block;" :title="text">
+                {{ text }}
+              </span>
             </template>
             <template v-if="record.editable && col == 'createDate' ">
               {{ text }}
@@ -128,27 +133,39 @@
                 {{ item.roomName }}/{{ item.customerName }}
               </a-select-option>
             </a-select>
-            <j-date
-                v-if=" record.editable && col == 'remindDate' "
-                placeholder="请选择自动提醒时间"
-                v-model="record.remindDate"
-                style="width: 100%"
+
+              <!--            <j-date-->
+              <!--              v-if=" record.editable && col == 'remindDate' "-->
+              <!--              placeholder="自动提醒时间"-->
+              <!--              v-model="record.remindDate"-->
+              <!--              style="width: 100%"-->
+              <!--            />-->
+              <a-date-picker
+                  v-if=" record.editable && col == 'remindDate' "
+                  style="width: 100%;"
+                  v-model="record.remindDate"
+                  placeholder="自动提醒时间"
+                  :show-time="true"
+                  format="YYYY-MM-DD HH:mm:ss"
+                  :allowClear="false"
               />
-            <j-date
+
+            <a-date-picker
                 v-if=" record.editable && col == 'validDate' "
-                placeholder="请选择有效时间"
+                style="width: 100%;"
                 v-model="record.validDate"
-                style="width: 100%"
-              />
-              <a-select v-if=" record.editable && col == 'relay' " placeholder="请选择" v-model="record.relay">
-                <a-select-option :value="1"> 是 </a-select-option>
-                <a-select-option :value="2"> 否 </a-select-option>
-              </a-select>
+                placeholder="有效时间"
+                :show-time="true"
+                format="YYYY-MM-DD HH:mm:ss"
+                :allowClear="false"
+            />
+            <a-select v-if=" record.editable && col == 'relay' " placeholder="请选择" v-model="record.relay">
+              <a-select-option :value="1"> 是 </a-select-option>
+              <a-select-option :value="2"> 否 </a-select-option>
+            </a-select>
           </div>
         </template>
 
-
-
         <template slot="action" slot-scope="text, record, index">
           <!-- <div>
             <a @click="handleEdit(record)">编辑</a>
@@ -164,14 +181,15 @@
             <a @click="() => save(record.id, record)">保存</a>
             <a-divider :disabled="editingKey !== ''" type="vertical" />
             <!-- <a-popconfirm title="Sure to cancel?" @confirm="() => cancel(record.id)"> -->
-              <a @click="() => cancel(record.id)">取消</a>
+            <a @click="() => cancel(record.id)">取消</a>
             <!-- </a-popconfirm> -->
           </span>
           <span v-else>
             <!-- <a :disabled="editingKey !== ''" @click="() => edit(record.id)">Edit</a> -->
             <a :disabled="editingKey !== ''" @click="edit(record.id)">编辑</a>
             <a-divider :disabled="editingKey !== ''" type="vertical" />
-            <a-popconfirm :disabled="editingKey !== ''"
+            <a-popconfirm
+              :disabled="editingKey !== ''"
               title="确定删除吗?"
               @confirm="() => handleDelete(record.id)"
             >
@@ -196,215 +214,247 @@
 </template>
 
 <script>
-import "@/assets/less/TableExpand.less";
-import { mixinDevice } from "@/utils/mixin";
-import { JeecgListMixin } from "@/mixins/JeecgListMixin";
-import BusMemberMessageModal from "./modules/membermessage/BusMemberMessageModal";
-import { deleteAction, getAction,downFile,getFileAccessHttpUrl, httpAction } from '@/api/manage'
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import BusMemberMessageModal from './modules/membermessage/BusMemberMessageModal'
+import { deleteAction, getAction, downFile, getFileAccessHttpUrl, httpAction } from '@/api/manage'
+import moment from 'moment'
+
+// const disabledDate = (current: Dayjs) => {
+//   // Can not select days before today and today
+//   return current && current < dayjs().endOf('day');
+// };
+
+const disabledDateTime = () => {
+  return {
+    disabledHours: () => range(0, 24).splice(4, 20),
+    disabledMinutes: () => range(30, 60),
+    disabledSeconds: () => [55, 56],
+  };
+};
 
 export default {
-  name: "BusMemberMessageList",
+  name: 'BusMemberMessageList',
   mixins: [JeecgListMixin, mixinDevice],
   components: {
-    BusMemberMessageModal,
+    BusMemberMessageModal
   },
   props: {
     livingOrderId: {
       type: String,
-      default: null,
-    },
+      default: null
+    }
   },
   data() {
     return {
-      editingKey: "",
-      description: "bus_member_message管理页面",
+      editingKey: '',
+      description: 'bus_member_message管理页面',
       // 表头
       columns: [
         {
-          title: "房号",
-          align: "center",
-          dataIndex: "roomNo",
-          scopedSlots: { customRender: "roomNo" },
+          title: '房号',
+          align: 'center',
+          dataIndex: 'roomNo',
+          width: 147,
+          scopedSlots: { customRender: 'roomNo' }
         },
         {
-          title: "留言人",
-          align: "center",
-          dataIndex: "userName",
-          scopedSlots: { customRender: "userName" },
+          title: '留言人',
+          align: 'center',
+          dataIndex: 'userName',
+          width: 147,
+          scopedSlots: { customRender: 'userName' }
         },
         {
-          title: "自动提醒时间",
-          align: "center",
-          dataIndex: "remindDate",
+          title: '是否传达',
+          align: 'center',
+          dataIndex: 'relay',
+          width: 147,
+          scopedSlots: { customRender: 'relay' }
           // customRender: function (text) {
-          //   return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          //   return !text ? "否" : "是";
           // },
-          scopedSlots: { customRender: "remindDate" },
         },
         {
-          title: "有效时间",
-          align: "center",
-          dataIndex: "validDate",
-          scopedSlots: { customRender: "validDate" },
+          title: '自动提醒时间',
+          align: 'center',
+          dataIndex: 'remindDate',
           // customRender: function (text) {
           //   return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
           // },
+          width: 210,
+          scopedSlots: { customRender: 'remindDate' }
         },
         {
-          title: "是否传达",
-          align: "center",
-          dataIndex: "relay",
-          scopedSlots: { customRender: "relay" },
+          title: '有效时间',
+          align: 'center',
+          dataIndex: 'validDate',
+          width: 210,
+          scopedSlots: { customRender: 'validDate' }
           // customRender: function (text) {
-          //   return !text ? "否" : "是";
+          //   return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
           // },
         },
         {
-          title: "留言内容",
-          align: "center",
-          scopedSlots: { customRender: "contentBody" },
-          dataIndex: "contentBody",
+          title: '留言内容',
+          align: 'center',
+          scopedSlots: { customRender: 'contentBody' },
+          width: 147,
+          dataIndex: 'contentBody'
         },
         {
-          title: "创建时间",
-          align: "center",
-          dataIndex: "createDate",
-          scopedSlots: { customRender: "createDate" },
+          title: '创建时间',
+          align: 'center',
+          dataIndex: 'createDate',
+          scopedSlots: { customRender: 'createDate' },
+          width: 147
           // customRender: function (text) {
           //   return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
           // },
         },
         {
-          title: "操作",
-          dataIndex: "action",
-          align: "center",
-          fixed: "right",
+          title: '操作',
+          dataIndex: 'action',
+          align: 'center',
+          fixed: 'right',
           width: 147,
-          scopedSlots: { customRender: "action" },
-        },
+          scopedSlots: { customRender: 'action' }
+        }
       ],
       url: {
         list:
-          "/business/busMemberMessage/list?livingOrderId=" + this.livingOrderId,
-        delete: "/business/busMemberMessage/delete",
-        deleteBatch: "/business/busMemberMessage/deleteBatch",
-        exportXlsUrl: "/business/busMemberMessage/exportXls",
-        importExcelUrl: "business/busMemberMessage/importExcel",
+          '/business/busMemberMessage/list?livingOrderId=' + this.livingOrderId,
+        delete: '/business/busMemberMessage/delete',
+        deleteBatch: '/business/busMemberMessage/deleteBatch',
+        exportXlsUrl: '/business/busMemberMessage/exportXls',
+        importExcelUrl: 'business/busMemberMessage/importExcel'
       },
       dictOptions: {},
       superFieldList: [],
       datetime: [],
-      dataSourceCopy:[],
+      dataSourceCopy: [],
       roomsList: [],
-      isAddOk: true,
-    };
+      isAddOk: true
+    }
   },
   created() {
-    this.getSuperFieldList();
-    getAction("/business/busRoomBookingOrders/living-orders?status=-1", {
+    this.getSuperFieldList()
+    getAction('/business/busRoomBookingOrders/living-orders?status=-1', {
       current: 1,
-      size: 99999,
+      size: 99999
     }).then((res) => {
       if (res.success) {
-        this.roomsList = res.result.records;
+        this.roomsList = res.result.records
       }
-    });
+    })
   },
   computed: {
     importExcelUrl: function () {
-      return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
-    },
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
+    }
   },
   methods: {
 
     handleChange(value, key, column) {
-      const newData = [...this.dataSource];
-      const target = newData.find(item => key === item.id);
+      const newData = [...this.dataSource]
+      const target = newData.find(item => key === item.id)
       if (target) {
-        target[column] = value;
-        this.dataSource = newData;
+        target[column] = value
+        this.dataSource = newData
       }
     },
 
     edit(key) {
-      const newData = [...this.dataSource];
-      const target = newData.find(item => key === item.id);
-      this.editingKey = key;
+      const newData = [...this.dataSource]
+      const target = newData.find(item => key === item.id)
+      this.editingKey = key
       if (target) {
-        target.editable = true;
-        this.dataSource = newData;
+        target.editable = true
+        this.dataSource = newData
       }
     },
     save(key) {
-      const that = this;
-      const newData = [...this.dataSource];
-      const newCacheData = [...this.dataSourceCopy];
-      const target = newData.find(item => key === item.id);
-      const targetCache = newCacheData.find(item => key === item.id);
-      if (!target.remindDate) {
-        that.$message.warning("自动提醒时间不能为空");
+      console.log(key)
+      console.log(this.dataSource)
+      const that = this
+      const newData = [...this.dataSource]
+      const newCacheData = [...this.dataSourceCopy]
+      const target = newData.find(item => key === item.id)
+      const targetCache = newCacheData.find(item => key === item.id)
+      if (target.relay === 1 && !target.remindDate) {
+        that.$message.warning('自动提醒时间不能为空')
         return
       }
-      if (!target.validDate) {
-        that.$message.warning("有效时间不能为空");
+      if (target.relay === 1 && !target.validDate) {
+        that.$message.warning('有效时间不能为空')
         return
       }
+      console.log(target.remindDate)
+      if (target.remindDate != null) {
+        target.remindDate = moment(target.remindDate).format('YYYY-MM-DD HH:mm:ss')
+        debugger
+      }
+      if (target.validDate != null) {
+        target.validDate = moment(target.validDate).format('YYYY-MM-DD HH:mm:ss')
+      }
       if (target && targetCache) {
-        delete target.editable;
-        this.dataSource = newData;
-        Object.assign(targetCache, target);
-        this.dataSourceCopy = newCacheData;
+        delete target.editable
+        this.dataSource = newData
+        Object.assign(targetCache, target)
+        this.dataSourceCopy = newCacheData
       }
-      that.loading = true;
-      let httpurl = "";
-      let method = "";
+      that.loading = true
+      let httpurl = ''
+      let method = ''
       if (!target.id || target.id == 9999) {
-        httpurl += '/business/busMemberMessage/add';
-        method = "post";
+        httpurl += '/business/busMemberMessage/add'
+        method = 'post'
       } else {
-        httpurl += '/business/busMemberMessage/edit';
-        method = "put";
+        httpurl += '/business/busMemberMessage/edit'
+        method = 'put'
       }
-      if (target.id==9999) {
+      if (target.id == 9999) {
         delete target.id
       }
       httpAction(httpurl, target, method)
       .then((res) => {
         if (res.success) {
-          that.$message.success(res.message);
+          that.$message.success(res.message)
           // that.$emit("ok");
           // 新增/修改 成功时,重载列表
-          this.loadData();
-          //清空列表选中
+          this.loadData()
+          // 清空列表选中
           this.onClearSelected()
         } else {
-          that.$message.warning(res.message);
+          that.$message.warning(res.message)
         }
       })
       .finally(() => {
-        that.loading = false;
+        that.loading = false
         this.isAddOk = true
-      });
-      console.log("target", target);
-      this.editingKey = '';
+      })
+      console.log('target', target)
+      this.editingKey = ''
     },
     cancel(key) {
-      const newData = [...this.dataSource];
-      const target = newData.find(item => key === item.id);
-      this.editingKey = '';
+      const newData = [...this.dataSource]
+      const target = newData.find(item => key === item.id)
+      this.editingKey = ''
       if (target) {
-        Object.assign(target, this.dataSourceCopy.find(item => key === item.id));
-        delete target.editable;
-        this.dataSource = newData;
+        Object.assign(target, this.dataSourceCopy.find(item => key === item.id))
+        delete target.editable
+        this.dataSource = newData
       }
       if (target.id == 9999) {
         this.dataSource.pop()
-        this.isAddOk = true;
+        this.isAddOk = true
       }
       this.loadData()
     },
-
-
+    submitForm() {
+      this.$emit('ok')
+    },
     handleAdd() {
       console.log(this.roomsList)
       // this.$refs.modalForm.add(this.livingOrderId);
@@ -412,85 +462,84 @@ export default {
       // this.$refs.modalForm.disableSubmit = false;
       let find = this.roomsList.find(
         (t) => t.livingOrderId === this.livingOrderId
-      );
+      )
       let roomId = find.roomId
       this.dataSource.push({
-        id:9999,
+        id: 9999,
         livingOrderId: this.livingOrderId,
         relay: 1,
         editable: true,
-        hotelId:JSON.parse(localStorage.getItem("storeInfo")).id,
-        roomId:roomId,
+        hotelId: JSON.parse(localStorage.getItem('storeInfo')).id,
+        roomId: roomId
       })
-      this.isAddOk = false;
-      this.editingKey = 9999;
+      this.isAddOk = false
+      this.editingKey = 9999
     },
     onChange(e, dateString) {
-      this.queryParam.startTime = dateString[0];
-      this.queryParam.endTime = dateString[1];
+      this.queryParam.startTime = dateString[0]
+      this.queryParam.endTime = dateString[1]
     },
     initDictConfig() {},
     getSuperFieldList() {
-      let fieldList = [];
-      fieldList.push({ type: "string", value: "tenantId", text: "关联租户" });
-      fieldList.push({ type: "string", value: "hotelId", text: "关联酒店" });
-      fieldList.push({ type: "string", value: "roomId", text: "房号id" });
+      let fieldList = []
+      fieldList.push({ type: 'string', value: 'tenantId', text: '关联租户' })
+      fieldList.push({ type: 'string', value: 'hotelId', text: '关联酒店' })
+      fieldList.push({ type: 'string', value: 'roomId', text: '房号id' })
       fieldList.push({
-        type: "string",
-        value: "livingOrderId",
-        text: "入住订单id",
-      });
-      fieldList.push({ type: "string", value: "userName", text: "留言人" });
+        type: 'string',
+        value: 'livingOrderId',
+        text: '入住订单id'
+      })
+      fieldList.push({ type: 'string', value: 'userName', text: '留言人' })
       fieldList.push({
-        type: "date",
-        value: "remindDate",
-        text: "自动提醒时间",
-      });
-      fieldList.push({ type: "date", value: "validDate", text: "有效时间" });
-      fieldList.push({ type: "int", value: "relay", text: "是否传达" });
+        type: 'date',
+        value: 'remindDate',
+        text: '自动提醒时间'
+      })
+      fieldList.push({ type: 'date', value: 'validDate', text: '有效时间' })
+      fieldList.push({ type: 'int', value: 'relay', text: '是否传达' })
       fieldList.push({
-        type: "string",
-        value: "contentBody",
-        text: "留言内容",
-      });
-      fieldList.push({ type: "date", value: "createDate", text: "创建时间" });
-      this.superFieldList = fieldList;
+        type: 'string',
+        value: 'contentBody',
+        text: '留言内容'
+      })
+      fieldList.push({ type: 'date', value: 'createDate', text: '创建时间' })
+      this.superFieldList = fieldList
     },
     loadData(arg) {
-      if (this.url.list==2) {
+      if (this.url.list == 2) {
         return
       }
-      if(!this.url.list){
-        this.$message.error("请设置url.list属性!")
+      if (!this.url.list) {
+        this.$message.error('请设置url.list属性!')
         return
       }
-      //加载数据 若传入参数1则加载第一页的内容
+      // 加载数据 若传入参数1则加载第一页的内容
       if (arg === 1) {
-        this.ipagination.current = 1;
+        this.ipagination.current = 1
       }
-      var params = this.getQueryParams();//查询条件
-      this.loading = true;
+      var params = this.getQueryParams()// 查询条件
+      this.loading = true
       getAction(this.url.list, params).then((res) => {
         if (res.success) {
-          //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-          this.dataSource = res.result.records||res.result;
-          this.dataSourceCopy = res.result.records||res.result
-          if(res.result.total)
-          {
-            this.ipagination.total = res.result.total;
-          }else{
-            this.ipagination.total = 0;
+          // update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+          this.dataSource = res.result.records || res.result
+          this.dataSourceCopy = res.result.records || res.result
+          if (res.result.total) {
+            this.ipagination.total = res.result.total
+          } else {
+            this.ipagination.total = 0
           }
-          //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-        }else{
+          // update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+        } else {
           this.$message.warning(res.message)
         }
       }).finally(() => {
         this.loading = false
       })
-    },
-  },
-};
+    }
+  }
+}
 </script>
 <style scoped>
 @import "~@assets/less/common.less";

+ 153 - 146
src/views/room/modules/checkIn/BillRoomForm.vue

@@ -68,126 +68,140 @@
                         </a-auto-complete>
                       </a-form-model-item>
                     </a-col> -->
-                    <a-col :span="12">
-                      <a-form-model-item
-                        label="姓名"
-                        :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
-                        :wrapperCol="{
-                          xs: { span: 24 },
-                          sm: { span: 16 },
-                        }"
-                        :prop="`roomIds[${aindex}].key1`"
-                        :rules="[
-                          {
-                            required: true,
-                            message: '请输入姓名!',
-                            trigger: 'change',
-                          },
-                        ]"
-                      >
-                        <a-auto-complete
-                          style="width: 60%;"
-                          v-model="room.key1"
-                          placeholder="请输入姓名"
-                          @search="handleSearch"
-                          @select="(e) => handleSelectMember(room, e)"
+                    <a-row style="align-items: self-start">
+                      <a-col :span="9">
+                        <a-form-model-item
+                          label="姓名"
+                          :labelCol="{ xs: { span: 24 }, sm: { span: 6 } }"
+                          :wrapperCol="{
+                            xs: { span: 24 },
+                            sm: { span: 18 },
+                          }"
+                          :prop="`roomIds[${aindex}].key1`"
+                          :rules="validatorRules.contactName"
                         >
-                          <template slot="dataSource">
-                            <a-select-option
-                              v-for="item in customerList"
-                              :key="item.id"
-                            >{{ item.name }}-{{ item.phone }}</a-select-option
-                            >
-                          </template>
-                        </a-auto-complete>
-                        <a-icon type="contacts" style="font-size: 18px;margin-left: 5px;" @click="readCardNo" />
-                        <span style="cursor: pointer;" v-if="room.busMemberCard&&room.busMemberCard.id" @click="showMemberCard(room.busMemberCard)">会员</span>
-                        <span style="cursor: pointer;" v-if="room.busMarketAgreementUnit&&room.busMarketAgreementUnit.id" @click="showAgreementUnit(room.busMarketAgreementUnit)"> 协议</span>
-                        <span style="cursor: pointer;" v-if="room.ruZhuHistory&&room.ruZhuHistory.phone" @click="showRuZhuHistory(room.ruZhuHistory.phone)"> 客史</span>
-
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col :span="6">
-                      <a-form-model-item
-                        label="性别"
-                        :labelCol="labelCol"
-                        :wrapperCol="wrapperCol"
-                        :prop="`roomIds[${aindex}].key2`"
-                        :rules="[
+                          <a-auto-complete
+                            style="width: 60%;"
+                            v-model="room.key1"
+                            placeholder="请输入姓名"
+                            @search="handleSearch($event,1)"
+                            @select="(e) => handleSelectMember(room, e)"
+                          >
+                            <template slot="dataSource">
+                              <a-select-option
+                                v-for="item in customerList"
+                                :key="item.id"
+                              >{{ item.name }}-{{ item.phone }}</a-select-option
+                              >
+                            </template>
+                          </a-auto-complete>
+                          <a-icon type="contacts" style="font-size: 18px;margin-left: 5px;" @click="readCardNo" />
+                          <span style="cursor: pointer;" v-if="room.busMemberCard&&room.busMemberCard.id" @click="showMemberCard(room.busMemberCard)">会员</span>
+                          <span style="cursor: pointer;" v-if="room.busMarketAgreementUnit&&room.busMarketAgreementUnit.id" @click="showAgreementUnit(room.busMarketAgreementUnit)"> 协议</span>
+                          <span style="cursor: pointer;" v-if="room.ruZhuHistory&&room.ruZhuHistory.phone" @click="showRuZhuHistory(room.ruZhuHistory.phone)"> 客史</span>
+                        </a-form-model-item>
+                      </a-col>
+                      <a-col :span="6">
+                        <a-form-model-item
+                            label="性别"
+                            :labelCol="labelCol"
+                            :wrapperCol="wrapperCol"
+                            :prop="`roomIds[${aindex}].key2`"
+                            :rules="[
                           {
                             required: true,
                             message: '请选择性别!',
                             trigger: 'change',
                           },
                         ]"
-                      >
-                        <a-select v-model="room.key2" placeholder="请选择性别">
-                          <a-select-option :value="1"> 男 </a-select-option>
-                          <a-select-option :value="2"> 女 </a-select-option>
-                        </a-select>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col :span="6">
-                      <a-form-model-item
-                        label="民族"
-                        :labelCol="labelCol"
-                        :wrapperCol="wrapperCol"
-                        :prop="`roomIds[${aindex}].key3`"
-                        :rules="[
+                        >
+                          <a-select v-model="room.key2" placeholder="请选择性别">
+                            <a-select-option :value="1"> 男 </a-select-option>
+                            <a-select-option :value="2"> 女 </a-select-option>
+                          </a-select>
+                        </a-form-model-item>
+                      </a-col>
+                      <a-col :span="6">
+                        <a-form-model-item
+                            label="民族"
+                            :labelCol="labelCol"
+                            :wrapperCol="wrapperCol"
+                            :prop="`roomIds[${aindex}].key3`"
+                            :rules="[
                           {
                             required: true,
                             message: '请选择民族!',
                             trigger: 'change',
                           },
                         ]"
-                      >
-                        <a-select v-model="room.key3" placeholder="请选择民族">
-                          <a-select-option value="汉"> 汉 </a-select-option>
-                          <a-select-option value="回"> 回 </a-select-option>
-                        </a-select>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col :span="16">
-                      <a-form-model-item
-                        label="身份证号"
-                        :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
-                        :wrapperCol="{
+                        >
+                          <a-select v-model="room.key3" placeholder="请选择民族">
+                            <a-select-option value="汉"> 汉 </a-select-option>
+                            <a-select-option value="回"> 回 </a-select-option>
+                          </a-select>
+                        </a-form-model-item>
+                      </a-col>
+                    </a-row>
+                    <a-row style="align-items: self-start">
+                      <a-col :span="8">
+                        <a-form-model-item
+                            label="手机号"
+                            :labelCol="{ xs: { span: 24 }, sm: { span: 7 } }"
+                            :wrapperCol="{
                           xs: { span: 24 },
-                          sm: { span: 16 },
+                          sm: { span: 17 },
                         }"
-                        :prop="`roomIds[${aindex}].key4`"
-                      >
-                        <a-input
-                          v-model="room.key4"
-                          placeholder="请输身份证号"
-                        ></a-input>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col :span="8">
-                      <a-form-model-item
-                        label="手机号"
-                        :labelCol="labelCol"
-                        :wrapperCol="wrapperCol"
-                        :prop="`roomIds[${aindex}].key5`"
-                      >
-                        <a-auto-complete
-                            style="width: 60%;"
-                            v-model="room.key5"
-                            placeholder="请输入手机号"
-                            @search="phoneHandleSearch"
-                            @select="(e) => handleSelectMember(room, e)"
+                            :prop="`roomIds[${aindex}].key5`"
+                            :rules="validatorRules.phone"
                         >
-                          <template slot="dataSource">
-                            <a-select-option
-                                v-for="item in customerList"
-                                :key="item.id"
-                            >{{ item.name }}-{{ item.phone }}</a-select-option
-                            >
-                          </template>
-                        </a-auto-complete>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col :span="24">
+                          <a-auto-complete
+                              style="width: 80%;"
+                              v-model="room.key5"
+                              placeholder="请输入手机号"
+                              @search="handleSearch($event,5)"
+                              @select="(e) => handleSelectMember(room, e)"
+                          >
+                            <template slot="dataSource">
+                              <a-select-option
+                                  v-for="item in customerList"
+                                  :key="item.id"
+                              >{{ item.name }}-{{ item.phone }}</a-select-option
+                              >
+                            </template>
+                          </a-auto-complete>
+                        </a-form-model-item>
+                      </a-col>
+                      <a-col :span="16">
+                        <a-form-model-item
+                            label="身份证号"
+                            :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
+                            :wrapperCol="{
+                          xs: { span: 24 },
+                          sm: { span: 18 },
+                        }"
+                            :prop="`roomIds[${aindex}].key4`"
+                            :rules="validatorRules.certNo"
+                        >
+                          <a-auto-complete
+                              style="width: 60%;"
+                              v-model="room.key4"
+                              placeholder="请输入证件号"
+                              @search="handleSearch($event,4)"
+                              @select="(e) => handleSelectMember(room, e)"
+                          >
+                            <template slot="dataSource">
+                              <a-select-option
+                                  v-for="item in customerList"
+                                  :key="item.id"
+                              >{{ item.name }}-{{ item.phone }}-{{ item.certNo }}</a-select-option
+                              >
+                            </template>
+                          </a-auto-complete>
+                        </a-form-model-item>
+                      </a-col>
+                    </a-row>
+
+                    <a-col :span="20">
                       <a-form-model-item
                         label="联系地址"
                         :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
@@ -229,13 +243,7 @@
                             sm: { span: 22 },
                           }"
                           :prop="`roomIds[${aindex}].livingCustomers2[${index}].customerName`"
-                          :rules="[
-                            {
-                              required: true,
-                              message: '请输入姓名!',
-                              trigger: 'change',
-                            },
-                          ]"
+                          :rules="validatorRules.contactName"
                         >
                           <a-input
                             v-model="item.customerName"
@@ -280,14 +288,9 @@
                             sm: { span: 23 },
                           }"
                           :prop="`roomIds[${aindex}].livingCustomers2[${index}].certNo`"
-                          :rules="[
-                            {
-                              required: true,
-                              message: '请输入证件号!',
-                              trigger: 'change',
-                            },
-                          ]"
+                          :rules="validatorRules.certNo"
                         >
+
                           <a-input
                             v-model="item.certNo"
                             placeholder="证件号"
@@ -301,13 +304,7 @@
                             sm: { span: 24 },
                           }"
                           :prop="`roomIds[${aindex}].livingCustomers2[${index}].phone`"
-                          :rules="[
-                            {
-                              required: true,
-                              message: '请输入手机号!',
-                              trigger: 'change',
-                            },
-                          ]"
+                          :rules="validatorRules.phone"
                         >
                           <a-input
                             v-model="item.phone"
@@ -702,7 +699,7 @@
                   </a-form-model-item>
                 </a-col>
               </div>
-              <div style="width: 43%">
+              <div style="width: 43%;">
                 <div
                   style="
                     display: flex;
@@ -720,7 +717,7 @@
                     财务信息
                   </h4>
                   <div>
-                    <a-switch v-model="depositSplit" />押金均摊记账到每个房间
+                    <a-switch v-model="depositSplit" />押金、房费分别记账到每个房间
                   </div>
                 </div>
                 <a-divider />
@@ -730,6 +727,7 @@
                   :pagination="false"
                   rowKey="id"
                   :scroll="{ y: 200, x: 500 }"
+                  style=" height: auto"
                 >
                   <template slot="prefPrice" slot-scope="text, record, index">
                     <div>
@@ -787,6 +785,7 @@
                         :pagination="false"
                         rowKey="id"
                         :scroll="{ y: 160 }"
+                        style=" height: auto"
                       >
                         <template
                           slot="subjectTypeLabel"
@@ -941,6 +940,7 @@
         </a-row>
       </a-form-model>
     </j-form-container>
+    <!-- 增加房间-->
     <select-room-form-modal
       ref="modalSelectRoomForm"
       @ok="modalFormOk"
@@ -1184,8 +1184,9 @@ export default {
         'orderInfo.customerType': [
           { required: true, message: '请选择客人类型!' }
         ],
-        contactName: [{ required: true, message: '请输入联系人!' }],
-        phone: [{ required: true, message: '请输入电话!' }]
+        contactName: [{ required: true, message: '请输入中文或英文姓名!',trigger: 'blur', pattern: /^[\u4E00-\u9FA5a-zA-Z]+$/ }],
+        phone: [{ required: true, message: '电话号码格式不正确!', trigger: 'blur',pattern: /^[0-9]{11}$/, }],
+        certNo: [{message: '请输入正确格式的身份证号', pattern: /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9Xx]$/ }]
       },
       url: {
         add: 'business/busRoomBookingOrders/living',
@@ -1662,9 +1663,10 @@ export default {
   },
   methods: {
     customerSourceChange(e) {
-      console.log(e)
       let idx = this.model.roomIds.findIndex(item => item.id == this.roomIdsIndexId)
       this.model.roomIds[idx].customerSource = e
+      console.log(this.model.roomIds[idx])
+      debugger
     },
     // 房价方案改变事件
     roomPriceChange(value) {
@@ -2408,21 +2410,18 @@ export default {
       }
       this.loadRooms()
     },
-    handleSearch(value) {
+    handleSearch(value, key) {
       let result
       if (!value) {
         result = this.oldcustomerList
       } else {
-        result = this.oldcustomerList.filter((t) => t.name.includes(value))
-      }
-      this.customerList = result
-    },
-    phoneHandleSearch(value) {
-      let result
-      if (!value) {
-        result = this.oldcustomerList
-      } else {
-        result = this.oldcustomerList.filter((t) => t.phone.includes(value))
+        if (key === 1) {
+          result = this.oldcustomerList.filter((t) => t.name.includes(value))
+        } else if (key === 5) {
+          result = this.oldcustomerList.filter((t) => t.phone.includes(value))
+        } else {
+          result = this.oldcustomerList.filter((t) => t.certNo && t.certNo.includes(value))
+        }
       }
       this.customerList = result
     },
@@ -2775,14 +2774,14 @@ export default {
       })
       this.modelDefault.orderInfo.bookingOrdersType = key
       this.model.orderInfo.bookingOrdersType = key
-      if (roomLiveList[0].bookingOrderId != null){
+      if (roomLiveList.length > 0 && roomLiveList[0].bookingOrderId != null && roomLiveList[0].bookingOrderId !== '' && orderInfo != null){
         this.$set(orderInfo, 'id', roomLiveList[0].bookingOrderId)
-        debugger
-
         this.modelDefault.orderInfo = orderInfo
         this.model.orderInfo = orderInfo
       }
-      this.edit(this.modelDefault)
+      if (this.modelDefault.roomIds.length > 0){
+        this.edit(this.modelDefault)
+      }
     },
     async edit(record) {
       console.log('edit', record)
@@ -2790,6 +2789,9 @@ export default {
       this.visible = true
       this.model = Object.assign({}, record)
       console.log('this.model', this.model)
+      if (this.model.roomIds && this.model.roomIds.length > 0) {
+        this.roomIdsIndexId = this.model.roomIds[0].id
+      }
       if (this.roomLayoutList.length === 0) {
         await this.getcesRoomLayout()
       }
@@ -3065,7 +3067,7 @@ export default {
         // 第一行不知道干嘛的,不过加上会导致钟点房的居住订单的预离时间多一天
         // info.dueOutTime = that.addDate(info.arrivalTime2, that.model.roomPrices[idx].day) + ' ' + moment(that.model.orderInfo.dueOutTimeSpan).format('HH:mm')
         // info.dueOutTime = that.model.roomPrices[idx].editPriceTime[that.model.roomPrices[idx].editPriceTime.length-1] + " " + moment(that.model.orderInfo.dueOutTimeSpan).format("HH:mm")
-        info.dueOutTime = moment(that.model.orderInfo.dueOutTimeSpan).format('yyyy-MM-DD HH:mm')
+        info.dueOutTime = moment(this.model.orderInfo.dueOutTime2).format('yyyy-MM-DD') + ' ' + moment(that.model.orderInfo.dueOutTimeSpan).format('HH:mm')
         t.roomOrderInfo = info
         t.roomOrderInfo.customerSource = t.customerSource
         t.roomId = t.id
@@ -3104,6 +3106,11 @@ export default {
             this.model.orderInfo.dueOutTime2 +
             ' ' +
             moment(this.model.orderInfo.dueOutTimeSpan).format('HH:mm')
+          console.log(this.model.orderInfo.arrivalTime)
+          if (new Date(this.model.orderInfo.arrivalTime) > new Date()) {
+            this.$message.warning('入住时间不能晚于当前时间')
+            return
+          }
           that.confirmLoading = true
           let httpurl = ''
           let method = ''

+ 73 - 7
src/views/room/modules/checkIn/BillRoomInfo.vue

@@ -220,6 +220,23 @@
                   />
                 </a-descriptions-item>
               </template>
+<!--               留言-->
+              <template>
+
+              </template>
+
+              <a-descriptions-item
+                  label="留言"
+                  :span="2"
+                  v-for="(item, index) in messageList.filter((item) => {
+                    return tabSelectRoomId == 1
+                      ? item
+                      : tabSelectRoomId == item.roomId;
+                  })"
+                  :key="index"
+              >
+                {{ item.contentBody }}
+              </a-descriptions-item>
             </a-descriptions>
             <div style="display: flex; justify-content: space-between">
               <h4
@@ -596,8 +613,8 @@
     <pay-or-refund-modal ref="modalPayOrRefundForm" @ok="modalFormOk"></pay-or-refund-modal>
     <fee-modal ref="modalFeeForm" @ok="modalFormOk"></fee-modal>
     <strike-balance-model  ref="modalStrikeBalanceForm" @ok="modalFormOk"></strike-balance-model>
-    <member-message-modal ref="modalMemberMessage"></member-message-modal>
-    <lease-goods-modal ref="modalLeaseGoods"></lease-goods-modal>
+    <member-message-modal ref="modalMemberMessage" @ok="modalFormOk"></member-message-modal>
+    <lease-goods-modal ref="modalLeaseGoods" @ok="modalFormOk"></lease-goods-modal>
     <select-check-in-room-order-modal
       ref="modalSelectCheckInRoomOrder"
       @ok="modalFormOk"
@@ -893,6 +910,7 @@ export default {
       columns2,
       strikeColumns,
       wakeList: [{}],
+      messageList: [{}],
       model: {
         // data: data,
         orderInfo: {},
@@ -1136,6 +1154,21 @@ export default {
         }
       )
     },
+    getMessageData() {
+      let ids = []
+      this.model.livingRoomIds.forEach((item) => {
+        if (item.roomName != '全部') {
+          ids.push(item.livingOrder && item.livingOrder.id)
+        }
+      })
+      getAction('business/busMemberMessage/list?livingOrderId=' + ids.toString()).then(
+          (res) => {
+            if (res.success) {
+              this.messageList = res.result.records
+            }
+          }
+      )
+    },
     // 删除叫醒服务
     removeWakeService(id) {
       deleteAction('/fw/fwLivingJx/delete?id=' + id).then((res) => {
@@ -1278,6 +1311,12 @@ export default {
             (t) => t.roomId == that.selectRoomId
           )
           var livingRoom = that.model.livingRoomIds[index]
+          console.log(livingRoom)
+          debugger
+          if (livingRoom.isMain) {
+            this.$message.warning('不能拆分主房')
+            return
+          }
           httpAction(
             'business/busRoomBookingOrders/split-living?livingOrderId=' +
               livingRoom.livingOrder.id,
@@ -1289,6 +1328,10 @@ export default {
                 that.$message.success('拆分成功')
                 that.getBookingOrderInfo()
                 that.$emit('ok')
+                console.log(that.model.livingRoomIds && that.model.livingRoomIds.length > 1)
+                if (that.model.livingRoomIds && that.model.livingRoomIds.length > 1) {
+                  that.tabSelectRoomId = that.model.livingRoomIds[1].roomId
+                }
               } else {
                 that.$message.warning(res.message)
               }
@@ -1342,10 +1385,15 @@ export default {
             livingOrderId += t.livingOrder.id + ','
           })
       }
-      this.$refs.modalLeaseGoods.add()
+      let chooseRooms = [this.chooseLivingRoom]
+      if (this.selectRoomId === '1') {
+        chooseRooms = this.model.livingRoomIds.filter(e => e.roomId !== '1')
+      }
+      this.$refs.modalLeaseGoods.add(chooseRooms)
       this.$refs.modalLeaseGoods.title = '物品借用'
       this.$refs.modalLeaseGoods.disableSubmit = false
       this.$refs.modalLeaseGoods.livingOrderId = livingOrderId // find.livingOrder.id;
+      this.$refs.modalLeaseGoods.payTypeList = this.payTypeList
     },
     addMessage() {
       if (this.selectRoomId === '1') {
@@ -1356,6 +1404,7 @@ export default {
         (t) => t.roomId == this.selectRoomId
       )
       var find = this.model.livingRoomIds[index]
+      console.log(find)
       this.$refs.modalMemberMessage.add()
       this.$refs.modalMemberMessage.title = '客人留言'
       this.$refs.modalMemberMessage.disableSubmit = false
@@ -1417,6 +1466,7 @@ export default {
       this.$refs.modalPaymentForm.showYinshou = false
     },
     tabChange(e) {
+      debugger
       console.log(e)
       this.selectRoomId = e
       if (e == '1') {
@@ -1563,6 +1613,12 @@ export default {
       }
       getAction(this.url.getBookingOrderInfo, obj).then((res) => {
         if (res.success) {
+          if (res.result.livingRoomIds.length > 1) {
+            let index = res.result.livingRoomIds.findIndex(e => e.isMain === true)
+              if (index !== -1 && index !== 0) {
+                [res.result.livingRoomIds[0], res.result.livingRoomIds[index]] = [res.result.livingRoomIds[index], res.result.livingRoomIds[0]]
+              }
+          }
           var livingRoomId = JSON.parse(
               JSON.stringify(res.result.livingRoomIds[0])
           )
@@ -1576,12 +1632,15 @@ export default {
           })
           livingRoomId.livingCustomers = list
           res.result.livingRoomIds.unshift(livingRoomId)
-          this.tabSelectRoomId = this.roomId
-              ? this.roomId
-              : res.result.livingRoomIds[1].roomId
-          this.selectRoomId = this.tabSelectRoomId
+          if (this.tabSelectRoomId == null || this.tabSelectRoomId === ''){
+            this.tabSelectRoomId = this.roomId
+                ? this.roomId
+                : res.result.livingRoomIds[1].roomId
+            this.selectRoomId = this.tabSelectRoomId
+          }
           this.model = res.result
           this.getWakeServiceData()
+          this.getMessageData()
           // 查询冲账账单
           this.loadStrikeDate()
           // 查询账单
@@ -1669,6 +1728,13 @@ export default {
         (t) => t.roomId == this.selectRoomId
       )
       var livingRoom = this.model.livingRoomIds[index]
+      if (livingRoom.isMain && livingRoom.roomId !== '1') {
+        let livingRoomIdList = this.model.livingRoomIds.filter(item => item.livingOrder.settleType !== 1)
+        if (livingRoomIdList.length > 2) {
+          this.$message.warning('存在联房,主房不能单独结账')
+          return
+        }
+      }
       var livingOrderId = ''
       if (livingRoom.roomId != '1') {
         livingOrderId = livingRoom.livingOrder.id

+ 25 - 20
src/views/room/modules/checkIn/BillRoomInfoModal.vue

@@ -100,26 +100,31 @@ export default {
         roomId: roomId
       }
       getAction('/business/busRoomBookingOrders/canOnlyPaySelf', obj).then(res =>{
-          if (res.result && !confirm('是否团体支付??')) {
-            httpAction(
-                'business/busRoomBookingOrders/split-living?livingOrderId=' +
-                liveOrderId,
-                {},
-                "post"
-            ).then((res) => {
-              if (res.success) {
-                this.visible = true;
-                this.$nextTick(() => {
-                  this.$refs.realForm.add(res.result, key, roomId);
-                })
-              }
-            });
-          }else {
-            this.visible = true;
-            this.$nextTick(() => {
-              this.$refs.realForm.add(bookingOrderId, key, roomId);
-            })
-          }
+          // if (res.result && !confirm('是否团体支付??')) {
+          //   httpAction(
+          //       'business/busRoomBookingOrders/split-living?livingOrderId=' +
+          //       liveOrderId,
+          //       {},
+          //       "post"
+          //   ).then((res) => {
+          //     if (res.success) {
+          //       this.visible = true;
+          //       this.$nextTick(() => {
+          //         this.$refs.realForm.add(res.result, key, roomId);
+          //       })
+          //     }
+          //   });
+          // }else {
+          //   this.visible = true;
+          //   this.$nextTick(() => {
+          //     this.$refs.realForm.add(bookingOrderId, key, roomId);
+          //   })
+          // }
+        this.visible = true
+        this.$nextTick(() => {
+          this.$refs.realForm.add(bookingOrderId, key, roomId);
+        })
+
       });
     },
     getOrder(){

+ 10 - 8
src/views/room/modules/checkIn/EditCustomerForm.vue

@@ -199,18 +199,20 @@ export default {
       },
       confirmLoading: false,
       validatorRules: {
-        mobile: [
-          {
-            required: true,
-            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-            message: '请输入手机号!'
-          }
-        ],
+        // mobile: [
+        //   {
+        //     required: true,
+        //     pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+        //     message: '请输入手机号!'
+        //   }
+        // ],
+        cusPhone: [{ required: true, message: '电话号码格式不正确!', trigger: 'blur',pattern: /^[0-9]{11}$/ }],
+        certNo: [{message: '请输入正确格式的身份证号', pattern: /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9Xx]$/ }],
         cardNo: [{ required: true, message: '请输入会员卡号!' }],
         gradeId: [{ required: true, message: '请输入等级类型!' }],
         payType: [{ required: true, message: '请输入付款类型!' }],
         paymentMethod: [{ required: true, message: '请输入付款方式!' }],
-        cusName: [{ required: true, message: '请输入会员姓名!' }],
+        cusName: [{ required: true, message: '请输入中文或英文姓名!',trigger: 'blur', pattern: /^[\u4E00-\u9FA5a-zA-Z]+$/ }],
         sex: [{ required: true, message: '请输入性别!' }],
         certificateType: [{ required: true, message: '请输入证件类型!' }],
         validity: [{ required: true, message: '请输入有效期!' }]

+ 0 - 1
src/views/room/modules/checkIn/EnterAccountModel.vue

@@ -118,7 +118,6 @@ export default {
     add (record) {
       let modelList = []
       console.log(record)
-      debugger
       record.forEach(e => {
         let model = {
           roomId: e.roomId,

+ 10 - 0
src/views/room/modules/checkIn/FeeForm.vue

@@ -258,6 +258,16 @@ export default {
                             }
                         })
                         that.model.money = that.goodsPrice
+                    } else {
+                      if (this.model.money == null || this.model.money === 0) {
+                        that.confirmLoading = false
+                        this.$message.warning('请输入金额')
+                        return
+                      }
+                      orders.push({
+                        money: this.model.money,
+                        subjectType: this.model.subjectType,
+                      });
                     }
                     this.model.orders = orders;
                     this.model.livingOrderId = this.livingOrderId;

+ 17 - 3
src/views/room/modules/checkIn/PayOrRefund.vue

@@ -218,6 +218,7 @@
 <script>
 import { httpAction, getAction } from '@/api/manage'
 import { validateDuplicateValue } from '@/utils/util'
+import moment from 'moment/moment'
 
 export default {
   name: 'PayOrRefund',
@@ -290,7 +291,8 @@ export default {
       isDanwei: false,
       payList: [],
       memeberCouponList: [],
-      agreementUnitData: {}
+      agreementUnitData: {},
+      copyRealityAmount: '', // 原本值
     }
   },
   computed: {
@@ -325,16 +327,23 @@ export default {
       // 实际要收的钱,为负表示要退的钱
       let relMoney = this.couponAmount.toFixed(2) - this.model.collection
       this.isRefund = relMoney < 0
+      let result = 0
       if (this.model.couponCard) {
         var find = this.memeberCouponList.find(
             (t) => t.id == this.model.couponId
         )
         if (find) {
           this.isRefund = relMoney - find.cost < 0
-          return Math.abs(relMoney - find.cost)
+          result = Math.abs(relMoney - find.cost)
         }
       }
-      return Math.abs(relMoney)
+      result = Math.abs(relMoney)
+      if (this.payList && this.payList.length > 0 && this.copyRealityAmount != result) {
+        this.payList = [this.payList[0]]
+        this.payList[0].money = result
+      }
+      this.copyRealityAmount = result
+      return result
     }
   },
   created() {
@@ -513,6 +522,11 @@ export default {
       // 触发表单验证
       this.$refs.form.validate((valid) => {
         if (valid) {
+          if (this.model.couponFirstAmount > this.model.consumption.toFixed(2)) {
+            this.model.couponFirstAmount = 0
+            this.$message.warning('优惠金额不能大于消费')
+            return
+          }
           if (this.realityAmount != this.sumAmount) {
             that.$message.warning('实收金额和实收合计必须相等')
             return

+ 32 - 13
src/views/room/modules/checkIn/Payment.vue

@@ -8,7 +8,7 @@
         slot="detail"
       >
         <a-row>
-          <a-col :span="24" v-show="showYinshou">
+          <a-col :span="24">
             <a-form-model-item
               label="结账应收"
               :labelCol="labelCol"
@@ -16,7 +16,7 @@
               prop="billAmount"
             >
               {{ model.billAmount.toFixed(2) }}元
-              <a-switch v-model="model.coupon" />优惠
+              <a-switch v-model="model.coupon"  />优惠
             </a-form-model-item>
           </a-col>
           <template v-if="model.coupon">
@@ -211,8 +211,7 @@ export default {
     },
     showYinshou: {
       type: Boolean,
-      default: true,
-      required: false,
+      default: true
     },
   },
   data() {
@@ -270,6 +269,7 @@ export default {
       payList: [],
       memeberCouponList: [],
       agreementUnitData: {},
+      copyRealityAmount: '',
     };
   },
   computed: {
@@ -300,15 +300,30 @@ export default {
       return sum;
     },
     realityAmount() {
+      let result = this.couponAmount
       if (this.model.couponCard) {
         var find = this.memeberCouponList.find(
           (t) => t.id == this.model.couponId
         );
         if (find) {
-          return this.couponAmount - find.cost;
+          result = this.couponAmount - find.cost;
+        }
+      }
+      if (this.model.coupon) {
+        var find = this.memeberCouponList.find(
+            (t) => t.id == this.model.couponId
+        );
+        if (find) {
+          result =  this.couponAmount - find.cost;
         }
+        if (this.payList && this.payList.length > 0 && this.copyRealityAmount != result) {
+          this.payList = [this.payList[0]]
+          this.payList[0].money = result
+        }
+        this.copyRealityAmount = result
       }
-      return this.couponAmount;
+      this.$forceUpdate()
+      return result;
     },
   },
   created() {
@@ -432,9 +447,9 @@ export default {
       this.edit(this.modelDefault);
     },
     edit(record) {
-      this.model = Object.assign({}, record);
+      let data = Object.assign({}, record);
+      this.model = JSON.parse(JSON.stringify(data))
       if (record.preferentialMoney !== 0 && record.preferentialMoney !== null) {
-        this.model.coupon = true
         this.model.preferentialType = 2
         this.model.couponFirstAmount = record.preferentialMoney;
       }
@@ -477,17 +492,21 @@ export default {
           }
         });
       }
-      this.visible = true;
+      // this.visible = true;
     },
     submitForm() {
+      debugger
       const that = this;
       // 触发表单验证
       this.$refs.form.validate((valid) => {
         if (valid) {
-          console.log("this.realityAmount ", this.realityAmount);
-          console.log("this.sumAmount ", this.sumAmount);
-          if (this.realityAmount != this.sumAmount) {
-            that.$message.warning("实收金额和实收合计必须相等");
+          if (this.model.couponFirstAmount > this.model.consumption) {
+            this.model.couponFirstAmount = 0
+            this.$message.warning('优惠金额不能大于消费')
+            return
+          }
+          if (this.realityAmount !== this.sumAmount) {
+            that.$message.warning('实收金额和实收合计必须相等');
             return;
           }
           var obj = {};

+ 3 - 2
src/views/room/modules/checkIn/PaymentModal.vue

@@ -13,7 +13,7 @@
       ref="realForm"
       @ok="submitCallback"
       :disabled="disableSubmit"
-      :showYinshou="showYinshou"
+      :showYinshou="showYinshou1"
     ></payment>
   </j-modal>
 </template>
@@ -31,7 +31,7 @@ export default {
       width: 800,
       visible: false,
       disableSubmit: false,
-      showYinshou: true,
+      showYinshou1: true,
     };
   },
   methods: {
@@ -52,6 +52,7 @@ export default {
       this.visible = false;
     },
     handleOk() {
+      debugger
       this.$refs.realForm.submitForm();
     },
     submitCallback() {

+ 31 - 7
src/views/room/modules/checkIn/RefundModal.vue

@@ -26,21 +26,26 @@
       <template slot="roomId" slot-scope="text, record, index">
         {{ getRoomName(text) }}
       </template>
+      <template slot="refundType" slot-scope="text, record, index">
+        <a-select style="width: 100px" v-model="record.refundType">
+          <a-select-option v-for="(item, key) in record.payTypeList" :key="key" :value="item.id" :disabled="item.disable">{{ item.name }}</a-select-option>
+        </a-select>
+      </template>
       <template slot="prerefund" slot-scope="text, record, index">
         <a-input-number v-model="record.prerefund"></a-input-number>
       </template>
     </a-table>
     <a-form-model>
       <a-row  style="display: flex; ">
-        <a-col :span="16" style="flex: 4">
+        <a-col :span="16" style="flex: 5">
           <a-form-model-item style="margin-bottom: 0px;" label="合计"></a-form-model-item>
         </a-col>
-        <a-col :span="4" style="flex: 2.5">
+        <a-col :span="4" style="flex: 5">
         <a-form-model-item label="支付金额:" style="display: flex; margin-bottom: 0px;">
             {{ allFeeMoney }}
           </a-form-model-item>
         </a-col>
-        <a-col :span="4" style="flex: 1">
+        <a-col :span="4" style="flex: 1.5">
         <a-form-model-item label="退款金额:"  style="display: flex; margin-bottom: 0px;">
             {{ allReturnFee }}
           </a-form-model-item>
@@ -90,12 +95,19 @@ const columns = [
     title: '支付金额',
     dataIndex: 'id',
     align: 'center',
-// width: 60,
+    width: 90,
     customRender: function (text, record) {
       return record.money
     }
   },
   {
+    title: '退款方式',
+    // dataIndex: 'id',
+    align: 'center',
+    width: 130,
+    scopedSlots: { customRender: 'refundType' }
+  },
+  {
   title: '本次退款',
   dataIndex: 'prerefund',
     align: 'center',
@@ -116,7 +128,7 @@ export default {
   data () {
     return {
       title:'退款',
-      width:800,
+      width:900,
       visible: false,
       disableSubmit: false,
       payTypeList: [],
@@ -146,7 +158,7 @@ export default {
     handleOk() {
       let refundFeeList = []
       if (this.feeList.some(e => e.money - e.returnMoney < e.prerefund)) {
-        this.$message.warning('退款金额不能小于当前余额')
+        this.$message.warning('可退款余额不足')
         return
       }
       this.feeList.forEach(e => {
@@ -162,7 +174,7 @@ export default {
           returnItem: true,
           feeType: e.feeType,
           subjectType: 13,
-          payType: e.payType,
+          payType: e.refundType,
           hotelId: e.hotelId,
           agreementUnitId: e.agreementUnitId
         }
@@ -234,6 +246,9 @@ export default {
       postAction('/business/busOrderFee/refundList', ids).then((res) => {
         let feeList = []
         let returnFeeList = []
+
+        var vipIndex = this.payTypeList.findIndex((t) => t.name.includes('会员'))
+        var danweiIndex = this.payTypeList.findIndex((t) => t.name.includes('单位'))
         res.result.forEach(e => {
           // 如果是退款
           if (e.returnItem === true) {
@@ -245,6 +260,15 @@ export default {
             e.prerefund = 0
             var room = this.model.filter(room => room.roomId === e.roomId)
             e.roomName = room[0].roomName
+            this.$set(e, 'refundType', e.payType)
+            let payTypeList = JSON.parse(JSON.stringify(this.payTypeList));
+            console.log(room[0].livingOrder.vipCustomerId)
+            console.log(room[0].livingOrder.contractTeamId)
+            console.log(vipIndex)
+            console.log(danweiIndex)
+            this.$set(payTypeList[vipIndex], 'disable', room[0].livingOrder.vipCustomerId == null || room[0].livingOrder.vipCustomerId === '')
+            this.$set(payTypeList[danweiIndex], 'disable', room[0].livingOrder.contractTeamId == null)
+            this.$set(e, 'payTypeList', payTypeList)
             feeList.push(e)
           }
         })

+ 118 - 90
src/views/room/modules/checkIn/SelectCheckInRoomOrder.vue

@@ -37,47 +37,56 @@
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
+        :expandable="true"
         class="j-table-force-nowrap"
         @change="handleTableChange"
         :rowSelection="{
           selectedRowKeys: selectedRowKeys,
           onChange: onSelectChange,
-        }"
-      >
-        <template slot="avatar" slot-scope="text">
-          <a-avatar v-if="text" :src="text" />
-          <a-avatar v-else icon="user" />
-        </template>
-        <template slot="imgSlot" slot-scope="text, record">
-          <span v-if="!text" style="font-size: 12px; font-style: italic"
-            >无图片</span
+        }">
+        <template #expandedRowRender="record">
+          <a-table
+              size="small"
+              :columns="innerColumns"
+              :dataSource="record.children"
           >
-          <img
-            v-else
-            :src="getImgView(text)"
-            :preview="record.id"
-            height="25px"
-            alt=""
-            style="max-width: 80px; font-size: 12px; font-style: italic"
-          />
-        </template>
-        <template slot="fileSlot" slot-scope="text">
-          <span v-if="!text" style="font-size: 12px; font-style: italic"
-            >无文件</span
-          >
-          <a-button
-            v-else
-            :ghost="true"
-            type="primary"
-            icon="download"
-            size="small"
-            @click="downloadFile(text)"
-          >
-            下载
-          </a-button>
+          </a-table>
         </template>
 
-        <span slot="action" slot-scope="text, record">
+          <template slot="avatar" slot-scope="text">
+            <a-avatar v-if="text" :src="text" />
+            <a-avatar v-else icon="user" />
+          </template>
+          <template slot="imgSlot" slot-scope="text, record">
+            <span v-if="!text" style="font-size: 12px; font-style: italic"
+              >无图片</span
+            >
+            <img
+              v-else
+              :src="getImgView(text)"
+              :preview="record.id"
+              height="25px"
+              alt=""
+              style="max-width: 80px; font-size: 12px; font-style: italic"
+            />
+          </template>
+          <template slot="fileSlot" slot-scope="text">
+            <span v-if="!text" style="font-size: 12px; font-style: italic"
+              >无文件</span
+            >
+            <a-button
+              v-else
+              :ghost="true"
+              type="primary"
+              icon="download"
+              size="small"
+              @click="downloadFile(text)"
+            >
+              下载
+            </a-button>
+          </template>
+
+          <span slot="action" slot-scope="text, record">
           <a @click="handleSelect(record)">选择</a>
         </span>
       </a-table>
@@ -92,6 +101,56 @@ import { JeecgListMixin } from "@/mixins/JeecgListMixin";
 import { httpAction } from "@/api/manage";
 import hotelInfo from '@views/settings/hotelInfo'
 import { formatDate } from '@/utils/util'
+const columns = [
+  {
+    title: "房间",
+    align: "center",
+    dataIndex: "roomName",
+  },
+  {
+    title: "入住类型",
+    align: "center",
+    dataIndex: 'groupTag',
+    customRender: (groupTag) => {
+      return groupTag === null? "散" : groupTag
+    },
+  },
+  {
+    title: "名字",
+    align: "center",
+    dataIndex: "customerName",
+  },
+  {
+    title: "单号",
+    align: "center",
+    dataIndex: "livingOrderNo",
+  },
+  {
+    title: "状态",
+    align: "center",
+    dataIndex: "customerId",
+    customRender(text) {
+      return "正常入住";
+    },
+  },
+]
+const innerColumns = [
+  {
+    title: "房间",
+    align: "center",
+    dataIndex: "roomName",
+  },
+  {
+    title: "名字",
+    align: "center",
+    dataIndex: "customerName",
+  },
+  {
+    title: "单号",
+    align: "center",
+    dataIndex: "livingOrderNo",
+  }
+]
 export default {
   name: "BusMemberCardList",
   mixins: [JeecgListMixin, mixinDevice],
@@ -121,54 +180,10 @@ export default {
       num: 1,
       description: "PickingGoodsOrder",
       // 表头
-      columns: [
-        {
-          title: "房间",
-          align: "center",
-          dataIndex: "roomName",
-        },
-        {
-          title: "入住类型",
-          align: "center",
-          dataIndex: 'groupTag',
-          customRender: (groupTag) => {
-            return groupTag === null? "散" : groupTag
-          },
-        },
-        {
-          title: "名字",
-          align: "center",
-          dataIndex: "customerName",
-        },
-        {
-          title: "单号",
-          align: "center",
-          dataIndex: "livingOrderNo",
-        },
-        {
-          title: "状态",
-          align: "center",
-          dataIndex: "customerId",
-          customRender(text) {
-            return "正常入住";
-          },
-        },
-        // {
-        //   title: "金额",
-        //   align: "center",
-        //   dataIndex: "payMoney",
-        // },
-        // {
-        //   title: "操作",
-        //   dataIndex: "action",
-        //   align: "center",
-        //   fixed: "right",
-        //   width: 147,
-        //   scopedSlots: { customRender: "action" },
-        // },
-      ],
+      columns: columns,
+      innerColumns: innerColumns,
       url: {
-        list: "/business/busRoomBookingOrders/living-orders?status=-1",
+        list: "/business/busRoomBookingOrders/union-living-orders?status=-1",
         delete: "/business/busMemberCard/delete",
         deleteBatch: "/business/busMemberCard/deleteBatch",
         exportXlsUrl: "/business/busMemberCard/exportXls",
@@ -203,6 +218,23 @@ export default {
     },
   },
   methods: {
+
+    // expandIcon(e){
+    //   console.log(e)
+    //   if(e.record.children && e.record.children > 0){
+    //     if (e.expanded) {
+    //       return <a style="margin-right:0px" onClick={ele=> {
+    //         e.onExpand(e.record, ele);
+    //       }}><a-icon type="caret-down"/> </a>
+    //     } else{
+    //       return <a style="margin-right:0px" onClick={ele => {
+    //         e.onExpand(e.record, ele);
+    //       }}><a-icon type="caret-right"/></a>
+    //     }
+    //   }else{
+    //     return <span style="margin-right:0px"><a-icon type="smile" /></span>
+    //   }
+    // },
     searchQuery() {
       this.loadData(1);
       this.selectedRowKeys = [];
@@ -218,17 +250,13 @@ export default {
         this.$message.warning("请先选择订单");
         return;
       }
-      if(this.selectionRows.some(e => {
-        if (e.relType !== null) {
-          this.$message.warning( e.roomName + '房间已关联:' + e.groupTag)
-          return true;
-        }
-      })){
-        return
-      }
-      debugger
+      // if(this.selectionRows.some(e => {
+      //   if (e.relType !== null) {
+      //     this.$message.warning( e.roomName + '房间已关联:' + e.groupTag)
+      //     return true;
+      //   }
+      // }))
       that.confirmLoading = true;
-      debugger
       let httpurl =
         '/business/busRoomBookingOrders/merge-order?livingRoomId=' +
         this.livingOrderId + '&hotelId=' + this.hotelId

+ 1 - 1
src/views/room/modules/checkIn/SelectRoomForm.vue

@@ -99,7 +99,7 @@
                         :span="24"
                         v-for="(item, index) in (roomList || [])"
                         :key="index"
-                        v-if="item.floorRooms.length > 0"
+                        v-if="item.floorRooms && item.floorRooms.length > 0"
                       >
                         <div>{{ item.buildingName + item.floorName }}</div>
                         <div style="display:flex;flex-wrap:wrap;">

+ 1 - 1
src/views/room/modules/checkIn/StrikeBalanceModel.vue

@@ -19,7 +19,7 @@
         {{ getSubjectTypeText(text, record) }}
       </template>
       <template slot="money" slot-scope="text, record">
-        <a-input-number v-model=record.money @blur="handleBlur()"></a-input-number>
+        <a-input-number v-model=record.money @blur="handleBlur()" :min="0"></a-input-number>
       </template>
       <template slot="remark" slot-scope="text, record">
         <a-textarea v-model=record.remark></a-textarea>

+ 71 - 28
src/views/room/modules/checkIn/batchCardDetailCopy.vue

@@ -1,19 +1,19 @@
 <template>
 <div>
-    <a-card title="批量制卡" style="width: 100%">
+    <a-card :title="roomList.length > 1 ? '批量制卡' : '制卡'" style="width: 100%">
         <div slot="extra" style="display:flex;align-items:center;">
-            <a-switch></a-switch>制卡完毕自动跳转下一张
+            <a-switch v-model="isChecked"></a-switch>制卡完毕自动跳转下一张
         </div>
         <p>
             <a-row type="flex" justify="center">
                 <a-col :span="12">
                     <div style="display:flex;flex-direction:column;justify-content:center;align-items:center;">
-                        <h3 style="color:rgba(42, 130, 228, 1)">
-                            当前房间号
-                        </h3>
-                        <div style="color:#fff;background: rgba(42, 130, 228, 1);line-height:100px;width:40%;text-align:center;border-radius:12px;">
-                            {{roomList[roomIndex] && roomList[roomIndex].name}}
-                        </div>
+                      <h3 style="color:rgba(42, 130, 228, 1)">
+                        当前房间号
+                      </h3>
+                      <div style="color:#fff;background: rgba(42, 130, 228, 1);line-height:100px;width:40%;text-align:center;border-radius:12px;">
+                        {{roomList[roomIndex] && roomList[roomIndex].name}}
+                      </div>
                     </div>
                 </a-col>
                 <a-col :span="12">
@@ -41,9 +41,6 @@
         <p>
             <a-row :gutter="[6,6]">
                 <a-col :span="5">
-                    <a-button @click="changeErr">制新卡</a-button>
-                </a-col>
-                <a-col :span="5">
                     <a-button @click="changeErr">复制卡</a-button>
                 </a-col>
                 <a-col :span="4">
@@ -52,6 +49,9 @@
                 <a-col :span="4">
                     <a-button @click="changeErr">注销</a-button>
                 </a-col>
+              <a-col :span="5">
+                <a-button @click="makeCard">制卡</a-button>
+              </a-col>
                 <a-col :span="5" v-if="roomIndex>0">
                     <a-button @click="handleCutRoom">上一张</a-button>
                 </a-col>
@@ -61,9 +61,25 @@
             </a-row>
         </p>
         <p>
-            <a-table ref="table" size="middle" :scroll="{ x: '100%' }" bordered rowKey="id" :columns="columns" :dataSource="roomList" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap">
-                <span slot="state" slot-scope="record">
-                    {{record?'已制卡':''}}
+            <a-table
+                  ref="table"
+                  size="middle"
+                  :row-selection="{
+                     type: 'radio',
+                     selectedRowKeys: selectedRowKeys,
+                     onChange: onSelectChange,
+                     }"
+                  :scroll="{ x: '100%',y:250 }"
+                  style="height: 250px"
+                  bordered
+                  rowKey="id"
+                  :columns="columns"
+                  :dataSource="roomList"
+                  :pagination="ipagination"
+                  :loading="loading"
+                  class="j-table-force-nowrap">
+                <span slot="state" slot-scope="text">
+                    {{text?'已制卡':''}}
                     <!-- {{record}} -->
                 </span>
                 <!-- <template slot="num" slot-scope="text, record, index">
@@ -106,46 +122,68 @@ export default {
                 {
                     title: "住客姓名",
                     align: "center",
-                    dataIndex: "roomInfo.key1",
+                    dataIndex: "customerName",
                 },
                 {
                     title: "手机号码",
                     align: "center",
-                    dataIndex: "roomInfo.key5",
+                    dataIndex: "phone",
                 },
                 {
                     title: "",
                     align: "center",
                     dataIndex: "iscard",
+                    scopedSlots: { customRender: 'state' }
                 }
             ],
             ipagination:{},
             dataSource:[],
             loading:false,
+            isChecked: true,
             roomList:[],
             roomIndex:0,
+            selectedRowKeys: [],
+            selectedRows: []
         }
     },
     methods: {
+
+        onSelectChange(selectedRowKeys, selectionRows) {
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectionRows
+        },
+        makeCard(){
+          if (this.selectedRowKeys.length > 0) {
+            let index = this.roomList.findIndex(e => e.id === this.selectedRowKeys[0])
+            console.log(this.roomList)
+            console.log(index)
+            if (index !== -1) {
+              this.roomList[index].iscard = true
+              // debugger
+              if (this.isChecked) {
+                if (index < this.roomList.length - 1) {
+                  this.selectedRowKeys = [this.roomList[index + 1].id]
+                } else {
+                  this.selectedRowKeys = [this.roomList[0].id]
+                }
+              }
+
+              this.$forceUpdate()
+
+            }
+          }
+        },
         changeErr(){
             this.$message.error('接口程序未打开,请打开接口程序')
         },
         handleAddRoom(){
-            console.log(this.roomIndex);
-            if (this.roomIndex == this.roomList.length-1) {
-                this.$message.error('已经是最后一间了')
-                return                
-            }else{
-                this.roomIndex++;
-            }
+            this.roomIndex++;
+            this.selectedRowKeys = [this.roomList[this.roomIndex].id]
         },
         handleCutRoom(){
-            console.log(this.roomIndex);
-            if (this.roomIndex == 0) {
-                this.$message.error('已经是第一间了')
-                return                
-            }
             this.roomIndex--;
+            this.selectedRowKeys = [this.roomList[this.roomIndex].id]
+
         },
         edit(record){
             console.log(record);
@@ -157,6 +195,11 @@ export default {
             //     ele.Info = record.orderInfo
             // })
             // console.log(arr);
+
+
+          if (record.length > 0) {
+              this.selectedRowKeys = [record[0].id]
+            }
             this.roomList = record;
         },
         submitForm(){

+ 0 - 1
src/views/room/modules/checkIn/batchCardModalCopy.vue

@@ -35,7 +35,6 @@
         })
       },
       edit (record) {
-        debugger
         this.visible=true
         this.$nextTick(()=>{
           this.$refs.realForm.edit(record);

+ 52 - 22
src/views/room/modules/fangtaiModal/exchangeHouses/exchangeHousesForm.vue

@@ -37,32 +37,41 @@
                                 </template> <a href="#" @click="selectVisible = true">选择</a>
                             </a-form-model-item>
                         </a-col>
+                      <a-col :span="24">
+                        <a-form-model-item label="方案" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
+                          <a-radio-group v-model="roomScheme" name="radioGroup" @change="roomSchemeChange">
+                            <a-radio :value="1" :checked="true">原房价</a-radio>
+                            <a-radio :value="2" :disabled="!newRoom">新房价</a-radio>
+                            <a-radio :value="3">自定义房价</a-radio>
+                          </a-radio-group>
+                        </a-form-model-item>
+                      </a-col>
                         <a-col :span="24">
                             <a-form-model-item label="房价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
                                 <!-- <a-input-number :min="0" v-model="dayNum" placeholder="请输入续住天数" style="width: 40%" @change="dayChange" /> -->
-                                <template v-if="newRoom">
+                                <template>
                                     {{ timeData.reduce((pre,cur)=> pre+cur.price*1,0) }}
                                     <a-popover placement="right">
                                         <template slot="content">
                                             <div style="max-height:400px;overflow:auto;width:100%;">
                                                 <div v-for="(item, index) in timeData" :key="index">
                                                     {{item.day}}
-                                                    <a-input-number :disabled="daysBetweenCopy(item.day)" :min="0" v-model="item.price"></a-input-number>
+                                                    <a-input-number :disabled="daysBetweenCopy(item.day) || roomScheme!==3" :min="0" v-model="item.price"></a-input-number>
                                                 </div>
                                             </div>
                                         </template>
                                       <template slot="title">
-                                        <a-input-number :min="0" @change="batchPrice" placeholder="批量改价"></a-input-number>
+                                        <a-input-number :min="0" @change="batchPrice" placeholder="批量改价" v-if="roomScheme===3"></a-input-number>
                                       </template>
                                         <template slot="title">
                                         </template>
                                         <a-icon type="edit" />
                                     </a-popover>
                                 </template>
-                                <template v-else>
-                                    0
-                                    <a-icon type="edit" />
-                                </template>
+<!--                                <template v-else>-->
+<!--                                    0-->
+<!--                                    <a-icon type="edit" />-->
+<!--                                </template>-->
                             </a-form-model-item>
                         </a-col>
                         <a-col :span="24">
@@ -102,11 +111,13 @@
 
             </a-col>
             <a-col :span="24" v-if="dataList.length>0">
-                <div style="display:flex;flex-wrap:wrap;height:400px;overflow: auto;">
-                    <div v-for="(item,index) in dataList" :key="index" @click="selectRoom(item, index)" :class="{'active':index==link}" style="border:1px solid #ccc;padding: 5px 20px;margin-right:10px;margin-top:10px;border-radius:5px;height:30px">
-                        {{ item && item.name}}
-                    </div>
+              <div style="height:300px;overflow: scroll;">
+                <div style="display:flex;flex-wrap:wrap;">
+                  <div v-for="(item,index) in dataList" :key="index" @click="selectRoom(item, index)" :class="{'active':index==link}" style="border:1px solid #ccc;padding: 5px 20px;margin-right:10px;margin-top:10px;border-radius:5px;height:30px;" >
+                    {{ item && item.name}}
+                  </div>
                 </div>
+              </div>
             </a-col>
         </a-row>
     </a-modal>
@@ -122,6 +133,7 @@ import {
 import {
     validateDuplicateValue
 } from "@/utils/util";
+import moment from 'moment'
 
 export default {
     name: "PosTableForm",
@@ -217,6 +229,8 @@ export default {
             selectData: [],
             newRoom: null,
             timeData: [],
+            oldTimeData: [],
+            roomScheme: 1
         };
     },
     watch: {
@@ -276,9 +290,11 @@ export default {
                 return
             }
             this.newRoom = this.selectData[0]
-            this.timeData.forEach(ele => {
+            if (this.roomScheme === 2) {
+              this.timeData.forEach(ele => {
                 ele.price = this.newRoom.marketPrice
-            })
+              })
+            }
             this.selectVisible = false;
         },
         /**
@@ -354,6 +370,18 @@ export default {
                 item.price = e;
             })
         },
+        roomSchemeChange(e){
+          debugger
+          console.log(this.oldTimeData)
+          if (this.roomScheme === 1) {
+            this.timeData = JSON.parse(JSON.stringify(this.oldTimeData))
+            this.$forceUpdate()
+          } else if (this.roomScheme === 2) {
+            this.timeData.forEach(ele => {
+              ele.price = this.newRoom.marketPrice
+            })
+          }
+        },
         checkChange(e) {
             console.log("e", e);
             console.log(
@@ -377,7 +405,7 @@ export default {
                 list = list.reduce((acc, curr) => {
                     const floorRooms = curr.floorRooms.filter((room) =>
                         this.checkedRoomStatusList.includes(
-                            room.roomStatus.toString()
+                            room.roomStatus !== '7' ? room.roomStatus.toString() : room.lastRoomStatus.toString()
                         )
                     );
                     acc.push({
@@ -387,7 +415,7 @@ export default {
                     return acc;
                 }, []);
             }
-            console.log("list2", list);
+            console.log('list2', list);
             this.roomList = list;
             let arr = [];
             this.roomList.forEach(ele => {
@@ -398,7 +426,6 @@ export default {
                         }
                     }
                 })
-
             })
             this.dataList = arr
         },
@@ -425,6 +452,7 @@ export default {
                 if (res.success) {
                     this.roomList = res.result[0].buildingRooms;
                     this.oldRoomList = JSON.parse(JSON.stringify(res.result[0].buildingRooms));
+                  console.log(this.roomList)
                     this.checkChange()
                 }
             });
@@ -442,11 +470,15 @@ export default {
                 arr[i] = {
                     day: this.addDate(record.livingData.livingOrder.arrivalTime, i),
                     // price: this.model.layout.marketPrice,
-                    price: 0
+                    price: this.model.livingData.price[i].price
                 };
             }
-            console.log(arr);
+            let nowDate = new moment().format('yyyy-MM-DD')
+             arr = arr.filter(e => e.day > nowDate)
             this.timeData = arr
+            // 用于改回原房价时
+            this.oldTimeData = JSON.parse(JSON.stringify(arr))
+            console.log('arr', arr);
             this.visible = true;
         },
         submitForm() {
@@ -483,10 +515,8 @@ export default {
                                 let obj = {
                                   ...this.newRoom,
                                   layoutName: this.model.layout.name,
-                                  roomInfo: {
-                                    key1: this.model.livingData.livingCustomers.customerName,
-                                    key5: this.model.livingData.livingCustomers.phone
-                                  }
+                                  customerName: this.model.livingData.livingCustomers.customerName,
+                                  phone: this.model.livingData.livingCustomers.phone
                                 }
                                 that.$emit('ok', [obj]);
                             } else {

+ 9 - 7
src/views/room/modules/leasegoods/leasegoodsModal.vue

@@ -8,7 +8,7 @@
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
-    <upkeep-room-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :livingOrderId="livingOrderId"></upkeep-room-form>
+    <upkeep-room-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :livingOrderId="livingOrderId" :payTypeList = 'payTypeList'></upkeep-room-form>
   </j-modal>
 </template>
 
@@ -26,15 +26,17 @@
         width:1000,
         visible: false,
         disableSubmit: false,
-        livingOrderId:''
+        livingOrderId:'',
+        payTypeList: []
       }
     },
     methods: {
       add (record) {
         this.visible=true
-        // this.$nextTick(()=>{
-        //   this.$refs.realForm.add(record);
-        // })
+        this.$nextTick(()=>{
+          this.$refs.realForm.payTypeList = this.payTypeList
+          this.$refs.realForm.add(record);
+        })
       },
       edit (record) {
         this.visible=true
@@ -43,7 +45,7 @@
         })
       },
       close () {
-        this.$emit('close');
+        this.$emit('ok');
         this.visible = false;
       },
       handleOk () {
@@ -67,4 +69,4 @@
 /deep/.ant-modal-close {
   color: rgba(0, 0, 0, 0.45) !important;
 }
-</style>
+</style>

+ 3 - 3
src/views/room/modules/membergoodsmanage/membermessageModal.vue

@@ -8,7 +8,7 @@
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
-    <upkeep-room-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :livingOrderId="livingOrderId"></upkeep-room-form>
+    <upkeep-room-form ref="realForm" @ok="submitCallback" @cancel="handleCancel" :disabled="disableSubmit" :livingOrderId="livingOrderId"></upkeep-room-form>
   </j-modal>
 </template>
 
@@ -43,7 +43,7 @@
         })
       },
       close () {
-        this.$emit('close');
+        this.$emit('ok');
         this.visible = false;
       },
       handleOk () {
@@ -67,4 +67,4 @@
 /deep/.ant-modal-close {
   color: rgba(0, 0, 0, 0.45) !important;
 }
-</style>
+</style>

+ 57 - 20
src/views/room/modules/schedule/EditScheduleRoomForm.vue

@@ -21,9 +21,6 @@
       <a-button v-if="model.orderInfo.bookingStatus == 2" @click="deleteOrder"
         >删除预定</a-button
       >
-      <a-button v-if="disabled && model.orderInfo.bookingStatus == 1"
-        >合并联房</a-button
-      >
     </div>
     <j-form-container>
       <a-form-model
@@ -380,9 +377,9 @@
                   <span style="padding-left: 10px">总价:{{ amount2 }}</span>
                 </div>
                 <div style="display: flex; gap: 10px">
-                  <a-button>制房卡</a-button>
-                  <a-button>批量排房</a-button>
-                  <a-button>批量入住</a-button>
+                  <a-button @click="makeCard">制房卡</a-button>
+                  <a-button @click="batchPulsRoom">批量排房</a-button>
+                  <a-button @click="addCustomer">入住</a-button>
                 </div>
               </div>
               <a-table
@@ -415,12 +412,12 @@
                 </span>
                 <span slot="action" slot-scope="text, record, index">
                   <div style="gap: 10px; display: flex">
-                    <a-button
-                      v-if="record.roomStatus != 3 && record.roomStatus != 4"
-                      size="small"
-                      @click="addCustomer(record)"
-                      >入住</a-button
-                    >
+<!--                    <a-button-->
+<!--                      v-if="record.roomStatus != 3 && record.roomStatus != 4"-->
+<!--                      size="small"-->
+<!--                      @click="addCustomer(record)"-->
+<!--                      >入住</a-button-->
+<!--                    >-->
                     <a-button
                       size="small"
                       v-if="!record.isMain"
@@ -545,6 +542,7 @@
         ref="ModalBillRoomForm"
         @ok="modalBillRoomFormOk"
     ></bill-room-form-modal>
+    <batch-card-modal-copy  ref="batchCardModalCopy"></batch-card-modal-copy>
   </a-spin>
 </template>
 
@@ -555,7 +553,9 @@ import moment from "moment";
 import EditableCell from "@views/room/modules/checkIn/EditableCell.vue";
 import SelectRoomFormModal from "./SelectRoomFormModal.vue";
 import CustomerModal from "@views/room/modules/customer/CustomerModal.vue";
-import BillRoomFormModal from '@views/room/modules/checkIn/BillRoomFormModal'
+import BillRoomFormModal from '@views/room/modules/checkIn/BillRoomFormModal';
+import batchCardModalCopy from '@views/room/modules/checkIn/batchCardModalCopy'
+
 const date = new Date();
 const endDate = new Date(date.setDate(date.getDate() + 1));
 const columns = [
@@ -587,7 +587,7 @@ const columns = [
   },
   {
     title: "押金",
-    dataIndex: "roomName",
+    // dataIndex: "roomName",
     customRender: function (text, record) {
       return 100
     }
@@ -615,7 +615,7 @@ for (let i = 0; i < 2; i++) {
 }
 export default {
   name: "ScheduleRoomForm",
-  components: { BillRoomFormModal, EditableCell, SelectRoomFormModal, CustomerModal },
+  components: { BillRoomFormModal, EditableCell, SelectRoomFormModal, CustomerModal, batchCardModalCopy },
   props: {
     //表单禁用
     disabled2: {
@@ -834,6 +834,21 @@ export default {
     this.getBookingOrderInfo();
   },
   methods: {
+    makeCard(){
+      let recrod = []
+      this.model.roomIds.forEach(e => {
+        let param = {
+          name: e.roomName,
+          id: e.roomId,
+          layoutId: e.roomLayoutId,
+          layoutName: e.layoutName,
+          customerName: this.model.contactName,
+          phone: this.model.phone
+        }
+        recrod.push(param)
+      })
+      this.$refs.batchCardModalCopy.edit(recrod)
+    },
     getBookingOrderInfo() {
       getAction(this.url.getBookingOrderInfo, {
         bookingNo: this.id,
@@ -1130,10 +1145,9 @@ export default {
         }
       });
     },
-    addCustomer(record) {
-      console.log(record,'record')
-      if (!record.roomId) {
-        this.$message.warning("请先排房");
+    addCustomer() {
+      if (this.model.roomIds.some(e => e.roomId == null || e.roomId === '')) {
+        this.$message.warning('请先排房')
         return;
       }
       //  this.$refs.modalCustomerForm.edit({
@@ -1162,8 +1176,13 @@ export default {
         }
         roomInfo.push(param)
       })
+      let orderInfo = JSON.parse(JSON.stringify(this.model.orderInfo))
+      orderInfo.arrivalTimeSpan = moment(new Date(), 'HH:mm')
+      orderInfo.arrivalTime2 = moment(new Date()).format('YYYY-MM-DD')
+      delete orderInfo.arrivalTime
+      console.log(orderInfo)
 
-      this.$refs.ModalBillRoomForm.addList(roomInfo, '1', this.model.orderInfo)
+      this.$refs.ModalBillRoomForm.addList(roomInfo, '1', orderInfo)
       this.$refs.ModalBillRoomForm.title =
           e.key == '1' ? '散客入住登记' : '团队入住登记'
       this.$refs.ModalBillRoomForm.disableSubmit = false
@@ -1183,6 +1202,24 @@ export default {
         }
       );
     },
+    batchPulsRoom(){
+      this.$confirm({
+        content: `是否批量排房?`,
+        onOk: () => {
+          let ids = this.model.roomIds.filter(e => e.roomId == null).map(obj => obj.id)
+          if (ids.length === 0) {
+            this.$message.warning('没有需要排房的房间')
+            return
+          }
+          postAction('/business/busBookingRooms/editBatch', ids).then(resp => {
+            if (resp.success) {
+              this.$message.success('成功')
+              this.getBookingOrderInfo();
+            }
+          })
+        }
+      })
+    },
     pulsRoom(index) {
       this.selectIndex = index;
       this.$refs.modalSelectRoomForm.add(this.canUserRooms[this.selectIndex]);

+ 5 - 5
src/views/room/modules/schedule/ScheduleRoomForm.vue

@@ -457,8 +457,8 @@ export default {
           required: true,
           message: "请选择VIP!"
         }],
-        contactName: [{ required: true, message: "请输入联系人!" }],
-        phone: [{ required: true, message: "请输入电话!" }],
+        contactName: [{ required: true, message: '请输入中文或英文姓名!',trigger: 'blur', pattern: /^[\u4E00-\u9FA5a-zA-Z]+$/ }],
+        phone: [{ required: true, message: '电话号码格式不正确!', trigger: 'blur',pattern: /^[0-9]{11}$/, }],
       },
       url: {
         add: "/business/busRoomBookingOrders/add",
@@ -870,8 +870,8 @@ export default {
     },
     handleSelectMember(e) {
       var find = this.customerList.find((t) => t.id === e);
-      this.model.phone = find.phone;
-      this.model.contactName = find.name;
+      this.$set(this.model, 'phone', find.phone)
+      this.$set(this.model, 'contactName', find.name)
       this.model.orderInfo.contactId = find.id;
     },
     handleSelectVipMember(e) {
@@ -900,7 +900,7 @@ export default {
       this.edit(this.modelDefault, initArrivalTime);
     },
     async edit(record, initArrivalTime) {
-      this.model = Object.assign({}, record);
+      this.model = Object.assign({ phone: null, contactName: null }, record);
       this.visible = true;
       if (initArrivalTime) {
         this.setArrivalTime(initArrivalTime)

+ 3 - 0
src/views/room/scheduledetail.vue

@@ -84,6 +84,7 @@
                 <div>
                   <a-tag color="#2db7f5"> 预定中 </a-tag>
                   <span>{{ busRoomBookingOrders.contactName }}</span>
+                  <span v-if="offReserve">(已取消)</span>
                 </div>
                 <div style="float: right">{{ busRoomBookingOrders.phone }}</div>
               </div>
@@ -135,6 +136,7 @@ export default {
       scheduleRoomList: [],
       busRoomBookingOrders: {},
       isShow: true,
+      offReserve: false
     };
   },
   created(){
@@ -157,6 +159,7 @@ export default {
         (t) => t.roomStatus == 1 || t.roomStatus == 2
       );
       this.scheduleRoomCount = this.scheduleRoomList.length;
+      this.offReserve = this.busRoomBookingOrders.orderInfo.bookingStatus === 2
     },
     onChange(checkedValues) {
       console.log("checked = ", checkedValues);

+ 18 - 15
src/views/settings/components/roomModules/roomNumSettings/roomNumForm.vue

@@ -53,18 +53,18 @@
             </a-select-option>
           </a-select>
         </a-form-model-item>
-        <a-form-model-item
-          label="房间前缀"
-          :labelCol="labelCol"
-          :wrapperCol="wrapperCol"
-          prop="prefix"
-        >
-          <a-input
-            style="width: 50%"
-            v-model="model.prefix"
-            placeholder="请填写房间前缀"
-          />
-        </a-form-model-item>
+<!--        <a-form-model-item-->
+<!--          label="房间前缀"-->
+<!--          :labelCol="labelCol"-->
+<!--          :wrapperCol="wrapperCol"-->
+<!--          prop="prefix"-->
+<!--        >-->
+<!--          <a-input-->
+<!--            style="width: 50%"-->
+<!--            v-model="model.prefix"-->
+<!--            placeholder="请填写房间前缀"-->
+<!--          />-->
+<!--        </a-form-model-item>-->
 
         <a-form-model-item
           label="房间房号"
@@ -157,7 +157,7 @@ export default {
     buildingTree().then((res) => {
       if (res.code == 200) {
         this.buildingTreeData = res.result;
-        console.log(res.result[0].children[0].id);
+        this.model.buildId = res.result[0].id;
         this.model.floorId = res.result[0].children[0].id;
       }
     });
@@ -180,10 +180,13 @@ export default {
       this.buildingTreeData.forEach((s) => {
         if (s.children) {
           s.children.forEach((t) => {
-            if (t.id == e) this.model.buildId = s.id;
+            if (t.id == e){
+              this.model.buildId = s.id;
+            }
           });
         }
       });
+      this.$forceUpdate()
     },
     initData() {
       getRoomPlans(this.model.hotelId, null).then((res) => {
@@ -256,4 +259,4 @@ export default {
   width: 104px;
   height: 104px;
 }
-</style>
+</style>

+ 6 - 1
src/views/settings/components/roomModules/roomNumSettings/roomNumList.vue

@@ -82,6 +82,11 @@ export default {
   mounted() {
     this.loadBuildingTreeData();
   },
+  watch: {
+    '$route'(to, from) {
+      this.loadBuildingTreeData()
+    }
+  },
   methods: {
     // 点击 触发搜索
     filterSearch(item) {
@@ -235,4 +240,4 @@ export default {
 .empty-data {
   height: 100%;
 }
-</style>
+</style>

+ 6 - 5
src/views/settings/components/roomModules/roomNumSettings/roomNumTable.vue

@@ -53,14 +53,15 @@
       </a-dropdown> -->
         <a-button
           type="primary"
-          @click="searchQuery"
-          icon="search"
-        >查询</a-button>
-        <a-button
-          type="primary"
           @click="()=>{editPasswordVisible = true}"
           icon="edit"
         >批量修改密码</a-button>
+        <a-input v-model="queryParam.roomName" placeholder="请输入房间号" style="width: 130px; margin-right: 10px"></a-input>
+        <a-button
+            type="primary"
+            @click="searchQuery"
+            icon="search"
+        >查询</a-button>
       </div>
 
       <!-- table区域-begin -->

+ 136 - 160
src/views/stock/depositoryingoods.vue

@@ -2,7 +2,7 @@
   <a-card :bordered="false">
     <!-- 查询区域 -->
     <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="searchQuery">
+      <a-form layout="inline" @keyup.enter.native="">
         <a-row :gutter="24">
           <a-col :span="3">
             <a-form-item label="">
@@ -16,7 +16,7 @@
                   v-for="(item, index) in depositoryList"
                   :key="index"
                   :value="item.id"
-                  >{{ item.name }}</a-select-option
+                >{{ item.name }}</a-select-option
                 >
               </a-select>
             </a-form-item>
@@ -34,15 +34,17 @@
               style="float: left; overflow: hidden"
               class="table-page-search-submitButtons"
             >
-              <a-button type="primary" @click="searchQuery" icon="search"
-                >查询</a-button
+              <a-button
+                type="primary"
+                @click="loadDate"
+                icon="search"
+              >查询</a-button
               >
               <a-button
                 type="primary"
-                @click="searchReset"
                 icon="reload"
                 style="margin-left: 8px"
-                >重置</a-button
+              >重置</a-button
               >
             </span>
           </a-col>
@@ -52,9 +54,9 @@
     <!-- 查询区域-END -->
 
     <!-- 操作按钮区域 -->
-    <div class="table-operator">
-      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
-    </div>
+<!--    <div class="table-operator">-->
+<!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
+<!--    </div>-->
 
     <!-- table区域-begin -->
     <div>
@@ -72,128 +74,70 @@
         bordered
         rowKey="id"
         :columns="columns"
-        :dataSource="dataSource"
+        :dataSource="goodDate"
         :pagination="ipagination"
-        :loading="loading"
-        :rowSelection="{
-          selectedRowKeys: selectedRowKeys,
-          onChange: onSelectChange,
-        }"
-        class="j-table-force-nowrap"
-        @change="handleTableChange"
-        @expand="getInnerData"
-
+        @change="pageChange"
+        @expand="loadInnerData"
+        :expandedRowKeys="expandedRowKeys"
       >
-        <template slot="payFlagslot" slot-scope="text, record, index">
-          {{ record.payFlag == 1 ? "是" : "否" }}
-        </template>
-        <template slot="iconslot" slot-scope="text, record, index">
-          <a-icon :type="record.icon" theme="filled" />
-        </template>
-        <template slot="htmlSlot" slot-scope="text">
-          <div v-html="text"></div>
-        </template>
-        <template slot="imgSlot" slot-scope="text, record">
-          <span v-if="!text" style="font-size: 12px; font-style: italic"
-            >无图片</span
-          >
-          <img
-            v-else
-            :src="getImgView(text)"
-            :preview="record.id"
-            height="25px"
-            alt=""
-            style="max-width: 80px; font-size: 12px; font-style: italic"
-          />
-        </template>
-        <template slot="fileSlot" slot-scope="text">
-          <span v-if="!text" style="font-size: 12px; font-style: italic"
-            >无文件</span
-          >
-          <a-button
-            v-else
-            :ghost="true"
-            type="primary"
-            icon="download"
-            size="small"
-            @click="downloadFile(text)"
-          >
-            下载
-          </a-button>
-        </template>
-
-        <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">编辑</a>
-
-          <a-divider type="vertical" />
-          <a-popconfirm
-            title="确定删除吗?"
-            @confirm="() => handleDelete(record.id)"
-          >
-            <a>删除</a>
-          </a-popconfirm>
-        </span>
-
-
         <a-table
-            size="small"
-            slot="expandedRowRender"
-            slot-scope="record"
-            :columns="innerColumns"
-            :dataSource="record.kcDepositoryInGoods"
-            :pagination="record.ipagination"
-            rowKey="id"
-            @change="pageChange($event, record)"
+          size="small"
+          slot="expandedRowRender"
+          slot-scope="record"
+          :columns="innerColumns"
+          :dataSource="record.kcDepositoryInGoods"
+          :pagination="record.ipagination"
+          rowKey="id"
+          @change="innerPageChange($event, record)"
         >
         </a-table>
-
       </a-table>
     </div>
-
-    <depository-modal ref="modalForm" @ok="modalFormOk"></depository-modal>
+<!--    <depository-modal ref="modalForm" @ok="modalFormOk"></depository-modal>-->
   </a-card>
 </template>
 
   <script>
-import { JeecgListMixin } from "@/mixins/JeecgListMixin";
-import { filterObj } from "@/utils/util";
-import { getAction } from "@/api/manage";
-import DepositoryModal from "./modules/DepositoryModal.vue";
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import { filterObj } from '@/utils/util'
+import { getAction } from '@/api/manage'
+import DepositoryModal from './modules/DepositoryModal.vue'
 export default {
-  name: "memberList",
-  mixins: [JeecgListMixin],
+  name: 'MemberList',
+  // mixins: [JeecgListMixin],
   components: {
-    DepositoryModal,
+    DepositoryModal
   },
   data() {
     return {
+      goodDate: [],
       queryParam: {},
       // 分页参数
       ipagination: {
         current: 1,
         pageSize: 10,
-        pageSizeOptions: ["10", "20", "30"],
+        pageSizeOptions: ['10', '20', '30'],
         showTotal: (total, range) => {
-          return range[0] + "-" + range[1] + " 共" + total + "条";
+          return range[0] + '-' + range[1] + ' 共' + total + '条'
         },
         showQuickJumper: true,
         showSizeChanger: true,
-        total: 0,
+        total: 0
       },
-      innerPagination:{
+      innerPagination: {
         current: 1,
         pageSize: 2,
-        pageSizeOptions: ["1", "2", "3"],
+        pageSizeOptions: ['1', '2', '3'],
         showQuickJumper: true,
         showSizeChanger: true,
-        total: 0,
+        total: 0
       },
       // 表头
       columns: [
         {
-          title: "商品名称",
-          align: "center",
-          dataIndex: "name",
+          title: '商品名称',
+          align: 'center',
+          dataIndex: 'name'
         },
         // {
         //   title: "仓库名称",
@@ -201,119 +145,151 @@ export default {
         //   dataIndex: "depositoryName",
         // },
         {
-          title: "商品规格",
-          align: "center",
-          dataIndex: "spec",
+          title: '商品规格',
+          align: 'center',
+          dataIndex: 'spec'
         },
         {
-          title: "库存预警数",
-          align: "center",
-          dataIndex: "stockWarning",
+          title: '库存预警数',
+          align: 'center',
+          dataIndex: 'stockWarning'
         },
         {
-          title: "库存量",
-          align: "center",
-          dataIndex: "inventory",
+          title: '库存量',
+          align: 'center',
+          dataIndex: 'inventory'
         },
         {
-          title: "单位",
-          align: "center",
-          dataIndex: "unitName",
+          title: '单位',
+          align: 'center',
+          dataIndex: 'unitName'
         },
         {
-          title: "预警状态",
-          align: "center",
-          dataIndex: "id",
+          title: '预警状态',
+          align: 'center',
+          dataIndex: 'id',
           customRender(text, record) {
-            return record.stockWarning >= record.num ? "预警" : "正常";
-          },
-        },
+            return record.stockWarning >= record.num ? '预警' : '正常'
+          }
+        }
       ],
       innerColumns: [
         {
-          title: "单号",
-          align: "center",
-          dataIndex: "stockCode",
+          title: '单号',
+          align: 'center',
+          dataIndex: 'stockCode'
         },
         {
-          title: "仓库名称",
-          align: "center",
-          dataIndex: "depositoryName",
+          title: '仓库名称',
+          align: 'center',
+          dataIndex: 'depositoryName'
         },
         {
-          title: "进货量",
-          align: "center",
-          dataIndex: "num",
+          title: '进货量',
+          align: 'center',
+          dataIndex: 'num'
         },
         {
-          title: "价格",
-          align: "center",
-          dataIndex: "price",
+          title: '价格',
+          align: 'center',
+          dataIndex: 'price'
         }
       ],
 
       url: {
-        list: "/rooms/cesGoods/list",
-        delete: "/kc/kcDepositoryInGoods/delete",
-        deleteBatch: "/kc/kcDepositoryInGoods/deleteBatch",
-        exportXlsUrl: "/kc/kcDepositoryInGoods/exportXls",
-        importExcelUrl: "/kc/kcDepositoryInGoods/importExcel",
+        list: '/rooms/cesGoods/list',
+        delete: '/kc/kcDepositoryInGoods/delete',
+        deleteBatch: '/kc/kcDepositoryInGoods/deleteBatch',
+        exportXlsUrl: '/kc/kcDepositoryInGoods/exportXls',
+        importExcelUrl: '/kc/kcDepositoryInGoods/importExcel'
       },
       dictOptions: {},
       superFieldList: [],
       selectedRowKeys: [],
       isorter: {
-        column: "createTime",
-        order: "desc",
+        column: 'createTime',
+        order: 'desc'
       },
-      depositoryList: [],
-    };
+      expandedRowKeys: [],
+      depositoryList: []
+    }
   },
   created() {
+    this.loadDate()
   },
-  mounted() {
-    setTimeout(() => {
-      this.dataSource.forEach(item => {
-        this.$set(item, 'ipagination', this.innerPagination)
-      })
-      console.log(this.dataSource,'this,dateSource')
-    }, 500)
-
-  },
+  // mounted() {
+  //   setTimeout(() => {
+  //     this.goodDate.forEach(item => {
+  //       this.$set(item, 'ipagination', this.innerPagination)
+  //     })
+  //     console.log(this.dataSource,'this,dateSource')
+  //   }, 500)
+  //
+  // },
   methods: {
-    getInnerData(expanded, record) {
+    loadDate() {
+      let params = {
+        pageSize: this.ipagination.pageSize,
+        pageNo: this.ipagination.current,
+        name: this.queryParam.goodsName,
+      }
+      getAction(this.url.list, params).then((res) => {
+        if (!res.success) {
+          this.$message.warning('查询失败')
+          return
+        }
+        res.result.records.forEach(item => {
+          this.$set(item, 'ipagination', this.innerPagination)
+        })
+        this.goodDate = res.result.records
+        this.ipagination.pageNo = res.result.current
+        this.ipagination.total = res.result.total
+        this.expandedRowKeys = []
+      }).finally(() => {
+        // this.loading = false
+      })
+    },
+    loadInnerData(expanded, record) {
       if (!expanded) {
+        this.expandedRowKeys = this.expandedRowKeys.filter(item => item !== record.id)
         return
       }
+      this.expandedRowKeys.push(record.id)
       console.log(record)
       let parmas = {
-        pageNo: this.innerPagination.current,
-        pageSize: this.innerPagination.pageSize,
+        pageNo: record.ipagination.current,
+        pageSize: record.ipagination.pageSize,
         goodsId: record.id,
+        depositoryId: this.queryParam.depositoryId
       }
       getAction('/kc/kcDepositoryInGoods/list', parmas).then(resp => {
         if (!resp.success) {
           this.$message.warning('查询失败')
           return
         }
-        console.log(resp.result);
-        let index = this.dataSource.findIndex(e => e.id = e.id)
-        if (index === -1){
+        let index = this.goodDate.findIndex(e => e.id === record.id)
+        if (index === -1) {
           return
         }
-        this.dataSource[index].kcDepositoryInGoods = resp.result.records;
-        this.$set(this.dataSource[index], 'kcDepositoryInGoods', resp.result.records)
-        this.dataSource[index].ipagination.current = resp.result.current
-        this.dataSource[index].ipagination.total = resp.result.total
+        this.goodDate[index].kcDepositoryInGoods = resp.result.records
+        this.$set(this.goodDate[index], 'kcDepositoryInGoods', resp.result.records)
+        this.goodDate[index].ipagination.current = resp.result.current
+        this.goodDate[index].ipagination.total = resp.result.total
+        this.goodDate[index].ipagination.pageSize = resp.result.size
       })
     },
-    pageChange(page, item) {
+    innerPageChange(page, item) {
       console.log(page)
-      this.innerPagination = page
-      this.getInnerData(true, item)
+      item.ipagination = page
+      this.loadInnerData(true, item)
+    },
+    pageChange(page) {
+      console.log(page)
+      this.ipagination = page
+      this.loadDate()
     }
-  },
-};
+  }
+}
 </script>
   <style scoped>
 @import "~@assets/less/common.less";