123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <view class="list-page">
- <van-sticky>
- <van-tabs swipeable id="tabs" :active="status" title-active-color="#3385FF" color="#3385FF" @change="typeChange">
- <van-tab title="待审批" name="待审批"></van-tab>
- <van-tab title="已处理" name="已处理"></van-tab>
- </van-tabs>
- </van-sticky>
- <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
- <view class="list-wrap" v-else>
- <view class="item" v-for="item in list" :key="item.BusinessApplyId" @click="goDetail(item)">
- <view class="info-item" v-for="info in itemOpt" :key="info.key">
- <view class="label">{{info.lable}}:</view>
- <view class="content">
- <text v-if="info.key=='date'">{{item.ArriveDate|formatTime}}-{{item.ReturnDate|formatTime}}</text>
- <text v-else-if="info.key=='place'">{{item.Province}}{{item.City}}</text>
- <text v-else>{{item[info.key]}}</text>
- </view>
- </view>
- <view class="status approve-list-status-wait" v-if="item.Status==='待审批'">待审批</view>
- <view class="status approve-list-status-success" v-if="item.Status==='已通过'">已通过</view>
- <view class="status approve-list-status-fail" v-if="item.Status==='已驳回'">已驳回</view>
- <view class="status approve-list-status-cancel" v-if="item.Status==='已过期'">已过期</view>
- <view class="status approve-list-status-back" v-if="item.Status==='已撤回'">已撤回</view>
- <view class="status approve-list-status-fail" v-if="item.Status==='已关闭'">已关闭</view>
- </view>
- </view>
- <view class="fix-bottom-wrap">
- <view class="btn" @click="goAddApply">添加申请</view>
- </view>
-
- </view>
- </template>
- <script>
- import {apiApplyList} from '@/api/businessTrip/index'
- export default {
- data() {
- return {
- status: '待审批',
- list:[],
- page:1,
- finished:false,
- PageSize:20,
- itemOpt:[
- {lable:'出差日期',key:'date'},
- {lable:'目的地',key:'place'},
- {lable:'出差事由',key:'Reason'},
- {lable:'提交时间',key:'CreateTime'},
- ]
- }
- },
- onLoad(){
- this.getList()
- // 更新列表
- uni.$on('businessApproveListUpdate',(e)=>{
- console.log('更新列表');
- this.page=1
- this.finished=false
- this.list=[]
- this.getList()
- })
- },
- onShow() {
- this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
- },
- onUnload(){
- uni.$off('businessApproveListUpdate')
- },
- onPullDownRefresh() {
- this.page=1
- this.finished=false
- this.list=[]
- this.getList()
- setTimeout(()=>{
- uni.stopPullDownRefresh()
- },1500)
- },
- onReachBottom() {
- if(this.finished) return
- this.page++
- this.getList()
- },
- methods: {
- typeChange(e){
- this.status=e.detail.name
- this.page=1
- this.finished=false
- this.list=[]
- this.getList()
- },
-
- async getList(){
- const res=await apiApplyList({
- PageSize:this.PageSize,
- CurrentIndex:this.page,
- Status:this.status
- })
- if(res.code===200){
- const arr=res.data.List||[]
- this.list=[...this.list,...arr]
- this.finished=res.data.Paging.IsEnd
- }
- },
- goAddApply(){
- uni.navigateTo({
- url: '/pages-approve/businessTrip/add',
- success: (result) => {},
- fail: () => {},
- complete: () => {}
- });
- },
- goDetail(item){
- uni.navigateTo({
- url: '/pages-approve/businessTrip/detail?id='+item.BusinessApplyId,
- success: (result) => {},
- fail: () => {},
- complete: () => {}
- });
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .list-page{
- min-height: 100vh;
- padding-bottom: calc(150rpx + constant(safe-area-inset-bottom));
- padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
- }
- .list-wrap{
- padding: 20rpx;
- .item{
- padding: 30rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- border-radius: 8rpx;
- .info-item{
- display: flex;
- font-size: 32rpx;
- margin-bottom: 30rpx;
- .label{
- width: 180rpx;
- flex-shrink: 0;
- text-align: right;
- }
- .content{
- flex: 1;
- }
- }
- .status{
- text-align: right;
- }
- }
- }
- .fix-bottom-wrap{
- .btn{
- width: 60%;
- text-align: center;
- line-height: 64rpx;
- height: 64rpx;
- color: #fff;
- background-color: #5890fb;
- border-radius: 50rpx;
- margin-left: auto;
- margin-right: auto;
- }
- }
- </style>
|