Browse Source

关联客户列表

zhaoxiaohai 2 years ago
parent
commit
a5be73865b

+ 71 - 0
packageA/project/modules/treaty/index.js

@@ -0,0 +1,71 @@
+const _Http = getApp().globalData.http;
+
+Component({
+    properties: {
+
+    },
+    data: {
+        "sa_projectid": null,
+        "content": {
+            "nocache": true,
+            "pageNumber": 1,
+            "pageTotal": 1,
+            "pageSize": 20,
+            "total": null,
+            "where": {
+                "condition": "",
+                "type": 4
+            }
+        },
+    },
+    methods: {
+        /* 获取地址列表 */
+        getList(id, init) {
+            let content = this.data.content;
+            content.where.sa_projectid = id;
+            if (init) {
+                content.pageNumber = 1
+                content.pageTotal = 1
+            }
+            _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,
+                    sa_projectid: id
+                })
+            })
+        },
+        /* 获取列表标签 */
+        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
+                })
+            })
+        },
+    }
+})

+ 6 - 0
packageA/project/modules/treaty/index.json

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

+ 1 - 0
packageA/project/modules/treaty/index.scss

@@ -0,0 +1 @@
+@import "../../../setclient/modules/address/head.scss";

+ 12 - 0
packageA/project/modules/treaty/index.wxml

@@ -0,0 +1,12 @@
+<view class="head">
+    <view class="count">总共{{content.total}}个</view>
+    <view class="expand">
+        <navigator url="#" class="but" bindtap="toSearch">
+            <van-icon name="search" />
+        </navigator>
+        <navigator url="/packageA/project/modules/treaty/add/index?sa_projectid={{sa_projectid}}" class="but">
+            <van-icon name="plus" />
+        </navigator>
+    </view>
+</view>
+<List list='{{list}}' />