BillRoomForm.vue 106 KB

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