jiangping
2025-06-06 a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<template>
    <view class="main_app">
        <view class="head_wrap">
            <view class="search_wrap">
                <image class="mr12 search" src="@/static/home/ic_search@2x.png" mode="widthFix"></image>
                <input v-model="param.name" @confirm="handleQuery" type="text" placeholder="搜索盘点单名称"
                    placeholder-class="placeholder9" />
            </view>
        </view>
        <!--  -->
        <scroll-view scroll-y="true" class="scroll_Y" @scrolltolower="scrolltolower">
            <view class="list">
                <view class="item" @click="itemClick(item)" v-for="item in list">
                    <image v-if="item.status == 0 || item.status == 1" class="img" src="@/static/side/ic_pandian@2x.png" mode="">
                    </image>
                    <image v-else class="img" src="@/static/side/ic_pandian_grey@2x.png" mode=""></image>
                    <view class="content">
                        <view class="head">
                            <view class="title">{{item.name}}</view>
                            <view class="status" v-if="item.status == 0">未开始</view>
                            <view class="status green" v-if="item.status == 1">盘点中</view>
                            <view class="status gray" v-if="item.status == 2">已完成</view>
                            <view class="status gray" v-if="item.status == 3">已取消</view>
                        </view>
                        <view class="line">盘点日期:{{item.planDate}}</view>
                        <view class="line">盘点仓库:{{item.warehouseName}}</view>
                        <view class="line">
                            <view class="">盘点人员:{{item.userName}}</view>
                            <view class="btn" v-if="item.status == 0 && item.timeFlag" @click="startHandle(item)">开始盘点</view>
                        </view>
                    </view>
                </view>
            </view>
        </scroll-view>
    </view>
</template>
 
<script>
    import {
        getYwStocktaking,
        ywStocktakingBegin
    } from '@/api'
    import dayjs from 'dayjs';
    export default {
        data() {
            return {
                param: {},
                list: [],
                page: 0,
                total: 0,
            };
        },
        onShow() {
            this.handleQuery()
        },
        methods: {
            getList() {
                const {
                    page,
                    param
                } = this
                getYwStocktaking({
                    capacity: 20,
                    page,
                    model: {
                        ...param
                    }
                }).then(res => {
                    this.list = [...this.list, ...res.data.records]
                    let date = dayjs().format('YYYY-MM-DD')
                    this.list.forEach(item => {
                        item.timeFlag = new Date(item.planDate).getTime() <= new Date(date+' 23:59:59').getTime()
                    })
                    this.total = res.data.total
                })
            },
            itemClick(item) {
                if (item.status != 0) {
                    uni.navigateTo({
                        url: '/pages/inventory/detail?id=' + item.id
                    })
                }
            },
            startHandle(item) {
                uni.showModal({
                    content: '盘点期间不可进行出入库操作',
                    success: (res) => {
                        if (res.confirm) {
                            ywStocktakingBegin(item.id).then(() => {
                                uni.navigateTo({
                                    url: '/pages/inventory/detail?id=' + item.id
                                })
                            })
 
                        }
                    }
                })
            },
            handleQuery() {
                this.list = []
                this.page = 1
                this.getList()
            },
            scrolltolower() {
                const {
                    total,
                    list
                } = this
                if (list.length < total) {
                    this.page = this.page + 1
                    this.getList()
                } else {
                    this.showToast('暂无更多数据')
                }
            },
        }
    }
</script>
 
<style lang="scss">
    .main_app {
        padding: 0rpx 30rpx 0;
        font-size: 28rpx;
    }
 
    .head_wrap {
        display: flex;
        align-items: center;
        height: 110rpx;    
        .search_wrap {
            display: flex;
            align-items: center;
            width: 100%;
            height: 76rpx;
            background: #F7F7F7;
            border-radius: 38rpx;
            padding-left: 30rpx;
 
            input {
                flex: 1;
            }
 
            .search {
                width: 28rpx;
                height: 28rpx;
            }
        }
 
    }
    .scroll_Y{
        height: calc(100vh - 126rpx);
    }
    .list {
        .item {
            display: flex;
            border-bottom: 1rpx solid #E5E5E5;
            padding-bottom: 28rpx;
            margin-bottom: 20rpx;
 
            .img {
                width: 80rpx;
                height: 80rpx;
                background: rgba(0, 104, 255, 0.08);
                border-radius: 12rpx;
                margin-right: 24rpx;
            }
 
            .content {
                flex: 1;
 
                .head {
                    display: flex;
                    // align-items: center;
                    justify-content: space-between;
                    margin-bottom: 12rpx;
 
                    .title {
                        font-weight: 600;
                        font-size: 34rpx;
                        color: #222222;
                        flex: 1;
                    }
 
                    .status {
                        color: $primaryColor;
                        width: 96rpx;
                        padding-top: 3rpx;
                    }
 
                    .green {
                        color: #0ADE79;
                    }
 
                    .gray {
                        color: #AAAAAA;
                    }
                }
 
                .line {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    color: #666666;
                    height: 60rpx;
 
                    .btn {
                        width: 144rpx;
                        height: 60rpx;
                        background: $primaryColor;
                        box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(0, 104, 255, 0.3);
                        border-radius: 30rpx;
                        color: #fff;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 26rpx;
                    }
                }
            }
        }
    }
</style>