Commit 1fe325aa54260a706c10f3259ec6ed3e3b45e39b

Authored by wangfan
1 parent 38ac791a

golist

@@ -722,7 +722,13 @@ Page({ @@ -722,7 +722,13 @@ Page({
722 listShow(){ 722 listShow(){
723 //this.selectComponent('#list').show(); 723 //this.selectComponent('#list').show();
724 wx.navigateTo({ 724 wx.navigateTo({
725 - url:util.http_build_query(this.param,'./indexList') 725 + url:util.http_build_query({
  726 + lat:this.param.lat,
  727 + lng:this.param.lng,
  728 + map:this.param.map,
  729 + multiIndex:this.data.multiIndex,
  730 + tags:this.param.tags,
  731 + },'./indexList')
726 }); 732 });
727 }, 733 },
728 }) 734 })
1 // pages/reserve/indexList.js 1 // pages/reserve/indexList.js
2 import util from '../../utils/util'; 2 import util from '../../utils/util';
3 import App from '../../utils/api'; 3 import App from '../../utils/api';
  4 +import DA from './data';
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
5 Page({ 6 Page({
6 7
@@ -22,10 +23,28 @@ Page({ @@ -22,10 +23,28 @@ Page({
22 /** 23 /**
23 * 生命周期函数--监听页面加载 24 * 生命周期函数--监听页面加载
24 */ 25 */
25 - onLoad: function (options) {  
26 - //lat=34.21719&lng=108.89155&offset=0&rows=50&distance=100000&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":108.87545674591064,"latitude":34.204520114013846},"northeast":{"longitude":108.90764325408935,"latitude":34.229857981005225},"scale":15}&cuisine=6&tags=1,2,3 26 + onLoad: async function (options) {
  27 + //lat=34.21719&lng=108.89155&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":108.87545674591064,"latitude":34.204520114013846},"northeast":{"longitude":108.90764325408935,"latitude":34.229857981005225},"scale":15}&multiIndex=1&tags=1,2
27 this.options=options; 28 this.options=options;
28 - this.getList(); 29 + let tags=[
  30 + {id:1,name:'环境好'},
  31 + {id:2,name:'菜品有特色'},
  32 + {id:3,name:'超大包间'},
  33 + ];
  34 + if(options.tags){
  35 + let ts=options.tags.split(',');
  36 + tags.forEach(t=>{
  37 + if(ts._indexOf(t.id)>-1){
  38 + t.active=true;
  39 + }
  40 + })
  41 + }
  42 + this.setData({
  43 + multiArray:[['全部菜系'].concat(await DA.getCates())],
  44 + multiIndex:[options.multiIndex],
  45 + tags:tags,
  46 + })
  47 + setTimeout(()=>{this.getList()},0)
29 }, 48 },
30 49
31 /** 50 /**
@@ -67,9 +86,9 @@ Page({ @@ -67,9 +86,9 @@ Page({
67 * 页面上拉触底事件的处理函数 86 * 页面上拉触底事件的处理函数
68 */ 87 */
69 onReachBottom: function () { 88 onReachBottom: function () {
70 - 89 + this.getListMore()
71 }, 90 },
72 - getList(){ 91 + async getList(){
73 let mapParam=this.options 92 let mapParam=this.options
74 this.offset=1 //page 93 this.offset=1 //page
75 this.size=20 //page size 94 this.size=20 //page size
@@ -86,11 +105,17 @@ Page({ @@ -86,11 +105,17 @@ Page({
86 size:this.size, 105 size:this.size,
87 distance:50, 106 distance:50,
88 }; 107 };
89 - if(mapParam.tags){  
90 - this.param.tags=mapParam.tags 108 + if(this.data.multiIndex[0]>0){
  109 + this.param.cuisine=await DA.getCatesID(this.data.multiIndex[0]-1);
91 } 110 }
92 - if(mapParam.cuisine){  
93 - this.param.cuisine=mapParam.cuisine 111 + let tags=[];
  112 + this.data.tags.forEach(t=>{
  113 + if(t.active){
  114 + tags.push(t.id)
  115 + }
  116 + })
  117 + if(tags.length>0){
  118 + this.param.tags=tags;
94 } 119 }
95 App.Customer.SellerLists(this.param).then(res=>{ 120 App.Customer.SellerLists(this.param).then(res=>{
96 this.setData({ 121 this.setData({
@@ -110,4 +135,39 @@ Page({ @@ -110,4 +135,39 @@ Page({
110 }) 135 })
111 }) 136 })
112 }, 137 },
  138 + caixiShow(){
  139 + this.selectComponent('#caixi').show();
  140 + },
  141 + caixiActive(e){
  142 + this.bindMultiPickerChange({
  143 + detail:{
  144 + value:[e.detail]
  145 + }
  146 + })
  147 + },
  148 + bindMultiPickerChange(e){
  149 + console.log(e);
  150 + let val=util.val(e);
  151 + this.setData({
  152 + multiIndex:val
  153 + })
  154 + setTimeout(()=>{this.getList();},0)
  155 + },
  156 + tagsChange(e){
  157 + let id=util.attr(e,'id');
  158 + let tags=this.data.tags;
  159 + let activeNum=0;
  160 + tags.forEach(t=>{
  161 + if(t.id==id){
  162 + t.active=!t.active
  163 + }
  164 + if(t.active){
  165 + activeNum++
  166 + }
  167 + })
  168 + this.setData({
  169 + tags:tags,
  170 + })
  171 + setTimeout(()=>{this.getList();},0)
  172 + },
113 }) 173 })
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 "formids":"/components/formids/formids", 6 "formids":"/components/formids/formids",
7 "nav":"/components/nav/nav", 7 "nav":"/components/nav/nav",
8 "getpos":"/components/userinfo/getpos", 8 "getpos":"/components/userinfo/getpos",
9 - "sb-tr":"/components/reserve/seller-box-transverse/seller-box" 9 + "sb-tr":"/components/reserve/seller-box-transverse/seller-box",
  10 + "caixi":"/components/reserve/caixi"
10 } 11 }
11 } 12 }
@@ -27,6 +27,9 @@ @@ -27,6 +27,9 @@
27 hasActivity="{{true}}" hasAverage="{{false}}" 27 hasActivity="{{true}}" hasAverage="{{false}}"
28 hasSlogan="{{true}}" ></sb-tr> 28 hasSlogan="{{true}}" ></sb-tr>
29 </view> 29 </view>
30 - <view class="flex-vc" wx:if="{{!hasMore}}">没有更多了</view> 30 + <view class="flex-vc nomore" wx:if="{{!hasMore}}">没有更多了</view>
31 </view> 31 </view>
32 -</view>  
  32 +</view>
  33 +<caixi multiArray="{{multiArray}}" multiIndex="{{multiIndex}}"
  34 + bindactive="caixiActive" id="caixi"
  35 +></caixi>
@@ -62,3 +62,7 @@ @@ -62,3 +62,7 @@
62 border-radius: 6rpx; 62 border-radius: 6rpx;
63 overflow: hidden; 63 overflow: hidden;
64 } 64 }
  65 +.nomore{
  66 + color: #999;
  67 + font-size: 28rpx;
  68 +}
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 "list": [] 43 "list": []
44 }, 44 },
45 "miniprogram": { 45 "miniprogram": {
46 - "current": 32, 46 + "current": 52,
47 "list": [ 47 "list": [
48 { 48 {
49 "id": 0, 49 "id": 0,
@@ -432,6 +432,13 @@ @@ -432,6 +432,13 @@
432 "pathName": "pages/reserve/discount", 432 "pathName": "pages/reserve/discount",
433 "query": "latitude=34.215637&longitude=108.891264&scale=16&height=397", 433 "query": "latitude=34.215637&longitude=108.891264&scale=16&height=397",
434 "scene": null 434 "scene": null
  435 + },
  436 + {
  437 + "id": -1,
  438 + "name": "pages/reserve/indexList",
  439 + "pathName": "pages/reserve/indexList",
  440 + "query": "lat=34.21719&lng=108.89155&map={\"errMsg\":\"getMapRegion:ok\",\"southwest\":{\"longitude\":108.87545674591064,\"latitude\":34.204520114013846},\"northeast\":{\"longitude\":108.90764325408935,\"latitude\":34.229857981005225},\"scale\":15}&multiIndex=1&tags=1,2",
  441 + "scene": null
435 } 442 }
436 ] 443 ]
437 } 444 }