EditScheduleRoomForm.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <div style="gap: 10px; display: flex; margin: 10px">
  4. <a-button
  5. v-if="disabled && model.orderInfo.bookingStatus == 1"
  6. @click="disabled = false"
  7. >修改预定</a-button
  8. >
  9. <a-button v-if="!disabled" @click="editOrder">确认修改</a-button>
  10. <a-button v-if="!disabled" @click="cancelOrder">取消修改</a-button>
  11. <a-button
  12. v-if="disabled && model.orderInfo.bookingStatus == 1"
  13. @click="setOrderStatus(2)"
  14. >取消预定</a-button
  15. >
  16. <a-button
  17. v-if="model.orderInfo.bookingStatus == 2"
  18. @click="setOrderStatus(1)"
  19. >恢复预定</a-button
  20. >
  21. <a-button v-if="model.orderInfo.bookingStatus == 2" @click="deleteOrder"
  22. >删除预定</a-button
  23. >
  24. </div>
  25. <j-form-container>
  26. <a-form-model
  27. ref="form"
  28. :model="model"
  29. :rules="validatorRules"
  30. slot="detail"
  31. >
  32. <a-row>
  33. <div style="display: flex; gap: 15px">
  34. <div style="width: 39%">
  35. <h4 style="color: rgba(255, 141, 26, 1); font-weight: 600">
  36. 订价信息
  37. </h4>
  38. <a-divider />
  39. <a-col :span="24" v-if="disabled">
  40. <a-form-model-item
  41. label="预定单号"
  42. :labelCol="labelCol"
  43. :wrapperCol="wrapperCol"
  44. >
  45. {{ model.orderInfo.bookingOrdersNo }}
  46. </a-form-model-item>
  47. </a-col>
  48. <a-col :span="24">
  49. <a-form-model-item
  50. label="入住类型"
  51. :labelCol="labelCol"
  52. :wrapperCol="wrapperCol"
  53. prop="orderInfo.bookingType"
  54. >
  55. <a-select
  56. :disabled="disabled"
  57. placeholder="入住类型"
  58. v-model="model.orderInfo.bookingType"
  59. @change="bookingTypeChange"
  60. >
  61. <a-select-option :value="1"> 全天 </a-select-option>
  62. <a-select-option :value="2"> 钟点 </a-select-option>
  63. </a-select>
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :span="24">
  67. <a-form-model-item
  68. label="预抵时间"
  69. :labelCol="labelCol"
  70. :wrapperCol="wrapperCol"
  71. prop="orderInfo.arrivalTime2"
  72. >
  73. <j-date
  74. :disabled="disabled"
  75. placeholder="预抵时间"
  76. v-model="model.orderInfo.arrivalTime2"
  77. style="width: 180px"
  78. :allowClear="false"
  79. :disabled-date="disabledDate"
  80. @change="arrivalTimeChange"
  81. />
  82. <a-time-picker
  83. :disabled="disabled"
  84. style="width: 80px; margin-left: 2px"
  85. v-model="model.orderInfo.arrivalTimeSpan"
  86. :default-value="moment('12:00', 'HH:mm')"
  87. format="HH:mm"
  88. :allowClear="false"
  89. @change="arrivalTimeSpanChange"
  90. />
  91. </a-form-model-item>
  92. </a-col>
  93. <a-col :span="24">
  94. <a-form-model-item
  95. label="预离时间"
  96. :labelCol="labelCol"
  97. :wrapperCol="wrapperCol"
  98. prop="orderInfo.dueOutTime2"
  99. >
  100. <j-date
  101. :disabled="disabled || model.orderInfo.bookingType === 2"
  102. placeholder="预离时间"
  103. v-model="model.orderInfo.dueOutTime2"
  104. style="width: 180px"
  105. :allowClear="false"
  106. :disabled-date="disabledDate"
  107. @change="arrivalTimeChange2"
  108. />
  109. <a-time-picker
  110. style="width: 80px; margin-left: 2px"
  111. v-model="model.orderInfo.dueOutTimeSpan"
  112. format="HH:mm"
  113. :allowClear="false"
  114. :disabled="disabled || model.orderInfo.bookingType === 2"
  115. />
  116. </a-form-model-item>
  117. </a-col>
  118. <a-col :span="24">
  119. <a-form-model-item
  120. label="客人来源"
  121. :labelCol="labelCol"
  122. :wrapperCol="wrapperCol"
  123. prop="orderInfo.customerSource"
  124. >
  125. <a-select
  126. :disabled="disabled"
  127. placeholder="客人来源"
  128. v-model="model.orderInfo.customerSource"
  129. >
  130. <a-select-option
  131. :value="item.id"
  132. v-for="(item, index) in customerSourceList"
  133. :key="item.id"
  134. >
  135. {{ item.itemText }}
  136. </a-select-option>
  137. </a-select>
  138. </a-form-model-item>
  139. </a-col>
  140. <a-col :span="24" v-if="model.orderInfo.bookingType == 2">
  141. <a-form-model-item
  142. label="时长"
  143. :labelCol="labelCol"
  144. :wrapperCol="wrapperCol"
  145. prop="orderInfo.hourRoomId"
  146. >
  147. <a-select
  148. :disabled="disabled"
  149. placeholder="时长"
  150. v-model="model.orderInfo.hourRoomId"
  151. @change="hourRoomIdChange"
  152. >
  153. <a-select-option
  154. :value="item.id"
  155. v-for="(item, index) in hourRoomRuleList"
  156. :key="item.id"
  157. >
  158. {{ item.hourRoomName }}
  159. </a-select-option>
  160. </a-select>
  161. </a-form-model-item>
  162. </a-col>
  163. <a-col :span="24" v-else>
  164. <a-form-model-item
  165. label="天数"
  166. :labelCol="labelCol"
  167. :wrapperCol="wrapperCol"
  168. prop="orderInfo.dayCount"
  169. >
  170. <a-input-number
  171. :disabled="disabled"
  172. v-model="model.orderInfo.dayCount"
  173. placeholder="天数"
  174. :min="1"
  175. @change="dayCountChange"
  176. ></a-input-number>
  177. </a-form-model-item>
  178. </a-col>
  179. <a-col :span="24">
  180. <a-form-model-item
  181. label="早餐"
  182. :labelCol="labelCol"
  183. :wrapperCol="wrapperCol"
  184. prop="orderInfo.breakfastNum"
  185. >
  186. <a-input-number
  187. :disabled="disabled"
  188. v-model="model.orderInfo.breakfastNum"
  189. placeholder="早餐"
  190. :min="0"
  191. ></a-input-number>
  192. </a-form-model-item>
  193. </a-col>
  194. <a-col :span="24">
  195. <a-form-model-item
  196. label="预定方式"
  197. :labelCol="labelCol"
  198. :wrapperCol="wrapperCol"
  199. prop="orderInfo.bookingDicWay"
  200. >
  201. <a-select
  202. :disabled="disabled"
  203. placeholder="预定方式"
  204. v-model="model.orderInfo.bookingDicWay"
  205. >
  206. <a-select-option
  207. :value="item.id"
  208. v-for="(item, index) in bookingdicWayList"
  209. :key="item.id"
  210. >
  211. {{ item.itemText }}
  212. </a-select-option>
  213. </a-select>
  214. </a-form-model-item>
  215. </a-col>
  216. <!-- <a-col :span="24">-->
  217. <!-- <a-form-model-item-->
  218. <!-- label="客人类型"-->
  219. <!-- :labelCol="labelCol"-->
  220. <!-- :wrapperCol="wrapperCol"-->
  221. <!-- prop="orderInfo.customerType"-->
  222. <!-- >-->
  223. <!-- <a-select-->
  224. <!-- :disabled="disabled"-->
  225. <!-- placeholder="客人类型"-->
  226. <!-- v-model="model.orderInfo.customerType"-->
  227. <!-- >-->
  228. <!-- <a-select-option :value="1"> 散客 </a-select-option>-->
  229. <!-- <a-select-option :value="2"> 会员 </a-select-option>-->
  230. <!-- <a-select-option :value="3"> 协议单位 </a-select-option>-->
  231. <!-- <a-select-option :value="4"> 中介 </a-select-option>-->
  232. <!-- </a-select>-->
  233. <!-- </a-form-model-item>-->
  234. <!-- </a-col>-->
  235. <!-- <a-col :span="24" v-if="model.orderInfo.bookingType === 1">-->
  236. <!-- <a-form-model-item-->
  237. <!-- label="房价方案"-->
  238. <!-- :labelCol="labelCol"-->
  239. <!-- :wrapperCol="wrapperCol"-->
  240. <!-- prop="orderInfo.roomPriceSlnId"-->
  241. <!-- >-->
  242. <!-- <a-select-->
  243. <!-- :disabled="disabled"-->
  244. <!-- placeholder="房价方案"-->
  245. <!-- v-model="model.orderInfo.roomPriceSlnId"-->
  246. <!-- >-->
  247. <!-- <a-select-option value="会员价"> 会员价 </a-select-option>-->
  248. <!-- <a-select-option value="平日价"> 平日价 </a-select-option>-->
  249. <!-- </a-select>-->
  250. <!-- </a-form-model-item>-->
  251. <!-- </a-col>-->
  252. <h4 style="color: rgba(255, 141, 26, 1); font-weight: 600">
  253. 其他信息
  254. </h4>
  255. <a-divider />
  256. <a-col :span="24">
  257. <a-form-model-item
  258. label="联系人"
  259. :labelCol="labelCol"
  260. :wrapperCol="wrapperCol"
  261. prop="contactName"
  262. >
  263. <a-auto-complete
  264. :disabled="disabled"
  265. v-model="model.contactName"
  266. placeholder="联系人"
  267. @search="handleSearch"
  268. @select="(e) => handleSelectMember(e)"
  269. >
  270. <template slot="dataSource">
  271. <a-select-option
  272. v-for="item in customerList"
  273. :key="item.id"
  274. >{{ item.name }}-{{ item.phone }}</a-select-option
  275. >
  276. </template>
  277. </a-auto-complete>
  278. </a-form-model-item>
  279. </a-col>
  280. <a-col :span="24">
  281. <a-form-model-item
  282. label="电话"
  283. :labelCol="labelCol"
  284. :wrapperCol="wrapperCol"
  285. prop="phone"
  286. >
  287. <a-input
  288. :disabled="disabled"
  289. v-model="model.phone"
  290. placeholder="电话"
  291. ></a-input>
  292. </a-form-model-item>
  293. </a-col>
  294. <a-col :span="24">
  295. <a-form-model-item
  296. label="担保方式"
  297. :labelCol="labelCol"
  298. :wrapperCol="wrapperCol"
  299. prop="orderInfo.warrantType"
  300. >
  301. <a-select
  302. :disabled="disabled"
  303. placeholder="担保方式"
  304. v-model="model.orderInfo.warrantType"
  305. >
  306. <a-select-option :value="1"> 无担保 </a-select-option>
  307. <a-select-option :value="2"> 有担保 </a-select-option>
  308. <a-select-option :value="3"> OTA担保 </a-select-option>
  309. </a-select>
  310. </a-form-model-item>
  311. </a-col>
  312. <a-col :span="24">
  313. <a-form-model-item
  314. label="销售员"
  315. :labelCol="labelCol"
  316. :wrapperCol="wrapperCol"
  317. prop="orderInfo.warranter"
  318. >
  319. <a-select
  320. :disabled="disabled"
  321. placeholder="销售员"
  322. v-model="model.orderInfo.warranter"
  323. >
  324. <a-select-option
  325. :value="item.id"
  326. v-for="item in warranterList"
  327. :key="item.id"
  328. >
  329. {{ item.name }}
  330. </a-select-option>
  331. </a-select>
  332. </a-form-model-item>
  333. </a-col>
  334. <a-col :span="24">
  335. <a-form-model-item
  336. label="外部单号"
  337. :labelCol="labelCol"
  338. :wrapperCol="wrapperCol"
  339. prop="orderInfo.outerOrdersNo"
  340. >
  341. <a-input
  342. :disabled="disabled"
  343. v-model="model.orderInfo.outerOrdersNo"
  344. placeholder="外部单号"
  345. ></a-input>
  346. </a-form-model-item>
  347. </a-col>
  348. <a-col :span="24">
  349. <a-form-model-item
  350. label="备注"
  351. :labelCol="labelCol"
  352. :wrapperCol="wrapperCol"
  353. prop="orderInfo.remark"
  354. >
  355. <a-textarea
  356. :disabled="disabled"
  357. v-model="model.orderInfo.remark"
  358. rows="4"
  359. placeholder="备注"
  360. />
  361. </a-form-model-item>
  362. </a-col>
  363. </div>
  364. <div style="width: 61%" v-if="disabled">
  365. <h4 style="color: rgba(255, 141, 26, 1); font-weight: 600">
  366. 选择房间
  367. </h4>
  368. <a-divider />
  369. <div style="display: flex; justify-content: space-between">
  370. <div>
  371. <span>房间数:{{ model.roomIds.length }}间</span>
  372. <span style="padding-left: 10px"
  373. >占房天数:{{ model.orderInfo.dayCount }}晚</span
  374. >
  375. <span style="padding-left: 10px">总价:{{ amount2 }}</span>
  376. </div>
  377. <div style="display: flex; gap: 10px">
  378. <a-button @click="makeCard">制房卡</a-button>
  379. <a-button @click="batchPulsRoom">批量排房</a-button>
  380. <a-button @click="addCustomer">入住</a-button>
  381. </div>
  382. </div>
  383. <a-table
  384. :columns="columns"
  385. :data-source="model.roomIds"
  386. :pagination="false"
  387. rowKey="id"
  388. >
  389. <template slot="favPrice" slot-scope="text, record, index">
  390. {{ record.layout.favPrice }}
  391. </template>
  392. <template slot="presetNum" slot-scope="text, record, index">
  393. <div>
  394. <a-input-number
  395. v-model="record.layout.presetNum"
  396. :min="(record.rooms || []).length"
  397. :max="record.layout.oldTags"
  398. @change="presetNumChange($event, record)"
  399. />
  400. </div>
  401. </template>
  402. <span slot="selectRoom" slot-scope="text, record, index">
  403. <a-button
  404. :disabled="record.roomStatus == 3 || record.roomStatus == 4"
  405. type="link"
  406. @click="pulsRoom2(record, index)"
  407. >{{ text ? text : "排房" }}</a-button
  408. >
  409. </span>
  410. <span slot="action" slot-scope="text, record, index">
  411. <div style="gap: 10px; display: flex">
  412. <!-- <a-button-->
  413. <!-- v-if="record.roomStatus != 3 && record.roomStatus != 4"-->
  414. <!-- size="small"-->
  415. <!-- @click="addCustomer(record)"-->
  416. <!-- >入住</a-button-->
  417. <!-- >-->
  418. <a-button
  419. size="small"
  420. v-if="!record.isMain"
  421. @click="setMain(record.id)"
  422. >设主房</a-button
  423. >
  424. <a-button
  425. v-if="record.roomStatus == 3 || record.roomStatus == 4"
  426. size="small"
  427. >查看详单</a-button
  428. >
  429. </div>
  430. </span>
  431. <template slot="zhu" slot-scope="text, record, index">
  432. <span
  433. v-if="text == true"
  434. class="booking_circle_span orange_color"
  435. >主</span
  436. >
  437. </template>
  438. </a-table>
  439. </div>
  440. <div style="width: 61%" v-else>
  441. <h4 style="color: rgba(255, 141, 26, 1); font-weight: 600">
  442. 选择房间
  443. </h4>
  444. <a-divider />
  445. <div style="display: flex; justify-content: space-between">
  446. <div>
  447. <span style="padding-left: 10px"
  448. >占房天数:{{ model.orderInfo.dayCount }}晚</span
  449. >
  450. <span style="padding-left: 10px">总价:{{ amount }}</span>
  451. </div>
  452. </div>
  453. <a-table
  454. :columns="columns2"
  455. :data-source="canUserRooms"
  456. :pagination="false"
  457. :rowKey="rowKey"
  458. >
  459. <div
  460. slot="expandedRowRender"
  461. slot-scope="record, index, indent, expanded"
  462. style="margin: 0"
  463. >
  464. <p>
  465. 已排房:
  466. <template
  467. v-for="(building, bIndex) in record.buildingRooms"
  468. >
  469. <a-tag
  470. color="blue"
  471. closable
  472. :visible="visible"
  473. @close.stop="tagClose2(rindex, bIndex, index)"
  474. v-for="(item, rindex) in building.floorRooms"
  475. :key="rindex"
  476. v-if="item.check && item.check == 1"
  477. >{{ item.name }}</a-tag
  478. >
  479. <!-- <a-tag
  480. color="blue"
  481. closable
  482. :visible="visible"
  483. @close.stop="tagClose2(rindex, index)"
  484. v-for="(item, rindex) in record.rooms"
  485. :key="rindex"
  486. >{{ item.name }}</a-tag
  487. > -->
  488. </template>
  489. </p>
  490. <p>
  491. 未排房:{{
  492. record.layout.presetNum - (record.rooms || []).length
  493. }}间
  494. </p>
  495. </div>
  496. <template slot="favPrice" slot-scope="text, record, index">
  497. <!-- <editable-cell
  498. :text="record.layout.favPrice"
  499. @change="onCellChange('favPrice', index, $event)"
  500. /> -->
  501. {{ record.layout.favPrice }}
  502. </template>
  503. <template slot="presetNum" slot-scope="text, record, index">
  504. <div>
  505. <a-input-number
  506. v-model="record.layout.presetNum"
  507. :min="(record.rooms || []).length"
  508. :max="record.layout.oldTags"
  509. @change="presetNumChange($event, record)"
  510. />
  511. </div>
  512. </template>
  513. <span slot="action" slot-scope="text, record, index">
  514. <a
  515. :disabled="record.layout.presetNum <= 0"
  516. @click="pulsRoom(index)"
  517. >排房</a
  518. >
  519. </span>
  520. </a-table>
  521. </div>
  522. </div>
  523. </a-row>
  524. </a-form-model>
  525. </j-form-container>
  526. <select-room-form-modal
  527. ref="modalSelectRoomForm"
  528. @ok="modalFormOk"
  529. ></select-room-form-modal>
  530. <select-room-form-modal
  531. ref="modalSelectRoomForm2"
  532. @ok="modalFormOk2"
  533. ></select-room-form-modal>
  534. <customer-modal
  535. ref="modalCustomerForm"
  536. @ok=""
  537. ></customer-modal>
  538. <bill-room-form-modal
  539. ref="ModalBillRoomForm"
  540. @ok="modalBillRoomFormOk"
  541. ></bill-room-form-modal>
  542. <batch-card-modal-copy ref="batchCardModalCopy"></batch-card-modal-copy>
  543. </a-spin>
  544. </template>
  545. <script>
  546. import { httpAction, getAction, postAction, deleteAction } from "@/api/manage";
  547. import { validateDuplicateValue } from "@/utils/util";
  548. import moment from "moment";
  549. import EditableCell from "@views/room/modules/checkIn/EditableCell.vue";
  550. import SelectRoomFormModal from "./SelectRoomFormModal.vue";
  551. import CustomerModal from "@views/room/modules/customer/CustomerModal.vue";
  552. import BillRoomFormModal from '@views/room/modules/checkIn/BillRoomFormModal';
  553. import batchCardModalCopy from '@views/room/modules/checkIn/batchCardModalCopy'
  554. const date = new Date();
  555. const endDate = new Date(date.setDate(date.getDate() + 1));
  556. const columns = [
  557. {
  558. title: "",
  559. dataIndex: "isMain",
  560. width: 50,
  561. scopedSlots: { customRender: "zhu" },
  562. },
  563. {
  564. title: "排房",
  565. dataIndex: "roomName",
  566. scopedSlots: { customRender: "selectRoom" },
  567. },
  568. {
  569. title: "房型",
  570. dataIndex: "layoutName",
  571. },
  572. {
  573. title: "房价",
  574. dataIndex: "marketPrice",
  575. customRender: function (text, record) {
  576. var price = 0;
  577. if (record.layoutDayPrices && record.layoutDayPrices.length > 0) {
  578. price = record.layoutDayPrices[0].price;
  579. }
  580. return price;
  581. },
  582. },
  583. {
  584. title: "押金",
  585. // dataIndex: "roomName",
  586. customRender: function (text, record) {
  587. return 100
  588. }
  589. },
  590. {
  591. title: "操作",
  592. dataIndex: "action",
  593. align: "center",
  594. fixed: "right",
  595. width: 70,
  596. scopedSlots: { customRender: "action" },
  597. },
  598. ];
  599. const data = [];
  600. for (let i = 0; i < 2; i++) {
  601. data.push({
  602. id: i,
  603. key1: `双人床` + i,
  604. key2: 298,
  605. key3: 298,
  606. key4: 8,
  607. key5: 0,
  608. key6: 0,
  609. });
  610. }
  611. export default {
  612. name: "ScheduleRoomForm",
  613. components: { BillRoomFormModal, EditableCell, SelectRoomFormModal, CustomerModal, batchCardModalCopy },
  614. props: {
  615. //表单禁用
  616. disabled2: {
  617. type: Boolean,
  618. default: false,
  619. },
  620. id: {
  621. type: String,
  622. default: "",
  623. },
  624. },
  625. data() {
  626. return {
  627. disabled: false,
  628. visible: true,
  629. columns,
  630. columns2: [
  631. // {
  632. // title: "",
  633. // dataIndex: "key",
  634. // width: 20,
  635. // },
  636. {
  637. title: "房型",
  638. dataIndex: "name",
  639. width: 150,
  640. customRender: function (text, record) {
  641. return record.layout.name;
  642. },
  643. },
  644. {
  645. title: "门市价",
  646. dataIndex: "marketPrice",
  647. width: 100,
  648. customRender: function (text, record) {
  649. return record.layout.marketPrice;
  650. },
  651. },
  652. {
  653. title: "优惠价",
  654. dataIndex: "favPrice",
  655. width: 120,
  656. scopedSlots: { customRender: "favPrice" },
  657. },
  658. {
  659. title: "可订数/可超数",
  660. dataIndex: "canUseCount",
  661. width: 170,
  662. customRender: function (text, record) {
  663. return record.layout.canUseCount + "/0";
  664. },
  665. },
  666. {
  667. title: "预定间数",
  668. dataIndex: "presetNum",
  669. width: 100,
  670. scopedSlots: { customRender: "presetNum" },
  671. },
  672. {
  673. title: "操作",
  674. dataIndex: "action",
  675. align: "center",
  676. fixed: "right",
  677. width: 70,
  678. scopedSlots: { customRender: "action" },
  679. },
  680. ],
  681. model: {
  682. // data: data,
  683. orderInfo: {
  684. bookingOrdersType: 1,
  685. arrivalTime2: moment(new Date()).format("YYYY-MM-DD"),
  686. dueOutTime2: moment(endDate).format("YYYY-MM-DD"),
  687. arrivalTimeSpan: moment("18:00", "HH:mm"),
  688. dueOutTimeSpan: moment("12:00", "HH:mm"),
  689. bookingType: 1,
  690. dayCount: 1,
  691. warrantType: 1,
  692. hourRoomId: "",
  693. breakfastNum: 0,
  694. },
  695. roomIds: [],
  696. layoutDayPrices: [],
  697. },
  698. labelCol: {
  699. xs: { span: 24 },
  700. sm: { span: 5 },
  701. },
  702. wrapperCol: {
  703. xs: { span: 24 },
  704. sm: { span: 16 },
  705. },
  706. confirmLoading: false,
  707. validatorRules: {
  708. "orderInfo.bookingType": [
  709. { required: true, message: "请选择入住类型!" },
  710. ],
  711. "orderInfo.arrivalTime2": [
  712. { required: true, message: "请选择预抵时间!" },
  713. ],
  714. "orderInfo.dueOutTime2": [
  715. { required: true, message: "请选择预离时间!" },
  716. ],
  717. "orderInfo.customerSource": [
  718. { required: true, message: "请选择客人来源!" },
  719. ],
  720. "orderInfo.bookingDicWay": [
  721. { required: true, message: "请选择预定方式!" },
  722. ],
  723. // "orderInfo.customerType": [
  724. // { required: true, message: "请选择客人类型!" },
  725. // ],
  726. contactName: [{ required: true, message: "请输入联系人!" }],
  727. phone: [{ required: true, message: "请输入电话!" }],
  728. },
  729. url: {
  730. add: "/business/busRoomBookingOrders/add",
  731. edit: "/business/busRoomBookingOrders/edit",
  732. getBookingOrderInfo:
  733. "/business/busRoomBookingOrders/getBookingOrderInfo",
  734. },
  735. result: [],
  736. selectIndex: 0,
  737. customerSourceList: [],
  738. bookingdicWayList: [],
  739. warranterList: [],
  740. hourRoomRuleList: [],
  741. canUserRooms: [],
  742. canUserRooms2: [],
  743. customerList: [],
  744. oldcustomerList: [],
  745. };
  746. },
  747. computed: {
  748. formDisabled() {
  749. return this.disabled;
  750. },
  751. amount() {
  752. var sum = 0;
  753. this.canUserRooms.forEach((t) => {
  754. sum += t.layout.favPrice * t.layout.presetNum;
  755. });
  756. return sum.toFixed(2);
  757. },
  758. amount2() {
  759. var sum = 0;
  760. this.model.roomIds.forEach((t) => {
  761. t.layoutDayPrices.forEach((p) => {
  762. sum += p.price;
  763. });
  764. });
  765. return sum.toFixed(2);
  766. },
  767. },
  768. created() {
  769. this.disabled = this.disabled2;
  770. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  771. if (_info) {
  772. this.model.hotelId = _info.id;
  773. }
  774. //备份model原始值
  775. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  776. getAction('/business/busDictItem/queryList', {
  777. hotelId: _info.id,
  778. dictName: '客人来源设置'
  779. }).then((res) => {
  780. if (res.success) {
  781. this.customerSourceList = res.result;
  782. }
  783. });
  784. getAction('/business/busDictItem/queryList', {
  785. hotelId: _info.id,
  786. dictName: '预定方式'
  787. }).then((res) => {
  788. if (res.success) {
  789. this.bookingdicWayList = res.result;
  790. }
  791. });
  792. getAction("/business/busSalesPerson/list", {
  793. hotelId: _info.id,
  794. pageNo: 1,
  795. pageSize: 100,
  796. }).then((res) => {
  797. if (res.success) {
  798. this.warranterList = res.result.records;
  799. }
  800. });
  801. getAction("/rooms/cesHourRoomRule/list", {
  802. pageNo: 1,
  803. pageSize: 100,
  804. }).then((res) => {
  805. if (res.success) {
  806. this.hourRoomRuleList = res.result.records;
  807. }
  808. });
  809. // postAction("/rooms/cesAllDayPriceRule/fetch", { hotelId: _info.id }).then(
  810. // (res) => {
  811. // if (res.success) {
  812. // if (
  813. // res.result &&
  814. // res.result.cesAllDayPriceRule &&
  815. // res.result.cesAllDayPriceRule.leaveTime
  816. // ) {
  817. // this.model.orderInfo.dueOutTimeSpan = moment(
  818. // res.result.cesAllDayPriceRule.leaveTime,
  819. // "HH:mm"
  820. // );
  821. // }
  822. // }
  823. // this.loadRooms();
  824. // }
  825. // );
  826. this.getBookingOrderInfo();
  827. },
  828. methods: {
  829. makeCard(){
  830. let recrod = []
  831. this.model.roomIds.forEach(e => {
  832. let param = {
  833. name: e.roomName,
  834. id: e.roomId,
  835. layoutId: e.roomLayoutId,
  836. layoutName: e.layoutName,
  837. customerName: this.model.contactName,
  838. phone: this.model.phone,
  839. arriveTime: this.model.orderInfo.arrivalTime,
  840. dueOutTime: this.model.orderInfo.dueOutTime
  841. }
  842. recrod.push(param)
  843. })
  844. this.$refs.batchCardModalCopy.edit(recrod)
  845. },
  846. getBookingOrderInfo() {
  847. getAction(this.url.getBookingOrderInfo, {
  848. bookingNo: this.id,
  849. }).then((res) => {
  850. if (res.success) {
  851. this.model = res.result;
  852. this.model.orderInfo.arrivalTime2 = moment(
  853. this.model.orderInfo.arrivalTime
  854. ).format("YYYY-MM-DD");
  855. this.model.orderInfo.dueOutTime2 = moment(
  856. this.model.orderInfo.dueOutTime
  857. ).format("YYYY-MM-DD");
  858. this.model.orderInfo.arrivalTimeSpan = moment(
  859. this.model.orderInfo.arrivalTime.substr(11, 15),
  860. "HH:mm"
  861. );
  862. this.model.orderInfo.dueOutTimeSpan = moment(
  863. this.model.orderInfo.dueOutTime.substr(11, 15),
  864. "HH:mm"
  865. );
  866. this.getbusCustomer();
  867. this.loadRooms();
  868. }
  869. });
  870. },
  871. deleteOrder() {
  872. deleteAction("/business/busRoomBookingOrders/delete", {
  873. id: this.model.orderInfo.id,
  874. }).then((res) => {
  875. if (res.success) {
  876. this.$message.success(res.message);
  877. this.$router.go(-1);
  878. } else {
  879. this.$message.warning(res.message);
  880. }
  881. });
  882. },
  883. setOrderStatus(status) {
  884. postAction("/business/busRoomBookingOrders/set-booking-status", {
  885. id: this.model.orderInfo.id,
  886. bookingStatus: status,
  887. }).then((res) => {
  888. if (res.success) {
  889. this.$message.success(res.message);
  890. this.getBookingOrderInfo();
  891. } else {
  892. this.$message.warning(res.message);
  893. }
  894. });
  895. },
  896. getbusCustomer() {
  897. getAction("/bus/busCustomer/list", {}).then((res) => {
  898. if (res.success) {
  899. this.customerList = res.result.records;
  900. this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
  901. var find = this.oldcustomerList.find(
  902. (t) => t.id == this.model.orderInfo.contactId
  903. );
  904. if (find) {
  905. this.model.contactName = find.name;
  906. this.model.phone = find.phone;
  907. this.model.contactId = find.id;
  908. this.$emit("ok", this.model);
  909. }
  910. }
  911. });
  912. },
  913. presetNumChange(e, record) {
  914. console.log(e);
  915. record.layout.canUseCount = record.layout.oldTags - e;
  916. },
  917. onCellChange(key, dataIndex, value) {
  918. const dataSource = [...this.canUserRooms];
  919. const target = dataSource[dataIndex];
  920. console.log("target", target);
  921. if (target && target.layout) {
  922. target.layout[key] = value;
  923. this.canUserRooms = dataSource;
  924. }
  925. console.log("this.canUserRooms", this.canUserRooms);
  926. },
  927. rowKey(record) {
  928. return record.layout.id;
  929. },
  930. loadRooms() {
  931. getAction("/rooms/cesRooms/can-user-rooms", {
  932. startOf:
  933. this.model.orderInfo.arrivalTime2 +
  934. " " +
  935. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm"),
  936. endOf:
  937. this.model.orderInfo.dueOutTime2 +
  938. " " +
  939. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm"),
  940. bookingType: this.model.orderInfo.bookingType,
  941. hourRoomRuleId: this.model.orderInfo.hourRoomId,
  942. orderId: this.model.orderInfo.id,
  943. }).then((res) => {
  944. if (res.success) {
  945. res.result.forEach((t) => {
  946. var rooms = [];
  947. var layouts = this.model.roomIds.filter(
  948. (r) => r.roomLayoutId === t.layout.id
  949. );
  950. t.layout = Object.assign({}, t.layout, {
  951. presetNum: layouts.length,
  952. oldTags: t.layout.canUseCount + layouts.length,
  953. });
  954. t.buildingRooms.forEach((b) => {
  955. b.floorRooms.forEach((f) => {
  956. var exRoom = this.model.roomIds.some((r) => r.roomId === f.id);
  957. if (exRoom) {
  958. rooms.push(f);
  959. }
  960. this.$set(f, "check", exRoom === true ? 1 : 0);
  961. });
  962. });
  963. this.$set(t, "rooms", rooms);
  964. });
  965. this.canUserRooms = res.result;
  966. console.log("this.canUserRooms", this.canUserRooms);
  967. }
  968. });
  969. },
  970. bookingTypeChange(e) {
  971. if (this.model.orderInfo.bookingType == 1) {
  972. this.model.orderInfo.hourRoomId = "";
  973. } else {
  974. var hourRoomRule = this.hourRoomRuleList[0];
  975. if (hourRoomRule) {
  976. this.model.orderInfo.hourRoomId = hourRoomRule.id;
  977. }
  978. }
  979. if (this.model.orderInfo.bookingType === 2) {
  980. var find = this.hourRoomRuleList.find(
  981. (t) => t.id === this.model.orderInfo.hourRoomId
  982. );
  983. if (find) {
  984. var mDate = moment(
  985. this.model.orderInfo.arrivalTime2 +
  986. " " +
  987. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  988. ).add(find.afterOpenRoom, "minutes");
  989. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  990. this.model.orderInfo.dueOutTimeSpan = moment(
  991. mDate.format("HH:mm"),
  992. "HH:mm"
  993. );
  994. }
  995. } else if (this.model.orderInfo.bookingType === 1) {
  996. var mDate = moment(this.model.orderInfo.arrivalTime2).add(1, "days");
  997. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  998. }
  999. this.loadRooms();
  1000. },
  1001. dayCountChange(e) {
  1002. this.model.orderInfo.dueOutTime2 = moment(
  1003. this.model.orderInfo.arrivalTime2
  1004. )
  1005. .add(e, "days")
  1006. .format("YYYY-MM-DD");
  1007. this.loadRooms();
  1008. },
  1009. disabledDate(current) {
  1010. return current && current < moment().add(-1, "days").endOf("day");
  1011. },
  1012. arrivalTimeChange(e) {
  1013. var v = parseInt(
  1014. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1015. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1016. (1000 * 60 * 60 * 24)
  1017. );
  1018. if (v <= 0) {
  1019. this.model.orderInfo.dueOutTime2 = moment(
  1020. this.model.orderInfo.arrivalTime2
  1021. )
  1022. .add(1, "days")
  1023. .format("YYYY-MM-DD");
  1024. }
  1025. v = parseInt(
  1026. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1027. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1028. (1000 * 60 * 60 * 24)
  1029. );
  1030. this.model.orderInfo.dayCount = Math.abs(v);
  1031. this.loadRooms();
  1032. },
  1033. arrivalTimeChange2(e) {
  1034. var v = parseInt(
  1035. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1036. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1037. (1000 * 60 * 60 * 24)
  1038. );
  1039. if (v <= 0) {
  1040. this.model.orderInfo.arrivalTime2 = moment(
  1041. this.model.orderInfo.dueOutTime2
  1042. )
  1043. .add(-1, "days")
  1044. .format("YYYY-MM-DD");
  1045. }
  1046. v = parseInt(
  1047. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1048. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1049. (1000 * 60 * 60 * 24)
  1050. );
  1051. this.model.orderInfo.dayCount = Math.abs(v);
  1052. this.loadRooms();
  1053. },
  1054. arrivalTimeSpanChange(m, time) {
  1055. console.log(time);
  1056. console.log(moment(m).format("HH:mm"));
  1057. if (this.model.orderInfo.bookingType === 2) {
  1058. var find = this.hourRoomRuleList.find(
  1059. (t) => t.id === this.model.orderInfo.hourRoomId
  1060. );
  1061. if (find) {
  1062. var mDate = moment(
  1063. this.model.orderInfo.arrivalTime2 +
  1064. " " +
  1065. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1066. ).add(find.afterOpenRoom, "minutes");
  1067. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1068. this.model.orderInfo.dueOutTimeSpan = moment(
  1069. mDate.format("HH:mm"),
  1070. "HH:mm"
  1071. );
  1072. }
  1073. }
  1074. this.loadRooms();
  1075. },
  1076. hourRoomIdChange() {
  1077. if (this.model.orderInfo.bookingType === 2) {
  1078. var find = this.hourRoomRuleList.find(
  1079. (t) => t.id === this.model.orderInfo.hourRoomId
  1080. );
  1081. if (find) {
  1082. var mDate = moment(
  1083. this.model.orderInfo.arrivalTime2 +
  1084. " " +
  1085. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1086. ).add(find.afterOpenRoom, "minutes");
  1087. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1088. this.model.orderInfo.dueOutTimeSpan = moment(
  1089. mDate.format("HH:mm"),
  1090. "HH:mm"
  1091. );
  1092. }
  1093. }
  1094. this.loadRooms();
  1095. },
  1096. tagClose2(rindex, bindex, index) {
  1097. console.log(rindex, index);
  1098. console.log(this.canUserRooms[index]);
  1099. var id =
  1100. this.canUserRooms[index].buildingRooms[bindex].floorRooms[rindex].id;
  1101. var findIndex = this.canUserRooms[index].rooms.findIndex(
  1102. (t) => t.id === id
  1103. );
  1104. this.canUserRooms[index].rooms.splice(findIndex, 1);
  1105. this.$set(
  1106. this.canUserRooms[index].buildingRooms[bindex].floorRooms[rindex],
  1107. "check",
  1108. 0
  1109. );
  1110. console.log(this.canUserRooms);
  1111. },
  1112. modalFormOk(e) {
  1113. // this.modelDefault = Object.assign({}, this.modelDefault, {
  1114. // rooms: e,
  1115. // });
  1116. // this.edit(this.modelDefault);
  1117. this.$set(this.canUserRooms[this.selectIndex], "rooms", e);
  1118. console.log(this.canUserRooms[this.selectIndex]);
  1119. },
  1120. modalFormOk2(e) {
  1121. this.$set(this.canUserRooms2[0], "rooms", e);
  1122. console.log("modalFormOk2", this.canUserRooms2[0]);
  1123. this.model.roomIds[this.selectIndex].roomId = e[0].id;
  1124. this.model.roomIds[this.selectIndex].roomName = e[0].name;
  1125. postAction(
  1126. "/business/busBookingRooms/edit",
  1127. this.model.roomIds[this.selectIndex]
  1128. ).then((res) => {
  1129. if (res.success) {
  1130. this.$message.success(res.message);
  1131. } else {
  1132. this.$message.warning(res.message);
  1133. }
  1134. });
  1135. },
  1136. addCustomer() {
  1137. console.log(this.model, '-------------')
  1138. if (this.model.roomIds.some(e => e.roomId == null || e.roomId === '')) {
  1139. this.$message.warning('请先排房')
  1140. return;
  1141. }
  1142. let roomInfo = []
  1143. this.model.roomIds.forEach(e => {
  1144. let param = {
  1145. id: e.roomId,
  1146. bookingOrdersNo: this.id,
  1147. bookingOrderId: e.bookingOrdersId,
  1148. layoutId: e.roomLayoutId,
  1149. name: e.roomName,
  1150. marketPrice: e.marketPrice,
  1151. key1: this.model.contactName,
  1152. key5: this.model.phone,
  1153. customerId: this.model.contactId,
  1154. layoutDayPrices: e.layoutDayPrices
  1155. }
  1156. roomInfo.push(param)
  1157. })
  1158. let orderInfo = JSON.parse(JSON.stringify(this.model.orderInfo))
  1159. orderInfo.arrivalTimeSpan = moment(new Date(), 'HH:mm')
  1160. orderInfo.arrivalTime2 = moment(new Date()).format('YYYY-MM-DD')
  1161. delete orderInfo.arrivalTime
  1162. console.log(orderInfo)
  1163. this.$refs.ModalBillRoomForm.addList(roomInfo, '1', orderInfo)
  1164. this.$refs.ModalBillRoomForm.title = '散客入住登记'
  1165. // e.key == '1' ? '散客入住登记' : '团队入住登记'
  1166. this.$refs.ModalBillRoomForm.disableSubmit = false
  1167. },
  1168. modalBillRoomFormOk() {
  1169. this.$router.replace("/room/dynamic/fangtai");
  1170. // this.getBookingOrderInfo();
  1171. },
  1172. setMain(id) {
  1173. postAction("/business/busBookingRooms/set-main", { id: id }).then(
  1174. (res) => {
  1175. if (res.success) {
  1176. this.$message.success(res.message);
  1177. this.getBookingOrderInfo();
  1178. } else {
  1179. this.$message.warning(res.message);
  1180. }
  1181. }
  1182. );
  1183. },
  1184. batchPulsRoom(){
  1185. this.$confirm({
  1186. content: `是否批量排房?`,
  1187. onOk: () => {
  1188. let ids = this.model.roomIds.filter(e => e.roomId == null).map(obj => obj.id)
  1189. if (ids.length === 0) {
  1190. this.$message.warning('没有需要排房的房间')
  1191. return
  1192. }
  1193. postAction('/business/busBookingRooms/editBatch', ids).then(resp => {
  1194. if (resp.success) {
  1195. this.$message.success('成功')
  1196. this.getBookingOrderInfo();
  1197. }
  1198. })
  1199. }
  1200. })
  1201. },
  1202. pulsRoom(index) {
  1203. this.selectIndex = index;
  1204. this.$refs.modalSelectRoomForm.add(this.canUserRooms[this.selectIndex]);
  1205. this.$refs.modalSelectRoomForm.title = "排房";
  1206. this.$refs.modalSelectRoomForm.disableSubmit = false;
  1207. },
  1208. pulsRoom2(record, index) {
  1209. this.selectIndex = index;
  1210. getAction("/rooms/cesRooms/can-user-rooms", {
  1211. startOf:
  1212. this.model.orderInfo.arrivalTime2 +
  1213. " " +
  1214. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm"),
  1215. endOf:
  1216. this.model.orderInfo.dueOutTime2 +
  1217. " " +
  1218. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm"),
  1219. bookingType: this.model.orderInfo.bookingType,
  1220. hourRoomRuleId: this.model.orderInfo.hourRoomId,
  1221. layoutId: record.roomLayoutId,
  1222. // orderId: this.model.orderInfo.id,
  1223. }).then((res) => {
  1224. if (res.success) {
  1225. res.result.forEach((t) => {
  1226. t.layout = Object.assign({}, t.layout, {
  1227. presetNum: 0,
  1228. oldTags: t.layout.canUseCount,
  1229. });
  1230. t.buildingRooms.forEach((b) => {
  1231. b.floorRooms.forEach((f) => {
  1232. this.$set(f, "check", 0);
  1233. });
  1234. });
  1235. });
  1236. this.canUserRooms2 = res.result;
  1237. this.canUserRooms2[0].layout.presetNum = 1;
  1238. this.$refs.modalSelectRoomForm2.add(this.canUserRooms2[0]);
  1239. this.$refs.modalSelectRoomForm2.title = "排房";
  1240. this.$refs.modalSelectRoomForm2.disableSubmit = false;
  1241. }
  1242. });
  1243. },
  1244. handleSearch(value) {
  1245. let result;
  1246. if (!value) {
  1247. result = this.oldcustomerList;
  1248. } else {
  1249. result = this.oldcustomerList.filter((t) => t.name.includes(value));
  1250. }
  1251. this.customerList = result;
  1252. },
  1253. handleSelectMember(e) {
  1254. var find = this.customerList.find((t) => t.id === e);
  1255. this.model.phone = find.phone;
  1256. this.model.contactName = find.name;
  1257. this.model.orderInfo.contactId = find.id;
  1258. },
  1259. moment,
  1260. onChange(date, dateString) {
  1261. console.log(date, dateString);
  1262. },
  1263. add() {
  1264. this.edit(this.modelDefault);
  1265. },
  1266. addList(roomLiveList) {
  1267. this.modelDefault = Object.assign({}, this.modelDefault, {
  1268. rooms: roomLiveList,
  1269. });
  1270. this.edit(this.modelDefault);
  1271. },
  1272. edit(record) {
  1273. this.model = Object.assign({}, record);
  1274. this.visible = true;
  1275. },
  1276. cancelOrder() {
  1277. this.disabled = true;
  1278. this.getBookingOrderInfo();
  1279. },
  1280. editOrder() {
  1281. this.submitForm();
  1282. },
  1283. submitForm() {
  1284. const that = this;
  1285. that.model.roomIds = [];
  1286. that.model.layoutDayPrices = [];
  1287. that.canUserRooms.forEach((t) => {
  1288. console.log("foreach");
  1289. var lastlayoutId = t.layout.id;
  1290. t.buildingRooms.forEach((b) => {
  1291. b.floorRooms.forEach((f) => {
  1292. if (f.check && f.check === 1) {
  1293. that.model.roomIds.push({
  1294. layoutId: t.layout.id,
  1295. roomId: f.id,
  1296. roomLayoutId: t.layout.id,
  1297. });
  1298. }
  1299. });
  1300. });
  1301. const roomIds = that.model.roomIds.filter(
  1302. (it) => it.layoutId === lastlayoutId
  1303. );
  1304. var len = roomIds.length;
  1305. for (var i = len; i < t.layout.presetNum; i++) {
  1306. that.model.roomIds.push({
  1307. layoutId: t.layout.id,
  1308. roomId: null,
  1309. roomLayoutId: t.layout.id,
  1310. });
  1311. }
  1312. for (var b = 0; b < that.model.orderInfo.dayCount; b++) {
  1313. var dayTime = moment(this.model.orderInfo.arrivalTime2)
  1314. .add(b, "days")
  1315. .format("YYYY-MM-DD");
  1316. that.model.layoutDayPrices.push({
  1317. bookingType: 1,
  1318. dayTime: dayTime,
  1319. price: t.layout.favPrice,
  1320. roomLayoutId: t.layout.id,
  1321. });
  1322. }
  1323. });
  1324. console.log(" that.canUserRooms", that.canUserRooms);
  1325. console.log("this.model", this.model);
  1326. if (that.model.roomIds.length <= 0) {
  1327. that.$message.warning("请先添加房间");
  1328. return;
  1329. }
  1330. // 触发表单验证
  1331. this.$refs.form.validate((valid) => {
  1332. if (valid) {
  1333. this.model.orderInfo.arrivalTime =
  1334. this.model.orderInfo.arrivalTime2 +
  1335. " " +
  1336. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm");
  1337. this.model.orderInfo.dueOutTime =
  1338. this.model.orderInfo.dueOutTime2 +
  1339. " " +
  1340. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm");
  1341. that.confirmLoading = true;
  1342. let httpurl = "";
  1343. let method = "";
  1344. if (!this.model.orderInfo.id) {
  1345. httpurl += this.url.add;
  1346. method = "post";
  1347. } else {
  1348. httpurl += this.url.edit;
  1349. method = "put";
  1350. }
  1351. httpAction(httpurl, this.model, method)
  1352. .then((res) => {
  1353. if (res.success) {
  1354. that.$message.success(res.message);
  1355. if (that.model.orderInfo.id) {
  1356. that.getBookingOrderInfo();
  1357. that.disabled = true;
  1358. } else {
  1359. that.$emit("ok");
  1360. }
  1361. } else {
  1362. that.$message.warning(res.message);
  1363. }
  1364. })
  1365. .finally(() => {
  1366. that.confirmLoading = false;
  1367. });
  1368. }
  1369. });
  1370. },
  1371. },
  1372. };
  1373. </script>
  1374. <style scoped>
  1375. /deep/.ant-divider-horizontal {
  1376. margin: 12px 0 !important;
  1377. }
  1378. /deep/ .ant-form-item {
  1379. margin-bottom: 5px !important;
  1380. }
  1381. .orange_color {
  1382. border-color: #ff9e35 !important;
  1383. color: #ff9e35 !important;
  1384. vertical-align: initial;
  1385. }
  1386. .booking_circle_span {
  1387. width: 18px;
  1388. height: 18px;
  1389. border-radius: 50%;
  1390. color: #f24e4c;
  1391. border: 1px solid #f24e4c;
  1392. font-size: 12px;
  1393. text-align: center;
  1394. line-height: 16px;
  1395. display: inline-block;
  1396. }
  1397. </style>