Commit 88e5c7fe by zhangxw

选择客户 添加搜索

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