fix
Helius
2021-02-20 45fb4b11ad51bb38306765b11a6747402e382cee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
    <!-- 库存查询 -->
    <view>
        <search-bar @confirm="search" placeholder="商品名称、编号、拼音" class="ml-10 mr-10"></search-bar>
        <view class="content">
            <navigator :url="'./storeRecord?goodsCode='+item.goodsCode" hover-class="none" class="content-row" v-for="item in list">
                <view class="flex align-center">
                    <image class="product-img" :src="item.img?item.img:'../../static/images/no-img.png'"></image>
                    <view>
                        <text class="title">{{item.goodsName}}</text>
                        <view class="gray">
                            <text>在库数量: {{item.storeTotal}}</text>
                            <!-- <text class="iconfont iconjinggao warn-icon" v-if="item.storeTotal <= item.alarmNum"></text> -->
                            <text class="warn-txt" v-if="item.storeTotal <= item.alarmNum">低于警戒值</text>
                        </view>
                    </view>
                </view>
                <text class="iconfont iconarrow-backimg light-gray"></text>
            </navigator>
            <view v-if="list.length">
                <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
            </view>
        </view>
    </view>
</template>
 
<script>
    import searchBar from '../../components/searchBar/index.vue';
    import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
    export default {
        components:{
            uniLoadMore,
            searchBar
        },
        data(){
            return{
                queryKey: '',
                list: [],
                loadStatus: 'more',
                pageNum: 1
            }
        },
        onLoad() {
            this.loadList()
        },
        onPullDownRefresh(){
            this.reloadData();
            let timer = setTimeout(function () {
                uni.stopPullDownRefresh();
                clearTimeout(timer);
                timer = null;
            }, 800);
        },
        onReachBottom(){
            this.loadList()
        },
        methods:{
            reloadData(){
                this.list = [];
                this.pageNum = 1;
                this.loadStatus = 'more';
                this.loadList();
            },
            search(val){
                this.queryKey = val;
                this.reloadData();
            },
            loadList(){
                if(this.loadStatus!=='more'){
                    return;
                }
                this.$httpUtils.request('/api/store/findStoreList', {
                    pageNum: this.pageNum,
                    pageSize: 10,
                    queryKey: this.queryKey
                }, 'POST').then((res) => {
                    if(res.status == 200){
                        let result = res.rows;
                        if(result.length < 10){
                            this.loadStatus = 'noMore';
                        } else {
                            this.pageNum ++ ;
                            this.loadStatus = 'more';
                        }
                        this.list = this.list.concat(result);
                    }
                })
            }
        }
    }
</script>
 
<style>
    .content{
        padding: 0 10px;
    }
    .content-row{
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #EDEAF4;
        padding: 12px 0;
        font-size: 13px;
    }
    .product-img{
        width: 48px;
        height: 48px;
        border-radius: 4px;
        margin-right: 10px;
    }
    .content-row .title{
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        color: #333333;
    }
    .content-row .warn-icon{
        margin-left: 10px;
        color: #FF3232;
        font-size: 18px;
    }
    .content-row .warn-txt{
        padding: 2px 8px;
        margin-left: 10px;
        border: 1px solid #FF3232;
        color: #FF3232;
        font-size: 10px;
        border-radius: 20px;
        
    }
</style>