addMyshop.vue
9.02 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
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
350
351
352
353
354
355
356
357
358
359
360
361
<template>
<view class="page">
<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">
<u-upload :action="$upload" :auto-upload="false" ref="coverImage" :max-count="5"
@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'coverImage')"></u-upload>
</view>
</view>
</view>
</view>
</view>
<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">
<input type="text" placeholder="请输入" v-model="ruleForm.deviceName">
</view>
</view>
<view class="item">
<view class="contents" style="background-color:#fff;">
<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;padding:10px;" v-model="ruleForm.memo"></textarea>
</view>
</view>
</view>
</view>
</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.deviceName">
</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;padding:10px;" v-model="ruleForm.memo"></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>
<u-select v-model="popup2" mode="mutil-column-auto" :list="list1" @confirm="pops1" label-name="label" value-name="value"></u-select>
<!-- 保存按钮 -->
<view class="page-footer">
<u-button type="success" style="width: 100%;border-radius: 10px;" @click="submit">提交</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
fileList:[],
ruleForm:{
onSitePhoto:'',
deviceName:'',
deviceType:'',
warrantyIssue:'',
memo:'',
applicationTime:'',
enterpriseAuthorization:[],
status:'1'
},
lableXian:'',
shelei:'',
list: [{
value: '水管问题',
label: '水管问题'
},
{
value: '物业问题',
label: '物业问题'
}
],
list1: [{
value: '类型1',
label: '类型1'
},
{
value: '类型2',
label: '类型2'
}
],
popup1:false,
popup2:false
}
},
methods:{
chooseLocation(val, item) {
this.popup1 = true
},
choose(val, item) {
this.popup2 = true
},
pops(val) {
this.ruleForm.warrantyIssue = val[0].label
},
pops1(val) {
this.ruleForm.deviceType = val[0].label
},
check(){
if (this.ruleForm.onSitePhoto.length== 0) {
uni.showToast({
icon: 'none',
title: '请上传现场图片'
});
return false;
}
if (!this.ruleForm.complaintType) {
uni.showToast({
icon: 'none',
title: '请选择投诉类型'
});
return false;
}
if (!this.ruleForm.problemDescription) {
uni.showToast({
icon: 'none',
title: '请输入问题描述'
});
return false;
}
if (!this.ruleForm.remark) {
uni.showToast({
icon: 'none',
title: '请输入备注信息'
});
return false;
}
return true;
},
submit() {
let show = this.check()
if(show == false){
return
}
this.ruleForm.enterpriseAuthorization.map(item=>{
item.replace(this.$img,'')
})
this.ruleForm.applicationTime = this.currentTime()
let info = {
...this.ruleForm,
enterpriseAuthorization:this.ruleForm.enterpriseAuthorization.join(','),
}
this.$http.sendRequest('/cereReportIssuesRepairs/add', 'POST',info,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;
},
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.enterpriseAuthorization.push(this.$img + JSON.parse(uploadFileRes.data).data)
uni.showToast({
title: '上传成功',
icon: 'success',
});
},
fail: (err) => {
console.error('上传失败', err);
uni.showToast({
title: '上传失败',
icon: 'none',
});
},
});
},
}
}
</script>
<style scoped lang="scss">
.page{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #f6f6f6;
}
.add-list{
padding: 0 4%;
background-color: #FFFFFF;
border-radius: 20rpx;
margin-top: 20rpx;
width: 100%;
.list{
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: 100rpx;
border-bottom: 2rpx solid #f6f6f6;
.title{
display: flex;
align-items: center;
height: 100%;
text{
font-size: 26rpx;
color: #222222;
}
.star{
color: red;
}
}
.content{
display: flex;
align-items: center;
text-align: right;
input{
width: 100%;
color: #222222;
font-size: 26rpx;
padding-top: 6rpx;
/* #ifdef MP */
padding-top: 5rpx;
/* #endif */
}
image {
width: 20rpx;
height: 20rpx;
margin-left: 10rpx;
/* #ifdef MP */
margin-top: 5rpx;
/* #endif */
}
}
}
}
/* 保存按钮 */
.page-footer{
position: fixed;
left: 0;
bottom: 0;
display: flex;
z-index: 999;
width: 100%;
height: 100rpx;
background-color: #FFFFFF;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
padding: 0 20px;
}
.feedback-data{
width: 100%;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #f6f6f6;
.title{
display: flex;
align-items: center;
height: 100rpx;
text{
font-size: 26rpx;
color: #222222;
}
.star{
color: red;
}
}
.voucher-img{
display: flex;
align-items: center;
.voucher-list {
width: 33%;
height: 100%;
image{
width: 160rpx;
height: 160rpx;
border-radius: 10rpx;
}
}
}
}
</style>