orderDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <template>
  2. <view class="container">
  3. <!-- 顶部订单状态信息区域 -->
  4. <view class="header">
  5. <!-- 背景图片区域 -->
  6. <img src="../../static/my/headerImg.png" />
  7. <!-- 标题区域 -->
  8. <view class="header_title">订单详情</view>
  9. <!-- 返回图标区域 -->
  10. <img class="header_icon" src="../../static/index/left.png" @click="handleBack" />
  11. <view class="header_type" v-if="info.orderStatus === '1'">待支付</view>
  12. <view class="header_info" v-if="info.orderStatus === '1'">超时后,订单将会自动取消</view>
  13. <view class="header_type" v-if="info.orderStatus === '2'">已支付</view>
  14. <view class="header_info" v-if="info.orderStatus === '2'">订单已支付,请等待商家接单</view>
  15. <view class="header_type" v-if="info.orderStatus === '3'">待入住</view>
  16. <view class="header_info" v-if="info.orderStatus === '3'">订单已被商家接单,请前往办理入住</view>
  17. <view class="header_type" v-if="info.orderStatus === '4'">已入住</view>
  18. <view class="header_info" v-if="info.orderStatus === '4'">订单已办理入住</view>
  19. <view class="header_type" v-if="info.orderStatus === '5'">已消费</view>
  20. <view class="header_info" v-if="info.orderStatus === '5'">您的订单已消费,期待您再次预定哦</view>
  21. <view class="header_type" v-if="info.orderStatus === '6'">支付超时</view>
  22. <view class="header_info" v-if="info.orderStatus === '6'">订单已超过可支付时间,请重新下单</view>
  23. <view class="header_type" v-if="info.orderStatus === '7'">已取消</view>
  24. <view class="header_info" v-if="info.orderStatus === '7'">订单已取消,请重新下单</view>
  25. <view class="header_type" v-if="info.orderStatus === '8'">已退单</view>
  26. <view class="header_info" v-if="info.orderStatus === '8'">订单已被商家退单,请重新下单</view>
  27. <view class="header_type" v-if="info.orderStatus === '9'">已退款</view>
  28. <view class="header_info" v-if="info.orderStatus === '9'">订单已被商家退款</view>
  29. <view class="header_type" v-if="info.orderStatus === '10'">退款中</view>
  30. <view class="header_info" v-if="info.orderStatus === '10'">正在退款中...</view>
  31. <view class="header_btn">
  32. <!-- hotelIsCanorder 1可取消,0不可 -->
  33. <view class="btn_box" v-if="info.orderStatus === '1'" @click="handlePay">去支付 ¥{{ info.houseTotalPrice }}</view>
  34. <view
  35. class="btn_box"
  36. v-if="((info.orderStatus === '2' || info.orderStatus === '3') && info.hotelIsCanorder == '1') || info.orderStatus === '1'"
  37. @click="handleCancel"
  38. >
  39. 取消订单
  40. </view>
  41. <view class="btn_box" v-if="info.orderStatus * 1 > 3" @click="handleAgain">再次预定</view>
  42. <view class="btn_box" @click="handleDelete" v-if="info.orderStatus === '5' || info.orderStatus === '7' || info.orderStatus === '8' || info.orderStatus === '9'">
  43. 删除订单
  44. </view>
  45. </view>
  46. <!-- <view class="header_msg" v-if="info.orderStatus === '1'">预定成功后,07月26日12:00前可免费取消</view> -->
  47. </view>
  48. <!-- 主体内容区域 -->
  49. <view class="body">
  50. <!-- 费用信息区域 -->
  51. <view class="body_box">
  52. <view class="box_title">费用信息</view>
  53. <view class="box_container">
  54. <view class="container_key">在线支付</view>
  55. <view class="container_value price">¥{{ info.houseTotalPrice }}</view>
  56. </view>
  57. <view class="box_container">
  58. <view class="container_key">发票报销</view>
  59. <view class="container_value">如需发票,请先与酒店确认</view>
  60. </view>
  61. </view>
  62. <!-- 民宿信息区域 -->
  63. <view class="body_box">
  64. <view class="box_info">
  65. <img src="../../static/index/banner.png" />
  66. <view class="info_msg">
  67. <view class="msg_name">{{ info.hotelName }}</view>
  68. <view class="msg_address">{{ info.hotelHposition }}</view>
  69. </view>
  70. </view>
  71. <view class="box_btn">
  72. <view class="btn_item" @click="handleMap">
  73. <img class="img" src="../../static/my/map.png" />
  74. 地图/导航
  75. </view>
  76. <view class="btn_item" @click="handlePhone(info.hotelPhone)">
  77. <img class="img2" src="../../static/my/phone.png" />
  78. 联系商家
  79. </view>
  80. </view>
  81. </view>
  82. <!-- 房型信息和用户信息区域 -->
  83. <view class="body_box2">
  84. <view class="info_time">
  85. {{ (info.orderStartTime || '').slice(5, 7) }}月{{ (info.orderStartTime || '').slice(8, 10) }}日
  86. <view class="time_line"></view>
  87. <view class="time_num">{{ info.orderLiveTime }}</view>
  88. <view class="time_line"></view>
  89. <view class="gap">{{ (info.orderStartTime || '').slice(5, 7) }}月{{ (info.checkOutTime || '').slice(8, 10) }}日</view>
  90. </view>
  91. <view class="info_msg">{{ info.houseName }}</view>
  92. <view class="info_type">
  93. <view class="type_item">包吃住型</view>
  94. </view>
  95. <view class="info_tag">
  96. <view class="tag_item" v-if="info.houseAreas">{{ info.houseAreas }}㎡</view>
  97. <view class="tag_item">{{ info.houseName }}</view>
  98. <view class="tag_item">窗户位于走廊/窗户较小</view>
  99. </view>
  100. <view class="info_box">
  101. <view class="box_key">住客姓名</view>
  102. <view class="box_value">{{ info.userName }}</view>
  103. </view>
  104. <view class="info_box">
  105. <view class="box_key">联系电话</view>
  106. <view class="box_value">{{ info.userPhone }}</view>
  107. </view>
  108. <view class="info_box">
  109. <view class="box_key">预计到店</view>
  110. <view class="box_value">7月26日14:00之前</view>
  111. </view>
  112. </view>
  113. <!-- 订单信息区域 -->
  114. <view class="body_box">
  115. <view class="box_title">订单信息</view>
  116. <view class="box_container">
  117. <view class="container_key">订单号</view>
  118. <view class="container_value">{{ info.orderNum }}</view>
  119. <view class="container_copy" @click="handleCopy(info.orderNum)">复制</view>
  120. </view>
  121. <view class="box_container">
  122. <view class="container_key">下单时间</view>
  123. <view class="container_value">{{ (info.createTime || '').slice(0, 19) }}</view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </template>
  129. <script>
  130. export default {
  131. data() {
  132. return {
  133. // 详细信息
  134. info: {},
  135. // 订单ID
  136. id: ''
  137. }
  138. },
  139. onLoad(options) {
  140. this.id = options.id
  141. this.getData()
  142. },
  143. methods: {
  144. // 获取订单信息
  145. async getData() {
  146. const res = await this.$myRequest({
  147. url: '/mhotel/ampgetBookingById.action',
  148. data: {
  149. bookingId: this.id
  150. }
  151. })
  152. // console.log(res)
  153. if (res.code === 200) {
  154. this.info = res.data
  155. }
  156. },
  157. // 点击复制文字回调
  158. handleCopy(text) {
  159. uni.setClipboardData({
  160. data: text,
  161. success: () => {}
  162. })
  163. },
  164. handleBack() {
  165. uni.navigateBack(1)
  166. },
  167. // 点击地图/导航文字回调
  168. handleMap() {
  169. uni.getSetting({
  170. success: (res) => {
  171. if (res.authSetting['scope.userLocation']) {
  172. let lat = this.info.hotelHpositionWens.split(',')[0] * 1
  173. let lng = this.info.hotelHpositionWens.split(',')[1] * 1
  174. uni.openLocation({
  175. latitude: lat,
  176. longitude: lng,
  177. name: this.info.hotelName,
  178. address: this.info.hotelHposition,
  179. success: () => {}
  180. })
  181. } else {
  182. uni.showModal({
  183. content: '当前没有定位权限,是否去设置打开?',
  184. confirmText: '确认',
  185. cancelText: '取消',
  186. success: (res) => {
  187. if (res.confirm) {
  188. uni.openSetting({
  189. success: (res) => {
  190. this.handleMap()
  191. }
  192. })
  193. } else {
  194. uni.showToast({
  195. title: '获取定位权限失败',
  196. icon: 'none',
  197. mask: true
  198. })
  199. }
  200. }
  201. })
  202. }
  203. }
  204. })
  205. },
  206. // 点击联系商家文字回调
  207. handlePhone(phone) {
  208. uni.makePhoneCall({
  209. phoneNumber: phone
  210. })
  211. },
  212. // 点击去支付按钮回调
  213. handlePay() {
  214. uni.navigateTo({
  215. url: `/pages/pay/pay?id=${this.id}`
  216. })
  217. },
  218. // 点击取消订单按钮回调
  219. handleCancel() {
  220. uni.showModal({
  221. title: '提示',
  222. content: '确定取消该订单吗?',
  223. success: async (res) => {
  224. if (res.confirm) {
  225. const result = await this.$myRequest({
  226. url: '/mhotel/abkcancelBooking.action',
  227. data: {
  228. bookingId: this.info.id,
  229. open_id: uni.getStorageSync('openid')
  230. }
  231. })
  232. if (result.code === 200) {
  233. uni.showToast({
  234. title: '取消成功,' + result.message,
  235. icon: 'none',
  236. mask: true
  237. })
  238. setTimeout(() => {
  239. uni.navigateBack(1)
  240. }, 1500)
  241. }
  242. }
  243. }
  244. })
  245. },
  246. // 点击再次预定按钮回调
  247. handleAgain() {
  248. uni.showModal({
  249. title: '提示',
  250. content: '确定再次预定吗?',
  251. success: async (res) => {
  252. if (res.confirm) {
  253. const result = await this.$myRequest({
  254. url: '/mhotel/abkcreateOrder.action',
  255. data: {
  256. houseId: this.info.houseId,
  257. startTime: this.info.orderStartTime.slice(0, 10),
  258. endTime: this.info.orderEndTime.slice(0, 10),
  259. houseOrderNumber: this.info.houseOrderNumber,
  260. userName: this.info.userName,
  261. userPhone: this.info.userPhone,
  262. userId: uni.getStorageSync('userInfo').id
  263. }
  264. })
  265. if (result.code === 200) {
  266. uni.navigateTo({
  267. url: `/pages/pay/pay?id=${result.data}`
  268. })
  269. // uni.showToast({
  270. // title: '预定成功',
  271. // icon: 'success',
  272. // mask: true
  273. // })
  274. // setTimeout(() => {
  275. // uni.navigateBack(1)
  276. // }, 1500)
  277. }
  278. }
  279. }
  280. })
  281. },
  282. // 点击删除订单按钮回调
  283. handleDelete() {
  284. uni.showModal({
  285. title: '提示',
  286. content: '确定删除该订单吗?',
  287. success: async (res) => {
  288. if (res.confirm) {
  289. const result = await this.$myRequest({
  290. url: '/mhotel/abkdelBooking.action',
  291. data: {
  292. bookingId: this.info.id,
  293. open_id: uni.getStorageSync('openid')
  294. }
  295. })
  296. if (result.code === 200) {
  297. uni.showToast({
  298. title: '删除成功',
  299. icon: 'success',
  300. mask: true
  301. })
  302. setTimeout(() => {
  303. uni.navigateBack(1)
  304. }, 1500)
  305. }
  306. }
  307. }
  308. })
  309. }
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .container {
  315. position: relative;
  316. height: 100vh;
  317. background-color: #f2f2f2;
  318. .header {
  319. height: 480rpx;
  320. color: #fff;
  321. img {
  322. width: 100%;
  323. }
  324. .header_title {
  325. position: absolute;
  326. top: 65rpx;
  327. left: 308rpx;
  328. color: #fff;
  329. font-size: 28rpx;
  330. }
  331. .header_icon {
  332. position: absolute;
  333. top: 76rpx;
  334. left: 10rpx;
  335. width: 47rpx;
  336. height: 47rpx;
  337. }
  338. .header_type {
  339. position: absolute;
  340. top: 162rpx;
  341. left: 30rpx;
  342. font-size: 40rpx;
  343. font-weight: bold;
  344. }
  345. .header_info {
  346. position: absolute;
  347. top: 235rpx;
  348. left: 30rpx;
  349. font-size: 24rpx;
  350. }
  351. .header_btn {
  352. position: absolute;
  353. top: 290rpx;
  354. left: 30rpx;
  355. right: 30rpx;
  356. display: flex;
  357. justify-content: space-between;
  358. .btn_box {
  359. display: flex;
  360. justify-content: center;
  361. align-items: center;
  362. width: 335rpx;
  363. height: 72rpx;
  364. border-radius: 10rpx;
  365. color: #096562;
  366. font-size: 28rpx;
  367. background-color: #fff;
  368. }
  369. }
  370. .header_msg {
  371. position: absolute;
  372. top: 378rpx;
  373. left: 30rpx;
  374. font-size: 24rpx;
  375. }
  376. }
  377. .body {
  378. position: absolute;
  379. top: 430rpx;
  380. left: 0;
  381. right: 0;
  382. box-sizing: border-box;
  383. padding: 20rpx;
  384. height: calc(100vh - 430rpx);
  385. border-radius: 20rpx 20rpx 0 0;
  386. background-color: #ebeced;
  387. overflow-y: auto;
  388. .body_box {
  389. box-sizing: border-box;
  390. padding: 0 30rpx;
  391. margin-bottom: 20rpx;
  392. display: flex;
  393. flex-direction: column;
  394. height: 240rpx;
  395. border-radius: 14rpx;
  396. background-color: #fff;
  397. .box_title {
  398. line-height: 90rpx;
  399. font-size: 28rpx;
  400. font-weight: bold;
  401. border-bottom: 1rpx solid #e5e5e5;
  402. }
  403. .box_container {
  404. display: flex;
  405. margin-top: 25rpx;
  406. font-size: 28rpx;
  407. .container_key {
  408. width: 160rpx;
  409. color: #808080;
  410. }
  411. .container_value {
  412. }
  413. .container_copy {
  414. margin-left: auto;
  415. color: #096562;
  416. }
  417. .price {
  418. color: #ff5733;
  419. }
  420. }
  421. .box_info {
  422. display: flex;
  423. margin-top: 20rpx;
  424. height: 130rpx;
  425. img {
  426. width: 100rpx;
  427. height: 100rpx;
  428. border-radius: 10rpx;
  429. }
  430. .info_msg {
  431. display: flex;
  432. flex-direction: column;
  433. justify-content: space-around;
  434. margin-top: -10rpx;
  435. margin-left: 18rpx;
  436. width: 540rpx;
  437. .msg_name {
  438. font-size: 28rpx;
  439. font-weight: bold;
  440. }
  441. .msg_address {
  442. color: #808080;
  443. font-size: 24rpx;
  444. display: -webkit-box;
  445. -webkit-box-orient: vertical;
  446. -webkit-line-clamp: 2;
  447. overflow: hidden;
  448. }
  449. }
  450. }
  451. .box_btn {
  452. display: flex;
  453. justify-content: space-around;
  454. align-items: center;
  455. height: 110rpx;
  456. .btn_item {
  457. display: flex;
  458. align-items: center;
  459. width: 200rpx;
  460. .img {
  461. margin-right: 14rpx;
  462. width: 38rpx;
  463. height: 38rpx;
  464. }
  465. .img2 {
  466. width: 66rpx;
  467. height: 66rpx;
  468. }
  469. }
  470. }
  471. }
  472. .body_box2 {
  473. display: flex;
  474. flex-direction: column;
  475. box-sizing: border-box;
  476. padding: 0 30rpx;
  477. margin-bottom: 20rpx;
  478. height: 478rpx;
  479. border-radius: 15rpx;
  480. background-color: #fff;
  481. .info_time {
  482. display: flex;
  483. align-items: center;
  484. margin-top: 20rpx;
  485. font-size: 32rpx;
  486. font-weight: bold;
  487. .time_line {
  488. width: 17rpx;
  489. height: 1rpx;
  490. background-color: #096562;
  491. }
  492. .time_num {
  493. box-sizing: border-box;
  494. padding: 0 15rpx;
  495. height: 46rpx;
  496. line-height: 46rpx;
  497. font-size: 24rpx;
  498. font-weight: 400;
  499. border-radius: 66rpx;
  500. border: 1rpx solid #096562;
  501. background-color: #f0f2f5;
  502. }
  503. .gap {
  504. margin: 0 10rpx;
  505. }
  506. text {
  507. font-size: 24rpx;
  508. font-weight: 400;
  509. }
  510. }
  511. .info_msg {
  512. margin-top: 15rpx;
  513. font-size: 28rpx;
  514. font-weight: bold;
  515. }
  516. .info_type {
  517. display: flex;
  518. flex-wrap: wrap;
  519. margin-top: 15rpx;
  520. .type_item {
  521. box-sizing: border-box;
  522. padding: 0 15rpx;
  523. margin-right: 20rpx;
  524. height: 41rpx;
  525. line-height: 41rpx;
  526. font-size: 24rpx;
  527. color: #fff;
  528. border-radius: 34rpx;
  529. background-color: #096562;
  530. }
  531. }
  532. .info_tag {
  533. display: flex;
  534. flex-wrap: wrap;
  535. margin: 18rpx 0 0;
  536. box-sizing: border-box;
  537. padding-bottom: 30rpx;
  538. color: #808080;
  539. font-size: 24rpx;
  540. border-bottom: 1rpx solid #e5e5e5;
  541. .tag_item {
  542. margin-right: 20rpx;
  543. }
  544. }
  545. .info_box {
  546. display: flex;
  547. margin-top: 23rpx;
  548. font-size: 28rpx;
  549. .box_key {
  550. width: 160rpx;
  551. color: #808080;
  552. }
  553. .box_value {
  554. }
  555. }
  556. }
  557. }
  558. }
  559. </style>