暂存商户信息

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;