Commit 88e5c7fe by zhangxw

选择客户 添加搜索

1 parent 93ddcb34
......@@ -13,6 +13,7 @@ Component({
let { connectionList } = this.data
if (n?.length) {
connectionList.map(val => {
val.show = true
if (n.findIndex(item => item.merchantId == val.merchantId) > -1) val.checked = true
return val
})
......@@ -26,7 +27,7 @@ Component({
* 组件的初始数据
*/
data: {
searchKeyword: ''
},
/**
......@@ -45,6 +46,27 @@ Component({
connectionList
})
},
search(e) {
let { connectionList } = this.data
let { value } = e.currentTarget.dataset && Object.keys(e.currentTarget.dataset).length ? e.currentTarget.dataset : e.detail
console.log(value)
connectionList.forEach(item => {
console.log(item)
item.show = item.merchantName?.includes(value)
})
this.setData({
connectionList
})
console.log(connectionList)
},
input(e) {
let { value } = e.detail
this.setData({
searchKeyword: value
})
},
// 确定
handleConfirm() {
// 处理选中的数据
......
......@@ -16,7 +16,7 @@
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search" bindtap="showConfirm">
<view class="search" bindtap="search" data-value="{{searchKeyword}}">
<view class="text-center">搜索</view>
</view>
</view>
......@@ -34,9 +34,11 @@
refresher-triggered="{{triggered}}">
<view>
<block wx:for="{{connectionList}}" wx:key="index">
<view
<view hidden="{{!item.show}}">
<view
class="service-items text-hide"
data-item="{{item}}"
data-index="{{index}}"
hidden="{{!item.show}}"
bindtap="select">
<view class="item-radio">
<view wx:if="{{!item.checked}}" class="radio_class radio {{item.disabled?'disabled': ''}}"></view>
......@@ -49,6 +51,8 @@
</view>
<view class="item-text {{item.disabled?'disabled_text':''}}">{{item.merchantName}}</view>
</view>
</view>
</block>
</view>
</scroll-view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!