Blame view

lvdao-miniapp/pages/complaint/complaint.vue 6.33 KB
3f535f30   杨鑫   '初始'
1
2
  <template>
  	<view class="page">
e5b57447   杨鑫   '分包问卷'
3
4
5
6
7
  		<view class="item">
  			<view class="contents">
  				<view class="add-list">
  					<view class="list">
  						<view class="title">
0fd8b750   杨鑫   '最新落地1'
8
  							<text style="font-weight: bold;">*投诉类型</text>
e5b57447   杨鑫   '分包问卷'
9
10
11
12
13
14
15
16
17
18
  							<!-- <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">
0fd8b750   杨鑫   '最新落地1'
19
  							<text style="font-weight: bold;">*问题描述</text>
e5b57447   杨鑫   '分包问卷'
20
21
22
23
24
25
26
  							<!-- <text class="star">*</text> -->
  						</view>
  						<view class="content">
  							<input type="text" placeholder="请输入" v-model="ruleForm.problemDescription">
  						</view>
  					</view>
  					
3f535f30   杨鑫   '初始'
27
28
  				</view>
  			</view>
e5b57447   杨鑫   '分包问卷'
29
30
31
32
33
34
35
  		</view>
  		
  		<view class="item">
  			<view class="contents"  style="background-color:#fff;padding:10px 20px;">
  				<view class="feedback-data">
  					<view >
  						<view class="title">
0fd8b750   杨鑫   '最新落地1'
36
  							<text style="font-weight: bold;">*现场照片</text>
e5b57447   杨鑫   '分包问卷'
37
38
39
40
41
  							<!-- <text class="star">*</text> -->
  						</view>
  					</view>
  					<view class="voucher-img">
  						<view class="voucher-list">
0fd8b750   杨鑫   '最新落地1'
42
43
  							<u-upload :action="$upload" :auto-upload="false" ref="uUpload" :max-count="5"
  								@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'uUpload')"></u-upload>
e5b57447   杨鑫   '分包问卷'
44
45
  						</view>
  					</view>
3f535f30   杨鑫   '初始'
46
47
  				</view>
  			</view>
e5b57447   杨鑫   '分包问卷'
48
49
50
51
52
53
54
  		</view>
  		
  		<view class="item">
  			<view class="contents"  style="background-color:#fff;padding:10px 20px;">
  				<view class="feedback-data">
  					<view>
  						<view class="title">
0fd8b750   杨鑫   '最新落地1'
55
  							<text style="font-weight: bold;">*备注信息</text>
e5b57447   杨鑫   '分包问卷'
56
57
  							<!-- <text class="star">*</text> -->
  						</view>
3f535f30   杨鑫   '初始'
58
  					</view>
e5b57447   杨鑫   '分包问卷'
59
60
61
  					<view class="voucher-img">
  						<view class="voucher-list" style="width: 100%;">
  							<view class="" style="background-color: #F0F0F0;border-radius: 20rpx;">
0fd8b750   杨鑫   '最新落地1'
62
  								<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;" v-model="ruleForm.remark"></textarea>
e5b57447   杨鑫   '分包问卷'
63
64
  							</view>
  						</view>
3f535f30   杨鑫   '初始'
65
66
67
68
  					</view>
  				</view>
  			</view>
  		</view>
e5b57447   杨鑫   '分包问卷'
69
  			<u-select v-model="popup1" mode="mutil-column-auto" :list="list" @confirm="pops" label-name="label" value-name="value"></u-select>
3f535f30   杨鑫   '初始'
70
  		<!-- 保存按钮 -->
e3789a75   杨鑫   '最新'
71
72
73
74
  		
  		<!-- <view class="page-footer">
  			<u-button type="success" style="flex: 1; margin: 0 10px;" >提交</u-button>
  		</view> -->
3f535f30   杨鑫   '初始'
75
  		<view class="page-footer">
e3789a75   杨鑫   '最新'
76
77
78
  			<view class="footer-btn">
  				<u-button type="success" style="width: 100%;border-radius: 10px;" @click="submit">提交</u-button>
  			</view>
