|
|
<template> <view class="pageBgImg"> <topNavbar title="我的订单"></topNavbar> <view class="pad"> <view class="searcBox"> <searchRow placeholder="搜索" @searchFn="searchFn"/> </view> <view class="tabs"> <view class="tab" v-for="(item,index) in tabList" :key="index" :class="{active: params.orderStatus==item.id}" @click="changeTab(item)">{{ item.text }}</view> </view> <view class="navs"> <view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: params.orderType==item.id}" @click="changeNav(item)">{{ item.text }}</view> </view> <view class="recordTotal"> <text v-if="total">{{total}}条记录</text></view> <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: 3}, ],//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 if(this.params.orderStatus==3) { delete obj.orderStatus if(obj.orderType) { obj.feeType = obj.orderType delete obj.orderType } var {data: res} = await refundPage(obj) }else { var {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> .searcBox { margin: 0 0 20rpx 0; } .card { padding: 0 24rpx; margin-bottom: 20rpx; } .tabs { display: flex; width: 100%; height: 72rpx; background: #FFFFFF; border-radius: 16rpx; margin-top: 20rpx; .tab { flex: 1; text-align: center; line-height: 72rpx; color: #ADADAD; &.active { background: rgba(25,137,250,0.1); border-radius: 16rpx; border: 2rpx solid #1989FA; color: $themC; font-weight: 600; } } } .navs { display: flex; justify-content: space-between; color: #fff; font-size: 28rpx; padding: 10rpx 30rpx 24rpx 30rpx; color: $themC; .nav { height: 80rpx; line-height: 80rpx; padding: 0 20rpx; &.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; } } } } .recordTotal { font-size: 24rpx; padding: 0rpx 0 28rpx 0; text-align: right; } </style>
|