فهرست منبع

关联客户搜索

zhaoxiaohai 2 سال پیش
والد
کامیت
963146be23

+ 84 - 0
packageA/project/modules/treaty/search.js

@@ -0,0 +1,84 @@
+const _Http = getApp().globalData.http,
+    getHeight = require("../../../../utils/getRheRemainingHeight");
+
+Page({
+    data: {
+        content: null
+    },
+    onLoad(options) {
+        this.setData({
+            content: JSON.parse(options.data)
+        });
+        this.getList(true);
+    },
+    /* 获取地址列表 */
+    getList(init) {
+        let content = this.data.content;
+        if (init) {
+            content.pageNumber = 1
+            content.pageTotal = 1
+        }
+        if (content.pageNumber > content.pageTotal) return;
+        _Http.basic({
+            "id": "20220920083901",
+            content
+        }).then(res => {
+            console.log("关联客户列表", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.getTags(res.data.map(v => v.sa_customersid));
+            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
+            })
+        })
+    },
+
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        if (detail == this.data.content.where.condition) return;
+        this.setData({
+            'content.where.condition': detail
+        });
+        this.getList(true);
+    },
+    /* 取消搜索 */
+    onClear() {
+        this.setData({
+            'content.where.condition': ""
+        });
+        this.getList(true);
+    },
+    /* 获取列表标签 */
+    getTags(ownerids = []) {
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                "ownertable": "sa_customers",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            let list = this.data.list;
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_customersid == key);
+                list[index].tags = res.data[key]
+            };
+            this.setData({
+                list
+            })
+        })
+    },
+    onReady() {
+        getHeight.getHeight('.search', this).then(res => this.setData({
+            listHeight: res
+        }));
+    },
+})

+ 5 - 0
packageA/project/modules/treaty/search.json

@@ -0,0 +1,5 @@
+{
+    "usingComponents": {
+        "List": "../../../setclient/modules/list/index"
+    }
+}

+ 13 - 0
packageA/project/modules/treaty/search.scss

@@ -0,0 +1,13 @@
+page {
+    height: 100vh;
+    overflow: hidden;
+}
+
+.total {
+    height: 60rpx;
+    line-height: 60rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #666666;
+    padding-left: 30rpx;
+}

+ 5 - 0
packageA/project/modules/treaty/search.wxml

@@ -0,0 +1,5 @@
+<van-search class="search" value="{{ content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
+<My_listBox id='ListBox' height="{{listHeight}}" bind:getlist='getList'>
+    <view class="total">共{{content.total}}个</view>
+    <List list='{{list}}' />
+</My_listBox>