orderDetails.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="wrap">
  3. <view class="order-info">
  4. <u-image
  5. class="order-info-img"
  6. width="90rpx"
  7. height="90rpx"
  8. src="../../../../static/img/position.png"
  9. ></u-image>
  10. <view class="addr">{{ orderInfo.roadName }}</view>
  11. <view class="pay-amount" v-if="orderInfo.payAmount">-{{ orderInfo.payAmount }}</view>
  12. <view class="pay-amount" v-else>{{ orderInfo.payAmount }}</view>
  13. <u-cell-group :border="false">
  14. <u-cell-item
  15. title="车牌号"
  16. :arrow="false"
  17. :border-bottom="false"
  18. :border-top="false"
  19. :value="orderInfo.vehicleNo"
  20. ></u-cell-item>
  21. <u-cell-item
  22. title="优惠总金额"
  23. :arrow="false"
  24. :border-bottom="false"
  25. :border-top="false"
  26. :value="(orderInfo.preferentialAmount ? orderInfo.preferentialAmount.toFixed(2) : 0) + ' 元'"
  27. ></u-cell-item>
  28. </u-cell-group>
  29. <u-cell-group>
  30. <u-cell-item
  31. title="订单编号 "
  32. :arrow="false"
  33. :border-bottom="false"
  34. :border-top="false"
  35. :value="orderInfo.orderId"
  36. ></u-cell-item>
  37. <u-cell-item
  38. title="入场时间 "
  39. :arrow="false"
  40. :border-bottom="false"
  41. :border-top="false"
  42. :value="orderInfo.inTime"
  43. ></u-cell-item>
  44. <u-cell-item
  45. title="停车时长 "
  46. :arrow="false"
  47. :border-bottom="false"
  48. :border-top="false"
  49. :value="orderInfo.duration"
  50. ></u-cell-item>
  51. <u-cell-item
  52. title="出场时间 "
  53. :arrow="false"
  54. :border-bottom="false"
  55. :border-top="false"
  56. :value="orderInfo.outTime"
  57. ></u-cell-item>
  58. <u-cell-item
  59. v-if="orderInfo.createTime"
  60. title="订单创建时间 "
  61. :arrow="false"
  62. :border-bottom="false"
  63. :border-top="false"
  64. :value="orderInfo.createTime"
  65. ></u-cell-item>
  66. <u-cell-item
  67. v-if="orderInfo.payTime"
  68. title="支付时间 "
  69. :arrow="false"
  70. :border-bottom="false"
  71. :border-top="false"
  72. :value="orderInfo.payTime"
  73. ></u-cell-item>
  74. <u-cell-item
  75. v-if="orderInfo.payStatus == 1"
  76. title="缴费方式 "
  77. :arrow="false"
  78. :border-bottom="false"
  79. :border-top="false"
  80. :value="orderInfo.paySource | verifyPaySource"
  81. ></u-cell-item>
  82. </u-cell-group>
  83. </view>
  84. <view
  85. class="bottom-btn-wrap"
  86. v-if="orderInfo.payStatus == 0 || orderInfo.payStatus == 2 || orderInfo.payStatus == 3"
  87. >
  88. <view class="bottom-btn" @click="goPay(orderId)">去支付</view>
  89. </view>
  90. <!-- 支付方式 -->
  91. <PaymentMethod
  92. :payWayPop="payWayPop"
  93. :curOrderList="orderList"
  94. :jumpUrl="jumpUrl"
  95. @closePaymentMethod="closePaymentMethod"
  96. ></PaymentMethod>
  97. <u-toast ref="uToast" />
  98. </view>
  99. </template>
  100. <script>
  101. import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
  102. export default {
  103. components: {
  104. PaymentMethod
  105. },
  106. data () {
  107. return {
  108. orderId: null,
  109. // 订单信息
  110. orderInfo: {},
  111. // 立即支付弹框
  112. payWayPop: false,
  113. // 订单列表,一般长度为1的数组
  114. orderList: [],
  115. // 重定向页面
  116. jumpUrl: location.href
  117. }
  118. },
  119. onLoad (page) {
  120. const orderId = page?.orderId
  121. uni.showLoading({
  122. title: '加载中',
  123. mask: true
  124. })
  125. setTimeout(() => {
  126. if (orderId) {
  127. this.orderId = orderId
  128. this.handleGetOrderinfo(orderId)
  129. }
  130. }, 1000)
  131. },
  132. methods: {
  133. handleGetOrderinfo (orderId) {
  134. this.$u.api.getOrderDetail({ id: orderId })
  135. .then(res => {
  136. if (res.code === 200) {
  137. uni.hideLoading()
  138. this.orderInfo = res.data
  139. } else {
  140. this.$refs.uToast.show({
  141. title: res.msg,
  142. type: 'error'
  143. })
  144. }
  145. })
  146. .catch(() => {
  147. this.$refs.uToast.show({
  148. title: '程序错误!',
  149. type: 'error'
  150. })
  151. })
  152. },
  153. goPay (orderId) {
  154. this.orderList = []
  155. this.orderList.push(orderId)
  156. if (this.orderList.length > 0) {
  157. this.payWayPop = true
  158. } else {
  159. this.$refs.uToast.show({
  160. title: '当前订单编号不存在,请重新进入当前页面!',
  161. type: 'warning'
  162. })
  163. }
  164. },
  165. /**
  166. * 关闭支付方式弹框
  167. * */
  168. closePaymentMethod () {
  169. this.payWayPop = false
  170. }
  171. },
  172. filters: {
  173. verifyPaySource (value) {
  174. if (value === 0) {
  175. return '现金支付'
  176. } else if (value === 1) {
  177. return '微信支付'
  178. } else if (value === 2) {
  179. return '支付宝支付'
  180. } else if (value === 3) {
  181. return '贵州银行快捷支付'
  182. } else if (value === 4) {
  183. return '贵州银行扫码支付'
  184. } else if (value === 5) {
  185. return '贵州银行被扫支付'
  186. } else {
  187. return ''
  188. }
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. @import "./orderDetails.scss";
  195. </style>