linwe
2023-11-12 b77cc2d2012ecb4b876538ac7aee3edac7db8a2f
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
<template>
    <view class="container">
        <u-sticky>
            <view class="tabsAndSearch">
                <view class="tabs">
                    <u-tabs :list="tabsList" @click="tabClick" :scrollable="false"></u-tabs>
                </view>
                <view class="search">
                    <u-search placeholder="请输入场所名称" v-model="iptContext" :clearabled="true" :showAction="true"
                        :animation="true" @change="keyWordChange" @search="searchConfirm" @clear="clearConfirm"></u-search>
                </view>
            </view>
        </u-sticky>
        <view class="info-box">
            <view class="records-card" v-for="(records, index) in recordsData" :key="records.id"
                @click="pushPage(records)">
                <view class="title">
                    <text>{{ records.placeName }}</text>
                    <text>{{ records.createTime }}</text>
                </view>
                <view class="info">
                    <view class="charge-man">
                        <text>场所负责人:</text>
                        <text>{{ records.username || '未完善' }}</text>
                    </view>
                    <view class="phone">
                        <text>手机号:</text>
                        <text>{{ records.phone || '未完善' }}</text>
                    </view>
                </view>
            </view>
        </view>
        <u-loadmore :status="status" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line />
    </view>
</template>
 
<script>
    import {
        getLocationRecord
    } from '@/api/place/place.js'
    export default {
        data() {
            return {
                tabsList: [{
                        type: 0,
                        name: '全部'
                    },
                    {
                        type: 1,
                        name: '待完善'
                    },
                    {
                        type: 2,
                        name: '已完善'
                    }
                ],
                recordsData: [],
                iptContext: '',
                pagingParams: {
                    current: 1,
                    size: 10
                },
                tabsType: 1,
                status: 'nomore',
                currentRole: {}
            }
        },
        onShow() {
            this.recordsData = []
            this.currentRole = uni.getStorageSync('activeRole')
            this.getrRecordList()
        },
        onReachBottom() {
            this.pagingParams.current++
            this.getrRecordList()
        },
        methods: {
            async getrRecordList(placeName = this.iptContext, isPerfect = this.tabsType) {
                this.status = 'loadmore'
                const { roleName } = this.currentRole
                console.log(this.currentRole);
                const {
                    code,
                    data: {
                        records
                    }
                } = await getLocationRecord({
                    placeName,
                    isPerfect,
                    roleName,
                    ...this.pagingParams
                })
                if (code !== 200) {
                    this.$u.func.showToast({
                        title: "获取数据失败",
                        icon: "error"
                    })
                    return
                }
                this.recordsData = [...this.recordsData, ...records]
                this.status = 'nomore'
            },
            tabClick({
                type
            }) {
                this.pagingParams = {
                    current: 1,
                    size: 10
                }
                this.recordsData = []
                this.tabsType = type
                this.getrRecordList(this.iptContext, this.tabsType)
            },
            searchConfirm() {
                this.recordsData = []
                this.pagingParams = {
                    current: 1,
                    size: 10
                }
                this.getrRecordList(this.iptContext, this.tabsType)
            },
            clearConfirm() {
                this.iptContext = ''
                this.searchConfirm()
            },
            pushPage({ id }) {
                if (!id) {
                    uni.showToast({
                        title: "关键参数为空",
                        icon: "error"
                    })
                    return
                }
                let url = "/subPackage/workbench/views/cscj?id=" + id + "&type=1"
                this.$u.func.globalNavigator(url)
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    page {
        background-color: #f6f6f6;
    }
 
    .tabsAndSearch {
        background-color: #fff;
 
        .tabs {}
 
        .search {
            padding: 20rpx 70rpx;
 
            .search-ipt {
                border: 0;
                border-radius: 9999rpx;
                background-color: #f6f6f6;
            }
        }
 
    }
 
    .info-box {
        padding: 20rpx 30rpx;
        background-color: #f6f6f6;
        .records-card {
            background: #fff;
            padding: 30rpx;
            border-radius: 10rpx;
            margin-bottom: 20rpx;
 
            .title {
                line-height: 70rpx;
                display: flex;
                font-size: 35rpx;
                display: flex;
                justify-content: space-between;
                border-bottom: 1rpx solid #f6f6f6;
 
                text {
                    &:nth-child(1) {
                        font-weight: 700;
                    }
 
                    &:nth-child(2) {
                        font-size: 27rpx;
                        color: #999999;
                    }
                }
            }
 
            .charge-man,
            .phone {
                display: flex;
                justify-content: space-between;
                font-weight: 30rpx;
                color: #717171;
                margin-top: 25rpx;
                font-size: 30rpx;
            }
 
            &:last-child {
                margin-bottom: 20rpx;
            }
        }
    }
</style>