准备联调抄表记录
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { getParkList } from "../../service/park"
|
||||
import { getLoginParkList, getParkBuildingList } from "../../service/park"
|
||||
import { getParkSimpleMeterList } from "../../service/meter"
|
||||
import { alertInfo } from "../../utils/index";
|
||||
import request from "../../utils/request"
|
||||
import { payWays } from "../../utils/data";
|
||||
|
||||
import { payWays, feeType } from "../../utils/data";
|
||||
import { getTenementList, getWxTenementList } from "../../service/tenement";
|
||||
const { OK } = request;
|
||||
|
||||
// components/searchSelect/index.js
|
||||
@@ -17,6 +17,7 @@ Component({
|
||||
type: String,
|
||||
show: Boolean,
|
||||
park: String,
|
||||
isBack: Boolean,
|
||||
},
|
||||
observers: {
|
||||
"show,type": function(newShow, newType) {
|
||||
@@ -32,6 +33,7 @@ Component({
|
||||
columns: [],
|
||||
searchText: "",
|
||||
payWays,
|
||||
feeType,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
@@ -60,6 +62,10 @@ Component({
|
||||
const { index } = event.detail;
|
||||
const { list = [], type } = this.data;
|
||||
const item = list[index];
|
||||
if (!item) {
|
||||
alertInfo("请选择一项")
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
@@ -78,6 +84,17 @@ Component({
|
||||
})
|
||||
this.triggerEvent("confirm", { data: item, way: index, type } );
|
||||
},
|
||||
onFeeTypeConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
const { feeType = [], type } = this.data;
|
||||
const item = feeType[index];
|
||||
this.setData({
|
||||
columns: [],
|
||||
list: [],
|
||||
searchText: ""
|
||||
})
|
||||
this.triggerEvent("confirm", { data: item, way: index, type } );
|
||||
},
|
||||
onSearch() {
|
||||
const { type } = this.data;
|
||||
switch(type) {
|
||||
@@ -86,12 +103,18 @@ Component({
|
||||
return;
|
||||
case "meter":
|
||||
this.onSearchMeter();
|
||||
return
|
||||
case "tenement":
|
||||
this.onSearchTenement();
|
||||
return;
|
||||
case "building":
|
||||
this.onSearchBuilding();
|
||||
return;
|
||||
}
|
||||
},
|
||||
async onSearchPark() {
|
||||
const { searchText = "" } = this.data;
|
||||
const { code, message, data: parks = [] } = await getParkList({keyword: searchText});
|
||||
const { code, message, data: parks = [] } = await getLoginParkList({keyword: searchText});
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
@@ -109,9 +132,34 @@ Component({
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`),
|
||||
list: parks,
|
||||
columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`) || [],
|
||||
list: parks || [],
|
||||
})
|
||||
}
|
||||
},
|
||||
async onSearchTenement() {
|
||||
const { searchText = "", park, isBack } = this.data;
|
||||
const { code, message, data = [] } = isBack ? await getWxTenementList({keyword: searchText, park}) : await getTenementList({keyword: searchText, park});
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: data?.length ? data?.map(item => item?.name) : [],
|
||||
list: data,
|
||||
})
|
||||
},
|
||||
async onSearchBuilding() {
|
||||
const { park } = this.data;
|
||||
const { code, message, buildings: data = [] } = await getParkBuildingList(park);
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
columns: data?.length ? data?.map(item => item?.name) : [],
|
||||
list: data,
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -3,11 +3,33 @@
|
||||
show="{{ show }}"
|
||||
bind:click="onClickHide"
|
||||
position="bottom"
|
||||
z-index="100000"
|
||||
wx:if="{{show}}"
|
||||
>
|
||||
<view wx:if="{{type !== 'pay'}}">
|
||||
<view wx:if="{{type === 'pay'}}">
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ payWays }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onPayConfirm"
|
||||
/>
|
||||
</view>
|
||||
<view wx:elif="{{type === 'feeType'}}">
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ feeType }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onFeeTypeConfirm"
|
||||
/>
|
||||
</view>
|
||||
<view wx:elif="{{type !== 'pay'}}">
|
||||
<van-search
|
||||
value="{{ value }}"
|
||||
placeholder="请输入搜索关键词"
|
||||
placeholder="{{type === 'tenement' ? '请输入关键词搜索后选择' : '请输入搜索关键词'}}"
|
||||
use-action-slot
|
||||
bind:change="onChangeSearch"
|
||||
>
|
||||
@@ -26,14 +48,15 @@
|
||||
bind:confirm="onConfirm"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view wx:else>
|
||||
<van-picker
|
||||
custom-style="width: 100%;"
|
||||
columns="{{ payWays }}"
|
||||
columns="{{ columns }}"
|
||||
title="{{title}}"
|
||||
show-toolbar="{{true}}"
|
||||
bind:cancel="onCancel"
|
||||
bind:confirm="onPayConfirm"
|
||||
bind:confirm="onConfirm"
|
||||
/>
|
||||
</view>
|
||||
</van-popup>
|
||||
@@ -1,3 +1 @@
|
||||
/* components/searchSelect/index.wxss */
|
||||
.van-ellipsis van-picker-column__item {
|
||||
}
|
||||
Reference in New Issue
Block a user