Browse Source

修改文档中的问题。添加房间超时收费

许智捷 2 years ago
parent
commit
789440000b

+ 294 - 191
src/views/fangwu/index.vue

@@ -1,159 +1,178 @@
 <template>
-<a-card :bordered="false">
+  <a-card :bordered="false">
     <a-tabs default-active-key="1" @change="callback">
-        <a-tab-pane key="1" tab="房务数据概览">
-            <div>
-                <h3>今日房务管理</h3>
-                <a-card style="width:50%;" class="card">
-                    <div class="grid-day">
-                        <div>
-                            <div>今日锁房</div>
-                            <div>{{LockedRoom}}间</div>
-                        </div>
-                        <div>
-                            <div>正在维修中房间</div>
-                            <div>{{RepairingRoom}}间</div>
-                        </div>
-                        <div>
-                            <div>今日完成维修房间</div>
-                            <div>{{TodayRepairRoom}}间</div>
-                        </div>
-                    </div>
-                </a-card>
+      <a-tab-pane key="1" tab="房务数据概览">
+        <div>
+          <h3>今日房务管理</h3>
+          <a-card style="width:50%;" class="card">
+            <div class="grid-day">
+              <div>
+                <div>今日锁房</div>
+                <div>{{ LockedRoom }}间</div>
+              </div>
+              <div>
+                <div>正在维修中房间</div>
+                <div>{{ RepairingRoom }}间</div>
+              </div>
+              <div>
+                <div>今日完成维修房间</div>
+                <div>{{ TodayRepairRoom }}间</div>
+              </div>
             </div>
+          </a-card>
+        </div>
 
-            <div>
-                <h3>分派房</h3>
-                <div class="grid-assign">
-                    <a-card class="card">
-                        <div class="assign-flex">
-                            <div>今日待派房间<span>0</span>间,已经分配了<span>0</span>间,剩余<span>0</span>间</div>
-                            <div style="color:#1890FF" @click="showAssignModal">点击分配</div>
-                        </div>
-                        <div style="text-indent: 2em;" class="assign-content">
-                            <div v-for="(item, index) in 15" :key="index">
-                                <span style="color:#1890FF">{{'小明'}}</span>:{{'0间'}}
-                            </div>
-                        </div>
-                    </a-card>
-                    <a-card class="card">
-                        <div>
-                            <div>房务审核记录及调整</div>
-                        </div>
-                        <div class="assgin-center">{{verifyCount}}条需要审核,<a @click="lookLook">点击查看></a> </div>
-                    </a-card>
-                    <a-card class="card">
-                        <div>
-                            <div>房屋审核记录及调整</div>
-                        </div>
-                        <div class="assgin-right">
-                            <a-button @click="auditRecords">点击设置</a-button>
-                        </div>
-                    </a-card>
+        <div>
+          <h3>分派房</h3>
+          <div class="grid-assign">
+            <a-card class="card">
+              <div class="assign-flex">
+                <div>今日待派房间<span>0</span>间,已经分配了<span>0</span>间,剩余<span>0</span>间</div>
+                <div style="color:#1890FF" @click="showAssignModal">点击分配</div>
+              </div>
+              <div style="text-indent: 2em;" class="assign-content">
+                <div v-for="(item, index) in 15" :key="index">
+                  <span style="color:#1890FF">{{ '小明' }}</span>:{{ '0间' }}
+                </div>
+              </div>
+            </a-card>
+            <a-card class="card">
+              <div>
+                <div>房务审核记录及调整</div>
+              </div>
+              <div class="assgin-center">{{ verifyCount }}条需要审核,<a @click="lookLook">点击查看></a> </div>
+            </a-card>
+            <a-card class="card">
+              <div>
+                <div>房屋审核记录及调整</div>
+              </div>
+              <div class="assgin-right">
+                <a-button @click="auditRecords">点击设置</a-button>
+              </div>
+            </a-card>
+          </div>
+        </div>
+
+        <div>
+          <h3>房扫记录</h3>
+          <div class="">
+            <ClearRecords />
+          </div>
+        </div>
+
+        <div>
+          <h3>房间易耗品记录</h3>
+          <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;">
+            <div style="display:flex;align-items:center;width:100%;">
+              <div class="list-container">
+                <div class="list-item" v-for="(item, index) in list" :key="index" :class="{active: activeIndex === index}" @click="handleClick(index)">
+                  {{ item }}
                 </div>
+              </div>
+              <a-range-picker v-show="activeIndex==4" @change="onChange" size="large" />
             </div>
 
+            <a-button @click="dispose" style="background:#1890ff;color:#fff;">配置易耗品</a-button>
+          </div>
+          <a-card class="card">
             <div>
-                <h3>房扫记录</h3>
-                <div class="">
-                    <ClearRecords />
+              <div>
+                客房易耗品消耗数量
+              </div>
+              <div style="display:flex;flex-wrap:wrap">
+                <div v-for="item in roomConsumableCount" style="margin-right:20px;">
+                  {{ item.good_name }} <a>{{ item.num }}{{ item.unit }}</a>
                 </div>
+              </div>
             </div>
-
             <div>
-                <h3>房间易耗品记录</h3>
-                <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;">
-                    <div style="display:flex;align-items:center;width:100%;">
-                        <div class="list-container">
-                            <div class="list-item" v-for="(item, index) in list" :key="index" :class="{active: activeIndex === index}" @click="handleClick(index)">
-                                {{ item }}
-                            </div>
-                        </div>
-                        <a-range-picker v-show="activeIndex==4" @change="onChange" size="large" />
-                    </div>
-
-                    <a-button @click="dispose" style="background:#1890ff;color:#fff;">配置易耗品</a-button>
+              <div>
+                布草换洗
+              </div>
+              <div style="display:flex;flex-wrap:wrap">
+                <div v-for="item in linenCount" style="margin-right:20px;">
+                  {{ item.good_name }} <a>{{ item.num }}{{ item.unit }}</a>
                 </div>
-                <a-card class="card">
-                    <div>
-                        <div>
-                            客房易耗品消耗数量
-                        </div>
-                        <div style="display:flex;flex-wrap:wrap">
-                            <div v-for="item in roomConsumableCount" style="margin-right:20px;">
-                                {{item.good_name}} <a>{{item.num}}{{item.unit}}</a>
-                            </div>
-                        </div>
-                    </div>
-                    <div>
-                        <div>
-                            布草换洗
-                        </div>
-                        <div style="display:flex;flex-wrap:wrap">
-                            <div v-for="item in linenCount" style="margin-right:20px;">
-                                {{item.good_name}} <a>{{item.num}}{{item.unit}}</a>
-                            </div>
-                        </div>
-                    </div>
-                </a-card>
+              </div>
             </div>
-        </a-tab-pane>
-        <a-tab-pane key="2" tab="维修记录" force-render>
-            <MaintenanceRecords />
-        </a-tab-pane>
-        <a-tab-pane key="3" tab="锁房记录">
-            <LockRoomRecords />
-        </a-tab-pane>
-        <a-tab-pane key="4" tab="房扫管理">
-            <ClearRoomManagement />
-        </a-tab-pane>
-        <a-tab-pane key="5" tab="房型易耗品">
-            <HouseTypeConsumablesVue />
-        </a-tab-pane>
+          </a-card>
+        </div>
+      </a-tab-pane>
+      <a-tab-pane key="2" tab="维修记录" force-render>
+        <MaintenanceRecords />
+      </a-tab-pane>
+      <a-tab-pane key="3" tab="锁房记录">
+        <LockRoomRecords />
+      </a-tab-pane>
+      <a-tab-pane key="4" tab="房扫管理">
+        <ClearRoomManagement />
+      </a-tab-pane>
+      <a-tab-pane key="5" tab="房型易耗品">
+        <HouseTypeConsumablesVue />
+      </a-tab-pane>
     </a-tabs>
     <!-- 分派房务弹窗 -->
     <a-modal v-model="assignVisible" title="分派房务" @ok="handleAssignOk" width="70%">
-        <div style="background-color: #ecf8ff; display: flex; justify-content: center; align-items: center;height:40px;border-radius:5px;overflow: hidden;">
-            <div style="width: 10px; height: 100%; background-color: #1890FF;"> </div>
-            <div style="text-align: center;flex:1;">剩余脏房 {{0}} 间 续(脏)房 {{5}} 间 退(脏)房 {{1}} 间</div>
-        </div>
-        <a-table ref="table" size="middle" :scroll="{ x: true, y: 600 }" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="false" :loading="loading" :rowSelection="{
+      <div style="background-color: #ecf8ff; display: flex; justify-content: center; align-items: center;height:40px;border-radius:5px;overflow: hidden;">
+        <div style="width: 10px; height: 100%; background-color: #1890FF;"> </div>
+        <div style="text-align: center;flex:1;">剩余脏房 {{ 0 }} 间 续(脏)房 {{ 5 }} 间 退(脏)房 {{ 1 }} 间</div>
+      </div>
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{ x: true, y: 600 }"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="waiterList"
+        :pagination="false"
+        :rowSelection="{
           selectedRowKeys: selectedRowKeys,
           onChange: onSelectChange,
-        }" class="j-table-force-nowrap" @change="handleTableChange">
-
-            <template slot="houseDetail" slot-scope="text, record">
-                <div>
-                    退(脏)房: <span class="check-out" v-for="(item, index) in !record || 6" :key="index">{{8306+index + ''}}</span>
-                </div>
-                <div style="margin-top:10px;">
-                    续(脏)房: <span class="continue" v-for="(item, index) in !record || 6" :key="index">{{210+index + ''}}</span>
-                </div>
-            </template>
-            <template slot="prefix_name" slot-scope="text, record">
-                {{ (record.prefix || "") + record.name }}
-            </template>
-            <template slot="htmlSlot" slot-scope="text">
-                <div v-html="text"></div>
-            </template>
-            <span slot="action" slot-scope="text, record">
-                <a @click="handVisible = true">手动分房</a>
-            </span>
-        </a-table>
+        }"
+        class="j-table-force-nowrap"
+        @change="handleTableChange">
+
+        <template slot="houseDetail" slot-scope="text, record">
+          <div>
+            退(脏)房:
+<!--            <span class="check-out" v-for="(item, index) in record.vacantRoom" :key="index">{{ item.roomNo }}</span>-->
+            <a-tag class="check-out" v-for="(item, index) in record.vacantRoom" :key="index" closable @close="removeRoom(item)">{{ item.roomNo }}</a-tag>
+          </div>
+          <div style="margin-top:10px;">
+            续(脏)房: <a-tag class="continue" v-for="(item, index) in record.livingRoom" :key="index" closable @close="removeRoom(item)">{{ item.roomNo }}</a-tag>
+          </div>
+        </template>
+        <template slot="prefix_name" slot-scope="text, record">
+          {{ (record.prefix || "") + record.name }}
+        </template>
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <span slot="action" slot-scope="text, record">
+          <a @click="allotRoomOpen(record.id)">手动分房</a>
+        </span>
+      </a-table>
     </a-modal>
     <!-- 手动分房弹窗 -->
-    <a-modal v-model="handVisible" title="房间列表" @ok="handVisible=false" width="50%">
-        <a-card title="退(脏)房">
-            <div style="display:flex; margin-right:6px;flex-wrap:wrap;">
-                <div @click="checkOut(item)" class="check-out" v-for="item in 5" :key="item.id">{{item}}</div>
-            </div>
-        </a-card>
-        <br />
-        <a-card title="续(脏)房">
-            <div style="display:flex; margin-right:6px;flex-wrap:wrap;">
-                <div @click="continueHouse(item)" class="check-out" v-for="item in 5" :key="item.id">{{item}}</div>
+    <a-modal v-model="handVisible" title="房间列表" @ok="allotRoom" width="50%">
+      <a-card title="退(脏)房">
+        <div style="display:flex; margin-right:6px;flex-wrap:wrap;">
+          <div @click="item.isSelect = !item.isSelect" class="check-out" v-for="item in vacantRoom" :key="item.id">
+            <span v-if="item.isSelect" style="color: #efef0d"> √ </span>
+            <span>{{item.prefix}}{{ item.name }}</span>
+          </div>
+        </div>
+      </a-card>
+      <br />
+      <a-card title="续(脏)房">
+        <div style="display:flex; margin-right:6px;flex-wrap:wrap;">
+          <div @click="item.isSelect = !item.isSelect" class="check-out" v-for="item in livingRoom" :key="item.id">
+            <span v-if="item.isSelect" style="color: #efef0d"> √ </span>
+            <span>{{item.prefix}}{{ item.name }}</span>
             </div>
-        </a-card>
+        </div>
+      </a-card>
     </a-modal>
 
     <!-- 手动分房弹窗结束 -->
@@ -169,7 +188,7 @@
     <!-- 配置易耗品弹窗 -->
     <ConfigureConsumables ref="configModal" />
     <!-- 配置易耗品弹窗结束 -->
-</a-card>
+  </a-card>
 </template>
 
 <script>
