createOrder.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. <template>
  2. <view class="page" :style="{'padding-top':mt+'px'}">
  3. <c-nav-bar :title="!dataForm.id?'新增订单':!orderStatus?'编辑订单':'办理入住'" :showIcon="true"></c-nav-bar>
  4. <view class="box box1">
  5. <view class="tit">预订信息</view>
  6. <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  7. <u-cell customStyle="height:88rpx">
  8. <text>*</text>
  9. <text slot="icon" class="label">姓名</text>
  10. <view slot="title" class="title">
  11. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  12. placeholder="请输入姓名" v-model="dataForm.guestName"></u--input>
  13. </view>
  14. </u-cell>
  15. <u-cell customStyle="height:88rpx">
  16. <text slot="icon" class="label">手机号码</text>
  17. <view slot="title" class="title">
  18. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  19. placeholder="请输入手机号码" v-model="dataForm.guestPhone"></u--input>
  20. </view>
  21. </u-cell>
  22. <u-cell customStyle="height:88rpx">
  23. <text slot="icon" class="label">成人</text>
  24. <view slot="title" class="title">
  25. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  26. placeholder="请输入成人人数" v-model="dataForm.checkinGuests"></u--input>
  27. </view>
  28. </u-cell>
  29. <u-cell customStyle="height:88rpx">
  30. <text slot="icon" class="label">儿童</text>
  31. <view slot="title" class="title">
  32. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  33. placeholder="请输入儿童人数" v-model="dataForm.childCheckinNums"></u--input>
  34. </view>
  35. </u-cell>
  36. <u-cell :isLink="true" @click="showLaiyuan=true">
  37. <text slot="icon" class="label">订单来源</text>
  38. <view slot="title" class="title">
  39. {{dataForm.guestSourceName||''}}
  40. </view>
  41. </u-cell>
  42. </u-cell-group>
  43. </view>
  44. <view class="box">
  45. <view class="tit tit2">入住登记<u-icon @click="goStayCheck()" name="plus-circle" label="添加入住人"
  46. labelColor="#1372FF" labelSize="24" color="1372FF" size="30"></u-icon></view>
  47. <view class="perItem" v-for="(item,index) in dataForm.detailFormList[0].checkInPersonList" :key="index">
  48. <text>{{item.checkInName}}</text>
  49. <text style="margin-left: 40px;">{{item.idCard}}</text>
  50. <u-icon name="close-circle-fill" color="#ddd" size="30" @click="delPer(index)"></u-icon>
  51. </view>
  52. </view>
  53. <view class="box box1">
  54. <view class="tit">房间信息</view>
  55. <view class="dateBetween">
  56. <view class="start" v-if="dataForm.arriveDate">
  57. <text>入住日期</text>
  58. <text class="txt">{{dataForm.arriveDate.substring(5,10)}}</text>
  59. </view>
  60. <view class="dateNum">共{{dataForm.num}}晚</view>
  61. <view class="end" v-if="dataForm.leaveDate">
  62. <text>离店日期</text>
  63. <text @click="showPick()" class="txt">{{dataForm.leaveDate.substring(5,10)}}</text>
  64. <u-datetime-picker :show="leaveDateShow" mode="date" ref="picker" @cancel="leaveDateShow=false"
  65. @confirm="credentialsConfirmtime" :defaultIndex="credentialsDefaulttime"></u-datetime-picker>
  66. </view>
  67. </view>
  68. <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  69. <u-cell isLink="true" @click="checkInTypeShow=true">
  70. <text slot="icon" class="label">入住类型</text>
  71. <view slot="title" class="title">
  72. {{dataForm.detailFormList[0].checkInTypeName}}
  73. </view>
  74. </u-cell>
  75. <u-cell>
  76. <text slot="icon" class="label">房间类型</text>
  77. <view slot="title" class="title">
  78. {{dataForm.houseBaseName}}
  79. </view>
  80. </u-cell>
  81. <u-cell>
  82. <text slot="icon" class="label bold">房间号</text>
  83. <view slot="title" class="title">
  84. {{dataForm.detailFormList[0].roomNumber}}
  85. </view>
  86. </u-cell>
  87. <!-- <u-cell>
  88. <text slot="icon" class="label bold"></text>
  89. <view slot="title" class="title">
  90. {{dataForm.detailFormList[0].roomAmount}}
  91. </view>
  92. </u-cell> -->
  93. <u-cell customStyle="height:88rpx;" style="display: flex; justify-content: space-between;"
  94. :border="false">
  95. <text slot="icon" class="label bold">房价</text>
  96. <view slot="title" class="title">
  97. <input class="input" inputAlign="right" placeholderStyle="font-size:26rpx" placeholder="请输入"
  98. @change="compoutPrice()" v-model="dataForm.detailFormList[0].roomAmount"
  99. :adjust-position="true" style=" margin-bottom: 5rpx; height: 50rpx; " />
  100. </view>
  101. </u-cell>
  102. </u-cell-group>
  103. </view>
  104. <view class="box">
  105. <view class="tit tit2"><text>消费信息</text> <u-icon @click="addBreast()" name="plus-circle" label="添加消费"
  106. labelColor="#1372FF" labelSize="24" color="1372FF" size="30"></u-icon></view>
  107. <u-swipe-action>
  108. <u-swipe-action-item :show="item.show" :index="index" class=""
  109. v-for="(item, index) in dataForm.detailFormList[0].breakfastData" :key="index" @click="click(index)"
  110. :options="options">
  111. <view class="goodsInfo item">
  112. <view class="title-wrap">
  113. <text class="title u-line-2">{{item.breakfastName}}/{{item.num}}/{{item.price}}</text>
  114. </view>
  115. </view>
  116. </u-swipe-action-item>
  117. <u-swipe-action-item :show="item.show" :index="index2" class=""
  118. v-for="(item, index2) in dataForm.detailFormList[0].otherData" :key="index2" @click="click2(index2)"
  119. :options="options">
  120. <view class="goodsInfo item">
  121. <view class="title-wrap">
  122. <text class="title u-line-2">{{item.projectName}}/{{item.num}}/{{item.defaultPrice}}</text>
  123. </view>
  124. </view>
  125. </u-swipe-action-item>
  126. </u-swipe-action>
  127. </view>
  128. <view class="box">
  129. <view class="tit tit2"><text>收款信息</text> <u-icon @click="addpay()" name="plus-circle" label="添加收款"
  130. labelColor="#1372FF" labelSize="24" color="1372FF" size="30"></u-icon></view>
  131. <u-swipe-action>
  132. <u-swipe-action-item :show="item.show" :index="index" class=""
  133. v-for="(item, index) in dataForm.flowRecord" :key="index" @click="click3(index)" :options="options">
  134. <view class="goodsInfo item">
  135. <view class="title-wrap">
  136. <text
  137. class="title u-line-2">{{item.flowTypeName}}/{{item.payTypeName}}/{{item.amount}}</text>
  138. </view>
  139. </view>
  140. </u-swipe-action-item>
  141. </u-swipe-action>
  142. </view>
  143. <view class="box">
  144. <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  145. <u-cell customStyle="height:88rpx" :border="false">
  146. <text slot="icon" class="label bold">备注</text>
  147. <view slot="title" class="titlebeuzhu" style="text-align: right;">
  148. <!-- <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  149. type="textarea" placeholder="请输入" v-model="dataForm.remarks" height="200"></u--input> -->
  150. <input class="input" inputAlign="right" placeholderStyle="font-size:26rpx" placeholder="请输入"
  151. :adjust-position="true" v-model="dataForm.remarks"
  152. style=" margin-bottom: 5rpx; height: 50rpx; " />
  153. </view>
  154. </u-cell>
  155. </u-cell-group>
  156. </view>
  157. <view class="footer">
  158. <view class="total"><text>订单金额:</text><text>¥{{totalMOney}}</text></view>
  159. <view class="btns">
  160. <text @click="confirmOrder(2)" v-if="today==1">直接入住</text>
  161. <text @click="confirmOrder()" v-if="!orderStatus">保存</text>
  162. <!-- 新增和编辑时由此按钮 -->
  163. </view>
  164. </view>
  165. <u-picker :itemHeight="88" :immediateChange="true" :show="showLaiyuan" :columns="laiyuan" title="来源选择"
  166. keyName="guestSource" :defaultIndex="passengerDefault" @cancel="showLaiyuan=false;"
  167. @confirm="passengerConfirm"></u-picker>
  168. <u-picker :itemHeight="88" :immediateChange="true" :show="checkInTypeShow" :columns="checkInType" title="入住类型选择"
  169. keyName="label" :defaultIndex="passengerDefault2" @cancel="checkInTypeShow=false;"
  170. @confirm="passengerConfirm2"></u-picker>
  171. </view>
  172. </template>
  173. <script>
  174. import {
  175. encrypt
  176. } from '../../utils/aes.js'
  177. export default {
  178. data() {
  179. return {
  180. credentialsDefaulttime: [10, 1, 0],
  181. titleStyle: {
  182. fontSize: '34rpx',
  183. fontWeight: "bold",
  184. },
  185. showLaiyuan: false,
  186. checkInTypeShow: false,
  187. passengerDefault: [0],
  188. passengerDefault2: [0],
  189. leaveDateShow: false,
  190. options: [{
  191. text: '删除',
  192. style: {
  193. backgroundColor: '#dd524d'
  194. }
  195. }],
  196. orderStatus: null,
  197. totalMOney: 0, //订单总金额
  198. dataForm: {
  199. arriveDate: "",
  200. detailFormList: [{
  201. breakfastAmount: 0,
  202. checkInPersonList: [],
  203. checkInType: 0,
  204. checkInTypeName: '',
  205. id: 0,
  206. otherAmount: 0,
  207. roomAmount: 0,
  208. roomIds: "",
  209. breakfastData: [],
  210. otherData: [],
  211. roomNumber: "",
  212. }],
  213. flowRecord: [],
  214. guestName: "",
  215. guestPhone: "",
  216. guestSourceId: null,
  217. guestSourceName: null,
  218. homestayId: uni.getStorageSync('homestayId'),
  219. houseBaseId: 0,
  220. houseBaseName: '',
  221. leaveDate: "",
  222. num: 0,
  223. orderStatus: null,
  224. remarks: "",
  225. checkinGuests: null,
  226. childCheckinNums: null
  227. },
  228. checkInType: [
  229. [{
  230. label: '正常入住',
  231. val: 1
  232. }, {
  233. label: '自用房',
  234. val: 2
  235. },
  236. {
  237. label: '免费入住',
  238. val: 3
  239. }
  240. ]
  241. ],
  242. flowTypeNames: ['微信', '支付宝', '云闪付'],
  243. roomId: '',
  244. laiyuan: [
  245. []
  246. ],
  247. currentDate: '',
  248. today: '',
  249. //加密备用
  250. tempCheckInPersonList: [],
  251. tempGuestName: null,
  252. tempGuestPhone: null,
  253. oldVal: ''
  254. }
  255. },
  256. onReady() {
  257. // 微信小程序需要用此写法
  258. },
  259. onLoad(opt) {
  260. setTimeout(() => {
  261. this.getLaiyuan();
  262. }, 1000)
  263. this.getLaiyuan();
  264. if (opt.roomId) {
  265. this.roomId = opt.roomId.split(',');
  266. }
  267. if (opt.id) { //编辑
  268. if (opt.orderStatus) {
  269. this.orderStatus = opt.orderStatus;
  270. }
  271. this.dataForm.id = opt.id;
  272. this.getInfo2()
  273. } else {
  274. //新增获取简单信息
  275. this.getInfo();
  276. }
  277. // 当前日期
  278. let myDate = new Date();
  279. let year = myDate.getFullYear();
  280. let mon = myDate.getMonth() + 1;
  281. let day = myDate.getDate();
  282. mon = mon > 9 ? mon : '0' + mon;
  283. day = day > 9 ? day : '0' + day;
  284. this.currentDate = year + '-' + mon + '-' + day;
  285. },
  286. watch: {
  287. },
  288. onUnload() {
  289. uni.$off('toSendData');
  290. },
  291. methods: {
  292. compoutPrice(e) {
  293. this.dealTotalMoney();
  294. },
  295. dealTotalMoney() {
  296. let fjMoney = parseFloat(this.dataForm.detailFormList[0].roomAmount) || 0;
  297. let bdList = this.dataForm.detailFormList[0].breakfastData;
  298. let bdMoney = bdList.reduce((cur, pre) => cur + pre.price * pre.num, 0);
  299. let odList = this.dataForm.detailFormList[0].otherData;
  300. let odMoney = odList.reduce((cur, pre) => cur + pre.defaultPrice * pre.num, 0);
  301. let frList = this.dataForm.flowRecord;
  302. let frMoney = frList.reduce((cur, pre) => cur + (parseFloat(pre.amount) || 0), 0);
  303. // this.totalMOney = fjMoney+bdMoney+odMoney-frMoney;
  304. this.totalMOney = fjMoney + bdMoney + odMoney;
  305. },
  306. showPick() {
  307. this.leaveDateShow = true;
  308. this.$refs.picker.innerValue = new Date().getTime()
  309. },
  310. //i计算天数
  311. getDaysBetween(dateString1, dateString2) {
  312. var startDate = Date.parse(dateString1);
  313. var endDate = Date.parse(dateString2);
  314. if (startDate > endDate) {
  315. return 0;
  316. }
  317. if (startDate == endDate) {
  318. return 1;
  319. }
  320. var days = (endDate - startDate) / (1 * 24 * 60 * 60 * 1000);
  321. this.dataForm.num = days;
  322. //return days;
  323. },
  324. credentialsConfirmtime(e) {
  325. // 创建一个Date对象并传入时间戳
  326. const date = new Date(e.value);
  327. // 使用Date对象的方法获取年、月、日、小时、分钟和秒
  328. const year = date.getFullYear();
  329. const month = ('0' + (date.getMonth() + 1)).slice(-2);
  330. const day = ('0' + date.getDate()).slice(-2);
  331. // 格式化时间
  332. const formattedTime = `${year}-${month}-${day}`;
  333. this.dataForm.leaveDate = formattedTime;
  334. this.getDaysBetween(this.dataForm.arriveDate, this.dataForm.leaveDate);
  335. this.leaveDateShow = false;
  336. },
  337. compareDate(data) {
  338. let data2 = data.substring(0, 10);
  339. if (
  340. new Date(data2).getTime() < new Date(this.currentDate).getTime()
  341. ) {
  342. this.today = -1;
  343. }
  344. if (
  345. new Date(data2).getTime() == new Date(this.currentDate).getTime()
  346. ) {
  347. this.today = 1;
  348. }
  349. if (
  350. new Date(data2).getTime() > new Date(this.currentDate).getTime()
  351. ) {
  352. this.today = 2;
  353. }
  354. },
  355. //添加入住人
  356. goStayCheck() {
  357. //let list = JSON.stringify(this.dataForm);
  358. uni.$once('toSendData', () => {
  359. uni.$emit('sendData', this.dataForm)
  360. })
  361. uni.navigateTo({
  362. url: '/pages/house/stayCheck',
  363. events: {
  364. addSuccess: data => {
  365. console.log(data.data)
  366. this.dataForm.detailFormList[0].checkInPersonList = data.data || [];
  367. }
  368. },
  369. })
  370. },
  371. //添加早餐
  372. addBreast() {
  373. let list = JSON.stringify(this.dataForm.detailFormList[0].breakfastData);
  374. let list2 = JSON.stringify(this.dataForm.detailFormList[0].otherData)
  375. uni.navigateTo({
  376. url: '/pages/house/breast?list1=' + list + '&list2=' + list2,
  377. events: {
  378. addSuccess: data => {
  379. this.dataForm.detailFormList[0].breakfastData = data.data1.filter((item) => item
  380. .num && item
  381. .num != 0);
  382. this.dataForm.detailFormList[0].otherData = data.data2.filter((item) => item.num &&
  383. item.num !=
  384. 0);
  385. this.dataForm.detailFormList[0].breakfastAmount = 0;
  386. this.dataForm.detailFormList[0].otherAmount = 0;
  387. for (let i = 0; i < this.dataForm.detailFormList[0].breakfastData.length; i++) {
  388. this.dataForm.detailFormList[0].breakfastAmount += parseFloat(this.dataForm
  389. .detailFormList[0].breakfastData[i]
  390. .price) * this.dataForm.detailFormList[0].breakfastData[i].num;
  391. }
  392. for (let i = 0; i < this.dataForm.detailFormList[0].otherData.length; i++) {
  393. this.dataForm.detailFormList[0].otherAmount += parseFloat(this.dataForm
  394. .detailFormList[0].otherData[i]
  395. .defaultPrice) * this.dataForm.detailFormList[0].otherData[i].num;
  396. }
  397. this.dealTotalMoney();
  398. }
  399. }
  400. })
  401. },
  402. //添加收款
  403. addpay() {
  404. uni.navigateTo({
  405. url: '/pages/house/payAdd?money=' + this.totalMOney + '&list=' +
  406. JSON.stringify(this.dataForm.flowRecord),
  407. events: {
  408. addSuccess: data => {
  409. if (data.data.amount != 0) {
  410. this.dataForm.flowRecord = this.dataForm.flowRecord || [];
  411. this.dataForm.flowRecord.push(data.data)
  412. this.dealTotalMoney();
  413. }
  414. }
  415. }
  416. })
  417. },
  418. delPer(index) {
  419. this.dataForm.detailFormList[0].checkInPersonList.splice(index, 1)
  420. },
  421. confirmOrder(orderStatus) {
  422. if (!this.dataForm.guestName) {
  423. this.$showToast('请输入姓名');
  424. return
  425. }
  426. let value = this.dataForm.guestPhone;
  427. if (value.indexOf("**") > -1) {
  428. value = value.replace(/\*/g, "5");
  429. }
  430. if (!this.$u.test.mobile(value)) {
  431. this.$showToast('请输入正确手机号');
  432. return
  433. }
  434. if (!this.dataForm.guestSourceName) {
  435. this.$showToast('请选择来源');
  436. return
  437. }
  438. // if (!this.dataForm.detailFormList[0].checkInPersonList || this.dataForm.detailFormList[0].checkInPersonList
  439. // .length == 0) {
  440. // this.$showToast('请添加入住人');
  441. // return
  442. // }
  443. //orderStatus//预约入住 1,直接入住2
  444. // if (orderStatus) {
  445. // this.dataForm.orderStatus = orderStatus ;
  446. // }
  447. if (!this.dataForm.orderStatus) {
  448. this.dataForm.orderStatus = orderStatus || 1;
  449. } else {
  450. this.dataForm.orderStatus = orderStatus || this.dataForm.orderStatus;
  451. }
  452. let url = '';
  453. if (this.dataForm.id) {
  454. url = '/merchant/hotel/order/updOrder'
  455. if (this.orderStatus) {
  456. this.dataForm.orderStatus = this.orderStatus;
  457. }
  458. } else {
  459. url = '/merchant/hotel/order/placeOrder'
  460. }
  461. //加密
  462. let newDataForm = JSON.parse(JSON.stringify(this.dataForm));
  463. if (
  464. newDataForm.guestName &&
  465. this.tempGuestName != newDataForm.guestName
  466. ) {
  467. //编辑了
  468. newDataForm.guestName = encrypt(
  469. newDataForm.guestName
  470. );
  471. } else {
  472. newDataForm.guestName = null;
  473. }
  474. if (
  475. newDataForm.guestPhone &&
  476. this.tempGuestPhone != newDataForm.guestPhone
  477. ) {
  478. newDataForm.guestPhone = encrypt(
  479. newDataForm.guestPhone
  480. );
  481. } else {
  482. newDataForm.guestPhone = null;
  483. }
  484. let checkInPersonList =
  485. newDataForm.detailFormList[0].checkInPersonList;
  486. //入住人里面身份证
  487. //let len = this.tempCheckInPersonList;
  488. checkInPersonList.forEach((element, i) => {
  489. //姓名 checkInName,idCard,checkInPhone
  490. //新增直接加密,编辑判断是否修改
  491. if (
  492. (this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||(
  493. element.checkInName &&
  494. element.checkInName != this.tempCheckInPersonList[i].checkInName)
  495. ) {
  496. element.checkInName = encrypt(element.checkInName);
  497. } else {
  498. element.checkInName = this.tempCheckInPersonList[i].checkInName2;
  499. }
  500. //身份证
  501. if (
  502. (this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||(
  503. element.idCard &&
  504. element.idCard != this.tempCheckInPersonList[i].idCard)
  505. ) {
  506. element.idCard = encrypt(element.idCard);
  507. } else {
  508. element.idCard = this.tempCheckInPersonList[i].idCard2;
  509. }
  510. //手机号
  511. if (
  512. (this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||
  513. (element.checkInPhone &&
  514. element.checkInPhone != this.tempCheckInPersonList[i].checkInPhone)
  515. ) {
  516. element.checkInPhone = encrypt(
  517. element.checkInPhone
  518. );
  519. } else {
  520. element.checkInPhone = this.tempCheckInPersonList[i].checkInPhone2;
  521. }
  522. });
  523. newDataForm.detailFormList[0].checkInPersonList = checkInPersonList;
  524. //return
  525. this.$api.post(url, newDataForm).then(res => {
  526. if (res.data.code == 0) {
  527. this.$showToast('操作成功');
  528. setTimeout(() => {
  529. uni.redirectTo({
  530. url: '/pagesMy/orderList/orderList'
  531. })
  532. }, 1500)
  533. }
  534. })
  535. },
  536. click(index) {
  537. this.dataForm.detailFormList[0].breakfastAmount -= this.dataForm.detailFormList[0].breakfastData[index]
  538. .price * this.dataForm.detailFormList[0].breakfastData[index].num;
  539. this.dataForm.detailFormList[0].breakfastData.splice(index, 1);
  540. this.dealTotalMoney();
  541. },
  542. click2(index) {
  543. this.dataForm.detailFormList[0].otherAmount -= this.dataForm.detailFormList[0].otherData[index]
  544. .defaultPrice * this.dataForm.detailFormList[0].otherData[index].num;
  545. this.dataForm.detailFormList[0].otherData.splice(index, 1);
  546. this.dealTotalMoney();
  547. },
  548. click3(index) {
  549. this.dataForm.flowRecord.splice(index, 1);
  550. this.dealTotalMoney();
  551. },
  552. getLaiyuan() {
  553. this.$api.get("/merchant/hotel/room/state/getSourceDownBox", {
  554. homestayId: this.dataForm.homestayId,
  555. })
  556. .then((res) => {
  557. if (res.data.code == 0) {
  558. this.laiyuan = [res.data.data];
  559. }
  560. });
  561. },
  562. getInfo2() { //详情信息
  563. this.$api.get('/merchant/hotel/order/getOrderDetail/' + this.dataForm.id).then(res => {
  564. if (res.data.code == 0) {
  565. this.dataForm = {
  566. ...this.dataForm,
  567. ...res.data.data,
  568. };
  569. //加密备用
  570. if (this.dataForm.detailFormList[0].checkInPersonList.length != 0) {
  571. this.tempCheckInPersonList = JSON.parse(
  572. JSON.stringify(this.dataForm.detailFormList[0].checkInPersonList)
  573. );
  574. } //入住人集合
  575. this.tempGuestName = this.dataForm.guestName;
  576. this.tempGuestPhone = this.dataForm.guestPhone;
  577. this.compareDate(this.dataForm.arriveDate);
  578. this.dataForm.detailFormList[0].checkInType = res.data.data.detailFormList[0].checkInType;
  579. this.dataForm.detailFormList[0].checkInTypeName = this.checkInType[0].filter((item => item
  580. .val == this.dataForm.detailFormList[0].checkInType))[0].label;
  581. this.totalMOney = this.dataForm.orderAmount;
  582. this.oldVal = this.totalMOney;
  583. this.dataForm.flowRecord.forEach((i, index) => {
  584. let flowTypeName = i.flowType == 1 ? '收款' : '退款';
  585. var payTypeName = '微信';
  586. if (i.payType) {
  587. payTypeName = this.flowTypeNames[i.payType - 1];
  588. }
  589. this.$set(this.dataForm.flowRecord[index], 'flowTypeName', flowTypeName)
  590. this.$set(this.dataForm.flowRecord[index], 'payTypeName', payTypeName)
  591. })
  592. }
  593. })
  594. },
  595. // 房型列表
  596. getInfo() {
  597. this.$api.post('/merchant/hotel/order/getRoomInfoList', this.roomId).then(res => {
  598. if (res.data.code == 0) {
  599. this.dataForm.detailFormList[0].roomIds = res.data.data.roomIds;
  600. this.dataForm.detailFormList[0].roomNumber = res.data.data.roomNumber;
  601. this.dataForm.detailFormList[0].checkInType = res.data.data.checkInType;
  602. this.dataForm.detailFormList[0].checkInTypeName = this.checkInType[0].filter((item => item
  603. .val == res.data.data.checkInType))[0].label;
  604. this.dataForm.detailFormList[0].roomAmount = res.data.data.roomAmount;
  605. this.dataForm.arriveDate = res.data.data.arriveDate;
  606. this.compareDate(this.dataForm.arriveDate);
  607. this.dataForm.leaveDate = res.data.data.leaveDate;
  608. this.dataForm.houseBaseId = res.data.data.houseBaseId;
  609. this.dataForm.houseBaseName = res.data.data.houseBaseName;
  610. this.dataForm.num = res.data.data.num;
  611. this.totalMOney = res.data.data.roomAmount;
  612. this.oldVal = this.totalMOney;
  613. }
  614. })
  615. },
  616. // 来源
  617. passengerConfirm(e) {
  618. this.dataForm.guestSourceId = e.value[0].id;
  619. this.dataForm.guestSourceName = e.value[0].guestSource;
  620. this.showLaiyuan = false;
  621. },
  622. //入住类型
  623. passengerConfirm2(e) {
  624. this.dataForm.detailFormList[0].checkInType = e.value[0].val;
  625. this.dataForm.detailFormList[0].checkInTypeName = e.value[0].label;
  626. this.checkInTypeShow = false;
  627. }
  628. }
  629. }
  630. </script>
  631. <style>
  632. .u-swipe-action-item__right__button__wrapper__text {
  633. font-size: 28rpx !important;
  634. }
  635. .u-cell__body__content {
  636. overflow: hidden !important;
  637. box-sizing: border-box !important;
  638. }
  639. </style>
  640. <style lang="scss" scoped>
  641. .u-swipe-action-item__right__button__wrapper {
  642. height: 36px
  643. }
  644. .u-swipe-action-item__right__button__wrapper__text {
  645. font-size: 28rpx;
  646. }
  647. .footer {
  648. position: fixed;
  649. bottom: 0;
  650. width: 100%;
  651. background-color: #fff;
  652. left: 0;
  653. z-index: 99;
  654. padding: 30rpx;
  655. box-sizing: border-box;
  656. .total {
  657. text {
  658. color: #1372FF;
  659. font-size: 32rpx;
  660. &:first-child {
  661. color: #333;
  662. }
  663. }
  664. }
  665. .btns {
  666. display: flex;
  667. justify-content: space-between;
  668. margin-top: 30rpx;
  669. text {
  670. display: inline-block;
  671. width: 48%;
  672. height: 96rpx;
  673. line-height: 96rpx;
  674. text-align: center;
  675. font-size: 34rpx;
  676. border-radius: 48rpx;
  677. border: 1rpx solid #D1D1D1;
  678. color: #999;
  679. margin: 0 3%;
  680. flex: 1;
  681. &:last-child {
  682. background-color: #1372FF;
  683. color: #fff;
  684. }
  685. }
  686. }
  687. }
  688. .u-cell__body {
  689. padding: 0 !important;
  690. }
  691. .page {
  692. background: #F3F4F4;
  693. padding-bottom: 360rpx;
  694. box-sizing: border-box;
  695. overflow-y: auto;
  696. overflow-x: auto;
  697. }
  698. .box {
  699. background-color: #fff;
  700. margin: 20rpx auto 0;
  701. border-radius: 10rpx;
  702. width: 96%;
  703. padding: 0 30rpx 30rpx;
  704. box-sizing: border-box;
  705. // overflow-y: auto;
  706. // overflow-x: auto;
  707. .label {
  708. color: #333;
  709. font-size: 30rpx;
  710. &.bold {
  711. font-weight: bold;
  712. font-size: 32rpx;
  713. }
  714. }
  715. &.box1 {
  716. padding: 0 30rpx;
  717. .title {
  718. text-align: right;
  719. }
  720. }
  721. .title {
  722. color: #999;
  723. }
  724. }
  725. .tit,
  726. .tit2 {
  727. font-size: 32rpx;
  728. font-weight: bold;
  729. padding-top: 30rpx;
  730. color: #333;
  731. margin-bottom: 10rpx;
  732. }
  733. .tit2 {
  734. display: flex;
  735. justify-content: space-between;
  736. align-items: center;
  737. }
  738. .goodsInfo.item {
  739. padding: 20rpx 0;
  740. text {
  741. font-size: 30rpx;
  742. }
  743. }
  744. .perItem {
  745. display: flex;
  746. align-items: center;
  747. padding: 26rpx 0;
  748. border-bottom: 1rpx solid #E1E1E1;
  749. &:last-child {
  750. border: 0;
  751. }
  752. text {
  753. font-size: 30rpx;
  754. color: #333;
  755. &:nth-of-type(2) {
  756. flex: 1;
  757. margin: 0 10rpx;
  758. }
  759. }
  760. }
  761. .dateBetween {
  762. display: flex;
  763. justify-content: space-between;
  764. align-items: center;
  765. padding: 20rpx 0 30rpx;
  766. border-bottom: 1rpx solid #E1E1E1;
  767. .start,
  768. .end {
  769. text-align: center;
  770. display: flex;
  771. flex-direction: column;
  772. justify-content: center;
  773. text {
  774. &.txt {
  775. font-size: 40rpx;
  776. font-weight: bold;
  777. margin-top: 20rpx;
  778. }
  779. }
  780. }
  781. .dateNum {
  782. text-align: center;
  783. border-radius: 30rpx;
  784. display: inline-block;
  785. width: 120rpx;
  786. height: 50rpx;
  787. line-height: 50rpx;
  788. font-size: 30rpx;
  789. color: #333;
  790. background-color: #F9FAFC;
  791. }
  792. }
  793. </style>