Quellcode durchsuchen

增加搜索功能

junyuanz vor 4 Jahren
Ursprung
Commit
8f857faac2

+ 2 - 0
app.json

@@ -8,6 +8,7 @@
     "pages/centcart/centcart",
     "pages/projects/projects",
     "pages/livelist/livelist",
+    "pages/search/search",
     "pages/helpfarm/helpfarm",
     "pages/helpfarm/helpfarm-detail/helpfarm-detail",
     "pages/helpfarm/helpfarm-success/helpfarm-success",
@@ -19,6 +20,7 @@
     "pages/projects/project-detail-noshare/project-detail-noshare",
     "pages/projects/project-comment/project-comment",
     "pages/projects/project-success/project-success",
+	"pages/projects/project-search/project-search",
     "pages/pay/pay",
     "pages/customservice/customservice",
     "pages/web/web",

+ 41 - 4
pages/cart/cart.js

@@ -44,17 +44,18 @@ Page({
 	 clearInterval(this.data.timer); 
   },
   onLoad: function (options) {
-	  clearInterval(this.data.timer);
   	// this.getCartList();
   },
   onShow: function () {
-	  clearInterval(this.data.timer);
   	this.getCartList();
   	this.setData({submitlock: false});
   	this.setData({selectedall: false});
-  	this.getCartListAndSelected();
+	setTimeout(function(){
+		this.getCartListAndSelected();
+	},50);
   },
   getCartList:function(){
+	  clearInterval(this.data.timer); 
   	console.log('getCartList')
   	var that = this
     var url = 'v1/cart/list'
@@ -153,6 +154,9 @@ Page({
 				      	
 				      }
 				      that.getCartList();
+					  that.setData({submitlock: false});
+					  that.setData({selectedall: false});
+					  that.getCartListAndSelected();
 				    }
 				    _request.$post(url, params, success);
 		      } else if (sm.cancel) {
@@ -181,6 +185,9 @@ Page({
 				      	
 				      }
 				      that.getCartList();
+					  that.setData({submitlock: false});
+					  that.setData({selectedall: false});
+					  that.getCartListAndSelected();
 				    }
 				    _request.$post(url, params, success);
 		      } else if (sm.cancel) {
@@ -225,6 +232,9 @@ Page({
     }
     _request.$post(url, params, success);
     this.getCartList();
+	that.setData({submitlock: false});
+	that.setData({selectedall: false});
+	that.getCartListAndSelected();
   },
   itemselected:function(e){
   	console.log(this)
@@ -310,6 +320,9 @@ Page({
       console.log('mulChangeState',res)
       if(res.data.result){
       	that.getCartList();
+		that.setData({submitlock: false});
+		that.setData({selectedall: false});
+		that.getCartListAndSelected();
       }
     }
     _request.$post(url, params, success);
@@ -389,6 +402,9 @@ Page({
 				      	
 				      }
 				      that.getCartList();
+					  that.setData({submitlock: false});
+					  that.setData({selectedall: false});
+					  that.getCartListAndSelected();
 				    }
 				    _request.$post(url, params, success);
 		      } else if (sm.cancel) {
@@ -474,10 +490,31 @@ Page({
 						
 					}else{
 						that.setData({
-							['seckillruntimearr['+index+']']:'秒杀已结束,左滑商品从购物车删除'
+							['seckillruntimearr['+index+']']:'秒杀已结束'
 						})
+						
+						var url = "/v1/cart/mult_delele";
+						var params = {
+							ids:that.data.cartList[index].id
+						}
+						var success = function (res) {
+						  console.log(res)
+						  if(res.data.result){
+							
+						  }
+						  clearInterval(that.data.timer); 
+						  that.getCartList();
+						  that.setData({submitlock: false});
+						  that.setData({selectedall: false});
+						  that.getCartListAndSelected();
+						}
+						_request.$post(url, params, success);
 					}
 				}
+			}else{
+				that.setData({
+					['seckillruntimearr['+index+']']:''
+				})
 			}
 		}
 		

+ 3 - 3
pages/cart/cart.wxml

@@ -49,8 +49,8 @@
 			  <view class="time-text">{{seckillruntimearr[index]}}</view>
 			</view>
 			<view class="main_item">
-		      <movable-area style="{{item.package?'height:'+(210+item.package_list.length * 14)+'rpx':''}}">
-		        <movable-view damping="100" out-of-bounds="true" direction="horizontal" x="{{item.movex}}" id="{{index}}" animation="false" bindchange="handleMovableChange" capture-bind:touchstart="handleTouchestart" capture-bind:touchend="handleTouchend" style="{{item.package?'height:'+(210+item.package_list.length * 14)+'rpx':''}}">
+		      <movable-area style="{{item.package?'height:'+(210+item.package_list.length * 28)+'rpx':''}}">
+		        <movable-view damping="100" out-of-bounds="true" direction="horizontal" x="{{item.movex}}" id="{{index}}" animation="false" bindchange="handleMovableChange" capture-bind:touchstart="handleTouchestart" capture-bind:touchend="handleTouchend" style="{{item.package?'height:'+(210+item.package_list.length * 28)+'rpx':''}}">
 		          <view class="main_item_content ">
 		          		  <view class="cartlist_item">
 						   	  <view class="cartlist_select {{item.IsBuy ? 'active' : ''}}" bindtap="itemselected" data-count="{{item.count}}" data-id='{{item.id}}' data-price="{{item.original_price}}" data-index="{{index}}">
@@ -82,7 +82,7 @@
 		          </view>
 		        </movable-view>
 		      </movable-area>
-		      <view class="delete_btn" data-productIndex="{{index}}" data-id='{{item.id}}' bindtap="delitem" style="{{item.package?'height:'+(210+item.package_list.length * 14)+'rpx;line-height:'+(210+item.package_list.length * 14)+'rpx':''}}">删除</view>
+		      <view class="delete_btn" data-productIndex="{{index}}" data-id='{{item.id}}' bindtap="delitem" style="{{item.package?'height:'+(210+item.package_list.length * 28)+'rpx;line-height:'+(210+item.package_list.length * 28)+'rpx':''}}">删除</view>
 		    </view>
 	    </view>
 	</view>

+ 34 - 1
pages/home/home.js

@@ -58,9 +58,19 @@ Page ({
     showtime: '',
     projects_more:true,
     userinfo:{},
-	nowseckill_data:''
+	nowseckill_data:'',
+	
+	statusBarHeight:20,
+	navBarHeight:45,
+	windowWidth:375,
+	word:''
   },
   onLoad: function () {
+	  const info = wx.getSystemInfoSync();
+	  console.log('info',info);
+	  this.setData({
+		statusBarHeight:info.statusBarHeight
+	  })
     // this.getzhunongList()
     this.setData({
       vershow: getApp().globalData.vershow,
@@ -69,6 +79,9 @@ Page ({
     if (getApp().globalData.wx_id) {
       this.info()
     }
+	this.getData()
+	
+	
     this.getBanners()
     this.getCategories()
     this.getList()
@@ -84,6 +97,7 @@ Page ({
     })
     this.geticons()
     this.getkilltime()
+	
     
   },
   onShow: function () {
@@ -119,6 +133,19 @@ Page ({
       swiperCurrent: e.detail.current
     })
   },
+  getData: function () {
+    var that = this
+    var url = 'v1/product/commend_words'
+  	var params = {}
+    var success = function (res) {
+      console.log('res',res.data.list);
+  	  that.setData({
+  		  word:res.data.list[0].title
+  	  })
+  	  
+    }
+    _request.$get(url, params, success)
+  },
   getVersion: function () {
     var that = this
     var url = 'v1/cat/3/products'
@@ -180,6 +207,12 @@ Page ({
       url: '/pages/projects/project-detail/project-detail?id=' + id
     })
   },
+  tosearch: function (val) {
+    var id = val.currentTarget.dataset.val;
+    wx.navigateTo({
+      url: '/pages/search/search'
+    })
+  },
   toCustom: function () {
     wx.reLaunch({
       url: '/pages/customservice/customservice'

+ 8 - 0
pages/home/home.wxml

@@ -1,4 +1,12 @@
 <view class="bg">
+	<!-- 顶部导航 -->
+	<view class="navbar" style="top:{{statusBarHeight}}px" bindtap="tosearch">
+		<view class="page__hd">
+			<image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/search.png"></image>
+			<view class="page__desc">{{word}}</view>
+		</view>
+	</view>
+	
   <!-- <view class="newyear" bindtap="newyear">新年入口</view> -->
   <view class="home">
     <view class="swiper-container">

+ 26 - 0
pages/home/home.wxss

@@ -1059,4 +1059,30 @@ font-size: 14px;
   transform: translate(-50%,-50%);
   width: 94rpx;
   height: 94rpx;
+}
+
+.navbar{
+	position: absolute;
+	    /* top: 50rpx; */
+	    z-index: 999;
+	    background: rgba(255,255,255,0.75);
+	    left: 15rpx;
+	    width: 70%;
+	    border-radius: 45rpx;
+		    border: 1rpx solid #cdcdcd;
+			margin-top: 10rpx;
+}
+.page__hd{padding: 6rpx 35rpx;}
+.page__hd image{
+	width: 30rpx;
+	    height: 30rpx;
+	    display: inline-block;
+	    vertical-align: middle;
+}
+.page__title{    float: left;}
+.page__desc{
+	    display: inline-block;
+	    padding-left: 20rpx;
+	    color: #666;
+	        font-size: 28rpx;
 }

+ 8 - 4
pages/pay/pay.js

@@ -119,9 +119,9 @@ Page({
 	  for(var i in val.data.product_list){
 		  var item = val.data.product_list[i];
 		  if(item.pv >= item.price){
-			   canusebalance = canusebalance + item.price;
+			   canusebalance = canusebalance + (item.price * item.count);
 		  }else{
-			  nousebalance = nousebalance + item.price;
+			  nousebalance = nousebalance + (item.price * item.count);
 		  }
 	  }
 	  
@@ -171,16 +171,19 @@ Page({
 
 		var afterdec = 0;
 		if(that.data.receivetype == 0){
+			console.log('val.data.total',val.data.total);
+			console.log('that.data.canusebalance',that.data.canusebalance);
+			console.log('that.data.yunfei',that.data.yunfei);
 			if(parseInt(val.data.total) >= parseInt(that.data.canusebalance) + parseInt(that.data.yunfei)){
 				afterdec = that.data.nousebalance;
 			}else{
-				afterdec = (that.data.canusebalance + that.data.yunfei)-val.data.total + that.data.nousebalance;
+				afterdec = Math.abs((that.data.canusebalance + that.data.yunfei)-val.data.total) + that.data.nousebalance;
 			}
 		}else{
 			if(parseInt(val.data.total) >= parseInt(that.data.canusebalance)){
 				afterdec = that.data.nousebalance;
 			}else{
-				afterdec = (that.data.canusebalance)-val.data.total + that.data.nousebalance;
+				afterdec = Math.abs((that.data.canusebalance)-val.data.total) + that.data.nousebalance;
 			}
 		}
 
@@ -513,6 +516,7 @@ Page({
 		yunfei : e.target.dataset.value == 0 ? this.data._yunfei : 0
 	})
 	wx.setStorageSync('receivetype', e.target.dataset.value) //存入
+	this.getBalanceInfo()
   },
   getpickdeparts: function () {
     var that = this

+ 174 - 0
pages/projects/project-search/project-search.js

@@ -0,0 +1,174 @@
+var _request = require('../../../utils/request.js')
+Page({
+  data: {
+    projects_page: 1,
+    projects_per_page: 5,
+    projects_more: true,
+    projects_change: false,
+    projects: [],
+    vershow: true,
+    navData:[],
+    currentTab: 0,
+    navScrollLeft: 0,
+    balance: 0,
+    todaysend: Date.parse(new Date()) / 1000,
+	searchword:''
+  },
+  onLoad: function (options) {
+	  console.log('onload-options',options.searchword);
+    this.getBalanceInfo()
+    this.setData({
+      vershow: getApp().globalData.vershow,
+      // currentTab:options.currentTab ? options.currentTab : 0,
+	  searchword:options.words ? options.words : ''
+      // currentTab: getApp().globalData.isshow
+    })
+    if (getApp().globalData.isupdate == true) {
+      this.getType()
+    }
+    wx.getSystemInfo({
+      success: (res) => {
+        this.setData({
+          windowWidth: res.windowWidth
+        })
+      }
+    })
+  },
+  onShow: function () {
+    if (getApp().globalData.isshow) {
+      this.setData({
+        // currentTab: getApp().globalData.isshow,
+        projects_more: true,
+        projects_page: 1,
+        projects_change: true,
+      })
+      this.getType()
+    }
+  },
+  onUnload: function () {
+    getApp().globalData.isshow = ''
+    // this.setData({
+    //   currentTab: 0,
+    // })
+  },
+  onHide: function () {
+    getApp().globalData.isshow = ''
+    // this.setData({
+    //   currentTab: 0,
+    // })
+  },
+  onPullDownRefresh: function () {
+    this.setData({
+      projects_more: true,
+      projects_page: 1,
+      projects_change: true
+    })
+    this.getProjects()
+    wx.stopPullDownRefresh()
+  },
+  onReachBottom: function () {
+    if (this.data.projects_more) {
+      var page = this.data.projects_page + 1
+      this.setData({
+        projects_page: page
+      })
+      this.getProjects()
+    }
+  },
+  getType: function () {
+    var that = this
+    var url = 'v1/product/cats'
+    var params = {}
+    var success = function (res) {
+      that.setData({
+        navData: res.data
+      })
+      that.getProjects()
+    }
+    _request.$get(url, params, success)
+  },
+  getProjects: function () {
+    var id = this.data.navData[this.data.currentTab].id
+    if (!this.data.vershow) {
+      id = 3
+    }
+    var that = this
+	
+    var url = 'v1/cat/' + id + '/products'
+	if(that.data.searchword){
+		var params = {
+		  // page: this.data.projects_page,
+		  // per_page: this.data.projects_per_page,
+		  words:that.data.searchword
+		}
+	}else{
+		var params = {
+		  page: this.data.projects_page,
+		  per_page: this.data.projects_per_page
+		}
+	}
+    
+	console.log('searchword',that.data.searchword)
+	
+    var success = function (res) {
+      if (that.data.projects_change) {
+        that.setData({
+          projects: [],
+          projects_change: false
+        })
+      }
+      var result = that.data.projects.concat(res.data.list || [])
+      that.setData({
+        projects: result
+      })
+      var listMore = res.data.list_count > that.data.projects.length
+      that.setData({
+        projects_more: listMore
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  toProject: function (val) {
+    var id = val.currentTarget.dataset.val
+    wx.navigateTo({
+      url: '/pages/projects/project-detail/project-detail?id=' + id
+    })
+  },
+  switchNav(event){
+    var cur = event.currentTarget.dataset.current
+    var singleNavWidth = this.data.windowWidth / 5
+    this.setData({
+        navScrollLeft: (cur - 2) * singleNavWidth
+    })
+    if (this.data.currentTab == cur) {
+      return false
+    } else {
+      this.setData({
+        currentTab: cur,
+        projects_more: true,
+        projects_page: 1,
+        projects_change: true
+      })
+      this.getProjects()
+    }
+  },
+  getBalanceInfo () {
+    var that = this
+    var url = 'v1/user/balance/info'
+    var params = {
+    }
+    var success = function (res) {
+      var result = res.data.total
+      that.setData({
+        balance: result
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      // path: '/pages/start/start?url=pages/projects/projects',
+      sc: 'xcx_products'
+    })
+  }
+})

+ 10 - 0
pages/projects/project-search/project-search.json

@@ -0,0 +1,10 @@
+{
+  "navigationBarTitleText": "搜索结果",
+  "usingComponents": {
+    "currency": "../../../component/currency/currency",
+    "format-time": "../../../component/formatTime/formatTime"
+  },
+  "enablePullDownRefresh": true,
+  "backgroundColor": "#f2f4f6",
+  "backgroundTextStyle": "dark"
+}

+ 41 - 0
pages/projects/project-search/project-search.wxml

@@ -0,0 +1,41 @@
+<view class="bg">
+  <view class="projects">
+    <view class="projectbg">
+      <!-- <view class="scrollview" wx:if="{{vershow}}">
+         <scroll-view scroll-x="true" class="nav" scroll-left="{{navScrollLeft}}" scroll-with-animation="{{true}}">
+          <block wx:for="{{navData}}" wx:for-index="idx" wx:for-item="navItem" wx:key="idx">
+              <view class="nav-item {{currentTab == idx ?'active':''}}"  data-current="{{idx}}" bindtap="switchNav">{{navItem.name}}</view>
+          </block>
+         </scroll-view>
+      </view> -->
+      <view class="project" wx:key="{{index}}" wx:for="{{projects}}"  data-val="{{item.id}}" bindtap="toProject">
+        <view class="project-left">
+          <view class="project-title ellipsisLn">{{item.name}}</view>
+          <view class="project-count">已售{{item.sold_count}}件</view>
+          <view class="project-price" style="padding-top:25rpx">
+            <image wx:if="{{item.seckill_state === 'seckill'}}" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/miaosha.png" class="project-miaosha-img"/>
+			<view wx:if="{{item.is_deliver}}" class="project-miaosha">
+				<span wx:if="{{item.deliver_state == 1}}">预售</span>
+				<span wx:if="{{item.deliver_state == 2}}">预售</span>
+				<span wx:if="{{item.deliver_state == 3}}">已售罄</span>
+			</view>
+            <view class="project-price" style="margin-bottom: 10rpx;padding-top:20rpx;color: #999;text-decoration: line-through;font-size: 23rpx;">零售价:<currency symbol="¥" value="{{item.user_sale_price}}" /></view>
+            <currency symbol="¥" value="{{item.price}}" style="font-size:35rpx" /><!-- <currency symbol="¥" value="{{item.price}}" wx:if="{{balance === 0 || balance < item.price}}"></currency> <text wx:if="{{balance !== 0 && balance >= item.price}}" class="project-point">{{item.price}}提货券</text> -->
+            <!--<image wx:if="{{item.mall_balance_price}}" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/integralpay_icon.png" style="float: right;width: 30rpx;height: 30rpx;margin-left: 5rpx;margin-top: 5rpx;"></image>
+            <image wx:if="{{item.robo_balance_price}}" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/rabbitpay_icon.png" style="float: right;width: 30rpx;height: 30rpx;margin-top: 4rpx;"></image>
+            <image wx:if="{{item.price}}" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/weixinpay.png" style="float: right;width: 30rpx;height: 30rpx;margin-top: 4rpx;;margin-right: 5rpx;"></image>-->
+          </view>
+          
+        </view>
+        <image class="project-right" src="{{item.cover}}"></image>
+        <view class="project-out" wx:if="{{item.left_count <= 0}}"></view>
+        <view class="project-green" wx:if="{{item.is_support_poor === 1}}"></view>
+        <view class="project-stop" wx:if="{{todaysend < item.deliver_start_time && todaysend > item.deliver_stop_time}}">将于<format-time type="formatmonth2" value="{{item.deliver_start_time}}"></format-time>发货</view>
+        <view class="clean"></view>
+      </view>
+      
+	  <view wx:if="{{projects.length == 0}}" style="text-align: center;color:#999">无相关内容</view>
+      <view><text wx:if="{{projects_more}}" style="text-align: center;padding: 10px;color: #999;display: block;margin-bottom: 15px;">正在努力加载...</text></view>
+    </view>
+  </view>
+</view>

+ 144 - 0
pages/projects/project-search/project-search.wxss

@@ -0,0 +1,144 @@
+.bg {
+  width: 100%;
+  min-height: 100%;
+  background-color: #fff;
+}
+.projects {
+  padding-top: 25rpx;
+}
+.projectbg {
+  background-color: #fff;
+  padding-bottom: 1rpx;
+}
+.project {
+  position: relative;
+  margin: 0 auto;
+  width: 710rpx;
+  height: 284rpx;
+  background-color: #f7f7f7;
+  margin-bottom: 20rpx;
+  border-radius: 8rpx;
+}
+.project-left {
+  float: left;
+  width: 390rpx;
+  padding-left: 20rpx;
+  padding-top: 15rpx;
+}
+.project-title {
+  font-size: 28rpx;
+  color: #2b2b2b;
+  line-height: 36rpx;
+  height: 72rpx;
+  -webkit-line-clamp: 2;
+}
+.project-right {
+  float: right;
+  margin-right: 10rpx;
+  margin-top: 10rpx;
+  display: block;
+  width: 258rpx;
+  height: 258rpx;
+  /*border: 1rpx solid #dddddd;*/
+}
+.project-count {
+  padding-top: 15rpx;
+  font-size: 24rpx;
+  color: #bbbbbb;
+}
+.project-price {
+  padding-top: 90rpx;
+  font-size: 28rpx;
+  color: #eab86a;
+}
+.project-point {
+  /* color: #bbbbbb; */
+  color: #eab86a;
+  font-size: 24rpx;
+  margin-top: 4rpx;
+  margin-left: 10rpx;
+}
+.project-out {
+  position: absolute;
+  right: 20rpx;
+  bottom: 20rpx;
+  width: 66rpx;
+  height: 66rpx;
+  background-image: url('https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/sellout.png');
+  background-size: 100% 100%;
+  z-index: 10;
+}
+.project-green {
+  position: absolute;
+  right: 10rpx;
+  top: 10rpx;
+  width: 48rpx;
+  height: 48rpx;
+  background-image: url('https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/green.png');
+  background-size: 100% 100%;
+  z-index: 10;
+}
+.scrollview {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 80rpx;
+  z-index: 999;
+  background-color: #f8f9fb;
+}
+.nav {
+    height: 80rpx;
+    width: 100%;
+    box-sizing: border-box;
+    overflow: hidden;
+    line-height: 80rpx;
+    background-color: #f8f9fb;
+    font-size: 26rpx;
+    white-space: nowrap;
+    color: #888888;
+}
+.nav-item {
+    width: 20%;
+    display: inline-block;
+    text-align: center;
+}
+.nav-item.active{
+    color: #eab86a;
+}
+ .project-miaosha-img {
+   width: 60rpx;
+   height: 28rpx;
+   display: inline-block;
+   float: left;
+   padding-top: 95rpx;
+   padding-right: 10rpx;
+   font-size: 20rpx;
+ }
+ .project-miaosha {
+   width: 85rpx;
+   height: 28rpx;
+   display: inline-block;
+   float: left;
+   padding-top: 95rpx;
+   padding-right: 10rpx;
+   font-size: 20rpx;
+ }
+ .project-miaosha span{
+	     background: #f00;
+	     color: #FFF;
+	     padding: 5rpx 10rpx;
+	     border-radius: 15px;
+ }
+.project-stop {
+  height: 38rpx;
+  width: 258rpx;
+  background: #ffefe4;
+  color: #ff9434;
+  position: absolute;
+  right: 10rpx;
+  bottom: 13rpx;
+  font-size: 20rpx;
+  text-align: center;
+  line-height: 38rpx;
+}

+ 18 - 6
pages/projects/projects.js

@@ -11,13 +11,15 @@ Page({
     currentTab: 0,
     navScrollLeft: 0,
     balance: 0,
-    todaysend: Date.parse(new Date()) / 1000
+    todaysend: Date.parse(new Date()) / 1000,
+	searchword:''
   },
   onLoad: function (options) {
     this.getBalanceInfo()
     this.setData({
       vershow: getApp().globalData.vershow,
-      currentTab:options.currentTab ? options.currentTab : 0
+      currentTab:options.currentTab ? options.currentTab : 0,
+	  searchword:options.searchword ? options.searchword : ''
       // currentTab: getApp().globalData.isshow
     })
     if (getApp().globalData.isupdate == true) {
@@ -90,11 +92,21 @@ Page({
       id = 3
     }
     var that = this
+	
     var url = 'v1/cat/' + id + '/products'
-    var params = {
-      page: this.data.projects_page,
-      per_page: this.data.projects_per_page
-    }
+	if(that.data.searchword){
+		var params = {
+		  page: this.data.projects_page,
+		  per_page: this.data.projects_per_page,
+		  words:this.data.searchword
+		}
+	}else{
+		var params = {
+		  page: this.data.projects_page,
+		  per_page: this.data.projects_per_page
+		}
+	}
+    
     var success = function (res) {
       if (that.data.projects_change) {
         that.setData({

+ 64 - 0
pages/search/search.js

@@ -0,0 +1,64 @@
+var _request = require('../../utils/request.js')
+Page({
+  data: {
+	statusBarHeight:20,
+	navBarHeight:45,
+	windowWidth:375,
+	wordlist:[],
+	searchword:''
+  },
+  onLoad: function () {
+	  const info = wx.getSystemInfoSync();
+	  console.log('info',info);
+	  this.setData({
+	  	statusBarHeight:info.statusBarHeight
+	  })
+  },
+  onShow: function () {
+	  this.getData()
+  },
+  onUnload: function () {
+  },
+  onHide: function () {
+  },
+  getData: function () {
+    var that = this
+    var url = 'v1/product/commend_words'
+	var params = {}
+    var success = function (res) {
+      console.log('res',res.data.list);
+	  that.setData({
+		  wordlist:res.data.list
+	  })
+	  
+    }
+    _request.$get(url, params, success)
+  },
+  setword:function(e){
+	  var that = this;
+	  console.log('e',e);
+	  var word = e.currentTarget.dataset.word;
+	  that.setData({
+		  searchword:word
+	  })
+	  
+	  that.tosearch();
+  },
+  tosearch:function(){
+	  console.log('tosearch')
+	  var word = this.data.searchword;
+	  if(word == ''){
+	  	word = this.data.wordlist[0]['title']
+	  }
+	  wx.navigateTo({
+	    url: '../projects/project-search/project-search?words=' + word
+	  })
+  },
+  bindword: function (e) {
+	  var word = e.detail.value;
+	  
+    this.setData({
+      searchword: word
+    })
+  },
+})

+ 9 - 0
pages/search/search.json

@@ -0,0 +1,9 @@
+{
+  "navigationBarTitleText": "商品搜索",
+  "usingComponents": {
+    "currency": "../../component/currency/currency",
+    "format-time": "../../component/formatTime/formatTime"
+  },
+  "backgroundColor": "#f2f4f6",
+  "backgroundTextStyle": "dark"
+}

+ 18 - 0
pages/search/search.wxml

@@ -0,0 +1,18 @@
+<view class="bg">
+	<view class="searchbox">
+		<view class="searchtxt">
+			<input type="text" placeholder="{{wordlist[0].title}}" auto-focus bindinput="bindword"/>
+			<button bindtap="tosearch">搜索</button>
+		</view>
+	</view>
+	
+	<view class="searchtj">
+		<view class="searchtj-title">搜索推荐</view>
+		
+		<view wx:for="{{wordlist}}" class="worditem" data-word="{{item.title}}" bindtap="setword">
+			{{item.title}}
+		</view>
+	</view>
+	
+	
+</view>

+ 99 - 0
pages/search/search.wxss

@@ -0,0 +1,99 @@
+.livelist{
+    width: 46%;
+    float: left;
+    margin: 0 2%;
+    margin-top: 10px;
+    padding: 15rpx;
+    overflow: hidden;
+    box-sizing: border-box;
+    border: 1px solid #ddd;
+	position: relative;
+}
+.livelist image{
+	    max-height: 100%;
+	    width: 100%;
+	    height: 280rpx;
+}
+.livelist .title{
+font-size: 32rpx;
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}
+.livelist .startt span{
+	    font-size: 20rpx;
+	    float: right;
+	    color: #eab86a;
+}
+.livelist .startt{
+	font-size: 24rpx;
+	color: #eab86a;
+	white-space: nowrap;
+}
+.livelist .status{
+    position: absolute;
+    top: 10px;
+    color: #f00;
+    right: 10px;
+    font-size: 30rpx;
+}
+
+.navbar{
+	position: absolute;
+	    /* top: 50rpx; */
+	    z-index: 999;
+	    background: rgba(255,255,255,0.6);
+	    left: 10%;
+	    width: 55%;
+	    border-radius: 45rpx;
+		    border: 1rpx solid #cdcdcd;
+			margin-top: 10rpx;
+}
+.page__hd{padding: 8rpx 35rpx;}
+.page__title{    float: left;}
+.page__desc{}
+.navback{}
+
+.searchbox{
+	background: #eab86a;
+	padding: 15rpx;
+}
+.searchtxt{
+	 background: #fff;
+	 padding: 10rpx 15rpx;
+	 border-radius: 45rpx;   
+	    
+}
+.searchtxt input{
+padding-left: 55rpx;
+    width: 80%;
+    display: inline-block;
+    line-height: 35rpx;
+    vertical-align: middle;
+    box-sizing: border-box;
+}
+.searchtxt button{
+	width: 20%;
+	    display: inline-block;
+	    font-size: 30rpx;
+	    line-height: 20rpx;
+	    padding: 20rpx 15rpx;
+	    background: #eab86a;
+	    border-radius: 45rpx;
+	    vertical-align: middle;
+	    color: #FFF;
+	    box-sizing: border-box;
+}
+
+.searchtj{    padding: 35rpx 20rpx;}
+.searchtj-title{
+	font-size: 34rpx;
+	    color: #666;
+}
+.worditem{display: inline-block;
+    margin-top: 20rpx;
+    margin-right: 20rpx;
+    background: #eee;
+    padding: 10rpx 30rpx;
+    font-size: 28rpx;
+    border-radius: 45rpx;}