瀏覽代碼

添加领域筛选项

xiaohaizhao 2 年之前
父節點
當前提交
a64902ef78
共有 4 個文件被更改,包括 99 次插入65 次删除
  1. 40 3
      packageA/publicClue/index.js
  2. 10 3
      packageA/publicClue/index.wxml
  3. 44 56
      packageA/saleClue/index.js
  4. 5 3
      packageA/saleClue/index.wxml

+ 40 - 3
packageA/publicClue/index.js

@@ -5,6 +5,7 @@ Page({
      * 页面的初始数据
      */
     data: {
+        filtrate: false,
         content: {
             "isExport": 0,
             "nocache": true,
@@ -24,6 +25,45 @@ Page({
             allot: wx.getStorageSync('auth').worderclue_public.options.some(v => v == 'allot')
         });
         this.getList();
+
+        _Http.basic({
+            "id": 20221223141802,
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 9999,
+                "where": {
+                    "condition": ""
+                }
+            }
+        }, false).then(res => {
+            console.log("获取领域", res)
+            if (res.msg == '成功') {
+                this.setData({
+                    filtratelist: [{
+                        label: "领域",
+                        index: null,
+                        showName: "tradefield", //显示字段
+                        valueKey: "tradefield", //返回Key
+                        selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
+                        value: "", //选中值
+                        list: res.data
+                    }]
+                })
+            }
+        })
+    },
+    onClick() {
+        this.setData({
+            filtrate: true
+        })
+    },
+    /* 处理筛选 */
+    handleFilter({
+        detail
+    }) {
+        detail.condition = this.data.content.where.condition;
+        this.data.content.where = detail;
+        this.getList(true)
     },
     /* 获取列表 */
     getList(init = false, data) {
@@ -113,8 +153,5 @@ Page({
     },
     setListHeight() {
         this.selectComponent("#ListBox").setHeight(".total", this);
-    },
-    onShareAppMessage() {
-
     }
 })

+ 10 - 3
packageA/publicClue/index.wxml

@@ -1,4 +1,11 @@
-<van-search shape="round" placeholder="请输入搜索关键词" bind:search='onSearch' bind:clear='onSearch' />
+<view class="search">
+    <van-search value="{{ value }}" shape="round" placeholder="请输入搜索关键词" use-action-slot bind:search="onSearch" bind:clear='onSearch'>
+        <navigator class="action" url="#" slot="action" bind:tap="onClick">
+            <text class="iconfont icon-shaixuan" />
+            筛选
+        </navigator>
+    </van-search>
+</view>
 
 <!-- 显示类型 -->
 <view class="total">共{{content.total}}个</view>
@@ -7,6 +14,6 @@
     <list list='{{list}}' allot="{{allot}}" />
     <view style="height: 80rpx;" />
 </Yl_ListBox>
-
 <!-- 浮动按钮 -->
-<Yl_FloatingButton wx:if="{{insert}}" bindtap="openType" />
+<Yl_FloatingButton wx:if="{{insert}}" bindtap="openType" />
+<Yl_Filtrate1 show='{{filtrate}}' list="{{filtratelist}}" bindhandle="handleFilter" />

+ 44 - 56
packageA/saleClue/index.js

@@ -39,13 +39,8 @@ Page({
             },
             "sort": []
         },
-        filter: {
-            show: false,
-            status: ['新建', '发布', '结束'], //状态项
-            statusActive: "",
-            startdate: "",
-            enddate: ""
-        }
+        filtrate: false,
+
     },
     onLoad(options) {
         this.setData({
@@ -99,6 +94,7 @@ Page({
     },
     /* 获取线索状态 */
     getClueArea() {
+        let filtratelist = [];
         _Http.basic({
             "classname": "sysmanage.develop.optiontype.optiontype",
             "method": "optiontypeselect",
@@ -111,15 +107,48 @@ Page({
                 title: res.data,
                 icon: "none"
             })
-            let status = res.data.map(item => {
-                return item.value
+            filtratelist.push({
+                label: "线索状态",
+                index: null,
+                showName: "value", //显示字段
+                valueKey: "status", //返回Key
+                selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
+                value: "", //选中值
+                list: res.data
             })
             this.setData({
-                'filter.status': status
-            });
+                filtratelist
+            })
             this.setListHeight();
         })
+        _Http.basic({
+            "id": 20221223141802,
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 9999,
+                "where": {
+                    "condition": ""
+                }
+            }
+        }, false).then(res => {
+            console.log("获取领域", res)
+            if (res.msg == '成功') {
+                filtratelist.push({
+                    label: "领域",
+                    index: null,
+                    showName: "tradefield", //显示字段
+                    valueKey: "tradefield", //返回Key
+                    selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
+                    value: "", //选中值
+                    list: res.data
+                })
+                this.setData({
+                    filtratelist
+                })
+            }
+        })
     },
+
     /* 处理搜索 */
     onSearch({
         detail
@@ -184,7 +213,7 @@ Page({
                 break;
             case '2':
                 this.setData({
-                    'filter.show': true
+                    filtrate: true
                 })
                 break;
         }
@@ -205,53 +234,12 @@ Page({
         this.classClose();
         this.getList(true)
     },
-    /* 筛选状态选择 */
-    selectStatus(e) {
-        const {
-            item
-        } = e.currentTarget.dataset;
-        this.setData({
-            "filter.statusActive": this.data.filter.statusActive == item ? "" : item
-        })
-    },
-    /* 筛选状态选择 */
-    typeStatus(e) {
-        const {
-            item
-        } = e.currentTarget.dataset;
-        this.setData({
-            "filter.typeActive": this.data.filter.typeActive == item ? "" : item
-        })
-    },
     /* 处理筛选 */
     handleFilter({
         detail
     }) {
-        const data = this.data.filter;
-        switch (detail) {
-            case 'confirm':
-                this.setData({
-                    'filter.show': false
-                });
-                this.getList(true, data);
-                break;
-            case 'reset':
-                this.setData({
-                    'filter.statusActive': "",
-                    'filter.typeActive': "",
-                    'filter.startdate': "",
-                    'filter.enddate': "",
-                });
-                this.getList(true, this.data.filter)
-                break;
-            case 'close':
-                this.setData({
-                    'filter.show': false
-                });
-                break;
-        }
-    },
-    onShareAppMessage() {
-
+        detail.condition = this.data.content.where.condition;
+        this.data.content.where = detail;
+        this.getList(true)
     }
 })

+ 5 - 3
packageA/saleClue/index.wxml

@@ -6,7 +6,7 @@
 <van-action-sheet bind:click-overlay='classClose' show="{{ classShow }}" actions="{{ classActions }}" cancel-text="取消" bind:cancel="classClose" bind:select="classSelect" />
 <view class="total">共{{content.total}}个</view>
 <!-- 筛选条件 -->
-<Yl_filtrate show="{{filter.show}}" bind:handle="handleFilter">
+<!-- <Yl_filtrate show="{{filter.show}}" bind:handle="handleFilter">
     <view class="groud">
         <view class="label">
             线索状态
@@ -15,10 +15,12 @@
             <van-button custom-class='but {{filter.statusActive==item?"active":""}}' wx:for="{{filter.status}}" wx:key="item" bindtap="selectStatus" data-item="{{item}}">{{item}}</van-button>
         </view>
     </view>
-</Yl_filtrate>
+</Yl_filtrate> -->
 <!-- 浮动按钮 -->
 <Yl_FloatingButton wx:if="{{insert}}" bindtap="openType" />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
     <list list='{{list}}' />
     <view style="height: 80rpx;" />
-</Yl_ListBox>
+</Yl_ListBox>
+
+<Yl_Filtrate1 show='{{filtrate}}' list="{{filtratelist}}" bindhandle="handleFilter" />