| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- import agentApi from '../../apis/agent'
- import { encryption } from '../../utils/encryption'
- import { bindInput } from '../../utils/utils'
- import { isPhoneX } from './../../utils/tools'
- const panelData={
- 'mudi':[
- {
- id:'mudi',
- items:[{
- name:'不限',
- id:''
- },{
- name:'刚需',
- id:''
- },{
- name:'改善',
- id:''
- }]
- }
- ],
- 'yixiang':[
- {
- id:'yixiang',
- items:[{
- name:'不限',
- id:''
- },{
- name:'强烈',
- id:3,
- icon_num: 3,
- icon: 'iconcus_star',
- },{
- name:'一般',
- id:2,
- icon: 'iconcus_star',
- icon_num: 2
- },{
- name:'较弱',
- id:1,
- icon: 'iconcus_star',
- icon_num: 1
- },{
- name:'暂不关注',
- id:0
- }]
- }
- ],
- 'paixu':[
- {
- id:'paixu',
- items:[{
- name:'不限',
- id:''
- },{
- name:'最近维护',
- id:'time'
- }]
- }
- ]
- }
- let type_acive = ''
- const app = getApp();
- Page({
- /**
- * 组件的属性列表
- */
- data: {
- clients: [],
- //todo 4个 icon栏位,可后台配置, 调用IconClick函数。
- icon_list: [
- {name: '目的',icon:'edit',type:"mudi"},
- {name: '意向',icon:'edit',type:"yixiang"},
- {name: '排序',icon:'write',type:"paixu"}
- ],
- type_acive,
- tab_panel:panelData[type_acive]||[],
- fetcherData: {
- page: 1,
- agency_user_id: '',
- size: 10,
- user_wish: '',
- purpose:''
- },
- has_next: true,
- navbarInitTop: 0,
- seachKey:'',
- },
- bindInput,
- changeListType(e){
- let {type} = e.currentTarget.dataset
- let obj = {
- type_acive:type,
- tab_panel:panelData[type]
- }
- if (type===this.data.type_acive) {
- obj['type_acive'] =''
- }
- this.setData(obj)
- },
- selecthandle(e){
- let {selectObj} = e.detail
- let tmp = Object.assign(this.data.fetcherData,{
- purpose:(selectObj.mudi)?String(selectObj.mudi.name):'',
- user_wish:selectObj.yixiang?selectObj.yixiang.id:'',
- order: selectObj.paixu ? selectObj.paixu.id : ''
- })
- this.setData({
- fetcherData: tmp
- })
- this.getClientList()
- },
- closeTypeActive(){
- this.setData({
- type_acive:''
- })
- },
- toAddClient(){
- wx.navigateTo({
- url: '/pages/add-client/add-client'
- })
- },
- onReachBottomDistance: 50,
- onReachBottom: function () {
- let page = this.data.fetcherData.page++
- this.setData({
- 'fetcherData.page': page
- })
- this.getClientList()
- },
-
- // onPageScroll: function (e) { // 调用showImg函数
- // var top = e.scrollTop;
- // try {
- // //判断'滚动条'滚动的距离 和 '元素在初始时'距顶部的距离进行判断
- // var isSatisfy = top >= this.data.navbarInitTop ? true : false;
- // //为了防止不停的setData, 这儿做了一个等式判断。 只有处于吸顶的临界值才会不相等
- // if (this.data.isFixedTop === isSatisfy) {
- // return false;
- // }
- // console.log(isSatisfy)
- // this.setData({
- // isFixedTop: isSatisfy
- // });
- // } catch (e) {
- // console.log(e)
- // }
- // },
- onShow: function () {
- this.getClientList()
- },
- getClientList: function () {
- this.setData({
- 'fetcherData.agency_user_id': app.globalData.userinfo.agency_user_id
- })
- app.wxshowloading('拼命加载中...');
- agentApi.fetchCustomers(this.data.fetcherData).then(res => {
- this.setData({
- clients: res.data.list
- })
- }).finally(() => {
- wx.hideLoading()
- })
- },
- tapSearch(){
- this.setData({
- 'fetcherData.user_name': this.data.seachKey,
- })
- this.getClientList()
- },
-
- onLoad: function (options) {
- isPhoneX().then(res => {
- this.setData({
- isPhoneX: res
- })
- })
- }
-
- });
|