BillRoomForm.vue 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539
  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. "
  35. >
  36. 宾客信息
  37. </h4>
  38. <div><a-switch v-model="otherRoomSync" />附属房间录入信息</div>
  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="12">
  72. <a-form-model-item
  73. label="姓名"
  74. :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
  75. :wrapperCol="{
  76. xs: { span: 24 },
  77. sm: { span: 16 },
  78. }"
  79. :prop="`roomIds[${aindex}].key1`"
  80. :rules="[
  81. {
  82. required: true,
  83. message: '请输入姓名!',
  84. trigger: 'change',
  85. },
  86. ]"
  87. >
  88. <a-auto-complete style="width: 60%;"
  89. v-model="room.key1"
  90. placeholder="请输入姓名"
  91. @search="handleSearch"
  92. @select="(e) => handleSelectMember(room, e)"
  93. >
  94. <template slot="dataSource">
  95. <a-select-option
  96. v-for="item in customerList"
  97. :key="item.id"
  98. >{{ item.name }}-{{ item.phone }}</a-select-option
  99. >
  100. </template>
  101. </a-auto-complete>
  102. <a-icon type="contacts" style="font-size: 18px;margin-left: 5px;" @click="readCardNo" />
  103. <span style="cursor: pointer;" v-if="room.busMemberCard&&room.busMemberCard.id" @click="showMemberCard(room.busMemberCard)">会员</span>
  104. <span style="cursor: pointer;" v-if="room.busMarketAgreementUnit&&room.busMarketAgreementUnit.id" @click="showAgreementUnit(room.busMarketAgreementUnit)"> 协议</span>
  105. <span style="cursor: pointer;" v-if="room.ruZhuHistory&&room.ruZhuHistory.phone" @click="showRuZhuHistory(room.ruZhuHistory.phone)"> 客史</span>
  106. </a-form-model-item>
  107. </a-col>
  108. <a-col :span="6">
  109. <a-form-model-item
  110. label="性别"
  111. :labelCol="labelCol"
  112. :wrapperCol="wrapperCol"
  113. :prop="`roomIds[${aindex}].key2`"
  114. :rules="[
  115. {
  116. required: true,
  117. message: '请选择性别!',
  118. trigger: 'change',
  119. },
  120. ]"
  121. >
  122. <a-select v-model="room.key2" placeholder="请选择性别">
  123. <a-select-option :value="1"> 男 </a-select-option>
  124. <a-select-option :value="2"> 女 </a-select-option>
  125. </a-select>
  126. </a-form-model-item>
  127. </a-col>
  128. <a-col :span="6">
  129. <a-form-model-item
  130. label="民族"
  131. :labelCol="labelCol"
  132. :wrapperCol="wrapperCol"
  133. :prop="`roomIds[${aindex}].key3`"
  134. :rules="[
  135. {
  136. required: true,
  137. message: '请选择民族!',
  138. trigger: 'change',
  139. },
  140. ]"
  141. >
  142. <a-select v-model="room.key3" placeholder="请选择民族">
  143. <a-select-option value="汉"> 汉 </a-select-option>
  144. <a-select-option value="回"> 回 </a-select-option>
  145. </a-select>
  146. </a-form-model-item>
  147. </a-col>
  148. <a-col :span="16">
  149. <a-form-model-item
  150. label="身份证号"
  151. :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
  152. :wrapperCol="{
  153. xs: { span: 24 },
  154. sm: { span: 16 },
  155. }"
  156. :prop="`roomIds[${aindex}].key4`"
  157. :rules="[
  158. {
  159. required: true,
  160. message: '请输身份证号!',
  161. trigger: 'change',
  162. },
  163. ]"
  164. >
  165. <a-input
  166. v-model="room.key4"
  167. placeholder="请输身份证号"
  168. ></a-input>
  169. </a-form-model-item>
  170. </a-col>
  171. <a-col :span="8">
  172. <a-form-model-item
  173. label="手机号"
  174. :labelCol="labelCol"
  175. :wrapperCol="wrapperCol"
  176. :prop="`roomIds[${aindex}].key5`"
  177. :rules="[
  178. {
  179. required: true,
  180. message: '请输入手机号!',
  181. trigger: 'change',
  182. },
  183. ]"
  184. >
  185. <a-input
  186. v-model="room.key5"
  187. placeholder="请输入手机号"
  188. ></a-input>
  189. </a-form-model-item>
  190. </a-col>
  191. <a-col :span="24">
  192. <a-form-model-item
  193. label="联系地址"
  194. :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
  195. :wrapperCol="{
  196. xs: { span: 24 },
  197. sm: { span: 16 },
  198. }"
  199. prop="key6"
  200. >
  201. <a-input
  202. v-model="room.key6"
  203. placeholder="请输入联系地址"
  204. ></a-input>
  205. </a-form-model-item>
  206. </a-col>
  207. <a-col :span="24">
  208. <div
  209. style="display: flex; justify-content: space-between"
  210. >
  211. <div></div>
  212. <div>
  213. <a-button type="link" @click="puls(room)">
  214. 添加同住
  215. </a-button>
  216. <a-icon
  217. type="right"
  218. v-if="room.invalid"
  219. @click="room.invalid=false"
  220. />
  221. <a-icon type="down" v-else @click="room.invalid=true" />
  222. </div>
  223. </div>
  224. </a-col>
  225. <template v-for="(item, index) in room.livingCustomers2" v-if="!room.invalid">
  226. <a-col :span="4">
  227. <a-form-model-item
  228. :wrapperCol="{
  229. xs: { span: 24 },
  230. sm: { span: 22 },
  231. }"
  232. :prop="`roomIds[${aindex}].livingCustomers2[${index}].customerName`"
  233. :rules="[
  234. {
  235. required: true,
  236. message: '请输入姓名!',
  237. trigger: 'change',
  238. },
  239. ]"
  240. >
  241. <a-input
  242. v-model="item.customerName"
  243. placeholder="姓名"
  244. ></a-input>
  245. </a-form-model-item>
  246. </a-col>
  247. <a-col :span="4">
  248. <a-form-model-item
  249. :wrapperCol="{
  250. xs: { span: 24 },
  251. sm: { span: 22 },
  252. }"
  253. :prop="`roomIds[${aindex}].livingCustomers2[${index}].gender`"
  254. >
  255. <a-select placeholder="性别" v-model="item.gender">
  256. <a-select-option :value="1"> 男 </a-select-option>
  257. <a-select-option :value="2"> 女 </a-select-option>
  258. </a-select>
  259. </a-form-model-item>
  260. </a-col>
  261. <a-col :span="4">
  262. <a-form-model-item
  263. :wrapperCol="{
  264. xs: { span: 24 },
  265. sm: { span: 22 },
  266. }"
  267. :prop="`roomIds[${aindex}].livingCustomers2[${index}].certType`"
  268. >
  269. <a-select placeholder="证件" v-model="item.certType">
  270. <a-select-option :value="1">
  271. 身份证
  272. </a-select-option>
  273. <a-select-option :value="2"> 护照 </a-select-option>
  274. </a-select>
  275. </a-form-model-item>
  276. </a-col>
  277. <a-col :span="6">
  278. <a-form-model-item
  279. :wrapperCol="{
  280. xs: { span: 24 },
  281. sm: { span: 23 },
  282. }"
  283. :prop="`roomIds[${aindex}].livingCustomers2[${index}].certNo`"
  284. :rules="[
  285. {
  286. required: true,
  287. message: '请输入证件号!',
  288. trigger: 'change',
  289. },
  290. ]"
  291. >
  292. <a-input
  293. v-model="item.certNo"
  294. placeholder="证件号"
  295. ></a-input>
  296. </a-form-model-item>
  297. </a-col>
  298. <a-col :span="6">
  299. <a-form-model-item
  300. :wrapperCol="{
  301. xs: { span: 24 },
  302. sm: { span: 24 },
  303. }"
  304. :prop="`roomIds[${aindex}].livingCustomers2[${index}].phone`"
  305. :rules="[
  306. {
  307. required: true,
  308. message: '请输入手机号!',
  309. trigger: 'change',
  310. },
  311. ]"
  312. >
  313. <a-input
  314. v-model="item.phone"
  315. placeholder="手机号"
  316. style="width: 120px"
  317. ></a-input>
  318. <a-icon type="contacts" style="font-size: 18px;margin-left: 5px;" @click="readCardNo" />
  319. <a-icon
  320. type="minus-circle"
  321. style="color: #f56c6c"
  322. class="dynamic-delete-button"
  323. v-if="room.livingCustomers2.length > 0"
  324. @click="() => remove(room, index)"
  325. />
  326. </a-form-model-item>
  327. </a-col>
  328. </template>
  329. </a-tab-pane>
  330. <div slot="tabBarExtraContent">
  331. <a-button type="link" @click="pulsRoom()">
  332. 增加房间
  333. </a-button>
  334. </div>
  335. </a-tabs>
  336. <h4
  337. style="
  338. color: rgba(255, 141, 26, 1);
  339. font-weight: 600;
  340. margin-top: 20px;
  341. "
  342. >
  343. 入住信息
  344. </h4>
  345. <a-divider />
  346. <a-col :span="12">
  347. <a-form-model-item
  348. label="入住类型"
  349. :labelCol="labelCol"
  350. :wrapperCol="wrapperCol"
  351. prop="orderInfo.bookingType"
  352. >
  353. <a-select
  354. placeholder="入住类型"
  355. v-model="model.orderInfo.bookingType"
  356. @change="bookingTypeChange"
  357. >
  358. <a-select-option :value="1"> 全天 </a-select-option>
  359. <a-select-option :value="2"> 钟点 </a-select-option>
  360. </a-select>
  361. </a-form-model-item>
  362. </a-col>
  363. <a-col :span="12">
  364. <a-form-model-item
  365. label="订单来源"
  366. :labelCol="labelCol"
  367. :wrapperCol="wrapperCol"
  368. prop="orderInfo.customerSource"
  369. >
  370. <a-select
  371. placeholder="订单来源"
  372. v-model="model.orderInfo.customerSource"
  373. >
  374. <a-select-option
  375. :value="item.id"
  376. v-for="(item, index) in customerSourceList"
  377. :key="item.id"
  378. >
  379. {{ item.itemText }}
  380. </a-select-option>
  381. </a-select>
  382. </a-form-model-item>
  383. </a-col>
  384. <a-col :span="12" v-if="model.orderInfo.bookingType == 2">
  385. <a-form-model-item
  386. label="时长"
  387. :labelCol="labelCol"
  388. :wrapperCol="wrapperCol"
  389. prop="orderInfo.hourRoomId"
  390. >
  391. <a-select
  392. placeholder="时长"
  393. v-model="model.orderInfo.hourRoomId"
  394. @change="hourRoomIdChange"
  395. >
  396. <a-select-option
  397. :value="item.id"
  398. v-for="(item, index) in hourRoomRuleList"
  399. :key="item.id"
  400. >
  401. {{ item.hourRoomName }}
  402. </a-select-option>
  403. </a-select>
  404. </a-form-model-item>
  405. </a-col>
  406. <a-col :span="12" v-else>
  407. <a-form-model-item
  408. label="天数"
  409. :labelCol="labelCol"
  410. :wrapperCol="wrapperCol"
  411. prop="orderInfo.dayCount"
  412. >
  413. <a-input-number
  414. v-model="model.orderInfo.dayCount"
  415. placeholder="天数"
  416. :min="1"
  417. @change="dayCountChange"
  418. ></a-input-number
  419. >天
  420. </a-form-model-item>
  421. </a-col>
  422. <a-col :span="12">
  423. <a-form-model-item
  424. label="外部单号"
  425. :labelCol="labelCol"
  426. :wrapperCol="wrapperCol"
  427. prop="orderInfo.outerOrdersNo"
  428. >
  429. <a-input
  430. v-model="model.orderInfo.outerOrdersNo"
  431. placeholder="外部单号"
  432. ></a-input>
  433. </a-form-model-item>
  434. </a-col>
  435. <a-col :span="12">
  436. <a-form-model-item
  437. label="入住时间"
  438. :labelCol="labelCol"
  439. :wrapperCol="wrapperCol"
  440. prop="orderInfo.arrivalTime2"
  441. >
  442. <j-date
  443. placeholder="入住时间"
  444. v-model="model.orderInfo.arrivalTime2"
  445. style="width: 120px"
  446. :allowClear="false"
  447. :disabled-date="disabledDate"
  448. @change="arrivalTimeChange"
  449. />
  450. <a-time-picker
  451. style="width: 80px; margin-left: 2px"
  452. v-model="model.orderInfo.arrivalTimeSpan"
  453. :default-value="moment('12:00', 'HH:mm')"
  454. format="HH:mm"
  455. :allowClear="false"
  456. @change="arrivalTimeSpanChange"
  457. />
  458. </a-form-model-item>
  459. </a-col>
  460. <a-col :span="12">
  461. <a-form-model-item
  462. label="预离时间"
  463. :labelCol="labelCol"
  464. :wrapperCol="wrapperCol"
  465. prop="orderInfo.dueOutTime2"
  466. >
  467. <j-date
  468. placeholder="预离时间"
  469. v-model="model.orderInfo.dueOutTime2"
  470. style="width: 120px"
  471. :allowClear="false"
  472. :disabled-date="disabledDate"
  473. :disabled="model.orderInfo.bookingType === 2"
  474. @change="arrivalTimeChange2"
  475. />
  476. <a-time-picker
  477. style="width: 80px; margin-left: 2px"
  478. v-model="model.orderInfo.dueOutTimeSpan"
  479. format="HH:mm"
  480. :allowClear="false"
  481. :disabled="model.orderInfo.bookingType === 2"
  482. />
  483. </a-form-model-item>
  484. </a-col>
  485. <a-col :span="12">
  486. <a-form-model-item
  487. label="宾客类型"
  488. :labelCol="labelCol"
  489. :wrapperCol="wrapperCol"
  490. prop="orderInfo.customerType"
  491. >
  492. <a-select
  493. placeholder="宾客类型"
  494. v-model="model.orderInfo.customerType"
  495. >
  496. <a-select-option :value="1"> 散客 </a-select-option>
  497. <a-select-option :value="2"> 会员 </a-select-option>
  498. <a-select-option :value="3"> 协议单位 </a-select-option>
  499. <a-select-option :value="4"> 中介 </a-select-option>
  500. </a-select>
  501. </a-form-model-item>
  502. </a-col>
  503. <a-col :span="24" v-if="model.orderInfo.customerType === 2">
  504. <a-card :bordered="true" style="width: 100%;padding: 0 !important;">
  505. <p>
  506. <a-form-model-item
  507. label="会员"
  508. :labelCol="{
  509. xs: { span: 24 },
  510. sm: { span: 2 },
  511. }"
  512. :wrapperCol="{
  513. xs: { span: 24 },
  514. sm: { span: 22 },
  515. }"
  516. prop="orderInfo.vipCustomerId"
  517. >
  518. <a-auto-complete v-model="vipCustomerData.name" @select="(e)=>handleSelectVip(e)" @search="handleSearchVip">
  519. <template slot="dataSource">
  520. <a-select-option
  521. :key="item.id"
  522. :value="item.id"
  523. :label="item.name"
  524. v-for="(item, index) in busMemberCardList"
  525. >
  526. {{ item.name }}-{{ item.gradeName }}-{{ item.balance }}
  527. </a-select-option>
  528. </template>
  529. </a-auto-complete>
  530. </a-form-model-item>
  531. </p>
  532. <p>
  533. <a-row>
  534. <a-col :span="8">名称:{{ vipCustomerData.name }}</a-col>
  535. <a-col :span="8">电话:{{ vipCustomerData.mobile }}</a-col>
  536. <a-col :span="8">级别:{{ vipCustomerData.gradeName }}</a-col>
  537. </a-row>
  538. <a-row>
  539. <a-col :span="8">余额:{{ vipCustomerData.balance }}</a-col>
  540. <a-col :span="8">积分:{{ vipCustomerData.integral }}</a-col>
  541. <a-col :span="8">卡号:{{ vipCustomerData.cardNo }}</a-col>
  542. </a-row>
  543. </p>
  544. </a-card>
  545. </a-col>
  546. <a-col :span="12" v-if="model.orderInfo.customerType === 3">
  547. <a-form-model-item
  548. label="协议单位"
  549. :labelCol="labelCol"
  550. :wrapperCol="wrapperCol"
  551. prop="orderInfo.roomPriceSlnId"
  552. >
  553. <a-select
  554. placeholder="协议单位"
  555. option-label-prop="label"
  556. v-model="model.orderInfo.contractTeamId"
  557. @change="contractTeamIdChange"
  558. >
  559. <a-select-option
  560. :key="item.id"
  561. :value="item.id"
  562. :label="item.customerName"
  563. v-for="(item, index) in busMarketAgreementUnitList"
  564. >
  565. {{ item.customerName }}
  566. </a-select-option>
  567. </a-select>
  568. </a-form-model-item>
  569. </a-col>
  570. <a-col :span="12"></a-col>
  571. <a-col :span="12" v-if="model.orderInfo.customerType === 3">
  572. <a-form-model-item
  573. label="协议合同"
  574. :labelCol="labelCol"
  575. :wrapperCol="wrapperCol"
  576. prop="orderInfo.contractTeamProtocolId"
  577. >
  578. <span style="color:red;cursor: pointer;" @click="showAgreementUnitTable(model.orderInfo.contractTeamId)">{{ model.orderInfo.contractTeamProtocolName }}</span>
  579. </a-form-model-item>
  580. </a-col>
  581. <a-col :span="12">
  582. <a-form-model-item
  583. label="房价方案"
  584. :labelCol="labelCol"
  585. :wrapperCol="wrapperCol"
  586. prop="orderInfo.roomPriceSlnId"
  587. >
  588. <a-select
  589. placeholder="房价方案"
  590. v-model="model.orderInfo.roomPriceSlnId"
  591. >
  592. <a-select-option value="会员价"> 会员价 </a-select-option>
  593. <a-select-option value="平日价"> 平日价 </a-select-option>
  594. </a-select>
  595. </a-form-model-item>
  596. </a-col>
  597. <a-col :span="12">
  598. <a-form-model-item
  599. label="销售员工"
  600. :labelCol="labelCol"
  601. :wrapperCol="wrapperCol"
  602. prop="orderInfo.warranter"
  603. >
  604. <a-select
  605. placeholder="销售员工"
  606. v-model="model.orderInfo.warranter"
  607. >
  608. <a-select-option
  609. :value="item.id"
  610. v-for="item in warranterList"
  611. :key="item.id"
  612. >
  613. {{ item.name }}
  614. </a-select-option>
  615. </a-select>
  616. </a-form-model-item>
  617. </a-col>
  618. <a-col :span="12">
  619. <a-form-model-item
  620. label="早餐数量"
  621. :labelCol="labelCol"
  622. :wrapperCol="wrapperCol"
  623. prop="orderInfo.breakfastNum"
  624. >
  625. <a-input-number
  626. v-model="model.orderInfo.breakfastNum"
  627. placeholder="早餐数量"
  628. :min="0"
  629. ></a-input-number
  630. >份
  631. </a-form-model-item>
  632. </a-col>
  633. <a-col :span="24">
  634. <a-form-model-item
  635. label="订单备注"
  636. :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
  637. :wrapperCol="{
  638. xs: { span: 24 },
  639. sm: { span: 15 },
  640. }"
  641. prop="orderInfo.remark"
  642. >
  643. <a-textarea
  644. v-model="model.orderInfo.remark"
  645. rows="4"
  646. placeholder="订单备注"
  647. />
  648. </a-form-model-item>
  649. </a-col>
  650. </div>
  651. <div style="width: 43%">
  652. <div
  653. style="
  654. display: flex;
  655. justify-content: space-between;
  656. align-items: center;
  657. "
  658. >
  659. <h4
  660. style="
  661. color: rgba(255, 141, 26, 1);
  662. font-weight: 600;
  663. margin-top: 15px;
  664. "
  665. >
  666. 财务信息
  667. </h4>
  668. <div>
  669. <a-switch v-model="depositSplit" />押金均摊记账到每个房间
  670. </div>
  671. </div>
  672. <a-divider />
  673. <a-table
  674. :columns="columns"
  675. :data-source="model.roomPrices"
  676. :pagination="false"
  677. rowKey="id"
  678. :scroll="{ y: 200, x: 500 }"
  679. >
  680. <template slot="prefPrice" slot-scope="text, record, index">
  681. <div>
  682. {{text}}<a-icon @click="onCellExpand(index)" style="margin-left:10px;" type="edit" />
  683. <!-- <editable-cell
  684. :text="text"
  685. @change.stop="onCellChange('prefPrice', index, $event)"
  686. /> -->
  687. </div>
  688. </template>
  689. </a-table>
  690. <div
  691. style="
  692. color: rgba(255, 87, 51, 1);
  693. font-weight: 600;
  694. text-align: right;
  695. "
  696. >
  697. 合计应收:{{ amount.toFixed(2) }}
  698. </div>
  699. <div
  700. style="
  701. display: flex;
  702. justify-content: space-between;
  703. align-items: center;
  704. margin-top: 30px;
  705. "
  706. >
  707. <!-- <h4
  708. style="
  709. color: rgba(255, 141, 26, 1);
  710. font-weight: 600;
  711. margin-top: 15px;
  712. "
  713. >
  714. 收款
  715. </h4> -->
  716. <a-tabs
  717. default-active-key="1"
  718. @change="paymentTabsChange"
  719. :tabBarStyle="{ fontWeight: 600 }"
  720. >
  721. <a-tab-pane key="1" tab="收款">
  722. <a-table
  723. :columns="columns2"
  724. :data-source="model.orderFees"
  725. :pagination="false"
  726. rowKey="id"
  727. :scroll="{ y: 160 }"
  728. >
  729. <template
  730. slot="subjectTypeLabel"
  731. slot-scope="text, record, index"
  732. >
  733. <div>
  734. <!-- <a-input
  735. style="margin: -5px 0"
  736. :value="text"
  737. @change="
  738. (e) => handleChange(e.target.value, index, 'subjectTypeLabel')
  739. "
  740. /> -->
  741. <a-select
  742. v-model="model.orderFees[index].subjectType"
  743. placeholder="费项"
  744. >
  745. <a-select-option :value="2">
  746. 房费
  747. </a-select-option>
  748. <a-select-option :value="1">
  749. 押金
  750. </a-select-option>
  751. </a-select>
  752. </div>
  753. </template>
  754. <template
  755. slot="payType"
  756. slot-scope="text, record, index"
  757. >
  758. <div>
  759. <a-select
  760. v-model="model.orderFees[index].payType"
  761. placeholder="收款方式"
  762. >
  763. <a-select-option
  764. :value="item.id"
  765. v-for="item in payTypeList"
  766. :key="item.id"
  767. >
  768. {{ item.name }}
  769. </a-select-option>
  770. </a-select>
  771. </div>
  772. </template>
  773. <template slot="money" slot-scope="text, record, index">
  774. <div>
  775. <a-input-number
  776. v-model="record.money"
  777. :min="0"
  778. @change="presetNumChange($event, record)"
  779. />
  780. </div>
  781. </template>
  782. </a-table>
  783. <div
  784. style="color: rgba(255, 141, 26, 1); font-weight: 200"
  785. >
  786. <p style="margin-bottom: 2px">
  787. <template></template>
  788. 实收:{{ orderFeesText }}
  789. </p>
  790. <p style="margin-bottom: 2px">
  791. 合计实款:{{ orderFeesAmout.toFixed(2) }}
  792. </p>
  793. </div>
  794. <div
  795. style="color: rgba(255, 87, 51, 1); font-weight: 200"
  796. >
  797. <p v-if="orderFeesArrearsAmout < 0">
  798. 欠费:{{ orderFeesArrearsAmout.toFixed(2) }}元
  799. </p>
  800. </div>
  801. </a-tab-pane>
  802. <a-tab-pane key="2" tab="信用卡预授权">
  803. <a-row
  804. v-for="(item, index) in payPalModel.list"
  805. :key="index"
  806. >
  807. <a-col :span="9">
  808. <a-form-model-item
  809. :labelCol="{
  810. xs: { span: 24 },
  811. sm: { span: 5 },
  812. }"
  813. :wrapperCol="{
  814. xs: { span: 24 },
  815. sm: { span: 22 },
  816. }"
  817. prop="key1"
  818. >
  819. <a-input
  820. v-model="item.key1"
  821. placeholder="银行卡号"
  822. ></a-input>
  823. </a-form-model-item>
  824. </a-col>
  825. <a-col :span="9">
  826. <a-form-model-item
  827. :labelCol="{
  828. xs: { span: 24 },
  829. sm: { span: 5 },
  830. }"
  831. :wrapperCol="{
  832. xs: { span: 24 },
  833. sm: { span: 22 },
  834. }"
  835. prop="key2"
  836. >
  837. <a-input
  838. v-model="item.key2"
  839. placeholder="预授权号"
  840. :min="1"
  841. ></a-input>
  842. </a-form-model-item>
  843. </a-col>
  844. <a-col :span="6">
  845. <a-form-model-item
  846. :labelCol="{
  847. xs: { span: 24 },
  848. sm: { span: 5 },
  849. }"
  850. :wrapperCol="{
  851. xs: { span: 24 },
  852. sm: { span: 22 },
  853. }"
  854. prop="key3"
  855. >
  856. <a-input-number
  857. v-model="item.key3"
  858. placeholder="金额"
  859. :min="1"
  860. ></a-input-number>
  861. </a-form-model-item>
  862. </a-col>
  863. </a-row>
  864. </a-tab-pane>
  865. <div slot="tabBarExtraContent">
  866. <a-switch v-model="paymentSplit" />押金、房费分开收款
  867. <a-button type="link" @click="pulsFee">
  868. 添加费项
  869. </a-button>
  870. </div>
  871. </a-tabs>
  872. </div>
  873. <div style="display:flex;justify-content: end; margin-top:20px;">
  874. <a-checkbox defaultChecked>打印入住登记单</a-checkbox></div>
  875. </div>
  876. </div>
  877. </div>
  878. </a-row>
  879. </a-form-model>
  880. </j-form-container>
  881. <select-room-form-modal
  882. ref="modalSelectRoomForm"
  883. @ok="modalFormOk"
  884. ></select-room-form-modal>
  885. <!-- 修改每日单价弹窗 -->
  886. <a-modal :visible="editPriceModal" title="调价" @cancel="editPriceModal = false" :width="800" @ok="editPriceOk">
  887. <table>
  888. <tr>
  889. <td style="text-align:center;background:#722ed1;color:#fff;">
  890. 批量调价
  891. </td>
  892. <td style="text-align:center;background:#1890ff;color:#fff;">
  893. 价格调整(元/天)
  894. </td>
  895. </tr>
  896. <th>
  897. <td style="text-align:center;color:#722ed1;">
  898. <div>每日房价</div>
  899. <div v-if="model.roomPrices.length>0 && model.roomPrices[editPriceIndex]">
  900. <a-input-number v-model="model.roomPrices[editPriceIndex].prefPrice" @change="batchPrice"></a-input-number>
  901. </div>
  902. </td>
  903. </th>
  904. <th style="display:flex;flex-wrap:wrap;">
  905. <td v-for="(item, index) in editPriceData" :key="index">
  906. <div style="text-align:center;">
  907. {{item.day}}
  908. </div>
  909. <div>
  910. <a-input-number v-model="item.price"></a-input-number>
  911. </div>
  912. </td>
  913. </th>
  914. </table>
  915. </a-modal>
  916. <member-card-modal ref="modalMemberCardInfo"></member-card-modal>
  917. <agreement-unit-modal ref="modalAgreementUnitInfo"></agreement-unit-modal>
  918. <agreement-unit-modal-table ref="modalAgreementUnitTable" @ok="modalAgreementUnitTableOk"></agreement-unit-modal-table>
  919. <history-modal ref="modalHistoryInfo"></history-modal>
  920. </a-spin>
  921. </template>
  922. <script>
  923. import { httpAction, getAction, postAction } from "@/api/manage";
  924. import { validateDuplicateValue } from "@/utils/util";
  925. import moment from "moment";
  926. import EditableCell from "./EditableCell.vue";
  927. import SelectRoomFormModal from "./SelectRoomFormModal.vue";
  928. import MemberCardModal from "./MemberCardModal";
  929. import AgreementUnitModal from "./AgreementUnitModal";
  930. import AgreementUnitModalTable from "./AgreementUnitModalTable";
  931. import HistoryModal from "./HistoryModal";
  932. const columns = [
  933. // {
  934. // title: "",
  935. // dataIndex: "key",
  936. // width: 20,
  937. // },
  938. {
  939. title: "房间号",
  940. dataIndex: "roomNo",
  941. width: 70,
  942. },
  943. {
  944. title: "房型",
  945. dataIndex: "layoutName",
  946. width: 80,
  947. },
  948. {
  949. title: "门市价",
  950. dataIndex: "marketPrice",
  951. width: 60,
  952. },
  953. {
  954. title: "优惠价",
  955. dataIndex: "prefPrice",
  956. width: 100,
  957. scopedSlots: { customRender: "prefPrice" },
  958. },
  959. {
  960. title: "天数",
  961. dataIndex: "day",
  962. width: 60,
  963. },
  964. {
  965. title: "房费",
  966. dataIndex: "roomFee",
  967. width: 80,
  968. },
  969. {
  970. title: "押金",
  971. dataIndex: "deposit",
  972. // width: 60,
  973. },
  974. ];
  975. const columns2 = [
  976. {
  977. title: "费项",
  978. dataIndex: "subjectType",
  979. width: "25%",
  980. scopedSlots: { customRender: "subjectTypeLabel" },
  981. },
  982. {
  983. title: "收款方式",
  984. dataIndex: "payType",
  985. width: "25%",
  986. scopedSlots: { customRender: "payType" },
  987. },
  988. {
  989. title: "应缴",
  990. dataIndex: "receivable",
  991. width: "25%",
  992. },
  993. {
  994. title: "实收",
  995. dataIndex: "money",
  996. width: "25%",
  997. scopedSlots: { customRender: "money" },
  998. },
  999. ];
  1000. const date = new Date();
  1001. const endDate = new Date(date.setDate(date.getDate() + 1));
  1002. export default {
  1003. name: "BillRoomForm",
  1004. components: {
  1005. EditableCell,
  1006. SelectRoomFormModal,
  1007. MemberCardModal,
  1008. AgreementUnitModal,
  1009. AgreementUnitModalTable,
  1010. HistoryModal,
  1011. },
  1012. props: {
  1013. //表单禁用
  1014. disabled: {
  1015. type: Boolean,
  1016. default: false,
  1017. required: false,
  1018. },
  1019. },
  1020. data() {
  1021. return {
  1022. //会员选中数据
  1023. vipCustomerData: {},
  1024. otherRoomSync: false,
  1025. payPalModel: { list: [{ key1: "", key2: "", key3: "" }] },
  1026. depositSplit: true,
  1027. paymentSplit: true,
  1028. activeKey: "",
  1029. PriceData: [],
  1030. newTabIndex: 0,
  1031. //调价弹窗
  1032. editPriceModal: false,
  1033. //调价的索引
  1034. editPriceIndex: null,
  1035. selectedRowKeys: [],
  1036. // data,
  1037. columns,
  1038. // data2,
  1039. columns2,
  1040. wakeList: [{}],
  1041. // model: { rooms: panes, data: data, data2: data2 },
  1042. modelDefault: {},
  1043. model: {
  1044. // data: data,
  1045. orderInfo: {
  1046. rooms: [],
  1047. data: [],
  1048. data2: [],
  1049. bookingOrdersType: 1,
  1050. arrivalTime2: moment(new Date()).format("YYYY-MM-DD"),
  1051. dueOutTime2: moment(endDate).format("YYYY-MM-DD"),
  1052. arrivalTimeSpan: moment(new Date(), "HH:mm"),
  1053. dueOutTimeSpan: moment("12:00", "HH:mm"),
  1054. bookingType: 1,
  1055. dayCount: 1,
  1056. warrantType: 1,
  1057. hourRoomId: "",
  1058. breakfastNum: 0,
  1059. vipCustomerId: "",
  1060. customerType: 1,
  1061. contractTeamProtocolName: "",
  1062. customerSource: "",
  1063. },
  1064. roomIds: [],
  1065. livingRoomDayPrices: [],
  1066. roomPrices: [],
  1067. orderFees: [],
  1068. },
  1069. labelCol: {
  1070. xs: { span: 24 },
  1071. sm: { span: 7 },
  1072. },
  1073. wrapperCol: {
  1074. xs: { span: 24 },
  1075. sm: { span: 16 },
  1076. },
  1077. confirmLoading: false,
  1078. validatorRules: {
  1079. "orderInfo.bookingType": [
  1080. { required: true, message: "请选择入住类型!" },
  1081. ],
  1082. "orderInfo.arrivalTime2": [
  1083. { required: true, message: "请选择入住时间!" },
  1084. ],
  1085. "orderInfo.dueOutTime2": [
  1086. { required: true, message: "请选择预离时间!" },
  1087. ],
  1088. "orderInfo.customerSource": [
  1089. { required: true, message: "请选择客人来源!" },
  1090. ],
  1091. "orderInfo.bookingDicWay": [
  1092. { required: true, message: "请选择预定方式!" },
  1093. ],
  1094. "orderInfo.customerType": [
  1095. { required: true, message: "请选择客人类型!" },
  1096. ],
  1097. contactName: [{ required: true, message: "请输入联系人!" }],
  1098. phone: [{ required: true, message: "请输入电话!" }],
  1099. },
  1100. url: {
  1101. add: "business/busRoomBookingOrders/living",
  1102. edit: "business/busRoomBookingOrders/living",
  1103. queryById: "/business/busMeetingRoom/queryById",
  1104. },
  1105. result: [],
  1106. selectIndex: 0,
  1107. customerSourceList: [],
  1108. bookingdicWayList: [],
  1109. warranterList: [],
  1110. hourRoomRuleList: [],
  1111. canUserRooms: [],
  1112. customerList: [],
  1113. oldcustomerList: [],
  1114. depositRule: {},
  1115. roomLayoutList: [],
  1116. amount: 0,
  1117. roomIdsIndex: 0,
  1118. oldBusMemberCardList:[],
  1119. busMemberCardList: [],
  1120. payTypeList: [],
  1121. busMemberCard: {},
  1122. busMarketAgreementUnitList: [],
  1123. ruZhuHistoryList: [],
  1124. };
  1125. },
  1126. computed: {
  1127. editPriceData() {
  1128. let arr = [];
  1129. arr.length = this.model.orderInfo.dayCount;
  1130. for (let i = 0; i < arr.length; i++) {
  1131. arr[i] = {
  1132. day: this.addDate(this.model.orderInfo.arrivalTime2, i),
  1133. price:
  1134. (this.model.roomPrices[this.editPriceIndex] &&
  1135. this.model.roomPrices[this.editPriceIndex].prefPrice) ||
  1136. 0,
  1137. };
  1138. let idx =
  1139. this.model.roomPrices[this.editPriceIndex] &&
  1140. this.model.roomPrices[this.editPriceIndex].editPriceTime &&
  1141. this.model.roomPrices[this.editPriceIndex].editPriceTime.findIndex(
  1142. (item) => item == arr[i].day
  1143. );
  1144. if (idx > -1) {
  1145. console.log(idx);
  1146. arr[i].price =
  1147. this.model.roomPrices[this.editPriceIndex].editPrice[idx];
  1148. }
  1149. }
  1150. this.PriceData = arr;
  1151. return arr;
  1152. },
  1153. formDisabled() {
  1154. return this.disabled;
  1155. },
  1156. orderFeesAmout() {
  1157. var sum = 0;
  1158. this.model.orderFees.forEach((item) => {
  1159. sum += item.money;
  1160. });
  1161. return sum;
  1162. },
  1163. orderFeesArrearsAmout() {
  1164. return this.orderFeesAmout - this.amount;
  1165. },
  1166. orderFeesText() {
  1167. var text = "";
  1168. this.model.orderFees.forEach((item) => {
  1169. var find = this.payTypeList.find((t) => t.id == item.payType);
  1170. if (find) {
  1171. text += find.name + ":" + item.money + "元;";
  1172. }
  1173. });
  1174. return text;
  1175. },
  1176. cPhone() {
  1177. let a = this.model.roomIds.map((t) => t.key5);
  1178. return a;
  1179. },
  1180. },
  1181. watch: {
  1182. depositSplit(value) {
  1183. if (!value) {
  1184. var yajin = this.model.roomPrices.reduce((sum, val) => {
  1185. let total = sum + val.deposit;
  1186. return isNaN(total) ? 0 : total;
  1187. }, 0);
  1188. this.model.roomPrices.forEach((t) => {
  1189. t.deposit = 0;
  1190. });
  1191. this.model.roomPrices[0].deposit = yajin;
  1192. } else {
  1193. this.model.roomPrices.forEach((t) => {
  1194. t.deposit = this.compuleDeposit(t.marketPrice);
  1195. });
  1196. }
  1197. },
  1198. paymentSplit(value) {
  1199. if (!value) {
  1200. var list2 = this.model.orderFees.filter(
  1201. (t) => t.subjectType == 2 && (!t.add || t.add != 1)
  1202. );
  1203. var list1 = this.model.orderFees.filter((t) => t.subjectType == 1);
  1204. var list = this.model.orderFees.filter(
  1205. (t) =>
  1206. (t.subjectType != 1 && t.subjectType != 2) || (t.add && t.add == 1)
  1207. );
  1208. list2.forEach((t) => {
  1209. var yjList = list1.filter((b) => b.roomId == t.roomId);
  1210. var yajin = yjList.reduce((sum, val) => {
  1211. let total = sum + val.money;
  1212. return isNaN(total) ? 0 : total;
  1213. }, 0);
  1214. t.yajing = yajin;
  1215. t.money += yajin;
  1216. t.receivable = t.money;
  1217. });
  1218. this.model.orderFees = [...list, ...list2];
  1219. } else {
  1220. // var list2 = this.model.orderFees.filter(
  1221. // (t) => t.subjectType == 2 && (!t.add || t.add != 1)
  1222. // );
  1223. // var list1 = [];
  1224. // var list = this.model.orderFees.filter(
  1225. // (t) =>
  1226. // (t.subjectType != 1 && t.subjectType != 2) || (t.add && t.add == 1)
  1227. // );
  1228. // list2.forEach((t) => {
  1229. // if (t.yajing && t.yajing > 0) {
  1230. // t.money -= t.yajing;
  1231. // t.receivable = t.money;
  1232. // var item = JSON.parse(JSON.stringify(t));
  1233. // item.subjectType = 1;
  1234. // item.money = t.yajing;
  1235. // item.yajing = 0;
  1236. // item.receivable = item.money;
  1237. // list1.push(item);
  1238. // }
  1239. // });
  1240. // list = [...list, ...list1];
  1241. // this.model.orderFees = [...list, ...list2];
  1242. this.loadOrderFees();
  1243. }
  1244. },
  1245. // "model.roomIds": {
  1246. // handler(newValue, oldValue) {
  1247. // console.log(newValue, oldValue);
  1248. // },
  1249. // deep: true,
  1250. // immediate: true,
  1251. // },
  1252. cPhone: {
  1253. handler: function (val, old) {
  1254. console.log(val, old);
  1255. var index = this.model.roomIds.findIndex((t) => t.id == this.activeKey);
  1256. if (index >= 0) {
  1257. var find = this.model.roomIds[index];
  1258. find.busMemberCard = this.busMemberCardList.find(
  1259. (t) => t.mobile == val[index]
  1260. );
  1261. if (!find.busMemberCard) {
  1262. find.busMarketAgreementUnit = this.busMarketAgreementUnitList.find(
  1263. (t) => t.phone == val[index]
  1264. );
  1265. } else {
  1266. find.busMarketAgreementUnit = {};
  1267. }
  1268. if (find.busMemberCard && find.busMemberCard.id) {
  1269. this.model.orderInfo.customerType = 2;
  1270. this.model.orderInfo.roomPriceSlnId = find.busMemberCard.id;
  1271. } else if (
  1272. find.busMarketAgreementUnit &&
  1273. find.busMarketAgreementUnit.id
  1274. ) {
  1275. this.model.orderInfo.customerType = 3;
  1276. } else {
  1277. this.model.orderInfo.customerType = 1;
  1278. }
  1279. if (this.ruZhuHistoryList && this.ruZhuHistoryList.length > 0) {
  1280. find.ruZhuHistory = this.ruZhuHistoryList.find(
  1281. (t) => t.phone == val[index]
  1282. );
  1283. }
  1284. }
  1285. },
  1286. deep: true,
  1287. immediate: true,
  1288. },
  1289. },
  1290. created() {
  1291. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  1292. if (_info) {
  1293. this.model.hotelId = _info.id;
  1294. }
  1295. //备份model原始值
  1296. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  1297. getAction("/business/busDictItem/list", {
  1298. hotelId: _info.id,
  1299. dictId: "1639538915239743490",
  1300. }).then((res) => {
  1301. if (res.success) {
  1302. this.customerSourceList = res.result.records;
  1303. if (this.customerSourceList) {
  1304. this.model.orderInfo.customerSource = this.customerSourceList[0].id;
  1305. }
  1306. }
  1307. });
  1308. getAction("/business/busDictItem/list", {
  1309. hotelId: _info.id,
  1310. dictId: "1639544187093995521",
  1311. }).then((res) => {
  1312. if (res.success) {
  1313. this.bookingdicWayList = res.result.records;
  1314. }
  1315. });
  1316. getAction("/business/busSalesPerson/list", {
  1317. hotelId: _info.id,
  1318. pageNo: 1,
  1319. pageSize: 100,
  1320. }).then((res) => {
  1321. if (res.success) {
  1322. this.warranterList = res.result.records;
  1323. }
  1324. });
  1325. getAction("/rooms/cesHourRoomRule/list", {
  1326. pageNo: 1,
  1327. pageSize: 100,
  1328. }).then((res) => {
  1329. if (res.success) {
  1330. this.hourRoomRuleList = res.result.records;
  1331. }
  1332. });
  1333. getAction("/bus/busCustomer/list", {}).then((res) => {
  1334. if (res.success) {
  1335. this.customerList = res.result.records;
  1336. this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
  1337. }
  1338. });
  1339. getAction("/business/busDepositSetting/queryByHotelId", {
  1340. hotelId: _info.id,
  1341. }).then((res) => {
  1342. if (res.success) {
  1343. this.depositRule = res.result;
  1344. }
  1345. });
  1346. getAction("/business/busMemberCard/list", {
  1347. pageSize: 99999,
  1348. pageNo: 1,
  1349. }).then((res) => {
  1350. if (res.success) {
  1351. this.busMemberCardList = res.result.records;
  1352. this.oldBusMemberCardList = JSON.parse(JSON.stringify(this.busMemberCardList));
  1353. }
  1354. });
  1355. getAction("/business/busMarketAgreementUnit/list", {
  1356. pageSize: 99999,
  1357. pageNo: 1,
  1358. }).then((res) => {
  1359. if (res.success) {
  1360. this.busMarketAgreementUnitList = res.result.records;
  1361. }
  1362. });
  1363. postAction("/rooms/cesAllDayPriceRule/fetch", { hotelId: _info.id }).then(
  1364. (res) => {
  1365. if (res.success) {
  1366. if (
  1367. res.result &&
  1368. res.result.cesAllDayPriceRule &&
  1369. res.result.cesAllDayPriceRule.leaveTime
  1370. ) {
  1371. this.model.orderInfo.dueOutTimeSpan = moment(
  1372. res.result.cesAllDayPriceRule.leaveTime,
  1373. "HH:mm"
  1374. );
  1375. }
  1376. }
  1377. this.loadRooms();
  1378. }
  1379. );
  1380. getAction("/business/busRoomBookingOrders/ruzhu-history-list", {
  1381. phone: "",
  1382. pageSize: 99999,
  1383. pageNo: 1,
  1384. }).then((res) => {
  1385. if (res.success) {
  1386. this.ruZhuHistoryList = res.result.records;
  1387. }
  1388. });
  1389. // this.getcesRoomLayout();
  1390. },
  1391. methods: {
  1392. handleSearchVip(value){
  1393. let result;
  1394. if (!value) {
  1395. result = this.oldBusMemberCardList;
  1396. } else {
  1397. result = this.oldBusMemberCardList.filter((t) => t.name.includes(value));
  1398. }
  1399. this.busMemberCardList = JSON.parse(JSON.stringify(result));
  1400. },
  1401. handleSelectVip(value){
  1402. console.log(value);
  1403. // vipCustomerData
  1404. let result = this.busMemberCardList.find((t) => t.id == value);
  1405. this.model.orderInfo.vipCustomerId = value;
  1406. console.log(result);
  1407. this.vipCustomerData = result;
  1408. },
  1409. loadOrderFees() {
  1410. var orderFees = [];
  1411. var roomIndex = 0;
  1412. var payType = this.payTypeList[0];
  1413. // roomNo: item.name,
  1414. // roomId: item.id,
  1415. // marketPrice: item.marketPrice,
  1416. // prefPrice: item.marketPrice,
  1417. // day: this.model.orderInfo.dayCount,
  1418. // roomFee: item.marketPrice * this.model.orderInfo.dayCount,
  1419. // deposit: this.compuleDeposit(item.marketPrice),
  1420. // layoutName: roomLayout ? roomLayout.name : "",
  1421. // layoutId: item.layoutId,
  1422. this.model.roomPrices.forEach((item) => {
  1423. var money = item.roomFee;
  1424. var deposit = item.deposit;
  1425. if (!orderFees.some((t) => t.roomId == this.model.roomIds[0].id)) {
  1426. if (!this.paymentSplit) {
  1427. money = item.roomFee + deposit;
  1428. }
  1429. orderFees.push({
  1430. subjectType: 2,
  1431. subjectTypeLabel: "预收房费",
  1432. payType: payType ? payType.id : "",
  1433. payTypeLabel: payType ? payType.name : "",
  1434. receivable: money,
  1435. money: money,
  1436. roomId: this.model.roomIds[0].id,
  1437. });
  1438. if (this.paymentSplit) {
  1439. if (deposit > 0) {
  1440. orderFees.push({
  1441. subjectType: 1,
  1442. subjectTypeLabel: "押金",
  1443. payType: payType ? payType.id : "",
  1444. payTypeLabel: payType ? payType.name : "",
  1445. receivable: deposit,
  1446. money: deposit,
  1447. roomId: this.model.roomIds[0].id,
  1448. });
  1449. }
  1450. }
  1451. } else {
  1452. var find = orderFees.find(
  1453. (t) => t.subjectType == 2 && t.roomId == this.model.roomIds[0].id
  1454. );
  1455. if (find) {
  1456. if (roomIndex == 0) {
  1457. find.money = item.roomFee;
  1458. find.receivable = item.roomFee;
  1459. } else {
  1460. find.money += item.roomFee;
  1461. find.receivable += item.roomFee;
  1462. }
  1463. if (!this.paymentSplit) {
  1464. find.money += deposit;
  1465. find.receivable += deposit;
  1466. }
  1467. }
  1468. if (this.paymentSplit) {
  1469. var find2 = orderFees.find(
  1470. (t) => t.subjectType == 1 && t.roomId == this.model.roomIds[0].id
  1471. );
  1472. if (find2) {
  1473. if (deposit > 0) {
  1474. if (roomIndex == 0) {
  1475. find2.money = deposit;
  1476. find2.receivable = deposit;
  1477. } else {
  1478. find2.money += deposit;
  1479. find2.receivable += deposit;
  1480. }
  1481. }
  1482. }
  1483. }
  1484. }
  1485. roomIndex++;
  1486. });
  1487. this.model.orderFees = orderFees;
  1488. },
  1489. readCardNo() {
  1490. this.$message.error("接口程序未打开,请打开接口程序");
  1491. },
  1492. contractTeamIdChange(e) {
  1493. this.model.orderInfo.contractTeamId = e;
  1494. getAction("/business/busMarketAgreementCustomer/list", {
  1495. agreementId: this.model.orderInfo.contractTeamId,
  1496. }).then((res) => {
  1497. if (res.success) {
  1498. var list = res.result.records;
  1499. if (list && list.length > 0) {
  1500. this.model.orderInfo.contractTeamProtocolName = list[0].name;
  1501. this.model.orderInfo.contractTeamProtocolId = list[0].id;
  1502. var info = list[0];
  1503. if (info.fixedDiscount == 1 && info.discount > 0) {
  1504. if (this.model.roomPrices && this.model.roomPrices.length > 0) {
  1505. var i = 0;
  1506. this.model.roomPrices.forEach((t) => {
  1507. t.prefPrice = (t.marketPrice * info.discount) / 100;
  1508. t.roomFee = t.prefPrice * t.day;
  1509. var editPrice = [];
  1510. if (t.editPrice && t.editPrice.length > 0) {
  1511. t.editPrice.forEach((p) => {
  1512. editPrice.push(t.prefPrice);
  1513. });
  1514. t.editPrice = editPrice;
  1515. }
  1516. this.editPriceIndex = i;
  1517. this.editPriceOk();
  1518. i++;
  1519. console.log("t", t);
  1520. });
  1521. }
  1522. }
  1523. }
  1524. }
  1525. });
  1526. },
  1527. vipCustomerIdChange(vipCustomerId) {
  1528. var find = this.busMemberCardList.find((t) => t.id == vipCustomerId);
  1529. getAction("/org.jeecg.modules.business/busMarketMember/queryById", {
  1530. id: find.gradeId,
  1531. }).then((res) => {
  1532. if (res.success) {
  1533. var info = res.result;
  1534. if (info) {
  1535. if (info.type == 0 && info.discount > 0) {
  1536. if (this.model.roomPrices && this.model.roomPrices.length > 0) {
  1537. var i = 0;
  1538. this.model.roomPrices.forEach((t) => {
  1539. t.prefPrice = (t.marketPrice * info.discount) / 100;
  1540. t.roomFee = t.prefPrice * t.day;
  1541. var editPrice = [];
  1542. if (t.editPrice && t.editPrice.length > 0) {
  1543. t.editPrice.forEach((p) => {
  1544. editPrice.push(t.prefPrice);
  1545. });
  1546. t.editPrice = editPrice;
  1547. }
  1548. this.editPriceIndex = i;
  1549. this.editPriceOk();
  1550. i++;
  1551. console.log("t", t);
  1552. });
  1553. }
  1554. }
  1555. }
  1556. }
  1557. });
  1558. },
  1559. modalAgreementUnitTableOk(e) {
  1560. var info = e;
  1561. this.model.orderInfo.contractTeamProtocolName = info.name;
  1562. this.model.orderInfo.contractTeamProtocolId = info.id;
  1563. if (info.fixedDiscount == 1 && info.discount > 0) {
  1564. if (this.model.roomPrices && this.model.roomPrices.length > 0) {
  1565. var i = 0;
  1566. this.model.roomPrices.forEach((t) => {
  1567. t.prefPrice = (t.marketPrice * info.discount) / 100;
  1568. t.roomFee = t.prefPrice * t.day;
  1569. var editPrice = [];
  1570. if (t.editPrice && t.editPrice.length > 0) {
  1571. t.editPrice.forEach((p) => {
  1572. editPrice.push(t.prefPrice);
  1573. });
  1574. t.editPrice = editPrice;
  1575. }
  1576. this.editPriceIndex = i;
  1577. this.editPriceOk();
  1578. i++;
  1579. console.log("t", t);
  1580. });
  1581. }
  1582. }
  1583. },
  1584. showRuZhuHistory(phone) {
  1585. this.$refs.modalHistoryInfo.add(phone);
  1586. this.$refs.modalHistoryInfo.title = "历史入住信息";
  1587. this.$refs.modalHistoryInfo.disableSubmit = true;
  1588. },
  1589. showMemberCard(busMemberCard) {
  1590. console.log("busMemberCard", busMemberCard);
  1591. this.$refs.modalMemberCardInfo.edit(busMemberCard);
  1592. this.$refs.modalMemberCardInfo.title = "会员信息";
  1593. this.$refs.modalMemberCardInfo.disableSubmit = true;
  1594. },
  1595. showAgreementUnit(busMarketAgreementUnit) {
  1596. console.log("busMarketAgreementUnit", busMarketAgreementUnit);
  1597. this.$refs.modalAgreementUnitInfo.edit(busMarketAgreementUnit);
  1598. this.$refs.modalAgreementUnitInfo.title = "协议单位信息";
  1599. this.$refs.modalAgreementUnitInfo.disableSubmit = true;
  1600. },
  1601. showAgreementUnitTable(agreementId) {
  1602. this.$refs.modalAgreementUnitTable.add(agreementId);
  1603. this.$refs.modalAgreementUnitTable.title = "选择协议";
  1604. this.$refs.modalAgreementUnitTable.disableSubmit = true;
  1605. },
  1606. //批量调价
  1607. batchPrice(e) {
  1608. console.log(e);
  1609. this.editPriceData.forEach((ele) => {
  1610. ele.price = e;
  1611. });
  1612. },
  1613. //根据传入的数字将日期加上对应的天数
  1614. addDate(date, days) {
  1615. console.log(date, days);
  1616. let time = new Date(date);
  1617. time.setDate(time.getDate() + days);
  1618. let m = time.getMonth() + 1;
  1619. let d = time.getDate();
  1620. if (m < 10) {
  1621. m = "0" + m;
  1622. }
  1623. if (d < 10) {
  1624. d = "0" + d;
  1625. }
  1626. return time.getFullYear() + "-" + m + "-" + d;
  1627. },
  1628. /**
  1629. * 点击修改图标时
  1630. */
  1631. onCellExpand(idx) {
  1632. console.log(idx);
  1633. this.editPriceIndex = idx;
  1634. console.log(
  1635. "11111111111111111111111",
  1636. this.model.roomPrices[this.editPriceIndex]
  1637. );
  1638. this.editPriceModal = true;
  1639. },
  1640. /**
  1641. * 修改完成
  1642. */
  1643. editPriceOk() {
  1644. console.log(this.editPriceData);
  1645. this.model.roomPrices[this.editPriceIndex].editPriceTime = [];
  1646. this.model.roomPrices[this.editPriceIndex].editPrice = [];
  1647. this.editPriceData.forEach((ele) => {
  1648. this.model.roomPrices[this.editPriceIndex].editPriceTime.push(ele.day);
  1649. this.model.roomPrices[this.editPriceIndex].editPrice.push(ele.price);
  1650. });
  1651. console.log(this.model.roomPrices);
  1652. this.model.roomPrices[this.editPriceIndex].prefPrice =
  1653. this.editPriceData[0].price;
  1654. this.onCellChange(
  1655. "prefPrice",
  1656. this.editPriceIndex,
  1657. this.editPriceData[0].price
  1658. );
  1659. this.editPriceData.forEach((ele) => {
  1660. ele.prcie = 0;
  1661. });
  1662. console.log(this.editPriceData);
  1663. this.editPriceModal = false;
  1664. var sum = 0;
  1665. var money2 = 0;
  1666. var deposit2 = 0;
  1667. for (var i = 0; i < this.model.roomPrices.length; i++) {
  1668. var money = 0;
  1669. var item = this.model.roomPrices[i];
  1670. if (item.editPrice && item.editPrice.length > 0) {
  1671. item.editPrice.forEach((p) => {
  1672. money += p;
  1673. });
  1674. item.roomFee = money;
  1675. sum += money + item.deposit;
  1676. } else {
  1677. sum += item.roomFee + item.deposit;
  1678. }
  1679. money2 += item.roomFee;
  1680. deposit2 += item.deposit;
  1681. // var find = this.model.orderFees.find(
  1682. // (t) =>
  1683. // t.subjectType == 2 &&
  1684. // t.roomId == this.model.roomPrices[this.editPriceIndex].roomId
  1685. // );
  1686. // if (find && find.roomId == item.roomId) {
  1687. // find.money = money;
  1688. // find.receivable = money;
  1689. // }
  1690. }
  1691. var find = this.model.orderFees.find(
  1692. (t) => t.subjectType == 2 && t.roomId == this.model.roomIds[0].id
  1693. );
  1694. if (find) {
  1695. find.money = money2;
  1696. find.receivable = money2;
  1697. if (!this.paymentSplit) {
  1698. find.money += deposit2;
  1699. find.receivable += deposit2;
  1700. }
  1701. }
  1702. var find2 = this.model.orderFees.find(
  1703. (t) => t.subjectType == 1 && t.roomId == this.model.roomIds[0].id
  1704. );
  1705. if (find2) {
  1706. find2.money = deposit2;
  1707. find2.receivable = deposit2;
  1708. }
  1709. this.amount = sum;
  1710. },
  1711. presetNumChange(e, record) {
  1712. console.log(e, record);
  1713. },
  1714. async getcesRoomLayout() {
  1715. await getAction("/rooms/cesRoomLayout/list", {
  1716. pageSize: 99999,
  1717. pageNo: 1,
  1718. }).then((res) => {
  1719. if (res.success) {
  1720. this.roomLayoutList = res.result.records;
  1721. console.log("roomLayoutList");
  1722. }
  1723. });
  1724. },
  1725. async getbusRoomPayType() {
  1726. await getAction("/business/busRoomPayType/list", {
  1727. pageSize: 99999,
  1728. pageNo: 1,
  1729. }).then((res) => {
  1730. if (res.success) {
  1731. this.payTypeList = res.result.records;
  1732. }
  1733. });
  1734. },
  1735. roomPriceSlnIdChange(e) {
  1736. this.model.orderInfo.vipCustomerId = e;
  1737. },
  1738. loadRooms() {
  1739. // this.model.roomPrices = [];
  1740. // this.model.roomIds = [];
  1741. // this.amount = 0;
  1742. getAction("/rooms/cesRooms/can-user-rooms", {
  1743. startOf:
  1744. this.model.orderInfo.arrivalTime2 +
  1745. " " +
  1746. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm"),
  1747. endOf:
  1748. this.model.orderInfo.dueOutTime2 +
  1749. " " +
  1750. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm"),
  1751. bookingType: this.model.orderInfo.bookingType,
  1752. hourRoomRuleId: this.model.orderInfo.hourRoomId,
  1753. cancelLayout: true,
  1754. }).then((res) => {
  1755. if (res.success) {
  1756. res.result.forEach((t) => {
  1757. // t.layout = Object.assign({}, t.layout, {
  1758. // presetNum: 0,
  1759. // oldTags: t.layout.canUseCount,
  1760. // });
  1761. t.buildingRooms.forEach((b) => {
  1762. b.floorRooms.forEach((f) => {
  1763. this.$set(
  1764. f,
  1765. "check",
  1766. this.model.roomIds.some((r) => r.id == f.id) ? 1 : 0
  1767. );
  1768. });
  1769. });
  1770. });
  1771. this.canUserRooms = res.result;
  1772. }
  1773. });
  1774. },
  1775. hourRoomIdChange() {
  1776. if (this.model.orderInfo.bookingType === 2) {
  1777. var find = this.hourRoomRuleList.find(
  1778. (t) => t.id === this.model.orderInfo.hourRoomId
  1779. );
  1780. if (find) {
  1781. var mDate = moment(
  1782. this.model.orderInfo.arrivalTime2 +
  1783. " " +
  1784. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1785. ).add(find.afterOpenRoom, "minutes");
  1786. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1787. this.model.orderInfo.dueOutTimeSpan = moment(
  1788. mDate.format("HH:mm"),
  1789. "HH:mm"
  1790. );
  1791. }
  1792. }
  1793. this.loadRooms();
  1794. },
  1795. bookingTypeChange(e) {
  1796. if (this.model.orderInfo.bookingType == 1) {
  1797. this.model.orderInfo.hourRoomId = "";
  1798. } else {
  1799. var hourRoomRule = this.hourRoomRuleList[0];
  1800. if (hourRoomRule) {
  1801. this.model.orderInfo.hourRoomId = hourRoomRule.id;
  1802. }
  1803. }
  1804. if (this.model.orderInfo.bookingType === 2) {
  1805. var find = this.hourRoomRuleList.find(
  1806. (t) => t.id === this.model.orderInfo.hourRoomId
  1807. );
  1808. if (find) {
  1809. var mDate = moment(
  1810. this.model.orderInfo.arrivalTime2 +
  1811. " " +
  1812. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1813. ).add(find.afterOpenRoom, "minutes");
  1814. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1815. this.model.orderInfo.dueOutTimeSpan = moment(
  1816. mDate.format("HH:mm"),
  1817. "HH:mm"
  1818. );
  1819. }
  1820. } else if (this.model.orderInfo.bookingType === 1) {
  1821. var mDate = moment(this.model.orderInfo.arrivalTime2).add(1, "days");
  1822. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1823. }
  1824. this.loadRooms();
  1825. },
  1826. dayCountChange(e) {
  1827. if (e) {
  1828. this.model.orderInfo.dueOutTime2 = moment(
  1829. this.model.orderInfo.arrivalTime2
  1830. )
  1831. .add(e, "days")
  1832. .format("YYYY-MM-DD");
  1833. }
  1834. this.loadRooms();
  1835. // this.edit(this.modelDefault);
  1836. var i = 0;
  1837. this.model.roomPrices.forEach((t) => {
  1838. t.day = this.model.orderInfo.dayCount;
  1839. this.editPriceIndex = i;
  1840. this.editPriceOk();
  1841. i++;
  1842. });
  1843. },
  1844. disabledDate(current) {
  1845. return current && current < moment().add(-1, "days").endOf("day");
  1846. },
  1847. arrivalTimeChange(e) {
  1848. var v = parseInt(
  1849. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1850. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1851. (1000 * 60 * 60 * 24)
  1852. );
  1853. if (v <= 0) {
  1854. this.model.orderInfo.dueOutTime2 = moment(
  1855. this.model.orderInfo.arrivalTime2
  1856. )
  1857. .add(1, "days")
  1858. .format("YYYY-MM-DD");
  1859. }
  1860. v = parseInt(
  1861. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1862. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1863. (1000 * 60 * 60 * 24)
  1864. );
  1865. this.model.orderInfo.dayCount = Math.abs(v);
  1866. // this.loadRooms();
  1867. this.dayCountChange();
  1868. },
  1869. arrivalTimeChange2(e) {
  1870. var v = parseInt(
  1871. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1872. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1873. (1000 * 60 * 60 * 24)
  1874. );
  1875. if (v <= 0) {
  1876. this.model.orderInfo.arrivalTime2 = moment(
  1877. this.model.orderInfo.dueOutTime2
  1878. )
  1879. .add(-1, "days")
  1880. .format("YYYY-MM-DD");
  1881. }
  1882. v = parseInt(
  1883. (new Date(this.model.orderInfo.dueOutTime2).getTime() -
  1884. new Date(this.model.orderInfo.arrivalTime2).getTime()) /
  1885. (1000 * 60 * 60 * 24)
  1886. );
  1887. this.model.orderInfo.dayCount = Math.abs(v);
  1888. // this.loadRooms();
  1889. this.dayCountChange();
  1890. },
  1891. arrivalTimeSpanChange(m, time) {
  1892. console.log(time);
  1893. console.log(moment(m).format("HH:mm"));
  1894. if (this.model.orderInfo.bookingType === 2) {
  1895. var find = this.hourRoomRuleList.find(
  1896. (t) => t.id === this.model.orderInfo.hourRoomId
  1897. );
  1898. if (find) {
  1899. var mDate = moment(
  1900. this.model.orderInfo.arrivalTime2 +
  1901. " " +
  1902. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm")
  1903. ).add(find.afterOpenRoom, "minutes");
  1904. this.model.orderInfo.dueOutTime2 = mDate.format("YYYY-MM-DD");
  1905. this.model.orderInfo.dueOutTimeSpan = moment(
  1906. mDate.format("HH:mm"),
  1907. "HH:mm"
  1908. );
  1909. }
  1910. }
  1911. this.loadRooms();
  1912. },
  1913. handleSearch(value) {
  1914. let result;
  1915. if (!value) {
  1916. result = this.oldcustomerList;
  1917. } else {
  1918. result = this.oldcustomerList.filter((t) => t.name.includes(value));
  1919. }
  1920. this.customerList = result;
  1921. },
  1922. handleSelectMember(room, e) {
  1923. console.log("room", room);
  1924. var find = this.customerList.find((t) => t.id === e);
  1925. this.$set(room, "key1", find.name);
  1926. this.$set(room, "key2", 1);
  1927. this.$set(room, "key3", "汉");
  1928. this.$set(room, "key5", find.phone);
  1929. this.$set(room, "customerId", find.id);
  1930. },
  1931. pulsRoom() {
  1932. this.$refs.modalSelectRoomForm.add(this.canUserRooms);
  1933. this.$refs.modalSelectRoomForm.title = "选择房间";
  1934. this.$refs.modalSelectRoomForm.disableSubmit = false;
  1935. },
  1936. paymentTabsChange(e) {},
  1937. pulsFee() {
  1938. var payType = this.payTypeList[0];
  1939. this.model.orderFees.push({
  1940. add: 1,
  1941. subjectType: 2,
  1942. subjectTypeLabel: "预收房费",
  1943. payType: payType ? payType.id : "",
  1944. payTypeLabel: payType ? payType.name : "",
  1945. receivable: 0,
  1946. money: 0,
  1947. roomId: this.model.roomIds[0].id,
  1948. });
  1949. },
  1950. onCellChange(key, dataIndex, value) {
  1951. console.log(key, value);
  1952. console.log(this.model.roomPrices[dataIndex]);
  1953. const dataSource = [...this.model.roomPrices];
  1954. const target = dataSource[dataIndex];
  1955. console.log("target", target);
  1956. if (target) {
  1957. target[key] = value;
  1958. target.roomFee = value * target.day;
  1959. target.deposit = this.compuleDeposit(value);
  1960. this.model.roomPrices = dataSource;
  1961. }
  1962. // var sum = 0;
  1963. // this.model.roomPrices.forEach(function (item) {
  1964. // sum += item.roomFee + item.deposit;
  1965. // });
  1966. // this.amount = sum;
  1967. // console.log("this.model.roomPrices", this.model.roomPrices);
  1968. },
  1969. // handleChange(value, index, column) {
  1970. // const newData = [...this.data2];
  1971. // const target = newData[index];
  1972. // if (target) {
  1973. // target[column] = value;
  1974. // this.data2 = newData;
  1975. // }
  1976. // },
  1977. onEdit(targetKey, action) {
  1978. this[action](targetKey);
  1979. },
  1980. add() {
  1981. console.log(1);
  1982. const panes = this.panes;
  1983. const activeKey = `newTab${this.newTabIndex++}`;
  1984. panes.push({
  1985. title: `New Tab ${activeKey}`,
  1986. content: "",
  1987. key: activeKey,
  1988. });
  1989. this.panes = panes;
  1990. this.activeKey = activeKey;
  1991. },
  1992. onSelectChange(selectedRowKeys, selectionRows) {
  1993. this.selectedRowKeys = selectedRowKeys;
  1994. this.selectionRows = selectionRows;
  1995. },
  1996. handleAdd() {},
  1997. puls(room) {
  1998. if (!room.livingCustomers2) {
  1999. this.$set(room, "livingCustomers2", [
  2000. { gender: 1, certType: 1, roomId: room.id },
  2001. ]);
  2002. } else {
  2003. room.livingCustomers2.push({ gender: 1, certType: 1, roomId: room.id });
  2004. }
  2005. },
  2006. remove(room, index) {
  2007. room.livingCustomers2.splice(index, 1);
  2008. },
  2009. moment,
  2010. onChange(e) {
  2011. console.log(e);
  2012. },
  2013. add2(roomLive) {
  2014. this.modelDefault = Object.assign({}, this.modelDefault, {
  2015. roomIds: [roomLive],
  2016. });
  2017. this.edit(this.modelDefault);
  2018. },
  2019. editTabs(e) {
  2020. console.log("editTabs", e);
  2021. var index = this.model.roomIds.findIndex((t) => t.id == e);
  2022. this.model.roomIds.splice(index, 1);
  2023. console.log("this.canUserRooms", this.canUserRooms);
  2024. this.canUserRooms.forEach((t) => {
  2025. t.buildingRooms.forEach((b) => {
  2026. b.floorRooms.forEach((f) => {
  2027. if (f.id == e) {
  2028. f.check = 0;
  2029. }
  2030. });
  2031. });
  2032. });
  2033. this.model.roomPrices = this.model.roomPrices.filter(
  2034. (t) => t.roomId != e
  2035. );
  2036. // this.model.orderFees = this.model.orderFees.filter((t) => t.roomId != e);
  2037. this.model.orderFees.forEach((t) => {
  2038. if (t.roomId == e) {
  2039. t.roomId = this.model.roomIds[0].id;
  2040. }
  2041. });
  2042. var sum = 0;
  2043. var money2 = 0;
  2044. var deposit2 = 0;
  2045. for (var i = 0; i < this.model.roomPrices.length; i++) {
  2046. var money = 0;
  2047. var item = this.model.roomPrices[i];
  2048. if (item.editPrice && item.editPrice.length > 0) {
  2049. item.editPrice.forEach((p) => {
  2050. money += p;
  2051. });
  2052. item.roomFee = money;
  2053. sum += money + item.deposit;
  2054. } else {
  2055. sum += item.roomFee + item.deposit;
  2056. }
  2057. money2 += item.roomFee;
  2058. deposit2 += item.deposit;
  2059. }
  2060. var find = this.model.orderFees.find(
  2061. (t) => t.subjectType == 2 && t.roomId == this.model.roomIds[0].id
  2062. );
  2063. if (find) {
  2064. find.money = money2;
  2065. find.receivable = money2;
  2066. }
  2067. var find2 = this.model.orderFees.find(
  2068. (t) => t.subjectType == 1 && t.roomId == this.model.roomIds[0].id
  2069. );
  2070. if (find2) {
  2071. find2.money = deposit2;
  2072. find2.receivable = deposit2;
  2073. }
  2074. this.amount = sum;
  2075. },
  2076. tabClick(e) {
  2077. console.log("tabClick", e);
  2078. var index = this.model.roomIds.findIndex((t) => t.id == e);
  2079. this.roomIdsIndex = index;
  2080. },
  2081. modalFormOk(e) {
  2082. console.log("e", e);
  2083. this.model.roomPrices = this.model.roomPrices.filter((t) =>
  2084. e.some((r) => r.id == t.roomId)
  2085. );
  2086. this.model.orderFees = this.model.orderFees.filter((t) =>
  2087. e.some((r) => r.id == t.roomId)
  2088. );
  2089. var roomIds = this.model.roomIds.filter((t) =>
  2090. e.some((r) => r.id == t.id)
  2091. );
  2092. var newRoomIds = e.filter(
  2093. (t) => !this.model.roomIds.some((r) => r.id == t.id)
  2094. );
  2095. this.modelDefault = Object.assign({}, this.modelDefault, {
  2096. roomIds: [...roomIds, ...newRoomIds],
  2097. roomPrices: this.model.roomPrices,
  2098. orderFees: this.model.orderFees,
  2099. orderInfo: this.model.orderInfo,
  2100. });
  2101. if (!this.otherRoomSync) {
  2102. if (this.modelDefault.roomIds && this.modelDefault.roomIds.length > 0) {
  2103. if (this.modelDefault.roomIds[0].key1) {
  2104. for (var i = 1; i < this.modelDefault.roomIds.length; i++) {
  2105. var room = this.modelDefault.roomIds[i];
  2106. if (!room.key1) {
  2107. this.$set(room, "key1", this.modelDefault.roomIds[0].key1);
  2108. this.$set(room, "key2", this.modelDefault.roomIds[0].key2);
  2109. this.$set(room, "key3", this.modelDefault.roomIds[0].key3);
  2110. this.$set(room, "key4", this.modelDefault.roomIds[0].key4);
  2111. this.$set(room, "key5", this.modelDefault.roomIds[0].key5);
  2112. this.$set(room, "key6", this.modelDefault.roomIds[0].key6);
  2113. this.$set(
  2114. room,
  2115. "customerId",
  2116. this.modelDefault.roomIds[0].customerId
  2117. );
  2118. }
  2119. }
  2120. }
  2121. }
  2122. }
  2123. if (this.modelDefault.roomIds && this.modelDefault.roomIds.length > 2) {
  2124. var mainRoom = this.modelDefault.roomIds[0];
  2125. var sortRooms = this.modelDefault.roomIds
  2126. .filter((t) => t.id != mainRoom.id)
  2127. .sort(function (a, b) {
  2128. return a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1;
  2129. });
  2130. this.modelDefault.roomIds = [...[mainRoom], ...sortRooms];
  2131. }
  2132. console.log(" this.modelDefault.roomIds", this.modelDefault.roomIds);
  2133. this.edit(this.modelDefault);
  2134. },
  2135. compuleDeposit(prefPrice) {
  2136. var deposit = 0;
  2137. if (this.depositRule) {
  2138. if (this.depositRule.depositType === 1) {
  2139. deposit = prefPrice * this.depositRule.depositMultiple;
  2140. } else if (this.depositRule.depositType === 2) {
  2141. deposit = prefPrice + this.depositRule.depositMultiple;
  2142. } else if (this.depositRule.depositType === 3) {
  2143. deposit = this.depositRule.depositMoney;
  2144. }
  2145. }
  2146. return deposit;
  2147. },
  2148. getSubjectTypeLabel(value) {
  2149. switch (value) {
  2150. case 1:
  2151. return "押金";
  2152. case 2:
  2153. return "预收房费";
  2154. default:
  2155. return "";
  2156. }
  2157. },
  2158. addList(roomLiveList, key) {
  2159. console.log("roomLiveList", roomLiveList);
  2160. this.modelDefault = Object.assign({}, this.modelDefault, {
  2161. roomIds: JSON.parse(JSON.stringify(roomLiveList)),
  2162. });
  2163. this.modelDefault.orderInfo.bookingOrdersType = key;
  2164. this.edit(this.modelDefault);
  2165. },
  2166. async edit(record) {
  2167. console.log("edit", record);
  2168. this.visible = true;
  2169. this.model = Object.assign({}, record);
  2170. console.log("this.model", this.model);
  2171. if (this.roomLayoutList.length === 0) {
  2172. await this.getcesRoomLayout();
  2173. }
  2174. if (this.payTypeList == 0) {
  2175. await this.getbusRoomPayType();
  2176. }
  2177. if (this.customerSourceList) {
  2178. if (!this.model.orderInfo.customerSource) {
  2179. this.model.orderInfo.customerSource = this.customerSourceList[0].id;
  2180. }
  2181. }
  2182. if (this.model.roomIds && this.model.roomIds.length > 0) {
  2183. this.activeKey = this.model.roomIds[0].id;
  2184. var roomPrices = [];
  2185. var orderFees = [];
  2186. var roomIndex = 0;
  2187. this.model.roomIds.forEach((item) => {
  2188. var roomLayout = this.roomLayoutList.find(
  2189. (t) => (t.id = item.layoutId)
  2190. );
  2191. this.editPriceIndex = this.model.roomPrices.findIndex(
  2192. (t) => t.roomId == item.id
  2193. );
  2194. var find = this.model.roomPrices[this.editPriceIndex];
  2195. if (!find) {
  2196. var obj = {
  2197. roomNo: item.name,
  2198. roomId: item.id,
  2199. marketPrice: item.marketPrice,
  2200. prefPrice: item.marketPrice,
  2201. day: this.model.orderInfo.dayCount,
  2202. roomFee: item.marketPrice * this.model.orderInfo.dayCount,
  2203. deposit: this.compuleDeposit(item.marketPrice),
  2204. layoutName: roomLayout ? roomLayout.name : "",
  2205. layoutId: item.layoutId,
  2206. };
  2207. roomPrices.push(obj);
  2208. } else {
  2209. find.day = this.model.orderInfo.dayCount;
  2210. this.editPriceOk();
  2211. }
  2212. var payType = this.payTypeList[0];
  2213. // if (!this.model.orderFees.some((t) => t.roomId == item.id)) {
  2214. // orderFees.push({
  2215. // subjectType: 2,
  2216. // subjectTypeLabel: "预收房费",
  2217. // payType: payType ? payType.id : "",
  2218. // payTypeLabel: payType ? payType.name : "",
  2219. // receivable: item.marketPrice * this.model.orderInfo.dayCount,
  2220. // money: item.marketPrice * this.model.orderInfo.dayCount,
  2221. // roomId: item.id,
  2222. // });
  2223. // var deposit = this.compuleDeposit(item.marketPrice);
  2224. // if (deposit > 0) {
  2225. // orderFees.push({
  2226. // subjectType: 1,
  2227. // subjectTypeLabel: "押金",
  2228. // payType: payType ? payType.id : "",
  2229. // payTypeLabel: payType ? payType.name : "",
  2230. // receivable: deposit,
  2231. // money: deposit,
  2232. // roomId: item.id,
  2233. // });
  2234. // }
  2235. // } else {
  2236. // // var find = this.model.orderFees.find(
  2237. // // (t) => t.subjectType == 2 && t.roomId == item.id
  2238. // // );
  2239. // // if (find) {
  2240. // // find.money = money;
  2241. // // find.receivable = money;
  2242. // // }
  2243. // }
  2244. // if (
  2245. // !this.model.orderFees.some(
  2246. // (t) => t.roomId == this.model.roomIds[0].id
  2247. // )
  2248. // ) {
  2249. // orderFees.push({
  2250. // subjectType: 2,
  2251. // subjectTypeLabel: "预收房费",
  2252. // payType: payType ? payType.id : "",
  2253. // payTypeLabel: payType ? payType.name : "",
  2254. // receivable: item.marketPrice * this.model.orderInfo.dayCount,
  2255. // money: item.marketPrice * this.model.orderInfo.dayCount,
  2256. // roomId: this.model.roomIds[0].id,
  2257. // });
  2258. // var deposit = this.compuleDeposit(item.marketPrice);
  2259. // if (deposit > 0) {
  2260. // orderFees.push({
  2261. // subjectType: 1,
  2262. // subjectTypeLabel: "押金",
  2263. // payType: payType ? payType.id : "",
  2264. // payTypeLabel: payType ? payType.name : "",
  2265. // receivable: deposit,
  2266. // money: deposit,
  2267. // roomId: this.model.roomIds[0].id,
  2268. // });
  2269. // }
  2270. // } else {
  2271. // var deposit = this.compuleDeposit(item.marketPrice);
  2272. // var find = this.model.orderFees.find(
  2273. // (t) => t.subjectType == 2 && t.roomId == this.model.roomIds[0].id
  2274. // );
  2275. // if (find) {
  2276. // if (roomIndex == 0) {
  2277. // find.money = item.marketPrice * this.model.orderInfo.dayCount;
  2278. // find.receivable =
  2279. // item.marketPrice * this.model.orderInfo.dayCount;
  2280. // } else {
  2281. // find.money += item.marketPrice * this.model.orderInfo.dayCount;
  2282. // find.receivable +=
  2283. // item.marketPrice * this.model.orderInfo.dayCount;
  2284. // }
  2285. // if (!this.paymentSplit) {
  2286. // find.money += deposit;
  2287. // find.receivable += deposit;
  2288. // }
  2289. // }
  2290. // var find2 = this.model.orderFees.find(
  2291. // (t) => t.subjectType == 1 && t.roomId == this.model.roomIds[0].id
  2292. // );
  2293. // if (find2) {
  2294. // if (deposit > 0) {
  2295. // if (roomIndex == 0) {
  2296. // find2.money = deposit;
  2297. // find2.receivable = deposit;
  2298. // } else {
  2299. // find2.money += deposit;
  2300. // find2.receivable += deposit;
  2301. // }
  2302. // }
  2303. // }
  2304. // }
  2305. // roomIndex++;
  2306. });
  2307. this.model.roomPrices = [...this.model.roomPrices, ...roomPrices];
  2308. if (this.model.roomPrices && this.model.roomPrices.length > 2) {
  2309. var mainRoom = this.model.roomPrices[0];
  2310. var sortRooms = this.model.roomPrices
  2311. .filter((t) => t.roomId != mainRoom.roomId)
  2312. .sort(function (a, b) {
  2313. return a.roomNo.toUpperCase() > b.roomNo.toUpperCase() ? 1 : -1;
  2314. });
  2315. this.model.roomPrices = [...[mainRoom], ...sortRooms];
  2316. }
  2317. var sum = 0;
  2318. this.model.roomPrices.forEach(function (item) {
  2319. sum += item.roomFee + item.deposit;
  2320. });
  2321. this.amount = sum;
  2322. // console.log("orderFees", orderFees);
  2323. this.loadOrderFees();
  2324. // this.model.orderFees = [...this.model.orderFees, ...orderFees];
  2325. }
  2326. },
  2327. submitForm() {
  2328. const that = this;
  2329. that.model.livingRoomDayPrices = [];
  2330. console.log("that.model.roomPrices", that.model.roomPrices);
  2331. that.model.roomPrices.forEach((t) => {
  2332. for (var b = 0; b < that.model.orderInfo.dayCount; b++) {
  2333. var dayTime = moment(this.model.orderInfo.arrivalTime2)
  2334. .add(b, "days")
  2335. .format("YYYY-MM-DD");
  2336. that.model.livingRoomDayPrices.push({
  2337. livingType: 1,
  2338. dayTime: t.editPriceTime ? t.editPriceTime[b].toString() : dayTime,
  2339. // price: t.editPrice? t.editPrice[b].toString() : t.prefPrice,
  2340. price:
  2341. t.editPrice && t.editPriceTime && t.editPriceTime[b] == dayTime
  2342. ? t.editPrice[b].toString()
  2343. : t.prefPrice,
  2344. // dayTime: dayTime,
  2345. // price: t.prefPrice,
  2346. roomLayoutId: t.layoutId,
  2347. roomId: t.roomId,
  2348. });
  2349. }
  2350. });
  2351. that.model.roomIds.forEach((t) => {
  2352. t.roomId = t.id;
  2353. var obj = {
  2354. certNo: t.key4,
  2355. certType: 1,
  2356. customerId: t.customerId,
  2357. customerName: t.key1,
  2358. gender: t.key2,
  2359. phone: t.key5,
  2360. nation: t.key3,
  2361. address: t.key6,
  2362. roomId: t.id,
  2363. };
  2364. if (!t.livingCustomers2 || t.livingCustomers2.length == 0) {
  2365. t.livingCustomers = [obj];
  2366. } else {
  2367. t.livingCustomers = [...[obj], ...t.livingCustomers2];
  2368. }
  2369. });
  2370. console.log("this.model", this.model);
  2371. if (that.model.roomIds.length <= 0) {
  2372. that.$message.warning("请先添加房间");
  2373. return;
  2374. }
  2375. // 触发表单验证
  2376. this.$refs.form.validate((valid, err) => {
  2377. if (valid) {
  2378. this.model.orderInfo.arrivalTime =
  2379. this.model.orderInfo.arrivalTime2 +
  2380. " " +
  2381. moment(this.model.orderInfo.arrivalTimeSpan).format("HH:mm");
  2382. this.model.orderInfo.dueOutTime =
  2383. this.model.orderInfo.dueOutTime2 +
  2384. " " +
  2385. moment(this.model.orderInfo.dueOutTimeSpan).format("HH:mm");
  2386. that.confirmLoading = true;
  2387. let httpurl = "";
  2388. let method = "";
  2389. if (!this.model.id) {
  2390. httpurl += this.url.add;
  2391. method = "post";
  2392. } else {
  2393. httpurl += this.url.edit;
  2394. method = "put";
  2395. }
  2396. // if (this.model.orderInfo.bookingOrdersId) {
  2397. // httpurl = "/business/busRoomBookingOrders/add-batch";
  2398. // method = "post";
  2399. // }
  2400. httpAction(httpurl, this.model, method)
  2401. .then((res) => {
  2402. if (res.success) {
  2403. that.$message.success(res.message);
  2404. that.$emit("ok", res.result);
  2405. } else {
  2406. if (res.message.indexOf("与预约时间有冲突") >= 0) {
  2407. that.$confirm({
  2408. title: "提示",
  2409. content: res.message + "是否确定入住?",
  2410. onOk: function () {
  2411. that.model.confirm = true;
  2412. httpAction(httpurl, that.model, method)
  2413. .then((res) => {
  2414. if (res.success) {
  2415. that.$message.success(res.message);
  2416. that.$emit("ok", res.result);
  2417. } else {
  2418. if (res.message.indexOf("与预约时间有冲突") >= 0) {
  2419. } else {
  2420. that.$message.warning(res.message);
  2421. }
  2422. }
  2423. })
  2424. .finally(() => {
  2425. that.confirmLoading = false;
  2426. });
  2427. },
  2428. });
  2429. } else {
  2430. that.$message.warning(res.message);
  2431. }
  2432. }
  2433. })
  2434. .finally(() => {
  2435. that.confirmLoading = false;
  2436. });
  2437. } else {
  2438. console.log(err);
  2439. var keys = Object.keys(err);
  2440. console.log("keys", keys);
  2441. var some = keys.some(
  2442. (t) => t.indexOf("roomIds[" + this.roomIdsIndex + "]") >= 0
  2443. );
  2444. if (!some) {
  2445. this.$message.warning("请输入其他房间必填信息");
  2446. }
  2447. }
  2448. });
  2449. },
  2450. },
  2451. };
  2452. </script>
  2453. <style scoped>
  2454. /deep/ .ant-btn-link {
  2455. flex: 1;
  2456. color: rgba(255, 141, 26, 1) !important;
  2457. }
  2458. /deep/ .ant-btn-background-ghost {
  2459. color: rgba(0, 0, 0, 0.45) !important;
  2460. }
  2461. .menu {
  2462. display: flex;
  2463. flex-direction: column;
  2464. flex: 1;
  2465. color: #fff;
  2466. margin-top: 12px;
  2467. }
  2468. .dynamic-delete-button {
  2469. cursor: pointer;
  2470. position: relative;
  2471. /* top: 4px; */
  2472. margin-left: 5px;
  2473. font-size: 18px;
  2474. color: #1890ff;
  2475. transition: all 0.3s;
  2476. }
  2477. .dynamic-delete-button:hover {
  2478. color: #777;
  2479. }
  2480. .dynamic-delete-button[disabled] {
  2481. cursor: not-allowed;
  2482. opacity: 0.5;
  2483. }
  2484. /deep/.ant-table-thead > tr > th {
  2485. background: rgba(42, 130, 228, 1);
  2486. color: #ffffff;
  2487. }
  2488. /deep/.ant-divider-horizontal {
  2489. margin: 12px 0 !important;
  2490. }
  2491. /deep/ .ant-table-tbody .ant-table-row td {
  2492. padding-top: 5px;
  2493. padding-bottom: 5px;
  2494. }
  2495. /deep/.ant-table-thead > tr > th,
  2496. .ant-table-tbody > tr > td {
  2497. padding: 5px 5px !important;
  2498. overflow-wrap: break-word;
  2499. }
  2500. /deep/ .ant-form-item {
  2501. margin-bottom: 5px !important;
  2502. }
  2503. /deep/ .ant-tabs-nav .ant-tabs-tab-active {
  2504. color: rgba(255, 141, 26, 1);
  2505. }
  2506. /deep/.ant-tabs-nav .ant-tabs-tab:hover {
  2507. color: rgba(255, 141, 26, 1);
  2508. }
  2509. /deep/.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active {
  2510. color: rgba(255, 141, 26, 1);
  2511. }
  2512. </style>