Parcourir la source

Merge branch 'master' of http://49.4.53.36:3000/hotel/hotel-saas-tenant-frontend

gqx il y a 2 ans
Parent
commit
ed039db455
2 fichiers modifiés avec 284 ajouts et 10 suppressions
  1. 108 0
      src/views/room/forWardFangTaiModal.vue
  2. 176 10
      src/views/room/forwardfangtai.vue

+ 108 - 0
src/views/room/forWardFangTaiModal.vue

@@ -0,0 +1,108 @@
+<template>
+<!-- 弹窗 -->
+<a-modal :title="modalTitle" :visible.sync="modalVisible" :width="1200" :footer="null" @cancel="() => (modalVisible = false)">
+    <div class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="searchQuery">
+            <a-row :gutter="24">
+                <a-col :span="6">
+                    <a-form-item label="">
+                        <a-input placeholder="房号" v-model="search"></a-input>
+                    </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="8">
+                    <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
+                        <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+                    </span>
+                </a-col>
+            </a-row>
+        </a-form>
+    </div>
+    <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="tableData" class="j-table-force-nowrap">
+        <template slot="status" slot-scope="text, record">
+            {{record.isLiving==0?'预定房':'在住房'}}
+            <!-- {{text}} -->
+        </template>
+    </a-table>
+</a-modal>
+</template>
+
+<script>
+export default {
+    name: 'forWardFangTaiModal',
+    props: {
+        // modalTitle: {
+        //     type: String,
+        //     default: '今日预离'
+        // },
+        // modalVisible: {
+        //     type: Boolean,
+        //     default: false
+        // },
+        dataSource: {
+            type: Array,
+            default: () => []
+        }
+    },
+    data() {
+        return {
+            tableData: [],
+            tableDataCopy: [],
+            modalVisible:false,
+            modalTitle:'今日预离',
+            search:'',
+            columns: [{
+                    title: "房号",
+                    align: "center",
+                    dataIndex: "roomName",
+                },
+                {
+                    title: "单号",
+                    align: "center",
+                    dataIndex: "orderNo",
+                },
+                {
+                    title: "客人姓名",
+                    align: "center",
+                    dataIndex: "customerName",
+                },
+                {
+                    title: "房间类型",
+                    align: "center",
+                    dataIndex: "layoutName",
+                },
+                {
+                    title: "状态",
+                    align: "center",
+                    // dataIndex: "isLiving",
+                    scopedSlots: {
+                        customRender: "status"
+                    }
+                },
+                {
+                    title: "入住时间",
+                    align: "center",
+                    dataIndex: "arrivalTime",
+                },
+                {
+                    title: "预离时间",
+                    align: "center",
+                    dataIndex: "dueOutTime",
+                },
+            ]
+        }
+    },
+    methods: {
+        searchQuery(){
+            // this.tableDataCopy = JSON.parse(JSON.stringify(this.tableData))
+            this.tableData = this.tableDataCopy.filter(item => item.roomName.includes(this.search))
+        }
+    },
+    mounted() {
+
+    }
+}
+</script>
+
+<style>
+
+</style>

+ 176 - 10
src/views/room/forwardfangtai.vue

@@ -20,6 +20,9 @@
               style="float: left; overflow: hidden"
               class="table-page-search-submitButtons"
             >
+              <span style="margin-right:10px;">
+                包含当日预离房<a-switch v-model="queryParam.isContainLeave" />
+              </span>
               <a-button type="primary" @click="searchQuery" icon="search"
                 >查询</a-button
               >
@@ -38,7 +41,7 @@
     <!-- 查询区域-END -->
 
     <!-- table区域-begin -->
-    <div v-if="false">
+    <div>
       <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
         <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
@@ -68,6 +71,12 @@
           /> -->
           0/0/{{ text }}
         </template>
+
+        <template :slot="'long'" slot-scope="text, record">
+          <!-- {{text.leaveCount}}/{{text.livingCount}} -->
+          <a @click="leaveCountOpen(text)">{{text.leaveCount}}</a> / <a @click="openModal(text)">{{text.livingCount}}</a> / <span>{{record.count*1 - text.livingCount*1}}</span>
+        </template>
+
         <template slot="htmlSlot" slot-scope="text">
           <div v-html="text"></div>
         </template>
@@ -121,6 +130,16 @@
             </a-menu>
           </a-dropdown>
         </span>
