工作台修改

This commit is contained in:
2025-09-19 17:34:28 +08:00
parent 9b00bb3561
commit d4f357d624
63 changed files with 3615 additions and 15 deletions

View File

@@ -0,0 +1,74 @@
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
Component({
/**
* 组件的属性列表
*/
properties: {
type: String,
title: String,
visible: Boolean,
onCancel: Function,
park: String,
tenement: String,
parentPhone:String,
parentName:String,
parentId:String,
},
observers: {
"parentName,parentId,parentPhone": function(newName, newId, newPhone) {
this.setData({ data: { name: newName, id: newId, phone: newPhone } })
},
},
/**
* 组件的初始数据
*/
data: {
data: { name: "", phone: "", id: "" }
},
/**
* 组件的方法列表
*/
methods: {
async onSubmit() {
const { data = {}, tenement, park, type } = this.data;
if (!data.phone) {
alertInfo("请输入手机号")
return
}
if (!data.name) {
alertInfo("请输入昵称")
return
}
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
if (code !== OK) {
alertInfo(message)
this.triggerEvent("cancel")
return;
}
alertSuccess("操作成功")
this.triggerEvent("ok")
this.setData({ data: {} })
return;
},
onChange(e) {
const { name } = e.currentTarget.dataset;
const newData = this.data.data;
newData[name] = e.detail;
this.setData({
data: newData,
})
},
onCancel() {
this.setData({ data: {} })
this.triggerEvent("cancel")
}
}
})

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index"
}
}

View File

@@ -0,0 +1,34 @@
<!--pages/workBench/components/account/components/editModal/index.wxml-->
<van-dialog
use-slot
title="{{title}}"
show="{{ visible }}"
show-cancel-button
bind:confirm="onSubmit"
bind:cancel="onCancel"
>
<view class="modalContentWrapper">
<van-field
value="{{data.name}}"
label="昵称"
placeholder="请输入昵称"
type="textarea"
autosize="{{true}}"
title-width="120rpx"
border="{{false}}"
data-name="name"
bind:change="onChange"
/>
<van-field
value="{{ data.phone }}"
placeholder="请输入手机号"
label="手机号"
border="{{ false }}"
title-width="120rpx"
data-name="phone"
bind:change="onChange"
>
</van-field>
</view>
</van-dialog>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/account/components/editModal/index.wxss */

View File

@@ -0,0 +1,68 @@
// pages/workBench/components/account/components/updatePhoneModa/index.js
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
import { updateAdminPhone } from "../../../../../../service/tenement";
import request from "../../../../../../utils/request"
const { OK } = request
Component({
/**
* 组件的属性列表
*/
properties: {
type: String,
title: String,
visible: Boolean,
onCancel: Function,
park: String,
tenement: String,
parentPhone:String,
parentName:String,
parentId:String,
},
observers: {
"parentPhone": function (newPhone) {
this.setData({ phone: newPhone })
}
},
/**
* 组件的初始数据
*/
data: {
phone: "",
},
/**
* 组件的方法列表
*/
methods: {
async onSubmit() {
const { phone, tenement, park, type } = this.data;
if (!phone) {
alertInfo("请输入手机号")
return
}
const { code, message } = await updateAdminPhone({tenement, phone: phone })
if (code !== OK) {
alertInfo(message)
this.triggerEvent("cancel")
return;
}
alertSuccess("操作成功")
this.triggerEvent("ok")
this.setData({ phone: "" })
return;
},
onChange(e) {
this.setData({
phone: e.detail,
})
},
onCancel() {
this.setData({ phone: "" })
this.triggerEvent("cancel")
}
}
})

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index"
}
}

View File

@@ -0,0 +1,23 @@
<!--pages/workBench/components/account/components/updatePhoneModa/index.wxml-->
<van-dialog
use-slot
title="编辑管理员手机号"
show="{{ visible }}"
show-cancel-button
bind:confirm="onSubmit"
bind:cancel="onCancel"
>
<view class="modalContentWrapper">
<van-field
value="{{ phone }}"
placeholder="请输入新管理员手机号"
label="手机号"
border="{{ false }}"
title-width="120rpx"
data-name="phone"
bind:change="onChange"
>
</van-field>
</view>
</van-dialog>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/account/components/updatePhoneModa/index.wxss */

View File

