BillRoomForm.vue 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model
  5. ref="form"
  6. :model="model"
  7. :rules="validatorRules"
  8. slot="detail"
  9. >
  10. <a-row>
  11. <div>
  12. <div style="display: flex; gap: 15px">
  13. <div style="width: 57%">
  14. <a-tabs
  15. hide-add
  16. type="editable-card"
  17. v-model="activeKey"
  18. :tabBarStyle="{ fontWeight: 600 }"
  19. @edit="editTabs"
  20. @tabClick="tabClick"
  21. >
  22. <a-tab-pane
  23. v-for="(room, aindex) in model.roomIds"
  24. :key="room.id"
  25. :tab="room.name"
  26. :closable="true"
  27. force-render
  28. >
  29. <div style="display: flex; justify-content: space-between">
  30. <h4
  31. style="
  32. color: rgba(255, 141, 26, 1);
  33. font-weight: 600;
  34. margin-top: 15px;
  35. "
  36. >
  37. 宾客信息
  38. </h4>
  39. </div>
  40. <a-divider />
  41. <!-- <a-col :span="8">
  42. <a-form-model-item
  43. label="姓名"
  44. :labelCol="labelCol"
  45. :wrapperCol="wrapperCol"
  46. :prop="`rooms[${index}].key1`"
  47. :rules="[
  48. {
  49. required: true,
  50. message: '请输入姓名!',
  51. trigger: 'change',
  52. },
  53. ]"
  54. >
  55. <a-auto-complete
  56. v-model="room.key1"
  57. placeholder="请输入姓名"
  58. @search="handleSearch"
  59. @select="(e) => handleSelectMember(room, e)"
  60. >
  61. <template slot="dataSource">
  62. <a-select-option
  63. v-for="item in result"
  64. :key="item"
  65. >{{ item }}</a-select-option
  66. >
  67. </template>
  68. </a-auto-complete>
  69. </a-form-model-item>
  70. </a-col> -->
  71. <a-col :span="8">
  72. <a-form-model-item
  73. label="姓名"
  74. :labelCol="labelCol"
  75. :wrapperCol="wrapperCol"
  76. :prop="`roomIds[${aindex}].key1`"
  77. :rules="[
  78. {
  79. required: true,
  80. message: '请输入姓名!',
  81. trigger: 'change',
  82. },
  83. ]"
  84. >
  85. <a-auto-complete
  86. v-model="room.key1"
  87. placeholder="请输入姓名"
  88. @search="handleSearch"
  89. @select="(e) => handleSelectMember(room, e)"
  90. >
  91. <template slot="dataSource">
  92. <a-select-option
  93. v-for="item in customerList"
  94. :key="item.id"
  95. >{{ item.name }}-{{ item.phone }}</a-select-option
  96. >
  97. </template>
  98. </a-auto-complete>
  99. </a-form-model-item>
  100. </a-col>
  101. <a-col :span="8">
  102. <a-form-model-item
  103. label="性别"
  104. :labelCol="labelCol"
  105. :wrapperCol="wrapperCol"
  106. :prop="`roomIds[${aindex}].key2`"
  107. :rules="[
  108. {
  109. required: true,
  110. message: '请选择性别!',
  111. trigger: 'change',
  112. },
  113. ]"
  114. >
  115. <a-select v-model="room.key2" placeholder="请选择性别">
  116. <a-select-option :value="1"> 男 </a-select-option>
  117. <a-select-option :value="2"> 女 </a-select-option>
  118. </a-select>
  119. </a-form-model-item>
  120. </a-col>
  121. <a-col :span="8">
  122. <a-form-model-item
  123. label="民族"
  124. :labelCol="labelCol"
  125. :wrapperCol="wrapperCol"
  126. :prop="`roomIds[${aindex}].key3`"
  127. :rules="[
  128. {
  129. required: true,
  130. message: '请选择民族!',
  131. trigger: 'change',
  132. },
  133. ]"
  134. >
  135. <a-select v-model="room.key3" placeholder="请选择民族">
  136. <a-select-option value="汉"> 汉 </a-select-option>
  137. <a-select-option value="回"> 回 </a-select-option>
  138. </a-select>
  139. </a-form-model-item>
  140. </a-col>
  141. <a-col :span="16">
  142. <a-form-model-item
  143. label="身份证号"
  144. :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
  145. :wrapperCol="{
  146. xs: { span: 24 },
  147. sm: { span: 16 },
  148. }"
  149. :prop="`roomIds[${aindex}].key4`"
  150. :rules="[
  151. {
  152. required: true,
  153. message: '请输身份证号!',
  154. trigger: 'change',
  155. },
  156. ]"
  157. >
  158. <a-input
  159. v-model="room.key4"
  160. placeholder="请输身份证号"
  161. ></a-input>
  162. </a-form-model-item>
  163. </a-col>
  164. <a-col :span="8">
  165. <a-form-model-item
  166. label="手机号"
  167. :labelCol="labelCol"
  168. :wrapperCol="wrapperCol"
  169. :prop="`roomIds[${aindex}].key5`"
  170. :rules="[
  171. {
  172. required: true,
  173. message: '请输入手机号!',
  174. trigger: 'change',
  175. },
  176. ]"
  177. >
  178. <a-input
  179. v-model="room.key5"
  180. placeholder="请输入姓名"
  181. ></a-input>
  182. </a-form-model-item>
  183. </a-col>
  184. <a-col :span="24">
  185. <a-form-model-item
  186. label="联系地址"
  187. :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
  188. :wrapperCol="{
  189. xs: { span: 24 },
  190. sm: { span: 16 },
  191. }"
  192. prop="key6"
  193. >
  194. <a-input
  195. v-model="room.key6"
  196. placeholder="请输入联系地址"
  197. ></a-input>
  198. </a-form-model-item>
  199. </a-col>
  200. <a-col :span="24">
  201. <div
  202. style="display: flex; justify-content: space-between"
  203. >
  204. <div></div>
  205. <div>
  206. <a-button type="link" @click="puls(room)">
  207. 添加同住
  208. </a-button>
  209. </div>
  210. </div>
  211. </a-col>
  212. <template v-for="(item, index) in room.livingCustomers2">
  213. <a-col :span="4">
  214. <a-form-model-item
  215. :wrapperCol="{
  216. xs: { span: 24 },
  217. sm: { span: 22 },
  218. }"
  219. :prop="`roomIds[${aindex}].livingCustomers2[${index}].customerName`"
  220. :rules="[
  221. {
  222. required: true,
  223. message: '请输入姓名!',
  224. trigger: 'change',
  225. },
  226. ]"
  227. >
  228. <a-input
  229. v-model="item.customerName"
  230. placeholder="姓名"
  231. ></a-input>
  232. </a-form-model-item>
  233. </a-col>
  234. <a-col :span="4">
  235. <a-form-model-item
  236. :wrapperCol="{
  237. xs: { span: 24 },
  238. sm: { span: 22 },
  239. }"
  240. :prop="`roomIds[${aindex}].livingCustomers2[${index}].gender`"
  241. >
  242. <a-select placeholder="性别" v-model="item.gender">
  243. <a-select-option :value="1"> 男 </a-select-option>
  244. <a-select-option :value="2"> 女 </a-select-option>
  245. </a-select>
  246. </a-form-model-item>
  247. </a-col>
  248. <a-col :span="4">
  249. <a-form-model-item
  250. :wrapperCol="{
  251. xs: { span: 24 },
  252. sm: { span: 22 },
  253. }"
  254. :prop="`roomIds[${aindex}].livingCustomers2[${index}].certType`"
  255. >
  256. <a-select placeholder="证件" v-model="item.certType">
  257. <a-select-option :value="1">
  258. 身份证
  259. </a-select-option>
  260. <a-select-option :value="2"> 护照 </a-select-option>
  261. </a-select>
  262. </a-form-model-item>
  263. </a-col>
  264. <a-col :span="6">
  265. <a-form-model-item
  266. :wrapperCol="{
  267. xs: { span: 24 },
  268. sm: { span: 23 },
  269. }"
  270. :prop="`roomIds[${aindex}].livingCustomers2[${index}].certNo`"
  271. :rules="[
  272. {
  273. required: true,
  274. message: '请输入证件号!',
  275. trigger: 'change',
  276. },
  277. ]"
  278. >
  279. <a-input
  280. v-model="item.certNo"
  281. placeholder="证件号"
  282. ></a-input>
  283. </a-form-model-item>
  284. </a-col>
  285. <a-col :span="6">
  286. <a-form-model-item
  287. :wrapperCol="{
  288. xs: { span: 24 },
  289. sm: { span: 24 },
  290. }"
  291. :prop="`roomIds[${aindex}].livingCustomers2[${index}].phone`"
  292. :rules="[
  293. {
  294. required: true,
  295. message: '请输入手机号!',
  296. trigger: 'change',
  297. },
  298. ]"
  299. >
  300. <a-input
  301. v-model="item.phone"
  302. placeholder="手机号"
  303. style="width: 120px"
  304. ></a-input>
  305. <a-icon
  306. type="minus-circle"
  307. style="color: #f56c6c"
  308. class="dynamic-delete-button"
  309. v-if="room.livingCustomers2.length > 0"
  310. @click="() => remove(room, index)"
  311. />
  312. </a-form-model-item>
  313. </a-col>
  314. </template>
  315. </a-tab-pane>
  316. <div slot="tabBarExtraContent">
  317. <a-button type="link" @click="pulsRoom()">
  318. 增加房间
  319. </a-button>
  320. </div>
  321. </a-tabs>
  322. <h4
  323. style="
  324. color: rgba(255, 141, 26, 1);
  325. font-weight: 600;
  326. margin-top: 20px;
  327. "
  328. >
  329. 入住信息
  330. </h4>
  331. <a-divider />
  332. <a-col :span="12">
  333. <a-form-model-item
  334. label="入住类型"
  335. :labelCol="labelCol"
  336. :wrapperCol="wrapperCol"
  337. prop="orderInfo.bookingType"
  338. >
  339. <a-select
  340. placeholder="入住类型"
  341. v-model="model.orderInfo.bookingType"
  342. @change="bookingTypeChange"
  343. >
  344. <a-select-option :value="1"> 全天 </a-select-option>
  345. <a-select-option :value="2"> 钟点 </a-select-option>
  346. </a-select>
  347. </a-form-model-item>
  348. </a-col>
  349. <a-col :span="12">
  350. <a-form-model-item
  351. label="订单来源"
  352. :labelCol="labelCol"
  353. :wrapperCol="wrapperCol"
  354. prop="orderInfo.customerSource"
  355. >
  356. <a-select
  357. placeholder="订单来源"
  358. v-model="model.orderInfo.customerSource"
  359. >
  360. <a-select-option
  361. :value="item.id"
  362. v-for="(item, index) in customerSourceList"
  363. :key="item.id"
  364. >
  365. {{ item.itemText }}
  366. </a-select-option>
  367. </a-select>
  368. </a-form-model-item>
  369. </a-col>
  370. <a-col :span="12" v-if="model.orderInfo.bookingType == 2">
  371. <a-form-model-item
  372. label="时长"
  373. :labelCol="labelCol"
  374. :wrapperCol="wrapperCol"
  375. prop="orderInfo.hourRoomId"
  376. >
  377. <a-select
  378. placeholder="时长"
  379. v-model="model.orderInfo.hourRoomId"
  380. @change="hourRoomIdChange"
  381. >
  382. <a-select-option
  383. :value="item.id"
  384. v-for="(item, index) in hourRoomRuleList"
  385. :key="item.id"
  386. >
  387. {{ item.hourRoomName }}
  388. </a-select-option>
  389. </a-select>
  390. </a-form-model-item>
  391. </a-col>
  392. <a-col :span="12" v-else>
  393. <a-form-model-item
  394. label="天数"
  395. :labelCol="labelCol"
  396. :wrapperCol="wrapperCol"
  397. prop="orderInfo.dayCount"
  398. >
  399. <a-input-number
  400. v-model="model.orderInfo.dayCount"
  401. placeholder="天数"
  402. :min="1"
  403. @change="dayCountChange"
  404. ></a-input-number
  405. >天
  406. </a-form-model-item>
  407. </a-col>
  408. <a-col :span="12">
  409. <a-form-model-item
  410. label="外部单号"
  411. :labelCol="labelCol"
  412. :wrapperCol="wrapperCol"
  413. prop="orderInfo.outerOrdersNo"
  414. >
  415. <a-input
  416. v-model="model.orderInfo.outerOrdersNo"
  417. placeholder="外部单号"
  418. ></a-input>
  419. </a-form-model-item>
  420. </a-col>
  421. <a-col :span="12">
  422. <a-form-model-item
  423. label="入住时间"
  424. :labelCol="labelCol"
  425. :wrapperCol="wrapperCol"
  426. prop="orderInfo.arrivalTime2"
  427. >
  428. <j-date
  429. placeholder="入住时间"
  430. v-model="model.orderInfo.arrivalTime2"
  431. style="width: 120px"
  432. :allowClear="false"
  433. :disabled-date="disabledDate"
  434. @change="arrivalTimeChange"
  435. />
  436. <a-time-picker
  437. style="width: 80px; margin-left: 2px"
  438. v-model="model.orderInfo.arrivalTimeSpan"
  439. :default-value="moment('12:00', 'HH:mm')"
  440. format="HH:mm"
  441. :allowClear="false"
  442. @change="arrivalTimeSpanChange"
  443. />
  444. </a-form-model-item>
  445. </a-col>
  446. <a-col :span="12">
  447. <a-form-model-item
  448. label="预离时间"
  449. :labelCol="labelCol"
  450. :wrapperCol="wrapperCol"
  451. prop="orderInfo.dueOutTime2"
  452. >
  453. <j-date
  454. placeholder="预离时间"
  455. v-model="model.orderInfo.dueOutTime2"
  456. style="width: 120px"
  457. :allowClear="false"
  458. :disabled-date="disabledDate"
  459. :disabled="model.orderInfo.bookingType === 2"
  460. @change="arrivalTimeChange2"
  461. />
  462. <a-time-picker
  463. style="width: 80px; margin-left: 2px"
  464. v-model="model.orderInfo.dueOutTimeSpan"
  465. format="HH:mm"
  466. :allowClear="false"
  467. :disabled="model.orderInfo.bookingType === 2"
  468. />
  469. </a-form-model-item>
  470. </a-col>
  471. <a-col :span="12">
  472. <a-form-model-item
  473. label="宾客类型"
  474. :labelCol="labelCol"
  475. :wrapperCol="wrapperCol"
  476. prop="orderInfo.customerType"
  477. >
  478. <a-select
  479. placeholder="宾客类型"
  480. v-model="model.orderInfo.customerType"
  481. >
  482. <a-select-option :value="1"> 散客 </a-select-option>
  483. <a-select-option :value="2"> 会员 </a-select-option>
  484. <a-select-option :value="3"> 协议单位 </a-select-option>
  485. <a-select-option :value="4"> 中介 </a-select-option>
  486. </a-select>
  487. </a-form-model-item>
  488. </a-col>
  489. <a-col :span="12" v-if="model.orderInfo.customerType === 2">
  490. <a-form-model-item
  491. label="会员"
  492. :labelCol="labelCol"
  493. :wrapperCol="wrapperCol"
  494. prop="orderInfo.roomPriceSlnId"
  495. >
  496. <a-select
  497. placeholder="会员"
  498. option-label-prop="label"
  499. v-model="model.orderInfo.roomPriceSlnId"
  500. @change="roomPriceSlnIdChange"
  501. >
  502. <a-select-option
  503. :key="item.id"
  504. :value="item.id"
  505. :label="item.name"
  506. v-for="(item, index) in busMemberCardList"
  507. >
  508. {{ item.name }}-{{ item.gradeName }}-{{ item.balance }}
  509. </a-select-option>
  510. </a-select>
  511. </a-form-model-item>
  512. </a-col>
  513. <a-col :span="12">
  514. <a-form-model-item
  515. label="房价方案"
  516. :labelCol="labelCol"
  517. :wrapperCol="wrapperCol"
  518. prop="orderInfo.roomPriceSlnId"
  519. >
  520. <a-select
  521. placeholder="房价方案"
  522. v-model="model.orderInfo.roomPriceSlnId"
  523. >
  524. <a-select-option value="会员价"> 会员价 </a-select-option>
  525. <a-select-option value="平日价"> 平日价 </a-select-option>
  526. </a-select>
  527. </a-form-model-item>
  528. </a-col>
  529. <a-col :span="12">
  530. <a-form-model-item
  531. label="销售员工"
  532. :labelCol="labelCol"
  533. :wrapperCol="wrapperCol"
  534. prop="orderInfo.warranter"
  535. >
  536. <a-select
  537. placeholder="销售员工"
  538. v-model="model.orderInfo.warranter"
  539. >
  540. <a-select-option
  541. :value="item.id"
  542. v-for="item in warranterList"
  543. :key="item.id"
  544. >
  545. {{ item.name }}
  546. </a-select-option>
  547. </a-select>
  548. </a-form-model-item>
  549. </a-col>
  550. <a-col :span="12">
  551. <a-form-model-item
  552. label="早餐数量"
  553. :labelCol="labelCol"
  554. :wrapperCol="wrapperCol"
  555. prop="orderInfo.breakfastNum"
  556. >
  557. <a-input-number
  558. v-model="model.orderInfo.breakfastNum"
  559. placeholder="早餐数量"
  560. :min="0"
  561. ></a-input-number
  562. >份
  563. </a-form-model-item>
  564. </a-col>
  565. <a-col :span="24">
  566. <a-form-model-item
  567. label="订单备注"
  568. :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
  569. :wrapperCol="{
  570. xs: { span: 24 },
  571. sm: { span: 15 },
  572. }"
  573. prop="orderInfo.remark"
  574. >
  575. <a-textarea
  576. v-model="model.orderInfo.remark"
  577. rows="4"
  578. placeholder="订单备注"
  579. />
  580. </a-form-model-item>
  581. </a-col>
  582. </div>
  583. <div style="width: 43%">
  584. <div
  585. style="
  586. display: flex;
  587. justify-content: space-between;
  588. align-items: center;
  589. "
  590. >
  591. <h4
  592. style="
  593. color: rgba(255, 141, 26, 1);
  594. font-weight: 600;
  595. margin-top: 15px;
  596. "
  597. >
  598. 财务信息
  599. </h4>
  600. <div>
  601. <a-switch v-model="depositSplit" />押金均摊记账到每个房间
  602. </div>
  603. </div>
  604. <a-divider />
  605. <a-table
  606. :columns="columns"
  607. :data-source="model.roomPrices"
  608. :pagination="false"
  609. rowKey="id"
  610. :scroll="{ y: 200, x: 500 }"
  611. >
  612. <template slot="prefPrice" slot-scope="text, record, index">
  613. <editable-cell
  614. :text="text"
  615. @change="onCellChange('prefPrice', index, $event)"
  616. />
  617. </template>
  618. </a-table>
  619. <div
  620. style="
  621. color: rgba(255, 87, 51, 1);
  622. font-weight: 600;
  623. text-align: right;
  624. "
  625. >
  626. 合计应收:{{ amount.toFixed(2) }}
  627. </div>
  628. <div
  629. style="
  630. display: flex;
  631. justify-content: space-between;
  632. align-items: center;
  633. margin-top: 30px;
  634. "
  635. >
  636. <!-- <h4
  637. style="
  638. color: rgba(255, 141, 26, 1);
  639. font-weight: 600;
  640. margin-top: 15px;
  641. "
  642. >
  643. 收款
  644. </h4> -->
  645. <a-tabs
  646. default-active-key="1"
  647. @change="paymentTabsChange"
  648. :tabBarStyle="{ fontWeight: 600 }"
  649. >
  650. <a-tab-pane key="1" tab="收款">
  651. <a-table
  652. :columns="columns2"
  653. :data-source="model.orderFees"
  654. :pagination="false"
  655. rowKey="id"
  656. :scroll="{ y: 160 }"
  657. >
  658. <template
  659. slot="subjectTypeLabel"
  660. slot-scope="text, record, index"
  661. >
  662. <div>
  663. <!-- <a-input
  664. style="margin: -5px 0"
  665. :value="text"
  666. @change="
  667. (e) => handleChange(e.target.value, index, 'subjectTypeLabel')
  668. "
  669. /> -->
  670. <a-select
  671. v-model="model.orderFees[index].subjectType"
  672. placeholder="费项"
  673. >
  674. <a-select-option :value="2">
  675. 房费
  676. </a-select-option>
  677. <a-select-option :value="1">
  678. 押金
  679. </a-select-option>
  680. </a-select>
  681. </div>
  682. </template>
  683. <template
  684. slot="payType"
  685. slot-scope="text, record, index"
  686. >
  687. <div>
  688. <a-select
  689. v-model="model.orderFees[index].payType"
  690. placeholder="收款方式"
  691. >
  692. <a-select-option
  693. :value="item.id"
  694. v-for="item in payTypeList"
  695. :key="item.id"
  696. >
  697. {{ item.name }}
  698. </a-select-option>
  699. </a-select>
  700. </div>
  701. </template>
  702. <template slot="money" slot-scope="text, record, index">
  703. <div>
  704. <a-input-number
  705. v-model="record.money"
  706. :min="1"
  707. @change="presetNumChange($event, record)"
  708. />
  709. </div>
  710. </template>
  711. </a-table>
  712. <div
  713. style="color: rgba(255, 141, 26, 1); font-weight: 200"
  714. >
  715. <!-- <p style="margin-bottom: 2px">
  716. 实收:支付宝600.00元;微信292.00元;现金1000.00元;会员卡400元。
  717. </p> -->
  718. <p style="margin-bottom: 2px">
  719. 合计实款:{{ orderFeesAmout.toFixed(2) }}
  720. </p>
  721. </div>
  722. <div
  723. style="color: rgba(255, 87, 51, 1); font-weight: 200"
  724. >
  725. <p v-if="orderFeesArrearsAmout < 0">
  726. 欠费:{{ orderFeesArrearsAmout.toFixed(2) }}元
  727. </p>
  728. </div>
  729. </a-tab-pane>
  730. <a-tab-pane key="2" tab="信用卡预授权">
  731. <a-row
  732. v-for="(item, index) in payPalModel.list"
  733. :key="index"
  734. >
  735. <a-col :span="9">
  736. <a-form-model-item
  737. :labelCol="{
  738. xs: { span: 24 },
  739. sm: { span: 5 },
  740. }"
  741. :wrapperCol="{
  742. xs: { span: 24 },
  743. sm: { span: 22 },
  744. }"
  745. prop="key1"
  746. >
  747. <a-input
  748. v-model="item.key1"
  749. placeholder="银行卡号"
  750. ></a-input>
  751. </a-form-model-item>
  752. </a-col>
  753. <a-col :span="9">
  754. <a-form-model-item
  755. :labelCol="{
  756. xs: { span: 24 },
  757. sm: { span: 5 },
  758. }"
  759. :wrapperCol="{
  760. xs: { span: 24 },
  761. sm: { span: 22 },
  762. }"
  763. prop="key2"
  764. >
  765. <a-input
  766. v-model="item.key2"
  767. placeholder="预授权号"
  768. :min="1"
  769. ></a-input>
  770. </a-form-model-item>
  771. </a-col>
  772. <a-col :span="6">
  773. <a-form-model-item
  774. :labelCol="{
  775. xs: { span: 24 },
  776. sm: { span: 5 },
  777. }"
  778. :wrapperCol="{
  779. xs: { span: 24 },
  780. sm: { span: 22 },
  781. }"
  782. prop="key3"
  783. >
  784. <a-input-number
  785. v-model="item.key3"
  786. placeholder="金额"
  787. :min="1"
  788. ></a-input-number>
  789. </a-form-model-item>
  790. </a-col>
  791. </a-row>
  792. </a-tab-pane>
  793. <div slot="tabBarExtraContent">
  794. <a-switch v-model="paymentSplit" />押金、房费分开收款
  795. <a-button type="link" @click="pulsFee">
  796. 添加费项
  797. </a-button>
  798. </div>
  799. </a-tabs>
  800. </div>
  801. </div>
  802. </div>
  803. </div>
  804. </a-row>
  805. </a-form-model>
  806. </j-form-container>
  807. <select-room-form-modal
  808. ref="modalSelectRoomForm"
  809. @ok="modalFormOk"
  810. ></select-room-form-modal>
  811. </a-spin>
  812. </template>
  813. <script>
  814. import { httpAction, getAction, postAction } from "@/api/manage";
  815. import { validateDuplicateValue } from "@/utils/util";
  816. import moment from "moment";
  817. import EditableCell from "./EditableCell.vue";
  818. import SelectRoomFormModal from "./SelectRoomFormModal.vue";
  819. const columns = [
  820. // {
  821. // title: "",
  822. // dataIndex: "key",
  823. // width: 20,
  824. // },
  825. {
  826. title: "房间号",
  827. dataIndex: "roomNo",
  828. width: 70,
  829. },
  830. {
  831. title: "房型",
  832. dataIndex: "layoutName",
  833. width: 80,
  834. },
  835. {
  836. title: "门市价",
  837. dataIndex: "marketPrice",
  838. width: 60,
  839. },
  840. {
  841. title: "优惠价",
  842. dataIndex: "prefPrice",
  843. width: 120,
  844. scopedSlots: { customRender: "prefPrice" },
  845. },
  846. {
  847. title: "天数",
  848. dataIndex: "day",
  849. width: 60,
  850. },
  851. {
  852. title: "房费",
  853. dataIndex: "roomFee",
  854. width: 80,
  855. },
  856. {
  857. title: "押金",
  858. dataIndex: "deposit",
  859. // width: 60,
  860. },
  861. ];
  862. const columns2 = [
  863. {
  864. title: "费项",
  865. dataIndex: "subjectType",
  866. width: "25%",
  867. scopedSlots: { customRender: "subjectTypeLabel" },
  868. },
  869. {
  870. title: "收款方式",
  871. dataIndex: "payType",
  872. width: "25%",
  873. scopedSlots: { customRender: "payType" },
  874. },
  875. {
  876. title: "应缴",
  877. dataIndex: "receivable",
  878. width: "25%",
  879. },
  880. {
  881. title: "实收",
  882. dataIndex: "money",
  883. width: "25%",
  884. scopedSlots: { customRender: "money" },
  885. },
  886. ];
  887. const data = [];
  888. for (let i = 0; i < 2; i++) {
  889. data.push({
  890. id: i,
  891. key1: `100${i}`,
  892. key2: "双人床",
  893. key3: 298,
  894. key4: 298,
  895. key5: 2,
  896. key6: 298,
  897. key7: 298,
  898. });
  899. }
  900. const data2 = [];
  901. for (let i = 0; i < 2; i++) {
  902. data2.push({
  903. id: i,
  904. key1: "押金",
  905. key2: "支付宝",
  906. key3: 298,
  907. key4: 298,
  908. });
  909. }
  910. const panes = [
  911. { roomNo: "1001", content: "", id: "1001" },
  912. { roomNo: "1002", content: "", id: "1002" },
  913. ];
  914. const date = new Date();
  915. const endDate = new Date(date.setDate(date.getDate() + 1));
  916. export default {
  917. name: "BillRoomForm",
  918. components: { EditableCell, SelectRoomFormModal },
  919. props: {
  920. //表单禁用
  921. disabled: {
  922. type: Boolean,
  923. default: false,
  924. required: false,
  925. },
  926. },
  927. data() {
  928. return {
  929. payPalModel: { list: [{ key1: "", key2: "", key3: "" }] },
  930. depositSplit: true,
  931. paymentSplit: true,
  932. activeKey: "",
  933. newTabIndex: 0,
  934. selectedRowKeys: [],
  935. // data,
  936. columns,
  937. // data2,
  938. columns2,
  939. wakeList: [{}],
  940. // model: { rooms: panes, data: data, data2: data2 },
  941. modelDefault: {},
  942. model: {
  943. // data: data,
  944. orderInfo: {
  945. rooms: panes,
  946. data: data,
  947. data2: data2,
  948. bookingOrdersType: 1,
  949. arrivalTime2: moment(new Date()).format("YYYY-MM-DD"),
  950. dueOutTime2: moment(endDate).format("YYYY-MM-DD"),
  951. arrivalTimeSpan: moment("18:00", "HH:mm"),
  952. dueOutTimeSpan: moment("12:00", "HH:mm"),
  953. bookingType: 1,
  954. dayCount: 1,
  955. warrantType: 1,
  956. hourRoomId: "",
  957. breakfastNum: 0,
  958. vipCustomerId: "",
  959. },
  960. roomIds: [],
  961. livingRoomDayPrices: [],
  962. roomPrices: [],
  963. orderFees: [],
  964. },
  965. labelCol: {
  966. xs: { span: 24 },
  967. sm: { span: 7 },
  968. },
  969. wrapperCol: {
  970. xs: { span: 24 },
  971. sm: { span: 16 },
  972. },
  973. confirmLoading: false,
  974. validatorRules: {
  975. "orderInfo.bookingType": [
  976. { required: true, message: "请选择入住类型!" },
  977. ],
  978. "orderInfo.arrivalTime2": [
  979. { required: true, message: "请选择入住时间!" },
  980. ],
  981. "orderInfo.dueOutTime2": [
  982. { required: true, message: "请选择预离时间!" },
  983. ],
  984. "orderInfo.customerSource": [
  985. { required: true, message: "请选择客人来源!" },
  986. ],
  987. "orderInfo.bookingDicWay": [
  988. { required: true, message: "请选择预定方式!" },
  989. ],
  990. "orderInfo.customerType": [
  991. { required: true, message: "请选择客人类型!" },
  992. ],
  993. contactName: [{ required: true, message: "请输入联系人!" }],
  994. phone: [{ required: true, message: "请输入电话!" }],
  995. },
  996. url: {
  997. add: "business/busRoomBookingOrders/living",
  998. edit: "business/busRoomBookingOrders/living",
  999. queryById: "/business/busMeetingRoom/queryById",
  1000. },
  1001. result: [],
  1002. selectIndex: 0,
  1003. customerSourceList: [],
  1004. bookingdicWayList: [],
  1005. warranterList: [],
  1006. hourRoomRuleList: [],
  1007. canUserRooms: [],
  1008. customerList: [],
  1009. oldcustomerList: [],
  1010. depositRule: {},
  1011. roomLayoutList: [],
  1012. amount: 0,
  1013. roomIdsIndex: 0,
  1014. busMemberCardList: [],
  1015. payTypeList: [],
  1016. };
  1017. },
  1018. computed: {
  1019. formDisabled() {
  1020. return this.disabled;
  1021. },
  1022. orderFeesAmout() {
  1023. var sum = 0;
  1024. this.model.orderFees.forEach((item) => {
  1025. sum += item.money;
  1026. });
  1027. return sum;
  1028. },
  1029. orderFeesArrearsAmout() {
  1030. return this.orderFeesAmout - this.amount;
  1031. },
  1032. },
  1033. created() {
  1034. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  1035. if (_info) {
  1036. this.model.hotelId = _info.id;
  1037. }
  1038. //备份model原始值
  1039. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  1040. getAction("/business/busDictItem/list", {
  1041. hotelId: _info.id,
  1042. dictId: "1639538915239743490",
  1043. }).then((res) => {
  1044. if (res.success) {
  1045. this.customerSourceList = res.result.records;
  1046. }
  1047. });
  1048. getAction("/business/busDictItem/list", {
  1049. hotelId: _info.id,
  1050. dictId: "1639544187093995521",
  1051. }).then((res) => {
  1052. if (res.success) {
  1053. this.bookingdicWayList = res.result.records;
  1054. }
  1055. });
  1056. getAction("/business/busSalesPerson/list", {
  1057. hotelId: _info.id,
  1058. pageNo: 1,
  1059. pageSize: 100,
  1060. }).then((res) => {
  1061. if (res.success) {
  1062. this.warranterList = res.result.records;
  1063. }
  1064. });
  1065. getAction("/rooms/cesHourRoomRule/list", {
  1066. pageNo: 1,
  1067. pageSize: 100,
  1068. }).then((res) => {
  1069. if (res.success) {
  1070. this.hourRoomRuleList = res.result.records;
  1071. }
  1072. });
  1073. getAction("/bus/busCustomer/list", {}).then((res) => {
  1074. if (res.success) {
  1075. this.customerList = res.result.records;
  1076. this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
  1077. }
  1078. });
  1079. getAction("/business/busDepositSetting/queryByHotelId", {
  1080. hotelId: _info.id,
  1081. }).then((res) => {
  1082. if (res.success) {
  1083. this.depositRule = res.result;
  1084. }
  1085. });
  1086. getAction("/business/busMemberCard/list", {
  1087. pageSize: 99999,
  1088. pageNo: 1,
  1089. }).then((res) => {
  1090. if (res.success) {
  1091. this.busMemberCardList = res.result.records;
  1092. }
  1093. });
  1094. postAction("/rooms/cesAllDayPriceRule/fetch", { hotelId: _info.id }).then(
  1095. (res) => {
  1096. if (res.success) {
  1097. if (
  1098. res.result &&
  1099. res.result.cesAllDayPriceRule &&
  1100. res.result.cesAllDayPriceRule.leaveTime
  1101. ) {
  1102. this.model.orderInfo.dueOutTimeSpan = moment(
  1103. res.result.cesAllDayPriceRule.leaveTime,
  1104. "HH:mm"
  1105. );
  1106. }
  1107. }
  1108. this.loadRooms();
  1109. }
  1110. );
  1111. // this.getcesRoomLayout();
  1112. },
  1113. methods: {
  1114. presetNumChange(e, record) {
  1115. console.log(e, record);
  1116. },
  1117. async getcesRoomLayout() {
  1118. await getAction("/rooms/cesRoomLayout/list", {
  1119. pageSize: 99999,
  1120. pageNo: 1,
  1121. }).then((res) => {
  1122. if (res.success) {
  1123. this.roomLayoutList = res.result.records;
  1124. console.log("roomLayoutList");
  1125. }
  1126. });
  1127. },
  1128. async getbusRoomPayType() {
  1129. await getAction("/business/busRoomPayType/list", {
  1130. pageSize: 99999,
  1131. pageNo: 1,
  1132. }).then((res) => {
  1133. if (res.success) {
  1134. this.payTypeList = res.result.records;
  1135. }
  1136. });
  1137. },
  1138. roomPriceSlnIdChange(e) {
  1139. this.model.orderInfo.vipCustomerId = e;
  1140. },
  1141. loadRooms() {
  1142. // this.model.roomPrices = [];
  1143. // this.model.roomIds = [];
  1144. this.amount = 0;
  1145. getAction("/rooms/cesRooms/can-user-rooms", {
  1146. startOf:
  1147. this.model.orderInfo.arrivalTime2 +
  1148. " " +
  1149. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm"),
  1150. endOf:
  1151. this.model.orderInfo.dueOutTime2 +
  1152. " " +
  1153. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm"),
  1154. bookingType: this.model.orderInfo.bookingType,
  1155. hourRoomRuleId: this.model.orderInfo.hourRoomId,
  1156. cancelLayout: true,
  1157. }).then((res) => {
  1158. if (res.success) {
  1159. res.result.forEach((t) => {
  1160. // t.layout = Object.assign({}, t.layout, {
  1161. // presetNum: 0,
  1162. // oldTags: t.layout.canUseCount,
  1163. // });
  1164. t.buildingRooms.forEach((b) => {
  1165. b.floorRooms.forEach((f) => {
  1166. this.$set(f, "check", 0);
  1167. });
  1168. });
  1169. });
  1170. this.canUserRooms = res.result;
  1171. }
  1172. });
  1173. },
  1174. hourRoomIdChange() {
  1175. if (this.model.orderInfo.bookingType === 2) {
  1176. var find = this.hourRoomRuleList.find(
  1177. (t) => t.id === this.model.orderInfo.hourRoomId
  1178. );
  1179. if (find) {
  1180. var mDate = moment(
  1181. this.model.orderInfo.arrivalTime2 +
  1182. " " +
  1183. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1184. ).add(find.afterOpenRoom, "minutes");
  1185. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1186. this.model.orderInfo.dueOutTimeSpan = moment(
  1187. mDate.format("HH:mm"),
  1188. "HH:mm"
  1189. );
  1190. }
  1191. }
  1192. this.loadRooms();
  1193. },
  1194. bookingTypeChange(e) {
  1195. if (this.model.orderInfo.bookingType == 1) {
  1196. this.model.orderInfo.hourRoomId = "";
  1197. } else {
  1198. var hourRoomRule = this.hourRoomRuleList[0];
  1199. if (hourRoomRule) {
  1200. this.model.orderInfo.hourRoomId = hourRoomRule.id;
  1201. }
  1202. }
  1203. if (this.model.orderInfo.bookingType === 2) {
  1204. var find = this.hourRoomRuleList.find(
  1205. (t) => t.id === this.model.orderInfo.hourRoomId
  1206. );
  1207. if (find) {
  1208. var mDate = moment(
  1209. this.model.orderInfo.arrivalTime2 +
  1210. " " +
  1211. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1212. ).add(find.afterOpenRoom, "minutes");
  1213. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1214. this.model.orderInfo.dueOutTimeSpan = moment(
  1215. mDate.format("HH:mm"),
  1216. "HH:mm"
  1217. );
  1218. }
  1219. } else if (this.model.orderInfo.bookingType === 1) {
  1220. var mDate = moment(this.model.orderInfo.arrivalTime2).add(1, "days");
  1221. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1222. }
  1223. this.loadRooms();
  1224. },
  1225. dayCountChange(e) {
  1226. this.model.orderInfo.dueOutTime2 = moment(
  1227. this.model.orderInfo.arrivalTime2
  1228. )
  1229. .add(e, "days")
  1230. .format("YYYY-MM-DD");
  1231. this.loadRooms();
  1232. },
  1233. disabledDate(current) {
  1234. return current && current < moment().add(-1, "days").endOf("day");
  1235. },
  1236. arrivalTimeChange(e) {
  1237. var v = parseInt(
  1238. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1239. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1240. (1000 * 60 * 60 * 24)
  1241. );
  1242. if (v <= 0) {
  1243. this.model.orderInfo.dueOutTime2 = moment(
  1244. this.model.orderInfo.arrivalTime2
  1245. )
  1246. .add(1, "days")
  1247. .format("YYYY-MM-DD");
  1248. }
  1249. v = parseInt(
  1250. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1251. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1252. (1000 * 60 * 60 * 24)
  1253. );
  1254. this.model.orderInfo.dayCount = Math.abs(v);
  1255. this.loadRooms();
  1256. },
  1257. arrivalTimeChange2(e) {
  1258. var v = parseInt(
  1259. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1260. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1261. (1000 * 60 * 60 * 24)
  1262. );
  1263. if (v <= 0) {
  1264. this.model.orderInfo.arrivalTime2 = moment(
  1265. this.model.orderInfo.dueOutTime2
  1266. )
  1267. .add(-1, "days")
  1268. .format("YYYY-MM-DD");
  1269. }
  1270. v = parseInt(
  1271. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1272. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1273. (1000 * 60 * 60 * 24)
  1274. );
  1275. this.model.orderInfo.dayCount = Math.abs(v);
  1276. this.loadRooms();
  1277. },
  1278. arrivalTimeSpanChange(m, time) {
  1279. console.log(time);
  1280. console.log(moment(m).format("HH:mm"));
  1281. if (this.model.orderInfo.bookingType === 2) {
  1282. var find = this.hourRoomRuleList.find(
  1283. (t) => t.id === this.model.orderInfo.hourRoomId
  1284. );
  1285. if (find) {
  1286. var mDate = moment(
  1287. this.model.orderInfo.arrivalTime2 +
  1288. " " +
  1289. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1290. ).add(find.afterOpenRoom, "minutes");
  1291. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1292. this.model.orderInfo.dueOutTimeSpan = moment(
  1293. mDate.format("HH:mm"),
  1294. "HH:mm"
  1295. );
  1296. }
  1297. }
  1298. this.loadRooms();
  1299. },
  1300. handleSearch(value) {
  1301. let result;
  1302. if (!value) {
  1303. result = this.oldcustomerList;
  1304. } else {
  1305. result = this.oldcustomerList.filter((t) => t.name.includes(value));
  1306. }
  1307. this.customerList = result;
  1308. },
  1309. handleSelectMember(room, e) {
  1310. var find = this.customerList.find((t) => t.id === e);
  1311. room.key1 = find.name;
  1312. room.key2 = 1;
  1313. room.key3 = "汉";
  1314. // room.key4 = find.phone;
  1315. room.key5 = find.phone;
  1316. // room.key6 = "火星";
  1317. this.$set(room, "customerId", find.id);
  1318. },
  1319. pulsRoom() {
  1320. this.$refs.modalSelectRoomForm.add(this.canUserRooms);
  1321. this.$refs.modalSelectRoomForm.title = "选择房间";
  1322. this.$refs.modalSelectRoomForm.disableSubmit = false;
  1323. },
  1324. paymentTabsChange(e) {},
  1325. pulsFee() {
  1326. var payType = this.payTypeList[0];
  1327. this.model.orderFees.push({
  1328. subjectType: 2,
  1329. subjectTypeLabel: "预收房费",
  1330. payType: payType ? payType.id : "",
  1331. payTypeLabel: payType ? payType.name : "",
  1332. receivable: 0,
  1333. money: 0,
  1334. roomId: this.model.orderFees[0].roomId,
  1335. });
  1336. },
  1337. onCellChange(key, dataIndex, value) {
  1338. const dataSource = [...this.model.roomPrices];
  1339. const target = dataSource[dataIndex];
  1340. console.log("target", target);
  1341. if (target) {
  1342. target[key] = value;
  1343. target.roomFee = value * target.day;
  1344. target.deposit = this.compuleDeposit(value);
  1345. this.model.roomPrices = dataSource;
  1346. }
  1347. var sum = 0;
  1348. this.model.roomPrices.forEach(function (item) {
  1349. sum += item.roomFee + item.deposit;
  1350. });
  1351. this.amount = sum;
  1352. console.log("this.model.roomPrices", this.model.roomPrices);
  1353. },
  1354. // handleChange(value, index, column) {
  1355. // const newData = [...this.data2];
  1356. // const target = newData[index];
  1357. // if (target) {
  1358. // target[column] = value;
  1359. // this.data2 = newData;
  1360. // }
  1361. // },
  1362. onEdit(targetKey, action) {
  1363. this[action](targetKey);
  1364. },
  1365. add() {
  1366. console.log(1);
  1367. const panes = this.panes;
  1368. const activeKey = `newTab${this.newTabIndex++}`;
  1369. panes.push({
  1370. title: `New Tab ${activeKey}`,
  1371. content: "",
  1372. key: activeKey,
  1373. });
  1374. this.panes = panes;
  1375. this.activeKey = activeKey;
  1376. },
  1377. onSelectChange(selectedRowKeys, selectionRows) {
  1378. this.selectedRowKeys = selectedRowKeys;
  1379. this.selectionRows = selectionRows;
  1380. },
  1381. handleAdd() {},
  1382. puls(room) {
  1383. if (!room.livingCustomers2) {
  1384. this.$set(room, "livingCustomers2", [
  1385. { gender: 1, certType: 1, roomId: room.id },
  1386. ]);
  1387. } else {
  1388. room.livingCustomers2.push({ gender: 1, certType: 1, roomId: room.id });
  1389. }
  1390. },
  1391. remove(room, index) {
  1392. room.livingCustomers2.splice(index, 1);
  1393. },
  1394. moment,
  1395. onChange(e) {
  1396. console.log(e);
  1397. },
  1398. add2(roomLive) {
  1399. this.modelDefault = Object.assign({}, this.modelDefault, {
  1400. roomIds: [roomLive],
  1401. });
  1402. this.edit(this.modelDefault);
  1403. },
  1404. editTabs(e) {
  1405. console.log("editTabs", e);
  1406. var index = this.model.roomIds.findIndex((t) => t.id == e);
  1407. this.model.roomIds.splice(index, 1);
  1408. },
  1409. tabClick(e) {
  1410. console.log("tabClick", e);
  1411. var index = this.model.roomIds.findIndex((t) => t.id == e);
  1412. this.roomIdsIndex = index;
  1413. },
  1414. modalFormOk(e) {
  1415. console.log("e", e);
  1416. this.modelDefault = Object.assign({}, this.modelDefault, {
  1417. roomIds: e,
  1418. });
  1419. this.edit(this.modelDefault);
  1420. },
  1421. compuleDeposit(prefPrice) {
  1422. var deposit = 0;
  1423. if (this.depositRule) {
  1424. if (this.depositRule.depositType === 1) {
  1425. deposit = prefPrice * this.depositRule.depositMultiple;
  1426. } else if (this.depositRule.depositType === 2) {
  1427. deposit = prefPrice + this.depositRule.depositMultiple;
  1428. } else if (this.depositRule.depositType === 3) {
  1429. deposit = this.depositRule.depositMoney;
  1430. }
  1431. }
  1432. return deposit;
  1433. },
  1434. getSubjectTypeLabel(value) {
  1435. switch (value) {
  1436. case 1:
  1437. return "押金";
  1438. case 2:
  1439. return "预收房费";
  1440. default:
  1441. return "";
  1442. }
  1443. },
  1444. addList(roomLiveList, key) {
  1445. console.log("roomLiveList", roomLiveList);
  1446. this.modelDefault = Object.assign({}, this.modelDefault, {
  1447. roomIds: roomLiveList,
  1448. });
  1449. this.modelDefault.orderInfo.bookingOrdersType = key;
  1450. this.edit(this.modelDefault);
  1451. },
  1452. async edit(record) {
  1453. console.log("edit");
  1454. this.visible = true;
  1455. this.model = Object.assign({}, record);
  1456. console.log("this.model", this.model);
  1457. if (this.roomLayoutList.length === 0) {
  1458. await this.getcesRoomLayout();
  1459. }
  1460. if (this.payTypeList == 0) {
  1461. await this.getbusRoomPayType();
  1462. }
  1463. if (this.model.roomIds && this.model.roomIds.length > 0) {
  1464. this.activeKey = this.model.roomIds[0].id;
  1465. var roomPrices = [];
  1466. var orderFees = [];
  1467. this.model.roomIds.forEach((item) => {
  1468. var roomLayout = this.roomLayoutList.find(
  1469. (t) => (t.id = item.layoutId)
  1470. );
  1471. roomPrices.push({
  1472. roomNo: item.name,
  1473. roomId: item.id,
  1474. marketPrice: item.marketPrice,
  1475. prefPrice: item.marketPrice,
  1476. day: this.model.orderInfo.dayCount,
  1477. roomFee: item.marketPrice * this.model.orderInfo.dayCount,
  1478. deposit: this.compuleDeposit(item.marketPrice),
  1479. layoutName: roomLayout ? roomLayout.name : "",
  1480. layoutId: item.layoutId,
  1481. });
  1482. var payType = this.payTypeList[0];
  1483. orderFees.push({
  1484. subjectType: 2,
  1485. subjectTypeLabel: "预收房费",
  1486. payType: payType ? payType.id : "",
  1487. payTypeLabel: payType ? payType.name : "",
  1488. receivable: item.marketPrice,
  1489. money: item.marketPrice,
  1490. roomId: item.id,
  1491. });
  1492. var deposit = this.compuleDeposit(item.marketPrice);
  1493. if (deposit > 0) {
  1494. orderFees.push({
  1495. subjectType: 1,
  1496. subjectTypeLabel: "押金",
  1497. payType: payType ? payType.id : "",
  1498. payTypeLabel: payType ? payType.name : "",
  1499. receivable: deposit,
  1500. money: deposit,
  1501. roomId: item.id,
  1502. });
  1503. }
  1504. });
  1505. this.model.roomPrices = roomPrices;
  1506. var sum = 0;
  1507. this.model.roomPrices.forEach(function (item) {
  1508. sum += item.roomFee + item.deposit;
  1509. });
  1510. this.amount = sum;
  1511. this.model.orderFees = orderFees;
  1512. console.log("this.model", this.model);
  1513. }
  1514. // console.log("this.amount2", JSON.stringify(this.amount));
  1515. },
  1516. submitForm() {
  1517. const that = this;
  1518. that.model.livingRoomDayPrices = [];
  1519. console.log("that.model.roomPrices", that.model.roomPrices);
  1520. that.model.roomPrices.forEach((t) => {
  1521. for (var b = 0; b < that.model.orderInfo.dayCount; b++) {
  1522. var dayTime = moment(this.model.orderInfo.arrivalTime2)
  1523. .add(b, "days")
  1524. .format("YYYY-MM-DD");
  1525. that.model.livingRoomDayPrices.push({
  1526. livingType: 1,
  1527. dayTime: dayTime,
  1528. price: t.prefPrice,
  1529. roomLayoutId: t.layoutId,
  1530. roomId: t.roomId,
  1531. });
  1532. }
  1533. });
  1534. that.model.roomIds.forEach((t) => {
  1535. t.roomId = t.id;
  1536. var obj = {
  1537. certNo: t.key4,
  1538. certType: 1,
  1539. customerId: t.customerId,
  1540. customerName: t.key1,
  1541. gender: t.key2,
  1542. phone: t.key5,
  1543. roomId: t.id,
  1544. };
  1545. if (!t.livingCustomers2 || t.livingCustomers2.length == 0) {
  1546. t.livingCustomers = [obj];
  1547. } else {
  1548. t.livingCustomers = [...[obj], ...t.livingCustomers2];
  1549. }
  1550. });
  1551. console.log("this.model", this.model);
  1552. if (that.model.roomIds.length <= 0) {
  1553. that.$message.warning("请先添加房间");
  1554. return;
  1555. }
  1556. // 触发表单验证
  1557. this.$refs.form.validate((valid, err) => {
  1558. if (valid) {
  1559. this.model.orderInfo.arrivalTime =
  1560. this.model.orderInfo.arrivalTime2 +
  1561. " " +
  1562. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm");
  1563. this.model.orderInfo.dueOutTime =
  1564. this.model.orderInfo.dueOutTime2 +
  1565. " " +
  1566. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm");
  1567. that.confirmLoading = true;
  1568. let httpurl = "";
  1569. let method = "";
  1570. if (!this.model.id) {
  1571. httpurl += this.url.add;
  1572. method = "post";
  1573. } else {
  1574. httpurl += this.url.edit;
  1575. method = "put";
  1576. }
  1577. // if (this.model.orderInfo.bookingOrdersId) {
  1578. // httpurl = "/business/busRoomBookingOrders/add-batch";
  1579. // method = "post";
  1580. // }
  1581. httpAction(httpurl, this.model, method)
  1582. .then((res) => {
  1583. if (res.success) {
  1584. that.$message.success(res.message);
  1585. that.$emit("ok", res.result);
  1586. } else {
  1587. if (res.message.indexOf("与预约时间有冲突") >= 0) {
  1588. that.$confirm({
  1589. title: "提示",
  1590. content: res.message + "是否确定入住?",
  1591. onOk: function () {
  1592. that.model.confirm = true;
  1593. httpAction(httpurl, that.model, method)
  1594. .then((res) => {
  1595. if (res.success) {
  1596. that.$message.success(res.message);
  1597. that.$emit("ok", res.result);
  1598. } else {
  1599. if (res.message.indexOf("与预约时间有冲突") >= 0) {
  1600. } else {
  1601. that.$message.warning(res.message);
  1602. }
  1603. }
  1604. })
  1605. .finally(() => {
  1606. that.confirmLoading = false;
  1607. });
  1608. },
  1609. });
  1610. } else {
  1611. that.$message.warning(res.message);
  1612. }
  1613. }
  1614. })
  1615. .finally(() => {
  1616. that.confirmLoading = false;
  1617. });
  1618. } else {
  1619. console.log(err);
  1620. var keys = Object.keys(err);
  1621. console.log("keys", keys);
  1622. var some = keys.some(
  1623. (t) => t.indexOf("roomIds[" + this.roomIdsIndex + "]") >= 0
  1624. );
  1625. if (!some) {
  1626. this.$message.warning("请输入其他房间必填信息");
  1627. }
  1628. }
  1629. });
  1630. },
  1631. },
  1632. };
  1633. </script>
  1634. <style scoped>
  1635. /deep/ .ant-btn-link {
  1636. flex: 1;
  1637. color: rgba(255, 141, 26, 1) !important;
  1638. }
  1639. /deep/ .ant-btn-background-ghost {
  1640. color: rgba(0, 0, 0, 0.45) !important;
  1641. }
  1642. .menu {
  1643. display: flex;
  1644. flex-direction: column;
  1645. flex: 1;
  1646. color: #fff;
  1647. margin-top: 12px;
  1648. }
  1649. .dynamic-delete-button {
  1650. cursor: pointer;
  1651. position: relative;
  1652. /* top: 4px; */
  1653. margin-left: 5px;
  1654. font-size: 18px;
  1655. color: #1890ff;
  1656. transition: all 0.3s;
  1657. }
  1658. .dynamic-delete-button:hover {
  1659. color: #777;
  1660. }
  1661. .dynamic-delete-button[disabled] {
  1662. cursor: not-allowed;
  1663. opacity: 0.5;
  1664. }
  1665. /deep/.ant-table-thead > tr > th {
  1666. background: rgba(42, 130, 228, 1);
  1667. color: #ffffff;
  1668. }
  1669. /deep/.ant-divider-horizontal {
  1670. margin: 12px 0 !important;
  1671. }
  1672. /deep/ .ant-table-tbody .ant-table-row td {
  1673. padding-top: 5px;
  1674. padding-bottom: 5px;
  1675. }
  1676. /deep/.ant-table-thead > tr > th,
  1677. .ant-table-tbody > tr > td {
  1678. padding: 5px 5px !important;
  1679. overflow-wrap: break-word;
  1680. }
  1681. /deep/ .ant-form-item {
  1682. margin-bottom: 5px !important;
  1683. }
  1684. /deep/ .ant-tabs-nav .ant-tabs-tab-active {
  1685. color: rgba(255, 141, 26, 1);
  1686. }
  1687. /deep/.ant-tabs-nav .ant-tabs-tab:hover {
  1688. color: rgba(255, 141, 26, 1);
  1689. }
  1690. /deep/.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active {
  1691. color: rgba(255, 141, 26, 1);
  1692. }
  1693. </style>