orderDetail.vue 13 KB

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