@@ -0,0 +1,224 @@
// pages/workBenchNew/components/workBenchWxUser/index.js
import request from "../../../../utils/request"
import { getTenementBackInfo, updateUserApp} from "../../../../service/tenement"
import { getBackApproveList, removeUser } from "../../../../service/user"
import { alertInfo, alertSuccess, wxModal } from "../../../../utils/index"
const { OK } = request
Page({
/**
* 页面的初始数据
*/
data: {
list: [],
tenementInfo: {},
},
onParkFocus(e) {
this.setData({
show: true,
title: "园区",
type: 'park'
})
},
onTenementFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "商户",
type: 'tenement'
})
},
onConfirm(e) {
const that = this;
const { type, data } = e.detail;
switch(type) {
case "park":
this.setData({
park: data.id,
parkName: data.name,
show: false,
})
break;
case "tenement":
this.setData({
tenement: data.id,
tenementName: data.name,
show: false,
}, () => {
that.initUserList();
that.getTenementInfo();
})
break;
}
},
async setAdmin(e) {
const { id, name } = e.currentTarget.dataset;
const { tenement } = this.data;
await wxModal({ content: `确认要将${name}设置为管理吗?` })
const { code, message } = await updateUserApp({ userId: id, type: 2, tenement: tenement })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("转交成功")
this.initUserList();
this.getTenementInfo();
},
onCancel() {
this.setData({
show: false,
})
},
handleDelete(e) {
const { id, name } = e.currentTarget.dataset;
const { tenement } = this.data;
const that = this;
wx.showModal({
title: '提示',
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();
},
onUpdatePhoneConfirm() {
this.setData({ parentPhone: "", phone: "", type: "", title: "" })
this.getTenementInfo();
this.initUserList()
},
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 { tenement } = this.data;
const { code, message, data } = await getBackApproveList(tenement, 1);
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data,
})
},
handleAddSon() {
this.setData({
visible: true,
type: "add",
title: "新建子账号"
})
},
handleChangeMain() {
const { tenementInfo = {} } = this.data;
this.setData({
updatePhoneVisible: true,
type: "update",
title: "编辑管理员",
parentPhone: tenementInfo.phone,
// name: main.WechatUserName,
// id: main.WechatUserID,
})
},
handleUpdatePhoneCancel() {
this.setData({
updatePhoneVisible: false,
type: "",
phone: "",
parentPhone: "",
name: "",
id: "",
})
},
handleCancel() {
this.setData({
visible: false,
type: "",
phone: "",
name: "",
id: "",
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,22 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"search-select": "/components/searchSelect/index",
"van-empty": "@vant/weapp/empty/index",
"table": "/components/table/table",
"pagination": "/components/pagination/index",
"empty": "/components/empty/index",
"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",
"updatePhoneModal": "./components/updatePhoneModal/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"searchSelectWrapper": "/components/searchSelectWrapper/index",
"van-image": "@vant/weapp/image/index",
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,143 @@
<!--pages/workBench/components/account/index.wxml-->
<navigator title="C端账号" canBack="{{true}}" />
<view>
<searchSelectWrapper
label="园区"
placeholder="请选择园区"
text="{{ parkName }}"
bind:search="onParkFocus"
/>
<searchSelectWrapper
label="商户"
placeholder="请选择商户"
text="{{ tenementName }}"
bind:search="onTenementFocus"
/>
</view>
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
<view wx:else>
<view class="operateBox">
<van-button type="info" size="small" style="margin-right: 20rpx;" bind:click="handleAddSon"> 添加子账号 </van-button>
<van-button type="info" size="small" style="margin-right: 20rpx;" bind:click="handleChangeMain"> 修改主账号 </van-button>
</view>
<view class="customTable">
<view class="customTableTile">
<van-row>
<van-col span="24">
<view class="tableTitleRow">
<view class="tableTitleRow">
<view class="tbody">
<view class="tr">
<view class="th" style="width: 200rpx;text-align: center;"> {{tenementInfo.shortName}} </view>
<view> {{tenementInfo.fullName}} </view>
</view>
</view>
</view>
</view>
</van-col>
<van-col span="24">
<view class="tableTitleRow">
<view class="tbody">
<view class="tr">
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 0}}"
> 华昌宝能收费 </view>
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 1}}"
> 物业代收1 </view>
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 2}}"
> 物业代收2 </view>
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 3}}"
> 物业代收线损 </view>
<view style="margin-left: 26rpx;"> {{tenementInfo.contact}} {{tenementInfo.phone}} </view>
</view>
</view>
</view>
</van-col>
</van-row>
</view>
<view class="customTableContent">
<van-row wx:if="{{list.length}}">
<van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
<view class="tbody">
<view class="tr tableRow">
<view class="th" style="width: 200rpx;border-right: 1rpx solid #ccc;"> {{ item.WechatUserName }} </view>
<view class="th" style="width: 250rpx;border-right: 1rpx solid #ccc;"> {{ item.WechatPhone }} </view>
<view class="th" style="display: flex;">
<view style="margin-left: 16rpx;">
<view wx:if="{{!item.Permissions}}" style="display: inline-block;">
<view
class="primaryTextBtn"
bind:tap="handleDelete"
data-id="{{item.WechatUserID}}"
data-name="{{item.WechatUserName}}"
>
<van-image width="40rpx" height="40rpx" src="/assets/images/stop.png" />
</view>
<view
class="primaryTextBtn"
bind:tap="setAdmin"
data-id="{{item.WechatUserID}}"
data-name="{{item.WechatUserName}}"
style="margin-left: 16rpx;"
>
<van-image width="40rpx" height="40rpx" src="/assets/images/tihuan.png" />
</view>
</view>
<van-tag type="primary" wx:else>管理员</van-tag>
</view>
</view>
</view>
</view>
</block>
</van-radio-group>
</van-row>
<empty wx:else bind:refresh="initUserList" />
</view>
</view>
</view>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
isBack="{{true}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
/>
<edit-modal
visible="{{visible}}"
type="{{type}}"
title="{{title}}"
tenement="{{tenement}}"
park="{{park}}"
parentPhone="{{phone}}"
parentName="{{name}}"
parentId="{{id}}"
bind:ok="onEditConfirm"
bind:cancel="handleCancel"
/>
<updatePhoneModal
visible="{{updatePhoneVisible}}"
tenement="{{tenement}}"
park="{{park}}"
parentPhone="{{parentPhone}}"
bind:ok="onUpdatePhoneConfirm"
bind:cancel="handleUpdatePhoneCancel"
/>

View File

@@ -0,0 +1,71 @@
/* pages/workBench/components/account/index.wxss */
.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;
}
.tr {
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tbody .th {
word-break: break-all;
text-align: center;
}
.primaryTextBtn {
color: #1989fa;
display: inline-block;
}
.customTable {
margin: 20rpx;
font-size: 32rpx;
}
.customTableTile {
background-color: var(--light-green);
box-sizing: border-box;
}
.tableTitleRow {
padding: 16rpx;
font-weight: 700;
}
.tableRow {
padding: 16rpx;
border: 1rpx solid #ccc;
border-top: 0rpx;
}
page {
background-color: rgb(228,240,236);
font-size: 32rpx;
}