orderDetail.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view>
  3. <view class="top">
  4. <!-- #ifdef MP-WEIXIN -->
  5. <NavigateBar title="订单详情" control="back" bgcolor="#a09cc4"></NavigateBar>
  6. <!-- #endif -->
  7. <!-- #ifdef MP-ALIPAY -->
  8. <NavigateBar title="订单详情" bgcolor="#a09cc4"></NavigateBar>
  9. <!-- #endif -->
  10. </view>
  11. <view class="info-item">
  12. <u-text text="订单id:"></u-text>
  13. <u-text :text="orderInfo.orderId" align="right"></u-text>
  14. </view>
  15. <view class="info-item">
  16. <u-text text="姓名:"></u-text>
  17. <u-text :text="orderInfo.name" align="right"></u-text>
  18. </view>
  19. <view class="info-item">
  20. <u-text text="手机号:"></u-text>
  21. <u-text :text="orderInfo.phone" align="right"></u-text>
  22. </view>
  23. <view class="info-item">
  24. <u-text text="酒店:"></u-text>
  25. <u-text :text="currentHotel.name" align="right"></u-text>
  26. </view>
  27. <view class="info-item">
  28. <u-text text="房间类型:"></u-text>
  29. <u-text :text="roomTypeName" align="right"></u-text>
  30. </view>
  31. <view class="info-item">
  32. <u-text text="楼栋:"></u-text>
  33. <u-text :text="orderInfo.building" align="right"></u-text>
  34. </view>
  35. <view class="info-item">
  36. <u-text text="楼层:"></u-text>
  37. <u-text :text="orderInfo.floor" align="right"></u-text>
  38. </view>
  39. <view class="info-item">
  40. <u-text text="房间号:"></u-text>
  41. <u-text :text="orderInfo.room+'('+orderInfo.breakfastNum+')'" align="right"></u-text>
  42. </view>
  43. <view class="info-item">
  44. <u-text text="开始日期:"></u-text>
  45. <u-text :text="orderInfo.startTime" align="right"></u-text>
  46. </view>
  47. <view class="info-item">
  48. <u-text text="结束日期:"></u-text>
  49. <u-text :text="orderInfo.endTime" align="right"></u-text>
  50. </view>
  51. <view class="info-item">
  52. <u-text text="创建时间:"></u-text>
  53. <u-text :text="orderInfo.createTime" align="right"></u-text>
  54. </view>
  55. <view class="info-item">
  56. <u-text text="价格:"></u-text>
  57. <u-text :text="orderInfo.price" align="right"></u-text>
  58. </view>
  59. <view class="info-item">
  60. <u-text text="支付时间:"></u-text>
  61. <u-text :text="orderInfo.paymentTime" align="right"></u-text>
  62. </view>
  63. <view class="info-item">
  64. <u-text text="支付方式:"></u-text>
  65. <u-text :text="orderInfo.paymentMethod" align="right"></u-text>
  66. </view>
  67. <view class="info-item">
  68. <u-text text="订单状态:"></u-text>
  69. <u-text :text="orderInfo.status" align="right"></u-text>
  70. </view>
  71. <view class="info-item">
  72. <u-text text="支付状态:"></u-text>
  73. <u-text :text="orderInfo.paymentStatus" align="right"></u-text>
  74. </view>
  75. <view class="btn-container">
  76. <u-button text="删除" type="error" @click="deleteOrder" color="#9e97c3"></u-button>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. import moment from "moment"
  82. import NavigateBar from "../../components/navigateBar/navigate-bar.vue";
  83. import {
  84. mapState,
  85. mapMutations
  86. } from 'vuex'
  87. export default {
  88. components: {
  89. NavigateBar
  90. },
  91. data() {
  92. return {
  93. orderId: '',
  94. orderInfo: {},
  95. roomTypeName: '',
  96. paymentStatus: {
  97. UNPAID: '待支付',
  98. PAID: '已支付'
  99. },
  100. status: {
  101. CANCELED: "已取消",
  102. ORDER_PLACED: "已下单",
  103. ROOM_SELECTED: "已选房",
  104. CHECK_IN: "已入住",
  105. FINISHED: "已完成"
  106. },
  107. paymentMethod: {
  108. WECHAT: '微信',
  109. ALIPAY: '支付宝'
  110. }
  111. };
  112. },
  113. computed: {
  114. ...mapState('m_business', ['currentHotel']),
  115. },
  116. methods: {
  117. async queryOrder() {
  118. let res = await uni.$http.get(`/order/orderId/${this.orderId}`, )
  119. console.log(res)
  120. this.orderInfo = JSON.parse(JSON.stringify(res.data.data))
  121. this.orderInfo.orderId = this.orderInfo.orderId.toUpperCase()
  122. this.orderInfo.startTime = moment(this.orderInfo.startTime).format('YYYY-MM-DD')
  123. this.orderInfo.endTime = moment(this.orderInfo.endTime).format('YYYY-MM-DD')
  124. this.orderInfo.createTime = moment(this.orderInfo.createTime).format('YYYY-MM-DD HH:mm:ss')
  125. this.orderInfo.paymentTime = this.orderInfo.paymentTime === null ? '' : moment(this.orderInfo
  126. .paymentTime).format('YYYY-MM-DD HH:mm:ss')
  127. this.orderInfo.status = this.status[this.orderInfo.status]
  128. this.orderInfo.paymentStatus = this.paymentStatus[this.orderInfo.paymentStatus]
  129. if (this.orderInfo.breakfastNum === null) {
  130. this.orderInfo.breakfastNum = '不含早'
  131. } else {
  132. this.orderInfo.breakfastNum = `含${this.orderInfo.breakfastNum}早`
  133. }
  134. this.orderInfo.paymentMethod = this.paymentMethod[this.orderInfo.platform]
  135. },
  136. async deleteOrder() {
  137. let res = await uni.$http.delete('/hotelOrder/' + this.orderInfo.id)
  138. console.log(res)
  139. if (res.data.code === 200 && res.data.msg === 'SUCCESS') {
  140. uni.$showMsg('删除成功!')
  141. setTimeout(() => {
  142. uni.switchTab({
  143. url: '/pages/order/order'
  144. })
  145. }, 1000)
  146. } else {
  147. uni.$showMsg('删除失败!')
  148. }
  149. }
  150. },
  151. async onLoad(options) {
  152. console.log(options.orderId)
  153. this.orderId = options.orderId
  154. this.roomTypeName = options.roomTypeName
  155. await this.queryOrder()
  156. },
  157. // #ifdef MP-WEIXIN
  158. onShareAppMessage(info) {
  159. return {
  160. title: '源享住',
  161. path: 'pages/login/login',
  162. imageUrl: "/static/logo.png"
  163. }
  164. }
  165. // #endif
  166. }
  167. </script>
  168. <style lang="scss">
  169. .info-item {
  170. margin: 20rpx;
  171. display: flex;
  172. }
  173. .btn-container {
  174. margin: 40rpx;
  175. }
  176. </style>