|
|
<template> <view class="pageBg"> <view class="navs"> <view class="nav" v-for="(item,index) in tabList" :key="index" :class="{active: params.orderStatus==item.id}" @click="changeTab(item)">{{ item.text }}</view> </view> <view class="pad"> <view class="tabCon"> <view class="card" v-for="(item,index) in list" :key="index" @click="goDetail(item)"> <opera :item="item"></opera> </view> </view> <view style="padding-bottom: 20rpx;" v-if="list.length>2"> <u-loadmore :status="status" /> </view> <nodata v-if="!list.length&&status=='nomore'"></nodata> </view> </view> </template>
<script> import opera from './comp/opera' import { applyOrderPage, refundPage } from '@/config/api.js' export default { components: { opera }, data() { return { tabList: [ {text: '已完成',id: 1}, {text: '待付款',id: 0}, {text: '退款',id: -1}, ],//0:待支付,1:已支付,-1:已取消,2:支付失败
navList: [ {text: '全部', id: 0}, {text: '学费', id: 1}, {text: '考场模拟费', id: 3} ],//1:驾校培训费用,2:理科培训费用,3:考场适应性费用,4:额外学时购买
params: { pageNo: 1, pageSize: 20, orderStatus: 1, orderType: 0, sercheValue: '' }, list: [], total: 0, status: 'loading' } }, onLoad() { this.params.studentId = this.studentId this.applyOrderPageFn() }, onPullDownRefresh() { this.initList() }, onReachBottom() { if(this.total>this.list.length) { this.applyOrderPageFn() } }, methods: { goDetail(item) { if(this.params.orderStatus==3) { this.$goPage('/pages/mineEntry/myOrder/detail/detail?refundId='+ item.id+'&orderId='+item.orderId) }else { this.$goPage('/pages/mineEntry/myOrder/detail/detail?orderId='+ item.orderId) } }, searchFn(val) { this.params.sercheValue = val this.initList() }, changeTab(item) { this.params.orderStatus = item.id this.initList() }, changeNav(item) { this.params.orderType = item.id this.initList() }, initList() { this.params.pageNo = 1 this.list = [] this.status = 'loading' this.applyOrderPageFn() }, async applyOrderPageFn() { let obj = Object.assign({},this.params) if(obj.orderType==0) delete obj.orderType if(!obj.sercheValue) delete obj.sercheValue let {data: res} = await applyOrderPage(obj) this.list.push(...res.list) this.params.pageNo ++ this.total = res.total if(this.total==this.list.length) { this.status = 'nomore' } uni.stopPullDownRefresh() } } } </script>
<style lang="scss" scoped> .card { padding: 0 24rpx; margin-bottom: 20rpx; } .navs { display: flex; justify-content: space-between; color: #fff; font-size: 28rpx; padding: 10rpx 30rpx 20rpx 30rpx; color: $themC; background: #fff; .nav { height: 80rpx; line-height: 80rpx; padding: 0 20rpx; flex: 1; text-align: center; &.active { font-weight: 500; position: relative; &::before { position: absolute; left: 50%; transform: translateX(-50%); bottom: 6rpx; content: ''; width: 56rpx; height: 6rpx; background: $themC; border-radius: 3rpx; } } } } .tabCon { padding: 20rpx 0 0 0; } .recordTotal { font-size: 24rpx; padding: 0rpx 0 28rpx 0; text-align: right; } </style>
|