暂存工作台的修改

This commit is contained in:
qiaomu 2025-02-20 17:28:45 +08:00
parent 5d617f2282
commit 16a03fbb4b
10 changed files with 126 additions and 48 deletions

View File

@ -3,7 +3,7 @@ import { getParkSimpleMeterList } from "../../service/meter"
import { alertInfo } from "../../utils/index";
import request from "../../utils/request"
import { payWays, feeType } from "../../utils/data";
import { getTenementList } from "../../service/tenement";
import { getTenementList, getWxTenementList } from "../../service/tenement";
const { OK } = request;
// components/searchSelect/index.js
@ -17,6 +17,7 @@ Component({
type: String,
show: Boolean,
park: String,
isBack: Boolean,
},
observers: {
"show,type": function(newShow, newType) {
@ -120,8 +121,8 @@ Component({
})
},
async onSearchTenement() {
const { searchText = "", park } = this.data;
const { code, message, data = [] } = await getTenementList({keyword: searchText, park});
const { searchText = "", park, isBack } = this.data;
const { code, message, data = [] } = isBack ? await getWxTenementList({keyword: searchText, park}) : await getTenementList({keyword: searchText, park});
if (code !== OK) {
alertInfo(message)
return

View File

@ -8,7 +8,7 @@
<view wx:if="{{type !== 'pay'}}">
<van-search
value="{{ value }}"
placeholder="请输入搜索关键词"
placeholder="{{type === 'tenement' ? '请输入关键词搜索后选择' : '请输入搜索关键词'}}"
use-action-slot
bind:change="onChangeSearch"
>

View File

@ -1,4 +1,5 @@
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
import { createTenementWxUser } from "../../../../../../service/tenement";
import request from "../../../../../../utils/request"
const { OK } = request
// pages/workBench/components/account/components/editModal/index.js
@ -11,15 +12,16 @@ Component({
type: String,
title: String,
visible: Boolean,
onOk: Function,
onCancel: Function,
park: String,
tenement: String,
},
/**
* 组件的初始数据
*/
data: {
data: { name: "", phone: "" }
},
/**
@ -27,24 +29,32 @@ Component({
*/
methods: {
async onSubmit() {
const { phone, name } = this.data;
if (!phone) {
const { data = {}, tenement, park } = this.data;
if (!data.phone) {
alertInfo("请输入手机号")
return
}
if (!name) {
if (!data.name) {
alertInfo("请输入昵称")
return
}
// const { code, message } = await update()
// if (code !== OK) {
// alertInfo(message)
// return;
// }
// alertSuccess("操作成功")
// if (this.onOk) {
// this.onOk()
// }
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("操作成功")
this.triggerEvent("ok")
},
onChange(e) {
console.log('e', e)
const { name } = e.currentTarget.dataset;
const newData = this.data.data;
newData[name] = e.detail;
this.setData({
data: newData,
})
}
}
})

View File

@ -8,21 +8,24 @@
>
<view class="modalContentWrapper">
<van-field
value=""
value="{{data.name}}"
label="昵称"
readonly
placeholder="请输入昵称"
type="textarea"
autosize="{{true}}"
title-width="120rpx"
border="{{false}}"
data-name="name"
bind:change="onChange"
/>
<van-field
value="{{ meterName }}"
placeholder="请选择电表"
value="{{ data.phone }}"
placeholder="请输入手机号"
label="手机号"
readonly
border="{{ false }}"
title-width="120rpx"
data-name="phone"
bind:change="onChange"
>
</van-field>
</view>

View File

@ -1,4 +1,9 @@
// pages/workBench/components/account/index.js
import request from "../../../../utils/request"
import { getTenementBackInfo, getTenementUsers } from "../../../../service/tenement"
import { alertInfo } from "../../../../utils/index"
const { OK } = request
Component({
/**
@ -12,7 +17,8 @@ Component({
* 组件的初始数据
*/
data: {
list: [],
tenementInfo: {},
},
/**
@ -39,6 +45,7 @@ Component({
})
},
onConfirm(e) {
const that = this;
const { type, data } = e.detail;
switch(type) {
case "park":
@ -53,10 +60,18 @@ Component({
tenement: data.id,
tenementName: data.name,
show: false,
}, () => {
that.initUserList();
that.getTenementInfo();
})
break;
}
},
onConcal() {
this.setData({
show: false,
})
},
handleDelete(e) {
const {} = e;
wx.showModal({
@ -73,9 +88,34 @@ Component({
}
})
},
async init() {
const { tenementName } = this.data;
const { code, message, data } = await
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,
})
},
async initUserList() {
const { tenementName, park } = this.data;
const { code, message, data } = await getTenementUsers({ park, keyword: tenementName });
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data,
})
},
handleAddSon() {
this.setData({
visible: true,
type: "add",
title: "新建子账号"
})
}
}
})

View File

@ -30,30 +30,28 @@
<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"
/>
<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>
</view>
<view wx:if="{{list.length}}">
<view class="tableWrapper">
<view class="table">
@ -81,18 +79,25 @@
</view>
</view>
</view>
<view class="operateBox">
<van-button type="primary" size="small" style="margin-right: 20rpx;"> 添加子账号 </van-button>
<van-button type="primary" size="small" style="margin-right: 20rpx;"> 修改主账号 </van-button>
</view>
</view>
<empty bind:refresh="initUserList" />
</view>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
isBack="{{true}}"
bindconfirm="onConfirm"
bindcancel="onConcal"
/>
<kaihu park="{{park}}" visible="{{kaihuVisible}}" />
<edit-modal
visible="{{visible}}"
type="{{type}}"
title="{{title}}"
tenement="{{tenement}}"
park="{{park}}"
bind:ok="initUserList"
/>

View File

@ -1 +1,5 @@
/* pages/workBench/components/account/index.wxss */
/* pages/workBench/components/account/index.wxss */
.operateBox {
margin: 20rpx;
}

View File

@ -5,6 +5,6 @@
bind:change="handleChange"
/>
<approve status="{{1}}" wx:if="{{active === 0}}" />
<approve status="{{2}}" wx:if="{{active === 1}}" />
<approve status="{{2}}" wx:if="{{active === 0}}" />
<approve status="{{1}}" wx:if="{{active === 1}}" />
<recharge wx:if="{{active === 2}}" />

View File

@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
active: 2
active: 3
},
/**

View File

@ -7,6 +7,11 @@ export const getTenementList = async function({ park, keyword }) {
return await GET(`/wx/getTenementList?park=${park}&keyword=${replaceSpecialIcon(keyword)}`);
}
// 后台用户获取园区id模糊搜索商户列表
export const getWxTenementList = async function({ park, keyword }) {
return await GET(`/vx/getTenementList?park=${park}&keyword=${replaceSpecialIcon(keyword)}`);
}
// 获取名下所有的商户
export const getOwnTenementList = async function() {
return await GET(`/wx/getOwnTenements`);
@ -40,6 +45,16 @@ export const unbindMeter = async function(pid, tid, code) {
}
// 获取b端用户
export const getTenementUsers = async function(id) {
return await GET(`/records/getWxUserList`);
}
export const getTenementUsers = async function({ park, keyword }) {
return await GET(`/records/getWxUserList?park=${park}&keyword=${keyword}`);
}
// c端获取指定商户的详细信息
export const getTenementBackInfo = async (pid, tid) => {
return await GET(`/vx/${pid}/${tid}`);
}
// 新增用户
export const createTenementWxUser = async function(data) {
return await POST(`/wx/createUser`, data)
}