<template>  
 | 
    <u-popup :show="show" :round="10" closeable @close="show=false">  
 | 
        <view class="material-content bbox p30">  
 | 
            <view class="tc b f24 c2">选择物料</view>  
 | 
            <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="refreshing"  
 | 
                @scrolltolower="loadMore" @refresherrefresh="onRefresh">  
 | 
                <view v-for="(item1, index) in list" :key="index" class="" style="height: 20px;" @click="jump(item1)">  
 | 
                    <div class="page_content_title_top">  
 | 
                        <span>{{ item1.materialName + ' | ' + item1.materialCode }}</span>  
 | 
                    </div>  
 | 
                    <div class="page_content_title_bottom">  
 | 
                        <span>{{ item1.locationName }} / </span>  
 | 
                        <span>{{ item1.num }}{{ item1.unitName }}</span>  
 | 
                    </div>  
 | 
                    <div class="page_content_title_bottom">  
 | 
                        <span class="green" v-if="item1.qualityType == 0">合格 <span class="c1">/</span> </span>  
 | 
                        <span class="orange" v-else-if="item1.qualityType == 1">不良 <span  
 | 
                                class="c1">/</span> </span>  
 | 
                        <span class="red" v-else-if="item1.qualityType == 2">报废 <span  
 | 
                                class="c1">/</span> </span>  
 | 
                        <span v-else>- / </span>  
 | 
                        <span>{{item1.procedureName ? item1.procedureName : '-'}} / </span>  
 | 
                        <span>{{item1.batch ? item1.batch : '-'}}</span>  
 | 
                    </div>  
 | 
                </view>  
 | 
            </scroll-view>  
 | 
            <!-- <u-list @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower">  
 | 
                <u-list-item v-for="(item1, index) in list" :key="index">  
 | 
                </u-list-item>  
 | 
            </u-list> -->  
 | 
        </view>  
 | 
    </u-popup>  
 | 
</template>  
 | 
  
 | 
<script>  
 | 
    import {  
 | 
        choiceStockListPage,  
 | 
        choiceStockPageForStandard  
 | 
    } from '@/util/api/agencyAPI'  
 | 
    export default {  
 | 
        name: "selectMaterial",  
 | 
        data() {  
 | 
            return {  
 | 
                show: false, 
 | 
                refreshing: false,  
 | 
                pages: { 
 | 
                    capacity: 10, 
 | 
                    page: 1, 
 | 
                    total: 0 
 | 
                },  
 | 
                list: [  
 | 
                    1, 2, 3, 4, 5, 6, 7, 8  
 | 
                ]  
 | 
            };  
 | 
        },  
 | 
        methods: {  
 | 
            open(target) {  
 | 
                this.show = true  
 | 
                this.refreshing = false 
 | 
                this.workorderId = target.workorderId 
 | 
                this.deviceId = target.deviceId  
 | 
                this.list = []  
 | 
                this.pages = { 
 | 
                    capacity: 10, 
 | 
                    page: 1, 
 | 
                    total: 0 
 | 
                }  
 | 
                this.loadData()  
 | 
            },  
 | 
            loadData() {  
 | 
                // this.list = [{  
 | 
                //     batch: '1',  
 | 
                //     materialName: 'dsadas',  
 | 
                //     materialCode: '1m0001',  
 | 
                //     locationName: 'a仓2号位',  
 | 
                //     num: '1',  
 | 
                //     unitName: '块',  
 | 
                //     qualityType: 0,  
 | 
                //     procedureName: '压制',  
 | 
                // }]  
 | 
                choiceStockPageForStandard({  
 | 
                        ...this.pages,  
 | 
                        model: {  
 | 
                            workorderId: this.workorderId,  
 | 
                            deviceId: this.deviceId  
 | 
                        }  
 | 
                    }).then(res => {  
 | 
                        let {  
 | 
                            data  
 | 
                        } = res  
 | 
                        if (data.page == 1) {  
 | 
                            this.list = [];  
 | 
                        }  
 | 
                        this.pages.page = data.page  
 | 
                        this.pages.total = data.total  
 | 
                        this.list.push(...data.records)  
 | 
                    }).catch((err) => {  
 | 
  
 | 
                    })  
 | 
                    .finally(() => {  
 | 
                        this.refreshing = false;  
 | 
                    })  
 | 
            },  
 | 
            loadMore() { 
 | 
                this.pages.page += 1  
 | 
                this.loadData()  
 | 
            },  
 | 
            onRefresh() { 
 | 
                if (this.refreshing) return 
 | 
                this.refreshing = true; 
 | 
                this.pages.page = 1  
 | 
                this.loadData()  
 | 
            },  
 | 
            jump(item) {  
 | 
                this.$emit('selectAction', item)  
 | 
                this.show = false  
 | 
            }  
 | 
        }  
 | 
    }  
 | 
</script>  
 | 
  
 | 
<style lang="scss" scoped>  
 | 
    .material-content {  
 | 
        height: 1100rpx;  
 | 
    }  
 | 
  
 | 
    .page_content_title_top {  
 | 
        display: flex;  
 | 
        align-items: center;  
 | 
        justify-content: space-between;  
 | 
  
 | 
        span {  
 | 
            &:nth-child(1) {  
 | 
                font-size: 30rpx;  
 | 
                font-weight: 500;  
 | 
                color: #222222;  
 | 
            }  
 | 
  
 | 
            &:nth-child(2) {  
 | 
                flex-shrink: 0;  
 | 
                font-size: 24rpx;  
 | 
                font-weight: 400;  
 | 
                color: #333333;  
 | 
  
 | 
                // span {  
 | 
                //     font-size: 24rpx;  
 | 
                //     color: $nav-color;  
 | 
                // }  
 | 
            }  
 | 
        }  
 | 
    }  
 | 
  
 | 
    .page_content_title_bottom {  
 | 
        margin-top: 10rpx;  
 | 
  
 | 
        span {  
 | 
            font-size: 24rpx;  
 | 
            font-weight: 400;  
 | 
            color: #666666;  
 | 
        }  
 | 
    }  
 | 
  
 | 
    .page_content_title {  
 | 
        display: flex;  
 | 
        flex-direction: column;  
 | 
        margin-bottom: 10rpx;  
 | 
  
 | 
  
 | 
  
 | 
  
 | 
    }  
 | 
</style> 
 |