orderInfo.vue 16 KB

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