createOrder.vue 26 KB

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