complaint.vue
4.92 KB
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
<template>
<view class="page">
<view class="item">
<view class="contents">
<view class="add-list">
<view class="list">
<view class="title">
<text style="font-weight: bold;">投诉类型</text>
<!-- <text class="star">*</text> -->
</view>
<view class="content" @click="chooseLocation(1)" style="width: 25%;">
<u-input v-model="ruleForm.complaintType" type="select" disabledColor="#ffffff"
placeholder="请选择" :border="false" suffixIcon="arrow-right" style="pointer-events:none">
</u-input>
</view>
</view>
<view class="list">
<view class="title">
<text style="font-weight: bold;">问题描述</text>
<!-- <text class="star">*</text> -->
</view>
<view class="content">
<input type="text" placeholder="请输入" v-model="ruleForm.problemDescription">
</view>
</view>
</view>
</view>
</view>
<view class="item">
<view class="contents" style="background-color:#fff;padding:10px 20px;">
<view class="feedback-data">
<view >
<view class="title">
<text style="font-weight: bold;">现场照片</text>
<!-- <text class="star">*</text> -->
</view>
</view>
<view class="voucher-img">
<view class="voucher-list">
<!-- <image :src="$imgUrl('/voucher_bg.png')" ></image> -->
<u-upload :action="$upload" :auto-upload="true" ref="uUpload" ></u-upload>
</view>
</view>
</view>
</view>
</view>
<view class="item">
<view class="contents" style="background-color:#fff;padding:10px 20px;">
<view class="feedback-data">
<view>
<view class="title">
<text style="font-weight: bold;">备注信息</text>
<!-- <text class="star">*</text> -->
</view>
</view>
<view class="voucher-img">
<view class="voucher-list" style="width: 100%;">
<view class="" style="background-color: #F0F0F0;border-radius: 20rpx;">
<textarea name="" id="" cols="30" rows="10" placeholder="请输入" style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding: 20rpx 0;" v-model="ruleForm.remark"></textarea>
</view>
</view>
</view>
</view>
</view>
</view>
<u-select v-model="popup1" mode="mutil-column-auto" :list="list" @confirm="pops" label-name="label" value-name="value"></u-select>
<!-- 保存按钮 -->
<view class="page-footer">
<view class="footer-buy">
<view class="cart-add" @click="submit">
<text>提交</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
fileList:[],
ruleForm:{
onSitePhoto:'',
complaintType:'',
problemDescription:'',
remark:'',
applicationTime:'',
status:'1'
},
list: [{
value: '物业投诉',
label: '物业投诉'
},
{
value: '违规投诉',
label: '违规投诉'
}
],
popup1:false
}
},
methods:{
chooseLocation(val, item) {
this.popup1 = true
},
pops(val) {
this.ruleForm.complaintType = val[0].label
},
submit() {
let files = []
// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
// 如果您不需要进行太多的处理,直接如下即可
// files = this.$refs.uUpload.lists;
files.map(item=>{
this.ruleForm.onSitePhoto = item.response.data.url
})
this.ruleForm.applicationTime = this.currentTime()
this.ruleForm.applicant = uni.getStorageSync('shopId')
this.$http.sendRequest('/cereComplaintsSuggestions/add', 'POST',this.ruleForm,1).then(res => {
uni.navigateTo({
url: '/pages/serve/serve'
})
}).catch(err => {
console.log(err)
//请求失败
})
},
// 获取时间
currentTime() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1; // 月份从0~11,所以加一
let day = date.getDate();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
// 为月、日、时、分、秒添加前导零(如果需要)
month = month < 10 ? '0' + month : month;
day = day < 10 ? '0' + day : day;
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
// 拼接日期和时间字符串
let strDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
return strDate;
},
}
}
</script>
<style scoped lang="scss">
@import 'complaint.scss';
</style>