personalInfo.vue
5.12 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
<!-- 个人信息 -->
<template>
<d2-container class="personalInfo">
<p class="title">个人信息</p>
<el-form>
<template v-for="(item, index) in (formData.userType === 1 ? userformList : formList)">
<el-form-item
:key="index"
:label="item.label"
label-width="100px"
v-show="!item.hasOwnProperty('isDisabled') || formData[item.isDisabled]"
>
<template v-if="item.type === 'photo'">
<img
class="info-img"
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
:src="subItem.mediaUrl"
/>
</template>
<template v-else-if="Array.isArray(formData[item.name])">
<el-tag
class="tag"
type="warning"
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
>{{item.attrName ? subItem.brandName : subItem}}</el-tag>
</template>
<span v-else-if="item.formatter">{{item.formatter(formData)}}</span>
<span v-else-if="item.parentName">{{formData[item.parentName][item.name]}}</span>
<span v-else>{{formData[item.name]}}</span>
</el-form-item>
</template>
<el-form-item
v-if="formData.userType !== 1"
>
修改个人信息请到嘀加平台修改,点击快速修改<a
class="info-link"
href="http://dj.glsx.com.cn/web-dj-site/#/system/personallnfo"
target="_blank"
>http://dj.glsx.com.cn/web-dj-site/#/system/personallnfo</a>
</el-form-item>
</el-form>
</d2-container>
</template>
<script>
import { getUserInfo } from '@api/personalInfo'
import { userType, ghUserType } from '@/common/constants'
export default {
name: 'personalInfo',
data() {
return {
formData: {},
formList: [{
name: 'accountName',
label: '登录账户'
}, {
name: 'loginPhone',
label: '登录手机号'
}, {
name: 'merchantId',
label: '商户号'
}, {
name: 'merchantName',
label: '商户全称'
}, {
name: 'shortName',
label: '商户简称'
}, {
name: 'userTypeName',
label: '商户分类'
}, {
name: 'addr',
label: '商户地址'
}, {
name: 'phone',
label: '商户电话'
}, {
name: 'businessHours',
label: '营业时间'
}, {
name: 'shopMedias',
label: '门店照片',
type: 'photo'
}, {
name: 'carBrandListNoRepeat',
label: '主营品牌'
// attrName: 'brandName'
}, {
name: 'mainBusiness',
label: '营业范围'
}, {
parentName: 'role',
name: 'name',
label: '角色权限'
}],
userformList: [{
name: 'accountName',
label: '登录账户'
}, {
name: 'loginPhone',
label: '登陆手机号'
}, {
name: 'name',
label: '姓名/名称'
}, {
name: 'merchantName',
label: '所属商户'
}, {
parentName: 'role',
name: 'name',
label: '角色权限'
}, {
name: 'isOpenCard',
label: '名片',
formatter: (cellValue) => {
return cellValue.isOpenCard ? '开通' : '未开通'
}
}, {
name: 'duty',
isDisabled: 'isOpenCard',
label: '职务'
}, {
name: 'photoHead',
label: '头像',
isDisabled: 'isOpenCard',
type: 'photo'
}, {
name: 'phone',
label: '电话',
isDisabled: 'isOpenCard'
}, {
name: 'wechatNum',
label: '微信',
isDisabled: 'isOpenCard'
}, {
name: 'userLabelListArr',
label: '标签',
isDisabled: 'isOpenCard'
}]
}
},
mounted() {
getUserInfo({}).then(res => {
this.formData = res.detail
this.formData.userType = res.userType
if (this.formData.userType !== 1) {
this.formData.addr = (this.formData.provinceName || '') + (this.formData.cityName || '') + (this.formData.areaName || '') + (this.formData.address || '')
this.formData.carBrandListNoRepeat = [...new Set(this.formData.carBrandList.map(item => item.brandName))]
var typeList = this.formData.channelId === 2 ? ghUserType : userType
this.formData.userTypeName = typeList[this.formData.userType]
} else {
this.formData.photoHead = [{ mediaUrl: this.formData.photo }]
this.formData.userLabelListArr = this.formData.userLabelList.map(item => item.labelName)
}
})
},
methods: {}
}
</script>
<style>
.personalInfo .title {
font-size: 22px;
color: #666666;
letter-spacing: 1.38px;
}
.personalInfo .info-img {
width: 120px;
height: 120px;
margin-right: 5px;
}
.personalInfo .tag {
margin-right: 10px;
color: #333333;
/* width: 20px;
height: 20px;
font-size: 14px;
color: #333333;
background: #fff8ef;
border: 1px solid #ffdfb8;
border-radius: 6px; */
}
.personalInfo .info-link {
color: #003a00;
cursor: pointer;
}
</style>