orderDetail.vue 15 KB

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