工作台代码提交
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
// pages/workBenchNew/components/kaihu/index.js
|
||||
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;
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -7,7 +12,85 @@ Page({
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
onParkFocus(e) {
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "园区",
|
||||
type: 'park'
|
||||
})
|
||||
},
|
||||
onBuildingFocus() {
|
||||
const { park } = this.data;
|
||||
if (!park) {
|
||||
alertInfo("请先选择园区")
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "建筑",
|
||||
type: 'building'
|
||||
})
|
||||
},
|
||||
onChange(e) {
|
||||
const { name } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
[name]: e.detail
|
||||
})
|
||||
},
|
||||
onFeeTypeFocus() {
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "收费类型",
|
||||
type: 'feeType'
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
this.setData({ show: false })
|
||||
},
|
||||
async onSubmit() {
|
||||
const { name, shortName, address, contact,
|
||||
phone, building, feeType, park, editType, id, parkName,
|
||||
|
||||
} = this.data;
|
||||
const { code, message } = await createBackTenement(park, { name, shortName, address, contact, phone, building, feeType })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("开户成功")
|
||||
// wx.navigateBack()
|
||||
wx.redirectTo({
|
||||
url: `/pages/workBenchNew/components/workBenchTenement/index?park=${park}&parkName=${parkName}&name=${name}`,
|
||||
})
|
||||
},
|
||||
handleBack() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
onConfirm(e) {
|
||||
const { type, data, way } = e.detail;
|
||||
switch(type) {
|
||||
case "park":
|
||||
this.setData({
|
||||
park: data.id,
|
||||
parkName: data.name,
|
||||
show: false,
|
||||
})
|
||||
return;
|
||||
case "building":
|
||||
this.setData({
|
||||
building: data.id,
|
||||
buildingName: data.name,
|
||||
show: false,
|
||||
})
|
||||
return;
|
||||
case "feeType":
|
||||
this.setData({
|
||||
feeTypeName: data,
|
||||
feeType: way,
|
||||
show: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
<!--pages/workBenchNew/components/kaihu/index.wxml-->
|
||||
<navigator canBack="{{true}}" title="开户" />
|
||||
<view class="modalContentWrapper">
|
||||
<van-field
|
||||
value="{{ parkName }}"
|
||||
placeholder="请选择园区"
|
||||
label="园区"
|
||||
use-button-slot
|
||||
readonly
|
||||
title-width="120rpx"
|
||||
required
|
||||
>
|
||||
<van-button slot="button" size="small" type="info" bind:click="onParkFocus">
|
||||
选择
|
||||
</van-button>
|
||||
</van-field>
|
||||
<van-field
|
||||
value="{{name}}"
|
||||
data-name="name"
|
||||
@@ -80,4 +93,19 @@
|
||||
选择
|
||||
</van-button>
|
||||
</van-field>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operate">
|
||||
<view style="margin-top: 60rpx; margin-bottom: 60rpx;display: flex; justify-content: center; align-items: center;">
|
||||
<van-button type="info" size="small" style="margin-right: 30rpx;" bind:click="onSubmit" data-status="0"> 保存 </van-button>
|
||||
<van-button size="small" bind:click="handleBack" data-status="1"> 返回 </van-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<search-select
|
||||
show="{{show}}"
|
||||
title="{{title}}"
|
||||
type="{{type}}"
|
||||
park="{{park}}"
|
||||
bindconfirm="onConfirm"
|
||||
bindcancel="onCancel"
|
||||
/>
|
||||
Reference in New Issue
Block a user