push.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <view class="container" v-if="orderInfo">
  3. <!-- 顶部订单状态信息区域 -->
  4. <view class="header">
  5. <!-- 背景图片区域 -->
  6. <img src="https://jinganminsu-1320402385.cos.ap-nanjing.myqcloud.com/static//20240523163442_12.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/home3/home3'
  182. })
  183. },
  184. getWeek(time) {
  185. let rgTime = time.replace(/-/g, '/')
  186. let date = new Date(rgTime)
  187. // 获取星期
  188. let week = date.getDay()
  189. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  190. let res = '周' + weekList[week]
  191. return res
  192. },
  193. getTime(time) {
  194. let rgTime = time.replace(/-/g, '/')
  195. let date = new Date(rgTime)
  196. // 获取月份
  197. let M = date.getMonth() + 1
  198. // 获取日期
  199. let D = date.getDate()
  200. let res = M + '月' + D + '日'
  201. return res
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .container {
  208. position: relative;
  209. height: 100vh;
  210. background-color: #f2f2f2;
  211. .header {
  212. height: 480rpx;
  213. color: #fff;
  214. img {
  215. width: 100%;
  216. }
  217. .header_title {
  218. position: absolute;
  219. top: 0;
  220. left: 308rpx;
  221. color: #fff;
  222. font-size: 28rpx;
  223. }
  224. .header_icon {
  225. position: absolute;
  226. top: 0;
  227. left: 10rpx;
  228. width: 47rpx;
  229. height: 47rpx;
  230. }
  231. .header_type {
  232. position: absolute;
  233. top: 0;
  234. left: 30rpx;
  235. font-size: 40rpx;
  236. font-weight: bold;
  237. }
  238. .header_info {
  239. position: absolute;
  240. top: 0;
  241. left: 30rpx;
  242. font-size: 24rpx;
  243. }
  244. }
  245. .body {
  246. position: absolute;
  247. top: 320rpx;
  248. left: 0;
  249. right: 0;
  250. box-sizing: border-box;
  251. padding: 20rpx 20rpx 60rpx;
  252. height: calc(100vh - 320rpx);
  253. border-radius: 20rpx 20rpx 0 0;
  254. background-color: #ebeced;
  255. overflow-y: auto;
  256. .body_box {
  257. box-sizing: border-box;
  258. padding: 0 30rpx;
  259. margin-bottom: 20rpx;
  260. display: flex;
  261. flex-direction: column;
  262. height: 240rpx;
  263. border-radius: 14rpx;
  264. background-color: #fff;
  265. .box_title {
  266. line-height: 90rpx;
  267. font-size: 28rpx;
  268. font-weight: bold;
  269. border-bottom: 1rpx solid #e5e5e5;
  270. }
  271. .box_container {
  272. display: flex;
  273. margin-top: 25rpx;
  274. font-size: 28rpx;
  275. .container_key {
  276. width: 160rpx;
  277. color: #808080;
  278. }
  279. .container_value {
  280. }
  281. .container_copy {
  282. margin-left: auto;
  283. color: #096562;
  284. }
  285. .price {
  286. color: #ff5733;
  287. }
  288. }
  289. .box_info {
  290. display: flex;
  291. margin-top: 20rpx;
  292. height: 130rpx;
  293. img {
  294. width: 100rpx;
  295. height: 100rpx;
  296. border-radius: 10rpx;
  297. }
  298. .info_msg {
  299. display: flex;
  300. flex-direction: column;
  301. justify-content: space-around;
  302. margin-top: -10rpx;
  303. margin-left: 18rpx;
  304. width: 540rpx;
  305. .msg_name {
  306. font-size: 28rpx;
  307. font-weight: bold;
  308. }
  309. .msg_address {
  310. color: #808080;
  311. font-size: 24rpx;
  312. display: -webkit-box;
  313. -webkit-box-orient: vertical;
  314. -webkit-line-clamp: 2;
  315. overflow: hidden;
  316. }
  317. }
  318. }
  319. .box_btn {
  320. display: flex;
  321. justify-content: space-around;
  322. align-items: center;
  323. height: 110rpx;
  324. .btn_item {
  325. display: flex;
  326. align-items: center;
  327. width: 200rpx;
  328. .img {
  329. margin-right: 14rpx;
  330. width: 38rpx;
  331. height: 38rpx;
  332. }
  333. .img2 {
  334. width: 66rpx;
  335. height: 66rpx;
  336. }
  337. }
  338. }
  339. }
  340. .body_box2 {
  341. display: flex;
  342. flex-direction: column;
  343. box-sizing: border-box;
  344. padding: 0 30rpx;
  345. margin-bottom: 20rpx;
  346. height: 478rpx;
  347. border-radius: 15rpx;
  348. background-color: #fff;
  349. .info_time {
  350. display: flex;
  351. align-items: center;
  352. margin-top: 20rpx;
  353. font-size: 32rpx;
  354. font-weight: bold;
  355. .time_line {
  356. width: 17rpx;
  357. height: 1rpx;
  358. background-color: #096562;
  359. }
  360. .time_num {
  361. box-sizing: border-box;
  362. padding: 0 15rpx;
  363. height: 46rpx;
  364. line-height: 46rpx;
  365. font-size: 24rpx;
  366. font-weight: 400;
  367. border-radius: 66rpx;
  368. border: 1rpx solid #096562;
  369. background-color: #f0f2f5;
  370. }
  371. .gap {
  372. margin: 0 10rpx;
  373. }
  374. text {
  375. font-size: 24rpx;
  376. font-weight: 400;
  377. }
  378. }
  379. .info_msg {
  380. margin-top: 15rpx;
  381. font-size: 28rpx;
  382. font-weight: bold;
  383. }
  384. .info_type {
  385. display: flex;
  386. flex-wrap: wrap;
  387. margin-top: 15rpx;
  388. .type_item {
  389. box-sizing: border-box;
  390. padding: 0 15rpx;
  391. margin-right: 20rpx;
  392. height: 41rpx;
  393. line-height: 41rpx;
  394. font-size: 24rpx;
  395. color: #fff;
  396. border-radius: 34rpx;
  397. background-color: #096562;
  398. }
  399. }
  400. .info_tag {
  401. display: flex;
  402. flex-wrap: wrap;
  403. margin: 18rpx 0 0;
  404. box-sizing: border-box;
  405. padding-bottom: 30rpx;
  406. color: #808080;
  407. font-size: 24rpx;
  408. border-bottom: 1rpx solid #e5e5e5;
  409. .tag_item {
  410. margin-right: 20rpx;
  411. }
  412. }
  413. .info_box {
  414. display: flex;
  415. margin-top: 23rpx;
  416. font-size: 28rpx;
  417. .box_key {
  418. width: 160rpx;
  419. color: #808080;
  420. }
  421. .box_value {
  422. }
  423. }
  424. }
  425. .body_btn {
  426. box-sizing: border-box;
  427. padding: 0 32rpx;
  428. margin-top: 140rpx;
  429. display: flex;
  430. justify-content: space-between;
  431. height: 96rpx;
  432. .btn_item {
  433. display: flex;
  434. justify-content: center;
  435. align-items: center;
  436. width: 300rpx;
  437. height: 96rpx;
  438. border-radius: 64rpx;
  439. font-size: 32rpx;
  440. }
  441. .type {
  442. color: #d43030;
  443. border: 1rpx solid #d43030;
  444. }
  445. .type2 {
  446. color: #fff;
  447. background-color: #096562;
  448. }
  449. }
  450. .close_btn {
  451. margin: 32rpx;
  452. display: flex;
  453. justify-content: center;
  454. align-items: center;
  455. width: 300rpx;
  456. height: 96rpx;
  457. border-radius: 64rpx;
  458. font-size: 32rpx;
  459. color: #d43030;
  460. border: 1rpx solid #d43030;
  461. }
  462. }
  463. .popup_body {
  464. display: flex;
  465. flex-direction: column;
  466. justify-content: space-evenly;
  467. align-items: center;
  468. width: 481rpx;
  469. height: 404rpx;
  470. border-radius: 23rpx;
  471. background-color: #fff;
  472. img {
  473. width: 134rpx;
  474. height: 134rpx;
  475. }
  476. .msg {
  477. font-size: 26rpx;
  478. }
  479. .btn {
  480. display: flex;
  481. justify-content: center;
  482. align-items: center;
  483. width: 200rpx;
  484. height: 76rpx;
  485. font-size: 26rpx;
  486. color: #fff;
  487. border-radius: 43rpx;
  488. background: linear-gradient(90deg, rgba(11, 193, 150, 1) 0%, rgba(9, 101, 98, 1) 100%);
  489. }
  490. }
  491. }
  492. </style>