暂存商户信息
This commit is contained in:
@@ -31,5 +31,8 @@ Component({
|
||||
type: 'meter'
|
||||
})
|
||||
},
|
||||
onClose() {
|
||||
this.triggerEvent("close")
|
||||
}
|
||||
}
|
||||
})
|
@@ -5,6 +5,7 @@
|
||||
show="{{ show }}"
|
||||
show-cancel-button
|
||||
bind:confirm="onSubmit"
|
||||
bind:close="onClose"
|
||||
>
|
||||
<view class="modalContentWrapper">
|
||||
<van-field
|
||||
|
@@ -70,5 +70,5 @@
|
||||
type="{{type}}"
|
||||
park="{{park}}"
|
||||
bindconfirm="onConfirm"
|
||||
bindcancel="onConcal"
|
||||
bindcancel="onCancel"
|
||||
/>
|
@@ -1,6 +1,9 @@
|
||||
// pages/workBench/components/tenement/components/kaihu/index.js
|
||||
import { alertInfo } from "../../../../../../utils/index"
|
||||
|
||||
import { alertInfo, alertSuccess } from "../../../../../../utils/index"
|
||||
import { createBackTenement, updateTenementBackInfo } from "../../../../../../service/tenement"
|
||||
import request from "../../../../../../utils/request"
|
||||
import { payWays, feeType as feeTypeList } from "../../../../../../utils/data";
|
||||
const { OK } = request;
|
||||
Component({
|
||||
|
||||
/**
|
||||
@@ -9,14 +12,21 @@ Component({
|
||||
properties: {
|
||||
park: String,
|
||||
visible: Boolean,
|
||||
defaultValue: Object,
|
||||
editType: String,
|
||||
title: String,
|
||||
},
|
||||
observers: {
|
||||
'defaultValue': function(defaultValue) {
|
||||
const { fullName, shortName, phone, id, feeType, address, building, buildingName, contact,} = defaultValue;
|
||||
this.setData({
|
||||
name: fullName,
|
||||
shortName,
|
||||
phone, id, feeType, address, building, buildingName, contact,
|
||||
feeTypeName: feeTypeList[feeType]
|
||||
})
|
||||
}
|
||||
},
|
||||
// observers: {
|
||||
// 'visible': function(newVisible) {
|
||||
// this.setData({
|
||||
// show: newVisible
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
@@ -48,10 +58,67 @@ Component({
|
||||
}
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "建筑",
|
||||
type: 'building'
|
||||
title: "收费类型",
|
||||
type: 'feeType'
|
||||
})
|
||||
},
|
||||
onConfirm(e) {
|
||||
const { type, data, way } = e.detail;
|
||||
switch(type) {
|
||||
case "building":
|
||||
this.setData({
|
||||
building: data.id,
|
||||
buildingName: data.name,
|
||||
show: false,
|
||||
})
|
||||
return;
|
||||
case "feeType":
|
||||
this.setData({
|
||||
feeTypeName: data,
|
||||
feeType: way,
|
||||
show: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.setData({ show: false })
|
||||
},
|
||||
onClose() {
|
||||
this.triggerEvent("close")
|
||||
},
|
||||
onChange(e) {
|
||||
const { name } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
[name]: e.detail
|
||||
})
|
||||
},
|
||||
clear() {
|
||||
this.setData({
|
||||
name: "", shortName: "", address: "", contact: "", phone: "",
|
||||
building: "", feeType: "", buildingName: "", feeTypeName: "", id,
|
||||
})
|
||||
},
|
||||
async onSubmit() {
|
||||
const { name, shortName, address, contact, phone, building, feeType, park, editType, id } = this.data;
|
||||
if (editType === "add") {
|
||||
const { code, message } = await createBackTenement(park, { name, shortName, address, contact, phone, building, feeType })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("开户成功")
|
||||
this.triggerEvent("ok")
|
||||
return;
|
||||
}
|
||||
const { code, message } = await updateTenementBackInfo(park, id, { name, shortName, address, contact, phone, building, feeType })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
alertSuccess("编辑成功")
|
||||
this.triggerEvent("ok")
|
||||
}
|
||||
},
|
||||
|
||||
})
|
@@ -1,56 +1,73 @@
|
||||
<!--pages/workBench/components/tenement/components/kaihu/index.wxml-->
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="开户"
|
||||
title="{{title}}"
|
||||
show="{{ visible }}"
|
||||
show-cancel-button
|
||||
bind:close="onClose"
|
||||
bind:confirm="onSubmit"
|
||||
>
|
||||
<view class="modalContentWrapper">
|
||||
<van-field
|
||||
value=""
|
||||
value="{{name}}"
|
||||
data-name="name"
|
||||
bind:change="onChange"
|
||||
label="商户全称"
|
||||
type="textarea"
|
||||
placeholder="请输入商户全称"
|
||||
autosize="{{true}}"
|
||||
title-width="132rpx"
|
||||
required
|
||||
/>
|
||||
<van-field
|
||||
value=""
|
||||
value="{{shortName}}"
|
||||
data-name="shortName"
|
||||
bind:change="onChange"
|
||||
label="商户简称"
|
||||
placeholder="请输入商户简称"
|
||||
type="textarea"
|
||||
autosize="{{true}}"
|
||||
title-width="132rpx"
|
||||
/>
|
||||
<van-field
|
||||
value=""
|
||||
value="{{address}}"
|
||||
data-name="address"
|
||||
bind:change="onChange"
|
||||
label="联系地址"
|
||||
placeholder="请输入联系地址"
|
||||
type="textarea"
|
||||
autosize="{{true}}"
|
||||
title-width="132rpx"
|
||||
required
|
||||
/>
|
||||
<van-field
|
||||
value=""
|
||||
value="{{contact}}"
|
||||
data-name="contact"
|
||||
bind:change="onChange"
|
||||
label="联系人"
|
||||
placeholder="请输入联系人"
|
||||
type="textarea"
|
||||
autosize="{{true}}"
|
||||
title-width="132rpx"
|
||||
required
|
||||
/>
|
||||
<van-field
|
||||
value=""
|
||||
value="{{phone}}"
|
||||
data-name="phone"
|
||||
bind:change="onChange"
|
||||
label="联系电话"
|
||||
placeholder="请输入联系电话"
|
||||
type="textarea"
|
||||
autosize="{{true}}"
|
||||
title-width="132rpx"
|
||||
required
|
||||
/>
|
||||
<van-field
|
||||
value="{{ meterName }}"
|
||||
value="{{ buildingName }}"
|
||||
placeholder="请选择建筑"
|
||||
label="建筑"
|
||||
use-button-slot
|
||||
readonly
|
||||
title-width="120rpx"
|
||||
>
|
||||
<van-button slot="button" size="small" type="primary" bind:click="onBuildingFocus">
|
||||
@@ -58,9 +75,10 @@
|
||||
</van-button>
|
||||
</van-field>
|
||||
<van-field
|
||||
value="{{ meterName }}"
|
||||
value="{{ feeTypeName }}"
|
||||
placeholder="请选择收费类型"
|
||||
label="收费类型"
|
||||
readonly
|
||||
use-button-slot
|
||||
title-width="120rpx"
|
||||
>
|
||||
@@ -77,5 +95,5 @@
|
||||
type="{{type}}"
|
||||
park="{{park}}"
|
||||
bindconfirm="onConfirm"
|
||||
bindcancel="onConcal"
|
||||
bindcancel="onCancel"
|
||||
/>
|
Reference in New Issue
Block a user