@@ -184,12 +203,12 @@ import ConfigureConsumables from './modalList/configureConsumables.vue'
 
 import {
     JeecgListMixin
-} from "@/mixins/JeecgListMixin";
+} from '@/mixins/JeecgListMixin'
 // import roomNumModal from "./roomNumModal.vue"; // todo roomLayoutForm 需要替换成房型的表单弹窗
 // import roomImgs from './roomImagesForm.vue'
 import {
     getAllLayouts
-} from "@/api/roomLayout";
+} from '@/api/roomLayout'
 import {
     delBatch,
     delAll
@@ -199,9 +218,10 @@ import {
     HousekeepingApi
 } from '@/api/fwApi.js'
 import {
-    getAction
+  deleteAction,
+  getAction, postAction
 } from '../../api/manage'
-let hotelInfo = JSON.parse(localStorage.getItem("storeInfo"));
+let hotelInfo = JSON.parse(localStorage.getItem('storeInfo'))
 export default {
     mixins: [JeecgListMixin],
     components: {
@@ -221,51 +241,57 @@ export default {
             /**
              * 待审核的数量
              */
+            chooseWaiterId: '',
             verifyCount: 0,
-
+            vacantRoom: [],
+            livingRoom: [],
+            selectVacantRoom: [],
+            selectLivingRoom: [],
             activeIndex: 0,
+            waiterList: [],
             dataSource: [],
             assignVisible: false,
             handVisible: false,
-            //锁房总数
+            // 锁房总数
             LockedRoom: '0',
-            //正在维修中总数
+            // 正在维修中总数
             RepairingRoom: '0',
-            //今日完成维修总数
+            // 今日完成维修总数
             TodayRepairRoom: '0',
 
             // 表头
             columns: [{
-                    title: "姓名",
-                    align: "center",
-                    dataIndex: "hotelName",
+                    title: '姓名',
+                    align: 'center',
+                    width: '50px',
+                    dataIndex: 'name'
                 },
                 {
-                    title: "退房",
+                    title: '退房',
                     // align: "center",
-                    dataIndex: "房间明细",
+                    dataIndex: '房间明细',
                     scopedSlots: {
-                        customRender: "houseDetail"
-                    },
+                        customRender: 'houseDetail'
+                    }
                 },
                 {
-                    title: "操作",
-                    dataIndex: "action",
-                    align: "center",
-                    fixed: "right",
+                    title: '操作',
+                    dataIndex: 'action',
+                    align: 'center',
+                    fixed: 'right',
                     width: 147,
                     scopedSlots: {
-                        customRender: "action"
-                    },
-                },
+                        customRender: 'action'
+                    }
+                }
             ],
             url: {
                 // list: 'org.jeecg.modules.business/busMarketMember/list',
-                list: "/rooms/cesRooms/list",
-                delete: "/rooms/cesRooms/remove",
-                deleteBatch: "/rooms/cesRooms/deleteBatch",
-                exportXlsUrl: "/rooms/cesRooms/exportXls",
-                importExcelUrl: "rooms/cesRooms/importExcel",
+                list: 2,
+                delete: '/rooms/cesRooms/remove',
+                deleteBatch: '/rooms/cesRooms/deleteBatch',
+                exportXlsUrl: '/rooms/cesRooms/exportXls',
+                importExcelUrl: 'rooms/cesRooms/importExcel'
             },
             buildingFloorSearchTag: {
                 name: null
@@ -273,12 +299,12 @@ export default {
             dictOptions: {},
             superFieldList: [],
             selectedRowKeys: [],
-            startTime: new Date().toLocaleString().substring(0, 10).replace(/\//g, "-"),
-            endTime: new Date(new Date().getTime() + 24*60*60*1000).toLocaleString().substring(0, 10).replace(/\//g, "-"),
-            //客房易耗品数量
+            startTime: new Date().toLocaleString().substring(0, 10).replace(/\//g, '-'),
+            endTime: new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleString().substring(0, 10).replace(/\//g, '-'),
+            // 客房易耗品数量
             roomConsumableCount: [],
-            //布草
-            linenCount: [],
+            // 布草
+            linenCount: []
         }
     },
     methods: {
@@ -290,24 +316,88 @@ export default {
             if (index == 4) {
                 return
             }
-            let startTime, endTime;
+            let startTime, endTime
             startTime = this.getTime(index).startTime
             endTime = this.getTime(index).endTime
             this.getRoomUseConsumableSummary(startTime, endTime, 1)
             this.getRoomUseConsumableSummary(startTime, endTime, 2)
             // this.searchQuery()
         },
+        getWaiter() {
+          getAction('/business/busWaiter/getRoomClean', { hotelId: hotelInfo.id }).then(resp => {
+            if (resp.success) {
+              resp.result.forEach(waiter => {
+                let livingRoom = waiter.roomCleanList.filter(e => e.roomState === 2)
+                let vacantRoom = waiter.roomCleanList.filter(e => e.roomState === 1)
+                this.$set(waiter, 'livingRoom', livingRoom)
+                this.$set(waiter, 'vacantRoom', vacantRoom)
+              })
+              this.waiterList = resp.result
+            }
+          })
+        },
+        loadFwRoomClean() {
+          getAction('/rooms/cesRooms/needCleanRoom').then(resp => {
+            if (resp.success) {
+              this.allCleanRoom = resp.result;
+              this.allCleanRoom.forEach(e => this.$set(e, 'isSelect', false))
+              this.vacantRoom = this.allCleanRoom.filter(e => e.roomStatus === 2)
+              this.livingRoom = this.allCleanRoom.filter(e => e.roomStatus === 4)
+            }
+          })
+        },
+        allotRoomOpen(id) {
+          this.chooseWaiterId = id
+          this.loadFwRoomClean()
+          this.handVisible = true
+        },
+        // 分配房间
+        allotRoom() {
+            let chooseRoom = this.allCleanRoom.filter(e => e.isSelect === true)
+            let params = {
+              hotelId: hotelInfo.id,
+              waiterId: this.chooseWaiterId,
+              roomCleanList: []
+            }
+          console.log(chooseRoom)
+            chooseRoom.forEach(e => {
+              let obj = {
+                roomId: e.id,
+                roomNo: e.name,
+                roomState: e.roomStatus === 2 ? 1 : 2
+              }
+              params.roomCleanList.push(obj)
+            })
+            if (chooseRoom.length > 0) {
+              postAction('/fw/fwRoomClean/allotRoomClean', params).then(resp => {
+                if (resp.success){
+                  this.getWaiter()
+                }
+              })
+            }
+            this.handVisible = false
 
+        },
+        removeRoom(room){
+          console.log(room)
+            deleteAction('/fw/fwRoomClean/delete', { id: room.id }).then(resp => {
+              if (resp.success) {
+                this.$message.success('删除成功')
+              } else {
+                this.$message.warning('删除失败')
+                this.getWaiter()
+              }
+            })
+        },
         getTime(type) {
-
-            let startTime;
-            let endTime;
-            let now = new Date(); //当前日期
-            let nowDayOfWeek = now.getDay(); //今天本周的第几天
-            let nowDay = now.getDate(); //当前日
-            let nowMonth = now.getMonth(); //当前月
-            let nowYear = now.getFullYear(); //当前年
-            let jd=Math.ceil((nowMonth + 1) / 3)
+            let startTime
+            let endTime
+            let now = new Date() // 当前日期
+            let nowDayOfWeek = now.getDay() // 今天本周的第几天
+            let nowDay = now.getDate() // 当前日
+            let nowMonth = now.getMonth() // 当前月
+            let nowYear = now.getFullYear() // 当前年
+            let jd = Math.ceil((nowMonth + 1) / 3)
             if (type == 0) {
                 startTime = new Date().toLocaleString().substring(0, 10)
                 endTime = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleString().substring(0, 10)
@@ -316,11 +406,11 @@ export default {
                 startTime = new Date(new Date().getTime() - 24 * 60 * 60 * 1000 * 2).toLocaleString().substring(0, 10)
                 endTime = new Date(new Date().getTime() - 24 * 60 * 60 * 1000).toLocaleString().substring(0, 10)
             }
-            if(type == 2){
-                startTime = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek+1).toLocaleString().substring(0, 10)
-                endTime = new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek+1).toLocaleString().substring(0, 10)
+            if (type == 2) {
+                startTime = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1).toLocaleString().substring(0, 10)
+                endTime = new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek + 1).toLocaleString().substring(0, 10)
             }
-            if (type==3) {
+            if (type == 3) {
                 startTime = new Date(nowYear, nowMonth, 1).toLocaleString().substring(0, 9)
                 endTime = new Date(nowYear, nowMonth + 1, 0).toLocaleString().substring(0, 10)
             }
@@ -343,11 +433,11 @@ export default {
                 type
             }).then(res => {
                 if (res.success) {
-                    console.log(res);
-                    if (type==1) {
+                    console.log(res)
+                    if (type == 1) {
                         this.roomConsumableCount = res.result
                     }
-                    if (type==2) {
+                    if (type == 2) {
                         this.linenCount = res.result
                     }
                 }
@@ -355,30 +445,41 @@ export default {
         },
         onChange(date, dateString) {
             console.log(date, dateString)
-            if (dateString[0]=="" || dateString[1]=="") {
+            if (dateString[0] == '' || dateString[1] == '') {
                 return
             }
             this.getRoomUseConsumableSummary(dateString[0], dateString[1], 1)
             this.getRoomUseConsumableSummary(dateString[0], dateString[1], 2)
         },
-        //点击弹出框
+        // 点击弹出框
         showAssignModal() {
+            this.getWaiter()
             this.assignVisible = true
         },
         handleAssignOk() {
             this.assignVisible = false
         },
         continueHouse(item) {
-            console.log(item)
+          let index = this.selectLivingRoom.findIndex(e => e === item)
+          if (index === -1) {
+            this.selectLivingRoom.push(item)
+          } else {
+            this.selectLivingRoom.splice(index, 1)
+          }
         },
         checkOut(item) {
-            console.log(item)
+          let index = this.selectVacantRoom.findIndex(e => e === item)
+          if (index === -1) {
+            this.selectVacantRoom.push(item)
+          } else {
+            this.selectVacantRoom.splice(index, 1)
+          }
         },
         lookLook() {
             this.$refs.lookModal.visible = true
             this.$refs.lookModal.title = '房务审核'
         },
-        //房务审核记录设置
+        // 房务审核记录设置
         auditRecords() {
             this.$refs.auditModal.visible = true
             this.$refs.auditModal.title = '分派规则'
@@ -389,7 +490,8 @@ export default {
         dispose() {
             this.$refs.configModal.visible = true
             this.$refs.configModal.title = '配置易耗品'
-        }
+        },
+
     },
     mounted() {
         // getAllLayouts().then((res) => {
@@ -412,6 +514,7 @@ export default {
         })
         this.getRoomUseConsumableSummary(this.startTime, this.endTime, 1)
         this.getRoomUseConsumableSummary(this.startTime, this.endTime, 2)
+        this.loadFwRoomClean()
     }
 }
 </script>

+ 2 - 2
src/views/finance/financeModules/depository.vue

@@ -96,7 +96,7 @@ export default {
                 return []
             }
             let arr = Object.keys(this.dataSource[0])
-            let brr = [] 
+            let brr = []
             arr = arr.filter(item => item != 'department' && item != 'hotel_name' && item != 'flag')
             let sum = 0
             arr.forEach(item => {
@@ -127,7 +127,7 @@ export default {
             arr.forEach(item => {
                 sum += data[item]
             })
-            return sum
+            return sum.toFixed(2)
         }
     },
     watch: {

+ 9 - 3
src/views/room/calendarfangtai.vue

@@ -341,6 +341,11 @@ export default {
       nowRoomIds: []
     }
   },
+  watch: {
+    '$route'(to, from) {
+      this.getData()
+    }
+  },
   created() {
     this.initColumns()
     setTimeout(() => {
@@ -628,15 +633,15 @@ export default {
                 total: s.rooms.length
               })
             }
-            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)
 
+            console.log(this.roomStatuList)
+            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'))
             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)
+              let findExistOrderIndex = this.tempOrderIds.findIndex(w => w.orderId === tpOrder.orderId && w.roomId === tpOrder.roomId)
               if (findExistOrderIndex == -1) {
                 let dayCount = this.getDiffDay(new Date(tpOrder.arrivalTime).format('yyyy-MM-dd'), new Date(tpOrder.dueOutTime).format('yyyy-MM-dd'))
 
@@ -659,6 +664,7 @@ export default {
                 this.tempOrderIds.push({
                   key: `${index}_${rIndex}_${dIndex}`,
                   orderId: tpOrder.orderId,
+                  roomId: tpOrder.roomId,
                   data: tpOrder,
                   dayCount: dayCount,
                   livingCount: livingCount

+ 14 - 2
src/views/room/fangtailive.vue

@@ -2017,13 +2017,25 @@ export default {
           title: '提示',
           content: '确认要拆分房间?',
           onOk: function () {
+            let livingOrderId = row.livingData.livingOrder.id
+            let index = row.bookingData.releBookingRooms.findIndex(e => e.roomId === row.roomInfo.id)
+            console.log(row.bookingData.releBookingRooms[index].isMain)
+            if (row.bookingData.releBookingRooms[index].isMain) {
+              if (row.bookingData.releBookingRooms.length === 2) {
+                let index2 = row.bookingData.releBookingRooms.findIndex(e => e.roomId !== row.roomInfo.id)
+                livingOrderId = row.bookingData.releBookingRooms[index2].livingOrderId
+              } else {
+                that.$message.warning('请先变更主房间再拆分')
+                return
+              }
+            }
             // var index = that.model.livingRoomIds.findLastIndex(
             //   (t) => t.roomId == that.selectRoomId
             // );
             // var livingRoom = that.model.livingRoomIds[index];
             httpAction(
               'business/busRoomBookingOrders/split-living?livingOrderId=' +
-                row.livingData.livingOrder.id,
+                livingOrderId,
               {},
               'post'
             )
@@ -2032,7 +2044,7 @@ export default {
                   that.$message.success('拆分成功')
                   // that.getBookingOrderInfo();
                   // that.$emit("ok");
-                  this.loadData()
+                  that.loadData()
                 } else {
                   that.$message.warning(res.message)
                 }

+ 16 - 32
src/views/room/leasegoods.vue

@@ -176,15 +176,12 @@
           <span v-else>
             <template v-if="!record.revertDate">
               <a :disabled="editingKey !== ''" @click="edit(record.id)">编辑</a>
-
-              <a-divider
-                :disabled="editingKey !== ''"
-                type="vertical"
-              /></template>
+            </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="handleRevert(record.id, false)">归还</a>
+              <a-divider :disabled="editingKey !== ''" type="vertical" />
+              <a :disabled="editingKey !== ''" @click="handleRevert(record.id, true)">归还并退押金</a></template>
           </span>
 
         </template>
@@ -291,7 +288,7 @@ export default {
           dataIndex: 'action',
           align: 'center',
           fixed: 'right',
-          width: 147,
+          width: 187,
           scopedSlots: { customRender: 'action' }
         }
       ],
@@ -543,31 +540,18 @@ export default {
       this.queryParam.startTime = dateString[0]
       this.queryParam.endTime = dateString[1]
     },
-    handleRevert(id) {
+    handleRevert(id, returnDeposit) {
       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)
-        //     }
-        //   })
-        // }
+      this.loading = true
+      postAction('/order/cesOrderLeaseGoods/revert?returnDeposit=' + returnDeposit, { id: id }).then((res) => {
+        if (res.success) {
+          that.$message.success(res.message)
+          that.loadData()
+        } else {
+          that.$message.warning(res.message)
+        }
+      }).finally(() => {
+        this.loading = false
       })
     },
     initDictConfig() {},

File diff suppressed because it is too large
+ 340 - 328
src/views/room/modules/checkIn/BillRoomForm.vue


+ 84 - 63
src/views/room/modules/checkIn/BillRoomInfo.vue

@@ -15,27 +15,26 @@
           <div style="display: flex">
             <div
               style="display: flex; flex-direction: column"
-              v-if="chooseLivingRoom.livingOrder && chooseLivingRoom.livingOrder.settleType == -1 && !chooseLivingRoom.isMain"
+              v-if="chooseLivingRoom.livingOrder && chooseLivingRoom.livingOrder.settleType == -1 && !chooseLivingRoom.isMain && tabSelectRoomId !== 1"
               @click="changeMainRoom">
               <a-icon
                 type="clock-circle"
                 style="color: rgba(255, 141, 26, 1); font-size: 18px"/>
               <a-button type="link"> 改为主房 </a-button>
             </div>
-            <div style="display: flex; flex-direction: column">
+            <div style="display: flex; flex-direction: column" @click="puls()">
               <a-icon
                 type="clock-circle"
                 style="color: rgba(255, 141, 26, 1); font-size: 18px"
               /><a-button type="link"> 叫醒服务 </a-button>
             </div>
-            <div style="display: flex; flex-direction: column">
+            <div style="display: flex; flex-direction: column" @click="splitLiving">
               <a-icon
                 type="compass"
                 style="color: rgba(255, 141, 26, 1); font-size: 18px"
               /><a-button
                 type="link"
                 :disabled="selectRoomId == '1'"
-                @click="splitLiving"
               >
                 拆分房间
               </a-button>
@@ -220,20 +219,20 @@
                   />
                 </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"
+                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>
@@ -385,16 +384,16 @@
           </h4>
           <div style="display: flex">
             <div
-                @click="strikeBalance"
-                style="display: flex; flex-direction: column">
+              @click="strikeBalance"
+              style="display: flex; flex-direction: column">
               <a-icon
-                  type="pound"
-                  style="color: rgba(255, 141, 26, 1); font-size: 18px"
+                type="pound"
+                style="color: rgba(255, 141, 26, 1); font-size: 18px"
               /><a-button
                 type="link"
-            >
-              冲账
-            </a-button>
+              >
+                冲账
+              </a-button>
             </div>
             <div
               @click="addProjectFee"
@@ -427,15 +426,15 @@
         <a-tabs :v-model="active" @change="tabFeeChange" style="padding-top: 0px">
           <a-tab-pane tab="未结算" key="1" :forceRender="true">
             <a-table
-                :columns="columns"
-                :data-source="feesList"
-                :pagination="false"
-                :scroll="{ y: 160 }"
-                rowKey="id"
-                :rowSelection="{
-            consumSelectedRowKeys: consumSelectedRowKeys,
-            onChange: onSelectChange,
-          }"
+              :columns="columns"
+              :data-source="feesList"
+              :pagination="false"
+              :scroll="{ y: 160 }"
+              rowKey="id"
+              :rowSelection="{
+                consumSelectedRowKeys: consumSelectedRowKeys,
+                onChange: onSelectChange,
+              }"
             >
               <template slot="subjectType" slot-scope="text, record, index">
                 {{ getSubjectTypeText(text,record) }}
@@ -445,7 +444,7 @@
               </template>
             </a-table>
             <div
-                style="
+              style="
             color: rgba(255, 87, 51, 1);
             font-weight: 600;
             text-align: right;
@@ -456,11 +455,11 @@
           </a-tab-pane>
           <a-tab-pane tab="已结算" key="2">
             <a-table
-                :columns="columns"
-                :data-source="paidList"
-                :pagination="false"
-                :scroll="{ y: 160 }"
-                rowKey="id"
+              :columns="columns"
+              :data-source="paidList"
+              :pagination="false"
+              :scroll="{ y: 160 }"
+              rowKey="id"
             >
               <template slot="subjectType" slot-scope="text, record, index">
                 {{ getSubjectTypeText(text,record) }}
@@ -470,7 +469,7 @@
               </template>
             </a-table>
             <div
-                style="
+              style="
             color: rgba(255, 87, 51, 1);
             font-weight: 600;
             text-align: right;
@@ -481,11 +480,11 @@
           </a-tab-pane>
           <a-tab-pane tab="冲账单" key="3">
             <a-table
-                :columns="strikeColumns"
-                :data-source="strikeList"
-                :pagination="false"
-                :scroll="{ y: 160 }"
-                rowKey="id"
+              :columns="strikeColumns"
+              :data-source="strikeList"
+              :pagination="false"
+              :scroll="{ y: 160 }"
+              rowKey="id"
             >
               <template slot="subjectType" slot-scope="text, record, index">
                 {{ getSubjectTypeText(text,record) }}
@@ -495,7 +494,7 @@
               </template>
             </a-table>
             <div
-                style="
+              style="
             color: rgba(255, 87, 51, 1);
             font-weight: 600;
             text-align: right;
@@ -553,7 +552,7 @@
             {{ getPayTypeText(text) }}
           </template>
           <template slot="subjectType" slot-scope="text, record, index">
-            {{ getSubjectTypeText(record.subjectType) }}
+            {{ getSubjectTypeText(record.subjectType,record) }}
           </template>
         </a-table>
         <div
@@ -579,9 +578,9 @@
           </a-descriptions-item>
           <a-descriptions-item
             label="结账应退"
-            v-if="paymentAmount  - feesAmount > 0"
+            v-if="paymentAmount - feesAmount > 0"
           >
-            {{ (paymentAmount  - feesAmount).toFixed(2) }}
+            {{ (paymentAmount - feesAmount).toFixed(2) }}
           </a-descriptions-item>
           <a-descriptions-item label="结账应收" v-else>
             {{ (feesAmount - paymentAmount).toFixed(2) }}
@@ -612,7 +611,7 @@
     <refund-modal ref="modalRefundForm" @ok="modalFormOk"></refund-modal>
     <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>
+    <strike-balance-model ref="modalStrikeBalanceForm" @ok="modalFormOk"></strike-balance-model>
     <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
@@ -676,10 +675,12 @@
       <a-date-picker
         style="width: 120px; margin-left: 2px"
         placeholder="日期"
+        :default-value="wakeTime.date"
         @change="onChangeWakeService"
       />
       <a-time-picker
         style="width: 100px; margin-left: 2px"
+        :default-value="moment(wakeTime.time, 'HH:mm')"
         format="HH:mm"
         @change="onChangeWakeServiceTime"
       />
@@ -729,13 +730,13 @@ const columns = [
   {
     title: '入账日期',
     dataIndex: 'dayTime',
-    width: 110,
+    width: 180,
     align: 'center',
-    customRender: function (text, record) {
-      if (text !== null && text !== '') {
-        return record.dayTime.substring(0, 10)
-      }
-    }
+    // customRender: function (text, record) {
+    //   if (text !== null && text !== '') {
+    //     return record.dayTime.substring(0, 10)
+    //   }
+    // }
   },
   {
     title: '单价',
@@ -765,13 +766,13 @@ const columns = [
     title: '小计',
     align: 'center',
     dataIndex: 'originalMoney',
-    width: 67,
+    width: 67
   },
   {
     title: '优惠价',
     align: 'center',
     dataIndex: 'money',
-    width: 67,
+    width: 67
   }
 ]
 
@@ -1307,15 +1308,25 @@ export default {
         title: '提示',
         content: '确认要拆分房间?',
         onOk: function () {
+          if (that.model.livingRoomIds.length === 2){
+            that.$message.warning('不能拆分主房')
+            return
+          }
           var index = that.model.livingRoomIds.findLastIndex(
             (t) => t.roomId == that.selectRoomId
           )
           var livingRoom = that.model.livingRoomIds[index]
-          console.log(livingRoom)
-          debugger
+          console.log(that.model.livingRoomIds)
           if (livingRoom.isMain) {
-            this.$message.warning('不能拆分主房')
-            return
+            if (that.model.livingRoomIds.length > 2) {
+              that.$message.warning('请先变更主房间再拆分')
+              return
+            } else {
+              var index2 = that.model.livingRoomIds.findLastIndex(
+                  (t) => t.roomId !== that.selectRoomId
+              )
+              livingRoom = that.model.livingRoomIds[index2]
+            }
           }
           httpAction(
             'business/busRoomBookingOrders/split-living?livingOrderId=' +
@@ -1496,10 +1507,14 @@ export default {
       var find = this.model.livingRoomIds[index]
       return find ? find.roomName : ''
     },
-    getSubjectTypeText(text,record) {
+    getSubjectTypeText(text, record) {
       var msg = ''
       if (text == 1) {
         msg = '押金'
+        debugger
+        if (record.remark != null && record.remark != '') {
+          msg = record.remark
+        }
       } else if (text == 2) {
         msg = '预收房费'
       } else if (text == 3) {
@@ -1632,7 +1647,7 @@ export default {
           })
           livingRoomId.livingCustomers = list
           res.result.livingRoomIds.unshift(livingRoomId)
-          if (this.tabSelectRoomId == null || this.tabSelectRoomId === ''){
+          if (this.tabSelectRoomId == null || this.tabSelectRoomId === '') {
             this.tabSelectRoomId = this.roomId
                 ? this.roomId
                 : res.result.livingRoomIds[1].roomId
@@ -1680,7 +1695,7 @@ export default {
                 // 未支付的费用账单,oldfeesList用于存放所有费用账单,feesList为当前房间账单
                 this.strikeList = res.result.records
                 this.oldStrikeList = JSON.parse(JSON.stringify(this.strikeList))
-                console.log(this.strikeList,'123')
+                console.log(this.strikeList, '123')
                 this.tabChange(this.tabSelectRoomId)
               }
             }
@@ -1709,7 +1724,7 @@ export default {
           map.set(e.roomId, e.roomName)
         }
       })
-      let fees = JSON.parse(JSON.stringify(this.feesList));
+      let fees = JSON.parse(JSON.stringify(this.feesList))
       this.$refs.modalStrikeBalanceForm.edit(fees, map)
       this.$refs.modalStrikeBalanceForm.title = '冲账'
     },
@@ -1791,11 +1806,13 @@ export default {
           // this.$refs.modalPayOrRefundForm.isRefund = true
         }
         this.$refs.modalPayOrRefundForm.disableSubmit = false
-
       }
     },
     puls() {
       this.wakeService = true
+      this.wakeTime.id = this.chooseLivingRoom.livingOrder.id
+      this.wakeTime.date = moment(new Date()).add(1, 'days').format('YYYY-MM-DD')
+      this.wakeTime.time = '07:00'
       // this.wakeList.push({});
     },
     remove(index) {
@@ -1847,6 +1864,10 @@ export default {
       })
     },
     adjustPrice() {
+      if (this.model.livingRoomIds.some(e => moment(e.livingOrder.dueOutTime).format('yyyy-MM-DD') <= new Date().format('yyyy-MM-dd'))) {
+        this.$message.warning('当前时间已过预离时间,不能进行操作')
+        return
+      }
       let roomInfos = []
       if (this.selectRoomId === '1') {
         roomInfos = this.model.livingRoomIds.slice(1)

+ 4 - 7
src/views/room/modules/checkIn/BillRoomInfoModal.vue

@@ -13,9 +13,7 @@
         style="
           display: flex;
           background-color: rgba(255, 141, 26, 1);
-          height: 80px;
-        "
-      >
+          height: 80px;">
         <div class="menu" @click="adjustPrice">
           <a-icon
             type="account-book"
@@ -65,11 +63,10 @@
         <div class="menu">
           <a-icon
             type="container"
-            style="color: #fff; font-size: 30px"
-          /><a-button type="link"> 自定义账单 </a-button>
+            style="color: #fff; font-size: 30px"/>
+          <a-button type="link"> 自定义账单 </a-button>
         </div>
-      </div></template
-    >
+      </div></template>
     <bill-room-info ref="realForm" @ok="submitCallback" @changeLivingStatu="(e) =>{livingStatu = e}"></bill-room-info>
   </j-modal>
 </template>

+ 28 - 32
src/views/room/modules/checkIn/FeeForm.vue

@@ -5,46 +5,28 @@
             <a-row style="display:flex;justify-content:center;">
                 <a-col :span="12">
                     <a-form-model-item label="消费项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subjectType">
-                        <a-select v-model="model.subjectType" style="50%" placeholder="消费项目" :allowClear="true">
+                        <a-select v-model="model.subjectType"  placeholder="消费项目" :allowClear="true">
                             <a-select-option :value="6">商品</a-select-option>
                             <a-select-option :value="10">手工房费</a-select-option>
                             <a-select-option :value="11">水电煤抄表</a-select-option>
                             <a-select-option :value="12">赔偿费</a-select-option>
                         </a-select>
                     </a-form-model-item>
-                    <a-row>
-                        <a-col :span="24">
-                            <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" v-if="model.subjectType==6">
-                                <a-input-number :disabled="model.subjectType==6" v-model="goodsPrice" placeholder="请输入金额" :min="0"></a-input-number>
-                            </a-form-model-item>
-                            <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money" v-else>
-                                <a-input-number v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
-                            </a-form-model-item>
-                        </a-col>
-                    </a-row>
+                      <a-col :span="24">
+<!--                            <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" v-if="model.subjectType==6">-->
+<!--                                <a-input-number :disabled="model.subjectType==6" v-model="goodsPrice" placeholder="请输入金额" :min="0"></a-input-number>-->
+<!--                            </a-form-model-item>-->
+                          <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money" v-if="model.subjectType !== 6">
+                              <a-input-number v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
+                          </a-form-model-item>
+                      </a-col>
                 </a-col>
                 <a-col v-if="model.subjectType==6" :span="12">
-                    <a-row>
-                        <a-col :span="24">
-                            <a-space>
-                                <a-input v-model="queryParams.name" placeholder="名称" />
-                                <a-button @click="searchQuery" type="primary">搜索</a-button>
-                            </a-space>
-
-                        </a-col>
-                    </a-row>
-                    <a-table :columns="columns" :loading="loading" :dataSource="dataSource" style="margin-top:10px;">
-                        <template slot="sellingPrice" slot-scope="text, record">
-                            <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
-                        </template>
-                        <template slot="number" slot-scope="text, record">
-                            <a-input-number :max="record.inventory" v-model="record.number" @change="changeNumber" :min="0"></a-input-number>
-                        </template>
-                        <template slot="inventorySlot" slot-scope="text,record">
-                            {{record.inventory - record.number}}
-                        </template>
-                    </a-table>
-                </a-col>
+                <a-space>
+                  <a-input v-model="queryParams.name" placeholder="名称" />
+                  <a-button @click="searchQuery" type="primary">搜索</a-button>
+                </a-space>
+              </a-col>
             </a-row>
             <!-- <a-row>
                 <a-col :span="24">
@@ -53,7 +35,21 @@
                     </a-form-model-item>
                 </a-col>
             </a-row> -->
+          <a-row >
+            <a-table v-if="model.subjectType==6" :columns="columns" :loading="loading" :dataSource="dataSource" style="margin-top:10px;">
+              <template slot="sellingPrice" slot-scope="text, record">
+                <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
+              </template>
+              <template slot="number" slot-scope="text, record">
+                <a-input-number :max="record.inventory" v-model="record.number" @change="changeNumber" :min="0"></a-input-number>
+              </template>
+              <template slot="inventorySlot" slot-scope="text,record">
+                {{record.inventory - record.number}}
+              </template>
+            </a-table>
+          </a-row>
         </a-form-model>
+
     </j-form-container>
 </a-spin>
 </template>

+ 2 - 2
src/views/room/modules/checkIn/FeeModal.vue

@@ -23,7 +23,7 @@
     data () {
       return {
         title:'',
-        width:1200,
+        width:800,
         visible: false,
         disableSubmit: false,
         livingOrderId:''
@@ -58,4 +58,4 @@
       }
     }
   }
-</script>
+</script>

+ 161 - 156
src/views/room/modules/checkIn/Payment.vue

@@ -10,14 +10,14 @@
         <a-row>
           <a-col :span="24">
             <a-form-model-item
-              label="结账应收"
+              label="应收金额"
               :labelCol="labelCol"
               :wrapperCol="wrapperCol"
               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">
@@ -33,14 +33,15 @@
                   <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: 50px"
-                    v-model="model.discount"
-                    :min="1"
-                    :max="9"
-                  ></a-input-number
-                  >折
+                <template
+                  v-if="model.preferentialType === 3"
+                >打<a-input-number
+                  style="width: 50px"
+                  v-model="model.discount"
+                  :min="1"
+                  :max="9"
+                ></a-input-number
+                >折
                 </template>
               </a-form-model-item>
             </a-col>
@@ -87,7 +88,7 @@
                     :value="couponItem.id"
                     v-for="couponItem in memeberCouponList"
                     :key="couponItem.id"
-                    >{{ couponItem.couponsName }}</a-select-option
+                  >{{ couponItem.couponsName }}</a-select-option
                   >
                 </a-select>
                 <a-switch v-model="model.couponCard" />使用优惠券
@@ -146,7 +147,7 @@
                       style="color: #f56c6c"
                       class="dynamic-delete-button"
                       @click="() => remove(index)"
-                  /></a-col>
+                    /></a-col>
                 </a-row>
 
                 <a-row type="flex" v-if="item.isVipMemmber">
@@ -197,23 +198,23 @@
 </template>
 
 <script>
-import { httpAction, getAction } from "@/api/manage";
-import { validateDuplicateValue } from "@/utils/util";
+import { httpAction, getAction } 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
     },
     showYinshou: {
       type: Boolean,
       default: true
-    },
+    }
   },
   data() {
     return {
@@ -224,15 +225,15 @@ export default {
         couponType: 1,
         couponFirstAmount: 0,
         billAmount: 0,
-        selectedFeeIds: [],
+        selectedFeeIds: []
       },
       labelCol: {
         xs: { span: 24 },
-        sm: { span: 5 },
+        sm: { span: 5 }
       },
       wrapperCol: {
         xs: { span: 24 },
-        sm: { span: 16 },
+        sm: { span: 16 }
       },
       confirmLoading: false,
       validatorRules: {
@@ -240,22 +241,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: [],
@@ -270,52 +271,52 @@ export default {
       payList: [],
       memeberCouponList: [],
       agreementUnitData: {},
-      copyRealityAmount: '',
-    };
+      copyRealityAmount: ''
+    }
   },
   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() {
       let result = this.couponAmount
       if (this.model.couponCard) {
         var find = this.memeberCouponList.find(
           (t) => t.id == this.model.couponId
-        );
+        )
         if (find) {
-          result = 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;
+          result = this.couponAmount - find.cost
         }
         if (this.payList && this.payList.length > 0 && this.copyRealityAmount != result) {
           this.payList = [this.payList[0]]
@@ -324,16 +325,16 @@ export default {
         this.copyRealityAmount = result
       }
       this.$forceUpdate()
-      return result;
-    },
+      return result
+    }
   },
   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));
+    // 备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model))
     // getAction("/business/busRoomPayType/list", {
     //   pageSize: 99999,
     //   pageNo: 1,
@@ -345,22 +346,22 @@ export default {
   },
   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) {
             if (
               !this.model.vipCustomerId ||
               this.model.vipCustomerId.length == 0
             ) {
               var index = this.payTypeList.findIndex((t) =>
-                t.name.includes("会员")
-              );
+                t.name.includes('会员')
+              )
               if (index >= 0) {
-                this.payTypeList[index].delFlag = 99;
+                this.payTypeList[index].delFlag = 99
               }
             }
             if (
@@ -370,134 +371,136 @@ export default {
               this.model.contractTeamProtocolId.length == 0
             ) {
               var index = this.payTypeList.findIndex((t) =>
-                t.name.includes("单位")
-              );
+                t.name.includes('单位')
+              )
               if (index >= 0) {
-                this.payTypeList[index].delFlag = 99;
+                this.payTypeList[index].delFlag = 99
               }
             }
-            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,
-                isDanwei: false,
-              },
-            ];
+                isDanwei: false
+              }
+            ]
           }
         }
-      });
+      })
     },
     puls() {
       var sum = this.payList.reduce(function (total, item) {
-        return total + item.money;
-      }, 0);
-      var money = this.realityAmount - sum;
+        return total + item.money
+      }, 0)
+      var money = this.realityAmount - sum
       if (money < 0) {
-        money = 0;
+        money = 0
       }
       this.payList.push({
         money: money,
         payType: this.payTypeList[0].id,
         isVipMemmber: false,
-        isDanwei: false,
-      });
+        isDanwei: false
+      })
     },
     remove(index) {
-      this.payList.splice(index, 1);
+      this.payList.splice(index, 1)
     },
     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.includes("会员");
