advertisementAdd.vue
21.8 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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
<template>
<view class="page">
<view class="steps-box">
<u-steps :list="numList" :current="active"></u-steps>
</view>
<view>
<view v-show="active == 0">
<view style="padding:15px;margin-top:10px;">
<!-- :endDate="endDate" -->
<wu-calendar :insert="true" @change="calendarChange" slideSwitchMode="horizontal" mode="range" :selected="selected" color="#3f9b6a" style="border-radius: 10px;" :data="today" :startDate="startDate" ></wu-calendar>
</view>
<u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250">
<view class="add-list">
<u-form-item :required="true" label="投放时段" prop="scheduleTime" borderBottom>
<u-input v-model="model1.scheduleTime" type="select" placeholder="请选择上面时间" ></u-input>
<!-- <u-input v-model="model1.scheduleTime" type="select" @click="TimeStratshow = true"
placeholder="请选择" /> -->
<!-- <u-picker mode="time" v-model="TimeStratshow" :params="params"
@confirm="startTimeChange"></u-picker> -->
</u-form-item>
</view>
<view class="add-list">
<!-- <u-form-item :required="true" label="跳转类型" prop="advertisementContent" borderBottom>
<u-input v-model="model1.advertisementContent"></u-input>
</u-form-item> -->
<u-form-item :required="true" label="跳转链接" prop="redirectUrl" borderBottom>
<u-input v-model="model1.redirectUrl"></u-input>
</u-form-item>
</view>
<view class="add-list">
<u-form-item :required="true" label="封面图片" prop="coverImage" borderBottom labelPosition="top">
<u-upload :action="$upload" :auto-upload="false" ref="coverImage" :max-count="1"
@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'coverImage')"></u-upload>
</u-form-item>
<!-- <u-form-item label="封面图片" prop="coverImage" borderBottom labelPosition="top">
<u-upload :action="$upload" :auto-upload="true" ref="coverImage" :max-count="1"></u-upload>
</u-form-item> -->
</view>
<!-- <view class="add-list">
<u-form-item :required="true" label="广告标题" prop="adTitle" borderBottom labelPosition="top">
<u-input v-model="model1.adTitle" />
</u-form-item>
</view> -->
</u-form>
</view>
<view class="add-list" v-show='active == 1'>
<u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250">
<u-form-item :required="true" label="主体名称" prop="subjectName" borderBottom>
<u-input v-model="model1.subjectName"></u-input>
</u-form-item>
<u-form-item :required="true" label="统一社会信用代码" prop="unifiedSocialCreditCode" borderBottom>
<u-input v-model="model1.unifiedSocialCreditCode"></u-input>
</u-form-item>
<u-form-item :required="true" label="类型" prop="type" borderBottom>
<u-input v-model="model1.type" type="select" @click="typeShow = true" placeholder='请选择类型' />
</u-form-item>
<u-form-item :required="true" label="法定代表人" prop="legalRepresentative" borderBottom>
<u-input v-model="model1.legalRepresentative"></u-input>
</u-form-item>
<u-form-item :required="true" label="经营范围" prop="businessScope" borderBottom>
<u-input v-model="model1.businessScope" type="textarea"></u-input>
</u-form-item>
<u-form-item :required="true" label="注册资本" prop="registeredCapital" borderBottom>
<u-input v-model="model1.registeredCapital"></u-input>
</u-form-item>
<u-form-item :required="true" label="成立日期" prop="establishmentDate" borderBottom>
<!-- <u-input v-model="model1.establishmentDate"></u-input> -->
<u-input v-model="model1.establishmentDate" type="select" @click="establishow = true"
placeholder="请选择" />
<u-picker mode="time" v-model="establishow" :params="params"
@confirm="establiChange"></u-picker>
</u-form-item>
<u-form-item :required="true" label="住所" prop="address" borderBottom>
<u-input v-model="model1.address" type="textarea"></u-input>
</u-form-item>
<u-form-item :required="true" label="邮箱地址" prop="emailAddress" borderBottom>
<u-input v-model="model1.emailAddress"></u-input>
</u-form-item>
<u-form-item :required="true" label="经营开始时间" prop="businessStartDate" borderBottom>
<u-input v-model="model1.businessStartDate" type="select" @click="busStartshow = true"
placeholder="请选择" />
<u-picker mode="time" v-model="busStartshow" :params="params"
@confirm="busStTimeChange"></u-picker>
</u-form-item>
<u-form-item :required="true" label="经营结束时间" prop="businessEndDate" borderBottom>
<u-input v-model="model1.businessEndDate" type="select" @click="busEndtshow = true"
placeholder="请选择" />
<u-picker mode="time" v-model="busEndtshow" :params="params"
@confirm="busEndTimeChange"></u-picker>
</u-form-item>
<u-form-item :required="true" label="营业执照" prop="businessLicense" borderBottom labelPosition="top">
<u-upload :action="$upload" :auto-upload="false" ref="businessLicense" :max-count="1"
@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'businessLicense')"></u-upload>
<!-- <u-upload :action="$upload" :auto-upload="true" ref="businessLicense" :max-count="1"></u-upload> -->
</u-form-item>
</u-form>
</view>
<view v-show="active == 2">
<u-form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :labelWidth="250">
<view class="add-list">
<u-form-item :required="true" label="经营者姓名" prop="lesseeName" borderBottom>
<u-input v-model="model1.lesseeName"></u-input>
</u-form-item>
<u-form-item :required="true" label="证件类型" prop="idCardType" borderBottom>
<u-input v-model="model1.idCardType" type="select" @click="IdtypeShow = true"
placeholder='请选择类型' />
</u-form-item>
<u-form-item :required="true" label="身份证号码" prop="idCardNumber" borderBottom>
<u-input v-model="model1.idCardNumber"></u-input>
</u-form-item>
<u-form-item :required="true" label="身份证有效开始时间" prop="idCardValidStart" borderBottom>
<u-input v-model="model1.idCardValidStart" type="select" @click="idCardStartshow = true"
placeholder="请选择" />
<u-picker mode="time" v-model="idCardStartshow" :params="params1"
@confirm="idCardStTimeChange"></u-picker>
</u-form-item>
<u-form-item :required="true" label="身份证有效结束时间" prop="idCardValidEnd" borderBottom>
<u-input v-model="model1.idCardValidEnd" type="select" @click="idCardEndtshow = true"
placeholder="请选择" />
<u-picker mode="time" v-model="idCardEndtshow" :params="params1"
@confirm="idCardEndTimeChange"></u-picker>
</u-form-item>
</view>
<view class="add-list">
<view class="deom-box">
<view class="img-deom">
<u-upload :action="$upload" :custom-btn="true"
@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'idCardPhotoFront')"
:auto-upload="false" :max-count="1" ref="idCardPhotoFront">
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover"
hover-stay-time="150">
<u-image width="304rpx" height="182rpx"
:src="$imgUrl('/uploadID1.png')"></u-image>
</view>
</u-upload>
<text>点击上传证件人像面</text>
</view>
<view class="img-deom">
<u-upload :action="$upload" :custom-btn="true"
@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'idCardPhotoBack')"
:auto-upload="false" :max-count="1" ref="idCardPhotoBack">
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover"
hover-stay-time="150">
<u-image width="304rpx" height="182rpx"
:src="$imgUrl('/uploadID2.png')"></u-image>
</view>
</u-upload>
<text>点击上传证件国徽面</text>
</view>
</view>
</view>
<view class="add-list">
<view style="line-height: 60rpx;">上传示例</view>
<view class="deom-box">
<view class="img-deom">
<u-image width="304rpx" height="182rpx" :src="$imgUrl('/front-icon.png')"></u-image>
<text>人脸示例图</text>
</view>
<view class="img-deom">
<u-image width="304rpx" height="182rpx" :src="$imgUrl('/back-icon.png')"></u-image>
<text>国徽面示例图</text>
</view>
</view>
</view>
<text
style="display: inline-block; font-size: 24rpx; line-height: 30px; margin: 24rpx 30rpx 0;">请拍摄证件原件,保证照片拍摄清晰,取图完整,不反光。</text>
<view class="add-list" labelPosition="left" :model="model1" :rules="rules" ref="uForm"
:labelWidth="250">
<u-form-item :required="true" label="是否为法人" prop="isLegalPerson" borderBottom>
<u-radio-group v-model="model1.isLegalPerson">
<u-radio name="1" value="1">是</u-radio>
<u-radio name="0" value="0">否</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item :required="true" label="企业授权书" prop="enterpriseAuthorization" borderBottom labelPosition="top">
<u-upload :action="$upload" :auto-upload="true" ref="enter" :max-count="1"></u-upload>
</u-form-item>
</view>
</u-form>
</view>
</view>
<u-select v-model="typeShow" :list="activesType" @confirm="typeChange"></u-select>
<u-select v-model="IdtypeShow" :list="idType" @confirm="IdtypeChange"></u-select>
<!-- 保存按钮 -->
<view class="page-footer">
<u-button style="background-color: #DFE0E4; flex: 1; margin: 0 10px;" @click="toBefor"
v-if="active != 0">上一步</u-button>
<u-button type="success" style="flex: 1; margin: 0 10px;" @click="toNext" v-if="active != 1">下一步</u-button>
<u-button type="success" style="flex: 1; margin: 0 10px;" @click="go" v-if="active == 1">提交申请</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
active: 0,
// numList: [{
// name: '租赁信息'
// }, {
// name: '主体信息'
// }, {
// name: '经营者信息'
// }],
numList: [{
name: '租赁信息'
}, {
name: '营业执照信息'
}],
model1: {
scheduleTime: '',
advertisementContent: '',
redirectUrl: '',
coverImage: '',
adTitle: '',
subjectName: '',
unifiedSocialCreditCode: '',
type: '',
legalRepresentative: '',
businessScope: '',
registeredCapital: '',
establishmentDate: '',
address: '',
emailAddress: '',
businessStartDate: '',
businessEndDate: '',
businessLicense: '',
lesseeName: '',
idCardType: '',
idCardNumber: '',
idCardValidStart: '',
idCardValidEnd: '',
isLegalPerson: '0',
idCardPhotoFront:'',
idCardPhotoBack:'',
enterpriseAuthorization: '',
auditStatus: '1'
},
rules: {},
// 类型
showType: false,
params: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true
},
params1: {
year: true,
month: true,
day: true
},
TimeStratshow: false,
typeShow: false,
activesType: [{
value: 1,
label: '个人'
}, {
value: 2,
label: '企业'
}],
idType: [{
value: 1,
label: '身份证'
}, ],
IdtypeShow: false,
busStartshow: false,
busEndtshow: false,
idCardStartshow: false,
idCardEndtshow: false,
params: {
year: true,
month: true,
day: true,
},
ziyuanId: '',
ziyuanType:'',
selected: [
],
establishow:false,
today:['',''],
startDate:'',
endDate:''
}
},
onLoad(option) {
this.ziyuanId = option.ids
this.ziyuanType = option.type
this.showlendar = true
},
onReady() {
},
onShow() {
this.calculateDates()
let pageHe={
pageNumber: 0,
pageSize: 10,
shopNumber:`gg${this.ziyuanId}`,
dataStatus:1
}
this.$http.sendRequest('/cereContractInformation/getPage', 'POST', pageHe,1).then(res => {
if(res.data.data.content.length !=0){
res.data.data.content.map(item=>{
this.generateDateRange([item.contractTerminationDate,item.leaseStartDate])
})
}
})
},
methods: {
generateDateRange(datas) {
const result = [];
const startDate = new Date(datas[0])
const endDate = new Date(datas[1])
if (startDate > endDate) {
[startDate, endDate] = [endDate, startDate]
}
let currentDate = new Date(startDate);
while (currentDate <= endDate) {
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(1, '0');
const day = String(currentDate.getDate()).padStart(1, '0');
const dateString = `${year}-${month}-${day}`;
this.selected.push({
date: dateString,
info: '已租',
disable: true
});
currentDate.setDate(currentDate.getDate() + 1);
}
console.log( this.selected)
return result;
},
calendarChange(e){
if(e.range.after == ''){
uni.showToast({
icon: 'none',
title: '请选择结束时间'
})
return
}
this.model1.scheduleTime =e.range.before+'至'+e.range.after
},
typeChange(e) {
this.model1.type = e[0].label;
},
establiChange(val){
this.model1.establishmentDate = this.timeChange(val)
},
calculateDates() {
const today = new Date();
const year = today.getFullYear();
const month = today.getMonth();
this.startDate = this.formatDate(today);
// 获取后一个月的最后一天
const nextMonthLastDay = new Date(year, month + 2, 0);
this.endDate = this.formatDate(nextMonthLastDay);
},
formatDate(date) {
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份是从0开始的
const day = ('0' + date.getDate()).slice(-2);
return `${year}-${month}-${day}`;
},
formatter(day) {
const d = new Date()
let month = d.getMonth() + 1
const date = d.getDate()
if(day.month == month && day.day == date + 3)
{
day.bottomInfo = '有优惠'
day.dot = true
}
return day
},
getCurrentTime() {
const now = new Date();
const year = now.getFullYear();
const month = ('0' + (now.getMonth() + 1)).slice(-2);
const day = ('0' + now.getDate()).slice(-2);
const hours = ('0' + now.getHours()).slice(-2);
const minutes = ('0' + now.getMinutes()).slice(-2);
const seconds = ('0' + now.getSeconds()).slice(-2);
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
go() {
let show = this.chek()
if(show == false){
return
}
this.model1.rentalResourcesId = this.ziyuanId
this.model1.advertisingSpaceType = this.ziyuanType
this.model1.applicant =uni.getStorageSync('user').phone
this.model1.applicationTime = this.getCurrentTime()
let info = {
...this.model1,
coverImage : this.model1.coverImage.replace(this.$img,''),
businessLicense:this.model1.businessLicense.replace(this.$img,''),
// idPhotoFront:this.model1.idPhotoFront.replace(this.$img,''),
// idPhotoBack:this.model1.idPhotoBack.replace(this.$img,''),
// enterpriseAuthorization:this.model1.enterpriseAuthorization.replace(this.$img,''),
}
this.$http.sendRequest('/cereAdvertiserInfo/add', 'POST', info, 1).then(res => {
uni.showToast({
title: '提交成功',
icon: 'none',
});
setTimeout(() => {
uni.navigateBack()
}, 1000)
})
},
// toChangeTime(val) {
// uni.navigateTo({
// url: `/pages/advertisementTime/advertisementTime?val=${val}`
// })
// },
// 上一步
toBefor() {
this.active = +this.active - 1;
},
// 下一步
toNext() {
if(this.active == '0') {
if (!this.model1.scheduleTime) {
uni.showToast({
icon: 'none',
title: '请选择投放时段'
});
return;
}
// if (!this.model1.advertisementContent) {
// uni.showToast({
// icon: 'none',
// title: '请输入跳转类型'
// });
// return;
// }
if (!this.model1.redirectUrl) {
uni.showToast({
icon: 'none',
title: '请输入跳转链接'
});
return;
}
if (!this.model1.coverImage) {
uni.showToast({
icon: 'none',
title: '请选择封面图片'
});
return;
}
// if (!this.model1.adTitle) {
// uni.showToast({
// icon: 'none',
// title: '请输入广告标题'
// });
// return;
// }
}
this.active = +this.active + 1;
},
chek() {
if (!this.model1.subjectName) {
uni.showToast({
icon: 'none',
title: '请输入主体名称'
});
return false;
}
if (!this.model1.unifiedSocialCreditCode) {
uni.showToast({
icon: 'none',
title: '请输入统一社会信用代码'
});
return false;
}
if (!this.model1.type) {
uni.showToast({
icon: 'none',
title: '请选择主体类型'
});
return false;
}
if (!this.model1.legalRepresentative) {
uni.showToast({
icon: 'none',
title: '请输入法定代表人'
});
return false;
}
if (!this.model1.businessScope) {
uni.showToast({
icon: 'none',
title: '请输入经营范围'
});
return false;
}
if (!this.model1.registeredCapital) {
uni.showToast({
icon: 'none',
title: '请输入注册资本'
});
return false;
}
if (!this.model1.establishmentDate) {
uni.showToast({
icon: 'none',
title: '请输入成立日期'
});
return false;
}
if (!this.model1.address) {
uni.showToast({
icon: 'none',
title: '请输入住所'
});
return false;
}
if (!this.model1.emailAddress) {
uni.showToast({
icon: 'none',
title: '请输入邮箱地址'
});
return false;
}
if (!this.model1.businessStartDate) {
uni.showToast({
icon: 'none',
title: '请选择经营开始时间'
});
return false;
}
if (!this.model1.businessEndDate) {
uni.showToast({
icon: 'none',
title: '请选择经营结束时间'
});
return false;
}
if (!this.model1.businessLicense) {
uni.showToast({
icon: 'none',
title: '请上传营业执照'
});
return false;
}
return true;
},
startTimeChange(val) {
this.model1.scheduleTime = this.timeChange(val)
},
timeChange(val) {
const {
year,
month,
day,
} = val;
return `${year}-${month}-${day}`;
},
leiXpops(val) {
this.model1.intentionalBusinessType = val[0].label
},
busStTimeChange(val) {
this.model1.businessStartDate = this.timeChange(val)
this.model1.businessEndDate = ''
},
busEndTimeChange(val) {
const time = this.timeChange(val);
if (new Date(time).getTime() > new Date(this.model1.businessStartDate).getTime()) {
this.model1.businessEndDate = time
} else {
this.$refs.uToast.show({
title: '结束时间不能小于开始时间',
type: 'error',
})
}
},
idCardStTimeChange(val) {
this.model1.idCardValidStart = this.timeChange1(val)
this.model1.idCardValidEnd = ''
},
idCardEndTimeChange(val) {
const time = this.timeChange1(val);
if (new Date(time).getTime() > new Date(this.model1.idCardValidStart).getTime()) {
this.model1.idCardValidEnd = time
} else {
this.$refs.uToast.show({
title: '结束时间不能小于开始时间',
type: 'error',
})
}
},
IdtypeChange(e) {
this.model1.idCardType = e[0].label;
},
timeChange1(val) {
const {
year,
month,
day
} = val;
return `${year}-${month}-${day}`;
},
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) => {
if (ziduan == 'businessLicense') {
this.model1.businessLicense = this.$img + JSON.parse(uploadFileRes.data).data
} else if (ziduan == 'idPhotoFront') {
this.model1.idPhotoFront = this.$img + JSON.parse(uploadFileRes.data).data
} else if (ziduan == 'idPhotoBack') {
this.model1.idPhotoBack = this.$img + JSON.parse(uploadFileRes.data).data
} else if(ziduan == 'coverImage'){
this.model1.coverImage = this.$img + JSON.parse(uploadFileRes.data).data
}else{
this.model1.enterpriseAuthorization = this.$img + JSON.parse(uploadFileRes.data).data
}
console.log('上传成功', this.model1);
uni.showToast({
title: '上传成功',
icon: 'success',
});
},
fail: (err) => {
console.error('上传失败', err);
uni.showToast({
title: '上传失败',
icon: 'none',
});
},
});
},
}
}
</script>
<style scoped lang="scss">
@import 'advertisementAdd.scss';
</style>