陶杰
2025-01-19 87a56274d598af9842b593ec972f517161f60707
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
<template>
    <view class="follow-page">
        <no-data v-if="!list||list.length===0" style="width: 100%;"></no-data>
 
        <view v-else style="min-height: 80vh;" class="p20">
            <view class="follow-item m-b-40 flex" v-for="(item,index) of list" :key="index">
                <view class="info">
                    <view class="name">投诉反馈类型:{{ item.typeStr || item.type  || '-'}}</view>                    
                    <view class="name">投诉反馈内容:{{ item.feedBack  || '-'}}</view>
                    <view class="name">提交时间:{{ item.createTime || '-' }}</view>
                </view>
                <view class="line-gray"></view>
                <view class="info">
                    <view class="name">回复内容:{{ item.reply  || '-'}}</view>
                    <view class="name">回复时间:{{ item.replyTime || '-' }}</view>
                </view>
                <view class="line-gray"></view>
                <view class="component-buttons">
                    <view class="button-1" @click="toDetail(item)">查看详情</view>
                </view>
            </view>
        </view>
        <footer-msg :more="page.total>0&&page.total>page.current*page.size&&list.length>0"></footer-msg>
 
        <view style="min-height:160rpx">
        </view>
 
        <view class="button-green-1 m-t-20 button-fixed-bottom " @click="addFeedback">
            提交投诉/反馈
        </view>
 
 
        <uni-popup ref="popup" type="bottom">
            <view class="component-popup_input_all">
 
 
                <view class="close-parent">
                    填写投诉/反馈内容
                    <uni-icons class="close" type="closeempty" @click="$refs.popup.close()"></uni-icons>
                </view>
 
                <view class="submit form">
                    <view class="form-item" style="height: unset;">
                        <view class="form-item-label require" style="min-width: 120rpx;margin-right: 10rpx;">
                            类型
                        </view>
                        <view class="form-item-value flex value-items">
                            <view class="value-item" @click="()=>{
                                    if(submitForm.type!==each.value){
                                        submitForm.type = each.value
                                    }                                                                                                                                                        
                                }" :class="[submitForm.type==each.value?'cur':'']" v-for="(each, j) in type_columns" :key="j">
                                {{ each.label || '-' }}
                            </view>
                        </view>
                    </view>
 
                    <view class="form-item">
                        <view class="form-item-label require">
                            内容
                        </view>
                        <view class="form-item-value">
                            <input v-model="submitForm.feedBack" placeholder="填写投诉/反馈内容" class="form-input"></input>
                        </view>
                    </view>
                    <view class="form-item">
                        <view class="form-item-label require">
                            图片
                        </view>
                        <view class="form-item-value m-l-a m-r-0">
                            <view class="t-red" @click="uploadCheckImage()">上传</view>
                        </view>
                    </view>
                    <view class="flex p20" v-if="submitForm.pictures&&submitForm.pictures.length>0">
                        <view class="m-t-12 m-r-10 " v-for="(timg,index) of submitForm.pictures" :key="index">
                            <image class="check-img" :src="timg" @click.stop="previewImg(timg)">
                            </image>
                            <view class="t-red text-center" @click.stop="deleteCheckImage(index)">删除</view>
                        </view>
                    </view>
                </view>
 
                <!-- <view class="line-gray"></view> -->
 
                <view class="component-buttons m-t-20" style="width: unset;">
                    <view class="button-1 m-auto" @click="$refs.popup.close()">关闭</view>
                    <view class="button-0 m-auto" @click="submit">提交</view>
                </view>
            </view>
 
        </uni-popup>
 
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                submitForm: {},
                type_columns: [],
            }
        },
        async onPullDownRefresh() {
            await this.refreshList()
            uni.stopPullDownRefresh()
        },
        async onShow() {
 
        },
        async onLoad() {
            this.listApi = '/api/feedback/my/feedback/list'
            this.getList()
            this.$http.request('get', '/api/code/value', {
                params: {
                    type: 'feedback_type'
                }
            }).then(res => {
                var data = res.data
                this.type_columns = data || []
 
            })
        },
        methods: {
            toDetail(item) {
                uni.navigateTo({
                    url: `/sub_pages/customer/self/feedback-detail?id=${item.id}`
                })
            },
            async deleteCheckImage(index) {
                await this.$message.confirm('确定删除吗')
                this.submitForm.pictures.splice(index, 1)
            },
            uploadCheckImage() {
                let that = this
                uni.chooseImage({
                    count: 1, // 最多可以选择的图片张数,默认9
                    sizeType: ['compressed'], //original 原图,compressed 压缩图,默认二者都有
                    sourceType: ['camera', 'album'], //album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项
                    success: function(res) {
                        let errMsg = res.errMsg
                        let tempFiles = res.tempFiles
                        if (errMsg === 'chooseImage:ok') {
                            if (tempFiles[0].size > 1024 * 1024 * 5) {
                                that.$message.confirm('图片最多支持5M大小,超出大小限制')
                                return
                            }
                            that.$message.showLoading()
                            that.$http.upload(tempFiles[0].path).then(async res => {
                                console.log('res1', res)
                                var pic = res.data && res.data.length > 0 && res.data[
                                        0]
                                    .url || ''
                                that.$message.hideLoading()
                                that.submitForm.pictures.push(pic)
                                that.$forceUpdate()
                            }).catch(res => {
                                that.$message.hideLoading()
                                console.error(res)
                                that.$message.showToast('文件上传失败,请联系管理员')
                            })
                        }
                    }
                })
            },
            async addFeedback() {
                this.submitForm = {
                    feedBack: '',
                    type: '',
                    pictures: [],
                }
                this.$refs.popup.open()
 
                // const res = await this.$message.confirm('', {
                //     editable: true,
                //     title: '请填写投诉/反馈内容'
                // })
                // if (res.content && res.confirm) {
                //     // 发送请求
                //     if (!res.content) {
                //         this.$message.showToast('未填写内容')
                //     } else {
                //         this.$message.showLoading()
                //         const {
                //             code
                //         } = await this.$http.request('post', '', {
                //             data: {
                //                 feedBack: res.content
                //             }
                //         })
                //         this.$message.hideLoading()
                //         if (code == 0) {
                //             await this.refreshList()
                //             this.$message.showToast('提交成功')
                //         }
                //     }
 
 
                // } else {
 
                // }
            },
            
            async submit() {
                console.log('submitForm',this.submitForm)
                if (!this.submitForm.type) {
                    this.$message.showToast('未选择类型')
                    return
                }
                if (!this.submitForm.feedBack) {
                    this.$message.showToast('未填写内容')
                    return
                }
                this.$message.showLoading()
                const {
                    code
                } = await this.$http.request('post', '/api/feedback/page/new', {
                    data: {
                        feedBack: this.submitForm.feedBack,
                        type: this.submitForm.type,
                        pictures: JSON.stringify(this.submitForm.pictures)
                    }
                })
                this.$message.hideLoading()
                if (code == 0) {
                    this.$refs.popup.close()
                    await this.refreshList()
                    this.$message.showToast('提交成功')
                }
            }
 
        }
    }
