push.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <view class="container" v-if="orderInfo">
  3. <!-- 顶部订单状态信息区域 -->
  4. <view class="header">
  5. <!-- 背景图片区域 -->
  6. <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/18.png" />
  7. <!-- 标题区域 -->
  8. <view class="header_title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }">订单详情</view>
  9. <!-- 返回图标区域 -->
  10. <!-- <img class="header_icon" src="../../static/index/left.png" @click="handleBack" /> -->
  11. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '1'">待支付</view>
  12. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '2'">已支付</view>
  13. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '3'">待入住</view>
  14. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '4'">已入住</view>
  15. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '5'">已消费</view>
  16. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '6'">支付超时</view>
  17. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '7'">已取消</view>
  18. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '8'">已退单</view>
  19. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '9'">已退款</view>
  20. <view class="header_type" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }" v-if="orderInfo.orderStatus === '10'">退款中</view>
  21. <view class="header_info" :style="{ paddingTop: statusBarH * 2 + 145 + 'rpx' }">订单号:{{ orderInfo.orderNum }}</view>
  22. </view>
  23. <!-- 主体内容区域 -->
  24. <view class="body">
  25. <!-- 房型信息和用户信息区域 -->
  26. <view class="body_box2">
  27. <view class="info_time">
  28. {{ getTime((orderInfo.orderStartTime || '').slice(0, 19)) }}
  29. <text class="gap">{{ getWeek((orderInfo.orderStartTime || '').slice(0, 19)) }}</text>
  30. <view class="time_line"></view>
  31. <view class="time_num">{{ orderInfo.orderLiveTime }}</view>
  32. <view class="time_line"></view>
  33. <view class="gap">{{ getTime((orderInfo.orderEndTime || '').slice(0, 19)) }}</view>
  34. <text>{{ getWeek((orderInfo.orderEndTime || '').slice(0, 19)) }}</text>
  35. </view>
  36. <view class="info_msg">{{ orderInfo.houseName }}</view>
  37. <view class="info_type">
  38. <view class="type_item">{{ orderInfo.hotelType }}型</view>
  39. </view>
  40. <view class="info_tag">
  41. <view class="tag_item" v-if="orderInfo.houseAreas">{{ orderInfo.houseAreas }}㎡</view>
  42. <view class="tag_item">双人床</view>
  43. <view class="tag_item">窗户位于走廊/窗户较小</view>
  44. </view>
  45. <view class="info_box">
  46. <view class="box_key">住客姓名</view>
  47. <view class="box_value">{{ orderInfo.userName }}</view>
  48. </view>
  49. <view class="info_box">
  50. <view class="box_key">联系电话</view>
  51. <view class="box_value">{{ orderInfo.userPhone }}</view>
  52. </view>
  53. <view class="info_box">
  54. <view class="box_key">预计到店</view>
  55. <view class="box_value">7月26日14:00之前</view>
  56. </view>
  57. </view>
  58. <!-- 费用信息区域 -->
  59. <view class="body_box">
  60. <view class="box_title">费用信息</view>
  61. <view class="box_container">
  62. <view class="container_key">在线支付</view>
  63. <view class="container_value price">¥{{ orderInfo.houseTotalPrice }}</view>
  64. </view>
  65. <view class="box_container">
  66. <view class="container_key">发票报销</view>
  67. <view class="container_value">如需发票,请先与酒店确认</view>
  68. </view>
  69. </view>
  70. <!-- 按钮区域 -->
  71. <view class="body_btn">
  72. <view class="btn_item type" @click="handleOrder(4)">退单</view>
  73. <view class="btn_item type2" v-if="orderInfo.orderStatus === '2'" @click="handleOrder(1)">接单</view>
  74. </view>
  75. </view>
  76. <!-- 状态弹窗区域 -->
  77. <uni-popup ref="popup" :is-mask-click="false" type="center">
  78. <view class="popup_body">
  79. <img src="../../static/index/success.png" />
  80. <view class="msg">{{ msg }}</view>
  81. <navigator class="btn" target="miniProgram" open-type="exit">确定</navigator>
  82. </view>
  83. </uni-popup>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. // 订单id
  91. id: '',
  92. // 订单信息
  93. orderInfo: null,
  94. // 弹窗信息
  95. msg: '',
  96. // 状态栏高度
  97. statusBarH: 0,
  98. // 胶囊按钮栏高度
  99. customBarH: 0
  100. }
  101. },
  102. created() {
  103. // 获取系统信息
  104. uni.getSystemInfo({
  105. success: (e) => {
  106. // 获取状态栏高度
  107. this.statusBarH = e.statusBarHeight + 10
  108. // // 获取菜单按钮栏高度
  109. let custom = uni.getMenuButtonBoundingClientRect()
  110. this.customBarH = custom.height + 10
  111. }
  112. })
  113. },
  114. onLoad(options) {
  115. this.id = options.id
  116. this.getData()
  117. },
  118. methods: {
  119. // 获取订单信息
  120. async getData() {
  121. const res = await this.$myRequest({
  122. url: '/mhotel/ampgetBookingById.action',
  123. data: {
  124. bookingId: this.id
  125. }
  126. })
  127. // console.log(res)
  128. if (res.code === 200) {
  129. this.orderInfo = res.data
  130. }
  131. },
  132. // 点击 退单 接单 按钮回调
  133. handleOrder(type) {
  134. // 1 接单 4 退单
  135. uni.showModal({
  136. title: '提示',
  137. content: `确定${type === 1 ? '接单' : '退单'}吗?`,
  138. success: (res) => {
  139. if (res.confirm) {
  140. if (type === 1) {
  141. // 接单请求
  142. this.receiving()
  143. } else {
  144. // 退单请求
  145. this.chargeback()
  146. }
  147. }
  148. }
  149. })
  150. },
  151. async receiving() {
  152. const res = await this.$myRequest({
  153. url: '/mhotel/bookupdateBookStatus.action',
  154. data: {
  155. id: this.id,
  156. type: 1
  157. }
  158. })
  159. // console.log(res)
  160. if (res.code === 200) {
  161. this.msg = '接单成功'
  162. this.$refs.popup.open()
  163. }
  164. },
  165. async chargeback() {
  166. const res = await this.$myRequest({
  167. url: '/mhotel/abkchargeback.action',
  168. data: {
  169. bookingId: this.id
  170. }
  171. })
  172. // console.log(res)
  173. if (res.code === 200) {
  174. this.msg = '退单成功'
  175. this.$refs.popup.open()
  176. }
  177. },
  178. // 点击左上角返回按钮回调
  179. handleBack() {
  180. uni.switchTab({
  181. url: '/pages/home/home'
  182. })
  183. },
  184. getWeek(time) {
  185. let date = new Date(time)
  186. // 获取星期
  187. let week = date.getDay()
  188. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  189. let res = '周' + weekList[week]
  190. return res
  191. },
  192. getTime(time) {
  193. let date = new Date(time)
  194. // 获取月份
  195. let M = date.getMonth() + 1
  196. // 获取日期
  197. let D = date.getDate()
  198. let res = M + '月' + D + '日'
  199. return res
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .container {
  206. position: relative;
  207. height: 100vh;
  208. background-color: #f2f2f2;
  209. .header {
  210. height: 480rpx;
  211. color: #fff;
  212. img {
  213. width: 100%;
  214. }
  215. .header_title {
  216. position: absolute;
  217. top: 0;
  218. left: 308rpx;
  219. color: #fff;
  220. font-size: 28rpx;
  221. }
  222. .header_icon {
  223. position: absolute;
  224. top: 0;
  225. left: 10rpx;
  226. width: 47rpx;
  227. height: 47rpx;
  228. }
  229. .header_type {
  230. position: absolute;
  231. top: 0;
  232. left: 30rpx;
  233. font-size: 40rpx;
  234. font-weight: bold;
  235. }
  236. .header_info {
  237. position: absolute;
  238. top: 0;
  239. left: 30rpx;
  240. font-size: 24rpx;
  241. }
  242. }
  243. .body {
  244. position: absolute;
  245. top: 320rpx;
  246. left: 0;
  247. right: 0;
  248. box-sizing: border-box;
  249. padding: 20rpx 20rpx 60rpx;
  250. height: calc(100vh - 320rpx);
  251. border-radius: 20rpx 20rpx 0 0;
  252. background-color: #ebeced;
  253. overflow-y: auto;
  254. .body_box {
  255. box-sizing: border-box;
  256. padding: 0 30rpx;
  257. margin-bottom: 20rpx;
  258. display: flex;
  259. flex-direction: column;
  260. height: 240rpx;
  261. border-radius: 14rpx;
  262. background-color: #fff;
  263. .box_title {
  264. line-height: 90rpx;
  265. font-size: 28rpx;
  266. font-weight: bold;
  267. border-bottom: 1rpx solid #e5e5e5;
  268. }
  269. .box_container {
  270. display: flex;
  271. margin-top: 25rpx;
  272. font-size: 28rpx;
  273. .container_key {
  274. width: 160rpx;
  275. color: #808080;
  276. }
  277. .container_value {
  278. }
  279. .container_copy {
  280. margin-left: auto;
  281. color: #096562;
  282. }
  283. .price {
  284. color: #ff5733;
  285. }
  286. }
  287. .box_info {
  288. display: flex;
  289. margin-top: 20rpx;
  290. height: 130rpx;
  291. img {
  292. width: 100rpx;
  293. height: 100rpx;
  294. border-radius: 10rpx;
  295. }
  296. .info_msg {
  297. display: flex;
  298. flex-direction: column;
  299. justify-content: space-around;
  300. margin-top: -10rpx;
  301. margin-left: 18rpx;
  302. width: 540rpx;
  303. .msg_name {
  304. font-size: 28rpx;
  305. font-weight: bold;
  306. }
  307. .msg_address {
  308. color: #808080;
  309. font-size: 24rpx;
  310. display: -webkit-box;
  311. -webkit-box-orient: vertical;
  312. -webkit-line-clamp: 2;
  313. overflow: hidden;
  314. }
  315. }
  316. }
  317. .box_btn {
  318. display: flex;
  319. justify-content: space-around;
  320. align-items: center;
  321. height: 110rpx;
  322. .btn_item {
  323. display: flex;
  324. align-items: center;
  325. width: 200rpx;
  326. .img {
  327. margin-right: 14rpx;
  328. width: 38rpx;
  329. height: 38rpx;
  330. }
  331. .img2 {
  332. width: 66rpx;
  333. height: 66rpx;
  334. }
  335. }
  336. }
  337. }
  338. .body_box2 {
  339. display: flex;
  340. flex-direction: column;
  341. box-sizing: border-box;
  342. padding: 0 30rpx;
  343. margin-bottom: 20rpx;
  344. height: 478rpx;
  345. border-radius: 15rpx;
  346. background-color: #fff;
  347. .info_time {
  348. display: flex;
  349. align-items: center;
  350. margin-top: 20rpx;
  351. font-size: 32rpx;
  352. font-weight: bold;
  353. .time_line {
  354. width: 17rpx;
  355. height: 1rpx;
  356. background-color: #096562;
  357. }
  358. .time_num {
  359. box-sizing: border-box;
  360. padding: 0 15rpx;
  361. height: 46rpx;
  362. line-height: 46rpx;
  363. font-size: 24rpx;
  364. font-weight: 400;
  365. border-radius: 66rpx;
  366. border: 1rpx solid #096562;
  367. background-color: #f0f2f5;
  368. }
  369. .gap {
  370. margin: 0 10rpx;
  371. }
  372. text {
  373. font-size: 24rpx;
  374. font-weight: 400;
  375. }
  376. }
  377. .info_msg {
  378. margin-top: 15rpx;
  379. font-size: 28rpx;
  380. font-weight: bold;
  381. }
  382. .info_type {
  383. display: flex;
  384. flex-wrap: wrap;
  385. margin-top: 15rpx;
  386. .type_item {
  387. box-sizing: border-box;
  388. padding: 0 15rpx;
  389. margin-right: 20rpx;
  390. height: 41rpx;
  391. line-height: 41rpx;
  392. font-size: 24rpx;
  393. color: #fff;
  394. border-radius: 34rpx;
  395. background-color: #096562;
  396. }
  397. }
  398. .info_tag {
  399. display: flex;
  400. flex-wrap: wrap;
  401. margin: 18rpx 0 0;
  402. box-sizing: border-box;
  403. padding-bottom: 30rpx;
  404. color: #808080;
  405. font-size: 24rpx;
  406. border-bottom: 1rpx solid #e5e5e5;
  407. .tag_item {
  408. margin-right: 20rpx;
  409. }
  410. }
  411. .info_box {
  412. display: flex;
  413. margin-top: 23rpx;
  414. font-size: 28rpx;
  415. .box_key {
  416. width: 160rpx;
  417. color: #808080;
  418. }
  419. .box_value {
  420. }
  421. }
  422. }
  423. .body_btn {
  424. box-sizing: border-box;
  425. padding: 0 32rpx;
  426. margin-top: 140rpx;
  427. display: flex;
  428. justify-content: space-between;
  429. height: 96rpx;
  430. .btn_item {
  431. display: flex;
  432. justify-content: center;
  433. align-items: center;
  434. width: 300rpx;
  435. height: 96rpx;
  436. border-radius: 64rpx;
  437. font-size: 32rpx;
  438. }
  439. .type {
  440. color: #d43030;
  441. border: 1rpx solid #d43030;
  442. }
  443. .type2 {
  444. color: #fff;
  445. background-color: #096562;
  446. }
  447. }
  448. .close_btn {
  449. margin: 32rpx;
  450. display: flex;
  451. justify-content: center;
  452. align-items: center;
  453. width: 300rpx;
  454. height: 96rpx;
  455. border-radius: 64rpx;
  456. font-size: 32rpx;
  457. color: #d43030;
  458. border: 1rpx solid #d43030;
  459. }
  460. }
  461. .popup_body {
  462. display: flex;
  463. flex-direction: column;
  464. justify-content: space-evenly;
  465. align-items: center;
  466. width: 481rpx;
  467. height: 404rpx;
  468. border-radius: 23rpx;
  469. background-color: #fff;
  470. img {
  471. width: 134rpx;
  472. height: 134rpx;
  473. }
  474. .msg {
  475. font-size: 26rpx;
  476. }
  477. .btn {
  478. display: flex;
  479. justify-content: center;
  480. align-items: center;
  481. width: 200rpx;
  482. height: 76rpx;
  483. font-size: 26rpx;
  484. color: #fff;
  485. border-radius: 43rpx;
  486. background: linear-gradient(90deg, rgba(11, 193, 150, 1) 0%, rgba(9, 101, 98, 1) 100%);
  487. }
  488. }
  489. }
  490. </style>