jialh
2024-12-11 cb5ecb1d5e80fe0b510e5dc229c02bd25a89153b
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<template>
    <view class="container">
        <header>
            <!-- <u-input class="search" placeholder="搜索" type="text" v-model="search" /> <u-button type="primary"
                style="width: 100upx;margin-top: 20upx;" size="normal" text="搜索" @click="getsearch"></u-button> -->
            <view class="right">
                <image src="/static/index/search.png" mode=""></image>
                <input class="search" placeholder="请输入感兴趣的政策内容" type="text" v-model="search" />
                <u-button type="primary" style="width: 100upx;border-radius: 18upx;" size="normal" text="搜索"
                @click="getsearch()"></u-button>
            </view>
        </header>
        <view
            style="padding: 0 20upx;background-color: #fff;display: flex;justify-content: space-between;">
            <u-tabs :list="tabsList" @click="chooseArticleType" style="padding-left: 4px;" lineWidth="30"
                lineColor="#6190E8" :activeStyle="{
                    color: '#6190E8',
                    transform: 'scale(1.05)'
                }" :inactiveStyle="{
                    color: '#606266',
                    transform: 'scale(1)'
                }" itemStyle="padding-left: 15px; padding-right: 15px; height: 54px;">
            </u-tabs>
 
        </view>
        <view v-if="!loading">
            <view
                style="padding: 40upx;background-color: #fff;margin-top: 20upx;padding-bottom:200upx;color: #969799;font-size: 28upx;"
                v-if="ArticleType == '可申领补贴'&& goodsList.length>0">
                <view class="goods-item" v-for="(item, index) in goodsList" :key="index" @click="godetail(item)">
                    <view style="background-color: #f7f7f7;padding: 10upx;margin-bottom: 10upx;">
                        <view style="display: flex;justify-content: space-between;">
                            <view style="font-weight: 800px;color: #000;">{{ item.ProjectTitle }}</view>
                            <u-tag :text="item.ProjectType" plain size="mini" type="primary"></u-tag>
                        </view>
                        <view style="display: flex;justify-content: space-between;margin-top: 2upx;">
                            <view style="font-size: 22upx;line-height: 44upx;">{{ item.PlatForm }}</view>
                            <!-- <u-tag :text="item.StartDate.split(' ')[0]" plain size="mini" type="primary"></u-tag> -->
                            <!-- PubTime -->
                        </view>
                    </view>
                </view>
            </view>
            <view
                style="padding: 40upx;background-color: #fff;margin-top: 20upx;padding-bottom:200upx;color: #969799;font-size: 28upx;"
                 v-if="ArticleType == '已获批补贴'&& PolicyAppliedPageList.length>0">
                <view class="goods-item" v-for="(item, index) in PolicyAppliedPageList" :key="index"
                    @click="godetail(item)">
                    <view style="background-color: #f7f7f7;padding: 10upx;margin-bottom: 10upx;">
                        <view style="display: flex;justify-content: space-between;">
                            <view style="font-weight: 800px;color: #000;">{{ item.Subsidized }}</view>
                            <u-tag :text="item.GetTime ? item.GetTime.slice(0, 4) : ''" plain size="mini"
                                type="primary"></u-tag>
                        </view>
                    </view>
                </view>
            </view>
        </view>
        <view v-if="loading" style="margin-top: 100upx;">
            <u-loading-icon></u-loading-icon>
        </view>
        <view v-if="ArticleType == '可申领补贴'">
            <u-empty v-if="!loading && goodsList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/car.png">
            </u-empty>
        </view>
        <view v-if="ArticleType == '已获批补贴'">
            <u-empty v-if="!loading && PolicyAppliedPageList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/car.png">
            </u-empty>
        </view>
        <view style="position: fixed;bottom: 0;background-color: #fff;width: 100%;" v-if="ArticleType == '可申领补贴'">
            <Pagination :totalItems="total1" :itemsPerPage="pageSize" :currentPage="pageIndex1"
                @page-change="onPageChange1" />
        </view>
        <view style="position: fixed;bottom: 0;background-color: #fff;width: 100%;" v-else>
            <Pagination :totalItems="total2" :itemsPerPage="pageSize" :currentPage="pageIndex2"
                @page-change="onPageChange2" />
        </view>
    </view>
</template>
 