-      value.isDanwei = find && find.name.includes("单位");
+      console.log('value', value)
+      console.log('e', e)
+      var find = this.payTypeList.find((t) => t.id == value.payType)
+      value.isVipMemmber = find && find.name.includes('会员')
+      value.isDanwei = find && find.name.includes('单位')
     },
     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) {
-      let data = Object.assign({}, record);
+      let data = Object.assign({}, record)
       this.model = JSON.parse(JSON.stringify(data))
       if (record.preferentialMoney !== 0 && record.preferentialMoney !== null) {
         this.model.preferentialType = 2
-        this.model.couponFirstAmount = record.preferentialMoney;
+        this.model.couponFirstAmount = record.preferentialMoney
+      }
+      this.getbusRoomPayType()
+      if (record.bookingYj != null) {
+        return
       }
-      this.getbusRoomPayType();
       if (this.model.vipCustomerId) {
-        this.getMemeberCouponList();
+        this.getMemeberCouponList()
       }
       if (this.model.vipCustomerId) {
-        getAction("/business/busMemberCard/list", {
-          id: this.model.vipCustomerId,
+        getAction('/business/busMemberCard/list', {
+          id: this.model.vipCustomerId
         }).then((res) => {
           if (res.success) {
             if (res.result.records && res.result.records.length > 0) {
-              this.memberCard = res.result.records[0];
+              this.memberCard = res.result.records[0]
             }
           }
-        });
+        })
       }
       if (this.model.contractTeamId && this.model.contractTeamProtocolId) {
-        getAction("/business/busMarketAgreementUnit/list", {
-          id: this.model.contractTeamId,
+        getAction('/business/busMarketAgreementUnit/list', {
+          id: this.model.contractTeamId
         }).then((res) => {
           if (res.success) {
-            var list = res.result.records;
+            var list = res.result.records
             if (list.length > 0) {
-              this.agreementUnitData = list[0];
-              getAction("/business/busMarketAgreementCustomer/list", {
-                agreementId: this.model.contractTeamId,
+              this.agreementUnitData = list[0]
+              getAction('/business/busMarketAgreementCustomer/list', {
+                agreementId: this.model.contractTeamId
               }).then((res2) => {
                 if (res2.success) {
-                  var list2 = res2.result.records;
+                  var list2 = res2.result.records
                   if (list2 && list2.length > 0) {
                     this.danwei = list2.find(
                       (t) => t.id == this.model.contractTeamProtocolId
-                    );
+                    )
                   }
                 }
-              });
+              })
             }
           }
-        });
+        })
       }
       // this.visible = true;
     },
     submitForm() {
-      debugger
-      const that = this;
+      const that = this
       // 触发表单验证
       this.$refs.form.validate((valid) => {
         if (valid) {
@@ -507,87 +510,89 @@ export default {
             return
           }
           if (this.realityAmount !== this.sumAmount) {
-            that.$message.warning('实收金额和实收合计必须相等');
-            return;
+            that.$message.warning('实收金额和实收合计必须相等')
+            return
           }
-          var obj = {};
-          var fees = [];
+          var obj = {}
+          var fees = []
+          console.log(this.model)
+          console.log(this.model.subjectType)
+          debugger
           if (this.model.coupon) {
             fees.push({
               feeType: this.model.feeType,
               preferentialType: this.model.preferentialType,
               money: this.couponAmount.toFixed(2) - this.model.billAmount.toFixed(2),
-              custorerOrderRemark: "优惠金额",
-              isPreferential: true,
-            });
+              custorerOrderRemark: '优惠金额',
+              isPreferential: true
+            })
           }
           if (this.model.couponCard && this.model.couponId) {
             var find = this.memeberCouponList.find(
               (t) => t.id == this.model.couponId
-            );
+            )
             if (find) {
               fees.push({
                 feeType: this.model.feeType,
                 money: find.cost.toFixed(2),
-                custorerOrderRemark: "优惠券",
-                isPreferential: true,
-              });
+                custorerOrderRemark: '优惠券',
+                isPreferential: true
+              })
             }
           }
