Browse Source

添加搜索列表和优质的杯子

wangyong 6 years ago
parent
commit
82eca6bc40

+ 1 - 1
pages/buy/buy.wxml

@@ -121,7 +121,7 @@
   </block>
   <block wx:else>
       <view class='footer_add'  bindtap="addCart"> 加 入 购 物 车 </view>
-      <view class='footer_buy'  bindtap="buyCart"> 立 即 购 买 </view>
+      <view class='footer_buy'  bindtap="buyCart"> 立 即 采 购 </view>
   </block>
 </view> 
 

+ 1 - 0
pages/car/index.js

@@ -864,6 +864,7 @@ Page({
         });
         var newCarts = JSON.stringify(that.data.buyCarts);
         newCarts = newCarts.replace(/&/g, "zss");
+        // 立即采购
         wx.navigateTo({
           url: '/pages/confirmOrder/confirmOrder?carts=' + newCarts,
         })

+ 2 - 2
pages/car/index.wxml

@@ -120,7 +120,7 @@
 </block>
 
 <!-- 猜你喜欢 -->
-<view class='like_wrap  {{contentShow}}'  style="padding-bottom:{{paddingBottom}}rpx;">
+<!-- <view class='like_wrap  {{contentShow}}'  style="padding-bottom:{{paddingBottom}}rpx;">
   <view class='like_title_wrap'>
     <view class='like_line'></view>
     <view class='like_title'>猜你喜欢</view>
@@ -137,7 +137,7 @@
     </block>
     
   </view>
-</view>
+</view> -->
 
 <!-- 蒙层 -->
 <view class="modal_wrap  {{hiddenmodal ? 'hidden' : ''}}">

+ 17 - 13
pages/confirmOrder/confirmOrder.js

