|
@@ -1,4 +1,5 @@
|
|
|
import { get,post } from "../../common/request.js"
|
|
|
+import stylemap from "../../common/stylemap"
|
|
|
import pathmap from "../../common/pathmap"
|
|
|
import { retCartData } from "../../data/car"
|
|
|
import bindSearch from "../../module/search/search.js"
|
|
@@ -63,7 +64,8 @@ Page({
|
|
|
}
|
|
|
],
|
|
|
searchdata:{
|
|
|
- sortby:""
|
|
|
+ sortby:"",
|
|
|
+ price:""
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -72,7 +74,9 @@ Page({
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
bindSearch(this);
|
|
|
+ this.setData(stylemap);
|
|
|
var searchdata = Object.assign(this.data.searchdata,{keys:options.keys||""});
|
|
|
+ this.getWheres();
|
|
|
this.getList(this.data.searchdata);
|
|
|
},
|
|
|
transformSearchData:function(searchdata){
|
|
@@ -86,6 +90,29 @@ Page({
|
|
|
delete para.sortby;
|
|
|
return para;
|
|
|
},
|
|
|
+ //获取筛选信息
|
|
|
+ getWheres:function(){
|
|
|
+ var _self = this;
|
|
|
+ get(pathmap.wheres, {
|
|
|
+ }, function (json) {
|
|
|
+ var brandlist = {};
|
|
|
+ json.data.brandlist = []
|
|
|
+ for(var i = 65; i < 91; i++){
|
|
|
+ brandlist[String.fromCharCode(i)];
|
|
|
+ }
|
|
|
+ json.data.brand.forEach(function(item){
|
|
|
+ if(Object.prototype.toString.call(brandlist[item.initial])=="[object Array]"){
|
|
|
+ brandlist[item.initial].push(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ for(var name in brandlist){
|
|
|
+ json.data.brandlist.push(brandlist[name]);
|
|
|
+ }
|
|
|
+ _self.setData({
|
|
|
+ wheres: json.data
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
getList:function(searchdata){
|
|
|
var _self = this;
|
|
|
var para = this.transformSearchData(searchdata);
|
|
@@ -128,6 +155,15 @@ Page({
|
|
|
})
|
|
|
this.getList(searchdata);
|
|
|
},
|
|
|
+ changePrice:function(e){
|
|
|
+ var el = e.currentTarget;
|
|
|
+ var id = el.dataset.id;
|
|
|
+ var searchdata = Object.assign(this.data.searchdata,{price:id});
|
|
|
+ this.setData({
|
|
|
+ selectbar:""
|
|
|
+ })
|
|
|
+ this.getList(searchdata);
|
|
|
+ },
|
|
|
loadLikeCar:function(){
|
|
|
var _self = this;
|
|
|
if(!this.data.like){
|