order.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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" v-if="orderItem.deviceType !=1">设备编号:{{ orderItem.deviceNo }}</view>
  68. <view class="order-center-item">入场时间:{{ orderItem.inTime }}</view>
  69. <view
  70. class="order-center-item"
  71. v-if="orderItem.orderStatus == 1 && orderItem.outTime"
  72. >预计出场时间:{{orderItem.outTime}}</view>
  73. <view
  74. class="order-center-item"
  75. v-if="orderItem.orderStatus !== 1"
  76. >出场时间:{{ orderItem.outTime }}</view>
  77. <view
  78. class="order-center-item"
  79. v-if="orderItem.orderStatus !== 1"
  80. >停留时间:{{ orderItem.duration }}</view>
  81. <view
  82. class="order-center-item"
  83. v-if="orderItem.orderStatus == 1"
  84. >
  85. 预计金额:
  86. <span class="pay-amount">{{ orderItem.payAmount }}</span>
  87. </view>
  88. <view class="order-center-item" v-else>
  89. 应付金额:
  90. <span class="pay-amount">{{ orderItem.payAmount }}</span>
  91. </view>
  92. <view
  93. class="order-center-item"
  94. v-if="(orderItem.actualAmount || orderItem.actualAmount === 0) && orderItem.orderStatus !== 2"
  95. >
  96. 实缴金额:
  97. <span class="pay-amount">{{ orderItem.actualAmount }}</span>
  98. </view>
  99. </view>
  100. <view class="order-bottom">
  101. <u-cell-item title="收费标准" @click.native.stop="jumpChargeStandard(orderItem)"></u-cell-item>
  102. </view>
  103. </view>
  104. <u-loadmore :status="loadStatus[index]" bg-color="#F6F6FF"></u-loadmore>
  105. </view>
  106. </scroll-view>
  107. </swiper-item>
  108. </swiper>
  109. </view>
  110. <u-toast ref="uToast" />
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. data () {
  116. return {
  117. orderList: [[], [], [], []],
  118. list: [
  119. { index: 0, name: '全部', orderStatu: null, pageNum: 1, total: null },
  120. { index: 1, name: '停放中', orderStatu: 1, pageNum: 1, total: null },
  121. { index: 2, name: '欠费未缴', orderStatu: 2, pageNum: 1, total: null },
  122. { index: 3, name: '已完成', orderStatu: 4, pageNum: 1, total: null }
  123. ],
  124. current: 0,
  125. swiperCurrent: 0,
  126. tabsHeight: 0,
  127. dx: 0,
  128. loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore']
  129. }
  130. },
  131. onShow () {
  132. // onShow 刷新数据
  133. this.list[this.current].pageNum = 1
  134. this.orderList = [[], [], [], []]
  135. this.getOrderList(this.list[this.current])
  136. },
  137. computed: {
  138. // 价格小数
  139. priceDecimal () {
  140. return val => {
  141. if (val !== parseInt(val)) return val.slice(-2)
  142. else return '00'
  143. }
  144. },
  145. // 价格整数
  146. priceInt () {
  147. return val => {
  148. if (val !== parseInt(val)) return val.split('.')[0]
  149. else return val
  150. }
  151. }
  152. },
  153. methods: {
  154. reachBottom () {
  155. // console.log('this.list[this.current]',this.list[this.current]);
  156. if (this.orderList[this.current].length >= this.list[this.current].total) {
  157. this.loadStatus.splice(this.list[this.current].index, 1, 'nomore')
  158. return
  159. };
  160. this.loadStatus.splice(this.list[this.current].index, 1, 'loading')
  161. this.getOrderList(this.list[this.current])
  162. },
  163. // 页面数据
  164. getOrderList (orderType) {
  165. const param = {
  166. pageNum: orderType.pageNum,
  167. orderStatus: orderType.orderStatu
  168. }
  169. // 未出场: orderStatu = 1-停放中
  170. // 缴费中: orderStatu = 2-出场中 && payStatus = 2-支付中
  171. // 完成: orderStatu = 4-完成
  172. this.$u.api.getOrderList(param)
  173. .then(res => {
  174. for (const item of res.data.rows) {
  175. this.orderList[orderType.index].push(item)
  176. }
  177. this.list[this.current].total = res.data.total
  178. this.list[orderType.index].pageNum++
  179. if (this.orderList[this.current].length >= this.list[this.current].total) {
  180. this.loadStatus.splice(this.list[orderType.index].index, 1, 'nomore')
  181. };
  182. }).catch(err => {
  183. this.$refs.uToast.show({
  184. title: err.msg,
  185. type: 'error'
  186. })
  187. // console.log('getOrderList ',err)
  188. })
  189. this.loadStatus.splice(this.current, 1, 'loadmore')
  190. },
  191. // tab栏切换
  192. change (index) {
  193. // this.swiperCurrent = this.list[index].orderStatu;
  194. this.swiperCurrent = index
  195. this.getOrderList(this.list[index])
  196. },
  197. transition ({ detail: { dx } }) {
  198. this.$refs.tabs.setDx(dx)
  199. },
  200. animationfinish ({ detail: { current } }) {
  201. this.$refs.tabs.setFinishCurrent(current)
  202. this.swiperCurrent = current
  203. this.current = current
  204. },
  205. /**
  206. * 跳转详情
  207. * 未发起退款或者未退款成功的
  208. * */
  209. goDetails (item) {
  210. this.$u.route({
  211. url: 'pages/center/order/orderDetails/orderDetails',
  212. params: {
  213. orderId: item.id
  214. }
  215. })
  216. },
  217. jumpChargeStandard (item) {
  218. this.$u.route({
  219. url: 'pages/chargeStandard/chargeStandard',
  220. params: {
  221. roadNo: item.roadNo
  222. }
  223. })
  224. },
  225. // 申请退款
  226. applyRefund (item) {
  227. this.$u.route('pages/applyRefund/applyRefund', {
  228. orderId: item.orderId,
  229. payAmount: item.actualAmount
  230. })
  231. },
  232. /**
  233. * 申请退款详情
  234. * 只要申请退款状态等于1并且审批状态等于1跳转到退款完成详情页
  235. * 否则跳转到退款过程页
  236. * */
  237. applyRefundDetails (item) {
  238. if (item.refundStatus === 1 && item.auditStatus === 1) {
  239. this.$u.route('pages/applyRefundDetails/applyRefundAchieveDetails', {
  240. orderId: item.orderId
  241. })
  242. } else {
  243. this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
  244. orderId: item.orderId
  245. })
  246. }
  247. }
  248. },
  249. filters: {
  250. verifyStatusFilter (value) {
  251. if (value === 0) {
  252. return ''
  253. } else if (value === 1) {
  254. return '停放中'
  255. } else if (value === 2) {
  256. return '欠费未缴'
  257. } else if (value === 4) {
  258. return '已完成'
  259. } else {
  260. return ''
  261. }
  262. },
  263. verifyRefundStatus (item) {
  264. if (item.auditStatus === 0) {
  265. return '申请退款中'
  266. } else if (item.auditStatus === 1) {
  267. if (item.refundStatus === 0) {
  268. return '退款失败'
  269. } else if (item.refundStatus === 1) {
  270. return '退款成功'
  271. }
  272. } else if (item.auditStatus === 2) {
  273. return '已驳回'
  274. }
  275. }
  276. }
  277. }
  278. </script>
  279. <style>
  280. /* #ifndef H5 */
  281. page {
  282. height: 100%;
  283. background-color: #f6f6ff;
  284. }
  285. /* #endif */
  286. </style>
  287. <style lang="scss" scoped>
  288. @import "./order.scss";
  289. </style>