</script>
 
<style lang="scss" scoped>
    .follow-page {
        min-height: 99vh;
 
        .follow-item {
            padding: 30rpx;
            background-color: #FFFFFF;
            margin-bottom: 20rpx;
 
 
            .info {
                .name {
                    font-weight: 400;
                    font-size: 24rpx;
                    color: #000000;
                    line-height: 40rpx;
                    margin-top: 6rpx;
                }
 
                .time {
                    font-weight: 400;
                    font-size: 24rpx;
                    color: #a3a3a3;
                    line-height: 40rpx;
                    margin-top: 6rpx;
                }
 
            }
 
            .button {
                padding: 14rpx 36rpx;
                text-align: center;
                margin-left: 10rpx;
                font-weight: 400;
                font-size: 24rpx;
                line-height: 30rpx;
                border-radius: 34rpx;
                margin-top: 10rpx;
 
 
                // min-width: 128rpx;
                height: 30rpx;
 
 
            }
 
            .button-1 {
                color: #999999;
                border: 2rpx solid #999999;
 
            }
 
            .button-2 {
                border: 2rpx solid #20613D;
                color: #20613D;
            }
        }
    }
    .component-popup_input_all{
        .check-img {
            width: 96rpx;
            height: 96rpx;
            border-radius: 4rpx;
            border: 2rpx dashed #CECECE;
        }
    }
</style>