Commit cf91655ed197f791402390e0cf766307dbefe7c2

Authored by vking
1 parent 3855a551

new 2.0

// components/2.0/filter/filter-group.js
import DA from '../../../pages/reserve/data';
import util from '../../../utils/util'
Component({
/**
* 组件的属性列表
... ... @@ -25,6 +26,7 @@ Component({
attached(){
this.init()
this.filterParams= null
this.paramsData={}//过滤参数集合
},
/**
* 组件的方法列表
... ... @@ -40,6 +42,15 @@ Component({
this.setData({
multiIndex: [e.detail]
})
if(e.detail>0){
DA.getCatesID(parseInt(e.detail) - 1).then(cuisine=>{
this.paramsData.cuisine=cuisine
this.eventPush()
})
}else{
this.paramsData.cuisine=""
this.eventPush()
}
this.hide()
},
caixiShow() {
... ... @@ -86,6 +97,36 @@ Component({
filterParams: this.filterParams,
})
}
this.paramsData.filterParams=this.filterParams
this.paramsData.average=""
if(this.filterParams){
let filterParams = this.filterParams.min + ',' + this.filterParams.max
if (this.filterParams.min == this.filterParams.max && this.filterParams.min == 300) {
filterParams = this.filterParams.min + ',' + parseInt(new Date() / 1000)
}
this.paramsData.average = filterParams
}
this.eventPush()
this.hide()
},
tagsChange(e) {
let id = util.attr(e, 'id');
let tags = this.data.tags;
let tagsIds=[];
tags.forEach(t => {
if (t.id == id) {
t.active = !t.active
}
if (t.active) {
tagsIds.push(t.id)
}
})
this.setData({
tags:tags,
})
this.paramsData.tags=tagsIds.toString()
this.eventPush()
this.hide()
},
hide(){
this.selectComponent('#caixi').hide();
... ... @@ -95,5 +136,9 @@ Component({
caixiOpened:false,
})
},
eventPush(){
this.triggerEvent('event',this.paramsData);
},
}
})
... ...
... ... @@ -106,7 +106,7 @@ Component({
active:this.data.active||'',
},
})
this.close()
this.hide()
},
reset(){
this.selectComponent('#consume').changeVal(0,300);
... ... @@ -115,7 +115,7 @@ Component({
consumeStr:'',
})
this.triggerEvent('event',{type:'clean'})
this.close()
this.hide()
},
}
})
... ...
... ... @@ -144,41 +144,15 @@ Page({
let lng = (this.mapData.region.southwest.longitude + this.mapData.region.northeast.longitude) / 2
param.centre_pos = `${lat},${lng}`
}
/*
if (this.data.multiIndex[0] > 0) {
param.cuisine = await DA.getCatesID(this.data.multiIndex[0] - 1);
if(this.filterGroupData.tags){
param.tags = this.filterGroupData.tags;
}
let tags = [];
this.data.tags.forEach(t => {
if (t.active) {
tags.push(t.id)
}
})
if (tags.length > 0) {
param.tags = tags;
if (this.filterGroupData.cuisine) {
param.cuisine = this.filterGroupData.cuisine;
}
if (param.lat) {
param.centre_pos = `${param.lat},${param.lng}`
} else {
let lat = (this.mapData.region.southwest.latitude + this.mapData.region.northeast.latitude) / 2
let lng = (this.mapData.region.southwest.longitude + this.mapData.region.northeast.longitude) / 2
param.centre_pos = `${lat},${lng}`
}
if (this.data.hasSuggestion) {
param.centre_pos = `${this.data.suggestion.latitude},${this.data.suggestion.longitude}`
if(this.filterGroupData.average){
param.average = this.filterGroupData.average;
}
if (this.findSellerData) {
param = Object.assign(param, this.findSellerData.paramObj)
}
if (this.filterParams) {//人均过滤
let filterParams = this.filterParams.min + ',' + this.filterParams.max
if (this.filterParams.min == this.filterParams.max && this.filterParams.min == 300) {
filterParams = this.filterParams.min + ',' + parseInt(new Date() / 1000)
}
param.average = filterParams
}
*/
//this.selectComponent('#list').getList(param);
this.param = param;
App.Customer.SellerList(param).then(async res => {
if (res.ret == 200) {
... ... @@ -288,6 +262,12 @@ Page({
};
this.setData(obj)
},
filterGroupData:{},
filterGroupEvent(e){
console.log('filterGroupEvent',e.detail)
this.filterGroupData=e.detail
this.debounce(this.getSellers,500)
},
back:function() {
/*
var mta = require('mta-wechat-analysis')
... ...
... ... @@ -15,7 +15,7 @@
layer-style="2"
style="width: 100%; height: 360rpx;"></map>
<view class="view content" style="height: {{height}}px;">
<filter-group height="{{height}}"></filter-group>
<filter-group height="{{height}}" bindevent="filterGroupEvent"></filter-group>
<scroll-view class="view scroll-view" scroll-y="true"
scroll-into-view="seller-{{activeSellerID}}"
scroll-with-animation
... ...