@@ -303,16 +303,20 @@ Page({
 
     var len = that.data.carts.length;
 
-    wx.showLoading({//支付提示
-      title: '生成订单', //微信支付
-      icon: 'loading',
-      mask: true,
-      success: function () {
-        that.setData({
-          maskBg: true,
-          allowPay : 1
-        })
-      }
+    // wx.showLoading({//支付提示
+    //   title: '生成订单', //微信支付
+    //   icon: 'loading',
+    //   mask: true,
+    //   success: function () {
+          // that.setData({
+          //   maskBg: true,
+          //   allowPay: 1
+          // })
+    //   }
+    // })
+    that.setData({
+      maskBg: true,
+      allowPay: 1
     })
 
     if (that.data.value == 0) {
@@ -438,9 +442,9 @@ Page({
 
       //调起支付
       // that.payOrder(timestamp, timestamp1, coupon_id, un_id, formId);
-      wx.showModal({
-        title: '提示',
-        content: '订单已生成,后面待上传支付凭证',
+      wx.showToast({
+        title: '订单已生成,后面待上传支付凭证',
+        icon:'none'
       })
 
     }else{

+ 13 - 13
pages/confirmOrder/confirmOrder.wxml

@@ -23,31 +23,31 @@
     </view> 
   </view>
  </block> 
- <view bindtap='coupon'  class="youhuijuan_title  double_line">
+ <!-- <view bindtap='coupon'  class="youhuijuan_title  double_line">
     <view class="text1">选择优惠劵</view>
     <text class="coupon_name">{{couponName}}</text>
     <image src="{{addressEditImg}}"  class="address_edit_img  flexbox"/>
-  </view>
+  </view> -->
   
   <view class="infor_content">
 
-    <view class="each_infor borderBottom">
+    <!-- <view class="each_infor borderBottom">
       <view class="infor_title">配送费</view>
       <view class="infor_num">快递¥0.00</view>
       <view class="clearfix"></view>
-    </view>
-
+    </view> -->
+<!-- 
     <view class="each_infor peisong  borderBottom">
       <view class="infor_title">定制费用</view>
       <view class="infor_num">¥0.00</view>
       <view class="clearfix"></view>
-    </view>
+    </view> -->
 
-    <view class="each_infor peisong  borderBottom">
+    <!-- <view class="each_infor peisong  borderBottom">
       <view class="infor_title">优惠劵</view>
       <view class="infor_num  infor_num_coupon">-¥{{minNum}}</view>
       <view class="clearfix"></view>
-    </view>
+    </view> -->
     
     <view class="each_infor peisong  borderBottom">
       <view class="infor_title">商品合计</view>
@@ -56,21 +56,21 @@
     </view>
 
     <!-- 发票 -->
-    <view class="add_invoice_wrap  borderBottom">
+    <!-- <view class="add_invoice_wrap  borderBottom">
       <label  bindtap="checkboxChange" data-value="{{value}}"   class="each_infor peisong checkbox">
         <checkbox  bindtap="checkboxChange" class="{{checked ? 'checkact' : ''}}"  disabled='{{invoice ? false : true}}' value="{{value}}" checked="{{checked}}"  color="#fff"/>{{invCont}}
       </label>
       <view bindtap='invoice' class="addInvoice"><image src='../../images/gray_more_2.png'></image></view>
-    </view>
+    </view> -->
 
     <!-- 同意协议 -->
-    <view class="add_invoice_wrap">
+    <!-- <view class="add_invoice_wrap">
       <label  bindtap="agrService"  data-value="{{servalue}}"   class="each_infor peisong">
         <checkbox  bindtap="agrService" class="{{serchecked ? 'checkact' : ''}}"  checked="{{serchecked}}"  color="#fff"/>
         我同意
       </label>
       <navigator url='/pages/serviceCont/serviceCont'  class='service_navig'>《大良造服务协议》</navigator>
-    </view>
+    </view> -->
   </view>
 
   <view class="footer_total"> 
@@ -85,7 +85,7 @@
     <block wx:if="{{allowPay == 0}}">
       <form bindsubmit="{{serchecked ? 'save' : ''}}"   data-id="{{i}}"  report-submit  >
         <button formType="submit"  class='form_button'>
-            <view class="footer_right  {{serchecked ? '' : 'footer_right_gray'}}">去付款</view>
+            <view class="footer_right  {{serchecked ? '' : 'footer_right_gray'}}">立即采购</view>
         </button>
       </form>
     </block>

+ 18 - 1
pages/index/index.js

@@ -39,21 +39,25 @@ Page({
       {
         src:'/images/news/nav_1.png',
         bg:'#fafcff',
+        type:0,
         href:'/'
       },
       {
         src: '/images/news/nav_2.png',
         bg: '#fef9f8',
-        href: '/pages/login/login'
+        type: 1,
+        href: '/pages/kindSecondList/kindSecondList'
       },
       {
         src: '/images/news/nav_3.png',
         bg: '#f7f6fb',
+        type: 2,
         href: '/customized/pages/index/index'
       },
       {
         src: '/images/news/nav_4.png',
         bg: '#f1f7fc',
+        type: 3,
         href: '/pages/patternMenu/patternMenu'
       }
     ],
@@ -571,6 +575,19 @@ Page({
       url: '/pages/buy/buy?com_id=' + id,
     })
   },
+  navTap(e){
+    console.log(e);
+    let item = e.currentTarget.dataset.item;
+    if (item.type == 1 && !wx.getStorageSync('channelIdObj')) { // 表示是优质的杯,并且还没有登录过渠道
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+    } else {
+      wx.navigateTo({
+        url: item.href,
+      })
+    }
+  }
 
 })
 

+ 6 - 6
pages/index/index.wxml

@@ -5,7 +5,7 @@
   <view class="header-index">
     <image src="/images/news/l_icon.png" mode='widthFix'  class="header_logo"></image>
     <view class="header_search_wrap">
-      <navigator url="/pages/search/search"  class="header_search">
+      <navigator url="/pages/searchList/searchList"  class="header_search">
         <icon type="search"  size="12" color="#929aa0" class="header_search_icon"></icon>
         <view class="header_search_placeholder">{{search.placeholder}}</view>      
       </navigator>
@@ -25,12 +25,12 @@
                   <block wx:if="{{item.banner_flag == '0'}}">
                     <swiper-item  wx:if="{{item.banner_logo}}"  class="banner">  
                         <!-- 跳转到文章 -->
-                        <!-- <block wx:if="{{item.classify_id == '' || item.classify_id == null}}">
+                        <block wx:if="{{item.classify_id == '' || item.classify_id == null}}">
                             <navigator url="/pages/articleInfor/articleInfor?id={{item.banner_find}}">
                               <image  src="{{item.banner_logo}}"  mode="scaleToFill" class="slide-image"></image>  
                             </navigator>  
                         </block>
-
+<!-- 
                         <block wx:elif="{{item.id == '2915'}}">
                             <navigator url="/pages/aboutUs/aboutUs">
                               <image  src="{{item.banner_logo}}"  mode="scaleToFill" class="slide-image"></image>  
@@ -64,7 +64,7 @@
                         </block> -->
 
                         <!-- 跳转到分类 -->
-                        <block>
+                        <block wx:else>
                             <navigator url='/pages/kindSecondList/kindSecondList?classify_name={{item.classify_name}}&classify_des={{item.classify_des}}&id={{item.classify_id}}'>
                               <image  src="{{item.banner_logo}}"  mode="scaleToFill" class="slide-image"></image>  
                             </navigator>
@@ -110,9 +110,9 @@
         <!-- nav -->
         <view class='nav-box'>
           <view class='f-box f-flex-wrap '>
-            <navigator class='nav-item f-box f-align-items-center f-justify-content-center' wx:for="{{navArray}}" style='background:{{item.bg}}' url='{{item.href}}'>
+            <view class='nav-item f-box f-align-items-center f-justify-content-center' wx:for="{{navArray}}" style='background:{{item.bg}}' data-item='{{item}}' bindtap='navTap'>
               <image src='{{item.src}}' mode='aspectFit'></image>
-            </navigator>
+            </view>
           </view>
         </view>
 

+ 1 - 1
pages/kind/index.js

@@ -181,7 +181,7 @@ Page({
   },
   search(){
     wx.redirectTo({
-      url: "/pages/search/search",
+      url: "/pages/searchList/searchList",
     })
   }
 

+ 102 - 327
pages/kindSecondList/kindSecondList.js

@@ -1,370 +1,145 @@
-// kindSecondList.js
-var app = getApp();
-// 列表
-var contentList = [];
 
+var app = getApp();
+var host = app.globalData.servsers;
 Page({
   data: {
-    pageNo: 1,
-    activeIndex: 0,
-    tuijian:[],
-    Title:'',
-    contentList: contentList,
-    navId: 0,
-    systemInfo: [],
-    loadingHidden: false,
-    list: [],
-    num: 1,
-    limt: 20,
-    tab: '',
-    classify_name: '',
-    classify_des: '',
-    id: '',
-    winHeight: "",//窗口高度
-    currentTab: 0, //预设当前项的值
-    scrollLeft: 0, //tab标题的滚动条位置
-    hidden : '',
-    hiddenAll : 'hidden',
-    forid : '',//当前选中tab id
-    searchPageNum: 0,   // 设置加载的第几次,默认是第一次  
-    callbackcount: 10,      //返回数据的个数  
-    searchLoading: false, //"上拉加载"的变量,默认false,隐藏  
-    searchLoadingComplete: false , //“没有数据”的变量,默认false,隐藏  
-    flag : 1,
-    shareFlag : 0,//非分享为0,来自分享页面为1
-  },
-
-  // 滚动切换标签样式
-  switchTab: function (e) {
-    var that = this;
-    var host = getApp().globalData.servsers;
-    // var id = e.currentTarget.dataset.id;
-    var current = e.detail.current;
-    var forid = that.data.contentList[e.detail.current].id;
-    var forname = that.data.contentList[e.detail.current].classify_name;
-    var classifydes = that.data.contentList[e.detail.current].classify_des;
-    this.setData({
-      currentTab: e.detail.current,
-      Title: classifydes
-    })
-    wx.request({
-      url: host + "commodityapi/commoditviewfoeeverybody",
-      data: {
-        commodity_levelTwo: forid,
-        offset: 0,
-        limit: 10,
-      },
-      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-      header: {
-        'Accept': 'application/json'
-      },
-      success: function (res) {
-        that.setData({
-          tuijian: res.data.rows,
-          forid: forid,
-          searchPageNum: 0,   //第一次加载,设置1  
-          searchSongList: [],  //放置返回数据的数组,设为空  
-          isFromSearch: true,  //第一次加载,设置true  
-          searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-          searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-        });
-        if (res.data.rows.length < 10) {
-          that.setData({
-            searchPageNum: 0,   //第一次加载,设置1  
-            searchSongList: [],  //放置返回数据的数组,设为空  
-            isFromSearch: true,  //第一次加载,设置true  
-            searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-            searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-          });
-        }
-        if (res == null || res.data == null) {
-          console.error('网络请求失败');
-          return;
-        }
-      }
-    });
-    that.checkCor();
-  },
-  checkCor: function () { 
-    if (this.data.currentTab > 2) {
-      this.setData({
-        scrollLeft: 300
-      })
-    } else {
-      this.setData({
-        scrollLeft: 0
-      })
-    }
+    contentList: [],
+    forid:null,
+    page:0, // 表示从第一页开始
+    limit:10, // 每页10条数据
+    requestState:true, // 表示可以请求
   },
-
   onLoad: function (options) {
     var that = this;
-    var host = getApp().globalData.servsers;
-    var classify_name = options.classify_name;
-    var flag = options.flag;
-    var shareFlag = options.shareFlag;
-    if (shareFlag != '' && shareFlag != null && shareFlag != undefined){
-      that.setData({
-        shareFlag: shareFlag
-      })
-    }
+    // var classify_name = options.classify_name;
+    // var flag = options.flag;
+    // var shareFlag = options.shareFlag;
+    // if (shareFlag != '' && shareFlag != null && shareFlag != undefined){
+    //   that.setData({
+    //     shareFlag: shareFlag
+    //   })
+    // }
     console.log("id:" + options.id);
     console.log("classify_name:" + options.classify_name);
     console.log("shareFlag:" + options.shareFlag);
     console.log("classify_des: "+options.classify_des);
+    if (options.id){
+      that.getId(that, options.id)
+    } else {
+      that.getGoodsList(that)
+    }
+    
 
     if(options.id == '2298' || options.id == '3000'){//内部员工和VIP禁止分享
       //禁止分享
       wx.hideShareMenu();
     }
 
-    that.setData({
-      id: options.id
-    })
+    // that.setData({
+    //   id: options.id
+    // })
     
-    wx.request({
-      url: host+"classifyapi/findAllforviewSce",
-      data: {
-        id: options.id
-      },
-      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-      header: {
-        'Accept': 'application/json'
-      },
-      success: function (res) {
-        that.setData({
-          contentList: res.data.rows
-        });
-        console.log(res.data.rows);
-        if (res.data.rows != ''){
-          var forid = res.data.rows[0].id;
-          var forname = res.data.rows[0].classify_name;
-          var classifydes = res.data.rows[0].classify_des;
-          wx.request({
-            url: host + "commodityapi/commoditviewfoeeverybody",
-            data: {
-              commodity_levelTwo: forid,
-              offset: 0,
-              limit: 10,
-            },
-            method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-            header: {
-              'Accept': 'application/json'
-            },
-            success: function (res) {
-              that.setData({
-                tuijian: res.data.rows,
-                Title: classifydes,
-                forid: forid,
-                searchPageNum: 0,   //第一次加载,设置1  
-                searchSongList: [],  //放置返回数据的数组,设为空  
-                isFromSearch: true,  //第一次加载,设置true  
-                searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-                searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-              });
-              if (res.data.rows.length<10){
-                that.setData({
-                  searchPageNum: 0,   //第一次加载,设置1  
-                  searchSongList: [],  //放置返回数据的数组,设为空  
-                  isFromSearch: true,  //第一次加载,设置true  
-                  searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-                  searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-                });
-              }
-              console.log(res.data.rows);
-              if (res == null || res.data == null) {
-                console.error('网络请求失败');
-                return;
-              }
-            }
-          });
-        }
+    // wx.request({
+    //   url: host+"classifyapi/findAllforviewSce",
+    //   data: {
+    //     id: options.id
+    //   },
+    //   method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
+    //   header: {
+    //     'Accept': 'application/json'
+    //   },
+    //   success: function (res) {
+    //     that.setData({
+    //       contentList: res.data.rows
+    //     });
+    //     console.log(res.data.rows);
+    //     if (res.data.rows != ''){
+    //       var forid = res.data.rows[0].id;
+    //       var forname = res.data.rows[0].classify_name;
+    //       var classifydes = res.data.rows[0].classify_des;
+          
+    //     }
         
-        if (res == null || res.data == null) {
-          console.error('网络请求失败');
-          return;
-        }
-      }
-    });
-
-    wx.setNavigationBarTitle({
-      title: options.classify_name
-    })
-    this.setData({
-      classify_name: options.classify_name,
-      classify_des: options.classify_des,
-      flag: flag
-    })
-
-    var that = this;
-    //  高度自适应
-    wx.getSystemInfo({
-      success: function (res) {
-        var clientHeight = res.windowHeight,
-            clientWidth = res.windowWidth,
-            rpxR = 750 / clientWidth;
-        var calc = clientHeight * rpxR;
-        that.setData({
-          winHeight: calc
-        });
-      }
-    });
+    //     if (res == null || res.data == null) {
+    //       console.error('网络请求失败');
+    //       return;
+    //     }
+    //   }
+    // });
+
+    // wx.setNavigationBarTitle({
+    //   title: options.classify_name
+    // })
+    // this.setData({
+    //   classify_name: options.classify_name,
+    //   classify_des: options.classify_des,
+    //   flag: flag
+    // })
+    
   },
-
-  footerTap: app.footerTap,
-
-  //切换TAB
-  tagChoose: function (options) {
-    var that = this;
-    var host = getApp().globalData.servsers;
-    var id = options.currentTarget.dataset.id;
-    var forid = options.currentTarget.dataset.forid;
-    var forname = options.currentTarget.dataset.forname;
-    //设置当前样式
-    if (this.data.currentTab == id) {
-      return false;
-    } else {
+  //滚动到底部触发事件  
+  /**
+  * 页面上拉触底事件的处理函数
+  */
+  onReachBottom: function () {
+    let that = this;
+    if (that.data.requestState) {
       that.setData({
-        'firstActive': "",
-        'currentTab': id,
-        Title: forname
+        page: that.data.page + 1
       })
+      that.getGoodsList(that)
     }
+  },
+  getId(that,id){
     wx.request({
-      url: host+"commodityapi/commoditviewfoeeverybody",
-      data: {
-        commodity_levelTwo: forid,
-        offset: 0,
-        limit: 10,
-      },
-      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-      header: {
-        'Accept': 'application/json'
+      url: host + "classifyapi/findAllforviewSce",
+      method:'get',
+      data:{
+        id:id
       },
-      success: function (res) {
+      success(res){
         that.setData({
-          tuijian: res.data.rows,
-          forid: forid,
-          searchPageNum: 0,   //第一次加载,设置1  
-          searchSongList: [],  //放置返回数据的数组,设为空  
-          isFromSearch: true,  //第一次加载,设置true  
-          searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-          searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-        });
-        if (res.data.rows.length < 10) {
-          that.setData({
-            searchPageNum: 0,   //第一次加载,设置1  
-            searchSongList: [],  //放置返回数据的数组,设为空  
-            isFromSearch: true,  //第一次加载,设置true  
-            searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-            searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-          });
-        }
-        if (res == null || res.data == null) {
-          console.error('网络请求失败');
-          return;
-        }
+          forid:res.data.rows[0].id
+        })
+        that.getGoodsList(that)
       }
-    });
-    
-  },
-
-  //下拉刷新
-  onPullDownRefresh: function (e) {
-    this.onLoad();
-    wx.stopPullDownRefresh();
+    })
   },
-
-  fetchSearchList: function () {//加载更多
-
-    var that = this;
-    var host = getApp().globalData.servsers;
-    var forid = that.data.forid;
+  getGoodsList(that){
+    let data = {
+      offset: that.data.page,
+      limit: that.data.limit,
+    }
+    if (that.data.forid) {
+      data.commodity_levelTwo = that.data.forid
+    }
     wx.request({
       url: host + "commodityapi/commoditviewfoeeverybody",
-      data: {
-        commodity_levelTwo: forid,
-        offset: parseInt(that.data.searchPageNum),
-        limit: 10
-      },
+      data: data,
       method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
       header: {
         'Accept': 'application/json'
       },
       success: function (res) {
-        if (res.data.rows.length != 0) {
-          let tuijian = [];
-          //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加  
-          that.data.isFromSearch ? tuijian = res.data.rows : tuijian = that.data.tuijian.concat(res.data.rows)
-          that.setData({
-            tuijian: tuijian, //获取数据数组   
-            searchLoading: true   //把"上拉加载"的变量设为false,显示  
-          });
-          //没有数据了,把“没有数据”显示,把“上拉加载”隐藏  
-        } else {
-          that.setData({
-            searchLoadingComplete: true, //把“没有数据”设为true,显示  
-            searchLoading: false  //把"上拉加载"的变量设为false,隐藏  
-          });
-        }
-
+        let contentList = that.data.contentList;
+        contentList.push(...res.data.rows)
+        that.setData({
+          contentList: contentList,
+          requestState: res.data.rows.length ==that.data.limit
+        });
+     
         if (res == null || res.data == null) {
           console.error('网络请求失败');
           return;
         }
-        wx.hideNavigationBarLoading(
-          that.setData({
-            hidden: 'hidden'
-          })
-        )
       }
     });
   },
-  //滚动到底部触发事件  
-  searchScrollLower: function () {
-    var that = this;
-    if (that.data.searchLoading && !that.data.searchLoadingComplete) {
-      that.setData({
-        searchPageNum: that.data.searchPageNum + 1,  //每次触发上拉事件,把searchPageNum+1  
-        isFromSearch: false  //触发到上拉事件,把isFromSearch设为为false  
-      });
-      that.fetchSearchList();
-    }
-  } ,
-
-  //分享【非“内部购买”和“VIP”】
-  onShareAppMessage: function (res) {
-    var that = this;
-    var host = getApp().globalData.servsers;
-    var contentList = that.data.contentList;
-    var classify_name = that.data.classify_name;
-    var classify_des = that.data.classify_des;
-    var id = that.data.id;
-
-    if (res.from === 'button') {
-      //来自页面内转发按钮
-      console.log(res.target)
-    }
-    return {
-      title: '大良造-精良之选,用心造物!',
-      path: '/pages/kindSecondList/kindSecondList?classify_name=' + classify_name + '&classify_des=' + classify_des + '&id=' + id + '&shareFlag=1',
-      success: function (res) {
-
-      },
-      fail: function (res) {
-        // 转发失败
-      }
-    }
-  }, 
-
-  //返回首页
-  backIndex: function (e) {
-    wx.switchTab({
-      url: '/pages/index/index',
+  toGoodsDetail(e) { // 进入商品详情页
+    let that = this, id = e.currentTarget.dataset.id;
+    wx.navigateTo({
+      url: '/pages/buy/buy?com_id=' + id,
     })
-  }
-
-})
+  },
 
-var that;
-var Util = require('../../utils/util.js'); 
+})

+ 8 - 1
pages/kindSecondList/kindSecondList.json

@@ -1 +1,8 @@
-{"enablePullDownRefresh": true}
+{
+  "enablePullDownRefresh": true,
+    "navigationBarTitleText": "",
+    "usingComponents": {
+      "data-none": "/components/data-none/data-none",
+      "divider": "/components/divider/divider"
+    }
+}

+ 22 - 37
pages/kindSecondList/kindSecondList.wxml

@@ -1,51 +1,36 @@
 <!--kindSecondList.wxml  分类二级列表  bindscrolltolower="pullUpLoad" -->
-<scroll-view class="container">
+<!-- <view class="container">
 
-  <!-- 导航 -->
-  <!-- <view class="header_nav_wrap"  wx:if="{{contentList != ''}}">
-    <scroll-view scroll-x="true" class="header_nav" scroll-left="{{scrollLeft}}">
-      <block wx:for="{{contentList}}" wx:key="id" wx:for-index="i">
-        <view class="each_nav_wrap">             
-          <view  data-id="{{i}}"  data-current="{{i}}" data-forid="{{item.id}}"  data-forname="{{item.classify_name}}"  data-forclassifydes="{{item.classify_des}}" class="header_nav_title  {{currentTab==i?'nav_item_active':''}}"   bindtap="tagChoose">{{item.classify_name}}</view> 
-        </view>
-      </block>
-    </scroll-view>
-  </view> -->
-  <!-- 内容 -->
-  <swiper class="tab-content"   data-forname="{{contentList.classify_name}}"  current="{{currentTab}}"  duration="300" bindchange="switchTab" style="height:{{winHeight}}rpx">
-    <swiper-item wx:for="{{contentList}}" wx:key="index"  wx:for-index="i" >
-        <scroll-view scroll-y class="scoll-h"  data-id="{{i}}" data-forid="{{item.id}}"  data-current="{{i}}"   bindscrolltolower="searchScrollLower">
-          <view class="list"> 
-            <!-- 二级标题 -->
-            <!-- <view class="content_title_wrap">
-              <view class="title_line"></view>
-              <view class="title_contemt">{{Title}}</view>
-            </view> -->
+<view class="list"> 
 
-            <!-- 数据列表 -->
-            <!-- <view class="list_list">              -->
               <block wx:for="{{tuijian}}" wx:key="{{index}}">
                 <navigator url="/pages/buy/buy?com_id={{item.id}}&flag={{flag}}"  class="list_item_wrap">
                   <view class="list_item">
                     <image src="{{item.commodity_logo}}" class="full_image" mode="widthFix"/>
                     <!-- <view class="full_img_footer">{{item.commodity_des}}</view> -->
-                  </view>        
+                  <!-- </view>        
                   <view class="full_title">{{item.commodity_name}}</view>
                   <view class="full_price">¥ {{item.commodity_sale}} <text class='full_price_unit' decode="true">&nbsp;&nbsp;¥{{item.commodity_cost}}&nbsp;&nbsp;</text></view>
                 </navigator>
               </block>
-            <!-- </view> -->
-            <!-- 数据列表结束 -->
 
           </view> 
-          <view class="loading" hidden="{{!searchLoading}}">正在载入更多...</view>  
-          <view class="loading complete" hidden="{{!searchLoadingComplete}}">已加载全部</view>
-        </scroll-view>
-    </swiper-item>
-  </swiper>
-  
-</scroll-view>
-<!-- 回到首页 -->
-<view  bindtap='backIndex'  class="back_btn  {{shareFlag == 1 ? '' : 'back_btn_hidden'}}">
-  <image src='/images/share_back_index.png'  class='back_btn_icon'></image>
-</view>
+</view>  -->
+<view>
+
+<view class="list">
+     <view class='goods-listType2 mar-t20'>
+        <view class='f-box f-flex-wrap f-justify-content-between'>
+          <view class='goods-list' wx:for="{{contentList}}" data-id='{{item.id}}' bindtap='toGoodsDetail'>
+            <image src='{{item.commodity_logo}}' class='goods-img' mode='aspectFit'></image>
+            <!-- <view class='goods-summary'></view> -->
+            <view class='goods-title'>{{item.commodity_name}}</view>
+            <view class='c-theme'>¥{{item.commodity_sale}}</view>
+          </view>
+        </view>
+      </view>
+  </view>
+
+  <data-none wx:if="{{contentList.length === 0}}"></data-none>
+  <divider wx:if="{{!requestState && page !=0}}"></divider>
+  </view>

+ 22 - 277
pages/kindSecondList/kindSecondList.wxss

@@ -2,292 +2,37 @@
 page{
   background-color: #fff;
 }
-.container{
-  height: 100%;
-  /* overflow: hidden; */
-}
-::-webkit-scrollbar{
-  width: 0;
-  height: 0;
-  color: transparent;
-}
-::-webkit-scrollbar-thumb{
-  color:transparent;
-}
-::-webkit-scrollbar-track-piece{
-  color: transparent;
-}
-.header_nav_wrap{
-  width: 100%;
-  height:80rpx;
-  font-size: 24rpx;
-  color: #7f7f7f;
-  border-bottom: 1rpx solid #f0f0f0;
-  position: fixed;
-  top: 0;
-  left: 0;
-  z-index: 10;
-}
-.header_nav{
-  /* display: flex; */
-  white-space: nowrap;
-  background-color: #fff;
-}
-.each_nav_wrap{
-  display: inline-block;
-  width: 33%;
-}
-.header_nav_title{
-  display: inline-block;
-  width: 100%;
-  text-align: center;
-  color:#a0b0b5;
-  border-bottom: 3rpx solid #fff;
-  box-sizing: border-box;
-}
-.nav_item_active{
-  color:#e60012;
-  border-bottom:3rpx solid #e60012; 
-  box-sizing: border-box;
-}
-.each_nav{
-  width: 50%;
-  display: flex;
-  flex-flow: row;
-  justify-content: center;
-  align-items: center;
-}
-.nav_item{
-  display: inline-block;
-  height: 91rpx;
-  padding:0 3rpx 0 23rpx;
-  box-sizing: border-box;
-}
-.header_nav_title{
-  line-height: 80rpx;
-}
-.tab-content{
-  position:relative;
-}
-/*  标题 */
-.content_title_wrap{
-  width:100%;
-  height:50rpx;
-  position:relative;
-  margin:0 auto;
-  padding: 15rpx 0;
-  background-color: #fff;
-  text-align: center;
-}
-.title_line{
-  width:100%;
-  height:1px;
-  background-color: #c4cdd3;
-  position:absolute;
-  top:50%;
-  left:0;
-  margin-top:-0.5px;
-}
-.title_contemt{
-  display: inline-block;
-  padding:0 20rpx;
-  height:50rpx;
-  font-size: 32rpx;
-  line-height: 50rpx;
-  text-align: center;
-  position: relative;
-  margin-top:0;
-  z-index: 2;
-  color: #6f7478;
-  background-color: #fff;
-  max-width: 600rpx;
-  text-overflow: ellipsis;
-  overflow: hidden;
-  white-space: nowrap;
-}
 
 /*  列表 */
 .list{
   display: flex;
   justify-content: space-between;
   flex-wrap: wrap;
-  background-color: #fff;
-  /* margin-top:80rpx; */
 }
-.list_item_wrap{
-  width: 50%;
-  box-sizing: border-box;
-  border-bottom:1px solid #f0f0f0;
+.goods-listType2{
+  padding:30rpx;
+  background:#fff;
 }
-.list_item_wrap:nth-child(odd){
-  border-right:1px solid #f0f0f0;
-}
-.list_item_wrap:nth-child(even){
-  border-left:1px solid #f0f0f0;
-}
-/* .list_list{
-  display: flex;
-  flex-wrap: wrap;
-  justify-content: space-between;
-   padding: 0 0 20rpx;
-} */
-.list_item{
-  width: 100%;
-  /* height:340rpx; */
-  overflow: hidden;
-  position: relative;
-   margin: 0 auto;
+.goods-listType2 .goods-list{
+  width:332rpx;
+  margin-bottom:26rpx;
 }
-.full_image{
+.goods-listType2 .goods-img{
+  width:332rpx;
+  height:332rpx;
+  background:#eeedf2;
   display: block;
-  width: 100%;
-}
-.full_img_footer{
-  width:100%;
-  height:50rpx;
-  font-size: 24rpx;
-  line-height: 50rpx;
-  color:#fff;
-  text-align: center;
-  background-color: rgba(0,0,0,0.6);
-  position: absolute;
-  left: 0;
-  bottom: 0;
-}
-.full_title{
-  height:72rpx;
-  font-size: 30rpx;
-  line-height: 36rpx;
-  color:#444;
-  text-overflow: ellipsis;
-  overflow: hidden;
-  display: -webkit-box;
-  -webkit-line-clamp: 2;
-  -webkit-box-orient: vertical;
-  padding: 23rpx 20rpx 0 32rpx ;
-}
-.full_price{
-  font:bold 30rpx "Microsoft Yahei";
-  color:#e60012;
-  padding: 34rpx 0 30rpx 32rpx;
-}
-.full_price_unit{
-  font: normal  normal  22rpx Arial;
-  text-decoration: line-through;
-  color:#c8c8c8;
-  padding-left:26rpx;
-}
-/* 列表结束 */
-
-/*头部整体样式*/
-.topContainsView {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  margin-top: 10rpx;
-  margin-bottom: 25rpx;
-  border-bottom: solid 2px #ebebeb;
-}
-
-/**
- * 商品样式
-*/
-.goodsImage {
-  width: 200rpx;
-  height: 200rpx;
-}
-
-/*右侧文本整体样式*/
-.topRightView {
-  width: 250px;
-  margin-left: 15rpx;
-  display: flex;
-  flex-direction: column;
-}
-
-/*用户名称样式*/
-.topRightName {
-  font-size: 25rpx;
-}
-
-/*时间样式*/
-.topRightTime {
-  font-size: 25rpx;
-  color: red;
-  margin-top: 10rpx;
-}
-
-/*Item样式中的图标样式 */
-.header_nav_icon {
-  width: 14rpx;
-  height: 8rpx;
-}
-
-/*Item中的文字样式*/
-.headerItemText {
-  font-size: 30rpx;
-  color: #b8b2b2;
-  margin-left: 10rpx;
-  margin-top: 8rpx;
-}
-
-/*销量和评价那一条*/
-.saleAndcom {
-  margin-top: 8rpx;
-  flex-direction: row;
-}
-
-.saletext {
-  font-size: 25rpx;
-}
-
-.saleRightText {
-  position: absolute;
-  right: 0;
-  margin-right: 10rpx;
-  font-size: 25rpx;
-}
-
-/*整体view样式*/
-
-.containsView {
-  box-sizing: border-box;
-  height: 100%;
-  width: 100%;
-  background-color: white;
-  flex-direction: column;
-}
-
-/*顶部view整体样式*/
-
-.headerView {
-  z-index: 1;
-  top: 0;
-  position: fixed;
-  background: #fff;
-  width: 100%;
-  height: 72rpx;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-}
-
-/*每个Item样式*/
-
-.headerNavView {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: center;
-  margin-top: 18rpx;
-}
-
-/*内容会被修剪,并且其余内容是不可见的。*/
-
-.scrollview-list {
-  margin-top: 72rpx;
 }
-.scoll-h{
-  height: 100vh;
-  overflow: hidden;
+.goods-listType2 .goods-summary{
+  height:44rpx;
+  line-height:44rpx;
+  background:#f1f7fc;
+  color:#666666;
+  padding:0 10rpx;
+  overflow: hidden;/*超出部分隐藏*/
+  white-space: nowrap;/*不换行*/
+  text-overflow:ellipsis;/*超出部分文字以...显示*/
+}
+.goods-listType2 .goods-title{
+  margin:10rpx 0;
 }

+ 3 - 3
pages/login/login.js

@@ -98,9 +98,9 @@ Page({
           })
         } else {
           wx.setStorageSync('channelIdObj', res.data)
-          // wx.navigateTo({
-          //   url: '',
-          // })
+          wx.navigateTo({
+            url: '/pages/kindSecondList/kindSecondList',
+          })
         }
       }
     })

+ 3 - 1
pages/mine/mine.js

@@ -58,6 +58,7 @@ Page({
         }
       ]
     },
+    channIdState:false, // 判断渠道是否登陆了,默认没有登陆
   },
 
   onLoad: function () {
@@ -124,7 +125,8 @@ Page({
     that.setData({
       userInfo: userInfo,
       userId: un_id,
-      userRole: userRole
+      userRole: userRole,
+      channIdState: wx.getStorageSync('channelIdObj') ? true : false
     })
   },
   orderList(e){

+ 1 - 1
pages/mine/mine.wxml

@@ -53,7 +53,7 @@
   </view>
 
   <!-- 退出渠道 -->
-  <view class='channe-box'>
+  <view class='channe-box' wx:if="channIdState">
     <button class='f-s30'>退出渠道</button>
   </view>
   

+ 46 - 414
pages/searchList/searchList.js

@@ -1,454 +1,86 @@
-// searchList.js
-//获取应用实例
-// pages/goodlist/goodlist.js
-// var request = require('../../utils/https.js')
-// var uri = 'goods/api/goodslist' //商品列表的的uri
-// var app = getApp();
-// var id = '';
-var navlist = [
-  { id: " ", title: "综合", icon: "../../images/search_list_zh_pre.png" },
-  { id: "price", title: "价格", icon: "../../images/search_list_zh_n.png" }
-];
 
+
+
+var Util = require('../../utils/util.js'); 
+var host = getApp().globalData.servsers;
 // 热销新品
-var contentList = [
-];
 
 
 Page({
   data: {
-    placeholder: "输入搜索关键字",
-    pageNo: 1,
-    activeIndex: 0,
-    navList: navlist,
-    contentList: contentList,
-    navId : 0,
-    systemInfo: [],
-    loadingHidden: false,
-    list: [],
-    num: 1,
-    limt: 20,
-    tab: '',
-    pre0: "../../images/search_list_zh_pre.png",
-    n0: "../../images/search_list_zh_n.png",
-    pre: "../../images/search_list_zh_pre.png",
-    n: "../../images/search_list_zh_n.png",
-    noActPrice: '/images/search_jt_price_up.png',
-    dataVal : "0",
-    hidden: false,
-    page: 0,
-    size: 20,
-    hasMore: true,
-    hasRefesh: false,
+    contentList: [],
     commodity_name: '',
-    host: '',
-    searchPageNum: 0,   // 设置加载的第几次,默认是第一次  
-    callbackcount: 10,      //返回数据的个数  
-    searchLoading: false, //"上拉加载"的变量,默认false,隐藏  
-    searchLoadingComplete: false,  //“没有数据”的变量,默认false,隐藏  
-    tab : '',
-    tabVal : ''
+    page: 0, // 默认第一页
+    limit: 10, // 每页请求最多数据
+    requestState:true, //表示还可以请求
   }, 
-  onLoad: function (options) {
-    var commodity_name = options.commodity_name;
-    var that = this;
-    var host = getApp().globalData.servsers;
-    //检索商品列表
-    wx.request({
-      url: host+"commodityapi/findAllforseach",
-      data: {
-        commodity_name: commodity_name,
-        offset: 0,
-        limit: 10,
-      },
-      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-      header: {
-        'Accept': 'application/json'
-      },
-      success: function (res) {
-        that.setData({
-          contentList: res.data.rows,
-          commodity_name: commodity_name,
-          host: host,
-          searchPageNum: 0,   //第一次加载,设置1  
-          searchSongList: [],  //放置返回数据的数组,设为空  
-          isFromSearch: true,  //第一次加载,设置true  
-          searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-          searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-        });
 
-          console.log(res.data.rows);
 
-        if (res.data.rows.length < 10) {
-          that.setData({
-            searchPageNum: 0,   //第一次加载,设置1  
-            searchSongList: [],  //放置返回数据的数组,设为空  
-            isFromSearch: true,  //第一次加载,设置true  
-            searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-            searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-          });
-        }
-        console.log(res.data.rows)
-        if (res == null || res.data == null) {
-          console.error('网络请求失败');
-          return;
-        }
-      }
-    });
-    
-  },
-  //切换TAB
-  tagChoose: function (options) {
-    var that = this
-    var id = options.currentTarget.dataset.id;
-    var index = e.currentTarget.dataset.index;
-    var type = e.currentTarget.dataset.dataType;
-    if (id == "price" && type == '1'){//价格
-      that.setData({
-        activeIndex: index,
-        pageNo: 1,
-        pre: "../../images/search_list_zh_n.png"
-      })
-    }else{//综合
-      //设置当前样式
-      if (type == '0') {//选择综合
-        that.setData({
-          noActPrice: '/images/search_jt_price_up.png'
-        })
-      }
+ 
+
+  //滚动到底部触发事件  
+  /**
+  * 页面上拉触底事件的处理函数
+  */
+  onReachBottom: function () {
+    let that = this;
+    if (that.data.requestState){
       that.setData({
-        activeIndex: index,
-        pageNo: 1
+        page:that.data.page + 1
       })
+      that.getSearchList(that)
     }
-    
   },
-
-  onTapTag: function (e) {
-    var that = this;
-    var tab = e.currentTarget.id;
-    var index = e.currentTarget.dataset.index;
-    var tabType = e.currentTarget.dataset.type;
-    var tabVal = e.currentTarget.dataset.val;//标志是否是一个tab点击多次(价格)
+  searResult(e){
+    console.log(e,"dd")
+    let that = this;
     that.setData({
-      tab: tab,
-      tabVal: tabVal,
-      searchPageNum: 0
+      commodity_name: e.detail.value,
+      contentList: [],//数据初始化
+      requestState:true, //数据初始化
+      page: 0,//数据初始化
     })
-
-    if (tab == "price" && tabVal == '0') {//切换数据 为  从低到高  (箭头朝上) 
-    wx.request({
-      url: that.data.host+"commodityapi/findAllforseachpricedown",
-        data: {
-          commodity_name: that.data.commodity_name,
-          offset: 0,
-          limit: 10,
-
-        },
-        method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-        header: {
-          'Accept': 'application/json'
-        },
-        success: function (res) {
-          that.setData({
-            contentList: res.data.rows,
-            commodity_name: that.data.commodity_name,
-
-            activeIndex: index,
-            tab: tab,
-            pageNo: 1,
-            dataVal: "1",
-            pre: "../../images/search_list_zh_pre.png",
-            searchPageNum: 0,   //第一次加载,设置1  
-            searchSongList: [],  //放置返回数据的数组,设为空  
-            isFromSearch: true,  //第一次加载,设置true  
-            searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-            searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-          });
-          if (res.data.rows.length < 10) {
-            that.setData({
-              searchPageNum: 0,   //第一次加载,设置1  
-              searchSongList: [],  //放置返回数据的数组,设为空  
-              isFromSearch: true,  //第一次加载,设置true  
-              searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-              searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-            });
-          }
-          console.log(res.data.rows)
-          if (res == null || res.data == null) {
-            console.error('网络请求失败');
-            return;
-          }
-        }
-      });
-   
-    } else if (tab == "price" && tabVal == '1') {//切换数据 为  从高到低  (箭头朝下)
-      wx.request({
-        url: that.data.host +"commodityapi/findAllforseachpriceup",
-        data: {
-          commodity_name: that.data.commodity_name,
-          offset: 0,
-          limit: 10,
-
-        },
-        method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-        header: {
-          'Accept': 'application/json'
-        },
-        success: function (res) {
-          that.setData({
-            contentList: res.data.rows,
-            commodity_name: that.data.commodity_name,
-            activeIndex: index,
-            tab: tab,
-            pageNo: 1,
-            dataVal: "0",
-            pre: "../../images/search_list_zh_n.png",
-            searchPageNum: 0,   //第一次加载,设置1  
-            searchSongList: [],  //放置返回数据的数组,设为空  
-            isFromSearch: true,  //第一次加载,设置true  
-            searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-            searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-          });
-          if (res.data.rows.length < 10) {
-            that.setData({
-              searchPageNum: 0,   //第一次加载,设置1  
-              searchSongList: [],  //放置返回数据的数组,设为空  
-              isFromSearch: true,  //第一次加载,设置true  
-              searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-              searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-            });
-          }
-          if (res == null || res.data == null) {
-            console.error('网络请求失败');
-            return;
-          }
-        }
-      });
-     
-    }else {
-      var that = this;
-      var host = getApp().globalData.servsers;
-      //检索商品列表
+    that.getSearchList(that)
+  },
+  getSearchList(that){
+    if (that.data.commodity_name){
       wx.request({
         url: host + "commodityapi/findAllforseach",
         data: {
           commodity_name: that.data.commodity_name,
-          offset: 0,
-          limit: 10,
-
+          offset: that.data.page,
+          limit: that.data.limit,
         },
         method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
         header: {
           'Accept': 'application/json'
         },
         success: function (res) {
+          let contentList = that.data.contentList;
+          contentList.push(...res.data.rows)
           that.setData({
-            contentList: res.data.rows,
+            contentList: contentList ,
             commodity_name: that.data.commodity_name,
-            host: host, searchPageNum: 0,   //第一次加载,设置1  
-            searchSongList: [],  //放置返回数据的数组,设为空  
-            isFromSearch: true,  //第一次加载,设置true  
-            searchLoading: true,  //把"上拉加载"的变量设为true,显示  
-            searchLoadingComplete: false //把“没有数据”设为false,隐藏 
+            requestState: res.data.rows.length == that.data.limit
           });
-          if (res.data.rows.length < 10) {
-            that.setData({
-              searchPageNum: 0,   //第一次加载,设置1  
-              searchSongList: [],  //放置返回数据的数组,设为空  
-              isFromSearch: true,  //第一次加载,设置true  
-              searchLoading: false,  //把"上拉加载"的变量设为true,显示  
-              searchLoadingComplete: false //把“没有数据”设为false,隐藏 
-            });
-          }
           if (res == null || res.data == null) {
             console.error('网络请求失败');
             return;
           }
         }
       });
-      that.setData({
-        activeIndex: index,
-        tab: tab,
-        pageNo: 1,
-        pre: "../../images/search_list_zh_pre.png"
+    } else {
+      wx.showToast({
+        title: "没有搜索关键词",
+        icon:'none'
       })
-
     }
+    
   },
-
-  //刷新处理
-  // refesh: function (e) {
-  //   var that = this;
-  //   that.setData({
-  //     hasRefesh: true,
-  //   });
-  //   //检索商品列表
-  //   wx.request({
-  //     url: that.data.host+"commodityapi/findAllforseach",
-  //     data: {
-  //       commodity_name: this.data.commodity_name,
-  //       offset: 0,
-  //       limit: 1000
-
-  //     },
-  //     method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-  //     header: {
-  //       'Accept': 'application/json'
-  //     },
-  //     success: function (res) {
-  //       that.setData({
-  //         contentList: res.data.rows
-  //       });
-  //       if (res == null || res.data == null) {
-  //         console.error('网络请求失败');
-  //         return;
-  //       }
-  //     }
-  //   });
-  // },
-
-  fetchSearchList: function () {//加载更多
-
-    var that = this;
-    var host = getApp().globalData.servsers;
-    var forid = that.data.forid;
-    var tab = that.data.tab;
-    var tabVal = that.data.tabVal;
-    if (tab == "price" && tabVal == '0') {//切换数据 为  从低到高  (箭头朝上) 
-      wx.request({
-        url: that.data.host + "commodityapi/findAllforseachpricedown",
-        data: {
-          commodity_name: that.data.commodity_name,
-          offset: parseInt(that.data.searchPageNum)*10,
-          limit: 10
-        },
-        method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-        header: {
-          'Accept': 'application/json'
-        },
-        success: function (res) {
-          if (res.data.rows.length != 0) {
-            let contentList = [];
-            //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加  
-            that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
-            that.setData({
-              contentList: contentList, //获取数据数组   
-              searchLoading: true   //把"上拉加载"的变量设为false,显示  
-            });
-            //没有数据了,把“没有数据”显示,把“上拉加载”隐藏  
-          } else {
-            that.setData({
-              searchLoadingComplete: true, //把“没有数据”设为true,显示  
-              searchLoading: false  //把"上拉加载"的变量设为false,隐藏  
-            });
-          }
-
-          if (res == null || res.data == null) {
-            console.error('网络请求失败');
-            return;
-          }
-          wx.hideNavigationBarLoading(
-            that.setData({
-              hidden: 'hidden'
-            })
-          )
-        }
-      });
-    } else if (tab == "price" && tabVal == '1') {//切换数据 为  从高到低  (箭头朝下)
-      wx.request({
-        url: that.data.host + "commodityapi/findAllforseachpriceup",
-        data: {
-          commodity_name: that.data.commodity_name,
-          offset: parseInt(that.data.searchPageNum)*10,
-          limit: 10
-        },
-        method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-        header: {
-          'Accept': 'application/json'
-        },
-        success: function (res) {
-          if (res.data.rows.length != 0) {
-            let contentList = [];
-            //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加  
-            that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
-            that.setData({
-              contentList: contentList, //获取数据数组   
-              searchLoading: true   //把"上拉加载"的变量设为false,显示  
-            });
-            //没有数据了,把“没有数据”显示,把“上拉加载”隐藏  
-          } else {
-            that.setData({
-              searchLoadingComplete: true, //把“没有数据”设为true,显示  
-              searchLoading: false  //把"上拉加载"的变量设为false,隐藏  
-            });
-          }
-
-          if (res == null || res.data == null) {
-            console.error('网络请求失败');
-            return;
-          }
-          wx.hideNavigationBarLoading(
-            that.setData({
-              hidden: 'hidden'
-            })
-          )
-        }
-      });
-    }else{
-      //检索商品列表
-      wx.request({
-        url: host + "commodityapi/findAllforseach",
-        data: {
-          commodity_name: that.data.commodity_name,
-          offset: parseInt(that.data.searchPageNum),
-          limit: 10
-        },
-        method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
-        header: {
-          'Accept': 'application/json'
-        },
-        success: function (res) {
-          if (res.data.rows.length != 0) {
-            let contentList = [];
-            //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加  
-            that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
-            that.setData({
-              contentList: contentList, //获取数据数组   
-              searchLoading: true   //把"上拉加载"的变量设为false,显示  
-            });
-            //没有数据了,把“没有数据”显示,把“上拉加载”隐藏  
-          } else {
-            that.setData({
-              searchLoadingComplete: true, //把“没有数据”设为true,显示  
-              searchLoading: false  //把"上拉加载"的变量设为false,隐藏  
-            });
-          }
-
-          if (res == null || res.data == null) {
-            console.error('网络请求失败');
-            return;
-          }
-          wx.hideNavigationBarLoading(
-            that.setData({
-              hidden: 'hidden'
-            })
-          )
-        }
-      });
-    }
+  toGoodsDetail(e) { // 进入商品详情页
+    let that = this, id = e.currentTarget.dataset.id;
+    wx.navigateTo({
+      url: '/pages/buy/buy?com_id=' + id,
+    })
   },
-  //滚动到底部触发事件  
-  searchScrollLower: function () {
-    var that = this;
-    if (that.data.searchLoading && !that.data.searchLoadingComplete) {
-      that.setData({
-        searchPageNum: that.data.searchPageNum + 1,  //每次触发上拉事件,把searchPageNum+1  
-        isFromSearch: false  //触发到上拉事件,把isFromSearch设为为false  
-      });
-      that.fetchSearchList();
-    }
-  }  
 })
-var that;
-var Util = require('../../utils/util.js'); 

+ 7 - 1
pages/searchList/searchList.json

@@ -1 +1,7 @@
-{}
+{
+  "navigationBarTitleText": "采购订单",
+  "usingComponents": {
+    "data-none": "/components/data-none/data-none",
+    "divider": "/components/divider/divider"
+  }
+}

+ 17 - 43
pages/searchList/searchList.wxml

@@ -1,58 +1,32 @@
-<!--searchList.wxml  bindscrolltoupper="refesh"  -->
-<scroll-view scroll-y class="container" bindscrolltolower="searchScrollLower" >
 
   <view class="header_fixed">
     <!-- 头部搜索 -->
     <view class="header-search">
       <view class="header_search_wrap">
-        <navigator url="/pages/search/search"  class="header_search">
+        <view class="header_search">
           <icon type="search"  size="12" color="#929aa0"  class="header_search_icon"></icon>
-          <view class="header_search_placeholder">{{placeholder}}</view>      
-        </navigator>
+          <input type="text" class="header_search_placeholder"  bindblur="searResult"  focus="true"  confirm-type="search"  placeholder="输入搜索关键字"  placeholder-style="padding-left:5rpx;color: #929aa0;font-family:'Microsoft Yahei';" />    
+        </view>    
       </view>
+      <view class="cancel_btn"  bindtap="cancelVal">取消</view>   
     </view>
 
-    <!-- 顶部导航栏 -->
-    <view class="header_nav">
-      <block wx:for="{{navList}}" wx:key="{{index}}">
-
-        <view class="each_nav  {{index == activeIndex ? 'nav_item_active' : ''}}">
-          <view bindtap="onTapTag" data-index="{{index}}" id="{{item.id}}"  data-type="{{index == activeIndex ? '1' : '0'}}"  data-val="{{dataVal}}" class="nav_item">
-            <text class="header_nav_title">{{item.title}}</text>             
-
-            <block wx:if="{{index == activeIndex}}">
-              <image class="header_nav_icon" src="{{pre}}" ></image>      
-            </block>
-
-            <block wx:elif="{{index != activeIndex && item.id == 'price'}}">
-              <image class="header_nav_icon_price" src="{{noActPrice}}"></image>      
-            </block> 
-
-            <block wx:else>
-              <image class="header_nav_icon" src="{{n}}"></image>      
-            </block> 
-          </view>
-            
-        </view>
-
-      </block>
-    </view>
   </view>
 
 
   <view class="list">
-    <block wx:for="{{contentList}}" wx:key="{{index}}">
-      <navigator url="/pages/buy/buy?com_id={{item.id}}"  open-type='redirect'  class="list_item_wrap">
-        <view class="list_item">
-          <image src="{{item.commodity_logo}}" class="full_image" mode="widthFix"/>
-          <!-- <view class="full_img_footer">{{item.commodity_des}}</view> -->
-        </view>        
-        <view class="full_title">{{item.commodity_name}}</view>
-        <view class="full_price">¥ {{item.commodity_sale}} <text class='full_price_unit' decode="true">&nbsp;&nbsp;¥{{item.commodity_cost}}&nbsp;&nbsp;</text></view>
-      </navigator>
-    </block>
+     <view class='goods-listType2 mar-t20'>
+        <view class='f-box f-flex-wrap f-justify-content-between'>
+          <view class='goods-list' wx:for="{{contentList}}" data-id='{{item.id}}' bindtap='toGoodsDetail'>
+            <image src='{{item.commodity_logo}}' class='goods-img' mode='aspectFit'></image>
+            <!-- <view class='goods-summary'></view> -->
+            <view class='goods-title'>{{item.commodity_name}}</view>
+            <view class='c-theme'>¥{{item.commodity_sale}}</view>
+          </view>
+        </view>
+      </view>
   </view>
 
-  <view class="loading" hidden="{{!searchLoading}}">正在载入更多...</view>  
-  <view class="loading complete" hidden="{{!searchLoadingComplete}}">已加载全部</view> 
-</scroll-view>
+  <data-none wx:if="{{contentList.length === 0}}"></data-none>
+  <divider wx:if="{{!requestState && page !=0}}"></divider>
+  

+ 33 - 193
pages/searchList/searchList.wxss

@@ -42,16 +42,24 @@ page{
   background-color:#282c2f;
   display: flex;
   align-items: center;
-  justify-content: center;
+  /* justify-content: center; */
+  
 }
 .header_search_icon{
   width:28rpx;
   height:28rpx;
-  margin-right:8rpx;
+  margin:0 8rpx 0 30rpx;
 }
 .header_search_placeholder{
   color:#929aa0;
   font-size: 28rpx;
+  width:100%;
+}
+.cancel_btn{
+  margin-right:30rpx;
+  font-size: 24rpx;
+  text-align: center;
+  color: #fff;
 }
 
 .header_nav_wrap{
@@ -135,200 +143,32 @@ page{
   justify-content: space-between;
   flex-wrap: wrap;
   background-color: #fff;
-  margin-top:200rpx;
+  margin-top:100rpx;
 }
-.list_item_wrap{
-  width: 50%;
-  box-sizing: border-box;
-  border-bottom:1px solid #f0f0f0;
-}
-
-.list_item_wrap:nth-child(odd){
-  border-right:1px solid #f0f0f0;
+.goods-listType2{
+  padding:30rpx;
+  background:#fff;
 }
-.list_item_wrap:nth-child(even){
-  border-left:1px solid #f0f0f0;
+.goods-listType2 .goods-list{
+  width:332rpx;
+  margin-bottom:26rpx;
 }
-
-.list_item{
-  width: 100%;
-  /* height:340rpx; */
-  overflow: hidden;
-  position: relative;
-   margin: 0 auto;
-}
-.full_image{
+.goods-listType2 .goods-img{
+  width:332rpx;
+  height:332rpx;
+  background:#eeedf2;
   display: block;
-  width: 100%;
-}
-.full_img_footer{
-  width:100%;
-  height:50rpx;
-  font-size: 24rpx;
-  line-height: 50rpx;
-  color:#fff;
-  text-align: center;
-  background-color: rgba(0,0,0,0.6);
-  position: absolute;
-  left: 0;
-  bottom: 0;
-}
-.full_title{
-  height:72rpx;
-  font-size: 30rpx;
-  line-height: 36rpx;
-  color:#444;
-  text-overflow: ellipsis;
-  overflow: hidden;
-  display: -webkit-box;
-  -webkit-line-clamp: 2;
-  -webkit-box-orient: vertical;
-  padding: 23rpx 20rpx 0 32rpx ;
 }
-.full_price{
-  font:bold 30rpx "Microsoft Yahei";
-  color:#e60012;
-  padding: 34rpx 0 30rpx 32rpx;
-}
-.full_price_unit{
-  font: normal  normal  22rpx Arial;
-  text-decoration: line-through;
-  color:#c8c8c8;
-  padding-left:26rpx;
-}
-/* 列表结束 */
-
-
-/*头部整体样式*/
-
-.topContainsView {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  margin-top: 10rpx;
-  margin-bottom: 25rpx;
-  border-bottom: solid 2px #ebebeb;
-}
-
-/**
- * 商品样式
-*/
-
-.goodsImage {
-  width: 200rpx;
-  height: 200rpx;
-}
-
-/*右侧文本整体样式*/
-
-.topRightView {
-  width: 250px;
-  margin-left: 15rpx;
-  display: flex;
-  flex-direction: column;
-}
-
-/*用户名称样式*/
-
-.topRightName {
-  font-size: 25rpx;
-}
-
-/*时间样式*/
-
-.topRightTime {
-  font-size: 25rpx;
-  color: red;
-  margin-top: 10rpx;
-}
-
-/*Item样式中的图标样式 */
-
-.header_nav_icon {
-  width: 14rpx;
-  height: 8rpx;
-}
-
-/*Item中的文字样式*/
-
-.headerItemText {
-  font-size: 30rpx;
-  color: #b8b2b2;
-  margin-left: 10rpx;
-  margin-top: 8rpx;
-}
-
-/*销量和评价那一条*/
-
-.saleAndcom {
-  margin-top: 8rpx;
-  flex-direction: row;
-}
-
-.saletext {
-  font-size: 25rpx;
-}
-
-.saleRightText {
-  position: absolute;
-  right: 0;
-  margin-right: 10rpx;
-  font-size: 25rpx;
-}
-
-/*整体view样式*/
-
-.containsView {
-  box-sizing: border-box;
-  height: 100%;
-  width: 100%;
-  background-color: white;
-  flex-direction: column;
-}
-
-/*顶部view整体样式*/
-
-.headerView {
-  z-index: 1;
-  top: 0;
-  position: fixed;
-  background: #fff;
-  width: 100%;
-  height: 72rpx;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-}
-
-/* .top-bar-item {
-  display: inline-block;
-  width: 25%;
-  color: gray;
-  text-align: center;
-  font-size: 28rpx;
-} */
-
-/* .top-bar-active {
-  color: red;
-  font-size: 32rpx;
-} */
-
-/*每个Item样式*/
-.headerNavView {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: center;
-  margin-top: 18rpx;
-}
-
-/*内容会被修剪,并且其余内容是不可见的。*/
-.scrollview-list {
-  margin-top: 72rpx;
-}
-.loading{
-  text-align: center;
-  font-size: 30rpx;
-  line-height: 60rpx;
-  color: #c8c8c8;
+.goods-listType2 .goods-summary{
+  height:44rpx;
+  line-height:44rpx;
+  background:#f1f7fc;
+  color:#666666;
+  padding:0 10rpx;
+  overflow: hidden;/*超出部分隐藏*/
+  white-space: nowrap;/*不换行*/
+  text-overflow:ellipsis;/*超出部分文字以...显示*/
+}
+.goods-listType2 .goods-title{
+  margin:10rpx 0;
 }