暂存商户信息

This commit is contained in:
2025-02-21 15:47:36 +08:00
parent b078bbf26a
commit 93ee759092
26 changed files with 339 additions and 118 deletions

View File

@@ -15,23 +15,14 @@ Component({
onCancel: Function,
park: String,
tenement: String,
parentPhone:String,
parentName:String,
parentId:String,
},
observers: {
"name": function(newValue) {
const newData = this.data;
newData.name = newValue
this.setData({ data: newData })
"parentName,parentId,parentPhone": function(newName, newId, newPhone) {
this.setData({ data: { name: newName, id: newId, phone: newPhone } })
},
"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 })
}
},
/**
* 组件的初始数据
@@ -45,7 +36,7 @@ Component({
*/
methods: {
async onSubmit() {
const { data = {}, tenement, park } = this.data;
const { data = {}, tenement, park, editType } = this.data;
if (!data.phone) {
alertInfo("请输入手机号")
return
@@ -54,18 +45,20 @@ Component({
alertInfo("请输入昵称")
return
}
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
if (code !== OK) {
alertInfo(message)
this.triggerEvent("cancel")
if (editType === 'add') {
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
if (code !== OK) {
alertInfo(message)
this.triggerEvent("cancel")
return;
}
alertSuccess("操作成功")
this.triggerEvent("ok")
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;

View File

@@ -69,7 +69,7 @@ Component({
break;
}
},
onConcal() {
onCancel() {
this.setData({
show: false,
})
@@ -133,21 +133,22 @@ Component({
},
handleChangeMain() {
const { list = [] } = this.data;
const main = list?.find(item => item.isAdmin)
const main = list?.find(item => item.Permissions)
if (!main) {
alertInfo("没有主账号")
return
}
console.log("main", main)
this.setData({
visible: true,
type: "update",
title: "编辑管理员",
phone: main.phone,
name: main.name,
id: main.id,
phone: main.WechatPhone,
name: main.WechatUserName,
id: main.WechatUserID,
})
},
handleCancel() {
console.log("-------------")
this.setData({
visible: false,
type: "",

View File

@@ -11,7 +11,6 @@
"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",
"van-tag": "@vant/weapp/tag/index"
"edit-modal": "./components/editModal/index"
}
}

View File

@@ -66,10 +66,10 @@
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
<view class="tr">
<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: 200rpx"> {{ item.WechatUserName }} </view>
<view class="th" style="width: 300rpx"> {{ item.WechatPhone }} </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 class="primaryTextBtn" bind:tap="handleDelete" data-id="{{item.WechatUserID}}" data-name="{{item.WechatUserName}}" wx:if="{{!item.Permissions}}">
移除
</view>
<van-tag type="primary" wx:else>管理员</van-tag>
@@ -83,7 +83,7 @@
</view>
<empty wx:else bind:refresh="initUserList" />
{{phone}} {{name}}
</view>
<search-select
show="{{show}}"
@@ -92,7 +92,7 @@
park="{{park}}"
isBack="{{true}}"
bindconfirm="onConfirm"
bindcancel="onConcal"
bindcancel="onCancel"
/>
<edit-modal
visible="{{visible}}"
@@ -100,6 +100,9 @@
title="{{title}}"
tenement="{{tenement}}"
park="{{park}}"
parentPhone="{{phone}}"
parentName="{{name}}"
parentId="{{id}}"
bind:ok="onEditConfirm"
bind:cancel="handleCancel"
/>