+
+
+
+        <template slot="footer" slot-scope="currentPageData" v-if="dataList.length>0">
+          <a-table size="middle" :scroll="{ x: true }" bordered rowKey="id" :showHeader="false" :pagination="false" :columns="columns" :dataSource="dataList">
+              <template slot="action" slot-scope="text, record">
+                  {{record}}
+              </template>
+          </a-table>
+        </template>
       </a-table>
     </div>
 
@@ -128,6 +147,7 @@
       ref="modalForm"
       @ok="modalFormOk"
     ></bus-member-balance-log-modal> -->
+    <ForWardFangTaiModal ref="forWardModal" />
   </a-card>
 </template>
 
@@ -138,6 +158,8 @@ import { JeecgListMixin } from "@/mixins/JeecgListMixin2";
 import { formatDate } from "@/utils/util";
 import EditableCell from "@views/room/modules/checkIn/EditableCell.vue";
 import { httpAction, postAction,getAction } from "@/api/manage";
+import ForWardFangTaiModal from './forWardFangTaiModal.vue';
+
 const hotelInfo = JSON.parse(localStorage.getItem("storeInfo"));
 import moment from "moment";
 const date = new Date();
@@ -147,15 +169,19 @@ export default {
   mixins: [JeecgListMixin, mixinDevice],
   components: {
     EditableCell,
+    ForWardFangTaiModal
   },
   data() {
     return {
       description: "远期房态",
       queryParam: {
         gradeId: "全天房",
-        startTime: moment(new Date()).format("YYYY-MM-DD"),
-        endTime: moment(endDate).format("YYYY-MM-DD"),
+        start: moment(new Date()).format("YYYY-MM-DD"),
+        end: moment(endDate).format("YYYY-MM-DD"),
+        isContainLeave: true
       },
+      modalVisible:false,
+      modalTitle: "占用房间",
       datetime: [
         moment(new Date(), "YYYY-MM-DD"),
         moment(endDate, "YYYY-MM-DD"),
@@ -170,8 +196,7 @@ export default {
         },
       ],
       url: {
-        list:
-          "/rooms/cesRoomLayoutPriceDate/pageList?hotelIds[]=" + hotelInfo.id,
+        list:"/business/busRoomBookingOrders/forward-fangtai",
         delete: "/business/busMemberBalanceLog/delete",
         deleteBatch: "/business/busMemberBalanceLog/deleteBatch",
         exportXlsUrl: "/business/busMemberBalanceLog/exportXls",
@@ -197,6 +222,29 @@ export default {
     importExcelUrl: function () {
       return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
     },
+    dataList() {
+            if (this.dataSource.length == 0) {
+                return []
+            }
+            let arr = Object.keys(this.dataSource[0])
+            let brr = [] 
+            arr = arr.filter(item => item != 'layout_name' && item != 'flag' && item != 'data' && item!='count')
+            let sum = 0
+            console.log(arr);
+            arr.forEach(item => {
+                sum += this.dataSource[this.dataSource.length - 1][item]
+            })
+            arr.forEach(item => {
+                console.log(item);
+                let a = {}
+                a[item] = `${this.dataSource.reduce((a, b) => a + b[item].leaveCount, 0)} ` + '/' + ` ${this.dataSource.reduce((a, b) => a + b[item].livingCount, 0)}` + ' / ' + (this.dataSource.reduce((a, b) => a + b.count*1, 0) - this.dataSource.reduce((a, b) => a + b[item].livingCount, 0))
+                brr.push(a)
+            })
+            let obj1 = {}
+            obj1=Object.assign({}, ...brr, {layout_name: '合计'},{flag:true}, {count: this.dataSource.reduce((a, b) => a + b.count*1, 0)});
+            console.log(obj1);
+            return [obj1]
+        }
   },
   methods: {
     onCellChange(key, dataIndex, value) {
@@ -227,8 +275,8 @@ export default {
       if (this.queryParam.hotelIds && this.queryParam.hotelIds.length > 0) {
         this.url.list = "/rooms/cesRoomLayoutPriceDate/pageList";
       } else {
-        this.url.list =
-          "/rooms/cesRoomLayoutPriceDate/pageList?hotelIds[]=" + hotelInfo.id;
+        this.url.list = "/business/busRoomBookingOrders/forward-fangtai"
+          // "/rooms/cesRoomLayoutPriceDate/pageList?hotelIds[]=" + hotelInfo.id;
       }
       this.loadData(1);
       this.selectedRowKeys = [];
@@ -242,8 +290,8 @@ export default {
     onChange(e, dateString) {
       // console.log("Selected Time: ", e);
       // console.log("Formatted Selected Time: ", dateString);
-      this.queryParam.startTime = dateString[0];
-      this.queryParam.endTime = dateString[1];
+      this.queryParam.start = dateString[0];
+      this.queryParam.end = dateString[1];
     },
     initDictConfig() {},
     getSuperFieldList() {
@@ -266,9 +314,127 @@ export default {
       fieldList.push({ type: "string", value: "code", text: "流水号" });
       this.superFieldList = fieldList;
     },
+    loadData(arg) {
+      if (!this.url.list) {
+        this.$message.error("请设置url.list属性!")
+        return
+      }
+      //加载数据 若传入参数1则加载第一页的内容
+      if (arg === 1) {
+        this.ipagination.current = 1;
+      }
+      var params = this.getQueryParams();//查询条件
+      this.loading = true;
+      this.columns = [
+        {
+          title: "房型",
+          align: "center",
+          dataIndex: "layout_name",
+          width: 300,
+        },
+        {
+          title: "",
+          align: "center",
+          dataIndex: "count",
+          width: 40,
+        }
+      ],
+      getAction(this.url.list, params).then((res) => {
+        if (res.success) {
+          //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+          this.dataSource = res.result.records || res.result.dateList || res.result;
+          if (res.result.layoutRooms.length>0) {
+            // this.dataSource = this.dataSource.map((item, index) => ({
+            //   layout_name:item
+            // }))
+            let brr = []
+            res.result.layoutRooms.forEach(ele=>{
+              // console.log(ele);
+              brr.push({
+                layout_name:ele.layoutName,
+                count:ele.roomCount,
+                data:res.result.dateList.filter(item => item.layoutId == ele.layoutId)
+              })
+              // brr = res.result.dateList.filter(item => item.layoutId == ele.layoutId)
+            })
+            // console.log(brr);
+            brr.forEach(ele=>{
+              ele.data.forEach(item=>{
+                ele[item.date] = item
+              })
+            })
+            console.log(brr);
+            let arr = []
+            brr[0].data.forEach(ele=>{
+              arr.push({
+                title: ele.date,
+                align: "center",
+                dataIndex: ele.date,
+                width:'120px',
+                scopedSlots: {
+                        customRender: 'long'
+                    },
+              })
+            })
+            this.dataSource = brr
+            this.columns = this.columns.concat(arr)
+            console.log('1111111111111111',arr);
+          }
+          if (res.result.total) {
+            this.ipagination.total = res.result.total;
+          } else {
+            this.ipagination.total = 0;
+          }
+          //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+        } else {
+          this.$message.warning(res.message)
+        }
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+
+    leaveCountOpen(data){
+      console.log(data);
+      this.$refs.forWardModal.modalVisible = true
+      this.$refs.forWardModal.modalTitle = '今日预离'
+      this.$refs.forWardModal.tableData = data.leaveOrders
+      this.$refs.forWardModal.tableDataCopy = data.leaveOrders
+    },
+    openModal(data){
+      console.log(data);
+      this.$refs.forWardModal.modalVisible = true
+      this.$refs.forWardModal.modalTitle = '占用房间'
+      this.$refs.forWardModal.tableData = data.livingOrders
+      this.$refs.forWardModal.tableDataCopy = data.livingOrders
+    }
   },
 };
 </script>
-<style scoped>
+<style lang="less" scoped>
 @import "~@assets/less/common.less";
+/deep/ .ant-table-content .ant-table-body {
+    position: relative;
+    z-index: 2;
+    background: #FFFFFF;
+}
+
+/deep/ .ant-table-footer .ant-table-body {
+    // overflow: hidden !important;
+    position: relative !important;
+    z-index: 1 !important;
+}
+
+/deep/ .ant-table-content>.ant-table-footer {
+    padding: 0 !important;
+    top: 0px;
+    position: relative;
+    z-index: 0;
+}
+/deep/.ant-table-footer{
+    padding: 0 !important;
+    top: 0px;
+    position: relative;
+    z-index: 2;
+}
 </style>