3f535f30   杨鑫   '初始'
79
80
81
82
83
84
85
86
  		</view>
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
e5b57447   杨鑫   '分包问卷'
87
88
  				fileList:[],
  				ruleForm:{
0fd8b750   杨鑫   '最新落地1'
89
90
  					onSitePhoto:[],
  				
e5b57447   杨鑫   '分包问卷'
91
92
93
94
95
96
97
98
99
100
101
102
103
  					status:'1'
  				},
  				list: [{
  						value: '物业投诉',
  						label: '物业投诉'
  					},
  					{
  						value: '违规投诉',
  						label: '违规投诉'
  					}
  				],
  				popup1:false
  			}
3f535f30   杨鑫   '初始'
104
105
  		},
  		methods:{
e5b57447   杨鑫   '分包问卷'
106
107
108
109
110
111
112
  			chooseLocation(val, item) {
  				this.popup1 = true
  			},
  			pops(val) {
  				this.ruleForm.complaintType =  val[0].label
  
  			},
0fd8b750   杨鑫   '最新落地1'
113
  			check(){
e3789a75   杨鑫   '最新'
114
115
  						
  						if (!this.ruleForm.complaintType) {
0fd8b750   杨鑫   '最新落地1'
116
117
  							uni.showToast({
  								icon: 'none',
e3789a75   杨鑫   '最新'
118
  								title: '请选择投诉类型'
0fd8b750   杨鑫   '最新落地1'
119
120
121
  							});
  							return false;
  						}
e3789a75   杨鑫   '最新'
122
  						if (!this.ruleForm.problemDescription) {
0fd8b750   杨鑫   '最新落地1'
123
124
  							uni.showToast({
  								icon: 'none',
e3789a75   杨鑫   '最新'
125
  								title: '请输入问题描述'
0fd8b750   杨鑫   '最新落地1'
126
127
128
  							});
  							return false;
  						}
e3789a75   杨鑫   '最新'
129
  						if (this.ruleForm.onSitePhoto.length== 0) {
0fd8b750   杨鑫   '最新落地1'
130
131
  							uni.showToast({
  								icon: 'none',
e3789a75   杨鑫   '最新'
132
  								title: '请上传现场图片'
0fd8b750   杨鑫   '最新落地1'
133
134
135
136
137
138
139
140
141
142
143
144
145
  							});
  							return false;
  						}
  						if (!this.ruleForm.remark) {
  							uni.showToast({
  								icon: 'none',
  								title: '请输入备注信息'
  							});
  							return false;
  						}
  				
  					return true;
  			},
e5b57447   杨鑫   '分包问卷'
146
  			submit() {
0fd8b750   杨鑫   '最新落地1'
147
148
149
150
151
152
  				let show = this.check()
  					if(show == false){
  						return
  					}
  				this.ruleForm.applicationTime = this.currentTime()
  				this.ruleForm.createUser = uni.getStorageSync('user').phone
45318813   杨鑫   '最新版本'
153
154
  		this.ruleForm.onSitePhoto = this.ruleForm.onSitePhoto.map(item=>{
  					 return item.replace(this.$img,'');
0fd8b750   杨鑫   '最新落地1'
155
  				})
45318813   杨鑫   '最新版本'
156
  				
0fd8b750   杨鑫   '最新落地1'
157
158
159
160
  						let info = {
  							...this.ruleForm,
  							onSitePhoto:this.ruleForm.onSitePhoto.join(','),
  						}
45318813   杨鑫   '最新版本'
161
  			
0fd8b750   杨鑫   '最新落地1'
162
  							this.$http.sendRequest('/cereComplaintsSuggestions/add', 'POST',info,1).then(res => {
e5b57447   杨鑫   '分包问卷'
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
  								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;
  						},
0fd8b750   杨鑫   '最新落地1'
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
  						onsuccess1(e, file, fileList, ziduan) {
  							console.error(e, file, fileList, ziduan)
  							uni.uploadFile({
  								url: this.$upload, // 仅为示例,请替换为您的服务器上传接口
  								filePath: e[0].url,
  								name: 'file', // 后端接收的文件参数名
  								formData: {
  									filePath: 'xcx', // 其他表单数据
  								},
  								success: (uploadFileRes) => {
  										this.ruleForm.onSitePhoto.push(this.$img + JSON.parse(uploadFileRes.data).data)
  									uni.showToast({
  										title: '上传成功',
  										icon: 'success',
  									});
  								},
  								fail: (err) => {
  									console.error('上传失败', err);
  									uni.showToast({
  										title: '上传失败',
  										icon: 'none',
  									});
  								},
  							});
  						},
3f535f30   杨鑫   '初始'
218
219
220
221
222
223
224
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'complaint.scss';
  </style>