BillRoomForm.vue 116 KB

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