jyy
2021-01-16 0556e2bfdf6e9424ef6ef12abe08fc9d7b44cf1b
pages/yuyue/choseService.js
@@ -9,7 +9,8 @@
   */
  data: {
    cates: [{ attrName: "全部", attrCode:""}],
    serviceList:[],
    composeProj:[],
    proj:[],
    cateIndex:0,
    offset: 0,
    limit:10,
@@ -34,34 +35,24 @@
  onLoad: function (options) {
    var _this=this;
    //加载分类
    util.request({
      api: api.productAttribute.getByCode + app.shopInfo.id+"/service",
      callback:function(data){
        var cates = _this.data.cates.concat(data.rows);
        _this.setData({
          cates: cates
        });
        _this.loadService();
      }
    });
    _this.loadService();
  },
  loadService:function(){
    
    var _this = this;
    var categoryId = _this.data.cates[_this.data.cateIndex].attrId;
    var serviceList = _this.data.serviceList;
    var userInfo= getApp().userInfo;
    var phoneNumber=userInfo.phoneNumber;
    util.request({
      api: api.goods.searchGoods,
      data: { categoryId: categoryId, isService: 1, offset: _this.data.offset,limit:_this.data.limit},
      callback:function(data){
        for (var i = 0; i < data.rows.length; i++) {
          serviceList.push(data.rows[i])
        }
      api:'/wxapi/yuyue/getUserPro/'+phoneNumber,
      callback:function(data){
        var composeProj=data.mapInfo.proj.composeProj;
        var proj=data.mapInfo.proj.proj;
        _this.setData({
          serviceList: serviceList,
          composeProj: composeProj,
          proj:proj
        });
      }
    });
@@ -69,20 +60,14 @@
  // 上拉加载
  onReachBottom: function () {
    var _this = this;
    var offset = _this.data.offset;
    var limit = _this.data.limit;
    _this.setData({
      offset: offset + limit
    });
    this.loadService();
  },
  chooseService:function(e){
    var index=e.currentTarget.dataset.index;
    var service =this.data.serviceList[index];
    wx.setStorageSync('chooseService', service);
    var item=e.currentTarget.dataset.pro;
    wx.setStorageSync('chooseService', item);
    wx.navigateBack({
      delta: 1,
    });