Browse Source

项目商机搜索

zhaoxiaohai 2 years ago
parent
commit
8e1bddf7e2

+ 69 - 0
packageA/project/search.js

@@ -0,0 +1,69 @@
+const _Http = getApp().globalData.http,
+    getHeight = require("../../utils/getRheRemainingHeight");
+
+Page({
+    data: {
+        content: {
+            "type": 0,
+            "pageNumber": 1,
+            "pageSize": 20,
+            "where": {
+                "condition": "",
+                "status": "",
+                "startdate": "",
+                "enddate": ""
+            },
+            "sort": [{
+                sortname: "默认",
+                sorted: 1,
+                sortid: 68,
+                reversed: 0
+            }]
+        },
+    },
+    onLoad(options) {
+        this.getList();
+    },
+    startSearch({
+        detail
+    }) {
+        this.setData({
+            "content.where.condition": detail
+        })
+        this.getList(true);
+    },
+    onClear() {
+        this.setData({
+            "content.where.condition": ""
+        })
+        this.getList(true);
+    },
+    getList(init = false) {
+        if (init.detail != undefined) init = init.detail;
+        let content = this.data.content;
+        if (init) content.pageNumber = 1;
+        if (content.pageNumber > content.pageTotal) return;
+        _Http.basic({
+            "id": 20221020143502,
+            content
+        }).then(res => {
+            console.log("客户商机列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                'content.pageNumber': res.pageNumber + 1,
+                'content.pageTotal': res.pageTotal,
+                'content.total': res.total,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            })
+        })
+    },
+    onReady() {
+        getHeight.getHeight('.total', this).then(res => this.setData({
+            listHeight: res
+        }));
+    },
+})

+ 6 - 0
packageA/project/search.json

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

+ 4 - 0
packageA/project/search.scss

@@ -0,0 +1,4 @@
+page {
+    height: 100vh;
+    overflow: hidden;
+}

+ 6 - 0
packageA/project/search.wxml

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