DESKTOP-812G6RA\PROW_006
9 days ago ee0581277156325f60fe3a1edfd8ac1645a77ec6
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
<template>
    <div class="common-main">
      <div class="common">
        <div class="common-top">
            <div class="common-top-title">
                <i class="el-icon-rank"></i>
                <span>个人中心</span>
            </div>
            <div class="common-top-right">
                <i class="el-icon-arrow-down"></i>
                <i class="el-icon-refresh"></i>
            </div>
        </div>
        <el-row :gutter="20">
 
            <!-- 公司信息 -->
            <el-col :span="10">
                <div class="grid-content bg-purple">
                    <el-card class="box-card" shadow="hover">
                        <div slot="header" class="clearfix">
                            <!-- 公司名字 -->
                            <span>
                                {{UserCustomerdata.CusFullName}}
                                <el-button type="text" @click="dialogVisible = true"><i class="el-icon-edit"></i></el-button>
                                <el-dialog
                                    title="修改信息"
                                    :visible.sync="dialogVisible"
                                    width="50%"
                                >
                                    <el-form ref="form" :model="form" label-width="80px" :rules="rules">
                                    <el-form-item label="公司全称" prop="CusFullName">
                                        <el-input v-model="form.CusFullName"></el-input>
                                    </el-form-item>
                                    <el-form-item label="公司主营" prop="CusMainBusiness">
                                        <el-input v-model="form.CusMainBusiness"></el-input>
                                    </el-form-item>
                                    <el-form-item label="公司地址" prop="CusAddress">
                                        <el-input v-model="form.CusAddress"></el-input>
                                    </el-form-item>
                                    <el-form-item label="客户联系人" prop="CusContacts">
                                        <el-input v-model="form.CusContacts"></el-input>
                                    </el-form-item>
                                    <el-form-item label="客户联系人电话" prop="CusContactsPhone">
                                        <el-input v-model="form.CusContactsPhone"></el-input>
                                    </el-form-item>
                                    </el-form>
                                    <span slot="footer" class="dialog-footer">
                                        <el-button @click="dialogVisible = false">取 消</el-button>
                                        <el-button type="primary" @click="submitForm('form')">确 定</el-button>
                                    </span>
                                    </el-dialog>
                            </span>
                            <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
                        </div>
                        <div class="CusFullNametit">
                            公司简介
                        </div>
                            <div class="CusFullNametxt">
                            <!-- 公司主营 -->
                            {{UserCustomerdata.CusMainBusiness}}
                            </div>
                        <div class="Companycontact">
                            <div class="CusAddress">
                                <!-- 公司地址 -->
                                <i class="el-icon-location"></i>
                                {{UserCustomerdata.CusAddress}}
                            </div>
                            <div class="CusContacts">
                                <!-- 客户联系人 -->
                                <i class="el-icon-s-custom"></i>
                                {{UserCustomerdata.CusContacts}}
                            </div>
                            <div class="CusContactsPhone">
                                <!-- 客户联系人电话 -->
                                <i class="el-icon-phone"></i>
                                {{UserCustomerdata.CusContactsPhone}}
                            </div>
                        </div>
                        
                    </el-card>
                </div>
            </el-col>
 
            <!-- 个人资料 -->
            <el-col :span="7">
                <div class="grid-content bg-purple">
                    <el-card class="box-card" shadow="hover">
                        <div slot="header" class="clearfix">
                            <span>基础资料</span>
                            <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
                        </div>
                        <!-- <div v-for="o in 4" :key="o" class="text item">
                            {{'列表内容 ' + o }}
                        </div> -->
                        驾驶员资料
                        <el-divider></el-divider>
                    </el-card>
                </div>
            </el-col>
 
            <!-- 个人信息 -->
            <el-col :span="7">
                <div class="grid-content bg-purple">
                    <el-card class="box-card" shadow="hover">
                        <div slot="header" class="clearfix">
                            <span>个人信息</span>
                            <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
                        </div>
                        <div class="Usermsg">
                            <div >
                            头像
                                <img :src="Userdata.Icon" alt="">
                            </div>
                            <div>
                                {{Userdata.DisplayName}}
                            </div>
                            <div>
                                {{Userdata.Phone}}
                            </div>
                        </div>
                        <el-divider></el-divider>
                    </el-card>
                </div>
            </el-col>
            
        </el-row>
 
      </div>
  </div>
