orderDetail.vue 15 KB

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