Ver código fonte

供需分类查询

zhaoxiaohai 4 anos atrás
pai
commit
4b66a6b837

+ 21 - 13
pages/tabbar-pages/supplyAndDemand/index.js

@@ -15,7 +15,7 @@ Page({
         pageTotal: 2, //全部分页数量
         active: 0, //tabs 选中下标
         ftypeList: [], //分类列表
-        ftype: "", //当前查询分类
+        ftype: "全部", //当前查询分类
         ifShowCommunicationOfNumber: false,
         /* 供需列表 */
         productList: [],
@@ -49,6 +49,17 @@ Page({
                 };
                 res.data[i].attinfos = attinfos;
             };
+            /* 添加全部 */
+            res.data.unshift({
+                ftype: "全部",
+                attinfos: [{
+                    fobsurl: "/static/supplyAndDemand/all-icon.png",
+                    ftype: "default"
+                }, {
+                    fobsurl: "/static/supplyAndDemand/acAll-icon.png",
+                    ftype: "click"
+                }]
+            });
             this.setData({
                 ftypeList: res.data
             });
@@ -70,9 +81,8 @@ Page({
         let {
             type
         } = even.currentTarget.dataset;
+        if (type == this.data.ftype) return;
         this.InitializeDataPaging();
-        /* 第二次触发同一个,查询全部 */
-        if (type == this.data.ftype) type = "";
         this.setData({
             ftype: type
         });
@@ -156,17 +166,18 @@ Page({
     },
     /* 获取供需列表 */
     getSupplyAndDemand(fstatus) {
-        let condition = "";
-        let where = {
-            "condition": condition, //模糊搜索
-            "ftype": this.data.ftype, //数据类型
-            "fissupply": "" // 0需 1供
-        };
+        const ftype = (this.data.ftype != '全部') ? this.data.ftype : "";
+        let condition = "",
+            where = {
+                "condition": condition, //模糊搜索
+                "ftype": ftype, //数据类型
+                "fissupply": "" // 0需 1供
+            };
         /* 暂时不分供需 */
         if (fstatus) {
             where = {
                 "condition": condition, //模糊搜索
-                "ftype": this.data.ftype, //数据类型
+                "ftype": ftype, //数据类型
                 "fissupply": 0, // 0需 1供
                 "fstatus": "正在对接"
             }
@@ -233,10 +244,7 @@ Page({
     },
     /* 返回列表 */
     returnList(res) {
-        console.log(res)
         let data = handleList.checkdate(res.data)
-        console.log(data)
-
         let productList = handleList.imageType(data, 'default');
         //替换或拼接
         if (res.pageNumber != 1) {

BIN
static/supplyAndDemand/acAll-icon.png


BIN
static/supplyAndDemand/all-icon.png