123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <div class="personal">
- <!-- 头部细节部分 -->
- <div class="title">
- <el-row>
- <el-col :span="24">
- <div class="top">
- <div class="geren">个人中心</div>
- <div class="line"></div>
- <div class="from">
- <table>
- <tr>
- <td><span>用户名</span></td>
- <td><span>{{formUserList.userName}}</span></td>
- </tr>
- <tr>
- <td><span>姓名</span></td>
- <td><span>{{formUserList.name}}</span></td>
- </tr>
- <tr>
- <td><span>企业名称</span></td>
- <td><span>{{formUserList.company}}</span></td>
- </tr>
- <tr>
- <td><span>手机号</span></td>
- <td><span>{{formUserList.phone}}</span></td>
- </tr>
- <tr>
- <td><span>余额</span></td>
- <td><span>{{formUserList.fee | rounding}}</span></td>
- </tr>
- <tr>
- <td><span>密码</span></td>
- <td><span style="color: blue; cursor:pointer;" @click="ChangeThePassword">修改密码</span></td>
- </tr>
- </table>
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
- <!-- 重置密码 -->
- <el-dialog
- @close="handleEditDialogClose"
- :visible.sync="changepassword"
- style="font-size: 0px;">
- <div class="tou">用户--重置密码</div>
- <div class="line"></div>
- <el-form
- label-position="right"
- label-width="80px"
- :model="formList">
- <el-form-item label="用户名">
- <el-input v-model="formList.userName" auto-complete="off" placeholder="请输入用户"></el-input>
- </el-form-item>
- <el-form-item label="新密码">
- <el-input v-model="formList.password" type="password" auto-complete="off" placeholder="请输入新密码"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="changepassword = false" type="info">取 消</el-button>
- <el-button type="primary" @click="resetPassword">修 改</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- export default{
- data() {
- return {
- formUserList: {
- 'userName': ``,
- 'password': ``,
- 'price': ``,
- 'id': ``,
- 'name': ``,
- 'phone': ``,
- 'roleId': ``,
- 'money': ``,
- 'isLock': ``,
- 'dutyParagraph': ``,
- 'company': ``,
- 'threshold': ``,
- 'autoUpdate': ``
- },
- // autoUpdate: 1,
- formupdateList: {
- 'id': ``,
- 'autoUpdate': ``
- },
- formList: {
- 'id': ``,
- 'userName': ``,
- 'password': ``
- },
- formthresholdList: {
- 'id': ``,
- 'threshold': ``
- },
- changepassword: false
- }
- },
- created() {
- this.loadData()
- },
- filters: {
- rounding(value) {
- return value.toFixed(2)
- }
- },
- methods: {
- async loadData() {
- this.formUserList.userId = sessionStorage.getItem(`userId`)
- this.formupdateList.id = sessionStorage.getItem(`userId`)
- this.formthresholdList.id = sessionStorage.getItem(`userId`)
- const response = await this.$http.get(`user/${this.formUserList.userId}`)
- if (response.data.code === 0) {
- this.formUserList = response.data.data
- this.formupdateList.autoUpdate = response.data.data.autoUpdate
- };
- },
- // 打开修改密码的弹框
- ChangeThePassword() {
- this.changepassword = true
- this.formList.userName = this.formUserList.userName
- this.formList.id = this.formUserList.id
- },
- // 修改是否自动更新开票中的发票信息
- async updateInvoiceMessage() {
- this.formupdateList.autoUpdate = this.formupdateList.autoUpdate
- const response = await this.$http.put(`user/auto`, this.formupdateList)
- if (response.data.code === 0) {
- this.loadData()
- this.$message({
- type: `success`,
- message: `修改成功`
- })
- } else {
- this.$message({
- type: `error`,
- message: `修改失败`
- })
- }
- },
- // 修改密码
- async resetPassword() {
- const response = await this.$http.put(`user/restPassword`, this.formList)
- if (response.data.code === 0) {
- this.loadData()
- this.changepassword = false
- this.$router.push(`/login`)
- this.$message({
- type: `success`,
- message: `修改成功`
- })
- } else {
- this.$message({
- type: `error`,
- message: `修改失败`
- })
- }
- },
- // 更改阈值
- async changeThreshold() {
- this.formthresholdList.id = this.formUserList.id
- this.formthresholdList.threshold = this.formUserList.threshold
- const response = await this.$http.put(`user`, this.formthresholdList)
- if (response.data.code === 0) {
- this.$message({
- type: `success`,
- message: `修改成功`
- })
- } else {
- this.$message({
- type: `error`,
- message: `修改失败`
- })
- }
- },
- handleEditDialogClose() {
- for (var key in this.formList) {
- this.formList[key] = ``
- };
- }
- }
- }
- </script>
- <style>
- .personal {
- border: 1px solid #d9d9d9;
- border-radius: 10px;
- }
- .personal .top {
- padding: 20px;
- }
- .personal .geren {
- font-size: 25px;
- text-align: center;
- padding-top: 15px;
- }
- .personal .line {
- margin-top: 20px;
- margin-bottom: 20px;
- width: 100%;
- height: 2px;
- background-color: #d9d9d9;
- }
- .personal .tou {
- font-size: 20px;
- height: 30px;
- line-height: 30px;
- padding-top: 15px;
- }
- .personal .el-dialog__header, .el-dialog__body {
- padding: 0 20px;
- }
- .personal table {
- width: 100%;
- border-collapse:collapse;
- }
- .personal table th {
- border: 1px solid #96989f;
- text-align: center;
- height: 40px;
- line-height: 40px;
- }
- .personal table td {
- width: 50%;
- border: 1px solid #96989f;
- text-align: left;
- margin-left: 20px;
- height: 40px;
- line-height: 40px;
- }
- .personal table span {
- margin-left: 30px;
- font-size: 18px;
- }
- .personal .el-input__inner {
- height: 30px !important;
- line-height: 30px !important;
- }
- </style>
|