调整手动绑定样式
This commit is contained in:
parent
b3358ef4ec
commit
4ecf443f89
|
@ -3,7 +3,7 @@ import { getParkSimpleMeterList } from "../../service/meter"
|
||||||
import { alertInfo } from "../../utils/index";
|
import { alertInfo } from "../../utils/index";
|
||||||
import request from "../../utils/request"
|
import request from "../../utils/request"
|
||||||
import { payWays } from "../../utils/data";
|
import { payWays } from "../../utils/data";
|
||||||
|
import { getTenementList } from "../../service/tenement";
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
|
|
||||||
// components/searchSelect/index.js
|
// components/searchSelect/index.js
|
||||||
|
@ -86,6 +86,8 @@ Component({
|
||||||
return;
|
return;
|
||||||
case "meter":
|
case "meter":
|
||||||
this.onSearchMeter();
|
this.onSearchMeter();
|
||||||
|
case "tenement":
|
||||||
|
this.onSearchTenement();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -112,6 +114,18 @@ Component({
|
||||||
columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`),
|
columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`),
|
||||||
list: parks,
|
list: parks,
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
async onSearchTenement() {
|
||||||
|
const { searchText = "", park } = this.data;
|
||||||
|
const { code, message, data = [] } = await getTenementList({keyword: searchText, park});
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
columns: data?.map(item => item?.name),
|
||||||
|
list: data,
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -93,6 +93,25 @@ Page({
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onParkFocus(e) {
|
||||||
|
this.setData({
|
||||||
|
show: true,
|
||||||
|
title: "园区",
|
||||||
|
type: 'park'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onTenementFocus(e) {
|
||||||
|
const { park } = this.data;
|
||||||
|
if (!park) {
|
||||||
|
alertInfo("请先选择园区")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
show: true,
|
||||||
|
title: "公司",
|
||||||
|
type: 'tenement'
|
||||||
|
})
|
||||||
|
},
|
||||||
scan() {
|
scan() {
|
||||||
wx.scanCode({
|
wx.scanCode({
|
||||||
scanType: "qrCode",
|
scanType: "qrCode",
|
||||||
|
@ -108,4 +127,29 @@ Page({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onConfirm(e) {
|
||||||
|
console.log('e', e.detail)
|
||||||
|
const { type, data = {} } = e.detail;
|
||||||
|
switch(type) {
|
||||||
|
case "park":
|
||||||
|
this.setData({
|
||||||
|
park: data.id,
|
||||||
|
parkName: data.name,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case "tenement":
|
||||||
|
this.setData({
|
||||||
|
tenement: data.id,
|
||||||
|
tenementName: data.name,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.onConcal();
|
||||||
|
},
|
||||||
|
onConcal() {
|
||||||
|
this.setData({
|
||||||
|
show: false,
|
||||||
|
title: "",
|
||||||
|
type: "",
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
|
@ -2,6 +2,7 @@
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"topbar": "/components/topbar/index",
|
"topbar": "/components/topbar/index",
|
||||||
"select": "/components/select/index",
|
"select": "/components/select/index",
|
||||||
|
"search-select": "/components/searchSelect/index",
|
||||||
"van-button": "@vant/weapp/button/index",
|
"van-button": "@vant/weapp/button/index",
|
||||||
"van-field": "@vant/weapp/field/index",
|
"van-field": "@vant/weapp/field/index",
|
||||||
"van-icon": "@vant/weapp/icon/index",
|
"van-icon": "@vant/weapp/icon/index",
|
||||||
|
|
|
@ -17,8 +17,34 @@
|
||||||
</van-tab>
|
</van-tab>
|
||||||
<van-tab title="手动绑定">
|
<van-tab title="手动绑定">
|
||||||
<view>
|
<view>
|
||||||
<select label="园区" type="0" bind:choose="onChoosePark" park="{{park}}" parkName="{{parkName}}" required="{{true}}" />
|
<!-- <select label="园区" type="0" bind:choose="onChoosePark" park="{{park}}" parkName="{{parkName}}" required="{{true}}" />
|
||||||
<select label="公司名称" type="1" bind:choose="onChooseTenement" park="{{park}}" tenement="{{tenement}}" tenementName="{{tenementName}}" required="{{true}}" />
|
<select label="公司名称" type="1" bind:choose="onChooseTenement" park="{{park}}" tenement="{{tenement}}" tenementName="{{tenementName}}" required="{{true}}" /> -->
|
||||||
|
<van-field
|
||||||
|
required
|
||||||
|
value="{{ parkName }}"
|
||||||
|
label="园区"
|
||||||
|
placeholder="请选择园区"
|
||||||
|
border="{{ true }}"
|
||||||
|
readonly
|
||||||
|
use-button-slot
|
||||||
|
>
|
||||||
|
<van-button slot="button" size="small" type="primary" bind:click="onParkFocus">
|
||||||
|
选择
|
||||||
|
</van-button>
|
||||||
|
</van-field>
|
||||||
|
<van-field
|
||||||
|
required
|
||||||
|
value="{{ tenementName }}"
|
||||||
|
label="园区"
|
||||||
|
placeholder="请选择商户"
|
||||||
|
border="{{ true }}"
|
||||||
|
readonly
|
||||||
|
use-button-slot
|
||||||
|
>
|
||||||
|
<van-button slot="button" size="small" type="primary" bind:click="onTenementFocus">
|
||||||
|
选择
|
||||||
|
</van-button>
|
||||||
|
</van-field>
|
||||||
<van-field
|
<van-field
|
||||||
required
|
required
|
||||||
value="{{ phone }}"
|
value="{{ phone }}"
|
||||||
|
@ -49,3 +75,13 @@
|
||||||
</view>
|
</view>
|
||||||
</van-tab>
|
</van-tab>
|
||||||
</van-tabs>
|
</van-tabs>
|
||||||
|
|
||||||
|
<search-select
|
||||||
|
show="{{show}}"
|
||||||
|
title="{{title}}"
|
||||||
|
type="{{type}}"
|
||||||
|
park="{{park}}"
|
||||||
|
bindconfirm="onConfirm"
|
||||||
|
bindcancel="onConcal"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
"condition": {
|
"condition": {
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"list": [
|
||||||
|
{
|
||||||
|
"name": "pages/handleLogin/index",
|
||||||
|
"pathName": "pages/handleLogin/index",
|
||||||
|
"query": "",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "pages/ticket/index",
|
"name": "pages/ticket/index",
|
||||||
"pathName": "pages/ticket/index",
|
"pathName": "pages/ticket/index",
|
||||||
|
|
|
@ -225,17 +225,8 @@ export const wxModal = (data) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const getPixelRatio = () => {
|
export const getPixelRatio = () => {
|
||||||
let pixelRatio = 0
|
return wx.getSystemInfoSync()?. pixelRatio
|
||||||
wx.getSystemInfo({
|
|
||||||
success: function (res) {
|
|
||||||
pixelRatio = res.pixelRatio
|
|
||||||
},
|
|
||||||
fail: function () {
|
|
||||||
pixelRatio = 0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return pixelRatio
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user