orderDetail.vue 14 KB

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