BillRoomForm.vue 102 KB

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