|
@@ -70,33 +70,38 @@ Page({
|
|
|
totalCount:0,
|
|
|
listId:"",
|
|
|
show:true,
|
|
|
- lType:"loading"
|
|
|
+ lType:"loading",
|
|
|
+ activity_tags:"",
|
|
|
+ pid:"9112489_209622235",
|
|
|
+ keyword:""
|
|
|
},
|
|
|
|
|
|
_asyncData() {
|
|
|
this.setData({
|
|
|
- scrollAbleTabs: [{
|
|
|
- tab: '精选',
|
|
|
- key: 'treasure'
|
|
|
+ scrollAbleTabs: [
|
|
|
+ {
|
|
|
+ tab: '精选',
|
|
|
+ key: '0'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tab: '秒杀',
|
|
|
+ key: '4'
|
|
|
}, {
|
|
|
- tab: '居家生活',
|
|
|
- key: 'life'
|
|
|
+ tab: '百亿补贴',
|
|
|
+ key: '7'
|
|
|
}, {
|
|
|
- tab: '美食厨房',
|
|
|
- key: 'food'
|
|
|
+ tab: '千万补贴',
|
|
|
+ key: '10851'
|
|
|
}, {
|
|
|
- tab: '服饰珠宝',
|
|
|
- key: 'cloth'
|
|
|
- }, {
|
|
|
- tab: '美妆洗护',
|
|
|
- key: 'cosmetics'
|
|
|
+ tab: '品牌',
|
|
|
+ key: '31'
|
|
|
},{
|
|
|
- tab:'家用电器',
|
|
|
- key:'one'
|
|
|
+ tab:'官方爆品',
|
|
|
+ key:'10564'
|
|
|
},
|
|
|
{
|
|
|
- tab:'运动女装',
|
|
|
- key:'sport'
|
|
|
+ tab:'大牌',
|
|
|
+ key:'24'
|
|
|
}],
|
|
|
});
|
|
|
},
|
|
@@ -106,45 +111,158 @@ Page({
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
// this._asyncData
|
|
|
- setTimeout(this._asyncData, 0);
|
|
|
- //获取数据
|
|
|
- var that = this;
|
|
|
- that.page = 1
|
|
|
- that.pageSize = 18
|
|
|
- wx.request( {
|
|
|
- url: "http://49.234.19.130:8081/v1/pdd/ddk/search",
|
|
|
- //url: "http://127.0.0.1:8081/v1/pdd/ddk/search",
|
|
|
- header: {
|
|
|
- "Content-Type": "application/json"
|
|
|
- },
|
|
|
- method: "POST",
|
|
|
- //data: { cityname: "上海", key: "1430ec127e097e1113259c5e1be1ba70" },
|
|
|
- data: { page: that.page.toString(), page_size: that.pageSize.toString() },
|
|
|
- complete: function( res ) {
|
|
|
- wx.hideLoading();
|
|
|
- console.log(res)
|
|
|
- that.totalCount = res.data.data.goods_search_response.total_count
|
|
|
- for (var i = 0; i < res.data.data.goods_search_response.goods_list.length; i++) {
|
|
|
- that.data.goodsList.push( res.data.data.goods_search_response.goods_list[i]);
|
|
|
- }
|
|
|
+ var that = this;
|
|
|
+ that.page = 1
|
|
|
+ that.pageSize = 18
|
|
|
+
|
|
|
+ wx.request( {
|
|
|
+ url: "http://127.0.0.1:8081/v1/set",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json"
|
|
|
+ },
|
|
|
+ method: "POST",
|
|
|
+ data: { version: "1.0.1" },
|
|
|
+ complete: function( res ) {
|
|
|
+ console.log(res)
|
|
|
+ if( res == null || res.data == null ) {
|
|
|
+ console.error( '网络请求失败' );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.data.data.type == "true"){
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../search/search'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+
|
|
|
+ //获取数据
|
|
|
+ setTimeout(that._asyncData, 0);
|
|
|
+ wx.request( {
|
|
|
+ url: "http://49.234.19.130:8081/v1/pdd/ddk/search",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json"
|
|
|
+ },
|
|
|
+ method: "POST",
|
|
|
+ data: { page: that.page.toString(), page_size: that.pageSize.toString(),with_coupon:"true" },
|
|
|
+ complete: function( res ) {
|
|
|
+ wx.hideLoading();
|
|
|
+ console.log(res)
|
|
|
+ that.totalCount = res.data.data.goods_search_response.total_count
|
|
|
+ for (var i = 0; i < res.data.data.goods_search_response.goods_list.length; i++) {
|
|
|
+ that.data.goodsList.push( res.data.data.goods_search_response.goods_list[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ goodsList: that.data.goodsList,
|
|
|
+ })
|
|
|
|
|
|
- that.setData({
|
|
|
- goodsList: that.data.goodsList,
|
|
|
- })
|
|
|
+ console.log(res.data.data.goods_search_response)
|
|
|
+ if( res == null || res.data == null ) {
|
|
|
+ console.error( '网络请求失败' );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- console.log(res.data.data.goods_search_response)
|
|
|
- if( res == null || res.data == null ) {
|
|
|
- console.error( '网络请求失败' );
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
- search(){
|
|
|
- wx.navigateTo({
|
|
|
- url: '../search/search'
|
|
|
+ search:function(e){
|
|
|
+ var that = this
|
|
|
+ console.log(e)
|
|
|
+ that.keyword = e.detail.value
|
|
|
+ that.activity_tags = ""
|
|
|
+ that.pid = "9112489_209622235"
|
|
|
+ console.log(that.keyword)
|
|
|
+ console.log(that.pid)
|
|
|
+
|
|
|
+ that.page = 1
|
|
|
+ that.pageSize = 18
|
|
|
+ wx.request( {
|
|
|
+ url: "http://49.234.19.130:8081/v1/pdd/ddk/search",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json"
|
|
|
+ },
|
|
|
+ method: "POST",
|
|
|
+ data: { page: that.page.toString(), page_size: that.pageSize.toString(),with_coupon:"true", activity_tags: that.activity_tags, pid:that.pid, keyword: that.keyword},
|
|
|
+ complete: function( res ) {
|
|
|
+ wx.hideLoading();
|
|
|
+ console.log(res)
|
|
|
+
|
|
|
+ that.totalCount = res.data.data.goods_search_response.total_count
|
|
|
+ that.data.goodsList = res.data.data.goods_search_response.goods_list
|
|
|
+ // for (var i = 0; i < res.data.data.goods_search_response.goods_list.length; i++) {
|
|
|
+ // that.data.goodsList.push( res.data.data.goods_search_response.goods_list[i]);
|
|
|
+ // }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ goodsList: that.data.goodsList,
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(res.data.data.goods_search_response)
|
|
|
+ if( res == null || res.data == null ) {
|
|
|
+ console.error( '网络请求失败' );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // wx.navigateTo({
|
|
|
+ // url: '../search/search'
|
|
|
+ // })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ keyData:function(e){
|
|
|
+ var that = this
|
|
|
+ that.keyword = ""
|
|
|
+ if (e.detail.activeKey == "0"){
|
|
|
+ that.activity_tags = ""
|
|
|
+ } else{
|
|
|
+ that.activity_tags = "["+e.detail.activeKey + "]"
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(e)
|
|
|
+
|
|
|
+ that.page = 1
|
|
|
+ that.pageSize = 18
|
|
|
+ wx.request( {
|
|
|
+ url: "http://49.234.19.130:8081/v1/pdd/ddk/search",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json"
|
|
|
+ },
|
|
|
+ method: "POST",
|
|
|
+ data: { page: that.page.toString(), page_size: that.pageSize.toString(),with_coupon:"true", activity_tags: that.activity_tags},
|
|
|
+ complete: function( res ) {
|
|
|
+ wx.hideLoading();
|
|
|
+ console.log(res)
|
|
|
+
|
|
|
+ that.totalCount = res.data.data.goods_search_response.total_count
|
|
|
+ that.data.goodsList = res.data.data.goods_search_response.goods_list
|
|
|
+ // for (var i = 0; i < res.data.data.goods_search_response.goods_list.length; i++) {
|
|
|
+ // that.data.goodsList.push( res.data.data.goods_search_response.goods_list[i]);
|
|
|
+ // }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ goodsList: that.data.goodsList,
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(res.data.data.goods_search_response)
|
|
|
+ if( res == null || res.data == null ) {
|
|
|
+ console.error( '网络请求失败' );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
|
|
|
goodsCollection: function(e){
|
|
@@ -161,7 +279,6 @@ Page({
|
|
|
header:{
|
|
|
'Accept': 'application/json'
|
|
|
},
|
|
|
-
|
|
|
success (res) {
|
|
|
wx.hideLoading();
|
|
|
for (var i = 0; i < res.data.goodsSearchInfo.goodsSearchResponse.goodsList.length; i++) {
|
|
@@ -224,7 +341,7 @@ Page({
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
that.page +=1
|
|
|
wx.request( {
|
|
|
url: "http://49.234.19.130:8081/v1/pdd/ddk/search",
|
|
@@ -234,7 +351,7 @@ Page({
|
|
|
},
|
|
|
method: "POST",
|
|
|
//data: { cityname: "上海", key: "1430ec127e097e1113259c5e1be1ba70" },
|
|
|
- data: { page: that.page.toString(), page_size: that.pageSize.toString() },
|
|
|
+ data: { page: that.page.toString(), page_size: that.pageSize.toString(),with_coupon:"true", activity_tags: that.activity_tags,keyword:that.keyword,pid:that.pid},
|
|
|
complete: function( res ) {
|
|
|
wx.hideLoading();
|
|
|
console.log(res)
|