createOrder.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  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. console.log(this.dataForm)
  362. uni.navigateTo({
  363. url: '/pages/house/stayCheck',
  364. events: {
  365. addSuccess: data => {
  366. console.log(data.data)
  367. this.dataForm.detailFormList[0].checkInPersonList = data.data || [];
  368. }
  369. },
  370. })
  371. },
  372. //添加早餐
  373. addBreast() {
  374. let list = JSON.stringify(this.dataForm.detailFormList[0].breakfastData);
  375. let list2 = JSON.stringify(this.dataForm.detailFormList[0].otherData)
  376. uni.navigateTo({
  377. url: '/pages/house/breast?list1=' + list + '&list2=' + list2,
  378. events: {
  379. addSuccess: data => {
  380. this.dataForm.detailFormList[0].breakfastData = data.data1.filter((item) => item
  381. .num && item
  382. .num != 0);
  383. this.dataForm.detailFormList[0].otherData = data.data2.filter((item) => item.num &&
  384. item.num !=
  385. 0);
  386. this.dataForm.detailFormList[0].breakfastAmount = 0;
  387. this.dataForm.detailFormList[0].otherAmount = 0;
  388. for (let i = 0; i < this.dataForm.detailFormList[0].breakfastData.length; i++) {
  389. this.dataForm.detailFormList[0].breakfastAmount += parseFloat(this.dataForm
  390. .detailFormList[0].breakfastData[i]
  391. .price) * this.dataForm.detailFormList[0].breakfastData[i].num;
  392. }
  393. for (let i = 0; i < this.dataForm.detailFormList[0].otherData.length; i++) {
  394. this.dataForm.detailFormList[0].otherAmount += parseFloat(this.dataForm
  395. .detailFormList[0].otherData[i]
  396. .defaultPrice) * this.dataForm.detailFormList[0].otherData[i].num;
  397. }
  398. this.dealTotalMoney();
  399. }
  400. }
  401. })
  402. },
  403. //添加收款
  404. addpay() {
  405. uni.navigateTo({
  406. url: '/pages/house/payAdd?money=' + this.totalMOney + '&list=' +
  407. JSON.stringify(this.dataForm.flowRecord),
  408. events: {
  409. addSuccess: data => {
  410. if (data.data.amount != 0) {
  411. this.dataForm.flowRecord = this.dataForm.flowRecord || [];
  412. this.dataForm.flowRecord.push(data.data)
  413. this.dealTotalMoney();
  414. }
  415. }
  416. }
  417. })
  418. },
  419. delPer(index) {
  420. this.dataForm.detailFormList[0].checkInPersonList.splice(index, 1)
  421. },
  422. confirmOrder(orderStatus) {
  423. if (!this.dataForm.guestName) {
  424. this.$showToast('请输入姓名');
  425. return
  426. }
  427. let value = this.dataForm.guestPhone;
  428. if (value.indexOf("**") > -1) {
  429. value = value.replace(/\*/g, "5");
  430. }
  431. if (!this.$u.test.mobile(value)) {
  432. this.$showToast('请输入正确手机号');
  433. return
  434. }
  435. if (!this.dataForm.guestSourceName) {
  436. this.$showToast('请选择来源');
  437. return
  438. }
  439. // if (!this.dataForm.detailFormList[0].checkInPersonList || this.dataForm.detailFormList[0].checkInPersonList
  440. // .length == 0) {
  441. // this.$showToast('请添加入住人');
  442. // return
  443. // }
  444. //orderStatus//预约入住 1,直接入住2
  445. // if (orderStatus) {
  446. // this.dataForm.orderStatus = orderStatus ;
  447. // }
  448. if (!this.dataForm.orderStatus) {
  449. this.dataForm.orderStatus = orderStatus || 1;
  450. } else {
  451. this.dataForm.orderStatus = orderStatus || this.dataForm.orderStatus;
  452. }
  453. let url = '';
  454. if (this.dataForm.id) {
  455. url = '/merchant/hotel/order/updOrder'
  456. if (this.orderStatus) {
  457. this.dataForm.orderStatus = this.orderStatus;
  458. }
  459. } else {
  460. url = '/merchant/hotel/order/placeOrder'
  461. }
  462. //加密
  463. let newDataForm = JSON.parse(JSON.stringify(this.dataForm));
  464. if (
  465. newDataForm.guestName &&
  466. this.tempGuestName != newDataForm.guestName
  467. ) {
  468. //编辑了
  469. newDataForm.guestName = encrypt(
  470. newDataForm.guestName
  471. );
  472. } else {
  473. newDataForm.guestName = null;
  474. }
  475. if (
  476. newDataForm.guestPhone &&
  477. this.tempGuestPhone != newDataForm.guestPhone
  478. ) {
  479. newDataForm.guestPhone = encrypt(
  480. newDataForm.guestPhone
  481. );
  482. } else {
  483. newDataForm.guestPhone = null;
  484. }
  485. let checkInPersonList =
  486. newDataForm.detailFormList[0].checkInPersonList;
  487. //入住人里面身份证
  488. //let len = this.tempCheckInPersonList;
  489. console.log(newDataForm.detailFormList[0].checkInPersonList)
  490. checkInPersonList.forEach((element, i) => {
  491. //姓名 checkInName,idCard,checkInPhone
  492. //新增直接加密,编辑判断是否修改
  493. if (
  494. (this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||(
  495. element.checkInName &&
  496. element.checkInName != this.tempCheckInPersonList[i].checkInName)
  497. ) {
  498. element.checkInName = encrypt(element.checkInName);
  499. } else {
  500. element.checkInName = this.tempCheckInPersonList[i].checkInName2;
  501. }
  502. //身份证
  503. if (
  504. (this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||(
  505. element.idCard &&
  506. element.idCard != this.tempCheckInPersonList[i].idCard)
  507. ) {
  508. element.idCard = encrypt(element.idCard);
  509. } else {
  510. element.idCard = this.tempCheckInPersonList[i].idCard2;
  511. }
  512. //手机号
  513. if (
  514. (this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||
  515. (element.checkInPhone &&
  516. element.checkInPhone != this.tempCheckInPersonList[i].checkInPhone)
  517. ) {
  518. element.checkInPhone = encrypt(
  519. element.checkInPhone
  520. );
  521. } else {
  522. element.checkInPhone = this.tempCheckInPersonList[i].checkInPhone2;
  523. }
  524. });
  525. newDataForm.detailFormList[0].checkInPersonList = checkInPersonList;
  526. //return
  527. this.$api.post(url, newDataForm).then(res => {
  528. if (res.data.code == 0) {
  529. this.$showToast('操作成功');
  530. setTimeout(() => {
  531. uni.redirectTo({
  532. url: '/pagesMy/orderList/orderList'
  533. })
  534. }, 1500)
  535. }
  536. })
  537. },
  538. click(index) {
  539. this.dataForm.detailFormList[0].breakfastAmount -= this.dataForm.detailFormList[0].breakfastData[index]
  540. .price * this.dataForm.detailFormList[0].breakfastData[index].num;
  541. this.dataForm.detailFormList[0].breakfastData.splice(index, 1);
  542. this.dealTotalMoney();
  543. },
  544. click2(index) {
  545. this.dataForm.detailFormList[0].otherAmount -= this.dataForm.detailFormList[0].otherData[index]
  546. .defaultPrice * this.dataForm.detailFormList[0].otherData[index].num;
  547. this.dataForm.detailFormList[0].otherData.splice(index, 1);
  548. this.dealTotalMoney();
  549. },
  550. click3(index) {
  551. this.dataForm.flowRecord.splice(index, 1);
  552. this.dealTotalMoney();
  553. },
  554. getLaiyuan() {
  555. this.$api.get("/merchant/hotel/room/state/getSourceDownBox", {
  556. homestayId: this.dataForm.homestayId,
  557. })
  558. .then((res) => {
  559. if (res.data.code == 0) {
  560. this.laiyuan = [res.data.data];
  561. }
  562. });
  563. },
  564. getInfo2() { //详情信息
  565. this.$api.get('/merchant/hotel/order/getOrderDetail/' + this.dataForm.id).then(res => {
  566. if (res.data.code == 0) {
  567. this.dataForm = {
  568. ...this.dataForm,
  569. ...res.data.data,
  570. };
  571. //加密备用
  572. if (this.dataForm.detailFormList[0].checkInPersonList.length != 0) {
  573. this.tempCheckInPersonList = JSON.parse(
  574. JSON.stringify(this.dataForm.detailFormList[0].checkInPersonList)
  575. );
  576. } //入住人集合
  577. this.tempGuestName = this.dataForm.guestName;
  578. this.tempGuestPhone = this.dataForm.guestPhone;
  579. this.compareDate(this.dataForm.arriveDate);
  580. this.dataForm.detailFormList[0].checkInType = res.data.data.detailFormList[0].checkInType;
  581. this.dataForm.detailFormList[0].checkInTypeName = this.checkInType[0].filter((item => item
  582. .val == this.dataForm.detailFormList[0].checkInType))[0].label;
  583. this.totalMOney = this.dataForm.orderAmount;
  584. this.oldVal = this.totalMOney;
  585. this.dataForm.flowRecord.forEach((i, index) => {
  586. let flowTypeName = i.flowType == 1 ? '收款' : '退款';
  587. var payTypeName = '微信';
  588. if (i.payType) {
  589. payTypeName = this.flowTypeNames[i.payType - 1];
  590. }
  591. this.$set(this.dataForm.flowRecord[index], 'flowTypeName', flowTypeName)
  592. this.$set(this.dataForm.flowRecord[index], 'payTypeName', payTypeName)
  593. })
  594. }
  595. })
  596. },
  597. // 房型列表
  598. getInfo() {
  599. this.$api.post('/merchant/hotel/order/getRoomInfoList', this.roomId).then(res => {
  600. if (res.data.code == 0) {
  601. this.dataForm.detailFormList[0].roomIds = res.data.data.roomIds;
  602. this.dataForm.detailFormList[0].roomNumber = res.data.data.roomNumber;
  603. this.dataForm.detailFormList[0].checkInType = res.data.data.checkInType;
  604. this.dataForm.detailFormList[0].checkInTypeName = this.checkInType[0].filter((item => item
  605. .val == res.data.data.checkInType))[0].label;
  606. this.dataForm.detailFormList[0].roomAmount = res.data.data.roomAmount;
  607. this.dataForm.arriveDate = res.data.data.arriveDate;
  608. this.compareDate(this.dataForm.arriveDate);
  609. this.dataForm.leaveDate = res.data.data.leaveDate;
  610. this.dataForm.houseBaseId = res.data.data.houseBaseId;
  611. this.dataForm.houseBaseName = res.data.data.houseBaseName;
  612. this.dataForm.num = res.data.data.num;
  613. this.totalMOney = res.data.data.roomAmount;
  614. this.oldVal = this.totalMOney;
  615. }
  616. })
  617. },
  618. // 来源
  619. passengerConfirm(e) {
  620. this.dataForm.guestSourceId = e.value[0].id;
  621. this.dataForm.guestSourceName = e.value[0].guestSource;
  622. this.showLaiyuan = false;
  623. },
  624. //入住类型
  625. passengerConfirm2(e) {
  626. this.dataForm.detailFormList[0].checkInType = e.value[0].val;
  627. this.dataForm.detailFormList[0].checkInTypeName = e.value[0].label;
  628. this.checkInTypeShow = false;
  629. }
  630. }
  631. }
  632. </script>
  633. <style>
  634. .u-swipe-action-item__right__button__wrapper__text {
  635. font-size: 28rpx !important;
  636. }
  637. .u-cell__body__content {
  638. overflow: hidden !important;
  639. box-sizing: border-box !important;
  640. }
  641. </style>
  642. <style lang="scss" scoped>
  643. .u-swipe-action-item__right__button__wrapper {
  644. height: 36px
  645. }
  646. .u-swipe-action-item__right__button__wrapper__text {
  647. font-size: 28rpx;
  648. }
  649. .footer {
  650. position: fixed;
  651. bottom: 0;
  652. width: 100%;
  653. background-color: #fff;
  654. left: 0;
  655. z-index: 99;
  656. padding: 30rpx;
  657. box-sizing: border-box;
  658. .total {
  659. text {
  660. color: #1372FF;
  661. font-size: 32rpx;
  662. &:first-child {
  663. color: #333;
  664. }
  665. }
  666. }
  667. .btns {
  668. display: flex;
  669. justify-content: space-between;
  670. margin-top: 30rpx;
  671. text {
  672. display: inline-block;
  673. width: 48%;
  674. height: 96rpx;
  675. line-height: 96rpx;
  676. text-align: center;
  677. font-size: 34rpx;
  678. border-radius: 48rpx;
  679. border: 1rpx solid #D1D1D1;
  680. color: #999;
  681. margin: 0 3%;
  682. flex: 1;
  683. &:last-child {
  684. background-color: #1372FF;
  685. color: #fff;
  686. }
  687. }
  688. }
  689. }
  690. .u-cell__body {
  691. padding: 0 !important;
  692. }
  693. .page {
  694. background: #F3F4F4;
  695. padding-bottom: 360rpx;
  696. box-sizing: border-box;
  697. overflow-y: auto;
  698. overflow-x: auto;
  699. }
  700. .box {
  701. background-color: #fff;
  702. margin: 20rpx auto 0;
  703. border-radius: 10rpx;
  704. width: 96%;
  705. padding: 0 30rpx 30rpx;
  706. box-sizing: border-box;
  707. // overflow-y: auto;
  708. // overflow-x: auto;
  709. .label {
  710. color: #333;
  711. font-size: 30rpx;
  712. &.bold {
  713. font-weight: bold;
  714. font-size: 32rpx;
  715. }
  716. }
  717. &.box1 {
  718. padding: 0 30rpx;
  719. .title {
  720. text-align: right;
  721. }
  722. }
  723. .title {
  724. color: #999;
  725. }
  726. }
  727. .tit,
  728. .tit2 {
  729. font-size: 32rpx;
  730. font-weight: bold;
  731. padding-top: 30rpx;
  732. color: #333;
  733. margin-bottom: 10rpx;
  734. }
  735. .tit2 {
  736. display: flex;
  737. justify-content: space-between;
  738. align-items: center;
  739. }
  740. .goodsInfo.item {
  741. padding: 20rpx 0;
  742. text {
  743. font-size: 30rpx;
  744. }
  745. }
  746. .perItem {
  747. display: flex;
  748. align-items: center;
  749. padding: 26rpx 0;
  750. border-bottom: 1rpx solid #E1E1E1;
  751. &:last-child {
  752. border: 0;
  753. }
  754. text {
  755. font-size: 30rpx;
  756. color: #333;
  757. &:nth-of-type(2) {
  758. flex: 1;
  759. margin: 0 10rpx;
  760. }
  761. }
  762. }
  763. .dateBetween {
  764. display: flex;
  765. justify-content: space-between;
  766. align-items: center;
  767. padding: 20rpx 0 30rpx;
  768. border-bottom: 1rpx solid #E1E1E1;
  769. .start,
  770. .end {
  771. text-align: center;
  772. display: flex;
  773. flex-direction: column;
  774. justify-content: center;
  775. text {
  776. &.txt {
  777. font-size: 40rpx;
  778. font-weight: bold;
  779. margin-top: 20rpx;
  780. }
  781. }
  782. }
  783. .dateNum {
  784. text-align: center;
  785. border-radius: 30rpx;
  786. display: inline-block;
  787. width: 120rpx;
  788. height: 50rpx;
  789. line-height: 50rpx;
  790. font-size: 30rpx;
  791. color: #333;
  792. background-color: #F9FAFC;
  793. }
  794. }
  795. </style>