BillRoomForm.vue 95 KB

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