Pārlūkot izejas kodu

筛选品牌组件改版

liguorui 6 gadi atpakaļ
vecāks
revīzija
be527ed008

+ 1 - 1
app.json

@@ -1,4 +1,4 @@
-{
+          {
   "pages":[
     "pages/index/index",
     "pages/hot/hot",

+ 169 - 0
components/brandlist/brandlist.js

@@ -0,0 +1,169 @@
+// components/carslider.js
+import { get,post } from "../../common/request.js"
+import stylemap from "../../common/stylemap"
+import pathmap from "../../common/pathmap"
+var app = getApp()
+
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    "show":{
+      value:false,
+      type:Boolean
+    },
+    "brandrecommend":{
+      value:[],
+      type:Array
+    },
+    "hasmodel":{
+      value:false,
+      type:Boolean
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    windowh:app.globalData.windowh
+  },
+  ready:function(){
+    this.getBrands();
+    var initialheight = Math.round((app.globalData.windowh-300)/26/app.globalData.scale);
+    this.setData(Object.assign({
+      initialheight:initialheight
+    },stylemap));
+    if(!this.data.brandrecommend.length){
+      this.loadBrandRecommend();
+    }
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    getBrands:function(){
+      var _self=this;
+      get(pathmap.getbrand, {}, function (json) {
+
+        var initiallist = {};
+        var brandlist = []
+        for(var i = 65; i < 91; i++){
+          initiallist[String.fromCharCode(i)] = [];
+        }
+        json.data.brand.forEach(function(item){
+          if(Object.prototype.toString.call(initiallist[item.initial])=="[object Array]"){
+            initiallist[item.initial].push(item);
+          }
+        })
+        var inith = 562;
+        var scale = app.globalData.scale;
+        for(var name in initiallist){
+          var l = initiallist[name].length;
+          if(l>0){
+            brandlist.push({
+              initial:name,
+              list:initiallist[name],
+              top:inith/scale
+            });          
+            inith = inith+45+l*79;
+          }
+        }
+        _self.setData({
+          brandlist:brandlist
+        })
+      })
+    },
+    getBrandDetail:function(e){
+      var _self = this;
+      var brandinfo = e.currentTarget.dataset;
+      var series = [];
+      get(pathmap.serieslist, {brand_id:brandinfo.id}, function (json) {
+        series = json.data.car_series;      
+        _self.setData({
+          serieslist:{
+            belong:brandinfo,
+            list:series
+          }
+          // ,
+          // searchdata:Object.assign(_self.data.searchdata,{brand:brandinfo.id,car_series:""})
+        })
+      })
+    },
+    getModel:function(series){
+      var _self = this;
+      get(pathmap.carmodel,{
+        car_series_id:series.car_series_id
+      },function(json){
+        _self.setData({
+          modellist:json.data
+        })
+      })
+    },
+    selectSeries:function(e){
+      var _self = this;
+      var series = e.currentTarget.dataset.series;
+      var data = {}
+      if(this.data.hasmodel){
+        data.showmodel = true;
+        this.getModel(series);
+      }else{
+        data.serieslist = "";
+        this.triggerEvent("select",{series:series});
+      }      
+      this.setData(data);
+    },
+    selectModel:function(e){
+      var _self = this;
+      var model = e.currentTarget.dataset.model;
+      var data = {serieslist:"",showmodel:false}
+      this.triggerEvent("select",{model:model}); 
+      this.setData(data);
+    },
+    filterBack:function(){
+      this.triggerEvent("close");
+      this.setData({serieslist:""})
+    },
+    modelBack:function(){      
+      this.setData({showmodel:false});
+    },
+    scrollInit:function(e){
+      var init = e.currentTarget.dataset.init;
+      this.setData({
+        scrolltoinit:init
+      })
+    },
+    waitScroll:null,
+    brandScroll:function(e) {
+      var _self = this;
+      //this.setData({ brandScrollTop: e.detail.scrollTop })
+      if(this.waitScroll){
+        try{
+          clearTimeout(this.waitScroll);
+        }catch(err){}
+      }
+      this.waitScroll = setTimeout(function(){      
+        var scrollinit = "";
+        var list = _self.data.brandlist;
+        for(var i=0,l=list.length;i<l;i++){
+          if(e.detail.scrollTop<list[i].top){
+            // scrollinit = list[i?i-1:i].initial;
+            scrollinit=(i?i-1:i)
+            break;
+          }
+        }
+        _self.setData({scrollinit:scrollinit})
+      },50)
+    },
+    loadBrandRecommend:function(){
+      var _self = this;
+      get(pathmap.brandrecommend, {
+      }, function (json) {
+        _self.setData({
+          brandrecommend:json.data
+        })
+      })
+    }
+  }
+})

+ 4 - 0
components/brandlist/brandlist.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 156 - 0
components/brandlist/brandlist.wxml

@@ -0,0 +1,156 @@
+<!--筛选品牌模块-->
+  <!-- style="{{selectbar=='brand'?'left:0rpx;':''}}" -->
+<scroll-view
+  class="brandw_c"
+  scroll-into-view ="{{scrolltoinit}}"
+  style="{{show?'left:0rpx;':''}}"
+  bindscroll="brandScroll"
+  scroll-y=true
+>
+  <view      
+    style="height:{{headerheight}}rpx;"
+  ></view>
+  <view 
+    class="brandw_title"
+    style="height:{{headerheight}}rpx;"
+  >
+    <image 
+      class="brandw_back" 
+      src="../../img/back.png"
+      bindtap="filterBack"
+    />
+    <view class="brandw_title_w">品牌</view>
+  </view>
+  <view class="brandw_list">
+    <view class="brandw_t_line">热门品牌</view>
+    <view class="brandw_hotlist">
+      <block wx:for="{{brandrecommend}}" wx:key="brand_id">
+        <view 
+          class="brandw_hotlist_item"          
+          bindtap="getBrandDetail"
+          data-id="{{item.brand_id}}"
+          data-img="{{item.brand_img}}"
+          data-name="{{item.brand_name}}"
+        >
+          <view class="brandw_hotitem_img" style="background-image:url({{item.brand_img}})"></view>
+          <view class="brandw_hotitem_name">{{item.brand_name}}</view>
+        </view>
+      </block>
+    </view>
+
+    <view class="brandw_t_line">不限品牌</view>
+    <block wx:for="{{brandlist}}" wx:key="initial">
+      <view class="brandw_binitial" id="{{item.initial}}">
+        {{item.initial}}
+      </view>
+      <block wx:for="{{item.list}}" wx:for-item="branditem" wx:key="brand_id">
+        <view 
+          class="brandw_bitem"
+          bindtap="getBrandDetail"
+          data-id="{{branditem.brand_id}}"
+          data-img="{{branditem.img}}"
+          data-name="{{branditem.brand_name}}"
+        >
+          <view
+            class="brandw_bimg"
+            style="background-image:url({{branditem.img}})"
+          />
+          <view class="brandw_bname">{{branditem.brand_name}}</view>
+        </view>
+      </block>
+    </block>
+  </view>
+
+</scroll-view>
+
+<scroll-view
+  class="brand_serieslist"
+  scroll-y=true
+  style="height: {{windowh-headerheight}}rpx; {{show&&serieslist?'left:0rpx;':''}}"
+>
+  <view class="series_lelong">
+      <view
+        class="series_lelong_bimg"
+        style="background-image:url({{serieslist.belong.img}})"
+      />
+
+        <!-- serieslist.belong.img -->
+      <view class="series_lelong_name">{{serieslist.belong.name}}</view>
+    </view>  
+  <view class="car_series_t">选择车系</view>
+  <block
+    wx:for="{{serieslist.list}}"
+    wx:key="car_series_id"
+  >
+    <view 
+      class="brand_series_i"
+      bindtap="selectSeries"
+      data-series = "{{item}}"
+      >
+      <view
+        class="brand_series_bimg"
+        style="background-image:url({{serieslist.belong.img}})"
+      />
+      <view class="brand_series_name">{{item.car_series_name}}</view>
+    </view>          
+  </block>
+</scroll-view>
+<view 
+  class="brand_initail_c"
+  style="display: {{show?'block':'none'}}"
+>
+  <!-- {{scrollinit==item.initial?'brand_initail_active':''}} -->
+  <image 
+    class="brand_selectbg"
+    style="top:{{scrollinit*initialheight}}px "
+    src="../../img/selectbrand.png"/>
+  <view 
+    class="brand_initail_i"
+    wx:for="{{brandlist}}"
+    wx:key="initial"
+    style="height:{{initialheight}}px;"
+    bindtap="scrollInit"
+    data-init = "{{item.initial}}"
+  >
+    {{item.initial}}
+  </view>
+</view>
+<scroll-view
+  class="models_c"
+  style="{{showmodel?'left:0rpx;':''}}"
+  scroll-y=true
+>
+  <view      
+    style="height:{{headerheight}}rpx;"
+  ></view>
+  <view 
+    class="brandw_title"
+    style="height:{{headerheight}}rpx;"
+  >
+    <image 
+      class="brandw_back" 
+      src="../../img/back.png"
+      bindtap="modelBack"
+    />
+    <view class="brandw_title_w">车型</view>
+  </view>
+  <view wx:if="{{modellist.length>0}}" class="brandw_list">
+    <block wx:for="{{modellist}}" wx:key="car_model_id">
+      <view 
+        class="brandw_bitem"
+        bindtap="selectModel"
+        data-model="{{item}}"
+      >
+        <view
+          class="brandw_bimg"
+          style="background-image:url({{serieslist.belong.img}})"
+        />
+        <view class="brandw_bname">{{item.car_model_name}}</view>
+      </view>
+    </block>
+  </view>
+  <view wx:else class="no_model">
+    暂无车型信息
+  </view>
+
+</scroll-view>

+ 33 - 5
module/brandlist/brandlist.wxss

@@ -22,11 +22,11 @@
 	width:30rpx;
 	height: 30rpx;
 	position: absolute;
-	top:70rpx;
+	top:100rpx;
 	left:40rpx;
 }
 .brandw_title_w{
-	padding-top: 60rpx;
+	padding-top: 105rpx;
 	font-size: 36rpx;
 	height: 44rpx;
 	line-height: 44rpx;
@@ -82,31 +82,37 @@
 	line-height: 70rpx;
 	height: 78rpx;
 	border-bottom: 1rpx solid rgba(235, 235, 235, 1);
+	display: flex;
 }
 .brandw_bimg{
 	height: 60rpx;
 	width:60rpx;
-	float:left;
 	margin:5px 30rpx 0rpx 0rpx;
 	background-repeat: no-repeat;
 	background-size: 60rpx;
 	background-position: center;
 }
 .brandw_bname{
-	display: inline;
+	flex: 1;
+	display: flex;
+	align-items:center;
 	margin-left:20rpx;
 	color: rgba(56, 55, 53, 1);
 	font-size: 26rpx;
+	line-height: 32rpx;	
 }
 
 .brand_serieslist{
 	width:440rpx;
+	margin-left:310rpx;
 	background-color: white;
 	position: fixed;
+	z-index:101;
 	bottom: 0rpx;
-	right:770rpx;
+	left:770rpx;
 	border-shadow:-1rpx 0rpx ;
 	box-shadow: -2rpx 0rpx 10rpx -1rpx rgba(0, 0, 0, 0.16);
+	transition: left 0.5s;
 }
 .series_lelong{
 	height: 78rpx;
@@ -157,6 +163,7 @@
 /*************首字母指示点*************/
 .brand_initail_c{	
 	position: fixed;
+	z-index:101;
 	bottom: 90rpx;
 	right:5rpx;
 	overflow:hidden;
@@ -185,4 +192,25 @@
 .brand_initail_active{
 	border-radius: 17rpx;
 	background-color: #FFE600;
+}
+
+
+/*model*/
+.models_c{
+	position: fixed;
+	top:0rpx;
+	left:100%;
+	width: 100%;
+	height: 100%;
+	background: white;
+	z-index:101;
+	transition: all 0.5s;
+}
+.no_model{
+	height: 100rpx;
+	line-height: 100rpx;
+	color: rgba(104, 104, 104, 1);
+	font-size: 26rpx;
+	text-align: center;
+	font-family: NotoSansHans-DemiLight;
 }

+ 11 - 2
components/carslider/carslider.js

@@ -82,6 +82,16 @@ Component({
    * 组件的方法列表
    */
   methods: {
+    touchMove:function(e){
+      var obj = this.changeScale(e);      
+      this.setData(obj);
+      this.triggerEvent("changevalue",obj);
+    },
+    tapToScale:function(e){
+      var obj = this.changeScale(e);    
+      this.setData(obj);
+      this.triggerEvent("changeend",obj);
+    },
     changeScale:function(e){
       var left = e.touches[0].pageX*this.data.gscale-45;
       var scale = left/660;
@@ -101,8 +111,7 @@ Component({
         scale:scale,
         value:value
       };
-      this.setData(obj)
-      this.triggerEvent("changevalue",obj);
+      return obj;
     },
     changeEndScale:function(e){
       var obj = {

+ 4 - 2
components/carslider/carslider.wxml

@@ -13,7 +13,9 @@
 		block-src="../../img/slider.png"
 	>		
 	</slider> -->
-	<view class="slider_line_b">
+	<view 
+		bindtap="tapToScale"
+		class="slider_line_b">
 
 		<view class="slider_line_el">
 			<view 
@@ -22,7 +24,7 @@
 			>
 				<view 
 					class="slider_control_b"
-					bindtouchmove="changeScale"
+					bindtouchmove="touchMove"
 					bindtouchend="changeEndScale"
 					>
 					<view

+ 0 - 3
module/brandlist/brandlist.js

@@ -1,3 +0,0 @@
-const brandlist = {
-	
-}

+ 0 - 110
module/brandlist/brandlist.wxml

@@ -1,110 +0,0 @@
-<!--筛选品牌模块-->
-<scroll-view
-  class="brandw_c"
-  style="{{selectbar=='brand'?'left:0rpx;':''}}"
-  scroll-into-view ="{{scrolltoinit}}"
-  bindscroll="brandScroll"
-  scroll-y=true
->
-  <view      
-    style="height:{{headerheight}}rpx;"
-  ></view>
-  <view 
-    class="brandw_title"
-    style="height:{{headerheight}}rpx;"
-  >
-    <image 
-      class="brandw_back" 
-      src="../../img/back.png"
-      bindtap="filterBack"
-    />
-    <view class="brandw_title_w">品牌</view>
-  </view>
-  <view class="brandw_list">
-    <view class="brandw_t_line">热门品牌</view>
-    <view class="brandw_hotlist">
-      <block wx:for="{{brandrecommend}}" wx:key="brand_id">
-        <view 
-          class="brandw_hotlist_item"          
-          bindtap="getBrandDetail"
-          data-id="{{item.brand_id}}"
-          data-img="{{item.brand_img}}"
-          data-name="{{item.brand_name}}"
-        >
-          <view class="brandw_hotitem_img" style="background-image:url({{item.brand_img}})"></view>
-          <view class="brandw_hotitem_name">{{item.brand_name}}</view>
-        </view>
-      </block>
-    </view>
-
-    <view class="brandw_t_line">不限品牌</view>
-    <block wx:for="{{wheres.brandlist}}" wx:key="initial">
-      <view class="brandw_binitial" id="{{item.initial}}">
-        {{item.initial}}
-      </view>
-      <block wx:for="{{item.list}}" wx:for-item="branditem" wx:key="brand_id">
-        <view 
-          class="brandw_bitem"
-          bindtap="getBrandDetail"
-          data-id="{{branditem.brand_id}}"
-          data-img="{{branditem.img}}"
-          data-name="{{branditem.brand_name}}"
-        >
-          <view
-            class="brandw_bimg"
-            style="background-image:url({{branditem.img}})"
-          />
-          <view class="brandw_bname">{{branditem.brand_name}}</view>
-        </view>
-      </block>
-    </block>
-    <scroll-view
-      class="brand_serieslist"
-      scroll-y=true
-      style="height: {{windowh-headerheight}}rpx; {{serieslist?'right:0rpx;':''}}"
-    >
-      <view class="series_lelong">
-          <view
-            class="series_lelong_bimg"
-            style="background-image:url({{serieslist.belong.img}})"
-          />
-
-            <!-- serieslist.belong.img -->
-          <view class="series_lelong_name">{{serieslist.belong.name}}</view>
-        </view>  
-      <view class="car_series_t">选择车系</view>
-      <block
-        wx:for="{{serieslist.list}}"
-        wx:key="car_series_id"
-      >
-        <view 
-          class="brand_series_i"
-          bindtap="selectSeries"
-          data-series = "{{item}}"
-          >
-          <view
-            class="brand_series_bimg"
-            style="background-image:url({{serieslist.belong.img}})"
-          />
-          <view class="brand_series_name">{{item.car_series_name}}</view>
-        </view>          
-      </block>
-    </scroll-view>
-    <view 
-      class="brand_initail_c"
-      style="display: {{selectbar=='brand'?'block':'none'}}"
-    >
-    <!-- {{scrollinit==item.initial?'brand_initail_active':''}} -->
-      <view 
-        class="brand_initail_i"
-        wx:for="{{wheres.brandlist}}"
-        wx:key="initial"
-        style="height:{{initialheight}}rpx;background-position-y:(scrollinit*21)rpx "
-        bindtap="scrollInit"
-        data-init = "{{item.initial}}"
-      >
-        {{item.initial}}
-      </view>
-    </view>
-  </view>
-</scroll-view>

+ 8 - 9
module/caritem/caritem.wxml

@@ -1,17 +1,16 @@
 <template name="caritem">
-  <view class="caritem_b">
-    <navigator 
+  <navigator 
+    open-type="navigateTo"
+    url="../cardetail/cardetail?id={{car.id}}"
+    class="caritem_b">
+    <view 
       class="caritem_img" 
-      open-type="navigateTo"
       style="background-image:url({{car.img}})"
-      url="../cardetail/cardetail?id={{car.id}}"
     />
     <view class="caritem_info">
-      <navigator 
+      <view 
         class="caritem_t"
-        open-type="navigateTo"
-        url="../cardetail/cardetail?id={{car.id}}"
-      >{{car.title?car.title:'--'}}</navigator>
+      >{{car.title?car.title:'--'}}</view>
       <view class="caritem_time">
         <view class="caritem_time_i">{{car.licensetime}}年上牌|{{car.mileage}}万公里</view>
         <navigator 
@@ -31,5 +30,5 @@
         新手指导价:<view class="caritem_guidep">{{car.guide_price}}万</view>
       </view>
     </view>
-  </view>
+  </navigator>
 </template>

+ 8 - 9
module/caritem/collectcaritem.wxml

@@ -1,17 +1,16 @@
 <template name="collectcaritem">
-  <view class="caritem_b">
-    <navigator 
-      open-type="navigateTo"
+  <navigator 
+    open-type="navigateTo"
+    url="../cardetail/cardetail?id={{car.id}}"
+    class="caritem_b">
+    <view
       class="caritem_img" 
       style="background-image:url({{car.img}})"
-      url="../cardetail/cardetail?id={{car.id}}"
     />
     <view class="caritem_info">
-      <navigator 
+      <view 
         class="caritem_t"
-        open-type="navigateTo"
-        url="../cardetail/cardetail?id={{car.id}}"
-      >{{car.title?car.title:'--'}}</navigator>
+      >{{car.title?car.title:'--'}}</view>
       <view class="caritem_time">
         {{car.licensetime}}年上牌|{{car.mileage}}万公里
         <navigator 
@@ -31,5 +30,5 @@
         <image class="delete_collect" bindtap="deleteCollect" data-id="{{car.id}}" data-ind="{{index}}" src="../../img/delete.png"/>
       </view>
     </view>
-  </view>
+  </navigator>
 </template>

+ 24 - 114
pages/buy/buy.js

@@ -82,12 +82,9 @@ Page({
    */
   onLoad: function (options) {
     bindSearch(this);
-    var initialheight = Math.round((app.globalData.windowh-300)/26/app.globalData.scale);
     //initialheight = initialheight-initialheight%2;
     var searchdata = Object.assign(this.data.searchdata,options);
-    this.setData(Object.assign({
-      initialheight:initialheight
-    },stylemap));
+    this.setData(stylemap);
     this.getWheres();
     this.getList(this.data.searchdata);
     this.loadBrandRecommend()
@@ -184,45 +181,10 @@ Page({
     if(name==this.data.selectbar){
       name=null;
     }
-    if(name=="brand"&&!this.data.brandlist){
-      this.getBrands();
-    }
     this.setData({
       selectbar:name
     })
   },
-  getBrands:function(){
-    var _self=this;
-    get(pathmap.getbrand, {}, function (json) {
-
-      var initiallist = {};
-      var brandlist = []
-      for(var i = 65; i < 91; i++){
-        initiallist[String.fromCharCode(i)] = [];
-      }
-      json.data.brand.forEach(function(item){
-        if(Object.prototype.toString.call(initiallist[item.initial])=="[object Array]"){
-          initiallist[item.initial].push(item);
-        }
-      })
-      var inith = 562;
-      var scale = app.globalData.scale;
-      for(var name in initiallist){
-        var l = initiallist[name].length;
-        if(l>0){
-          brandlist.push({
-            initial:name,
-            list:initiallist[name],
-            top:inith/scale
-          });          
-          inith = inith+45+l*79;
-        }
-      }
-
-
-      _self.setData({wheres:Object.assign(_self.data.wheres,{brandlist:brandlist})})
-    })
-  },
   changeSort:function(e){
     var el = e.currentTarget;
     var name = el.dataset.sort;
@@ -255,81 +217,6 @@ Page({
       })
     }
   },
-  scrollInit:function(e){
-    var init = e.currentTarget.dataset.init;
-    this.setData({
-      scrolltoinit:init
-    })
-  },
-  getBrandDetail:function(e){
-    var _self = this;
-    var brandinfo = e.currentTarget.dataset;
-    var series = [];
-    get(pathmap.serieslist, {brand_id:brandinfo.id}, function (json) {
-      series = json.data.car_series;      
-      _self.setData({
-        serieslist:{
-          belong:brandinfo,
-          list:series
-        },
-        searchdata:Object.assign(_self.data.searchdata,{brand:brandinfo.id,car_series:""})
-      })
-    })
-    // this.data.wheres.car_series.map(function(item){
-    //   if(item.brand_id == brand.brand_id){
-    //     series.push(item);
-    //   }
-    // })
-    // this.setData({
-    //   serieslist:{
-    //     belong:brand,
-    //     list:series
-    //   },
-    //   searchdata:Object.assign(this.data.searchdata,{brand:brand.brand_id,car_series:""})
-    // })
-    // get(pathmap.series, {
-    //   brand_id:brand.brand_id
-    // }, function (json) {
-    //   var list = retCartData(json.data.list)
-    //   _self.setData({
-    //     serieslist: json.data
-    //   })
-    // })
-  },
-  waitScroll:null,
-  brandScroll:function(e) {
-    var _self = this;
-    //this.setData({ brandScrollTop: e.detail.scrollTop })
-    if(this.waitScroll){
-      try{
-        clearTimeout(this.waitScroll);
-      }catch(err){}
-    }
-    this.waitScroll = setTimeout(function(){      
-      var scrollinit = "";
-      var list = _self.data.wheres.brandlist;
-      for(var i=0,l=list.length;i<l;i++){
-        if(e.detail.scrollTop<list[i].top){
-          // scrollinit = list[i?i-1:i].initial;
-          scrollinit=(i?i-1:i)
-          break;
-        }
-      }
-      _self.setData({scrollinit:scrollinit})
-    },50)
-  },
-  selectSeries:function(e){
-    var _self = this;
-    var series = e.currentTarget.dataset.series;
-    this.setData({
-      serieslist:"",
-      selectbar:""                      //关闭品牌筛选卡
-    })
-    this.getList(Object.assign(this.data.searchdata,{car_series:series.car_series_id}));
-  },
-  filterBack:function(){
-    this.setData({selectbar:"",serieslist:""})
-  },
   getMoreFilter:function(e){
     var info = e.currentTarget.dataset;
     var obj = {};
@@ -365,4 +252,27 @@ Page({
     this.getList(Object.assign(this.data.searchdata,obj));
     this.setData({searchshow:false})
   },
+  closeBrandList:function(){
+    this.setData({selectbar:""});
+  },
+  selectSeries:function(e){
+    var series = e.detail.series;
+    this.setData({
+      selectbar:""
+    })
+    this.getList(Object.assign(this.data.searchdata,{car_series:series.car_series_id}));
+  },
+  checkAll:function(e){
+    this.getList({
+      sortby:"",
+      price:"",
+      car_age:"",
+      mileage:"",
+      transmission:"",
+      displacement:"",
+      emission:"",
+      colour:"",
+      filterlock:true
+    });
+  }
 })

+ 2 - 1
pages/buy/buy.json

@@ -1,6 +1,7 @@
 {
 	"disableScroll":true,
   	"usingComponents":{
-		"page-scroll":"../../components/page-scroll/page-scroll"
+		"page-scroll":"../../components/page-scroll/page-scroll",		
+		"brandlist":"../../components/brandlist/brandlist"
 	}
 }

+ 10 - 2
pages/buy/buy.wxml

@@ -54,7 +54,9 @@
   </view>
   <view wx:else class="you_may_like">    
     <view class="nocar_w">没有相关结果,可以试试其他条件</view>
-    <view class="nocar_back">查看所有好车</view>
+    <view 
+      bindtap="checkAll"
+      class="nocar_back">查看所有好车</view>
     <view class="recommend">
       <view class="recommend_t">
         <image class="recommend_img" src="../../img/youmaylike.png"/>
@@ -72,6 +74,12 @@
   />
 </page-scroll>
 <!--筛选品牌模块-->
-<include src="./brandlist.wxml"/>
+<brandlist
+  brandrecommend = "{{brandrecommend}}"
+  show="{{selectbar=='brand'?true:false}}"
+  bind:close="closeBrandList"
+  bind:select="selectSeries"
+/>
+<!-- <include src="./brandlist.wxml"/> -->
 <!--  更多筛选条件 -->
 <include src="./more.wxml"/>

+ 0 - 1
pages/buy/buy.wxss

@@ -1,7 +1,6 @@
 /* pages/buy/buy.wxss */
 @import "../../module/search/search.wxss"
 @import "../../module/caritem/caritem.wxss"
-@import "../../module/brandlist/brandlist.wxss"
 .filter_space{
 	height: 88rpx;
 }

+ 4 - 4
pages/cardetail/cardetail.wxml

@@ -92,7 +92,7 @@
 		<view class="cardetail_baseinfo_c">
 			<view class="cardetail_baseinfo_i">
 				<view class="cardetail_baseinfo_v">{{detail.distance_at}}</view>
-				<view class="cardetail_baseinfo_n">{{detail.first_plate_at}}首次上牌</view>
+				<view class="cardetail_baseinfo_n">{{detail.distance_at}}首次上牌</view>
 			</view>
 			<view class="cardetail_baseinfo_i">
 				<view class="cardetail_baseinfo_v">{{detail.mileage}}</view>
@@ -107,7 +107,7 @@
 				<view class="cardetail_baseinfo_n">排量</view>
 			</view>
 			<view class="cardetail_baseinfo_i">
-				<view class="cardetail_baseinfo_v">{{detail.plate_province_name}} {{detail.plate_province_name}}</view>
+				<view class="cardetail_baseinfo_v">{{detail.plate_province_name}}</view>
 				<view class="cardetail_baseinfo_n">上牌地址</view>
 			</view>
 			<view class="cardetail_baseinfo_i">
@@ -173,13 +173,13 @@
 		<view class="cardetail_img_l">
 			<block wx:for="{{detail.imgs}}" wx:key="item">
 				<image class='cardetail_img_i' src="{{item}}"/>
-			</block>  
+			</block>
 		</view>
 	</view>
 	<view 
 		wx:if="{{detail.check_info.length>0}}"
 		class="cardetail_space">
-		<view class="cardetail_space_t">检报告</view>
+		<view class="cardetail_space_t">检报告</view>
 		<view class="cardetail_check_report">
 			<block wx:for="{{detail.check_info}}" wx:key="item">
 				<view class="cardetail_check_i">

+ 3 - 0
pages/cardetail/cardetail.wxss

@@ -237,6 +237,9 @@
 }
 .collocate_item_v{
 	flex: 1;
+	line-height: 32rpx;
+	align-items:center;
+	display:flex;
 	color: rgba(104, 104, 104, 1);
 	font-size: 24rpx;
 }

+ 85 - 60
pages/evaluate/evaluate.js

@@ -1,5 +1,5 @@
 // pages/evaluate/evaluate.js
-import { get,post,upload } from "../../common/request.js"
+import { get, postwithoutahth , upload } from "../../common/request.js"
 import pathmap from "../../common/pathmap"
 import stylemap from "../../common/stylemap"
 const app = getApp();
@@ -42,7 +42,7 @@ Page({
   onLoad: function (options) {
     this.setData(stylemap);
     this.getCararea(0,0,0);
-    this.getCarSeries(0,0,0);
+    //this.getCarSeries(0,0,0);
   },
 
   /**
@@ -134,58 +134,66 @@ Page({
   //     }
   //   })
   // },
-  getCarSeries:function(id,index,sel){
-    var _self=this;
-    sel = sel||0;
-    //resule 为借口返回数组对应的属性名
-    var path="",para={},key = "",resule="";
-    if(index==0){
-      path = pathmap.brandlist;
-      key = "brand_id";
-      resule = "brand";         
-    }else if(index==1){
-      path = pathmap.serieslist;
-      para = {brand_id:id}; //this.data.series['0'][this.data.selectseries['0']].brand_id}
-      key = "car_series_id";
-      resule = "car_series";
-    }else if(index==2){
-      path = pathmap.carmodel;
-      para = {car_series_id:id};  //this.data.series['1'][this.data.selectseries['1']].car_series_id}
-    }
-    get(path,para,function(json){
-      var obj = {},select={};
-      obj[index] = json.data;
-      if(resule){
-        obj[index] = obj[index][resule];
-      }
-      select[index] = sel;
-      _self.setData({
-        series:Object.assign({},_self.data.series,obj),
-        selectseries:Object.assign({},_self.data.selectseries,select)
-      });
-      if(index<2){
-        _self.getCarSeries(obj[index][sel][key],1+parseInt(index),0);
-      }
-    })
-  },
-  bindSeriesChange:function(e){
-    var index = e.currentTarget.dataset.index;
-    var select = e.detail.value;
-    var obj = {};
-    var key=""
-    if(index==0){
-      key = "brand_id";       
-    }else if(index==1){
-      key = "car_series_id";
-    }
-    obj[index]=select;
-    this.setData({selectseries:Object.assign(this.data.selectseries,obj)});
-    if(index<2){
-      this.getCarSeries(this.data.series[index][select][key],1+parseInt(index),0);
+  // getCarSeries:function(id,index,sel){
+  //   var _self=this;
+  //   sel = sel||0;
+  //   //resule 为借口返回数组对应的属性名
+  //   var path="",para={},key = "",resule="";
+  //   if(index==0){
+  //     path = pathmap.brandlist;
+  //     key = "brand_id";
+  //     resule = "brand";         
+  //   }else if(index==1){
+  //     path = pathmap.serieslist;
+  //     para = {brand_id:id}; //this.data.series['0'][this.data.selectseries['0']].brand_id}
+  //     key = "car_series_id";
+  //     resule = "car_series";
+  //   }else if(index==2){
+  //     path = pathmap.carmodel;
+  //     para = {car_series_id:id};  //this.data.series['1'][this.data.selectseries['1']].car_series_id}
+  //   }
+  //   get(path,para,function(json){
+  //     var obj = {},select={};
+  //     obj[index] = json.data;
+  //     if(resule){
+  //       obj[index] = obj[index][resule];
+  //     }
+  //     select[index] = sel;
+  //     _self.setData({
+  //       series:Object.assign({},_self.data.series,obj),
+  //       selectseries:Object.assign({},_self.data.selectseries,select)
+  //     });
+  //     if(index<2){
+  //       _self.getCarSeries(obj[index][sel][key],1+parseInt(index),0);
+  //     }
+  //   })
+  // },
+  // bindSeriesChange:function(e){
+  //   var index = e.currentTarget.dataset.index;
+  //   var select = e.detail.value;
+  //   var obj = {};
+  //   var key=""
+  //   if(index==0){
+  //     key = "brand_id";       
+  //   }else if(index==1){
+  //     key = "car_series_id";
+  //   }
+  //   obj[index]=select;
+  //   this.setData({selectseries:Object.assign(this.data.selectseries,obj)});
+  //   if(index<2){
+  //     this.getCarSeries(this.data.series[index][select][key],1+parseInt(index),0);
+  //   }
+  // },
+  getMileage:function(e){
+    var mileage = e.detail.value;
+    if(mileage>10){
+      mileage=Math.floor(mileage/10);
     }
+    this.setData({mileage:mileage});
   },
-  getMileage:function(e){
+  initMileage:function(e){
     var mileage = e.detail.value;
+
     this.setData({mileage:mileage});
   },
   bindDateChange: function(e) {
@@ -199,22 +207,21 @@ Page({
   },
   subEvaluate:function(){
     var _self=this;
-    post(pathmap.estimatedprice,{
+    var title = "";
+    // if(!this.data.mobile&&/^[1][3|4|5|6|7|8|9][0-9]{9}$/.test(this.data.mobile)){
+    //   title="请填写有效手机号"
+    // }
+    postwithoutahth(pathmap.estimatedprice,{
       mobile:this.data.mobile,
-      model_types:this.data.series['2'][this.data.selectseries['2']].car_model_id,
-      car_name:this.data.series['2'][this.data.selectseries['2']].car_model_name,
+      model_types:this.data.model.car_model_id,
+      car_name:this.data.model.car_model_name,
       license_time:this.data.date,
       mileage:this.data.mileage,
       area:this.data.area['1'][this.data.areaselect['1']].area_id,
       city_name:`${this.data.area['0'][this.data.areaselect['0']].area_name} ${this.data.area['1'][this.data.areaselect['1']].area_name}`,
     },function(json){  
 
-      if(json.data.status==0){
-        wx.showToast({
-          title:"估价失败!",
-          icon:"none"
-        });
-      }else{
+      if(json.data.status==1){        
         wx.showToast({
           title:"估价成功!"
         }); 
@@ -228,6 +235,11 @@ Page({
           showeva:true,
           currenteva:obj[json.data.default_car_condition]
         })
+      }else{
+        wx.showToast({
+          title:"估价失败!",
+          icon:"none"
+        });
       }
     })
   },
@@ -245,5 +257,18 @@ Page({
     this.setData({
       showeva:false
     })
+  },
+  showSeriesSelect:function(){
+    this.setData({brandlistshow:true});
+  },
+  closeBrandList:function(){
+    this.setData({brandlistshow:false});
+  },
+  selectModel:function(e){
+    var model = e.detail.model;
+    this.setData({
+      brandlistshow:false,
+      model:model
+    })
   }
 })

+ 2 - 1
pages/evaluate/evaluate.json

@@ -1,6 +1,7 @@
 {
 	"disableScroll":true,
   	"usingComponents":{
-		"page-scroll":"../../components/page-scroll/page-scroll"
+		"page-scroll":"../../components/page-scroll/page-scroll",		
+		"brandlist":"../../components/brandlist/brandlist"
 	}
 }

+ 17 - 3
pages/evaluate/evaluate.wxml

@@ -58,7 +58,14 @@
 	  			</view>
 	  			车型
 	  		</view>
-  			<picker
+	  		<view
+  				class="evaluate_form_input"
+  				bindtap="showSeriesSelect"
+  			>
+  				<view wx:if="{{model&&model.car_model_name}}" class="series_val">{{model.car_model_name}}</view>
+  				<view wx:else class="placeholder_val">请选择</view>
+  			</view>
+  			<!-- <picker
 		  		class="evaluate_form_picker"
 				bindchange="bindSeriesChange" 
 				value="{{selectseries['0']}}" 
@@ -93,7 +100,7 @@
 			    <view class="picker">
 			      {{series['2'][selectseries['2']].car_model_name||'请选择>'}}
 			    </view>
-		  	</picker>
+		  	</picker> -->
   		</view>
 	  	<view
 	  		class="evaluate_form_item"
@@ -130,6 +137,7 @@
   				placeholder="请输入"
   				bindinput="getMileage"
   				placeholder-style="color:#9B9B9B"
+  				bindblur="initMileage"
   			/>
   			<view class="evaluate_form_itr">万公里</view>
 	  	</view>
@@ -240,4 +248,10 @@
 		    </swiper>
   		</view>
   	</view>
-</page-scroll>
+</page-scroll>
+<brandlist
+  show="{{brandlistshow}}"
+  bind:close="closeBrandList"
+  bind:select="selectModel"
+  hasmodel="true"
+/>

+ 7 - 1
pages/evaluate/evaluate.wxss

@@ -41,6 +41,13 @@
 	white-space: nowrap;
 	text-overflow:ellipsis;
 }
+.series_val{
+	display: inline;
+}
+.placeholder_val{
+	display: inline;
+	color:#9B9B9B;
+}
 .evaluate_form_itr{
 	color: rgba(56, 55, 53, 1);
 	padding-right: 38rpx;
@@ -56,7 +63,6 @@
 	height: 98rpx;
 	background:linear-gradient(270deg,#FFD800,#FFE600);
 	line-height: 98rpx;
-	border-radius: 6rpx;
 	color: rgba(56, 55, 53, 1);
 	font-size: 30rpx;
 	text-align: center;

+ 1 - 0
pages/hotdt/hotdt.js

@@ -74,6 +74,7 @@ Page({
     get(pathmap.goodcardetail, {
       id:this.data.id
     }, function (json) {
+      json.data.content = json.data.content.replace('<img', '<img style="max-width:100%;height:auto" ');
       _self.setData(json.data);
     })
   }

+ 1 - 1
pages/hotdt/hotdt.wxml

@@ -24,7 +24,7 @@
 			</view>
 		</view>
 		<view class="hotdt_content">
-			<rich-text 
+			<rich-text
 				nodes="{{content}}">
 			</rich-text>
 		</view>

+ 3 - 0
pages/hotdt/hotdt.wxss

@@ -51,4 +51,7 @@
 	color: rgba(104, 104, 104, 1);
 	font-size: 28rpx;
 	font-family: NotoSansHans-DemiLight;
+}
+.hotdt_content img{
+	max-width: 100%;
 }

+ 9 - 10
pages/index/cardetail.wxml

@@ -1,17 +1,16 @@
 <template name="cardetail">
-  <view class="car_b">
-    <navigator 
-      open-type="navigate"
+  <navigator    
+    open-type="navigate"
+    url="../cardetail/cardetail?id={{car.id}}"
+    class="car_b">
+    <view
       class="car_img" 
-      style="background-image:url({{car.img}})"      
-      url="../cardetail/cardetail?id={{car.id}}"
+      style="background-image:url({{car.img}})"   
     />
     <view class="car_info">
-      <navigator 
-        open-type="navigate"
+      <view 
         class="car_t"
-        url="../cardetail/cardetail?id={{car.id}}"
-      >{{car.title?car.title:'--'}}</navigator>
+      >{{car.title?car.title:'--'}}</view>
       <view class="car_time">
         {{car.licensetime}}年上牌|{{car.mileage}}万公里
       </view>
@@ -24,5 +23,5 @@
         </block>
       </view>
     </view>
-  </view>
+  </navigator>
 </template>

+ 1 - 1
pages/index/index.wxss

@@ -200,8 +200,8 @@
   height: 200rpx;
 }
 .recommended_tab{
-  position: absolute;
   bottom:10rpx;
+  padding: 5rpx 0rpx 10rpx; 
   display: flex;
   text-align: center;
   justify-content:center;

+ 0 - 1
pages/loans/loans.wxss

@@ -10,7 +10,6 @@
 	height: 98rpx;
 	background:linear-gradient(270deg,#FFD800,#FFE600);
 	line-height: 98rpx;
-	border-radius: 6rpx;
 	color: rgba(56, 55, 53, 1);
 	font-size: 30rpx;
 	text-align: center;

+ 67 - 53
pages/sell/sell.js

@@ -15,7 +15,8 @@ Page({
     area:{},
     areaselect:{},
     series:{},
-    selectseries:{},
+    brandlistshow:false,
+    //selectseries:{},
     imgs:[
       "",
       "",
@@ -32,7 +33,7 @@ Page({
     //bindLog(this);
     this.setData(stylemap);
     this.getCararea(0,0,0);
-    this.getCarSeries(0,0,0);
+    //this.getCarSeries(0,0,0);
     try{
       var authorization = wx.getStorageSync("authorization");
     }catch(e){
@@ -132,56 +133,56 @@ Page({
   //     }
   //   })
   // },
-  getCarSeries:function(id,index,sel){
-    var _self=this;
-    sel = sel||0;
-    //resule 为借口返回数组对应的属性名
-    var path="",para={},key = "",resule="";
-    if(index==0){
-      path = pathmap.brandlist;
-      key = "brand_id";
-      resule = "brand";         
-    }else if(index==1){
-      path = pathmap.serieslist;
-      para = {brand_id:id}; //this.data.series['0'][this.data.selectseries['0']].brand_id}
-      key = "car_series_id";
-      resule = "car_series";
-    }else if(index==2){
-      path = pathmap.carmodel;
-      para = {car_series_id:id};  //this.data.series['1'][this.data.selectseries['1']].car_series_id}
-    }
-    get(path,para,function(json){
-      var obj = {},select={};
-      obj[index] = json.data;
-      if(resule){
-        obj[index] = obj[index][resule];
-      }
-      select[index] = sel;
-      _self.setData({
-        series:Object.assign({},_self.data.series,obj),
-        selectseries:Object.assign({},_self.data.selectseries,select)
-      });
-      if(index<2){
-        _self.getCarSeries(obj[index][sel][key],1+parseInt(index),0);
-      }
-    })
-  },
-  bindSeriesChange:function(e){
-    var index = e.currentTarget.dataset.index;
-    var select = e.detail.value;
-    var obj = {};
-    var key=""
-    if(index==0){
-      key = "brand_id";       
-    }else if(index==1){
-      key = "car_series_id";
-    }
-    obj[index]=select;
-    this.setData({selectseries:Object.assign(this.data.selectseries,obj)});
-    if(index<2){
-      this.getCarSeries(this.data.series[index][select][key],1+parseInt(index),0);
-    }
-  },
+  // getCarSeries:function(id,index,sel){
+  //   var _self=this;
+  //   sel = sel||0;
+  //   //resule 为借口返回数组对应的属性名
+  //   var path="",para={},key = "",resule="";
+  //   if(index==0){
+  //     path = pathmap.brandlist;
+  //     key = "brand_id";
+  //     resule = "brand";         
+  //   }else if(index==1){
+  //     path = pathmap.serieslist;
+  //     para = {brand_id:id}; //this.data.series['0'][this.data.selectseries['0']].brand_id}
+  //     key = "car_series_id";
+  //     resule = "car_series";
+  //   }else if(index==2){
+  //     path = pathmap.carmodel;
+  //     para = {car_series_id:id};  //this.data.series['1'][this.data.selectseries['1']].car_series_id}
+  //   }
+  //   get(path,para,function(json){
+  //     var obj = {},select={};
+  //     obj[index] = json.data;
+  //     if(resule){
+  //       obj[index] = obj[index][resule];
+  //     }
+  //     select[index] = sel;
+  //     _self.setData({
+  //       series:Object.assign({},_self.data.series,obj),
+  //       selectseries:Object.assign({},_self.data.selectseries,select)
+  //     });
+  //     if(index<2){
+  //       _self.getCarSeries(obj[index][sel][key],1+parseInt(index),0);
+  //     }
+  //   })
+  // },
+  // bindSeriesChange:function(e){
+  //   var index = e.currentTarget.dataset.index;
+  //   var select = e.detail.value;
+  //   var obj = {};
+  //   var key=""
+  //   if(index==0){
+  //     key = "brand_id";       
+  //   }else if(index==1){
+  //     key = "car_series_id";
+  //   }
+  //   obj[index]=select;
+  //   this.setData({selectseries:Object.assign(this.data.selectseries,obj)});
+  //   if(index<2){
+  //     this.getCarSeries(this.data.series[index][select][key],1+parseInt(index),0);
+  //   }
+  // },
   uploadImg:function(e){
     var _self=this;
     var index = e.currentTarget.dataset.index;
@@ -214,7 +215,7 @@ Page({
     //var mobile = wx.getStorageSync("mobile")
     postwithoutahth(pathmap.sellingcar,{
       mobile:this.data.mobile,
-      car_name:this.data.series['2'][this.data.selectseries['2']].car_model_name,
+      car_name:this.data.series.car_series_name,
       plate_at:this.data.date,
       mileage:this.data.mileage,
       city_name:`${this.data.area['0'][this.data.areaselect['0']].area_name} ${this.data.area['1'][this.data.areaselect['1']].area_name}`,
@@ -228,5 +229,18 @@ Page({
       }
       wx.showToast(obj);
     })
+  },
+  showSeriesSelect:function(){
+    this.setData({brandlistshow:true});
+  },
+  closeBrandList:function(){
+    this.setData({brandlistshow:false});
+  },
+  selectSeries:function(e){
+    var series = e.detail.series;
+    this.setData({
+      brandlistshow:false,
+      series:series
+    })
   }
 })

+ 2 - 1
pages/sell/sell.json

@@ -1,6 +1,7 @@
 {
 	"disableScroll":true,
   	"usingComponents":{
-		"page-scroll":"../../components/page-scroll/page-scroll"
+		"page-scroll":"../../components/page-scroll/page-scroll",		
+		"brandlist":"../../components/brandlist/brandlist"
 	}
 }

+ 14 - 2
pages/sell/sell.wxml

@@ -45,7 +45,14 @@
 	  			</view>
 	  			车型
 	  		</view>
-  			<picker
+	  		<view
+  				class="sell_form_input"
+  				bindtap="showSeriesSelect"
+  			>
+  				<view wx:if="{{series&&series.car_series_name}}" class="series_val">{{series.car_series_name}}</view>
+  				<view wx:else class="placeholder_val">请选择</view>
+  			</view>
+  			<!-- <picker
 		  		class="sell_form_picker"
 				bindchange="bindSeriesChange" 
 				value="{{selectseries['0']}}" 
@@ -80,7 +87,7 @@
 			    <view class="picker">
 			      {{series['2'][selectseries['2']].car_model_name||'请选择>'}}
 			    </view>
-		  	</picker>
+		  	</picker> -->
   		</view>
 	  	<view
 	  		class="sell_form_item"
@@ -188,4 +195,9 @@
       data="{{local:2,footerheight:footerheight}}"
     />  
 </page-scroll>
+<brandlist
+  show="{{brandlistshow}}"
+  bind:close="closeBrandList"
+  bind:select="selectSeries"
+/>
 <!-- <include src="../../module/logs/logs.wxml"/> -->

+ 7 - 0
pages/sell/sell.wxss

@@ -46,6 +46,13 @@
 	font-size: 24rpx;
 	overflow: hidden;
 }
+.series_val{
+	display: inline;
+}
+.placeholder_val{
+	display: inline;
+	color:#9B9B9B;
+}
 .picker{
 	overflow: hidden;
 	white-space: nowrap;