+          let remark = this.model.bookingYj ? '预约押金' : '结账退房'
           this.payList.forEach((item) => {
             fees.push({
               feeType: this.model.feeType,
+              bookingYj: this.model.bookingYj,
+              subjectType: this.model.subjectType,
               money: item.money.toFixed(2),
               payType: item.payType,
-              custorerOrderRemark: "结账退房",
+              remark: remark,
               isPreferential: this.model.isPreferential,
               preferentialMoney: this.model.preferentialMoney
-            });
-          });
+            })
+          })
 
-          that.confirmLoading = true;
-          var url =
-            "/business/busRoomBookingOrders/settle-checkout?bookingOrderId=" +
-            this.model.bookingOrderId;
+          that.confirmLoading = true
+          var url = '/business/busRoomBookingOrders/settle-checkout?bookingOrderId=' + this.model.bookingOrderId
           if (this.model.livingOrderId) {
-            url =
-              "/business/busRoomBookingOrders/living-settle-checkout?livingOrderId=" +
-              this.model.livingOrderId;
+            url = '/business/busRoomBookingOrders/living-settle-checkout?livingOrderId=' + this.model.livingOrderId
           }
-          if (
-            this.model.selectedFeeIds &&
-            this.model.selectedFeeIds.length > 0
-          ) {
-            url = "/business/busRoomBookingOrders/partial-settle";
+          if (this.model.selectedFeeIds && this.model.selectedFeeIds.length > 0) {
+            url = '/business/busRoomBookingOrders/partial-settle'
             obj = {
               fees: fees,
               livingOrderId: this.model.livingOrderId,
-              selectedFeeIds: this.model.selectedFeeIds,
-            };
+              selectedFeeIds: this.model.selectedFeeIds
+            }
+          }
+          if (this.model.bookingYj) {
+            url = '/business/busOrderFee/saveBookingDeposit'
           }
           httpAction(
             url,
             this.model.selectedFeeIds && this.model.selectedFeeIds.length > 0
               ? obj
               : fees,
-            "post"
+            'post'
           )
             .then((res) => {
               if (res.success) {
-                that.$message.success("结账成功");
-                that.$emit("ok");
+                that.$message.success('结账成功')
+                that.$emit('ok', res.result)
               } else {
-                that.$message.warning(res.message);
+                that.$message.warning(res.message)
               }
             })
             .finally(() => {
-              that.confirmLoading = false;
-            });
+              that.confirmLoading = false
+            })
         }
