暂存账号管理
This commit is contained in:
parent
16a03fbb4b
commit
b078bbf26a
|
@ -60,7 +60,12 @@ Component({
|
||||||
onConfirm(event) {
|
onConfirm(event) {
|
||||||
const { index } = event.detail;
|
const { index } = event.detail;
|
||||||
const { list = [], type } = this.data;
|
const { list = [], type } = this.data;
|
||||||
|
console.log("index", index)
|
||||||
const item = list[index];
|
const item = list[index];
|
||||||
|
if (!item) {
|
||||||
|
alertInfo("请选择一项")
|
||||||
|
return
|
||||||
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
columns: [],
|
columns: [],
|
||||||
list: [],
|
list: [],
|
||||||
|
@ -134,7 +139,7 @@ Component({
|
||||||
},
|
},
|
||||||
async onSearchBuilding() {
|
async onSearchBuilding() {
|
||||||
const { park } = this.data;
|
const { park } = this.data;
|
||||||
const { code, message, data = [] } = await getParkBuildingList(park);
|
const { code, message, buildings: data = [] } = await getParkBuildingList(park);
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
return
|
return
|
||||||
|
|
|
@ -16,12 +16,28 @@ Component({
|
||||||
park: String,
|
park: String,
|
||||||
tenement: String,
|
tenement: String,
|
||||||
},
|
},
|
||||||
|
observers: {
|
||||||
|
"name": function(newValue) {
|
||||||
|
const newData = this.data;
|
||||||
|
newData.name = newValue
|
||||||
|
this.setData({ data: newData })
|
||||||
|
},
|
||||||
|
"id": function(newValue) {
|
||||||
|
const newData = this.data;
|
||||||
|
newData.id = newValue
|
||||||
|
this.setData({ data: newData })
|
||||||
|
},
|
||||||
|
"phone": function(newValue) {
|
||||||
|
const newData = this.data;
|
||||||
|
newData.phone = newValue
|
||||||
|
this.setData({ data: newData })
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 组件的初始数据
|
* 组件的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
data: { name: "", phone: "" }
|
data: { name: "", phone: "", id: "" }
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,6 +58,7 @@ Component({
|
||||||
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
|
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
|
this.triggerEvent("cancel")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
alertSuccess("操作成功")
|
alertSuccess("操作成功")
|
||||||
|
@ -55,6 +72,9 @@ Component({
|
||||||
this.setData({
|
this.setData({
|
||||||
data: newData,
|
data: newData,
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
this.triggerEvent("cancel")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -5,6 +5,7 @@
|
||||||
show="{{ visible }}"
|
show="{{ visible }}"
|
||||||
show-cancel-button
|
show-cancel-button
|
||||||
bind:confirm="onSubmit"
|
bind:confirm="onSubmit"
|
||||||
|
bind:cancel="onCancel"
|
||||||
>
|
>
|
||||||
<view class="modalContentWrapper">
|
<view class="modalContentWrapper">
|
||||||
<van-field
|
<van-field
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// pages/workBench/components/account/index.js
|
// pages/workBench/components/account/index.js
|
||||||
import request from "../../../../utils/request"
|
import request from "../../../../utils/request"
|
||||||
import { getTenementBackInfo, getTenementUsers } from "../../../../service/tenement"
|
import { getTenementBackInfo, } from "../../../../service/tenement"
|
||||||
import { alertInfo } from "../../../../utils/index"
|
import { getBackApproveList, removeUser } from "../../../../service/user"
|
||||||
|
import { alertInfo, alertSuccess } from "../../../../utils/index"
|
||||||
const { OK } = request
|
const { OK } = request
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
|
@ -56,6 +57,7 @@ Component({
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case "tenement":
|
case "tenement":
|
||||||
|
console.log('data', data)
|
||||||
this.setData({
|
this.setData({
|
||||||
tenement: data.id,
|
tenement: data.id,
|
||||||
tenementName: data.name,
|
tenementName: data.name,
|
||||||
|
@ -73,21 +75,33 @@ Component({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleDelete(e) {
|
handleDelete(e) {
|
||||||
const {} = e;
|
const { id, name } = e.currentTarget.dataset;
|
||||||
|
const { tenement } = this.data;
|
||||||
|
const that = this;
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确认要移除该用户吗?',
|
content: `确认要移除${name}吗?`,
|
||||||
complete: (res) => {
|
complete: async (res) => {
|
||||||
if (res.cancel) {
|
if (res.cancel) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.confirm) {
|
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() {
|
async getTenementInfo() {
|
||||||
const { tenement, park } = this.data;
|
const { tenement, park } = this.data;
|
||||||
const { code, message, tenement: data } = await getTenementBackInfo(park, tenement)
|
const { code, message, tenement: data } = await getTenementBackInfo(park, tenement)
|
||||||
|
@ -100,8 +114,8 @@ Component({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async initUserList() {
|
async initUserList() {
|
||||||
const { tenementName, park } = this.data;
|
const { tenement } = this.data;
|
||||||
const { code, message, data } = await getTenementUsers({ park, keyword: tenementName });
|
const { code, message, data } = await getBackApproveList(tenement, 1);
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
return;
|
return;
|
||||||
|
@ -116,6 +130,31 @@ Component({
|
||||||
type: "add",
|
type: "add",
|
||||||
title: "新建子账号"
|
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: "",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -11,6 +11,7 @@
|
||||||
"van-radio": "@vant/weapp/radio/index",
|
"van-radio": "@vant/weapp/radio/index",
|
||||||
"van-radio-group": "@vant/weapp/radio-group/index",
|
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||||
"van-tag": "@vant/weapp/tag/index",
|
"van-tag": "@vant/weapp/tag/index",
|
||||||
"edit-modal": "./components/editModal/index"
|
"edit-modal": "./components/editModal/index",
|
||||||
|
"van-tag": "@vant/weapp/tag/index"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -50,7 +50,7 @@
|
||||||
/>
|
/>
|
||||||
<view class="operateBox">
|
<view class="operateBox">
|
||||||
<van-button type="primary" size="small" style="margin-right: 20rpx;" bind:click="handleAddSon"> 添加子账号 </van-button>
|
<van-button type="primary" size="small" style="margin-right: 20rpx;" bind:click="handleAddSon"> 添加子账号 </van-button>
|
||||||
<van-button type="primary" size="small" style="margin-right: 20rpx;" > 修改主账号 </van-button>
|
<van-button type="primary" size="small" style="margin-right: 20rpx;" bind:click="handleChangeMain"> 修改主账号 </van-button>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{list.length}}">
|
<view wx:if="{{list.length}}">
|
||||||
<view class="tableWrapper">
|
<view class="tableWrapper">
|
||||||
|
@ -58,20 +58,21 @@
|
||||||
<view class="thead">
|
<view class="thead">
|
||||||
<view class="th" style="width: 70rpx"> 序号 </view>
|
<view class="th" style="width: 70rpx"> 序号 </view>
|
||||||
<view class="th" style="width: 200rpx"> 昵称 </view>
|
<view class="th" style="width: 200rpx"> 昵称 </view>
|
||||||
<view class="th" style="width: 200rpx"> 手机号 </view>
|
<view class="th" style="width: 300rpx"> 手机号 </view>
|
||||||
<view class="th" style="width: 200rpx"> 操作 </view>
|
<view class="th" style="width: 100rpx"> 操作 </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tbody">
|
<view class="tbody">
|
||||||
<van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
|
<van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
|
||||||
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
|
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
|
||||||
<view class="tr">
|
<view class="tr">
|
||||||
<view class="th" style="width: 200rpx"> {{ index }} </view>
|
<view class="th" style="width: 70rpx"> {{ itemIndex + 1 }} </view>
|
||||||
<view class="th" style="width: 200rpx"> {{ item.tenement.shortName }} </view>
|
<view class="th" style="width: 200rpx"> {{ item.name }} </view>
|
||||||
<view class="th" style="width: 200rpx"> {{ item.money }} </view>
|
<view class="th" style="width: 300rpx"> {{ item.phone }} </view>
|
||||||
<view class="th" style="width: 200rpx">
|
<view class="th" style="width: 100rpx; display: flex;">
|
||||||
<view class="primaryTextBtn" bind:tap="handleDelete" data-id="{{item.id}}">
|
<view class="primaryTextBtn" bind:tap="handleDelete" data-id="{{item.id}}" data-name="{{item.name}}" wx:if="{{!item.isAdmin}}">
|
||||||
移除
|
移除
|
||||||
</view>
|
</view>
|
||||||
|
<van-tag type="primary" wx:else>管理员</van-tag>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<empty bind:refresh="initUserList" />
|
<empty wx:else bind:refresh="initUserList" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<search-select
|
<search-select
|
||||||
|
@ -99,5 +100,6 @@
|
||||||
title="{{title}}"
|
title="{{title}}"
|
||||||
tenement="{{tenement}}"
|
tenement="{{tenement}}"
|
||||||
park="{{park}}"
|
park="{{park}}"
|
||||||
bind:ok="initUserList"
|
bind:ok="onEditConfirm"
|
||||||
|
bind:cancel="handleCancel"
|
||||||
/>
|
/>
|
|
@ -2,4 +2,48 @@
|
||||||
|
|
||||||
.operateBox {
|
.operateBox {
|
||||||
margin: 20rpx;
|
margin: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
width: 890rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.classWrapper {
|
||||||
|
width: 100vw;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thead {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
border-bottom: 1rpx solid #EEEEEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thead .th {
|
||||||
|
padding: 20rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.tbody {
|
||||||
|
width: 890rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tbody .tr {
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1rpx solid #EEEEEE;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tbody .th {
|
||||||
|
word-break: break-all;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.primaryTextBtn {
|
||||||
|
color: #1989fa;
|
||||||
}
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
import { alertInfo } from "../../../../utils/index";
|
import { alertInfo } from "../../../../utils/index";
|
||||||
|
import { getTenementBackInfo, } from "../../../../service/tenement"
|
||||||
|
import request from "../../../../utils/request"
|
||||||
|
const { OK } = request
|
||||||
// pages/workBench/components/tenement/index.js
|
// pages/workBench/components/tenement/index.js
|
||||||
Component({
|
Component({
|
||||||
|
|
||||||
|
@ -34,6 +36,7 @@ Component({
|
||||||
},
|
},
|
||||||
onTenementFocus(e) {
|
onTenementFocus(e) {
|
||||||
const { park } = this.data;
|
const { park } = this.data;
|
||||||
|
const that = this;
|
||||||
if (!park) {
|
if (!park) {
|
||||||
alertInfo("请先选择园区")
|
alertInfo("请先选择园区")
|
||||||
return;
|
return;
|
||||||
|
@ -46,9 +49,21 @@ Component({
|
||||||
},
|
},
|
||||||
async init() {
|
async init() {
|
||||||
|
|
||||||
|
},
|
||||||
|
async getTenementInfo() {
|
||||||
|
const { tenement, park } = this.data;
|
||||||
|
const { code, message, tenement: data } = await getTenementBackInfo(park, tenement)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
tenementInfo: data,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onConfirm(e) {
|
onConfirm(e) {
|
||||||
const { type, data } = e.detail;
|
const { type, data } = e.detail;
|
||||||
|
const that = this;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case "park":
|
case "park":
|
||||||
this.setData({
|
this.setData({
|
||||||
|
@ -57,6 +72,15 @@ Component({
|
||||||
show: false,
|
show: false,
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
|
case "tenement":
|
||||||
|
this.setData({
|
||||||
|
tenement: data.id,
|
||||||
|
tenementName: data.name,
|
||||||
|
show: false,
|
||||||
|
} , () => {
|
||||||
|
that.getTenementInfo();
|
||||||
|
})
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startKh() {
|
startKh() {
|
||||||
|
|
|
@ -37,26 +37,20 @@
|
||||||
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
|
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
|
||||||
<view wx:else>
|
<view wx:else>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{item.tenement.name}}"
|
value="{{tenementInfo.fullName}}"
|
||||||
label="商户名称"
|
label="商户名称"
|
||||||
readonly
|
readonly
|
||||||
title-width="140rpx"
|
title-width="140rpx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<van-field
|
<van-field
|
||||||
value="{{item.meterNo}}"
|
value="{{tenementInfo.shortName}}"
|
||||||
label="商户简称"
|
label="商户简称"
|
||||||
readonly
|
readonly
|
||||||
title-width="140rpx"
|
title-width="140rpx"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{item.address}}"
|
value="{{tenementInfo.phone}}"
|
||||||
label="收费类型"
|
|
||||||
readonly
|
|
||||||
title-width="140rpx"
|
|
||||||
/>
|
|
||||||
<van-field
|
|
||||||
value="{{item.address}}"
|
|
||||||
label="预留电话"
|
label="预留电话"
|
||||||
readonly
|
readonly
|
||||||
title-width="140rpx"
|
title-width="140rpx"
|
||||||
|
|
|
@ -5,7 +5,7 @@ Page({
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
active: 3
|
active: 1
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,4 +68,9 @@ export const getPrivaciList = async function() {
|
||||||
// 获取常见问题
|
// 获取常见问题
|
||||||
export const getQuestionList = async function(page) {
|
export const getQuestionList = async function(page) {
|
||||||
return await GET(`/wx/getQuestions?page=${page}&type=0`);
|
return await GET(`/wx/getQuestions?page=${page}&type=0`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取扫描二维码的列表
|
||||||
|
export const getBackApproveList = async function(tenement, status=0) {
|
||||||
|
return await GET(`/wx/getApproveList?status=${status}&tenement=${tenement}`);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user