暂存账号管理
This commit is contained in:
parent
16a03fbb4b
commit
b078bbf26a
|
@ -60,7 +60,12 @@ Component({
|
|||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
const { list = [], type } = this.data;
|
||||
console.log("index", index)
|
||||
const item = list[index];
|
||||
if (!item) {
|
||||
alertInfo("请选择一项")
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
|
@ -134,7 +139,7 @@ Component({
|
|||
},
|
||||
async onSearchBuilding() {
|
||||
const { park } = this.data;
|
||||
const { code, message, data = [] } = await getParkBuildingList(park);
|
||||
const { code, message, buildings: data = [] } = await getParkBuildingList(park);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
|
|
|
@ -16,12 +16,28 @@ Component({
|
|||
park: 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: { name: "", phone: "" }
|
||||
data: { name: "", phone: "", id: "" }
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -42,6 +58,7 @@ Component({
|
|||
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
this.triggerEvent("cancel")
|
||||
return;
|
||||
}
|
||||
alertSuccess("操作成功")
|
||||
|
@ -55,6 +72,9 @@ Component({
|
|||
this.setData({
|
||||
data: newData,
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
this.triggerEvent("cancel")
|
||||
}
|
||||
}
|
||||
})
|
|
@ -5,6 +5,7 @@
|
|||
show="{{ visible }}"
|
||||
show-cancel-button
|
||||
bind:confirm="onSubmit"
|
||||
bind:cancel="onCancel"
|
||||
>
|
||||
<view class="modalContentWrapper">
|
||||
<van-field
|
||||
|
|
|
@ -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: "",
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
|
@ -11,6 +11,7 @@
|
|||
"van-radio": "@vant/weapp/radio/index",
|
||||
"van-radio-group": "@vant/weapp/radio-group/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">
|
||||
<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 wx:if="{{list.length}}">
|
||||
<view class="tableWrapper">
|
||||
|
@ -58,20 +58,21 @@
|
|||
<view class="thead">
|
||||
<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: 100rpx"> 操作 </view>
|
||||
</view>
|
||||
<view class="tbody">
|
||||
<van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
|
||||
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
|
||||
<view class="tr">
|
||||
<view class="th" style="width: 200rpx"> {{ index }} </view>
|
||||
<view class="th" style="width: 200rpx"> {{ item.tenement.shortName }} </view>
|
||||
<view class="th" style="width: 200rpx"> {{ item.money }} </view>
|
||||
<view class="th" style="width: 200rpx">
|
||||
<view class="primaryTextBtn" bind:tap="handleDelete" data-id="{{item.id}}">
|
||||
<view class="th" style="width: 70rpx"> {{ itemIndex + 1 }} </view>
|
||||
<view class="th" style="width: 200rpx"> {{ item.name }} </view>
|
||||
<view class="th" style="width: 300rpx"> {{ item.phone }} </view>
|
||||
<view class="th" style="width: 100rpx; display: flex;">
|
||||
<view class="primaryTextBtn" bind:tap="handleDelete" data-id="{{item.id}}" data-name="{{item.name}}" wx:if="{{!item.isAdmin}}">
|
||||
移除
|
||||
</view>
|
||||
<van-tag type="primary" wx:else>管理员</van-tag>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
@ -81,7 +82,7 @@
|
|||
</view>
|
||||
|
||||
</view>
|
||||
<empty bind:refresh="initUserList" />
|
||||
<empty wx:else bind:refresh="initUserList" />
|
||||
|
||||
</view>
|
||||
<search-select
|
||||
|
@ -99,5 +100,6 @@
|
|||
title="{{title}}"
|
||||
tenement="{{tenement}}"
|
||||
park="{{park}}"
|
||||
bind:ok="initUserList"
|
||||
bind:ok="onEditConfirm"
|
||||
bind:cancel="handleCancel"
|
||||
/>
|
|
@ -3,3 +3,47 @@
|
|||
.operateBox {
|
||||
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 { getTenementBackInfo, } from "../../../../service/tenement"
|
||||
import request from "../../../../utils/request"
|
||||
const { OK } = request
|
||||
// pages/workBench/components/tenement/index.js
|
||||
Component({
|
||||
|
||||
|
@ -34,6 +36,7 @@ Component({
|
|||
},
|
||||
onTenementFocus(e) {
|
||||
const { park } = this.data;
|
||||
const that = this;
|
||||
if (!park) {
|
||||
alertInfo("请先选择园区")
|
||||
return;
|
||||
|
@ -46,9 +49,21 @@ Component({
|
|||
},
|
||||
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) {
|
||||
const { type, data } = e.detail;
|
||||
const that = this;
|
||||
switch(type) {
|
||||
case "park":
|
||||
this.setData({
|
||||
|
@ -57,6 +72,15 @@ Component({
|
|||
show: false,
|
||||
})
|
||||
break;
|
||||
case "tenement":
|
||||
this.setData({
|
||||
tenement: data.id,
|
||||
tenementName: data.name,
|
||||
show: false,
|
||||
} , () => {
|
||||
that.getTenementInfo();
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
startKh() {
|
||||
|
|
|
@ -37,26 +37,20 @@
|
|||
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
|
||||
<view wx:else>
|
||||
<van-field
|
||||
value="{{item.tenement.name}}"
|
||||
value="{{tenementInfo.fullName}}"
|
||||
label="商户名称"
|
||||
readonly
|
||||
title-width="140rpx"
|
||||
/>
|
||||
|
||||
<van-field
|
||||
value="{{item.meterNo}}"
|
||||
value="{{tenementInfo.shortName}}"
|
||||
label="商户简称"
|
||||
readonly
|
||||
title-width="140rpx"
|
||||
/>
|
||||
<van-field
|
||||
value="{{item.address}}"
|
||||
label="收费类型"
|
||||
readonly
|
||||
title-width="140rpx"
|
||||
/>
|
||||
<van-field
|
||||
value="{{item.address}}"
|
||||
value="{{tenementInfo.phone}}"
|
||||
label="预留电话"
|
||||
readonly
|
||||
title-width="140rpx"
|
||||
|
|
|
@ -5,7 +5,7 @@ Page({
|
|||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
active: 3
|
||||
active: 1
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,3 +69,8 @@ export const getPrivaciList = async function() {
|
|||
export const getQuestionList = async function(page) {
|
||||
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