push.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <template>
  2. <view class="container" v-if="orderInfo">
  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="orderInfo.orderStatus === '1'">待支付</view>
  12. <view class="header_type" v-if="orderInfo.orderStatus === '2'">已支付</view>
  13. <view class="header_type" v-if="orderInfo.orderStatus === '3'">待入住</view>
  14. <view class="header_type" v-if="orderInfo.orderStatus === '4'">已入住</view>
  15. <view class="header_type" v-if="orderInfo.orderStatus === '5'">已消费</view>
  16. <view class="header_type" v-if="orderInfo.orderStatus === '6'">支付超时</view>
  17. <view class="header_type" v-if="orderInfo.orderStatus === '7'">已取消</view>
  18. <view class="header_type" v-if="orderInfo.orderStatus === '8'">已退单</view>
  19. <view class="header_type" v-if="orderInfo.orderStatus === '9'">已退款</view>
  20. <view class="header_type" v-if="orderInfo.orderStatus === '10'">退款中</view>
  21. <view class="header_info">订单号:{{ 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. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. // 订单id
  83. id: '',
  84. // 订单信息
  85. orderInfo: null
  86. }
  87. },
  88. onLoad(options) {
  89. this.id = options.id
  90. this.getData()
  91. },
  92. methods: {
  93. async getData() {
  94. const res = await this.$myRequest({
  95. url: '/mhotel/ampgetBookingById.action',
  96. data: {
  97. bookingId: this.id
  98. }
  99. })
  100. // console.log(res)
  101. if (res.code === 200) {
  102. this.orderInfo = res.data
  103. }
  104. },
  105. // 点击 退单 接单 按钮回调
  106. handleOrder(type) {
  107. // 1 接单 4 退单
  108. uni.showModal({
  109. title: '提示',
  110. content: `确定${type === 1 ? '接单' : '退单'}吗?`,
  111. success: (res) => {
  112. if (res.confirm) {
  113. if (type === 1) {
  114. // 接单请求
  115. this.receiving()
  116. } else {
  117. // 退单请求
  118. this.chargeback()
  119. }
  120. }
  121. }
  122. })
  123. },
  124. async receiving() {
  125. const res = await this.$myRequest({
  126. url: '/mhotel/bookupdateBookStatus.action',
  127. data: {
  128. id: this.id,
  129. type: 1
  130. }
  131. })
  132. // console.log(res)
  133. if (res.code === 200) {
  134. uni.showToast({
  135. title: `接单成功`,
  136. icon: 'success',
  137. mask: true
  138. })
  139. setTimeout(() => {
  140. uni.switchTab({
  141. url: '/pages/home/home'
  142. })
  143. }, 1500)
  144. }
  145. },
  146. async chargeback() {
  147. const res = await this.$myRequest({
  148. url: '/mhotel/abkchargeback.action',
  149. data: {
  150. bookingId: this.id
  151. }
  152. })
  153. // console.log(res)
  154. if (res.code === 200) {
  155. uni.showToast({
  156. title: res.message,
  157. icon: 'none',
  158. mask: true
  159. })
  160. setTimeout(() => {
  161. uni.switchTab({
  162. url: '/pages/home/home'
  163. })
  164. }, 1500)
  165. }
  166. },
  167. // 点击左上角返回按钮回调
  168. handleBack() {
  169. uni.switchTab({
  170. url: '/pages/home/home'
  171. })
  172. },
  173. getWeek(time) {
  174. let date = new Date(time)
  175. // 获取星期
  176. let week = date.getDay()
  177. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  178. let res = '周' + weekList[week]
  179. return res
  180. },
  181. getTime(time) {
  182. let date = new Date(time)
  183. // 获取月份
  184. let M = date.getMonth() + 1
  185. // 获取日期
  186. let D = date.getDate()
  187. let res = M + '月' + D + '日'
  188. return res
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .container {
  195. position: relative;
  196. height: 100vh;
  197. background-color: #f2f2f2;
  198. .header {
  199. height: 480rpx;
  200. color: #fff;
  201. img {
  202. width: 100%;
  203. }
  204. .header_title {
  205. position: absolute;
  206. top: 65rpx;
  207. left: 308rpx;
  208. color: #fff;
  209. font-size: 28rpx;
  210. }
  211. .header_icon {
  212. position: absolute;
  213. top: 76rpx;
  214. left: 10rpx;
  215. width: 47rpx;
  216. height: 47rpx;
  217. }
  218. .header_type {
  219. position: absolute;
  220. top: 144rpx;
  221. left: 30rpx;
  222. font-size: 40rpx;
  223. font-weight: bold;
  224. }
  225. .header_info {
  226. position: absolute;
  227. top: 215rpx;
  228. left: 30rpx;
  229. font-size: 24rpx;
  230. }
  231. }
  232. .body {
  233. position: absolute;
  234. top: 278rpx;
  235. left: 0;
  236. right: 0;
  237. box-sizing: border-box;
  238. padding: 20rpx;
  239. height: calc(100vh - 278rpx);
  240. border-radius: 20rpx 20rpx 0 0;
  241. background-color: #ebeced;
  242. overflow-y: auto;
  243. .body_box {
  244. box-sizing: border-box;
  245. padding: 0 30rpx;
  246. margin-bottom: 20rpx;
  247. display: flex;
  248. flex-direction: column;
  249. height: 240rpx;
  250. border-radius: 14rpx;
  251. background-color: #fff;
  252. .box_title {
  253. line-height: 90rpx;
  254. font-size: 28rpx;
  255. font-weight: bold;
  256. border-bottom: 1rpx solid #e5e5e5;
  257. }
  258. .box_container {
  259. display: flex;
  260. margin-top: 25rpx;
  261. font-size: 28rpx;
  262. .container_key {
  263. width: 160rpx;
  264. color: #808080;
  265. }
  266. .container_value {
  267. }
  268. .container_copy {
  269. margin-left: auto;
  270. color: #096562;
  271. }
  272. .price {
  273. color: #ff5733;
  274. }
  275. }
  276. .box_info {
  277. display: flex;
  278. margin-top: 20rpx;
  279. height: 130rpx;
  280. img {
  281. width: 100rpx;
  282. height: 100rpx;
  283. border-radius: 10rpx;
  284. }
  285. .info_msg {
  286. display: flex;
  287. flex-direction: column;
  288. justify-content: space-around;
  289. margin-top: -10rpx;
  290. margin-left: 18rpx;
  291. width: 540rpx;
  292. .msg_name {
  293. font-size: 28rpx;
  294. font-weight: bold;
  295. }
  296. .msg_address {
  297. color: #808080;
  298. font-size: 24rpx;
  299. display: -webkit-box;
  300. -webkit-box-orient: vertical;
  301. -webkit-line-clamp: 2;
  302. overflow: hidden;
  303. }
  304. }
  305. }
  306. .box_btn {
  307. display: flex;
  308. justify-content: space-around;
  309. align-items: center;
  310. height: 110rpx;
  311. .btn_item {
  312. display: flex;
  313. align-items: center;
  314. width: 200rpx;
  315. .img {
  316. margin-right: 14rpx;
  317. width: 38rpx;
  318. height: 38rpx;
  319. }
  320. .img2 {
  321. width: 66rpx;
  322. height: 66rpx;
  323. }
  324. }
  325. }
  326. }
  327. .body_box2 {
  328. display: flex;
  329. flex-direction: column;
  330. box-sizing: border-box;
  331. padding: 0 30rpx;
  332. margin-bottom: 20rpx;
  333. height: 478rpx;
  334. border-radius: 15rpx;
  335. background-color: #fff;
  336. .info_time {
  337. display: flex;
  338. align-items: center;
  339. margin-top: 20rpx;
  340. font-size: 32rpx;
  341. font-weight: bold;
  342. .time_line {
  343. width: 17rpx;
  344. height: 1rpx;
  345. background-color: #096562;
  346. }
  347. .time_num {
  348. box-sizing: border-box;
  349. padding: 0 15rpx;
  350. height: 46rpx;
  351. line-height: 46rpx;
  352. font-size: 24rpx;
  353. font-weight: 400;
  354. border-radius: 66rpx;
  355. border: 1rpx solid #096562;
  356. background-color: #f0f2f5;
  357. }
  358. .gap {
  359. margin: 0 10rpx;
  360. }
  361. text {
  362. font-size: 24rpx;
  363. font-weight: 400;
  364. }
  365. }
  366. .info_msg {
  367. margin-top: 15rpx;
  368. font-size: 28rpx;
  369. font-weight: bold;
  370. }
  371. .info_type {
  372. display: flex;
  373. flex-wrap: wrap;
  374. margin-top: 15rpx;
  375. .type_item {
  376. box-sizing: border-box;
  377. padding: 0 15rpx;
  378. margin-right: 20rpx;
  379. height: 41rpx;
  380. line-height: 41rpx;
  381. font-size: 24rpx;
  382. color: #fff;
  383. border-radius: 34rpx;
  384. background-color: #096562;
  385. }
  386. }
  387. .info_tag {
  388. display: flex;
  389. flex-wrap: wrap;
  390. margin: 18rpx 0 0;
  391. box-sizing: border-box;
  392. padding-bottom: 30rpx;
  393. color: #808080;
  394. font-size: 24rpx;
  395. border-bottom: 1rpx solid #e5e5e5;
  396. .tag_item {
  397. margin-right: 20rpx;
  398. }
  399. }
  400. .info_box {
  401. display: flex;
  402. margin-top: 23rpx;
  403. font-size: 28rpx;
  404. .box_key {
  405. width: 160rpx;
  406. color: #808080;
  407. }
  408. .box_value {
  409. }
  410. }
  411. }
  412. .body_btn {
  413. box-sizing: border-box;
  414. padding: 0 32rpx;
  415. margin-top: 140rpx;
  416. display: flex;
  417. justify-content: space-between;
  418. height: 96rpx;
  419. .btn_item {
  420. display: flex;
  421. justify-content: center;
  422. align-items: center;
  423. width: 300rpx;
  424. height: 96rpx;
  425. border-radius: 64rpx;
  426. font-size: 32rpx;
  427. }
  428. .type {
  429. color: #d43030;
  430. border: 1rpx solid #d43030;
  431. }
  432. .type2 {
  433. color: #fff;
  434. background-color: #096562;
  435. }
  436. }
  437. }
  438. }
  439. </style>