开始做充值和发票
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import { getParkList } from "../../service/park";
|
||||
import { getTenementList } from "../../service/tenement";
|
||||
import request from '../../utils/request'
|
||||
|
||||
const { OK } = request
|
||||
// components/select/index.js
|
||||
Component({
|
||||
|
||||
@@ -5,7 +10,11 @@ Component({
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
label: String,
|
||||
type: Number,
|
||||
park: String,
|
||||
parkName: String,
|
||||
required: Boolean
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -13,19 +22,39 @@ Component({
|
||||
*/
|
||||
data: {
|
||||
list: [],
|
||||
visible: false
|
||||
visible: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onInput(e) {
|
||||
console.log('e', e)
|
||||
this.setData({
|
||||
visible: true,
|
||||
list: [e.detail, e.detail, e.detail]
|
||||
})
|
||||
async onInput(e) {
|
||||
console.log('this.type', this.data.type)
|
||||
// this.setData({
|
||||
// visible: true,
|
||||
// list: [e.detail, e.detail, e.detail]
|
||||
// })
|
||||
switch(this.data.type) {
|
||||
case 0:
|
||||
const { data = [], code, message } = await getParkList({ keyword: e.detail });
|
||||
this.setData({
|
||||
list: data,
|
||||
visible: true,
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
const park = this.data.park;
|
||||
if (!park) {
|
||||
return;
|
||||
}
|
||||
const { data: tenementData = [], code: tenementCode, message: tenementMessage } = await getTenementList({ park, keyword: e.detail });
|
||||
this.setData({
|
||||
list: tenementData,
|
||||
visible: true,
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.setData({
|
||||
@@ -35,11 +64,11 @@ Component({
|
||||
},
|
||||
onChoose(e) {
|
||||
const { data = {} } = e.currentTarget.dataset;
|
||||
console.log('data', data)
|
||||
this.setData({
|
||||
visible: false
|
||||
visible: false,
|
||||
value: data.name
|
||||
})
|
||||
this.triggerEvent("choose", data)
|
||||
}
|
||||
this.triggerEvent("choose", {type: this.data.type, data})
|
||||
},
|
||||
}
|
||||
})
|
@@ -2,16 +2,16 @@
|
||||
<view class="content">
|
||||
<van-field
|
||||
value="{{ value }}"
|
||||
placeholder="请输入用户名"
|
||||
placeholder="{{'请选择' + label}}"
|
||||
border="{{ false }}"
|
||||
label="用户名"
|
||||
label="{{label}}"
|
||||
custom-style="height:100rpx"
|
||||
bind:change="onChange"
|
||||
bind:input="onInput"
|
||||
required="{{required}}"
|
||||
/>
|
||||
<view class="modal" wx:if="{{visible}}">
|
||||
<view class="options" >
|
||||
<view wx:for="{{list}}" class="option" bind:tap="onChoose" data-data="{{item}}">{{item}}</view>
|
||||
<view class="options">
|
||||
<view wx:for="{{list}}" class="option" bind:tap="onChoose" data-data="{{item}}" wx:key="id">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="other" bind:tap="close"></view>
|
||||
</view>
|
||||
|
@@ -8,7 +8,13 @@
|
||||
|
||||
background-color: #fff;
|
||||
padding: 20rpx;
|
||||
margin-left: 32rpx;
|
||||
margin-right: 32rpx;
|
||||
width: 100%;
|
||||
border: 1rpx solid #ccc;
|
||||
border-radius: 5rpx;
|
||||
box-sizing: border-box;
|
||||
width: calc(100% - 64rpx);
|
||||
}
|
||||
|
||||
.option {
|
||||
|
Reference in New Issue
Block a user