orderInfo.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <template>
  2. <view class="page" :style="{'height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="订单详情" showIcon="true" :titleStyle="titleStyle"></c-nav-bar>
  4. <view class="body" v-if="orderInfo.detailFormList[0]">
  5. <!-- 个人信息 -->
  6. <view class="uname">
  7. <text class="dtitle" style="margin-right: 50rpx;">{{orderInfo.guestName}}</text>
  8. <text class="dtitle" style="margin-right: 20rpx;">{{orderInfo.guestPhoneCopy}}</text>
  9. <image class="callphone"
  10. src="https://fsy.shengsi.gov.cn/file/20240710/efea82ea5afd4d719ba1d3f1c6bab998.png"
  11. @click="callPhone(orderInfo.guestPhone)"></image>
  12. </view>
  13. <!-- 房间信息 -->
  14. <view class="room">
  15. <!-- 房间/预定信息 -->
  16. <view class="reservations">
  17. <text class="dtitle">{{orderInfo.houseBaseName}}-{{orderInfo.detailFormList[0].roomNumber}}</text>
  18. <text class="r_status"
  19. :style="{'background': scolor[orderInfo.orderStatus]}">{{getStatusText()}}</text>
  20. </view>
  21. <!-- 时间/价格 -->
  22. <view class="time-price">
  23. <text style="font-size: 30rpx; color: #777;">{{orderInfo.arriveDate}}入住 {{orderInfo.num}}晚</text>
  24. <!-- <text style="font-size: 30rpx;font-weight: bold; color: #111;">¥{{orderInfo.orderAmount}}</text> -->
  25. </view>
  26. <view class="house-person">
  27. <text style="font-size: 30rpx; color: #777;">房间数量</text>
  28. <view class="right">
  29. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.detailFormList.length}}间
  30. </text>
  31. </view>
  32. </view>
  33. <view class="house-person">
  34. <text style="font-size: 30rpx; color: #777;">订单总金额</text>
  35. <view class="right">
  36. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">¥{{orderInfo.orderAmount}}
  37. </text>
  38. </view>
  39. </view>
  40. <!-- 入住成人人数 -->
  41. <!-- <view class="house-person">
  42. <text style="font-size: 30rpx; color: #777;">入住成人数量</text>
  43. <view class="right">
  44. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.checkinGuests||0}}人
  45. </text>
  46. </view>
  47. </view> -->
  48. <!-- 入住儿童人数 -->
  49. <!-- <view class="house-person">
  50. <text style="font-size: 30rpx; color: #777;">入住儿童数量</text>
  51. <view class="right">
  52. <text
  53. style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.childCheckinNums||0}}人
  54. </text>
  55. </view>
  56. </view> -->
  57. <!-- 订单信息 -->
  58. <view class="r_line"></view>
  59. <view class="house-person">
  60. <text style="font-size: 30rpx; color: #777;">订单号</text>
  61. <view class="right">
  62. <text style="font-size: 30rpx; color: #111; text-align: right;">
  63. {{orderInfo.orderCode}}
  64. </text>
  65. </view>
  66. </view>
  67. <view class="house-person">
  68. <text style="font-size: 30rpx; color: #777;">创建时间</text>
  69. <view class="right">
  70. <text style="font-size: 30rpx; color: #111; text-align: right;">
  71. {{orderInfo.orderTime}}
  72. </text>
  73. </view>
  74. </view>
  75. <view class="house-person" v-if="orderInfo.orderStatus==4">
  76. <text style="font-size: 30rpx; color: #777;">取消原因</text>
  77. <view class="right">
  78. <text style="font-size: 30rpx; color: #111; text-align: right;">
  79. {{orderInfo.refundReason}}
  80. </text>
  81. </view>
  82. </view>
  83. <view class="house-person">
  84. <text style="font-size: 30rpx; color: #777;">备注</text>
  85. <view class="right">
  86. <text style="font-size: 30rpx; color: #111; text-align: right;">
  87. {{orderInfo.remarks}}
  88. </text>
  89. </view>
  90. </view>
  91. </view>
  92. <!-- 其他消费 -->
  93. <view class="room" v-if="breakFastList.length>0||otherList.length>0">
  94. <view class="reservations">
  95. <text class="dtitle">其他消费</text>
  96. </view>
  97. <view class="house-person" v-for="(item,index) in breakFastList" :key="index"
  98. v-if="breakFastList.length>0">
  99. <text style="font-size: 30rpx; color: #777;">{{item.breakfastName}} X{{item.num}}</text>
  100. <view class="right">
  101. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">
  102. ¥{{item.price*item.num}}
  103. </text>
  104. </view>
  105. </view>
  106. <view class="house-person" v-for="(item,index) in otherList" :key="index" v-if="otherList.length>0">
  107. <text style="font-size: 30rpx; color: #777;">{{item.projectName}} X{{item.num}}</text>
  108. <view class="right">
  109. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">
  110. ¥{{item.defaultPrice*item.num}}
  111. </text>
  112. </view>
  113. </view>
  114. </view>
  115. <block v-if="orderInfo.repastList&&orderInfo.repastList.length>0">
  116. <view class="room" v-for="(item,index) in orderInfo.repastList" :key="index">
  117. <view class="dtitle" style="margin: 6rpx 0 40rpx;">餐饮订单详情</view>
  118. <view class="reservations">
  119. <text class="dtitle" style="color: #111;">{{item.comboName}}</text>
  120. <text class="r_status"
  121. :style="{'background': scolor[item.orderStatus]}">{{repastStr[item.orderStatus]}}</text>
  122. </view>
  123. <view class="time-price">
  124. <text style="font-size: 28rpx; color: #717171;">预约时间 {{item.repastTime}}</text>
  125. <text style="font-size: 30rpx;font-weight: bold; color: #111;">¥{{item.orderAmount}}</text>
  126. </view>
  127. <view class="r_line"></view>
  128. <view class="house-person">
  129. <text style="font-size: 30rpx; color: #777;">预约人姓名</text>
  130. <view class="right">
  131. <text style="font-size: 30rpx; color: #111; text-align: right;">
  132. {{item.guestName}}
  133. </text>
  134. </view>
  135. </view>
  136. <block v-if="item.comboType==1">
  137. <view class="house-person">
  138. <text style="font-size: 30rpx; color: #777;">成人人数</text>
  139. <view class="right">
  140. <text style="font-size: 30rpx; color: #111; text-align: right;">
  141. {{item.num}}
  142. </text>
  143. </view>
  144. </view>
  145. <view class="house-person">
  146. <text style="font-size: 30rpx; color: #777;">儿童人数</text>
  147. <view class="right">
  148. <text style="font-size: 30rpx; color: #111; text-align: right;">
  149. {{item.repastNum}}
  150. </text>
  151. </view>
  152. </view>
  153. </block>
  154. <block v-if="item.comboType==2">
  155. <view class="house-person">
  156. <text style="font-size: 30rpx; color: #777;">就餐份数</text>
  157. <view class="right">
  158. <text style="font-size: 30rpx; color: #111; text-align: right;">
  159. {{item.num}}份
  160. </text>
  161. </view>
  162. </view>
  163. </block>
  164. <view class="house-person">
  165. <text style="font-size: 30rpx; color: #777;">订单编号</text>
  166. <view class="right">
  167. <text style="font-size: 30rpx; color: #111; text-align: right;">
  168. {{item.orderCode}}
  169. </text>
  170. </view>
  171. </view>
  172. <view class="house-person">
  173. <text style="font-size: 30rpx; color: #777;">备注</text>
  174. <view class="right">
  175. <text style="font-size: 30rpx; color: #111; text-align: right;">
  176. {{item.remarks}}
  177. </text>
  178. </view>
  179. </view>
  180. </view>
  181. </block>
  182. <!-- 按钮 -->
  183. <view class="button" v-if="orderInfo.orderStatus==-1||orderInfo.orderStatus==1||orderInfo.orderStatus==2">
  184. <!-- 待确认 -->
  185. <template v-if="orderInfo.orderStatus==-1">
  186. <button class="edit" @click="cancle()">取消订单</button>
  187. <button class="goRoom" @click="show2=true">确认订单</button>
  188. </template>
  189. <!-- 已预订 -->
  190. <template v-if="orderInfo.orderStatus==1">
  191. <button class="edit" @click="edit()">编辑订单</button>
  192. <button class="edit" @click="cancle()" type="info">取消订单</button>
  193. <button class="goRoom" @click="checkIn(2)" v-if="showRuzhu">办理入住</button>
  194. </template>
  195. <!-- 已入住 -->
  196. <template v-if="orderInfo.orderStatus==2">
  197. <button class="edit" @click="edit()">编辑订单</button>
  198. <button class="goRoom" @click="show3=true">办理退房</button>
  199. </template>
  200. </view>
  201. </view>
  202. <!-- 取消订单 -->
  203. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  204. <view class="slot-content">
  205. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  206. <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  207. <u-cell>
  208. <view slot="title" class="title">
  209. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  210. placeholder="请输入原因" v-model="check.refundReason"></u--input>
  211. </view>
  212. </u-cell>
  213. </u-cell-group> -->
  214. </view>
  215. </u-modal>
  216. <!-- 确认订单 -->
  217. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  218. @cancel="show2=false">
  219. </u-modal>
  220. <!-- 办理退房 -->
  221. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  222. @cancel="show3=false">
  223. </u-modal>
  224. </view>
  225. </template>
  226. <script>
  227. export default {
  228. data() {
  229. return {
  230. titleStyle: {
  231. fontSize: '34rpx',
  232. fontWeight: "bold",
  233. },
  234. h: uni.getSystemInfoSync().windowHeight,
  235. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  236. show: false,
  237. show2: false,
  238. show3: false,
  239. check: {
  240. initiator: 1,
  241. refundReason: "",
  242. status: -1,
  243. orderCode: "",
  244. },
  245. showRuzhu: false,
  246. orderId: '',
  247. orderInfo: {
  248. detailFormList: []
  249. },
  250. id: '',
  251. scolor: {
  252. '-2': '#FF4141',
  253. '-1': '#FEA400',
  254. '1': '#FEA400',
  255. '2': '#A9B4C1',
  256. '3': '#A9B4C1',
  257. '4': '#A9B4C1',
  258. '5': '#A9B4C1',
  259. },
  260. repastStr: {
  261. '-2': '待支付',
  262. '1': '未核销',
  263. '2': '已核销',
  264. '4': '已取消',
  265. '5': '已退款'
  266. },
  267. breakFastList: [],
  268. otherList: [],
  269. }
  270. },
  271. onLoad(opt) {
  272. if (opt.orderId) {
  273. if (opt.orderType == 201) {
  274. this.id = opt.orderId;
  275. this.getrepast()
  276. } else {
  277. this.orderId = opt.orderId;
  278. this.getOrderInfo()
  279. }
  280. }
  281. },
  282. methods: {
  283. callPhone(phoneNumber) {
  284. uni.makePhoneCall({
  285. phoneNumber
  286. })
  287. },
  288. // 获取数据
  289. getOrderInfo() {
  290. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  291. if (res.data.code == 0) {
  292. this.orderInfo = res.data.data;
  293. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  294. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  295. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  296. .orderInfo.guestPhone, 2)
  297. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  298. 'yyyy-MM-dd')) {
  299. this.showRuzhu = true;
  300. }
  301. }
  302. })
  303. },
  304. // 获取数据
  305. getrepast() {
  306. this.$api.get(`/merchant/hotel/repast${this.id}`).then((res) => {
  307. if (res.data.code == 0) {
  308. this.orderInfo = res.data.data;
  309. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  310. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  311. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  312. .orderInfo.guestPhone, 2)
  313. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  314. 'yyyy-MM-dd')) {
  315. this.showRuzhu = true;
  316. }
  317. }
  318. })
  319. },
  320. // 客房状态
  321. getStatusText() {
  322. if (this.orderInfo.orderStatus === -1) {
  323. return '待确定'
  324. } else if (this.orderInfo.orderStatus === 1) {
  325. return '已预订'
  326. } else if (this.orderInfo.orderStatus === 2) {
  327. return '已入住'
  328. } else if (this.orderInfo.orderStatus === -2) {
  329. return '待支付'
  330. } else if (this.orderInfo.orderStatus === 3) {
  331. return '已退房'
  332. } else if (this.orderInfo.orderStatus === 4) {
  333. return '已取消'
  334. } else if (this.orderInfo.orderStatus === 5) {
  335. return '已退款'
  336. } else {
  337. return '状态异常'
  338. }
  339. },
  340. //添加入住人
  341. goStayCheck() {
  342. let list = JSON.stringify(this.orderInfo);
  343. uni.navigateTo({
  344. url: '/pages/house/stayCheck?orderInfo=' + list,
  345. events: {
  346. addSuccess: data => {
  347. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  348. }
  349. },
  350. })
  351. },
  352. // 确认订单
  353. confirmOrder() {
  354. this.$api
  355. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  356. .then((res) => {
  357. if (res.data.code !== 0) {
  358. return this.$showToast(res.data.msg);
  359. }
  360. this.show2 = false;
  361. this.$showToast('操作成功');
  362. setTimeout(() => {
  363. uni.reLaunch({
  364. url: '/pagesMy/orderList/orderList'
  365. })
  366. }, 1500)
  367. });
  368. },
  369. //取消订单
  370. cancle() {
  371. this.show = true;
  372. this.check.orderCode = this.orderInfo.orderCode;
  373. },
  374. //取消订单
  375. confirmCheck() {
  376. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  377. .then((res) => {
  378. if (res.data.code !== 0) {
  379. return this.$showToast(res.data.msg);
  380. }
  381. this.show = false;
  382. this.$showToast('操作成功');
  383. setTimeout(() => {
  384. uni.reLaunch({
  385. url: '/pagesMy/orderList/orderList'
  386. })
  387. }, 1500)
  388. });
  389. },
  390. //办理入住
  391. checkIn(orderStatus) {
  392. uni.navigateTo({
  393. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  394. })
  395. },
  396. // 编辑
  397. edit() {
  398. uni.navigateTo({
  399. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  400. })
  401. },
  402. //办理退房
  403. checkoutRoom() {
  404. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  405. .then((res) => {
  406. if (res.data.code !== 0) {
  407. return this.$showToast(res.data.msg);
  408. }
  409. this.show = false;
  410. this.$showToast('操作成功');
  411. setTimeout(() => {
  412. uni.reLaunch({
  413. url: '/pagesMy/orderList/orderList'
  414. })
  415. }, 1500)
  416. });
  417. }
  418. },
  419. computed: {
  420. isOrderPanding() {
  421. return this.orderInfo.orderStatus === 1
  422. }
  423. }
  424. }
  425. </script>
  426. <style lang="scss">
  427. .page {
  428. background: #F3F4F4;
  429. padding-bottom: 260rpx;
  430. box-sizing: border-box;
  431. overflow-y: auto;
  432. overflow-x: auto;
  433. }
  434. .body {
  435. padding-top: 20rpx;
  436. padding-left: 30rpx;
  437. padding-right: 30rpx;
  438. }
  439. .uname {
  440. width: 100%;
  441. height: 100rpx;
  442. line-height: 100rpx;
  443. background-color: #fff;
  444. padding-left: 30rpx;
  445. font-size: 30rpx;
  446. border-radius: 10rpx;
  447. box-sizing: border-box;
  448. position: relative;
  449. .callphone {
  450. width: 48rpx;
  451. height: 48rpx;
  452. position: absolute;
  453. top: 50%;
  454. margin-top: -24rpx;
  455. right: 30rpx;
  456. }
  457. }
  458. .dtitle {
  459. font-family: PingFang-SC, PingFang-SC;
  460. font-weight: bold;
  461. font-size: 36rpx;
  462. color: #333333;
  463. line-height: 40rpx;
  464. width: calc(100% - 100rpx);
  465. }
  466. .room {
  467. margin-top: 20rpx;
  468. width: 100%;
  469. background-color: #fff;
  470. margin-bottom: 20rpx;
  471. border-radius: 10rpx;
  472. padding: 30rpx;
  473. box-sizing: border-box;
  474. .r_line {
  475. width: 100%;
  476. height: 1rpx;
  477. background: #efefef;
  478. margin: 24rpx 0;
  479. }
  480. }
  481. .orderTip {
  482. padding: 30rpx;
  483. padding-top: 0;
  484. width: 690rpx;
  485. height: 514rpx;
  486. background-color: #fff;
  487. border-radius: 10rpx;
  488. }
  489. .button {
  490. position: fixed;
  491. bottom: 0;
  492. height: 96rpx;
  493. width: 100%;
  494. margin-top: 20rpx;
  495. display: flex;
  496. gap:0 20rpx;
  497. justify-content: space-between;
  498. border-radius: 10rpx;
  499. z-index: 9;
  500. background-color: #fff;
  501. left: 0;
  502. padding: 24rpx 0;
  503. }
  504. .goRoom {
  505. // border-radius: ;
  506. width: 330rpx;
  507. height: 96rpx;
  508. border-radius: 48rpx;
  509. font-size: 34rpx;
  510. background-color: #1372FF;
  511. color: #fff;
  512. }
  513. .edit {
  514. width: 330rpx;
  515. height: 96rpx;
  516. border-radius: 48rpx;
  517. font-size: 34rpx;
  518. background-color: #E2EDFC;
  519. color: #1372FF;
  520. }
  521. .reservations {
  522. display: flex;
  523. position: relative;
  524. .r_status {
  525. font-family: PingFang-SC, PingFang-SC;
  526. font-weight: bold;
  527. font-size: 24rpx;
  528. color: #FFFFFF;
  529. line-height: 33rpx;
  530. color: #fff;
  531. padding: 4rpx 9rpx;
  532. border-radius: 8rpx;
  533. position: absolute;
  534. right: 0;
  535. top: 50%;
  536. margin-top: -22rpx;
  537. }
  538. }
  539. .time-price {
  540. display: flex;
  541. justify-content: space-between;
  542. margin-top: 30rpx;
  543. }
  544. .house-person {
  545. display: flex;
  546. justify-content: space-between;
  547. margin-top: 30rpx;
  548. }
  549. .right {
  550. display: flex;
  551. }
  552. </style>