</template>
 
<script>
    export default {
        data() {
            return {
                UserCustomerdata:[],
                Userdata:[],
                dialogVisible: false,
                form: {
                    CusFullName: '',
                    CusMainBusiness: '',
                    CusAddress: '',
                    CusContacts: '',
                    CusContactsPhone: ''
                },
                rules: {
                    CusFullName: [
                        { required: true, message: '请输入公司全称', trigger: 'blur' },
                        { min: 1,  message: '不能为空', trigger: 'blur' }
                    ],
                    CusMainBusiness: [
                        { required: true, message: '请输入公司主营', trigger: 'blur' },
                        { min: 1,  message: '不能为空', trigger: 'blur' }
                    ],
                    CusAddress: [
                       { required: true, message: '请输入公司地址', trigger: 'blur' },
                       { min: 1,  message: '不能为空', trigger: 'blur' }
                    ],
                    CusContacts: [
                        { required: true, message: '请输入公司联系人姓名', trigger: 'blur' },
                        { min: 1,  message: '不能为空', trigger: 'blur' }
                    ],
                    CusContactsPhone: [
                        { required: true, message: '请输入公司联系人联系方式', trigger: 'blur' },
                        { min: 8, max: 13,  message: '输入正确电话位数', trigger: 'blur' }
                    ]
                }
            }
        },
        created () {
          this.QueryUserCustomer()
          this.QueryUser()
        },
        methods: {
            // 获取个人中心
            async QueryUserCustomer(model) {
                await this.$axios
                .post(
                    "/api/PersonalCnter/QueryUserCustomer",
                    this.$qs.stringify(model)
                )
                .then((res) => {
                    this.UserCustomerdata = res.data
                    this.form={...this.form,...res.data}
                })
                .catch((err) => {
                    console.log(err);
                });
            },
            // 获取用户信息
            async QueryUser(model) {
                await this.$axios
                .post(
                    "/api/PersonalCnter/QueryUser",
                    this.$qs.stringify(model)
                )
                .then((res) => {
                    this.Userdata = res.data
                    // console.log(this.Userdata);
                })
                .catch((err) => {
                    console.log(err);
                });
            },
            // 修改客户信息
            async UpdateUserCustomer() {
                await this.$axios
                .post(
                    "/api/PersonalCnter/UpdateUserCustomer",
                    this.$qs.stringify({
                        CusId: this.UserCustomerdata.CusId,
                        CusFullName: this.form.CusFullName,
                        CusMainBusiness: this.form.CusMainBusiness,
                        CusAddress: this.form.CusAddress,
                        CusContacts: this.form.CusContacts,
                        CusContactsPhone:this.form.CusContactsPhone
                    })
                )
                .then((res) => {
                     this.QueryUserCustomer()
                     this.dialogVisible = false
                })
                .catch((err) => {
                    console.log(err);
                });
            },
            submitForm(form) {
                this.$refs[form].validate((valid) => {
                if (valid) {
                    this.UpdateUserCustomer();
                } else {
                    return false;
                }
                });
            },
            
        },
    }
</script>
 
<style lang="less" scoped>
.el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
  .text {
    font-size: 14px;
  }
 
  .item {
    margin-bottom: 18px;
  }
 
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }
  .CusFullNametxt {
      min-height: 100px;
      padding-top: 16px;
      text-indent :25px;
      color: #606266;
  } 
 
  .Companycontact{
      display: flex;
      justify-content: space-around;
  }
  .Usermsg{
      text-align: center;
  }
  .el-icon-edit{
      font-size:20px
  }
</style>