Browse Source

no message

feature/v2.2
xpz2018 4 years ago
parent
commit
19438ef5f1
3 changed files with 30 additions and 19 deletions
  1. 2
      pages/home/customer-code/index.wxml
  2. 26
      pages/home/customer-list/index.js
  3. 21
      pages/home/customer-list/index.wxml

2
pages/home/customer-code/index.wxml

@ -9,7 +9,7 @@
<view style="width:100%;flex:1;margin-left: 18rpx"> <view style="width:100%;flex:1;margin-left: 18rpx">
<view class="text-sg text-bold">{{name || ''}}</view> <view class="text-sg text-bold">{{name || ''}}</view>
<view class="text-sm text-gray" style="line-height:32rpx;height:32rpx"> <view class="text-sm text-gray" style="line-height:32rpx;height:32rpx">
<text>电话号码:18545124454</text>
<text>联系电话:18545124454</text>
</view> </view>
</view> </view>
</view> </view>

26
pages/home/customer-list/index.js

@ -161,18 +161,22 @@ Scene({
return value1 - value2 return value1 - value2
} }
}, },
onChange: function({detail}) {
this.setData({ ['form.name']: detail })
let result = []
this.data.orderList.forEach(item => {
item.data.forEach(element => {
var keyword = detail.toLocaleUpperCase()
if (element.name.indexOf(keyword) !== -1 || element.mobile.indexOf(keyword) !== -1) {
result.push(element)
}
onChange: function(e) {
if(util.isEmpty(e.detail) || (e.detail !== e.detail + '')){
this.setData({ ['form.name']: '', searchList: [], loading: false })
} else {
this.setData({ ['form.name']: e.detail, loading: true })
let result = []
this.data.orderList.forEach(item => {
item.data.forEach(element => {
var keyword = e.detail.toLocaleUpperCase()
if (element.name.indexOf(keyword) !== -1 || element.mobile.indexOf(keyword) !== -1) {
result.push(element)
}
})
}) })
})
this.setData({ searchList: result })
this.setData({ searchList: result, loading: false })
}
}, },
onSearch: function(){ onSearch: function(){
this.onRefreshList() this.onRefreshList()

21
pages/home/customer-list/index.wxml

@ -35,9 +35,9 @@
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text> <text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</van-divider> </van-divider>
</refresh-view> --> </refresh-view> -->
<van-search value="{{ form.name }}" shape="round" placeholder="请输入名字或者电话号码" use-action-slot bind:change="onChange">
<!-- <view slot="action" bind:tap="addCustomer" style="padding: 0rpx 8rpx">添加客户</view> -->
<van-button slot="action" plain type="info" size="small" bind:click="addCustomer">添加客户</van-button>
<van-search value="{{ form.name }}" disabled="{{!orderList.length}}" shape="round" placeholder="请输入名字或者电话号码" use-action-slot bind:change="onChange">
<!-- <van-button slot="action" plain type="info" size="small" bind:click="addCustomer">添加客户</van-button> -->
<view slot="action" bind:tap="onChange" style="padding: 0rpx 8rpx" wx:if="{{form.name}}">取消</view>
</van-search> </van-search>
<scroll-view class="scrollList" scroll-y scroll-into-view="{{scrollViewId}}" style="height:{{height}}rpx"> <scroll-view class="scrollList" scroll-y scroll-into-view="{{scrollViewId}}" style="height:{{height}}rpx">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}"> <view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
@ -47,8 +47,15 @@
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image> <image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view> <view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view> </view>
<!-- 查询城市 -->
<!-- 查询结果 -->
<view wx:if="{{form.name}}"> <view wx:if="{{form.name}}">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!searchList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在搜索' : '暂无数据'}}</view>
</view>
<van-cell clickable wx:for="{{searchList}}" wx:key="index"> <van-cell clickable wx:for="{{searchList}}" wx:key="index">
<view slot="title" class="flex flex-justify" data-index="{{index}}" bindtap="customerInfo"> <view slot="title" class="flex flex-justify" data-index="{{index}}" bindtap="customerInfo">
<!-- <van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" /> --> <!-- <van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" /> -->
@ -70,7 +77,7 @@
<text class="text-sg" style="line-height:50rpx;padding-left:32rpx">{{pageItem.sign}}</text> <text class="text-sg" style="line-height:50rpx;padding-left:32rpx">{{pageItem.sign}}</text>
</view> </view>
<van-cell clickable wx:for="{{pageItem.data}}" wx:key="index"> <van-cell clickable wx:for="{{pageItem.data}}" wx:key="index">
<view slot="title" class="flex flex-justify" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="qrcodeCustomer">
<view slot="title" class="flex flex-justify" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="customerInfo">
<!-- <van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" /> --> <!-- <van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" /> -->
<view style="width:100%;flex:1"> <view style="width:100%;flex:1">
<view class="text-sg text-bold">{{item.name || ''}}</view> <view class="text-sg text-bold">{{item.name || ''}}</view>
@ -90,9 +97,9 @@
</view> </view>
</scroll-view> </scroll-view>
<!-- <view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx">
<view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx">
<van-button round type="info" icon="plus" bind:click="addCustomer" custom-style="width: 100rpx;height: 100rpx;"></van-button> <van-button round type="info" icon="plus" bind:click="addCustomer" custom-style="width: 100rpx;height: 100rpx;"></van-button>
</view> -->
</view>
<notification id="qn-notification"/> <notification id="qn-notification"/>
<!-- 右侧定位 --> <!-- 右侧定位 -->

Loading…
Cancel
Save