BillRoomForm.vue 101 KB

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