orderInfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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="goRoom" @click="checkIn(2)" v-if="showRuzhu">办理入住</button>
  179. </template>
  180. <!-- 已入住 -->
  181. <template v-if="orderInfo.orderStatus==2">
  182. <button class="edit" @click="edit()">编辑订单</button>
  183. <button class="goRoom" @click="show3=true">办理退房</button>
  184. </template>
  185. </view>
  186. </view>
  187. <!-- 取消订单 -->
  188. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  189. <view class="slot-content">
  190. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  191. <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  192. <u-cell>
  193. <view slot="title" class="title">
  194. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  195. placeholder="请输入原因" v-model="check.refundReason"></u--input>
  196. </view>
  197. </u-cell>
  198. </u-cell-group> -->
  199. </view>
  200. </u-modal>
  201. <!-- 确认订单 -->
  202. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  203. @cancel="show2=false">
  204. </u-modal>
  205. <!-- 办理退房 -->
  206. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  207. @cancel="show3=false">
  208. </u-modal>
  209. </view>
  210. </template>
  211. <script>
  212. export default {
  213. data() {
  214. return {
  215. titleStyle: {
  216. fontSize: '34rpx',
  217. fontWeight: "bold",
  218. },
  219. h: uni.getSystemInfoSync().windowHeight,
  220. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  221. show: false,
  222. show2: false,
  223. show3: false,
  224. check: {
  225. initiator: 1,
  226. refundReason: "",
  227. status: -1,
  228. orderCode: "",
  229. },
  230. showRuzhu: false,
  231. orderId: '',
  232. orderInfo: {
  233. detailFormList: []
  234. },
  235. id: '',
  236. scolor: {
  237. '-2': '#FF4141',
  238. '-1': '#FEA400',
  239. '1': '#FEA400',
  240. '2': '#A9B4C1',
  241. '3': '#A9B4C1',
  242. '4': '#A9B4C1',
  243. '5': '#A9B4C1',
  244. },
  245. repastStr: {
  246. '-2': '待支付',
  247. '1': '未核销',
  248. '2': '已核销',
  249. '4': '已取消',
  250. '5': '已退款'
  251. },
  252. breakFastList: [],
  253. otherList: [],
  254. }
  255. },
  256. onLoad(opt) {
  257. if (opt.orderId) {
  258. if (opt.orderType == 201) {
  259. this.id = opt.orderId;
  260. this.getrepast()
  261. } else {
  262. this.orderId = opt.orderId;
  263. this.getOrderInfo()
  264. }
  265. }
  266. },
  267. methods: {
  268. callPhone(phoneNumber) {
  269. uni.makePhoneCall({
  270. phoneNumber
  271. })
  272. },
  273. // 获取数据
  274. getOrderInfo() {
  275. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  276. if (res.data.code == 0) {
  277. this.orderInfo = res.data.data;
  278. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  279. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  280. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  281. .orderInfo.guestPhone, 2)
  282. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  283. 'yyyy-MM-dd')) {
  284. this.showRuzhu = true;
  285. }
  286. }
  287. })
  288. },
  289. // 获取数据
  290. getrepast() {
  291. this.$api.get(`/merchant/hotel/repast${this.id}`).then((res) => {
  292. if (res.data.code == 0) {
  293. this.orderInfo = res.data.data;
  294. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  295. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  296. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  297. .orderInfo.guestPhone, 2)
  298. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  299. 'yyyy-MM-dd')) {
  300. this.showRuzhu = true;
  301. }
  302. }
  303. })
  304. },
  305. // 客房状态
  306. getStatusText() {
  307. if (this.orderInfo.orderStatus === -1) {
  308. return '待确定'
  309. } else if (this.orderInfo.orderStatus === 1) {
  310. return '已预订'
  311. } else if (this.orderInfo.orderStatus === 2) {
  312. return '已入住'
  313. } else if (this.orderInfo.orderStatus === -2) {
  314. return '待支付'
  315. } else if (this.orderInfo.orderStatus === 3) {
  316. return '已退房'
  317. } else if (this.orderInfo.orderStatus === 4) {
  318. return '已取消'
  319. } else if (this.orderInfo.orderStatus === 5) {
  320. return '已退款'
  321. } else {
  322. return '状态异常'
  323. }
  324. },
  325. //添加入住人
  326. goStayCheck() {
  327. let list = JSON.stringify(this.orderInfo);
  328. uni.navigateTo({
  329. url: '/pages/house/stayCheck?orderInfo=' + list,
  330. events: {
  331. addSuccess: data => {
  332. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  333. }
  334. },
  335. })
  336. },
  337. // 确认订单
  338. confirmOrder() {
  339. this.$api
  340. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  341. .then((res) => {
  342. if (res.data.code !== 0) {
  343. return this.$showToast(res.data.msg);
  344. }
  345. this.show2 = false;
  346. this.$showToast('操作成功');
  347. setTimeout(() => {
  348. uni.reLaunch({
  349. url: '/pagesMy/orderList/orderList'
  350. })
  351. }, 1500)
  352. });
  353. },
  354. //取消订单
  355. cancle() {
  356. this.show = true;
  357. this.check.orderCode = this.orderInfo.orderCode;
  358. },
  359. //取消订单
  360. confirmCheck() {
  361. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  362. .then((res) => {
  363. if (res.data.code !== 0) {
  364. return this.$showToast(res.data.msg);
  365. }
  366. this.show = false;
  367. this.$showToast('操作成功');
  368. setTimeout(() => {
  369. uni.reLaunch({
  370. url: '/pagesMy/orderList/orderList'
  371. })
  372. }, 1500)
  373. });
  374. },
  375. //办理入住
  376. checkIn(orderStatus) {
  377. uni.navigateTo({
  378. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  379. })
  380. },
  381. // 编辑
  382. edit() {
  383. uni.navigateTo({
  384. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  385. })
  386. },
  387. //办理退房
  388. checkoutRoom() {
  389. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  390. .then((res) => {
  391. if (res.data.code !== 0) {
  392. return this.$showToast(res.data.msg);
  393. }
  394. this.show = false;
  395. this.$showToast('操作成功');
  396. setTimeout(() => {
  397. uni.reLaunch({
  398. url: '/pagesMy/orderList/orderList'
  399. })
  400. }, 1500)
  401. });
  402. }
  403. },
  404. computed: {
  405. isOrderPanding() {
  406. return this.orderInfo.orderStatus === 1
  407. }
  408. }
  409. }
  410. </script>
  411. <style lang="scss">
  412. .page {
  413. background: #F3F4F4;
  414. padding-bottom: 260rpx;
  415. box-sizing: border-box;
  416. overflow-y: auto;
  417. overflow-x: auto;
  418. }
  419. .body {
  420. padding-top: 20rpx;
  421. padding-left: 30rpx;
  422. padding-right: 30rpx;
  423. }
  424. .uname {
  425. width: 100%;
  426. height: 100rpx;
  427. line-height: 100rpx;
  428. background-color: #fff;
  429. padding-left: 30rpx;
  430. font-size: 30rpx;
  431. border-radius: 10rpx;
  432. box-sizing: border-box;
  433. position: relative;
  434. .callphone {
  435. width: 48rpx;
  436. height: 48rpx;
  437. position: absolute;
  438. top: 50%;
  439. margin-top: -24rpx;
  440. right: 30rpx;
  441. }
  442. }
  443. .dtitle {
  444. font-family: PingFang-SC, PingFang-SC;
  445. font-weight: bold;
  446. font-size: 36rpx;
  447. color: #333333;
  448. line-height: 40rpx;
  449. width: calc(100% - 100rpx);
  450. }
  451. .room {
  452. margin-top: 20rpx;
  453. width: 100%;
  454. background-color: #fff;
  455. margin-bottom: 20rpx;
  456. border-radius: 10rpx;
  457. padding: 30rpx;
  458. box-sizing: border-box;
  459. .r_line {
  460. width: 100%;
  461. height: 1rpx;
  462. background: #efefef;
  463. margin: 24rpx 0;
  464. }
  465. }
  466. .orderTip {
  467. padding: 30rpx;
  468. padding-top: 0;
  469. width: 690rpx;
  470. height: 514rpx;
  471. background-color: #fff;
  472. border-radius: 10rpx;
  473. }
  474. .button {
  475. position: fixed;
  476. bottom: 0;
  477. height: 96rpx;
  478. width: 100%;
  479. margin-top: 20rpx;
  480. display: flex;
  481. justify-content: space-between;
  482. border-radius: 10rpx;
  483. z-index: 9;
  484. background-color: #fff;
  485. left: 0;
  486. padding: 24rpx 0;
  487. }
  488. .goRoom {
  489. // border-radius: ;
  490. width: 330rpx;
  491. height: 96rpx;
  492. border-radius: 48rpx;
  493. font-size: 34rpx;
  494. background-color: #1372FF;
  495. color: #fff;
  496. }
  497. .edit {
  498. width: 330rpx;
  499. height: 96rpx;
  500. border-radius: 48rpx;
  501. font-size: 34rpx;
  502. background-color: #E2EDFC;
  503. color: #1372FF;
  504. }
  505. .reservations {
  506. display: flex;
  507. position: relative;
  508. .r_status {
  509. font-family: PingFang-SC, PingFang-SC;
  510. font-weight: bold;
  511. font-size: 24rpx;
  512. color: #FFFFFF;
  513. line-height: 33rpx;
  514. color: #fff;
  515. padding: 4rpx 9rpx;
  516. border-radius: 8rpx;
  517. position: absolute;
  518. right: 0;
  519. top: 50%;
  520. margin-top: -22rpx;
  521. }
  522. }
  523. .time-price {
  524. display: flex;
  525. justify-content: space-between;
  526. margin-top: 30rpx;
  527. }
  528. .house-person {
  529. display: flex;
  530. justify-content: space-between;
  531. margin-top: 30rpx;
  532. }
  533. .right {
  534. display: flex;
  535. }
  536. </style>