order.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view>
  3. <view class="swiper-wrap">
  4. <view class="u-tabs-box">
  5. <u-tabs-swiper
  6. activeColor="#008CFF"
  7. ref="tabs"
  8. :list="list"
  9. :current="current"
  10. @change="change"
  11. :is-scroll="false"
  12. swiperWidth="100%"
  13. ></u-tabs-swiper>
  14. </view>
  15. <swiper
  16. class="swiper-box"
  17. :current="swiperCurrent"
  18. @transition="transition"
  19. @animationfinish="animationfinish"
  20. >
  21. <swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
  22. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  23. <view class="page-box">
  24. <view
  25. class="order"
  26. @click="goDetails(orderItem)"
  27. v-for="(orderItem, index) in orderList[index]"
  28. :key="'o-' + index"
  29. >
  30. <view class="order-top u-flex">
  31. <view class="order-top-left u-flex-1">
  32. <view class="car">{{ orderItem.vehicleNo }}</view>
  33. <view class="addr">{{ orderItem.roadName }}</view>
  34. </view>
  35. <!--
  36. 显示申请退款按钮满足一下条件:
  37. 1.允许退款allowRefund等于1 并且
  38. 2.退款状态auditStatus等于2 已驳回 或者
  39. 3.退款状态auditStatus不能为空 并且不能等于0
  40. -->
  41. <view
  42. class="order-top-right apply-refund"
  43. v-show="orderItem.allowRefund == 1 &&
  44. (orderItem.auditStatus == 2 || !orderItem.auditStatus && orderItem.auditStatus != 0)"
  45. @click.stop="applyRefund(orderItem)"
  46. >申请退款</view>
  47. <!--
  48. 显示申请状态满足以下条件
  49. 申请状态存在或者审核状态存在(由于0比较特殊,所以单独拉出来判断)
  50. -->
  51. <view
  52. class="order-top-right apply-refund"
  53. @click.stop="applyRefundDetails(orderItem)"
  54. v-if="orderItem.refundStatus ||
  55. orderItem.refundStatus == 0 ||
  56. orderItem.auditStatus ||
  57. orderItem.auditStatus == 0"
  58. >{{ orderItem | verifyRefundStatus }}</view>
  59. <view
  60. class="order-top-right"
  61. v-else
  62. :class="{ 'order-top-right-finished': orderItem.orderStatus == '4' }"
  63. >{{ orderItem.orderStatus | verifyStatusFilter }}</view>
  64. </view>
  65. <view class="order-center">
  66. <view class="order-center-item">订单编号:{{ orderItem.orderId }}</view>
  67. <view class="order-center-item">入场时间:{{ orderItem.inTime }}</view>
  68. <view
  69. class="order-center-item"
  70. v-if="orderItem.orderStatus == 1 && orderItem.outTime"
  71. >预计出场时间:{{orderItem.outTime}}</view>
  72. <view
  73. class="order-center-item"
  74. v-if="orderItem.orderStatus !== 1"
  75. >出场时间:{{ orderItem.outTime }}</view>
  76. <view
  77. class="order-center-item"
  78. v-if="orderItem.orderStatus !== 1"
  79. >停留时间:{{ orderItem.duration }}</view>
  80. <view
  81. class="order-center-item"
  82. v-if="orderItem.orderStatus == 1"
  83. >
  84. 预计金额:
  85. <span class="pay-amount">{{ orderItem.payAmount }}</span>
  86. </view>
  87. <view class="order-center-item" v-else>
  88. 应付金额:
  89. <span class="pay-amount">{{ orderItem.payAmount }}</span>
  90. </view>
  91. <view
  92. class="order-center-item"
  93. v-if="(orderItem.actualAmount || orderItem.actualAmount === 0) && orderItem.orderStatus !== 2"
  94. >
  95. 实缴金额:
  96. <span class="pay-amount">{{ orderItem.actualAmount }}</span>
  97. </view>
  98. <view class="order-center-item">泊位号:{{ orderItem.spaceName }}</view>
  99. <view class="order-center-item" v-if="orderItem.deviceType !=1">车位锁设备号:{{ orderItem.deviceNo }}</view>
  100. </view>
  101. <view class="order-bottom">
  102. <u-cell-item title="收费标准" @click.native.stop="jumpChargeStandard(orderItem)"></u-cell-item>
  103. </view>
  104. </view>
  105. <u-loadmore :status="loadStatus[index]" bg-color="#F6F6FF"></u-loadmore>
  106. </view>
  107. </scroll-view>
  108. </swiper-item>
  109. </swiper>
  110. </view>
  111. <u-toast ref="uToast" />
  112. </view>
  113. </template>
  114. <script>
  115. export default {
  116. data () {
  117. return {
  118. orderList: [[], [], [], []],
  119. list: [
  120. { index: 0, name: '全部', orderStatu: null, pageNum: 1, total: null },
  121. { index: 1, name: '停放中', orderStatu: 1, pageNum: 1, total: null },
  122. { index: 2, name: '欠费未缴', orderStatu: 2, pageNum: 1, total: null },
  123. { index: 3, name: '已完成', orderStatu: 4, pageNum: 1, total: null }
  124. ],
  125. current: 0,
  126. swiperCurrent: 0,
  127. tabsHeight: 0,
  128. dx: 0,
  129. loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore']
  130. }
  131. },
  132. onShow () {
  133. // onShow 刷新数据
  134. this.list[this.current].pageNum = 1
  135. this.orderList = [[], [], [], []]
  136. this.getOrderList(this.list[this.current])
  137. },
  138. computed: {
  139. // 价格小数
  140. priceDecimal () {
  141. return val => {
  142. if (val !== parseInt(val)) return val.slice(-2)
  143. else return '00'
  144. }
  145. },
  146. // 价格整数
  147. priceInt () {
  148. return val => {
  149. if (val !== parseInt(val)) return val.split('.')[0]
  150. else return val
  151. }
  152. }
  153. },
  154. methods: {
  155. reachBottom () {
  156. // console.log('this.list[this.current]',this.list[this.current]);
  157. if (this.orderList[this.current].length >= this.list[this.current].total) {
  158. this.loadStatus.splice(this.list[this.current].index, 1, 'nomore')
  159. return
  160. };
  161. this.loadStatus.splice(this.list[this.current].index, 1, 'loading')
  162. this.getOrderList(this.list[this.current])
  163. },
  164. // 页面数据
  165. getOrderList (orderType) {
  166. const param = {
  167. pageNum: orderType.pageNum,
  168. orderStatus: orderType.orderStatu
  169. }
  170. // 未出场: orderStatu = 1-停放中
  171. // 缴费中: orderStatu = 2-出场中 && payStatus = 2-支付中
  172. // 完成: orderStatu = 4-完成
  173. this.$u.api.getOrderList(param)
  174. .then(res => {
  175. for (const item of res.data.pageInfo.rows) {
  176. this.orderList[orderType.index].push(item)
  177. }
  178. this.list[this.current].total = res.data.pageInfo.total
  179. this.list[orderType.index].pageNum++
  180. if (this.orderList[this.current].length >= this.list[this.current].total) {
  181. this.loadStatus.splice(this.list[orderType.index].index, 1, 'nomore')
  182. };
  183. }).catch(err => {
  184. this.$refs.uToast.show({
  185. title: err.msg,
  186. type: 'error'
  187. })
  188. // console.log('getOrderList ',err)
  189. })
  190. this.loadStatus.splice(this.current, 1, 'loadmore')
  191. },
  192. // tab栏切换
  193. change (index) {
  194. // this.swiperCurrent = this.list[index].orderStatu;
  195. this.swiperCurrent = index
  196. this.getOrderList(this.list[index])
  197. },
  198. transition ({ detail: { dx } }) {
  199. this.$refs.tabs.setDx(dx)
  200. },
  201. animationfinish ({ detail: { current } }) {
  202. this.$refs.tabs.setFinishCurrent(current)
  203. this.swiperCurrent = current
  204. this.current = current
  205. },
  206. /**
  207. * 跳转详情
  208. * 未发起退款或者未退款成功的
  209. * */
  210. goDetails (item) {
  211. this.$u.route({
  212. url: 'pages/center/order/orderDetails/orderDetails',
  213. params: {
  214. orderId: item.id
  215. }
  216. })
  217. },
  218. jumpChargeStandard (item) {
  219. this.$u.route({
  220. url: 'pages/chargeStandard/chargeStandard',
  221. params: {
  222. roadNo: item.roadNo
  223. }
  224. })
  225. },
  226. // 申请退款
  227. applyRefund (item) {
  228. this.$u.route('pages/applyRefund/applyRefund', {
  229. orderId: item.orderId,
  230. payAmount: item.actualAmount
  231. })
  232. },
  233. /**
  234. * 申请退款详情
  235. * 只要申请退款状态等于1并且审批状态等于1跳转到退款完成详情页
  236. * 否则跳转到退款过程页
  237. * */
  238. applyRefundDetails (item) {
  239. if (item.refundStatus === 1 && item.auditStatus === 1) {
  240. this.$u.route('pages/applyRefundDetails/applyRefundAchieveDetails', {
  241. orderId: item.orderId
  242. })
  243. } else {
  244. this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
  245. orderId: item.orderId
  246. })
  247. }
  248. }
  249. },
  250. filters: {
  251. verifyStatusFilter (value) {
  252. if (value === 0) {
  253. return ''
  254. } else if (value === 1) {
  255. return '停放中'
  256. } else if (value === 2) {
  257. return '欠费未缴'
  258. } else if (value === 4) {
  259. return '已完成'
  260. } else {
  261. return ''
  262. }
  263. },
  264. verifyRefundStatus (item) {
  265. if (item.auditStatus === 0) {
  266. return '申请退款中'
  267. } else if (item.auditStatus === 1) {
  268. if (item.refundStatus === 0) {
  269. return '退款失败'
  270. } else if (item.refundStatus === 1) {
  271. return '退款成功'
  272. }
  273. } else if (item.auditStatus === 2) {
  274. return '已驳回'
  275. }
  276. }
  277. }
  278. }
  279. </script>
  280. <style>
  281. /* #ifndef H5 */
  282. page {
  283. height: 100%;
  284. background-color: #f6f6ff;
  285. }
  286. /* #endif */
  287. </style>
  288. <style lang="scss" scoped>
  289. @import "./order.scss";
  290. </style>