wangzhibo
2025-10-23 cad64c1de2c45856b0774933c5801b05b64984e8
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<template>
    <view class="page-wrapper">
        <div class="bg-top"></div>
 
        <div class="content-wrapper">
 
            <!-- 页面标题 -->
            <view class="text-2xl font-bold mb-4 text-center">我的投诉建议</view>
 
            <!-- 投诉列表 -->
            <view class="space-y-6 relative">
                <view v-for="(item, index) in complaints" :key="index"
                    class="relative bg-white rounded-xl shadow-md p-4 pt-6 mt-10">
                    <!-- 编号圆形 -->
                    <view
                        class="absolute -top-3 -left-3 w-8 h-8 bg-blue-500 text-white text-center leading-8 rounded-full font-semibold shadow">
                        {{ index + 1 }}
                    </view>
 
                    <!-- 时间 -->
                    <view class="text-sm text-gray-500 mb-1">{{ item.time }}</view>
 
                    <!-- 用户提交内容 -->
                    <view class="text-base leading-snug mt-2">
                        投诉建议:
                        <text class="text-color-question">
                            {{ item.content }}
                        </text>
                    </view>
 
 
                    <!-- 后台回复 -->
                    <view class="text-base leading-snug mt-2">
                        处理状态:
                        <text :class="
            item.status === '未处理' ? 'text-color-status-0' :
            item.status === '处理中' ? 'text-color-status-1' :
            item.status === '已处理' ? 'text-color-status-2' : ''
          ">
                            {{ item.status || '暂未回复' }}
                        </text>
                    </view>
 
                    <view class="text-base text-gray-600 mt-2">
                        回复:
                        <text :class="
            item.status === '未处理' ? 'text-color-status-0' :
            item.status === '处理中' ? 'text-color-status-1' :
            item.status === '已处理' ? 'text-color-status-2' : ''
          ">
                            {{ item.reply ? item.reply : '暂未回复' }}
                        </text>
                    </view>
                </view>
            </view>
 
            <!-- 提示为空 -->
            <view v-if="complaints.length === 0" class="text-center text-color-reply-none mt-10">
                还没有提交任何投诉或建议
            </view>
        </div>
        <div class="bg-bottom"></div>
 
    </view>
</template>
 
<script setup>
    import {
        ref,
        onMounted
    } from 'vue'
    import {
        apiService
    } from '@/apiservice/apiService'
    import {
        useUserStore
    } from '@/stores/user'
 
    const userStore = useUserStore()
    const complaints = ref([])
 
    async function fetchComplaints() {
        const uuid = userStore.uuid
        if (!uuid) return
 
        try {
            console.log(uuid)
            const res = await apiService.advicesListByUuid(uuid)
            if (res.code === 1000 && Array.isArray(res.data)) {
                // 转换成前端需要的格式
                console.log(res.data)
                complaints.value = res.data.map(item => ({
                    time: item.createTime || '',
                    content: item.question || '',
                    reply: item.replytext || '',
                    status: item.status || '未处理'
                }))
            } else {
                console.warn('获取投诉数据失败:', res.message)
                complaints.value = []
            }
        } catch (err) {
            console.error('网络或服务器错误:', err)
            complaints.value = []
        }
    }
 
 
 
    onMounted(() => {
        fetchComplaints()
    })
</script>
 
<style>
    /* 布局与背景 */
    .p-4 {
        padding: 1rem;
    }
 
    .mt-10 {
        margin-top: 10rpx;
    }
 
 
    .bg-gray-100 {
        background-color: #f3f4f6;
    }
 
    .min-h-screen {
        min-height: 100vh;
    }
 
    /* 标题样式 */
    .text-2xl {
        font-size: 1.5rem;
        line-height: 2rem;
    }
 
    .font-bold {
        font-weight: 700;
    }
 
    .mb-4 {
        margin-bottom: 1rem;
    }
 
    .text-center {
        text-align: center;
    }
 
    /* 列表间距 */
    .space-y-6 {
        margin-top: 1.5rem;
    }
 
    .relative {
        position: relative;
    }
 
    .bg-white {
        background-color: #ffffff;
    }
 
    .rounded-xl {
        border-radius: 0.75rem;
    }
 
    .shadow-md {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
 
    .p-4 {
        padding: 1rem;
    }
 
    .pt-6 {
        padding-top: 1.5rem;
    }
 
    .absolute {
        position: absolute;
    }
 
    .-top-3 {
        top: -0.75rem;
    }
 
    .-left-3 {
        left: -0.75rem;
    }
 
    .w-8 {
        width: 2rem;
    }
 
    .h-8 {
        height: 2rem;
    }
 
    .bg-blue-500 {
        background-color: #3b82f6;
    }
 
    .text-white {
        color: #ffffff;
    }
 
    .text-center {
        text-align: center;
    }
 
    .leading-8 {
        line-height: 2rem;
    }
 
    .rounded-full {
        border-radius: 9999px;
    }
 
    .font-semibold {
        font-weight: 600;
    }
 
    .shadow {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
 
    /* 时间与内容样式 */
    .text-sm {
        font-size: 0.875rem;
        line-height: 1.25rem;
    }
 
    .text-gray-500 {
        color: #6b7280;
    }
 
    .mb-1 {
        margin-bottom: 0.25rem;
    }
 
    .text-base {
        font-size: 1rem;
        line-height: 1.5rem;
    }
 
    .text-gray-800 {
        color: #1f2937;
    }
 
    .leading-snug {
        line-height: 1.375;
    }
 
    /* 回复样式 */
    .text-gray-600 {
        color: #4b5563;
    }
 
    .mt-2 {
        margin-top: 0.5rem;
    }
 
    .text-gray-700 {
        color: #374151;
    }
 
    .text-gray-400 {
        color: #9ca3af;
    }
 
    /* 空提示 */
    .mt-10 {
        margin-top: 2.5rem;
    }
 
    .text-center {
        text-align: center;
    }
 
    .text-color-time {
        color: #6B7280;
    }
 
    .text-color-question {
        color: #0F172A;
    }
 
    .text-color-status-0 {
        color: #AAAAFF;
    }
 
    .text-color-status-1 {
        color: #AAAA00;
    }
 
    .text-color-status-2 {
        color: #00FF00;
    }
 
    .text-color-reply {
        color: #3B82F6;
    }
 
    .text-color-reply-none {
        color: #9CA3AF;
    }
 
    .page-wrapper {
        position: relative;
        min-height: 100vh;
        /* 确保小内容时填满视口 */
        overflow: hidden;
    }
 
    /* 顶部背景 */
    .bg-top {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 500rpx;
        /* 可用固定像素或图片高度 */
        background: url('https://farm.evcc.top/Uploads/yuanboyuan/background/bg_top.jpg') no-repeat top center;
        background-size: cover;
        z-index: 0;
    }
 
    /* 底部背景 */
    .bg-bottom {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 500rpx;
        /* 可用固定像素或图片高度 */
        background: url('https://farm.evcc.top/Uploads/yuanboyuan/background/bg_bottom.jpg') no-repeat bottom center;
        background-size: cover;
        z-index: 0;
    }
 
    /* 内容层 */
    .content-wrapper {
        position: relative;
        z-index: 1;
        padding: 2rem 1rem;
    }
</style>