zhaoxiaohai 3 anni fa
parent
commit
e6bd32e7d5

+ 17 - 1
packageA/setclient/modules/contacts/index.js

@@ -20,7 +20,7 @@ Component({
         getList(id, init) {
             let content = this.data.content;
             content.sys_enterpriseid = id;
-            console.log("id",id)
+            console.log("id", id)
             if (init) {
                 content.pageNumber = 1
                 content.pageTotal = 1
@@ -44,6 +44,22 @@ Component({
                 })
             })
         },
+        toSearch() {
+            wx.navigateTo({
+                url: '/packageA/setclient/modules/contacts/search/index?perams=' + JSON.stringify({
+                    sys_enterpriseid: this.data.sys_enterpriseid,
+                    "nacache": true,
+                    "pageNumber": 1,
+                    "pageSize": 20,
+                    "pageTotal": 1,
+                    "total": 0,
+                    "where": {
+                        "condition": "",
+                        "workaddress": 0
+                    }
+                }),
+            })
+        },
         /* 修改总数 */
         changeTotal() {
             this.setData({

+ 1 - 1
packageA/setclient/modules/contacts/index.wxml

@@ -3,7 +3,7 @@
         总共{{content.total}}个
     </view>
     <view class="expand">
-        <navigator url="#" class="but">
+        <navigator url="#" class="but" bindtap="toSearch">
             <van-icon name="search" />
         </navigator>
         <navigator url="/packageA/setclient/modules/contacts/quickly/index?sys_enterpriseid={{sys_enterpriseid}}" class="but">

+ 8 - 2
packageA/setclient/modules/contacts/list/index.js

@@ -46,8 +46,14 @@ Component({
                                 getCurrentPages().forEach(v => {
                                     switch (v.__route__) {
                                         case "packageA/setclient/detail":
-                                            that.setData({
-                                                list: this.data.list.filter(v => v.contactsid != item.contactsid)
+                                            const page = v.selectComponent("#Contacts");
+                                            page.setData({
+                                                list: page.data.list.filter(v => v.contactsid != item.contactsid)
+                                            });
+                                            break;
+                                        case "packageA/setclient/modules/contacts/search/index":
+                                            v.setData({
+                                                list: v.data.list.filter(v => v.contactsid != item.contactsid)
                                             });
                                             break;
                                         case "packageA/setclient/modules/contacts/detail/index":

+ 53 - 0
packageA/setclient/modules/contacts/search/index.js

@@ -0,0 +1,53 @@
+const _Http = getApp().globalData.http;
+Page({
+    data: {
+
+    },
+    onLoad(options) {
+        this.setData({
+            content: JSON.parse(options.perams)
+        })
+        this.getList();
+    },
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        this.setData({
+            "content.where.condition": detail
+        });
+        this.getList(true);
+    },
+    onClear() {
+        this.setData({
+            "content.where.condition": ""
+        });
+        this.getList(true);
+    },
+    /* 获取地址列表 */
+    getList(init) {
+        let content = this.data.content;
+        if (init) content.pageNumber = 1;
+        if (content.pageNumber > content.pageTotal) return;
+        _Http.basic({
+            "id": "20221022165503",
+            content
+        }).then(res => {
+            console.log("联系人列表", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                "content.pageNumber": res.pageNumber + 1,
+                "content.pageSize": res.pageSize,
+                "content.pageTotal": res.pageTotal,
+                "content.total": res.total
+            })
+        })
+    },
+    onReachBottom() {
+        this.getList();
+    },
+})

+ 6 - 0
packageA/setclient/modules/contacts/search/index.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "List": "../list/index"
+    },
+    "navigationBarTitleText": "搜索联系人"
+}

+ 1 - 0
packageA/setclient/modules/contacts/search/index.scss

@@ -0,0 +1 @@
+/* packageA/setclient/modules/contacts/search/index.wxss */

+ 3 - 0
packageA/setclient/modules/contacts/search/index.wxml

@@ -0,0 +1,3 @@
+<van-search value="{{ content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<view style="height: 20rpx;" />
+<List id='List' list='{{list}}' />