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