order.vue 11 KB

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