institutionInfo.vue
9.01 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
<template>
<view class="institution-page">
<view class="loading-wrap" v-if="loading">
<uni-load-more status="loading"></uni-load-more>
</view>
<view v-else>
<!-- 基本信息 -->
<view class="section">
<view class="section-header">
<uni-icons type="office" size="18" color="#AD181F"></uni-icons>
<text class="section-title">基本信息</text>
</view>
<view class="info-card">
<view class="info-row">
<text class="label">所属协会</text>
<text class="value">{{ form.parentDeptName || '-' }}</text>
</view>
<!-- <view class="info-row">
<text class="label">会员编号</text>
<text class="value">{{ form.menCode || '-' }}</text>
</view> -->
<view class="info-row">
<text class="label">机构名称</text>
<text class="value">{{ form.name || '-' }}</text>
</view>
<view class="info-row">
<text class="label">认证地址</text>
<text class="value">{{ form.provinceStr + form.cityStr + form.regionStr || '-' }}</text>
</view>
<view class="info-row">
<text class="label">详细地址</text>
<text class="value">{{ form.adress || '-' }}</text>
</view>
<view class="info-row">
<text class="label">联系人</text>
<text class="value">{{ form.siteContact || '-' }}</text>
</view>
<view class="info-row">
<text class="label">联系方式</text>
<text class="value">{{ form.siteTel || '-' }}</text>
</view>
<view class="info-row" v-if="form.applyPoints !== undefined">
<text class="label">是否为考点</text>
<text class="value">{{ form.applyPoints == 1 ? '是' : '否' }}</text>
</view>
</view>
</view>
<!-- 营业执照 -->
<view class="section" v-if="form.businessLicense">
<view class="section-header">
<uni-icons type="document" size="18" color="#AD181F"></uni-icons>
<text class="section-title">营业执照</text>
</view>
<view class="info-card">
<view class="info-row">
<text class="label">营业执照名称</text>
<text class="value">{{ form.companyName || '-' }}</text>
</view>
<view class="info-row">
<text class="label">社会信用代码</text>
<text class="value">{{ form.creditCode || '-' }}</text>
</view>
<view class="info-row" v-if="form.validityDate">
<text class="label">有效期</text>
<text class="value">{{ form.validityDate }}</text>
</view>
<view class="info-row">
<text class="label">营业执照</text>
<view>
<template v-slot:footer>
<view style="width: 50vw;word-break: break-all;text-align: right;" @click="download(form.businessLicense[0]?.url)" v-if="form.businessLicense&&form.businessLicense?.length>0">
<text class="text-primary">{{form.businessLicense[0]?.name}}</text>
</view>
</template>
</view>
</view>
</view>
</view>
<!-- 法人信息 -->
<view class="section">
<view class="section-header">
<uni-icons type="person" size="18" color="#AD181F"></uni-icons>
<text class="section-title">法人信息</text>
</view>
<view class="info-card">
<view class="info-row">
<text class="label">法人姓名</text>
<text class="value">{{ form.legal || '-' }}</text>
</view>
<view class="info-row">
<text class="label">法人证件号</text>
<text class="value">{{ form.legalIdcCode || '-' }}</text>
</view>
</view>
</view>
<!-- 证件照片 -->
<view class="section" v-if="form.legalIdcPhoto && form.legalIdcPhoto.length > 0">
<view class="section-header">
<uni-icons type="photo" size="18" color="#AD181F"></uni-icons>
<text class="section-title">法人证件照</text>
</view>
<view class="image-list">
<image
v-for="(img, index) in form.legalIdcPhoto"
:key="index"
class="preview-image"
:src="getImageUrl(img)"
mode="aspectFit"
@click="previewImage(form.legalIdcPhoto, index)"
/>
</view>
</view>
<!-- 机构照片 -->
<view class="section" v-if="form.pictures && form.pictures.length > 0">
<view class="section-header">
<uni-icons type="image" size="18" color="#AD181F"></uni-icons>
<text class="section-title">机构照片</text>
</view>
<view class="image-list">
<image
v-for="(img, index) in form.pictures"
:key="index"
class="preview-image"
:src="getImageUrl(img)"
mode="aspectFit"
@click="previewImage(form.pictures, index)"
/>
</view>
</view>
</view>
</view>
</template>
<script setup>
import * as api from '@/common/api.js'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
// const config = require('@/config.js')
import config from '@/config.js'
const loading = ref(false)
const form = ref({})
onLoad((options) => {
if (options.memId) {
getInstitutionInfo(options.memId)
}
})
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
});
}
});
}
function getInstitutionInfo(memId) {
loading.value = true
api.getGroupMemberInfoById(memId).then(res => {
loading.value = false
if (res.data) {
form.value = res.data
form.value.businessLicense = JSON.parse((form.value.businessLicense))
// 处理图片字段
if (form.value.pictures && typeof form.value.pictures === 'string') {
form.value.pictures = form.value.pictures.split(',').filter(Boolean)
}
if (form.value.legalIdcPhoto && typeof form.value.legalIdcPhoto === 'string') {
form.value.legalIdcPhoto = form.value.legalIdcPhoto.split(',').filter(Boolean)
}
}
}).catch(err => {
loading.value = false
console.error('获取机构资料失败', err)
uni.showToast({
title: '获取机构资料失败',
icon: 'none'
})
})
}
function getImageUrl(path) {
if (!path) return ''
if (path.startsWith('http')) return path
return config.baseUrl_api + path
}
function previewImage(images, currentIndex) {
const urls = images.map(img => getImageUrl(img))
uni.previewImage({
urls: urls,
current: currentIndex
})
}
</script>
<style lang="scss" scoped>
.institution-page {
min-height: 100vh;
background-color: #f5f5f5;
padding: 20rpx;
padding-bottom: 40rpx;
}
.loading-wrap {
padding: 100rpx 0;
text-align: center;
}
.section {
background-color: #fff;
border-radius: 16rpx;
padding: 30rpx;
margin-bottom: 20rpx;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
margin-left: 10rpx;
}
}
.info-card {
.info-row {
display: flex;
justify-content: space-between;
padding: 16rpx 0;
border-bottom: 1px solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.label {
font-size: 26rpx;
color: #999;
flex-shrink: 0;
}
.value {
font-size: 26rpx;
color: #333;
text-align: right;
margin-left: 20rpx;
flex: 1;
word-break: break-all;
}
}
}
.image-list {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
.preview-image {
width: 200rpx;
height: 200rpx;
border-radius: 12rpx;
background-color: #f5f5f5;
}
}
</style>