groupInfo.vue
10.6 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
<template>
<view>
<view class="mainbox">
<uni-list>
<uni-list-item title="所属协会">
<template v-slot:footer>
<!-- <view style="width: 60%;text-align: right;">{{form.firstName}} {{form.parentDeptName}}</view> -->
<view style="width: 500rpx;text-align: right;">
<uni-data-picker v-model="form.deptId" :localdata="tree"
readonly :clear-icon="false"
:map="{text:'label',value:'id'}">
</uni-data-picker>
</view>
</template>
</uni-list-item>
<uni-list-item title="会员编号" v-if="form.menCode" :rightText="form.menCode" />
<uni-list-item title="机构名称" :rightText="form.name" />
<uni-list-item title="所属省份">
<template v-slot:footer>
<uni-data-select :clear="false" disabled
v-model="form.belongProvinceId" :localdata="regionsList">
</uni-data-select>
</template>
</uni-list-item>
<uni-list-item title="社会信用代码" :rightText="form.creditCode" />
<uni-list-item v-if="isR" title="联系人" :rightText="form.certSiteContact" />
<uni-list-item v-else title="联系人" :rightText="form.siteContact" />
<uni-list-item v-if="isR" title="联系方式" :rightText="form.certSiteTel" />
<uni-list-item v-else title="联系方式" :rightText="form.siteTel" />
<uni-list-item v-if="form.validityDate" title="有效期" :rightText="form.validityDate?.slice(0,10)" />
<uni-list-item title="认证地址">
<template v-slot:footer>
{{form.provinceStr}}{{form.cityName}}{{form.regionStr}}
</template>
</uni-list-item>
<uni-list-item title="认证详细地址" :rightText="form.adress" />
<uni-list-item title="法人姓名" v-if="isR" :rightText="form.certLegal||'--'" />
<uni-list-item title="法人姓名" v-else :rightText="form.legal||'--'" />
<uni-list-item v-if="form.deptType==6" title="是否为考点" :rightText="form.applyPoints==1?'是':'否'" />
<uni-list-item title="法人身份证" clickable v-if="isR">
<template v-slot:footer>
<view v-if="form.legalIdcPhotoArr&&form.legalIdcPhotoArr?.length>0">
<image class="ylImage" mode="aspectFit" @click="showImage(form.legalIdcPhotoArr,index)"
v-for="(item,index) in form.legalIdcPhotoArr" :key="item" :src="item">
</image>
</view>
</template>
</uni-list-item>
<uni-list-item title="法人身份证" clickable v-else>
<template v-slot:footer>
<view v-if="form.legalIdcPhotoArrR&&form.legalIdcPhotoArrR?.length>0">
<image class="ylImage" mode="aspectFit" @click="showImage(form.legalIdcPhotoArrR,index)"
v-for="(item,index) in form.legalIdcPhotoArrR" :key="item" :src="item">
</image>
</view>
</template>
</uni-list-item>
<uni-list-item title="营业执照" clickable v-if="isR">
<template v-slot:footer>
<view style="width: 50vw;word-break: break-all;" @click="download(form.businessLicenseArrR[0]?.url)" v-if="form.businessLicenseArrR&&form.businessLicenseArrR?.length>0">
<text class="text-primary">{{form.businessLicenseArrR[0]?.name}}</text>
</view>
</template>
</uni-list-item>
<uni-list-item title="营业执照" clickable v-else>
<template v-slot:footer>
<view style="width: 50vw;word-break: break-all;" @click="download(form.businessLicenseArr[0]?.url)" v-if="form.businessLicenseArr&&form.businessLicenseArr?.length>0">
<text class="text-primary">{{form.businessLicenseArr[0]?.name}}</text>
</view>
</template>
</uni-list-item>
<uni-list-item title="机构照片" clickable v-if="isR">
<template v-slot:footer>
<view v-if="form.picturesArr&&form.picturesArr?.length>0" class="photoBook" @click="showImage(form.picturesArr,0)">
<image mode="aspectFit" class="ylImage"
:src="form.picturesArr[0]">
</image>
<text>共{{form.picturesArr?.length}}张</text>
</view>
</template>
</uni-list-item>
<uni-list-item title="机构照片" clickable v-else>
<template v-slot:footer>
<view v-if="form.picturesArrR&&form.picturesArrR?.length>0" class="photoBook" @click="showImage(form.picturesArrR,0)">
<image mode="aspectFit" class="ylImage"
:src="form.picturesArrR[0]">
</image>
<text>共{{form.picturesArrR?.length}}张</text>
</view>
</template>
</uni-list-item>
</uni-list>
</view>
<view class="height1"></view>
</view>
</template>
<script setup>
import * as api from '@/common/api.js'
import config from '@/config.js'
import _ from 'underscore'
import {
onMounted,
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
const app = getApp()
const form = ref({
legalIdcPhotoArr: [],
legalIdcPhotoArrR: [],
picturesArr: [],
picturesArrR: [],
businessLicenseArr:[],
businessLicenseArrR:[]
})
const tree = ref([])
const regionsList = ref([])
const isR = ref(false)
onLoad(option => {
console.log(option)
if (option.isR){
isR.value = true
}
if (option.memId) {
getForm(option.memId)
}
})
function getForm(memId){
if(memId){
api.getGroupMemberInfoById(memId).then(res => {
form.value = res.data
init()
})
}else{
init()
}
}
function init() {
getDeptTree()
getRegionsList()
console.log(form.value)
if (form.value.businessLicense) {
form.value.businessLicenseArr = []
try{
form.value.businessLicenseArr = JSON.parse(form.value.businessLicense) || []
}catch(e){
form.value.businessLicenseArr=[{url:form.value.businessLicense,name:'营业执照'}]
}
console.log('营业执照',form.value.businessLicenseArr)
}
if (form.value.certBusinessLicense) {
form.value.businessLicenseArrR = []
try{
form.value.businessLicenseArrR = JSON.parse(form.value.certBusinessLicense) || []
}catch(e){
form.value.businessLicenseArrR=[{url:form.value.certBusinessLicense,name:'营业执照'}]
}
console.log('营业执照',form.value.businessLicenseArrR)
}
if (form.value.certLegalIdcPhoto && form.value.certLegalIdcPhoto!=null) {
form.value.legalIdcPhotoArr = []
var arr = form.value.certLegalIdcPhoto?.split(',') || []
if (arr.length > 0) {
arr = _.map(arr, (p) => {
if(p.indexOf('http')==-1){
console.log(p)
p = config.baseUrl_api + p
}
return p
})
form.value.legalIdcPhotoArr = arr
}
}
if(form.value.legalIdcPhoto && form.value.legalIdcPhoto!=null){
form.value.legalIdcPhotoArrR = []
var arr = form.value.legalIdcPhoto?.split(',') || []
if (arr.length > 0) {
arr = _.map(arr, (p) => {
if(p.indexOf('http')==-1){
console.log(p)
p = config.baseUrl_api + p
}
return p
})
form.value.legalIdcPhotoArrR = arr
}
}
console.log('法人身份证',form.value.legalIdcPhotoArr)
if (form.value.certPictures) {
form.value.picturesArr = []
var arr = form.value.certPictures.split(',') || []
if (arr.length > 0) {
arr = _.map(arr, (p) => {
if(p.indexOf('http')==-1){
p = config.baseUrl_api + p
}
return p
})
form.value.picturesArr = arr
}
console.log(form.value.picturesArr)
}
if(form.value.pictures){
form.value.picturesArrR = []
var arr = form.value.pictures.split(',') || []
if (arr.length > 0) {
arr = _.map(arr, (p) => {
if(p.indexOf('http')==-1){
p = config.baseUrl_api + p
}
return p
})
form.value.picturesArrR = arr
}
console.log(form.value.picturesArrR)
}
}
function getRegionsList() {
api.regionsList().then(res => {
regionsList.value = res.data;
})
}
function getDeptTree(){
api.deptTreeSelect({ selfDeptId: '-1', showDirect: 1, showAll: 1 }).then(res=>{
tree.value = res.data
if (typeof tree.value?.[0]?.id == 'number') {
form.value.deptId = form.value.deptId * 1
} else {
form.value.deptId = form.value.deptId.toString()
}
})
}
function showImage(arr, index) {
uni.previewImage({
urls: arr,
current: index,
success: function(res) {
}
})
}
function download(url) {
console.log(url)
if (url.indexOf('.png') > -1 || url.indexOf('.jpg') > -1) {
if(url.indexOf('http')>-1){
uni.previewImage({
urls: [url],
success: function(res) {
console.log(res,[url],'111')
}
})
} else {
uni.previewImage({
urls: [config.baseUrl_api + url],
success: function(res) {
console.log(url,'222')
}
})
}
} else {
if(url.indexOf('http')>-1){
goWebView(url)
} else {
goWebView(config.baseUrl_api + url)
}
}
}
function goWebView(url) {
url = url.replace("http://", "https://")
uni.showLoading({
title: '下载中'
});
uni.downloadFile({
url: url,
success: function(res) {
uni.hideLoading();
var filePath = res.tempFilePath;
uni.showLoading({
title: '正在打开'
});
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
uni.hideLoading();
},
fail: function(err) {
uni.hideLoading();
uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
}
});
},
fail: function(error) {
uni.hideLoading();
uni.showToast({
title:`下载失败`,
icon: 'none',
duration: 2000
});
}
});
}
</script>
<style scoped lang="scss">
:deep(.input-value ){padding: 0!important;line-height: 1.4!important;}
:deep(.selected-list){display: block!important;
}
:deep(.selected-item){display:inline;white-space:normal!important;}
.height1 {
height: 1rpx
}
.ylImage {
width: 300rpx;
height: 200rpx;
display: block;
box-shadow: 0 0 10rpx #ddd;
border-radius: 8rpx;
}
.mainbox {
margin: 30rpx 25rpx 60rpx;
padding: 1px;
background: #FFFFFF;
border-radius: 15rpx;
:deep(.uni-list-item__content-title) {
color: #4C5359;
font-size: 30rpx;
font-weight: 300;
}
:deep(.uni-list-item__extra-text) {
color: #000;
font-size: 30rpx;
}
}
.photobox {
position: relative;
margin: 30rpx auto;
.photo {
width: 210rpx;
height: 280rpx;
background-color: #f4f4f4;
display: block;
margin: auto;
}
}
.colorful {
background-color: #007BDA;
width: 200rpx;
margin: auto;
height: 200rpx;
line-height: 200rpx;
font-size: 44rpx;
color: #fff;
text-align: center;
border-radius: 50%;
}
:deep(.uni-list-item__extra) {
width: 60%;
}
.photoBook{position: relative;border-radius: 10rpx; overflow: hidden;
&::after{content: '';position: absolute;width: 100%;height: 100%;top: 0;left: 0;
background: linear-gradient(180deg,rgba(0, 0, 0, 0),rgba(0, 0, 0, 0.7));
}
text{ position: absolute;z-index: 1;
font-size: 24rpx;
color: #fff;
bottom: 4rpx;
right: 8rpx;}
}
</style>