| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 | const content = {    pageNumber: 1,    pageTotal: 1,    where: {      condition: "",      itemclassid: "",      tradefield: ""    }  },  _Http = getApp().globalData.http;let sa_brandid = null,  downCount = null;Component({  options: {    addGlobalClass: true  },  data: {    CustomBar: getApp().globalData.CustomBar,    typeList: [],    list: [],    filtratelist: [{      label: "领域",      index: 0,      showName: "tradefield", //显示字段      valueKey: "tradefield", //返回Key      selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象      value: "", //选中值      list: [{        rowindex: 0,        subvalues: [],        sys_enterprise_tradefieldid: 0,        tradefield: "全部"      }]    }, {      label: "营销分类",      index: 0,      type: "multilevelClass",      showName: "itemclassname", //显示字段      valueKey: "itemclassid", //返回Key      selectKey: "itemclassid", //传参 代表选着字段 不传参返回整个选择对象      value: "", //选中值      list: []    }]  },  methods: {    init() {      this.getBrand();      this.getTradefie();      this.setData({        hidePrice: wx.getStorageSync('hidePrice'),      })      return true;    },    showModal(e) {      this.setData({        modalName: e.currentTarget.dataset.target      })    },    hideModal(e) {      this.setData({        modalName: null      })    },    /* 获取品牌 */    getBrand() {      getApp().globalData.setTemporaryId = this.handleFiltrate.bind(this);      _Http.basic({        "id": 20220924163702,        content: {          nocache: true,          pageSize: 999,        }      }).then(res => {        console.log("查询品牌", res)        if (res.msg != '成功') return wx.showToast({          title: res.msg,          icon: "none"        });        if (res.data.length != 0) {          sa_brandid = res.data[0].sa_brandid;          this.getTypeList();        } else {          wx.showToast({            title: '未查询到授权品牌',            icon: "none"          })        }      })    },    /* 获取分类 */    getTypeList() {      _Http.basic({        "id": "20220922110403",        pageSize: 1000,        content: {          nocache: true,          sa_brandid: sa_brandid,          where: {            istool: 0,          }        }      }).then(res => {        console.log("营销类别", res)        if (res.data[0].ttemclass) {          res.data[0].ttemclass.unshift({            itemclassid: "",            itemclassfullname: "全部",            itemclassname: "全部",            subdep: []          })          this.setData({            ['filtratelist[1].list']: res.data[0].ttemclass          });        }        this.getList(true);      })    },    /* 获取产品 */    getList(init = false) {      if (init.detail != undefined) init = init.detail;      if (init) content.pageNumber = 1;      if (content.pageNumber > content.pageTotal) return;      content.brandids = [sa_brandid];      _Http.basic({        "id": 20220926142203,        content      }).then(res => {        console.log("商品列表", res)        this.selectComponent('#ListBox').RefreshToComplete();        content.pageNumber = res.pageNumber + 1;        content.pageTotal = res.pageTotal;        this.setData({          list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)        })        this.setListHeight()      })    },    /* 开始搜索 */    onSearch({      detail    }) {      content.where.condition = detail;      this.getList(true)    },    /* 获取领域 */    getTradefie() {      _Http.basic({        "id": 20221223141802,        content: {          nocache: true,          pageNumber: 1,          pageSize: 9999,          where: {            condition: ""          }        }      }, false).then(res => {        console.log("获取领域", res)        if (res.msg == '成功') {          res.data.unshift({            rowindex: 0,            subvalues: [],            sys_enterprise_tradefieldid: 0,            tradefield: "全部"          })          this.setData({            'filtratelist[0].list': res.data          });        }      })    },    /* 设置页面高度 */    setListHeight() {      this.selectComponent("#ListBox").setHeight(".division", this);    },    handleFiltrate({      detail    }) {      clearTimeout(downCount);      if (detail.tradefield) content.where.tradefield = detail.tradefield == '全部' ? "" : detail.tradefield;      content.where.itemclassid = detail.temporaryId || detail.temporaryId == '' ? detail.temporaryId : content.where.itemclassid;      downCount = setTimeout(() => {        this.getList(true);      }, 300);    }  }})
 |