BillRoomInfo.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. <template>
  2. <div>
  3. <div style="display: flex; gap: 15px">
  4. <div style="width: 40%">
  5. <div style="display: flex; justify-content: space-between">
  6. <h4
  7. style="
  8. color: rgba(255, 141, 26, 1);
  9. font-weight: 600;
  10. margin-top: 15px;
  11. "
  12. >
  13. 入住信息
  14. </h4>
  15. <div style="display: flex">
  16. <div style="display: flex; flex-direction: column">
  17. <a-icon
  18. type="clock-circle"
  19. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  20. /><a-button type="link"> 叫醒服务 </a-button>
  21. </div>
  22. <div style="display: flex; flex-direction: column">
  23. <a-icon
  24. type="compass"
  25. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  26. /><a-button
  27. type="link"
  28. :disabled="selectRoomId == '1'"
  29. @click="splitLiving"
  30. >
  31. 拆分房间
  32. </a-button>
  33. </div>
  34. </div>
  35. </div>
  36. <a-divider />
  37. <a-tabs @change="tabChange">
  38. <a-tab-pane
  39. :key="item.roomId"
  40. v-for="(item, livingIndex) in model.livingRoomIds"
  41. >
  42. <span slot="tab">
  43. {{ item.roomName }}
  44. <a-badge
  45. dot
  46. :number-style="{ backgroundColor: '#52c41a' }"
  47. v-if="item.livingOrder.settleType == 1"
  48. >
  49. <span style="font-size: 12px">已结退房</span>
  50. </a-badge>
  51. <a-badge
  52. dot
  53. :number-style="{ backgroundColor: '#52c41a' }"
  54. v-if="item.livingOrder.settleType == 2"
  55. >
  56. <span style="font-size: 12px">未结退房</span>
  57. </a-badge>
  58. </span>
  59. <a-descriptions :column="2">
  60. <a-descriptions-item label="主客姓名">
  61. {{ item.livingCustomers[0].customerName }}
  62. <a-icon
  63. type="edit"
  64. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  65. /></a-descriptions-item>
  66. <a-descriptions-item label="性别">
  67. {{
  68. item.livingCustomers[0].gender === 1 ? "男" : "女"
  69. }}</a-descriptions-item
  70. >
  71. <a-descriptions-item label="房间数量">
  72. {{ livingIndex == 0 ? model.livingRoomIds.length : 1 }}间
  73. </a-descriptions-item>
  74. <a-descriptions-item label="手机号">
  75. {{ item.livingCustomers[0].phone }}
  76. <a-icon
  77. type="edit"
  78. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  79. /></a-descriptions-item>
  80. <a-descriptions-item label="宾客类型">
  81. {{ customerTypeName(model.orderInfo.customerType) }}
  82. <a-icon
  83. type="edit"
  84. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  85. /></a-descriptions-item>
  86. <a-descriptions-item label="入住时间">
  87. {{ model.orderInfo.arrivalTime }}
  88. </a-descriptions-item>
  89. <a-descriptions-item label="房价方案"> -- </a-descriptions-item>
  90. <a-descriptions-item label="预离时间">
  91. {{ model.orderInfo.dueOutTime }}
  92. </a-descriptions-item>
  93. <a-descriptions-item label="订单来源">
  94. {{ customerSourceName(model.orderInfo.customerSource) }}
  95. <a-icon
  96. type="edit"
  97. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  98. /></a-descriptions-item>
  99. <a-descriptions-item label="入住类型">
  100. {{ model.orderInfo.bookingType == 1 ? "全天" : "钟点" }}
  101. </a-descriptions-item>
  102. <a-descriptions-item label="入住天数">
  103. {{ model.orderInfo.dayCount }}
  104. </a-descriptions-item>
  105. <a-descriptions-item label="早餐券">
  106. {{ model.orderInfo.breakfastNum }}
  107. </a-descriptions-item>
  108. <a-descriptions-item label="外部单号">
  109. {{ model.orderInfo.outerOrdersNo }}
  110. </a-descriptions-item>
  111. <a-descriptions-item label="销售员工">
  112. {{ warranterName(model.orderInfo.warranter) }}
  113. <a-icon
  114. type="edit"
  115. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  116. /></a-descriptions-item>
  117. <a-descriptions-item label="订单备注" :span="2">
  118. {{ model.orderInfo.remark
  119. }}<a-icon
  120. type="edit"
  121. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  122. />
  123. </a-descriptions-item>
  124. <a-descriptions-item
  125. label="叫醒服务"
  126. :span="2"
  127. v-for="(item, index) in wakeList"
  128. :key="index"
  129. >
  130. <a-select
  131. style="width: 100px"
  132. placeholder="房间号"
  133. @change="onChange"
  134. >
  135. <a-select-option value="jack"> 1001 </a-select-option>
  136. <a-select-option value="lucy"> 1002 </a-select-option>
  137. </a-select>
  138. <a-date-picker
  139. style="width: 120px; margin-left: 2px"
  140. placeholder="日期"
  141. @change="onChange"
  142. />
  143. <a-time-picker
  144. style="width: 100px; margin-left: 2px"
  145. :default-value="moment('12:08', 'HH:mm')"
  146. format="HH:mm"
  147. />
  148. <a-icon
  149. v-if="wakeList.length - 1 == index"
  150. type="plus-circle"
  151. class="dynamic-delete-button"
  152. @click="puls()"
  153. />
  154. <a-icon
  155. type="minus-circle"
  156. style="color: #f56c6c"
  157. class="dynamic-delete-button"
  158. v-if="wakeList.length > 1"
  159. @click="() => remove(index)"
  160. />
  161. </a-descriptions-item>
  162. </a-descriptions>
  163. <div style="display: flex; justify-content: space-between">
  164. <h4
  165. style="
  166. color: rgba(255, 141, 26, 1);
  167. font-weight: 600;
  168. margin-top: 15px;
  169. "
  170. >
  171. 同住人
  172. </h4>
  173. <div style="display: flex">
  174. <div style="display: flex; flex-direction: column">
  175. <a-icon
  176. type="user-add"
  177. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  178. /><a-button
  179. type="link"
  180. @click="addlivingCustomer(item.livingOrder.id, item.roomId)"
  181. >
  182. 添加
  183. </a-button>
  184. </div>
  185. </div>
  186. </div>
  187. <div id="livingCustomers-grid">
  188. <a-row
  189. v-for="(customer, index) in item.livingCustomers"
  190. :key="customer.id"
  191. >
  192. <template v-if="index > 0">
  193. <a-col :span="7"> {{ customer.customerName }} </a-col>
  194. <a-col :span="1"
  195. >{{ customer.gender == 1 ? "男" : "女" }}
  196. </a-col>
  197. <a-col :span="8"> {{ customer.certNo }}</a-col>
  198. <a-col :span="6"> {{ customer.phone }}</a-col>
  199. <a-col :span="2">
  200. <a-icon
  201. type="minus-circle"
  202. style="color: #f56c6c"
  203. class="dynamic-delete-button"
  204. @click="() => removeLivingCustomer(customer.id)"
  205. /></a-col>
  206. </template>
  207. </a-row>
  208. </div>
  209. </a-tab-pane>
  210. </a-tabs>
  211. <template v-if="vipCustomer && vipCustomer.id">
  212. <h4
  213. style="
  214. color: rgba(255, 141, 26, 1);
  215. font-weight: 600;
  216. margin-top: 50px;
  217. "
  218. >
  219. 会员信息
  220. </h4>
  221. <a-divider />
  222. <a-descriptions :column="2">
  223. <a-descriptions-item label="姓名">
  224. {{ vipCustomer.name }}
  225. </a-descriptions-item>
  226. <a-descriptions-item label="证件号"
  227. >{{ vipCustomer.certificateNo }}
  228. </a-descriptions-item>
  229. <a-descriptions-item label="卡号">
  230. {{ vipCustomer.cardNo }}
  231. </a-descriptions-item>
  232. <a-descriptions-item label="手机号">
  233. {{ vipCustomer.mobile }}
  234. </a-descriptions-item>
  235. <a-descriptions-item label="会员级别">
  236. {{ vipCustomer.gradeName }}
  237. </a-descriptions-item>
  238. <a-descriptions-item label="余额"
  239. >{{ vipCustomer.balance.toFixed(2) }} 元
  240. </a-descriptions-item>
  241. <a-descriptions-item label="积分">
  242. {{ vipCustomer.integral }} 分
  243. </a-descriptions-item>
  244. </a-descriptions></template
  245. >
  246. </div>
  247. <div style="width: 40%">
  248. <div style="display: flex; justify-content: space-between">
  249. <h4
  250. style="
  251. color: rgba(255, 141, 26, 1);
  252. font-weight: 600;
  253. margin-top: 15px;
  254. "
  255. >
  256. 消费详情
  257. </h4>
  258. <div style="display: flex">
  259. <div style="display: flex; flex-direction: column">
  260. <a-icon
  261. type="import"
  262. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  263. /><a-button type="link"> 退单 </a-button>
  264. </div>
  265. <div style="display: flex; flex-direction: column">
  266. <a-icon
  267. type="tool"
  268. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  269. /><a-button type="link"> 补单 </a-button>
  270. </div>
  271. <div style="display: flex; flex-direction: column">
  272. <a-icon
  273. type="property-safety"
  274. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  275. /><a-button
  276. type="link"
  277. :disabled="selectedRowKeys1.length == 0 || selectRoomId == '1'"
  278. @click="partialSettle"
  279. >
  280. 部分结账
  281. </a-button>
  282. </div>
  283. </div>
  284. </div>
  285. <a-divider />
  286. <a-table
  287. :columns="columns"
  288. :data-source="feesList"
  289. :pagination="false"
  290. :scroll="{ y: 160 }"
  291. rowKey="id"
  292. :row-selection="rowSelection"
  293. >
  294. <template slot="subjectType" slot-scope="text, record, index">
  295. {{ getSubjectTypeText(text) }}
  296. </template>
  297. <template slot="roomId" slot-scope="text, record, index">
  298. {{ getRoomName(text) }}
  299. </template>
  300. </a-table>
  301. <div
  302. style="
  303. color: rgba(255, 87, 51, 1);
  304. font-weight: 600;
  305. text-align: right;
  306. "
  307. >
  308. 合计消费:{{ feesAmount.toFixed(2) }}
  309. </div>
  310. <div
  311. style="
  312. display: flex;
  313. justify-content: space-between;
  314. margin-top: 30px;
  315. "
  316. >
  317. <h4
  318. style="
  319. color: rgba(255, 141, 26, 1);
  320. font-weight: 600;
  321. margin-top: 15px;
  322. "
  323. >
  324. 收款详情
  325. </h4>
  326. <div style="display: flex">
  327. <div style="display: flex; flex-direction: column">
  328. <a-icon
  329. type="transaction"
  330. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  331. /><a-button type="link"> 收款 </a-button>
  332. </div>
  333. <div style="display: flex; flex-direction: column">
  334. <a-icon
  335. type="trademark"
  336. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  337. /><a-button type="link"> 退款 </a-button>
  338. </div>
  339. <div style="display: flex; flex-direction: column">
  340. <a-icon
  341. type="pound"
  342. style="color: rgba(255, 141, 26, 1); font-size: 18px"
  343. /><a-button type="link"> 冲账 </a-button>
  344. </div>
  345. </div>
  346. </div>
  347. <a-divider />
  348. <a-table
  349. :columns="columns2"
  350. :data-source="paymentList"
  351. :pagination="false"
  352. :scroll="{ y: 160 }"
  353. rowKey="id"
  354. :rowSelection="{
  355. selectedRowKeys: selectedRowKeys,
  356. onChange: onSelectChange,
  357. }"
  358. >
  359. <template slot="payType" slot-scope="text, record, index">
  360. {{ getPayTypeText(text) }}
  361. </template>
  362. <template slot="subjectType" slot-scope="text, record, index">
  363. {{ getSubjectTypeText(record.subjectType) }}
  364. </template>
  365. </a-table>
  366. <div
  367. style="
  368. color: rgba(255, 87, 51, 1);
  369. font-weight: 600;
  370. text-align: right;
  371. "
  372. >
  373. 合计收款:{{ paymentAmount.toFixed(2) }}
  374. </div>
  375. </div>
  376. <div style="width: 20%">
  377. <h4 style="color: rgba(255, 141, 26, 1); font-weight: 600">财务汇总</h4>
  378. <a-divider />
  379. <a-descriptions :column="1">
  380. <a-descriptions-item label="合计收款">
  381. + {{ paymentAmount.toFixed(2) }}
  382. </a-descriptions-item>
  383. <a-descriptions-item label="合计消费"
  384. >-{{ feesAmount.toFixed(2) }}
  385. </a-descriptions-item>
  386. <a-descriptions-item
  387. label="结账应退"
  388. v-if="paymentAmount - feesAmount > 0"
  389. >
  390. {{ (paymentAmount - feesAmount).toFixed(2) }}
  391. </a-descriptions-item>
  392. <a-descriptions-item label="结账应收" v-else>
  393. {{ (paymentAmount - feesAmount).toFixed(2) }}
  394. </a-descriptions-item>
  395. </a-descriptions>
  396. <a-button
  397. v-if="paymentAmount - feesAmount > 0"
  398. @click="handleAdd"
  399. type="danger"
  400. style="margin-left: 100px"
  401. :disabled="btnSisabled"
  402. >结账退款</a-button
  403. >
  404. <a-button
  405. v-else
  406. @click="handleAdd"
  407. type="danger"
  408. style="margin-left: 100px"
  409. :disabled="btnSisabled"
  410. >结账收款</a-button
  411. >
  412. </div>
  413. </div>
  414. <customer-modal ref="modalCustomerForm" @ok="modalFormOk"></customer-modal>
  415. <refund-modal ref="modalRefundForm" @ok="modalFormOk"></refund-modal>
  416. <payment-modal ref="modalPaymentForm" @ok="modalFormOk"></payment-modal>
  417. </div>
  418. </template>
  419. <script>
  420. import { httpAction, getAction, deleteAction } from "@/api/manage";
  421. import { validateDuplicateValue } from "@/utils/util";
  422. import moment from "moment";
  423. import CustomerModal from "./CustomerModal.vue";
  424. import RefundModal from "./RefundModal.vue";
  425. import PaymentModal from "./PaymentModal.vue";
  426. import { match } from "assert";
  427. import { postAction } from "../../../../api/manage";
  428. const columns = [
  429. // {
  430. // title: "",
  431. // dataIndex: "key",
  432. // width: 20,
  433. // },
  434. {
  435. title: "房间号",
  436. dataIndex: "roomId",
  437. width: 70,
  438. scopedSlots: { customRender: "roomId" },
  439. },
  440. {
  441. title: "费项",
  442. dataIndex: "subjectType",
  443. width: 60,
  444. scopedSlots: { customRender: "subjectType" },
  445. },
  446. {
  447. title: "入账日期",
  448. dataIndex: "dayTime",
  449. width: 110,
  450. },
  451. {
  452. title: "单价",
  453. dataIndex: "id",
  454. // width: 60,
  455. customRender: function (text, record) {
  456. return record.money;
  457. },
  458. },
  459. {
  460. title: "优惠价",
  461. dataIndex: "money",
  462. // width: 80,
  463. },
  464. {
  465. title: "数量",
  466. dataIndex: "feeType",
  467. // width: 60,
  468. customRender: function (text) {
  469. return 1;
  470. },
  471. },
  472. {
  473. title: "小计",
  474. dataIndex: "livingOrderId",
  475. // width: 60,
  476. customRender: function (text, record) {
  477. return record.money;
  478. },
  479. },
  480. ];
  481. const columns2 = [
  482. {
  483. title: "入账时间",
  484. dataIndex: "createTime",
  485. // width: 110,
  486. },
  487. {
  488. title: "支付方式",
  489. dataIndex: "payType",
  490. // width: 100,
  491. scopedSlots: { customRender: "payType" },
  492. },
  493. {
  494. title: "备注",
  495. dataIndex: "remark",
  496. // width: 120,
  497. scopedSlots: { customRender: "subjectType" },
  498. },
  499. {
  500. title: "金额",
  501. dataIndex: "money",
  502. // width: 60,
  503. },
  504. ];
  505. const data = [];
  506. for (let i = 0; i < 100; i++) {
  507. data.push({
  508. key: i,
  509. name: `100${i}`,
  510. age: "房费",
  511. address: 280,
  512. });
  513. }
  514. const data2 = [];
  515. for (let i = 0; i < 8; i++) {
  516. data2.push({
  517. key: i,
  518. name: `2023-02-0${i} 10:52`,
  519. age: "支付宝",
  520. remark: "押金",
  521. amount: 888,
  522. });
  523. }
  524. const date = new Date();
  525. const endDate = new Date(date.setDate(date.getDate() + 1));
  526. export default {
  527. name: "BusMeetingRoomForm",
  528. components: { CustomerModal, RefundModal, PaymentModal },
  529. props: {
  530. //表单禁用
  531. disabled: {
  532. type: Boolean,
  533. default: false,
  534. required: false,
  535. },
  536. },
  537. data() {
  538. return {
  539. selectedRowKeys: [],
  540. data,
  541. columns,
  542. data2,
  543. columns2,
  544. wakeList: [{}],
  545. model: {
  546. // data: data,
  547. orderInfo: {},
  548. roomIds: [],
  549. layoutDayPrices: [],
  550. livingRoomIds: [],
  551. },
  552. labelCol: {
  553. xs: { span: 24 },
  554. sm: { span: 5 },
  555. },
  556. wrapperCol: {
  557. xs: { span: 24 },
  558. sm: { span: 16 },
  559. },
  560. confirmLoading: false,
  561. validatorRules: {
  562. dateRange: [{ required: true, message: "请选择维修时间!" }],
  563. remark: [{ required: true, message: "请输入维修原因!" }],
  564. },
  565. url: {
  566. add: "/business/busMeetingRoom/add",
  567. edit: "/business/busMeetingRoom/edit",
  568. queryById: "/business/busMeetingRoom/queryById",
  569. getBookingOrderInfo:
  570. "/business/busRoomBookingOrders/getBookingOrderInfo",
  571. },
  572. id: "",
  573. customerSourceList: [],
  574. warranterList: [],
  575. key: 0,
  576. feesList: [],
  577. oldfeesList: [],
  578. paymentList: [],
  579. oldpaymentList: [],
  580. payTypeList: [],
  581. vipCustomer: {},
  582. selectRoomId: "1",
  583. selectedRowKeys1: [],
  584. };
  585. },
  586. computed: {
  587. formDisabled() {
  588. return this.disabled;
  589. },
  590. feesAmount() {
  591. return this.feesList.reduce(function (total, item) {
  592. return total + item.money;
  593. }, 0);
  594. },
  595. paymentAmount() {
  596. var list = this.paymentList.filter((t) => t.subjectType !== 5);
  597. var amount = list.reduce(function (total, item) {
  598. return total + item.money;
  599. }, 0);
  600. var list2 = this.paymentList.filter((t) => t.subjectType == 5);
  601. var amount2 = list2.reduce(function (total, item) {
  602. return total + item.money;
  603. }, 0);
  604. return amount - amount2;
  605. },
  606. btnSisabled() {
  607. var index = this.model.livingRoomIds.findLastIndex(
  608. (t) => t.roomId == this.selectRoomId
  609. );
  610. var find = this.model.livingRoomIds[index];
  611. if (find) {
  612. return find.livingOrder.settleType == 1;
  613. }
  614. return false;
  615. },
  616. rowSelection() {
  617. return {
  618. onChange: (selectedRowKeys, selectedRows) => {
  619. // console.log(
  620. // `selectedRowKeys: ${selectedRowKeys}`,
  621. // "selectedRows: ",
  622. // selectedRows
  623. // );
  624. this.selectedRowKeys1 = selectedRowKeys;
  625. },
  626. getCheckboxProps: (record) => ({
  627. props: {
  628. disabled: record.preferentialStatus === 2,
  629. id: record.id,
  630. },
  631. }),
  632. };
  633. },
  634. },
  635. created() {
  636. var _info = JSON.parse(localStorage.getItem("storeInfo"));
  637. if (_info) {
  638. this.model.hotelId = _info.id;
  639. }
  640. //备份model原始值
  641. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  642. getAction("/business/busDictItem/list", {
  643. hotelId: _info.id,
  644. dictId: "1639538915239743490",
  645. }).then((res) => {
  646. if (res.success) {
  647. this.customerSourceList = res.result.records;
  648. }
  649. });
  650. getAction("/business/busSalesPerson/list", {
  651. hotelId: _info.id,
  652. pageNo: 1,
  653. pageSize: 100,
  654. }).then((res) => {
  655. if (res.success) {
  656. this.warranterList = res.result.records;
  657. }
  658. });
  659. },
  660. methods: {
  661. splitLiving() {
  662. var that = this;
  663. this.$confirm({
  664. title: "提示",
  665. content: "确认要拆分房间?",
  666. onOk: function () {
  667. var index = that.model.livingRoomIds.findLastIndex(
  668. (t) => t.roomId == that.selectRoomId
  669. );
  670. var livingRoom = that.model.livingRoomIds[index];
  671. httpAction(
  672. "business/busRoomBookingOrders/split-living?livingOrderId=" +
  673. livingRoom.livingOrder.id,
  674. {},
  675. "post"
  676. )
  677. .then((res) => {
  678. if (res.success) {
  679. that.$message.success("拆分成功");
  680. that.getBookingOrderInfo();
  681. that.$emit("ok");
  682. } else {
  683. that.$message.warning(res.message);
  684. }
  685. })
  686. .finally(() => {
  687. that.confirmLoading = false;
  688. });
  689. },
  690. });
  691. },
  692. partialSettle() {
  693. var list2 = this.feesList.filter((t) =>
  694. this.selectedRowKeys1.includes(t.id)
  695. );
  696. console.log(list2);
  697. var amount = list2.reduce(function (total, item) {
  698. return total + item.money;
  699. }, 0);
  700. var index = this.model.livingRoomIds.findLastIndex(
  701. (t) => t.roomId == this.selectRoomId
  702. );
  703. var livingRoom = this.model.livingRoomIds[index];
  704. this.$refs.modalPaymentForm.edit({
  705. billAmount: parseFloat(amount.toFixed(2)),
  706. deposit: 0,
  707. roomFee: parseFloat(amount.toFixed(2)),
  708. subjectType: 5,
  709. feeType: 2,
  710. bookingOrderId: this.model.orderInfo.id,
  711. livingOrderId:
  712. livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
  713. preferentialType: 1,
  714. couponFirstAmount: 0,
  715. discount: 9,
  716. vipCustomerId: this.model.orderInfo.vipCustomerId,
  717. selectedFeeIds: this.selectedRowKeys1,
  718. });
  719. this.$refs.modalPaymentForm.title = "部分结账收款";
  720. this.$refs.modalPaymentForm.disableSubmit = false;
  721. },
  722. tabChange(e) {
  723. console.log(e);
  724. this.selectRoomId = e;
  725. if (e == "1") {
  726. this.feesList = this.oldfeesList;
  727. this.paymentList = this.oldpaymentList;
  728. } else {
  729. this.feesList = this.oldfeesList.filter((t) => t.roomId == e);
  730. this.paymentList = this.oldpaymentList.filter((t) => t.roomId == e);
  731. }
  732. },
  733. getPayTypeText(text) {
  734. var find = this.payTypeList.find((t) => t.id == text);
  735. return find ? find.name : "";
  736. },
  737. getRoomName(id) {
  738. var index = this.model.livingRoomIds.findLastIndex((t) => t.roomId == id);
  739. var find = this.model.livingRoomIds[index];
  740. return find ? find.roomName : "";
  741. },
  742. getSubjectTypeText(text) {
  743. var msg = "";
  744. if (text == 1) {
  745. msg = "押金";
  746. } else if (text == 2) {
  747. msg = "预收房费";
  748. } else if (text == 3) {
  749. msg = "每日房费";
  750. } else if (text == 4) {
  751. msg = "优惠金额";
  752. } else if (text == 5) {
  753. msg = "结账收款";
  754. }
  755. return msg;
  756. },
  757. async getbusRoomPayType() {
  758. await getAction("/business/busRoomPayType/list", {
  759. pageSize: 99999,
  760. pageNo: 1,
  761. }).then((res) => {
  762. if (res.success) {
  763. this.payTypeList = res.result.records;
  764. }
  765. });
  766. },
  767. removeLivingCustomer(id) {
  768. deleteAction("/business/busLivingCustomer/delete", { id: id }).then(
  769. (res) => {
  770. if (res.success) {
  771. this.getBookingOrderInfo();
  772. }
  773. }
  774. );
  775. },
  776. addlivingCustomer(id, roomId) {
  777. console.log(id);
  778. this.$refs.modalCustomerForm.add(id, roomId);
  779. this.$refs.modalCustomerForm.title = "添加同住人";
  780. this.$refs.modalCustomerForm.disableSubmit = false;
  781. },
  782. modalFormOk(e) {
  783. this.getBookingOrderInfo();
  784. this.$emit("ok");
  785. },
  786. customerTypeName(customerType) {
  787. switch (customerType) {
  788. case 1:
  789. return "散客";
  790. case 2:
  791. return "会员";
  792. case 3:
  793. return "协议单位";
  794. case 4:
  795. return "中介";
  796. default:
  797. return "散客";
  798. }
  799. },
  800. warranterName(warranter) {
  801. var find = this.warranterList.find((t) => t.id == warranter);
  802. return find ? find.name : "--";
  803. },
  804. customerSourceName(customerSource) {
  805. var find = this.customerSourceList.find((t) => t.id == customerSource);
  806. return find ? find.itemText : "--";
  807. },
  808. getMemberCard() {
  809. getAction("/business/busMemberCard/list", {
  810. id: this.model.orderInfo.vipCustomerId,
  811. }).then((res) => {
  812. if (res.success) {
  813. if (res.result.records && res.result.records.length > 0) {
  814. this.vipCustomer = res.result.records[0];
  815. }
  816. }
  817. });
  818. },
  819. async getBookingOrderInfo() {
  820. if (this.payTypeList == 0) {
  821. await this.getbusRoomPayType();
  822. }
  823. var obj = {
  824. bookingNo: this.id,
  825. };
  826. if (this.key && this.key == 1) {
  827. obj = {
  828. bookingOrderId: this.id,
  829. };
  830. }
  831. getAction(this.url.getBookingOrderInfo, obj).then((res) => {
  832. if (res.success) {
  833. var livingRoomId = JSON.parse(
  834. JSON.stringify(res.result.livingRoomIds[0])
  835. );
  836. livingRoomId.roomId = "1";
  837. livingRoomId.roomName = "全部";
  838. var list = [];
  839. res.result.livingRoomIds.forEach((t) => {
  840. list = [...list, ...t.livingCustomers];
  841. });
  842. livingRoomId.livingCustomers = list;
  843. res.result.livingRoomIds.unshift(livingRoomId);
  844. this.model = res.result;
  845. getAction("/business/busRoomBookingOrders/living-fees", {
  846. bookingOrderId: this.model.orderInfo.id,
  847. }).then((res) => {
  848. if (res.success) {
  849. if (res.result && res.result.length > 0) {
  850. this.feesList = res.result.filter((t) => t.feeType === 1);
  851. this.oldfeesList = JSON.parse(JSON.stringify(this.feesList));
  852. this.paymentList = res.result.filter((t) => t.feeType === 2);
  853. this.oldpaymentList = JSON.parse(
  854. JSON.stringify(this.paymentList)
  855. );
  856. }
  857. }
  858. });
  859. if (this.model.orderInfo.vipCustomerId) {
  860. this.getMemberCard();
  861. }
  862. }
  863. });
  864. },
  865. onSelectChange(selectedRowKeys, selectionRows) {
  866. this.selectedRowKeys = selectedRowKeys;
  867. this.selectionRows = selectionRows;
  868. },
  869. handleAdd() {
  870. var list = this.paymentList.filter((t) => t.subjectType === 1);
  871. var deposit = list.reduce(function (total, item) {
  872. return total + item.money;
  873. }, 0);
  874. var list2 = this.paymentList.filter((t) => t.subjectType === 2);
  875. var sum = list2.reduce(function (total, item) {
  876. return total + item.money;
  877. }, 0);
  878. var list3 = this.feesList.filter((t) => t.subjectType === 3);
  879. var sum2 = list3.reduce(function (total, item) {
  880. return total + item.money;
  881. }, 0);
  882. var index = this.model.livingRoomIds.findLastIndex(
  883. (t) => t.roomId == this.selectRoomId
  884. );
  885. var livingRoom = this.model.livingRoomIds[index];
  886. if (this.paymentAmount - this.feesAmount > 0) {
  887. this.$refs.modalRefundForm.edit({
  888. billRefund: this.paymentAmount - this.feesAmount,
  889. deposit: deposit - (sum - sum2),
  890. roomFee: sum - sum2,
  891. money: this.paymentAmount - this.feesAmount,
  892. subjectType: 5,
  893. feeType: 2,
  894. bookingOrderId: this.model.orderInfo.id,
  895. livingOrderId:
  896. livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
  897. });
  898. this.$refs.modalRefundForm.title = "结账退款";
  899. this.$refs.modalRefundForm.disableSubmit = false;
  900. } else {
  901. this.$refs.modalPaymentForm.edit({
  902. billAmount: parseFloat(
  903. Math.abs(this.paymentAmount - this.feesAmount).toFixed(2)
  904. ),
  905. deposit: deposit - (sum - sum2),
  906. roomFee: parseFloat(
  907. Math.abs(this.paymentAmount - this.feesAmount).toFixed(2)
  908. ),
  909. subjectType: 5,
  910. feeType: 2,
  911. bookingOrderId: this.model.orderInfo.id,
  912. livingOrderId:
  913. livingRoom.roomId != "1" ? livingRoom.livingOrder.id : "",
  914. preferentialType: 1,
  915. couponFirstAmount: 0,
  916. discount: 9,
  917. vipCustomerId: this.model.orderInfo.vipCustomerId,
  918. });
  919. this.$refs.modalPaymentForm.title = "结账收款";
  920. this.$refs.modalPaymentForm.disableSubmit = false;
  921. }
  922. },
  923. puls() {
  924. this.wakeList.push({});
  925. },
  926. remove(index) {
  927. this.wakeList.splice(index, 1);
  928. },
  929. moment,
  930. onChange(e) {
  931. console.log(e);
  932. },
  933. add(id, key) {
  934. this.key = key;
  935. this.id = id;
  936. this.edit(this.modelDefault);
  937. this.getBookingOrderInfo();
  938. },
  939. edit(record) {
  940. this.model = Object.assign({}, record);
  941. this.visible = true;
  942. },
  943. submitForm() {
  944. const that = this;
  945. that.$message.warning("未实现");
  946. return;
  947. // 触发表单验证
  948. this.$refs.form.validate((valid) => {
  949. if (valid) {
  950. that.confirmLoading = true;
  951. let httpurl = "";
  952. let method = "";
  953. if (!this.model.id) {
  954. httpurl += this.url.add;
  955. method = "post";
  956. } else {
  957. httpurl += this.url.edit;
  958. method = "put";
  959. }
  960. httpAction(httpurl, this.model, method)
  961. .then((res) => {
  962. if (res.success) {
  963. that.$message.success(res.message);
  964. that.$emit("ok");
  965. } else {
  966. that.$message.warning(res.message);
  967. }
  968. })
  969. .finally(() => {
  970. that.confirmLoading = false;
  971. });
  972. }
  973. });
  974. },
  975. },
  976. };
  977. </script>
  978. <style scoped>
  979. /deep/ .ant-btn-link {
  980. flex: 1;
  981. color: rgba(255, 141, 26, 1) !important;
  982. }
  983. .menu {
  984. display: flex;
  985. flex-direction: column;
  986. flex: 1;
  987. color: #fff;
  988. margin-top: 12px;
  989. }
  990. .dynamic-delete-button {
  991. cursor: pointer;
  992. position: relative;
  993. /* top: 4px; */
  994. margin-left: 5px;
  995. font-size: 18px;
  996. color: #1890ff;
  997. transition: all 0.3s;
  998. }
  999. .dynamic-delete-button:hover {
  1000. color: #777;
  1001. }
  1002. .dynamic-delete-button[disabled] {
  1003. cursor: not-allowed;
  1004. opacity: 0.5;
  1005. }
  1006. /deep/.ant-table-thead > tr > th {
  1007. background: rgba(42, 130, 228, 1);
  1008. color: #ffffff;
  1009. }
  1010. /deep/.ant-divider-horizontal {
  1011. margin: 12px 0 !important;
  1012. }
  1013. /deep/ .ant-table-tbody .ant-table-row td {
  1014. padding-top: 5px;
  1015. padding-bottom: 5px;
  1016. }
  1017. /deep/.ant-table-thead > tr > th,
  1018. .ant-table-tbody > tr > td {
  1019. padding: 5px 5px !important;
  1020. overflow-wrap: break-word;
  1021. }
  1022. #livingCustomers-grid [class~="ant-col"] {
  1023. border: #ccc 1px solid;
  1024. }
  1025. #livingCustomers-grid [class~="ant-col"]:last-child {
  1026. border: 0;
  1027. }
  1028. </style>