-      });
-    },
-  },
-};
+      })
+    }
+  }
+}
 </script>
 <style scoped>
 .dynamic-delete-button {

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

@@ -55,8 +55,8 @@ export default {
       debugger
       this.$refs.realForm.submitForm();
     },
-    submitCallback() {
-      this.$emit("ok");
+    submitCallback(e) {
+      this.$emit("ok", e);
       this.visible = false;
     },
     handleCancel() {

+ 6 - 5
src/views/room/modules/checkIn/SelectRoomForm.vue

@@ -309,11 +309,11 @@ export default {
 
     checkChange(e, stateList) {
             console.log('e', e)
-            var list = this.oldroomList
+            var list = JSON.parse(JSON.stringify(this.oldroomList))
             console.log(list)
             debugger
             if (this.checkLayoutList.length > 0) {
-              this.roomList = this.oldroomList.reduce((acc, curr) => {
+              list = list.reduce((acc, curr) => {
                     const floorRooms = curr.floorRooms.filter((room) =>
                         this.checkLayoutList.includes(room.layoutId)
                     )
@@ -325,7 +325,7 @@ export default {
                 }, [])
             }
             if (this.checkedRoomStatusList.length > 0) {
-              this.roomList = list.reduce((acc, curr) => {
+              list = list.reduce((acc, curr) => {
                     const floorRooms = curr.floorRooms.filter((room) =>
                         this.checkedRoomStatusList.includes(
                             room.roomStatus.toString()
@@ -342,7 +342,7 @@ export default {
               this.roomStatusOptions.forEach(ele => {
                 arr.push(ele.value)
               })
-              this.roomList = list.reduce((acc, curr) => {
+              list = list.reduce((acc, curr) => {
                   const floorRooms = curr.floorRooms.filter((room) =>
                       arr.includes(
                           room.roomStatus.toString()
@@ -356,7 +356,7 @@ export default {
               }, [])
             }
             if (stateList && stateList.length > 0) {
-              this.roomList = list.reduce((acc, curr) => {
+              list = list.reduce((acc, curr) => {
                     const floorRooms = curr.floorRooms.filter((room) =>
                         stateList.includes(room.roomStatus.toString())
                     )
@@ -367,6 +367,7 @@ export default {
                     return acc
                 }, [])
             }
+            this.roomList = list
         },
 
     checkRoomClick(row) {

+ 467 - 402
src/views/room/modules/fangtaiModal/continuedModal/continuedForm.vue

@@ -1,435 +1,500 @@
 <template>
-<a-spin :spinning="confirmLoading">
+  <a-spin :spinning="confirmLoading">
     <a-tabs default-active-key="1" @change="callback">
-        <a-tab-pane key="1" tab="操作">
-            <j-form-container :disabled="formDisabled">
-                <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
-                    <a-row>
-                        <a-col :span="24">
-                            <a-form-model-item label="续住总价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" >
-                                <!-- <a-input v-model="model.name" placeholder="请输入餐桌名称"></a-input> -->
-                                {{PriceData.reduce((pre,cur)=> pre+cur.price*1,0 ) || 0}}
-                                <a-popover placement="right" v-if="dayNum>0">
-                                    <template slot="content">
-                                        <div style="max-height:400px;overflow:auto;width:100%;">
-                                            <div v-for="(item, index) in PriceData" :key="index">
-                                                {{item.day}}
-                                                <a-input-number :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>
-                                    </template>
-                                    <a-icon type="edit" />
-                                </a-popover>
-                                <template v-else>
-                                    <a-icon type="edit" />
-                                </template>
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="入住时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                {{ model.livingData && model.livingData.livingOrder && model.livingData.livingOrder.arrivalTime || ''}}
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="预离时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                {{ model.livingData && model.livingData.livingOrder && model.livingData.livingOrder.dueOutTime || ''}}
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="预离变更" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <!-- <a-select v-model="model.posRegionId" placeholder="请选择pos类型">
-                                    <a-select-option :value="item.id" v-for="item in regionList" :key="item.id">
-                                        {{ item.name }}
-                                    </a-select-option>
-                                </a-select> -->
-                                <a-date-picker :disabled-date="disabledStartDate" v-model="model.startValue" show-time format="YYYY-MM-DD HH:mm:ss" :placeholder=" model.livingData && model.livingData.livingOrder && model.livingData.livingOrder.dueOutTime" @change="handleStartOpenChange" />
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="续住天数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" v-if="isAddDate">
-                                <a-input-number :min="0" v-model="dayNum" placeholder="请输入续住天数" style="width: 40%" @change="dayChange" />
-                            </a-form-model-item>
-                          <a-form-model-item label="退租天数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" v-if="!isAddDate">
-                            <a-input-number :min="0" v-model="dayNum" placeholder="请输退租住天数" style="width: 40%" @change="dayChange" />
-                          </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="收款方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <a-select v-model="model.payType" placeholder="收款方式" style="width: 40%">
-                                    <a-select-option :value="item.id" v-for="item in payTypeList" :key="item.id">
-                                        {{ item.name }}
-                                    </a-select-option>
-                                </a-select>
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
-                                <a-input-number v-model="model.num" placeholder="请输入金额" style="width: 40%" />
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <!-- <a-input-number v-model="model.num" placeholder="请输入座位数" style="width: 100%" /> -->
-                                <a-input v-model="model.remarks"></a-input>
-                            </a-form-model-item>
-                        </a-col>
-                    </a-row>
-                </a-form-model>
-            </j-form-container>
-        </a-tab-pane>
-        <!-- <a-tab-pane key="2" tab="续住记录"></a-tab-pane> -->
+      <!-- <a-tab-pane key="2" tab="续住记录"></a-tab-pane> -->
+      <a-tab-pane key="1" tab="操作">
+        <a-row>
+          <a-form-model style="margin-bottom: 10px ;">
+            <a-col :span="24">
+              <a-form-model-item style="margin-bottom: 10px" :labelCol="labelCol" :wrapperCol="wrapperCol" >
+                <a-radio-group v-model="model.batchWay" @change="batchWayChange">
+                  <a-radio :value="1">按天数</a-radio>
+                  <a-input-number v-model="model.batchDay" style="margin-right: 30px" @change="batchChangeDay"></a-input-number>
+                  <a-radio :value="2">按预离时间</a-radio>
+                  <a-date-picker
+                      v-model="model.batchTime"
+                      :disabled-date="disabledDate"
+                      show-time
+                      format="YYYY-MM-DD HH:mm:ss"
+                      @change="batchChangeTime" />
+                </a-radio-group>
+              </a-form-model-item>
+            </a-col>
+            <!--            <a-col :span="12">-->
+            <!--              <a-button @click="batchChangeDay" type="primary" style="float: right; margin-right: 20px">批量续住</a-button>-->
+            <!--            </a-col>-->
+          </a-form-model>
+
+          <a-col :span="24">
+            <a-table
+                ref="table"
+                size="middle"
+                height="450px"
+                overflow-y="scroll"
+                bordered
+                rowKey="id"
+                :columns="columns"
+                :dataSource="tableData"
+                :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
+              <template slot="newDueOutTime" slot-scope="text, record, index">
+                <a-date-picker
+                    v-model="record.newDueOutTime"
+                    :disabled-date="disabledDate"
+                    show-time
+                    format="YYYY-MM-DD HH:mm:ss"
+                    @change="timeChange(record)"/>
+              </template>
+              <!-- 续住天数-->
+              <template slot="dayNum" slot-scope="text, record, index">
+                <a-input-number  v-model="record.dayNum" placeholder="请输入续住天数" style="width: 90%" @change="dayChange(record)" />
+              </template>
+              <!-- 支付方式-->
+              <template slot="payType" slot-scope="text, record, index">
+                <a-select style="width: 100px" v-model="record.payType" :disabled="record.dayNum < 0">
+                  <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="payMoney" slot-scope="text, record, index">
+                <a-input-number  :min="0" v-model="record.payMoney" style="width: 80%" :disabled="record.dayNum <= 0"/>
+              </template>
+              <template slot="breakfastNum" slot-scope="text, record, index">
+                <a-input-number  :min="0" v-model="record.breakfastNum" style="width: 80%"/>
+              </template>
+              <!-- 总费用-->
+              <template slot="allMoney" slot-scope="text, record, index">
+                <a>{{record.layoutDayPriceList.reduce((pre,cur)=> pre+cur.price*1,0 ) || 0}}</a>
+                <a-popover placement="right" v-if="record.dayNum>0">
+                  <template slot="content">
+                    <div style="max-height:400px;overflow:auto;width:100%;">
+                      <div v-for="(item, index) in record.layoutDayPriceList" :key="index">
+                        {{item.dayTime}}
+                        <a-input-number :min="0" v-model="item.price"></a-input-number>
+                      </div>
+                    </div>
+                  </template>
+                  <template slot="title">
+                    <a-input-number :min="0" @change="batchPrice($event,record)" placeholder="批量改价"></a-input-number>
+                  </template>
+                  <a-icon type="edit" />
+                </a-popover>
+              </template>
+            </a-table>
+          </a-col>
+          <a-col :span="24" style="text-align: end">
+            <a-checkbox style="margin-top: 20px; margin-right: 10px" default-checked>打印续住单</a-checkbox>
+          </a-col>
+        </a-row>
+      </a-tab-pane>
     </a-tabs>
 
-</a-spin>
+  </a-spin>
 </template>
 
 <script>
 import {
-    httpAction,
-    getAction
-} from "@/api/manage";
+  httpAction,
+  getAction, postAction
+} from '@/api/manage'
 import {
   formatDate,
   validateDuplicateValue
 } from '@/utils/util'
 import moment from 'moment/moment'
 
+const columns = [
+  {
+    title: '房间号',
+    dataIndex: 'roomName',
+    width: 80,
+    align: 'center',
+    // scopedSlots: { customRender: 'roomId' }
+  },
+  {
+    title: '姓名',
+    dataIndex: 'customerName',
+    width: 80,
+    align: 'center',
+    // scopedSlots: { customRender: 'roomId' }
+  },
+  {
+    title: '原预离时间',
+    dataIndex: 'dueOutTime',
+    width: 120,
+    align: 'center',
+  },
+  {
+    title: '续住天数',
+    // dataIndex: 'dayNum',
+    width: 80,
+    align: 'center',
+    scopedSlots: { customRender: 'dayNum' }
+  },
+  {
+    title: '收款方式',
+    // dataIndex: 'dayNum',
+    width: 80,
+    align: 'center',
+    scopedSlots: { customRender: 'payType' }
+  },
+  {
+    title: '支付金额',
+    // dataIndex: 'dayNum',
+    width: 90,
+    align: 'center',
+    scopedSlots: { customRender: 'payMoney' }
+  },
+  {
+    title: '早餐券',
+    width: 80,
+    align: 'center',
+    scopedSlots: { customRender: 'breakfastNum' }
+  },
+  {
+    title: '新预离时间',
+    width: 80,
+    align: 'center',
+    scopedSlots: { customRender: 'newDueOutTime' }
+  },
+  {
+    title: '合计房价',
+    width: 80,
+    align: 'center',
+    scopedSlots: { customRender: 'allMoney' }
+  },
+]
+const date = new Date()
+const endDate = new Date(date.setDate(date.getDate() + 1))
 export default {
-    name: "PosTableForm",
-    components: {},
-    props: {
-        //表单禁用
-        disabled: {
-            type: Boolean,
-            default: false,
-            required: false,
-        },
-    },
-    data() {
-        return {
-            model: {
-                day: 0
-            },
-            labelCol: {
-                xs: {
-                    span: 24
-                },
-                sm: {
-                    span: 5
-                },
-            },
-            wrapperCol: {
-                xs: {
-                    span: 24
-                },
-                sm: {
-                    span: 16
-                },
-            },
-            confirmLoading: false,
-            validatorRules: {
-                tenantId: [{
-                    required: true,
-                    message: "请输入关联租户!"
-                }],
-                hotelId: [{
-                    required: true,
-                    message: "请输入关联酒店!"
-                }],
-                name: [{
-                    required: true,
-                    message: "请输入餐桌名称!"
-                }],
-                posTypeId: [{
-                    required: true,
-                    message: "请输入pos类型id!"
-                }],
-                posTableTypeId: [{
-                    required: true,
-                    message: "请输入pos桌型id!"
-                }],
-                posRegionId: [{
-                    required: true,
-                    message: "请输入pos餐桌区域id!"
-                }],
-                tableNo: [{
-                    required: true,
-                    message: "请输入餐桌序号!"
-                }],
-                state: [{
-                    required: true,
-                    message: "请输入状态!"
-                }],
-            },
-            url: {
-                add: "/pos/posTable/add",
-                edit: "/pos/posTable/edit",
-                queryById: "/pos/posTable/queryById",
-            },
-            payTypeList: [],
-            tableTypeList: [],
-            regionList: [],
-            PriceData: [],
-            dayNum:0,
-            isAddDate: true
-        };
+  name: "ContinuedForm",
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
     },
-    watch:{
-        dayNum(val){
-            let arr = [];
-            console.log(this.dayNum);
-            if (this.dayNum && this.dayNum > 0) {
-                arr.length = this.dayNum;
-                for (let i = 0; i < arr.length; i++) {
-                    arr[i] = {
-                        day: this.addDate(this.model.livingData.livingOrder.dueOutTime, i),
-                        price: this.model.layout.marketPrice,
-                    };
-                }
-                this.PriceData = arr;
-            } else {
-                return [];
-            }
-        }
-    },
-    computed: {
-        formDisabled() {
-            return this.disabled;
+  },
+  data() {
+    return {
+      model: {
+        day: 0,
+        batchDay: 1,
+        batchTime: moment(endDate).format('yyyy-MM-DD') + ' 13:00',
+        batchWay: 1
+      },
+      labelCol: {
+        xs: {
+          span: 24
         },
-        dayDataArr() {
-            let arr = [];
-            console.log(this.dayNum);
-            if (this.dayNum && this.dayNum > 0) {
-                arr.length = this.dayNum;
-                for (let i = 0; i < arr.length; i++) {
-                    arr[i] = {
-                        day: this.addDate(this.model.livingData.livingOrder.dueOutTime, i),
-                        price: this.model.layout.marketPrice,
-                    };
-                }
-                this.PriceData = arr;
-            } else {
-                return [];
-            }
+        sm: {
+          span: 5
+        },
+      },
+      wrapperCol: {
+        xs: {
+          span: 24
+        },
+        sm: {
+          span: 16
+        },
+      },
+      confirmLoading: false,
 
-            return arr;
+      payTypeList: [],
+      tableTypeList: [],
+      regionList: [],
+      PriceData: [],
+      isAddDate: true,
+      payList: [],
+      columns: columns,
+      tableData: [],
+      selectedRowKeys: [],
+      selectionRows: [],
+    };
+  },
+
+  computed: {
+    // dayDataArr() {
+    //   let arr = [];
+    //   console.log(this.dayNum);
+    //   if (this.dayNum && this.dayNum > 0) {
+    //     arr.length = this.dayNum;
+    //     for (let i = 0; i < arr.length; i++) {
+    //       arr[i] = {
+    //         day: this.addDate(this.model.livingData.livingOrder.dueOutTime, i),
+    //         price: this.model.layout.marketPrice,
+    //       };
+    //     }
+    //     this.PriceData = arr;
+    //   } else {
+    //     return [];
+    //   }
+    //
+    //   return arr;
+    // }
+  },
+  created() {
+    var _info = JSON.parse(localStorage.getItem("storeInfo"));
+    if (_info) {
+      this.model.hotelId = _info.id;
+    }
+    //备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    getAction('/business/busRoomPayType/list', {
+      pageSize: 99999,
+      pageNo: 1,
+    }).then((res) => {
+      if (res.success) {
+        this.payTypeList = res.result.records;
+        this.loadDate()
+      }
+    });
+  },
+  methods: {
+    loadDate() {
+      getAction('/business/busRoomBookingOrders/get-continue-order', { bookingOrderId: this.model.bookingOrderId }).then(resp => {
+        if (resp.success) {
+          var vipIndex = this.payTypeList.findIndex((t) => t.name.includes('会员'))
+          var danweiIndex = this.payTypeList.findIndex((t) => t.name.includes('单位'))
+          this.tableData = resp.result
+          this.tableData.forEach(e => {
+            e.newDueOutTime = e.dueOutTime
+            e.dayNum = 0
+            e.layoutDayPriceList = []
+            e.payMoney = 0
+            let payTypeList = JSON.parse(JSON.stringify(this.payTypeList))
+            this.$set(payTypeList[vipIndex], 'disable', e.vipCustomerId == null || e.vipCustomerId === '')
+            this.$set(payTypeList[danweiIndex], 'disable', e.contractTeamId == null || e.contractTeamId === '')
+            this.$set(e, 'payTypeList', payTypeList)
+            if (e.id === this.model.livingOrderId) {
+              this.selectedRowKeys.push(e.id)
+              this.selectionRows.push(e)
+              e.dayNum = 1
+              this.dayChange(e)
+            }
+          })
         }
+      })
     },
-    created() {
-        var _info = JSON.parse(localStorage.getItem("storeInfo"));
-        if (_info) {
-            this.model.hotelId = _info.id;
+    disabledDate(current) {
+      return current && current < moment().add(-1, 'days').endOf('day')
+    },
+    onSelectChange(selectedRowKeys, selectionRows) {
+      console.log(selectedRowKeys, selectionRows)
+      this.selectedRowKeys = selectedRowKeys
+      this.selectionRows = selectionRows
+    },
+    changePriceData(record){
+      let arr = [];
+      console.log(record.dayNum);
+      if (record.dayNum && record.dayNum > 0) {
+        arr.length = record.dayNum;
+        for (let i = 0; i < arr.length; i++) {
+          arr[i] = {
+            dayTime: this.addDate(record.dueOutTime, i),
+            price: record.roomLayout.marketPrice,
+            roomLayoutId: record.roomLayout.id,
+            roomId: record.roomId,
+            livingOrderId: record.id
+          };
         }
-        //备份model原始值
-        this.modelDefault = JSON.parse(JSON.stringify(this.model));
-        // getAction("/pos/posType/list", {
-        //     hotelId: _info.id,
-        //     pageNo: 1,
-        //     pageSize: 100,
-        // }).then((res) => {
-        //     if (res.success) {
-        //         this.posTypeList = res.result.records;
-        //     }
-        // });
-        // getAction("/pos/posTableType/list", {
-        //     hotelId: _info.id,
-        //     pageNo: 1,
-        //     pageSize: 100,
-        // }).then((res) => {
-        //     if (res.success) {
-        //         this.tableTypeList = res.result.records;
-        //     }
-        // });
-        // getAction("/pos/posRegion/list", {
-        //     hotelId: _info.id,
-        //     pageNo: 1,
-        //     pageSize: 100,
-        // }).then((res) => {
-        //     if (res.success) {
-        //         this.regionList = res.result.records;
-        //     }
-        // });
-        getAction("/business/busRoomPayType/list", {
-            pageSize: 99999,
-            pageNo: 1,
-        }).then((res) => {
-            if (res.success) {
-              debugger
-              this.payTypeList = res.result.records;
-              console.log(this.model)
-              if (this.model.livingData.livingOrder.vipCustomerId && this.model.livingData.livingOrder.vipCustomerId !== null) {
-                console.log(this.payTypeList)
-                var findPayType = this.payTypeList.find((e) => e.name === '会员卡')
-                this.$set(this.model, "payType", findPayType.id)
-                this.model.payType = findPayType.id
-              }
-            }
-        });
+        record.layoutDayPriceList = arr;
+      } else {
+        record.layoutDayPriceList = [];
+      }
+    },
+    // 批量修改的方式改变
+    batchWayChange() {
+      this.batchChangeDay()
+      this.batchChangeTime()
+    },
+    // 批量修改勾选的预离天数
+    batchChangeDay() {
+      if (this.model.batchWay === 1) {
+        this.selectionRows.forEach(e => {
+          e.dayNum = this.model.batchDay
+          this.dayChange(e)
+        })
+        this.$forceUpdate()
+      }
+    },
+    // 批量修改勾选的预离时间
+    batchChangeTime() {
+      if (this.model.batchWay === 2) {
+        this.selectionRows.forEach(e => {
+          e.newDueOutTime = this.model.batchTime
+          this.timeChange(e)
+        })
+        this.$forceUpdate()
+      }
+    },
+    // 预离日期改变
+    timeChange(record) {
+      let nowDate = new Date()
+      if (record.newDueOutTime.batchTime < nowDate) {
+        this.$message.warning('退租时间不能小于当前时间')
+        return
+      }
+      record.dayNum = this.daysBetween(record.dueOutTime, record.newDueOutTime)
+      this.changePriceData(record)
+      // this.model.startValue = e._i;
+      this.$forceUpdate()
+    },
+    // 预离天数改变
+    dayChange(record) {
+      // if (!this.isAddDate) {
+      //   record.dayNum = -record.dayNum
+      // }
+      let newTime = this.addDate(record.dueOutTime, record.dayNum)
+      if (record.dayNum < 0 && moment(newTime) < moment(endDate.format('yyyy-MM-dd'))) {
+        record.dayNum = 1
+        this.dayChange(record)
+        this.$message.warning('预离时间不能晚于当前时间')
+        return
+      }
+      record.newDueOutTime = newTime
+      console.log(record)
+      this.changePriceData(record)
+      this.$forceUpdate()
     },
-    methods: {
-        /**
-         * 根据传入的数字将日期加上对应的天数
-         * @param {String} date 日期
-         * @param {Number} days 天数
-         * @return {String} 返回日期
-         */
-        addDate(date, days) {
-            console.log(date, days);
-            let time = new Date(date);
-            time.setDate(time.getDate() + days);
-            let m = time.getMonth() + 1;
-            let d = time.getDate();
-            if (m < 10) {
-                m = "0" + m;
-            }
-            if (d < 10) {
-                d = "0" + d;
-            }
-            return time.getFullYear() + '-' + m + '-' + d + ' ' + time.getHours() + ':' + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ':' + (time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds())
-        },
-
-        //计算两个日期之间相隔多少天
-        daysBetween(date1, date2) {
-            const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
-            const firstDate = new Date(date1);
-            const secondDate = new Date(date2);
-          const diffDays = (secondDate - firstDate) / oneDay;
-          this.isAddDate = diffDays >= 0;
-          if (Math.round(diffDays) <= 0) {
-            debugger
-            this.PriceData = []
-          }
-          return Math.round(Math.abs(diffDays));
-        },
-        batchPrice(e){
-            console.log(e);
-            this.PriceData.forEach(item => {
-                item.price = e;
-            })
-        },
 
-        add() {
-            this.edit(this.modelDefault);
-        },
-        edit(record) {
-            this.model = Object.assign({}, record)
-            // this.model.startValue = record.livingData.livingOrder.dueOutTime
-            this.visible = true
-        },
+    /**
+     * 根据传入的数字将日期加上对应的天数
+     * @param {String} date 日期
+     * @param {Number} days 天数
+     * @return {String} 返回日期
+     */
+    addDate(date, days) {
+      console.log(date, days);
+      let time = new Date(date);
+      time.setDate(time.getDate() + days);
+      let m = time.getMonth() + 1;
+      let d = time.getDate();
+      if (m < 10) {
+        m = "0" + m;
+      }
+      if (d < 10) {
+        d = "0" + d;
+      }
+      return time.getFullYear() + '-' + m + '-' + d + ' ' + time.getHours() + ':' + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ':' + (time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds())
+    },
 
-        chooseVipPay() {
-        },
-        submitForm() {
-            const that = this;
-            // 触发表单验证
-            this.$refs.form.validate((valid) => {
-                if (valid) {
-                    let httpurl = "";
-                    let method = "";
-                    // if (!this.model.id) {
-                    //     httpurl += this.url.add;
-                    //     method = "post";
-                    // } else {
-                    //     httpurl += this.url.edit;
-                    //     method = "put";
-                    // }
-                    let obj = {
-                        // livingOrderId:this.model.roomInfo.livingOrderId,
-                        payType:this.model.payType,
-                        remark:this.model.remarks,
-                        roomId:this.model.roomInfo.id,
-                        money:this.model.num,
-                        prices:this.PriceData.map(item=>({
-                            livingOrderId:this.model.roomInfo.livingOrderId,
-                            dayTime:item.day,
-                            price:item.price,
-                        }))
-                    }
-                  if (typeof (this.model.startValue) === 'undefined') {
-                    this.model.startValue = this.model.livingData.livingOrder.dueOutTime
-                  }
-                    var date = new Date(this.model.startValue)
-                    let startValueFormat = date.format('yyyy-MM-dd hh:mm:ss')
+    //计算两个日期之间相隔多少天
+    daysBetween(date1, date2) {
+      const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
+      const firstDate = new Date(date1);
+      const secondDate = new Date(date2);
+      const diffDays = (secondDate - firstDate) / oneDay;
+      this.isAddDate = diffDays >= 0;
+      if (Math.round(diffDays) <= 0) {
+        debugger
+        this.PriceData = []
+      }
+      return Math.round(diffDays);
+    },
+    batchPrice(value, record) {
+      console.log(value)
+      console.log(record.layoutDayPriceList,'record.layoutDayPriceList')
+      record.layoutDayPriceList.forEach(item => {
+        item.price = value
+      })
+      this.$forceUpdate()
+    },
+    add() {
+      this.edit(this.modelDefault);
+    },
+    edit(record) {
+      this.model = Object.assign(this.model, {
+        livingOrderId: record.livingData.livingOrder.id,
+        bookingOrderId: record.livingData.livingOrder.bookingOrderId,
+      })
+      // this.model.startValue = record.livingData.livingOrder.dueOutTime
+      this.visible = true
+      this.loadDate()
+    },
 
-                  httpAction(`/business/busRoomBookingOrders/isBooked?livingOrderId=${this.model.roomInfo.livingOrderId}&dueOutTime=${startValueFormat}`,{},"post")
-                      .then(res => {
-                        if (!res.success) {
-                          return
-                        }
-                        debugger
-                        if (res.result !== null){
-                          this.$confirm({
-                            title: '提示',
-                            content: '房间被 ' + res.result.contactName + ',电话 '+ res.result.phone +' 预定,是否续住?',
-                            onOk: function () {
-                              that.confirmLoading = true;
-                              httpAction(`/business/busRoomBookingOrders/continue-living?livingOrderId=${this.model.roomInfo.livingOrderId}&dueOutTime=${startValueFormat}`, obj, 'post')
-                                  .then((res) => {
-                                    if (res.success) {
-                                      that.$message.success(res.message);
-                                      that.$emit("ok");
-                                    } else {
-                                      that.$message.warning(res.message);
-                                    }
-                                  })
-                                  .finally(() => {
-                                    that.confirmLoading = false;
-                                  });
-                            },
-                          })
+    chooseVipPay() {
+    },
+    submitForm() {
+      const that = this
+      let params = []
+      if (this.selectionRows.length === 0) {
+        that.$emit("ok");
+        return
+      }
+      if (this.selectionRows.some(e => e.payMoney > 0 && e.payType == null)) {
+        this.$message.warning('请选择支付方式')
+        return
+      }
+      this.selectionRows.forEach(e => {
+        if (e.dayNum === 0) {
+          return
+        }
+        let obj = {
+          id: e.id,
+          payType: e.payType,
+          roomId: e.roomId,
+          payMoney: e.payMoney,
+          breakfastNum: e.breakfastNum,
+          dayNum: e.dayNum == null ? 0 : e.dayNum,
+          layoutDayPriceList: e.layoutDayPriceList,
+          dueOutTime: moment(e.newDueOutTime).format('yyyy-MM-DD HH:mm')
+        }
+        params.push(obj)
+      })
+      httpAction(`/business/busRoomBookingOrders/isBooked`, params, 'post')
+          .then(res => {
+            if (!res.success) {
+              return
+            }
+            if (res.result.length > 0) {
+              let mess = '房间已被预定:'
+              res.result.forEach(e => {
+                mess += '\n' + e.customerName + ',电话:' + e.phone + ' 预抵时间:' + e.arrivalTime + '。'
+              })
+              mess += '是否续住?'
+              this.$confirm({
+                title: '提示',
+                content: mess,
+                onOk: function () {
+                  that.confirmLoading = true;
+                  httpAction(`/business/busRoomBookingOrders/continue-living`, params, 'post')
+                      .then((res) => {
+                        if (res.success) {
+                          that.$message.success(res.message)
+                          that.$emit('ok')
                         } else {
-                          that.confirmLoading = true;
-                          httpAction(`/business/busRoomBookingOrders/continue-living?livingOrderId=${this.model.roomInfo.livingOrderId}&dueOutTime=${startValueFormat}`, obj, 'post')
-                              .then((res) => {
-                                if (res.success) {
-                                  that.$message.success(res.message);
-                                  that.$emit("ok");
-                                } else {
-                                  that.$message.warning(res.message);
-                                }
-                              })
-                              .finally(() => {
-                                that.confirmLoading = false;
-                              });
+                          that.$message.warning(res.message);
                         }
                       })
-                }
-            });
-        },
-
-        callback(key) {
-            console.log(key)
-        },
-        handleStartOpenChange(e) {
-          let nowDate = new Date()
-          if (e._d < nowDate) {
-            this.$message.warning('退租时间不能小于当前时间')
-            this.model.startValue = nowDate
-            return
-          }
-            this.dayNum = this.daysBetween(this.model.livingData.livingOrder.dueOutTime, e._d)
-            // this.model.startValue = e._i;
-        },
-        dayChange(e) {
-            console.log(e);
-            if (!this.isAddDate) {
-              e = -e
+                      .finally(() => {
+                        that.confirmLoading = false;
+                      });
+                },
+              })
+            } else {
+              that.confirmLoading = true;
+              httpAction(`/business/busRoomBookingOrders/continue-living`, params, 'post')
+                  .then((res) => {
+                    if (res.success) {
+                      that.$message.success(res.message);
+                      that.$emit("ok");
+                    } else {
+                      that.$message.warning(res.message);
+                    }
+                  })
+                  .finally(() => {
+                    that.confirmLoading = false;
+                  });
             }
-            this.model.startValue = this.addDate(this.model.livingData.livingOrder.dueOutTime, e);
-        },
+          })
+    },
 
-        disabledStartDate(endValue) {
-            // const endValue =
-            // const startValue = this.model.livingData.livingOrder.dueOutTime
-            // if (!endValue || !startValue) {
-            //     return false;
-            // }
-            // return startValue.valueOf() >= endValue.valueOf();
-          return endValue && endValue < moment().add(-1, 'days').endOf('day')
-        },
+    callback(key) {
+      console.log(key)
     },
+  },
 };
 </script>

+ 4 - 4
src/views/room/modules/fangtaiModal/continuedModal/continuedModal.vue

@@ -9,7 +9,7 @@
         :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
         @cancel="handleCancel"
         cancelText="关闭">
-      <pos-table-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></pos-table-form>
+      <continued-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></continued-form>
     </j-modal>
     <batchCardModalCopy ref="batchCardModalCopy" />
   </div>
@@ -17,18 +17,18 @@
 
 <script>
 
-  import PosTableForm from './continuedForm.vue'
   import batchCardModalCopy from './../../../modules/checkIn/batchCardModalCopy'
+  import ContinuedForm from '@views/room/modules/fangtaiModal/continuedModal/continuedForm'
   export default {
     name: 'PosTableModal',
     components: {
-      PosTableForm,
+      ContinuedForm,
       batchCardModalCopy
     },
     data () {
       return {
         title:'',
-        width:800,
+        width:1200,
         visible: false,
         disableSubmit: false,
         makeCardInfo: {}

+ 384 - 261
src/views/room/modules/fangtaiModal/exchangeHouses/exchangeHousesForm.vue

@@ -1,153 +1,222 @@
 <template>
-<a-spin :spinning="confirmLoading">
+  <a-spin :spinning="confirmLoading">
     <a-tabs default-active-key="1" @change="callback">
-        <a-tab-pane key="1" tab="操作">
-            <j-form-container :disabled="formDisabled">
-                <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+      <a-tab-pane key="1" tab="操作">
+        <!--            <j-form-container :disabled="formDisabled">-->
+        <div>
+          <a-table
+            ref="table"
+            size="middle"
+            style="width: 80%;height: auto; margin-left: auto; margin-right: auto; margin-bottom: 10px"
+            :pagination="false"
+            rowKey="id"
+            :columns="columns"
+            :dataSource="tableData">
+          </a-table>
+          <a-form-model ref="form" :model="model" slot="detail">
+            <a-row>
+              <a-col :span="24">
+                <a-form-model-item label="新房间" :labelCol="labelCol" :wrapperCol="wrapperCol" style="margin-top: 10px; margin-bottom: 10px" prop="">
+                  <template v-if="selectData.length>0">
+                    {{ newRoom && newRoom.name }}
+                  </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" style="margin-bottom: 10px" prop="">
+                  {{ newRoom && newRoom.layoutName ? newRoom.layoutName : '--' }}
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="24">
+                <a-form-model-item label="方案" :labelCol="labelCol" :wrapperCol="wrapperCol" style="margin-bottom: 10px" 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" style="margin-bottom: 10px" prop="">
+                  <!-- <a-input-number :min="0" v-model="dayNum" placeholder="请输入续住天数" style="width: 40%" @change="dayChange" /> -->
+                  <template>
+                    {{ timeData.length > 0 ? timeData[0].price : 0 }}元/总房价{{ newRoomPrice }}元
+                    <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) || 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="批量改价" 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>-->
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="24">
+                <a-form-model-item label="换房原因" :labelCol="labelCol" :wrapperCol="wrapperCol" style="margin-bottom: 10px" prop="">
+                  <!-- <a-input-number v-model="model.num" placeholder="请输入座位数" style="width: 100%" /> -->
+                  <a-input v-model="model.remarks"></a-input>
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="24" v-if="differPrice > 0">
+                <a-form-model-item label="差价付款" :labelCol="labelCol" :wrapperCol="wrapperCol" style="margin-bottom: 10px" prop="">
+                  {{ differPrice }} 元
+                  <div v-for="(item, index) in payList" :key="index">
                     <a-row>
-                        <a-col :span="24">
-                            <a-form-model-item label="原房间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <!-- {{ model.livingData && model.livingData.livingOrder && model.livingData.livingOrder.arrivalTime || ''}} -->
-                                {{ model.roomInfo && model.roomInfo.name}}
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="房价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <!-- {{ model.livingData && model.livingData.livingOrder && model.livingData.livingOrder.dueOutTime || ''}} -->
-                                {{ model.roomInfo && model.livingData.price.reduce((pre,cur)=> pre+cur.price*1,0) || 0}} / {{ model.roomInfo && model.layout.marketPrice || 0}}
-                                <a-popover placement="right">
-                                    <template slot="content" v-if="model.livingData">
-                                        <div style="max-height:400px;overflow:auto;width:100%;">
-                                            <div v-for="(item, index) in model.livingData.price" :key="index">
-                                                {{item.dayTime}}
-                                                <a-input-number disabled :min="0" v-model="item.price"></a-input-number>
-                                            </div>
-                                        </div>
-                                    </template>
-                                    <template slot="title">
-                                    </template>
-                                    <a-icon type="eye" />
-                                </a-popover>
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="新房间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <template v-if="selectData.length>0">
-                                    {{newRoom && newRoom.name}}
-                                </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 :span="6">
+                        <a-select v-model="item.payType">
+                          <a-select-option
+                            :value="item.id"
+                            v-for="item in payTypeList"
+                            :key="item.id"
+                            :disabled="item.disable"
+                          >
+                            {{ item.name }}
+                          </a-select-option>
+                        </a-select>
+                      </a-col>
+                      <a-col :span="6">
+                        <a-input-number v-model="item.money" style="margin-left: 20px;"></a-input-number>
                       </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>
-                                    {{ 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) || 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="批量改价" 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>-->
-                            </a-form-model-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-model-item label="原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                                <!-- <a-input-number v-model="model.num" placeholder="请输入座位数" style="width: 100%" /> -->
-                                <a-input v-model="model.remarks"></a-input>
-                            </a-form-model-item>
-                        </a-col>
+                      <a-col :span="6">
+                        <a-icon
+                          v-if="index == payList.length - 1"
+                          type="plus-circle"
+                          class="dynamic-delete-button"
+                          @click="plus()" />
+                        <a-icon
+                          v-if="payList.length > 1"
+                          type="minus-circle"
+                          style="color: #f56c6c"
+                          class="dynamic-delete-button"
+                          @click="() => remove(index)"
+                        /></a-col>
                     </a-row>
-                </a-form-model>
-            </j-form-container>
-        </a-tab-pane>
-        <!-- <a-tab-pane key="2" tab="换房记录"></a-tab-pane> -->
+                  </div>
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="24" style="text-align: end">
+                <a-checkbox style="margin-top: 20px; margin-right: 10px" default-checked>打印换房单</a-checkbox>
+              </a-col>
+            </a-row>
+          </a-form-model>
+        </div>
+        <!--            </j-form-container>-->
+      </a-tab-pane>
+      <!-- <a-tab-pane key="2" tab="换房记录"></a-tab-pane> -->
     </a-tabs>
-
     <a-modal :title="'选择房间'" :width="800" :visible="selectVisible" @cancel="selectVisible = false" @ok="changeSelct">
-        <a-row>
-            <a-col :span="24">
-                <a-form-model-item label="房型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                    <a-checkbox-group v-model="checkedCesRoomLayoutList" :options="cesRoomLayoutList" @change="checkChange">
-                    </a-checkbox-group>
-                </a-form-model-item>
-            </a-col>
-            <a-col :span="24">
-                <a-form-model-item label="房态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
-                    <a-checkbox-group v-model="checkedRoomStatusList" :options="roomStatusList" @change="checkChange">
-                    </a-checkbox-group>
-                </a-form-model-item>
-            </a-col>
-            <a-col :span="24">
-                <div>
-                    <div>已选择{{selectData.length}}间</div>
-                    <div v-if="selectData.length>0">
-                        {{selectData[0].roomInfo && selectData[0].roomInfo.name}}
-                    </div>
-                </div>
+      <a-row>
+        <a-col :span="24">
+          <a-form-model-item label="房型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
+            <a-checkbox-group v-model="checkedCesRoomLayoutList" :options="cesRoomLayoutList" @change="checkChange">
+            </a-checkbox-group>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="24">
+          <a-form-model-item label="房态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="">
+            <a-checkbox-group v-model="checkedRoomStatusList" :options="roomStatusList" @change="checkChange">
+            </a-checkbox-group>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="24">
+          <div>
+            <div>已选择{{ selectData.length }}间</div>
+            <div v-if="selectData.length>0">
+              {{ selectData[0].roomInfo && selectData[0].roomInfo.name }}
+            </div>
+          </div>
 
-            </a-col>
-            <a-col :span="24" v-if="dataList.length>0">
-              <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>
+        </a-col>
+        <a-col :span="24" v-if="dataList.length>0">
+          <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>
-            </a-col>
-        </a-row>
+            </div>
+          </div>
+        </a-col>
+      </a-row>
     </a-modal>
 
-</a-spin>
+  </a-spin>
 </template>
 
 <script>
 import {
     httpAction,
     getAction
-} from "@/api/manage";
+} from '@/api/manage'
 import {
     validateDuplicateValue
-} from "@/utils/util";
+} from '@/utils/util'
 import moment from 'moment'
+const columns = [
+  {
+    title: '房间号',
+    dataIndex: 'roomName',
+    width: 80,
+    align: 'center'
+    // scopedSlots: { customRender: 'roomId' }
+  },
+  {
+    title: '房型',
+    dataIndex: 'layoutName',
+    width: 80,
+    align: 'center'
+    // scopedSlots: { customRender: 'roomId' }
+  },
+  {
+    title: '房价',
+    dataIndex: 'marketPrice',
+    width: 80,
+    align: 'center'
+    // scopedSlots: { customRender: 'roomId' }
+  },
+  {
+    title: '客人',
+    dataIndex: 'customerName',
+    width: 80,
+    align: 'center'
+    // scopedSlots: { customRender: 'roomId' }
+  },
+  {
+    title: '预抵时间',
+    dataIndex: 'arrivalTime',
+    width: 120,
+    align: 'center'
+    // scopedSlots: { customRender: 'roomId' }
+  }
+]
 
 export default {
-    name: "PosTableForm",
+    name: 'ExchangeHousesForm',
     components: {},
     props: {
-        //表单禁用
+        // 表单禁用
         disabled: {
             type: Boolean,
             default: false,
-            required: false,
-        },
+            required: false
+        }
     },
     data() {
         return {
+            tableData: [],
+            columns: columns,
             link: -1,
             customerSourceList: [],
             checkedCustomerSourceList: [],
@@ -166,7 +235,7 @@ export default {
                 },
                 sm: {
                     span: 5
-                },
+                }
             },
             wrapperCol: {
                 xs: {
@@ -174,53 +243,16 @@ export default {
                 },
                 sm: {
                     span: 16
-                },
+                }
             },
             confirmLoading: false,
-            validatorRules: {
-                tenantId: [{
-                    required: true,
-                    message: "请输入关联租户!"
-                }],
-                hotelId: [{
-                    required: true,
-                    message: "请输入关联酒店!"
-                }],
-                name: [{
-                    required: true,
-                    message: "请输入餐桌名称!"
-                }],
-                posTypeId: [{
-                    required: true,
-                    message: "请输入pos类型id!"
-                }],
-                posTableTypeId: [{
-                    required: true,
-                    message: "请输入pos桌型id!"
-                }],
-                posRegionId: [{
-                    required: true,
-                    message: "请输入pos餐桌区域id!"
-                }],
-                num: [{
-                    required: true,
-                    message: "请输入金额!"
-                }],
-                tableNo: [{
-                    required: true,
-                    message: "请输入餐桌序号!"
-                }],
-                state: [{
-                    required: true,
-                    message: "请输入状态!"
-                }],
-            },
             url: {
-                add: "/pos/posTable/add",
-                edit: "/pos/posTable/edit",
-                queryById: "/pos/posTable/queryById",
+                add: '/pos/posTable/add',
+                edit: '/pos/posTable/edit',
+                queryById: '/pos/posTable/queryById'
             },
             payTypeList: [],
+            payList: [],
             tableTypeList: [],
             regionList: [],
             PriceData: [],
@@ -230,72 +262,124 @@ export default {
             newRoom: null,
             timeData: [],
             oldTimeData: [],
-            roomScheme: 1
-        };
+            roomScheme: 1,
+            differPrice: 0 // 新旧房间总差价
+        }
     },
     watch: {
         roomList(val) {
             // this.roomList.forEach(ele => {
             //     this.dataList.push(...ele.rooms)
             // })
+        },
+        newRoomPrice(value) {
+            this.differPrice = value - this.oldTimeData.reduce((pre, cur) => pre + cur.price * 1, 0)
+            this.$forceUpdate()
         }
     },
     computed: {
         formDisabled() {
-            return this.disabled;
+            return this.disabled
         },
+        newRoomPrice() {
+          return this.timeData.reduce((pre, cur) => pre + cur.price * 1, 0)
+        }
     },
     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("/rooms/cesRoomLayout/list", {
+        // 备份model原始值
+        this.modelDefault = JSON.parse(JSON.stringify(this.model))
+        getAction('/rooms/cesRoomLayout/list', {
             pageSize: 99999,
-            pageNo: 1,
+            pageNo: 1
         }).then((res) => {
             if (res.success) {
-                var list = [];
+                var list = []
                 res.result.records.forEach((item) => {
                     list.push({
                         label: item.name,
                         value: item.id
-                    });
-                });
-                this.cesRoomLayoutList = list;
+                    })
+                })
+                this.cesRoomLayoutList = list
             }
-        });
-        getAction("/rooms/cesRooms/room-status-color", {}).then((res) => {
+        })
+        getAction('/rooms/cesRooms/room-status-color', {}).then((res) => {
             if (res.success) {
-                this.roomStatusColorList = res.result;
-                var list = [];
+                this.roomStatusColorList = res.result
+                var list = []
                 res.result.forEach((item) => {
                     list.push({
                         label: item.title,
                         value: item.value
-                    });
-                });
+                    })
+                })
                 list = list.filter(item => item.label == '空净' || item.label == '空脏')
-                console.log(list);
-                this.roomStatusList = list;
+                console.log(list)
+                this.roomStatusList = list
             }
-        });
+        })
+        // 获取支付方式
+        getAction('/business/busRoomPayType/list', {
+          pageSize: 99999,
+          pageNo: 1
+        }).then((res) => {
+          console.log(this.model, '9999s')
+          console.log(res.result.records, '9999s')
+            if (res.success && res.result.records.length > 0) {
+                this.payTypeList = res.result.records
+                var vipIndex = this.payTypeList.findIndex((t) => t.name.includes('会员'))
+                var danweiIndex = this.payTypeList.findIndex((t) => t.name.includes('单位'))
+                if (vipIndex !== -1) {
+                  console.log(this.model.livingData.livingOrder)
+                  console.log(this.model.livingData.livingOrder.vipCustomerId)
+                  this.$set(this.payTypeList[vipIndex], 'disable', this.model.livingData.livingOrder.vipCustomerId == null || this.model.livingData.livingOrder.vipCustomerId === '')
+                }
+                if (danweiIndex !== -1) {
+                  this.$set(this.payTypeList[danweiIndex], 'disable', this.model.livingData.livingOrder.contractTeamId == null)
+                }
+            }
+            this.plus()
+        })
     },
     methods: {
+        plus() {
+          // var sum = this.payList.reduce(function (total, item) {
+          //   return total + item.money
+          // }, 0)
+          // var money = this.realityAmount - sum
+          // if (money < 0) {
+          //   money = 0
+          // }
+          this.payList.push({
+            money: 0,
+            payType: this.payTypeList[0].id
+          })
+          this.$forceUpdate()
+        },
+        remove(index) {
+          this.payList.splice(index, 1)
+        },
         changeSelct() {
             if (this.selectData[0].id == this.model.id) {
-                this.$message.warning("不能选择相同的房间");
+                this.$message.warning('不能选择相同的房间')
                 return
             }
             this.newRoom = this.selectData[0]
+            let find = this.cesRoomLayoutList.find(e => e.value === this.newRoom.layoutId)
+            if (find != null) {
+              console.log(find, 'find')
+              this.$set(this.newRoom, 'layoutName', find.label)
+            }
             if (this.roomScheme === 2) {
               this.timeData.forEach(ele => {
                 ele.price = this.newRoom.marketPrice
               })
             }
-            this.selectVisible = false;
+          this.selectVisible = false
         },
         /**
          * 根据传入的数字将日期加上对应的天数
@@ -304,73 +388,73 @@ export default {
          * @return {String} 返回日期
          */
         addDate(date, days) {
-            console.log(date, days);
-            let time = new Date(date);
-            time.setDate(time.getDate() + days);
-            let m = time.getMonth() + 1;
-            let d = time.getDate();
+            console.log(date, days)
+            let time = new Date(date)
+            time.setDate(time.getDate() + days)
+            let m = time.getMonth() + 1
+            let d = time.getDate()
             if (m < 10) {
-                m = "0" + m;
+                m = '0' + m
             }
             if (d < 10) {
-                d = "0" + d;
+                d = '0' + d
             }
-            console.log(time);
-            return time.getFullYear() + '-' + m + '-' + d + ' ' + time.getHours() + ':' + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ':' + (time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds())
+            console.log(time)
+            return time.getFullYear() + '-' + m + '-' + d + ' ' + time.getHours() + ':' + (time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()) + ':' + (time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds())
         },
 
-        //计算两个日期之间相隔多少天
+        // 计算两个日期之间相隔多少天
         daysBetween(date1, date2) {
-            const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
-            const firstDate = new Date(date1);
-            const secondDate = new Date(date2);
+            const oneDay = 24 * 60 * 60 * 1000 // hours*minutes*seconds*milliseconds
+            const firstDate = new Date(date1)
+            const secondDate = new Date(date2)
             // if (secondDate < firstDate) {
             //     this.$message.warning("离开时间不能小于预离时间");
             //     return
             // }
-            const diffDays = Math.round(Math.abs((firstDate - secondDate) / oneDay));
+            const diffDays = Math.round(Math.abs((firstDate - secondDate) / oneDay))
             if (diffDays < 0) {
                 diffDays = 1
             }
-            return diffDays;
+            return diffDays
         },
-        //比较两个日期大小
+        // 比较两个日期大小
         daysBetweenCopy(date1) {
-            const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
-            const firstDate = new Date(date1);
-            const secondDate = new Date();
+            const oneDay = 24 * 60 * 60 * 1000 // hours*minutes*seconds*milliseconds
+            const firstDate = new Date(date1)
+            const secondDate = new Date()
             // const diffDays = Math.round(Math.abs((firstDate - secondDate) / oneDay));
             if (firstDate.getFullYear() >= secondDate.getFullYear()) {
-                return false;
+                return false
             } else if (firstDate.getFullYear() < secondDate.getFullYear()) {
-                return true;
+                return true
             } else {
                 if (firstDate.getMonth() >= secondDate.getMonth()) {
-                    return false;
+                    return false
                 } else if (firstDate.getMonth() < secondDate.getMonth()) {
-                    return true;
+                    return true
                 } else {
                     if (firstDate.getDate() >= secondDate.getDate()) {
-                        return false;
+                        return false
                     } else if (firstDate.getDate() < secondDate.getDate()) {
-                        return true;
+                        return true
                     }
                 }
             }
             // return diffDays < 0 ? true : false;
         },
         selectRoom(e, idx) {
-            console.log(e);
+            console.log(e)
             this.link = idx
             this.selectData[0] = e
         },
         batchPrice(e) {
-            console.log(e);
+            console.log(e)
             this.timeData.forEach(item => {
-                item.price = e;
+                item.price = e
             })
         },
-        roomSchemeChange(e){
+        roomSchemeChange(e) {
           debugger
           console.log(this.oldTimeData)
           if (this.roomScheme === 1) {
@@ -383,23 +467,23 @@ export default {
           }
         },
         checkChange(e) {
-            console.log("e", e);
+            console.log('e', e)
             console.log(
-                "checkedroomBuildingFloorList",
+                'checkedroomBuildingFloorList',
                 this.checkedroomBuildingFloorList
-            );
-            var list = this.oldRoomList;
+            )
+            var list = this.oldRoomList
             if (this.checkedCesRoomLayoutList.length > 0) {
                 list = this.oldRoomList.reduce((acc, curr) => {
                     const floorRooms = curr.floorRooms.filter((room) =>
                         this.checkedCesRoomLayoutList.includes(room.layoutId)
-                    );
+                    )
                     acc.push({
                         ...curr,
                         floorRooms
-                    });
-                    return acc;
-                }, []);
+                    })
+                    return acc
+                }, [])
             }
             if (this.checkedRoomStatusList.length > 0) {
                 list = list.reduce((acc, curr) => {
@@ -407,17 +491,17 @@ export default {
                         this.checkedRoomStatusList.includes(
                             room.roomStatus !== '7' ? room.roomStatus.toString() : room.lastRoomStatus.toString()
                         )
-                    );
+                    )
                     acc.push({
                         ...curr,
                         floorRooms
-                    });
-                    return acc;
-                }, []);
+                    })
+                    return acc
+                }, [])
             }
-            console.log('list2', list);
-            this.roomList = list;
-            let arr = [];
+            console.log('list2', list)
+            this.roomList = list
+            let arr = []
             this.roomList.forEach(ele => {
                 ele.floorRooms.forEach(item => {
                     if (item) {
@@ -442,27 +526,37 @@ export default {
             //         this.checkChange()
             //     }
             // });
-            getAction("/rooms/cesRooms/can-user-rooms", {
+            getAction('/rooms/cesRooms/can-user-rooms', {
                 startOf: this.model.livingData.livingOrder.arrivalTime,
                 endOf: this.model.livingData.livingOrder.dueOutTime,
                 bookingType: 1,
                 hourRoomRuleId: '',
-                cancelLayout: true,
+                cancelLayout: true
             }).then((res) => {
                 if (res.success) {
-                    this.roomList = res.result[0].buildingRooms;
-                    this.oldRoomList = JSON.parse(JSON.stringify(res.result[0].buildingRooms));
+                    this.roomList = res.result[0].buildingRooms
+                    this.oldRoomList = JSON.parse(JSON.stringify(res.result[0].buildingRooms))
                   console.log(this.roomList)
                     this.checkChange()
                 }
-            });
+            })
         },
         add() {
-            this.edit(this.modelDefault);
+            this.edit(this.modelDefault)
         },
         edit(record) {
-            this.model = Object.assign({}, record);
-            this.loadData();
+          debugger
+          console.log(record)
+            this.tableData = [{
+              roomName: record.roomInfo.name,
+              marketPrice: record.layout.marketPrice,
+              layoutName: record.layout.name,
+              customerName: record.livingData.livingCustomers.customerName,
+              arrivalTime: record.livingData.livingOrder.arrivalTime
+
+            }]
+            this.model = Object.assign({}, record)
+            this.loadData()
             // this.model.startValue = record.livingData.livingOrder.dueOutTime
             let arr = []
             arr.length = this.daysBetween(record.livingData.livingOrder.dueOutTime, record.livingData.livingOrder.arrivalTime)
@@ -471,28 +565,28 @@ export default {
                     day: this.addDate(record.livingData.livingOrder.arrivalTime, i),
                     // price: this.model.layout.marketPrice,
                     price: this.model.livingData.price[i].price
-                };
+                }
             }
             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;
+            console.log('arr', arr)
+            this.visible = true
         },
         submitForm() {
-            const that = this;
+            const that = this
             // 触发表单验证
             this.$refs.form.validate((valid) => {
                 if (valid) {
                     if (!this.newRoom) {
-                        this.$message.warning("请选择新房间");
+                        this.$message.warning('请选择新房间')
                         return
                     }
-                    that.confirmLoading = true;
-                    let httpurl = "";
-                    let method = "";
+                    that.confirmLoading = true
+                    let httpurl = ''
+                    let method = ''
                     // if (!this.model.id) {
                     //     httpurl += this.url.add;
                     //     method = "post";
@@ -500,6 +594,7 @@ export default {
                     //     httpurl += this.url.edit;
                     //     method = "put";
                     // }
+
                     let prices = this.timeData.map(item => {
                         return {
                             dayTime: item.day,
@@ -507,27 +602,46 @@ export default {
                             roomId: this.newRoom.id
                         }
                     })
+                    let feeList = []
+                    if (this.differPrice > 0) {
+                        feeList = this.payList.map((item) => {
+                            return {
+                              livingOrderId: this.model.roomInfo.livingOrderId,
+                              roomId: this.newRoom.id,
+                              hotelId: this.model.hotelId,
+                              feeType: 2,
+                              subjectType: 2,
+                              money: item.money.toFixed(2),
+                              preferentialStatus: 1,
+                              payType: item.payType,
+                              remark: '换房差价',
+                              vipCardId: this.model.livingData.livingOrder.vipCustomerId,
+                              agreementUnitId: this.model.livingData.livingOrder.contractTeamId
+                            }
+                        })
+                    }
+                    let param = { layoutDayPriceList: prices, orderFeeList: feeList, roomId: this.newRoom.id, id: this.model.roomInfo.livingOrderId }
                     // return
-                    httpAction(`/business/busRoomBookingOrders/change-living-room?livingOrderId=${this.model.roomInfo.livingOrderId}&changeRoomId=${this.newRoom.id}`, prices, 'post')
+                    httpAction('/business/busRoomBookingOrders/change-living-room', param, 'post')
                         .then((res) => {
                             if (res.success) {
-                                that.$message.success(res.message);
+                                that.$message.success(res.message)
                                 let obj = {
                                   ...this.newRoom,
                                   layoutName: this.model.layout.name,
                                   customerName: this.model.livingData.livingCustomers.customerName,
                                   phone: this.model.livingData.livingCustomers.phone
                                 }
-                                that.$emit('ok', [obj]);
+                                that.$emit('ok', [obj])
                             } else {
-                                that.$message.warning(res.message);
+                                that.$message.warning(res.message)
                             }
                         })
                         .finally(() => {
-                            that.confirmLoading = false;
-                        });
+                            that.confirmLoading = false
+                        })
                 }
-            });
+            })
         },
 
         callback(key) {
@@ -539,24 +653,33 @@ export default {
             // this.model.startValue = e._i;
         },
         dayChange(e) {
-            console.log(e);
-            this.model.startValue = this.addDate(this.model.livingData.livingOrder.dueOutTime, e);
+            console.log(e)
+            this.model.startValue = this.addDate(this.model.livingData.livingOrder.dueOutTime, e)
         },
 
         disabledStartDate(endValue) {
             // const endValue =
             const startValue = this.model.livingData.livingOrder.dueOutTime
             if (!endValue || !startValue) {
-                return false;
+                return false
             }
-            return startValue.valueOf() >= endValue.valueOf();
-        },
-    },
-};
+            return startValue.valueOf() >= endValue.valueOf()
+        }
+    }
+}
 </script>
 
 <style scoped>
 .active {
     border: 1px solid red !important;
 }
+.dynamic-delete-button {
+  cursor: pointer;
+  position: relative;
+  /* top: 4px; */
+  margin-left: 5px;
+  font-size: 18px;
+  color: #1890ff;
+  transition: all 0.3s;
+}
 </style>

+ 4 - 4
src/views/room/modules/fangtaiModal/exchangeHouses/exchangeHousesModal.vue

@@ -9,7 +9,7 @@
         :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
         @cancel="handleCancel"
         cancelText="关闭">
-      <pos-table-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></pos-table-form>
+      <exchange-houses-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></exchange-houses-form>
     </j-modal>
     <batchCardModalCopy ref="batchCardModalCopy" />
   </div>
@@ -17,12 +17,12 @@
 
 <script>
 
-  import PosTableForm from './exchangeHousesForm.vue'
+  import ExchangeHousesForm from './exchangeHousesForm.vue'
   import batchCardModalCopy from './../../../modules/checkIn/batchCardModalCopy'
   export default {
     name: 'PosTableModal',
     components: {
-      PosTableForm,
+      ExchangeHousesForm,
       batchCardModalCopy
     },
     data () {
@@ -43,7 +43,7 @@
       edit (record) {
         this.visible=true
         this.$nextTick(()=>{
-          this.$refs.realForm.edit(record);
+          this.$refs.realForm.edit(record)
         })
       },
       close () {

+ 5 - 4
src/views/room/modules/schedule/EditScheduleRoomForm.vue

@@ -911,7 +911,7 @@ export default {
           if (find) {
             this.model.contactName = find.name;
             this.model.phone = find.phone;
-
+            this.model.contactId = find.id;
             this.$emit("ok", this.model);
           }
         }
@@ -1172,7 +1172,8 @@ export default {
           name: e.roomName,
           marketPrice: e.layoutDayPrices[0].price,
           key1: this.model.contactName,
-          key5: this.model.phone
+          key5: this.model.phone,
+          customerId: this.model.contactId
         }
         roomInfo.push(param)
       })
@@ -1181,14 +1182,14 @@ export default {
       orderInfo.arrivalTime2 = moment(new Date()).format('YYYY-MM-DD')
       delete orderInfo.arrivalTime
       console.log(orderInfo)
-
       this.$refs.ModalBillRoomForm.addList(roomInfo, '1', orderInfo)
       this.$refs.ModalBillRoomForm.title =
           e.key == '1' ? '散客入住登记' : '团队入住登记'
       this.$refs.ModalBillRoomForm.disableSubmit = false
     },
     modalBillRoomFormOk() {
-      this.getBookingOrderInfo();
+      this.$router.replace("/room/dynamic/fangtai");
+      // this.getBookingOrderInfo();
     },
     setMain(id) {
       postAction("/business/busBookingRooms/set-main", { id: id }).then(

File diff suppressed because it is too large
+ 530 - 442
src/views/room/modules/schedule/ScheduleRoomForm.vue


+ 3 - 4
src/views/settings/components/roomModules/modules/housePriceSchemeDetailList.vue

@@ -130,14 +130,13 @@
                 },
                 dictOptions:{},
                 superFieldList:[],
-                queryParam: {},
+                queryParam: {
+                  schemeId: this.schemeId
+                },
             }
         },
         created() {
             this.getSuperFieldList();
-
-            this.queryParam.schemeId = this.schemeId
-            this.loadData()
         },
         computed: {
             importExcelUrl: function(){