<!-- 收到随手拍 -->
<template>
    <view id="receiveCasuallyPat">
        <view class="top-button-box">
            <view :class="tabIndex==0?'view-color-a':'view-color-b'" @click="tabClick(0)">待处理</view>
            <view :class="tabIndex==1?'view-color-a':'view-color-b'" @click="tabClick(1)">已处理</view>
        </view>
        <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
            <view class="for-info-box" v-for="(item,index) in infoList" :key="index" @click="goCasuallyPatInfo(item)">
                <view class="title-box">
                    <view>{{item.subName}}</view>
                    <view>{{item.createTimeStr}}</view>
                </view>
                <view class="text-box">{{item.describe}}</view>
            </view>
            <view class="get-null-box" v-if="!infoList[0]">暂无数据</view>
        </scroll-view>
    </view>
</template>

<script>
    import { getAppList ,photonoteList} from '@/api/index.js'
    export default {
        data() {
            return {
                tabIndex:0,
                infoList:[],
                //列表请求参数
                getData:{
                    page:1,
                    pageSize:20,
                    getType:true,
                    nullDataType:true,
                }
            }
        },
        onLoad() {

        },
        onShow(){
            this.clearData();
            this.getList();
        },
        methods: {
            tabClick(type){
                if(this.tabIndex != type){
                    this.tabIndex = type;
					this.infoList = [];
					this.getData.page = 1;
					this.getData.getType = true;
					this.getData.nullDataType = true;
					this.getList();
                }
            },
            //清除
            clearData(){
                this.infoList = [];
                this.getData.page = 1;
                this.getData.getType = true;
                this.getData.nullDataType = true;
            },
            //去详情页
            goCasuallyPatInfo(item){
                if(item.handleStatus == 0){
                }
                uni.navigateTo({
                    url: '/pages_manage/workbench/receiveCasuallyPat/casuallyPatInfo?item='+encodeURIComponent(JSON.stringify(item))
                });
            },
            //滚动事件
            scrollGet(){
                if(this.getData.getType){
                    this.getData.page += 1;
                    this.getList();
                }
            },
            //获取列表数据
            async getList(){
                let self = this;
                let obj = {
                    pageNum:this.getData.page,
                    pageSize:this.getData.pageSize,
					handleStatus:this.tabIndex
                }
                const {data} = await getAppList(obj)
                if(data.code==200){
                    if(self.page==1){
                        if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
                            self.infoList = data.rows;
                        }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
                            self.infoList = data.rows;
                            self.getData.getType = false;
                            self.getData.nullDataType = true;
                        }else{
                            self.getData.getType = false;
                            self.getData.nullDataType = true;
                        }
                    }else{
                        if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
                            self.infoList = self.infoList.concat(data.rows)
                        }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
                            self.infoList = self.infoList.concat(data.rows);
                            self.getData.getType = false;
                            self.getData.nullDataType = true;
                        }else{
                            self.getData.getType = false;
                            self.getData.nullDataType = true;
                        }
                    }
                }
            },
        }
    }
</script>

<style lang="stylus" scoped>
    #receiveCasuallyPat{
        height:100%;
        width:100%;
        display flex
        flex-direction column
        .top-button-box{
            margin:20rpx 125rpx;
            display flex
            view{
                width:250rpx;
                line-height:80rpx;
                text-align center;
                font-size:28rpx;
            }
            view:nth-child(1){
                border-top-left-radius :40rpx;
                border-bottom-left-radius:40rpx;
            }
            view:nth-child(2){
                border-top-right-radius :40rpx;
                border-bottom-right-radius:40rpx;
            }
            .view-color-a{
                background #0183FA;
                color:#fff;
            }
            .view-color-b{
                background #e6e6e6;
                color:#999;
            }
        }
        .info-max-box{
            flex:1;
            overflow: scroll
            padding-bottom:20rpx;
            border-radius 20rpx
            .for-info-box:nth-child(1){
                .title-box{
                    border:none;
                }
                border-top-left-radius 20rpx
                border-top-right-radius 20rpx
            }
            .for-info-box:last-child{
                border-bottom-left-radius 20rpx
                border-bottom-right-radius 20rpx
            }
            .for-info-box{
                background #fff
                margin:0 20rpx;
                .title-box{
                    padding-top:12rpx;
                    border-top:1rpx solid #e0e0e0;
                    display flex
                    margin 0 20rpx
                    view{
                        font-size:28rpx;
                        line-height:60rpx;
                    }
                    view:nth-child(1){
                        flex:1;
                    }
                    view:nth-child(2){
                        font-size:24rpx;
                        color:#999999;
                        text-align right
                    }
                }
                .text-box{
                    margin 0 20rpx
                    font-size:24rpx;
                    line-height:40rpx;
                    color:#666;
                    padding-bottom:20rpx;
                }
            }
            .get-null-box{
                height:100rpx;
                line-height:100rpx;
                color:#999;
                text-align center
            }
        }
    }
</style>
