暂存账号管理

This commit is contained in:
2025-02-21 08:41:46 +08:00
parent 16a03fbb4b
commit b078bbf26a
11 changed files with 168 additions and 33 deletions

View File

@@ -1,7 +1,8 @@
// pages/workBench/components/account/index.js
import request from "../../../../utils/request"
import { getTenementBackInfo, getTenementUsers } from "../../../../service/tenement"
import { alertInfo } from "../../../../utils/index"
import { getTenementBackInfo, } from "../../../../service/tenement"
import { getBackApproveList, removeUser } from "../../../../service/user"
import { alertInfo, alertSuccess } from "../../../../utils/index"
const { OK } = request
Component({
@@ -56,6 +57,7 @@ Component({
})
break;
case "tenement":
console.log('data', data)
this.setData({
tenement: data.id,
tenementName: data.name,
@@ -73,21 +75,33 @@ Component({
})
},
handleDelete(e) {
const {} = e;
const { id, name } = e.currentTarget.dataset;
const { tenement } = this.data;
const that = this;
wx.showModal({
title: '提示',
content: '确认要移除该用户吗?',
complete: (res) => {
content: `确认要移除${name}吗?`,
complete: async (res) => {
if (res.cancel) {
}
if (res.confirm) {
const { code, message } = await removeUser(id, tenement)
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("删除成功")
that.initUserList();
}
}
})
},
onEditConfirm() {
this.initUserList()
this.handleCancel();
},
async getTenementInfo() {
const { tenement, park } = this.data;
const { code, message, tenement: data } = await getTenementBackInfo(park, tenement)
@@ -100,8 +114,8 @@ Component({
})
},
async initUserList() {
const { tenementName, park } = this.data;
const { code, message, data } = await getTenementUsers({ park, keyword: tenementName });
const { tenement } = this.data;
const { code, message, data } = await getBackApproveList(tenement, 1);
if (code !== OK) {
alertInfo(message)
return;
@@ -116,6 +130,31 @@ Component({
type: "add",
title: "新建子账号"
})
},
handleChangeMain() {
const { list = [] } = this.data;
const main = list?.find(item => item.isAdmin)
if (!main) {
return
}
this.setData({
visible: true,
type: "update",
title: "编辑管理员",
phone: main.phone,
name: main.name,
id: main.id,
})
},
handleCancel() {
console.log("-------------")
this.setData({
visible: false,
type: "",
phone: "",
name: "",
id: "",
})
}
}
})