用户管理禁用

dev
yujialong 3 years ago
parent b29874e06d
commit aa626b7be9
  1. 2
      src/utils/api.js
  2. 11
      src/views/user/AddUser.vue
  3. 14
      src/views/user/User.vue

@ -54,6 +54,8 @@ export default {
checkCode: `${host3}/users/userAccount/checkCode`,
findPasswordByEmail: `${host3}/users/userAccount/findPasswordByEmail`,
findPasswordByPhone: `${host3}/users/userAccount/findPasswordByPhone`,
updateAccountEnable: `${host3}/users/userAccount/updateAccountEnable`,
updateAccountAllEnable: `${host3}/users/userAccount/updateAccountAllEnable`,
queryOrder: `${host}/liuwanr/order/queryOrder`, //查询订单
queryOrderDetails: `${host}/liuwanr/order/queryOrderDetails`, //查询订单详情

@ -348,7 +348,7 @@
<p class="val">{{item1.account}}</p>
</li>
<li>
<el-switch v-model="item1.disableAccount" :active-value="0" :inactive-value="1" :active-text="item1.disableAccount ? '禁用' : '启用'" @change="switchOff($event,item1)"></el-switch>
<el-switch v-model="item1.isEnable" :active-value="1" :inactive-value="0" :active-text="item1.isEnable ? '启用' : '禁用'" @change="switchOff($event,item1)"></el-switch>
</li>
</div>
<div class="line">
@ -830,8 +830,13 @@ export default {
console.log(11,list)
}).catch(res => {})
},
switchOff(val,item){
console.log(val,item)
switchOff(val,row){
this.$get(this.api.updateAccountEnable,{
id: row.id,
isEnable: val
}).then(res => {
this.$message.success(val ? '启用成功' : '禁用成功')
}).catch(res => {})
}
}
};

@ -110,7 +110,7 @@
<!-- <el-button type="text" @click="edit(scope.row)">编辑</el-button> -->
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-switch v-model="scope.row.disableAccount" :active-value="0" :inactive-value="1" style="margin: 0 10px 0 5px" :active-text="scope.row.disableAccount ? '禁用' : '启用'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<el-switch v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '启用' : '禁用'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
</template>
</el-table-column>
</el-table>
@ -336,14 +336,12 @@ export default {
}).catch(() => {})
},
switchOff(val,row,index) {
let data = {
id: row.id,
isDisable: val
}
this.$post(this.api.updateClient,data).then((res) => {
this.$get(this.api.updateAccountAllEnable,{
id: row.userId,
isEnable: val
}).then(res => {
this.$message.success(val ? '启用成功' : '禁用成功')
}).catch((res) => {
})
}).catch(res => {})
},
handleSelectionChange(val) {
this.multipleSelection = val

Loading…
Cancel
Save