<script>
import Pagination from '../../components/Pagination';
export default {
    components: {
        Pagination
    },
 
    data() {
        return {
            loading: false,
            keyword: '',
            search: '',
            goodsList: [],
            tabsList: [
                {
                    name: '可申领补贴',
                    badge: {
                        value: 0,
                        type: 'error',
                        max:99
                        
                    }
                },
                {
                    name: '已获批补贴',
                    badge: {
                        value: 0,
                        type: 'error',
                        max:99
                    }
                },
            ],
            pageIndex1: 1,
            pageIndex2: 1,
            pageSize: 8,
            total1: 0,
            total2: 0,
            PolicyAppliedList: [],
            PolicyAppliedPageList: [],
            ArticleType: '可申领补贴',
        };
    },
    onLoad() {
        if (uni.getStorageSync('Address') && uni.getStorageSync('Address') != 'null') {
            this.search = uni.getStorageSync('Address')
        }
        this.getArticleDataList()
        this.getPolicyApplied()
 
 
 
    },
    methods: {
        getsearch() {
            this.pageIndex1 = 1
            this.pageIndex2 = 1
            this.getArticleDataList()
            this.getPolicyApplied()
        },
 
        chooseArticleType(e) {
            console.log('item', e);
            this.ArticleType = e.name
            
        },
 
        getArticleDataList() {
            this.loading = true
            let data = {
                CompanyName: this.search,
                Keyword: this.keyword,
                PageNumber: this.pageIndex1,
                PageSize: this.pageSize
            };
            this.$http.post('/SubsidyData/GetSubsidyDataList', data).then(res => {
                if (res.Check) {
                    for (let i = 0; i < res.Data.Data.length; i++) {
                        res.Data.Data[i].index = 10 * (this.pageIndex - 1) + 1 + i;
                    }
                    this.goodsList = res.Data.Data;
                    this.total1 = res.Data.TotalCount;
                    this.tabsList[0].badge.value = res.Data.TotalCount;
                    this.loading = false;
                    console.log(this.tabsList);
                } else {
                    this.$msg(res.Msg);
                    this.total1 = 0
                    this.goodsList = [];
                }
            })
        },
        getPolicyApplied() {
            this.loading = true
            let data = {
                Company: this.search,
                PageNumber: this.pageIndex2,
                PageSize: this.pageSize
            }
            this.$http.post('/SubsidizedCompanies/GetSubsidizedCompaniesList', data).then(res => {
                console.log(res);
 
                if (res.Check && res.Data && res.Data.Data != '-1' && res.Data.Data != '-2') {
                    // this.PolicyAppliedList = res.Data.Data;
                    this.total2 = res.Data.TotalCount;
                    this.tabsList[1].badge.value = res.Data.TotalCount;
                    this.loading = false
                    // 前端分页
                    // this.PolicyAppliedPageList = this.PolicyAppliedList.slice((this.pageIndex2 - 1) * this.pageSize, this.pageIndex2 * this.pageSize);
                    this.PolicyAppliedPageList = res.Data.Data;
                } else {
                    this.PolicyAppliedPageList = []
                    this.PolicyAppliedList = []
                    this.tabsList[1].badge.value = 0
                    this.total2 = 0
                    this.loading = false
                }
            })
        },
        godetail(item) {
            // 手机浏览器跳转
            window.open(item.SubsidyUrl, "_blank");
        },
 
        onPageChange1(e) {
            this.pageIndex1 = e
            this.getArticleDataList()
        },
        onPageChange2(e) {
            this.pageIndex2 = e
            this.getPolicyApplied()
            // this.PolicyAppliedPageList = this.PolicyAppliedList.slice((this.pageIndex - 1) * this.pageSize, this.pageIndex * this.pageSize);
        },
 
    }
 
 
}
</script>
 
<style lang="scss" scoped>
page {
    background-color: #F7F7F7;
}
 
header {
    padding: 0 30upx;
    height: 120upx;
    background-color: #236AF0;
    display: flex;
    color: #fff;
    font-size: 14px;
    .right{
        flex: 1;
        display: flex;
        align-items: center;
        background-color: #fff;
        border-radius: 20upx;
        // height: 80upx;
        // line-height: 80upx;
        padding: 0 10upx 0 20upx;
        margin: 20upx 0 ;
        color: #236AF0;
        image {
            width: 28upx;
            height: 28upx;
            margin-right:10upx;
        }
        .search{
            flex: 1;
        }
    }
}
 
.u-page__tag-item {
    height: 40upx;
    line-height: 40upx;
    min-width: 50upx;
    text-align: center;
    margin: 10upx;
}
</style>