Pārlūkot izejas kodu

dev detail page

liguorui 7 gadi atpakaļ
vecāks
revīzija
282bab62bd

+ 1 - 0
app.js

@@ -37,6 +37,7 @@ App({
       success:function(res) {
         _self.globalData.scale = 750/res.windowWidth;
         _self.globalData.windowh = res.windowHeight*_self.globalData.scale;
+        _self.globalData.Authorization = false;
       }
     });
   },

+ 1 - 1
app.json

@@ -2,9 +2,9 @@
   "pages":[
     "pages/index/index",
     "pages/buy/buy",
-    "pages/logs/logs",
     "pages/search/search",
     "pages/searchresult/searchresult",
+    "pages/logs/logs",
     "pages/shop/shop",
     "pages/sell/sell",
     "pages/cardetail/cardetail"

+ 4 - 2
common/pathmap.js

@@ -12,7 +12,9 @@ export default{
   "storeinfo":"/api/store_info",
   "searchcar":"/api/cars",
   "wheres":"/api/wheres",      //筛选条件获取
-  "series":"/api/car_series",  //获取车系信息
   "brandrecommend":"/api/home_brand",    //推荐品牌
-  "cardetail":"/api/car_detail"           //获取车辆详情
+  "cardetail":"/api/car_detail",           //获取车辆详情
+  "getbrand":"/api/brand_list",
+  "serieslist":"/api/series_list",
+  "collect":"/api/collect"
 }

+ 27 - 17
common/request.js

@@ -38,22 +38,32 @@ export const get=(url,data,callback,failback)=>{
 } 
 export const post=(url,data,header,callback,failback)=>{
   addnum();
-  wx.request({
-    url: app.globalData.serverpath+url,
-    method: "POST",
-    header: Object.assign({
-      "Content-Type": "json"
-    },header),
-    data:data,
-    success: function (res){
-      console.debug(res);
-      callback && callback(res);
-    },
-    fail: function (error){
-      failback && failback(error);
-    },
-    complete: function () {
-      reducenum();
+  if(app.globalData.Authorization){
+    if(typeof header=="function"){
+      failback = callback;
+      callback = header;
+      header = {};
     }
-  })
+    wx.request({
+      url: app.globalData.serverpath+url,
+      method: "POST",
+      header: Object.assign({
+        "Content-Type": "json",
+        "Authorization":app.globalData.Authorization
+      },header),
+      data:data,
+      success: function (res){
+        //console.debug(res);
+        callback && callback(res);
+      },
+      fail: function (error){
+        failback && failback(error);
+      },
+      complete: function () {
+        reducenum();
+      }
+    })
+  }else{
+
+  }
 } 

BIN
img/accident.png


BIN
img/checkcollide.png


BIN
img/checknopass.png


BIN
img/checkpass.png


BIN
img/collect.png


BIN
img/comonuse.png


BIN
img/decorate.png


BIN
img/down_icon.png


BIN
img/right.png


BIN
img/startcheck.png


BIN
img/uncollect.png


BIN
img/wastage.png


+ 17 - 0
module/logs/logs.wxml

@@ -0,0 +1,17 @@
+<view class="logs_content">
+	<image 
+		class="logs_back"
+		bindtap="closeLog"
+	/>
+	<view class="logs_welcome">
+		欢迎来到第一好车
+	</view>
+	<view class="logs_welcome_withoutlog">
+		无需注册,急速登录
+	</view>
+	<view>
+	<input 
+		class="logs_phone_num"
+	/>
+	</view>
+</view>

+ 0 - 0
module/logs/logs.wxss


+ 57 - 34
pages/buy/buy.js

@@ -105,30 +105,8 @@ Page({
   getWheres:function(){
     var _self = this;
     get(pathmap.wheres, {
+      no_brand_series:1
     }, 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);
-        }
-      })
-      var inith = 562;
-      var scale = app.globalData.scale;
-      for(var name in brandlist){
-        var l = brandlist[name].length;
-        if(l>0){
-          json.data.brandlist.push({
-            initial:name,
-            list:brandlist[name],
-            top:inith/scale
-          });          
-          inith = inith+45+l*79;
-        }
-      }
       _self.setData({
         wheres: json.data
       })
@@ -202,10 +180,45 @@ 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;
@@ -248,18 +261,28 @@ Page({
     var _self = this;
     var brand = e.currentTarget.dataset.brand;
     var 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.serieslist, {brand_id:brand.brand_id}, function (json) {
+      series = json.data.car_series;      
+      _self.setData({
+        serieslist:{
+          belong:brand,
+          list:series
+        },
+        searchdata:Object.assign(_self.data.searchdata,{brand:brand.brand_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) {

+ 57 - 2
pages/cardetail/cardetail.js

@@ -11,7 +11,35 @@ Page({
    * 页面的初始数据
    */
   data: {
-  
+    collocatetype:[{
+      label:"基本参数",
+      name:"jiben"
+    },{
+      label:"发动机参数",
+      name:"fadongji"
+    },{
+      label:"底盘及制动",
+      name:"dipan"
+    },{
+      label:"安全配置",
+      name:"anquan"
+    },{
+      label:"外部配置",
+      name:"waibu"
+    },{
+      label:"内部配置",
+      name:"neibu"
+    },{
+      label:"操控/辅助配置",
+      name:"caokong"
+    }],
+    imagemap:{
+      "事故排查":"accident",
+      "轻微碰撞":"checkcollide",
+      "易损耗部件":"wastage",
+      "常用功能":"comonuse",
+      "启动检测":"startcheck"
+    }
   },
 
   /**
@@ -76,9 +104,13 @@ Page({
       var detail = json.data;
       var time = detail.first_plate_at.split('-');
       /*数据结构处理*/
-      detail.imgs = detail.imgs.split(",");
+      detail.imgs = detail.imgs&&detail.imgs.split(",");
       detail.imgslength = detail.imgs.length;
       detail.first_plate_at = time[0]+"/"+time[1];
+      detail.check_info.forEach(function(item){
+
+      })
+
       _self.setData({
         detail:detail,
         id:id
@@ -89,5 +121,28 @@ Page({
     this.setData({
       currentimg: e.detail.current+1
     });
+  },
+  swCollocate:function(e){
+    var name = e.currentTarget.dataset.name;
+    var collocatetype = this.data.collocatetype.map(function(item){
+      if(item.name==name){
+        if(item.opened){
+          item.opened=false;
+        }else{
+          item.opened=true;
+        }
+      }else{
+        item.opened=false;
+      }
+      return item;
+    })
+    this.setData({collocatetype:collocatetype});
+  },
+  collectCar:function(){
+    post(pathmap.collect,{
+      id:this.data.id
+    },function(json){
+      
+    })
   }
 })

+ 86 - 1
pages/cardetail/cardetail.wxml

@@ -73,7 +73,7 @@
 		<view class="cardetail_shop_n">{{detail.shop_name}}</view>
 		<view class="cardetail_shop_d">
 			<image src="../../img/address.png"/>
-			##############
+			{{detail.work_address}}
 		</view>
 		<navigator 
 			class="cardetail_shop_nav"
@@ -121,4 +121,89 @@
 			</view>
 		</view>
 	</view>
+	<view class="cardetail_space">
+		<view class="cardetail_space_t">车辆描述</view>
+		<view class="cardetail_describe">
+			########################################################
+		</view>
+	</view>
+	<view class="cardetail_space">
+		<view class="cardetail_space_t">配置详情</view>
+		<view class="cardetail_collocate">
+			仅供参考,购买前请于销售确认
+		</view>		
+		<view class="cardetail_collocate_list">
+			<block wx:for="{{collocatetype}}" wx:key="name">
+				<view class="cardetail_collocate_item {{item.opened?'collocate_open':''}}">
+					<view 
+						class="cardetail_collocate_item_t"
+						bindtap="swCollocate"
+					>
+						{{item.label}}
+						<image
+							data-name="{{item.name}}"
+							src="../../img/down_icon.png" 
+							class="cardetail_collocate_item_sw"
+						/>
+					</view>
+					<view 
+						class="cardetail_collocate_item_l"
+						style="height:{{item.opened?detail[item.name].length*89:0}}rpx"
+					>
+						<block wx:for="{{detail[item.name]}}" wx:key="k" wx:for-item="info">
+							<view class="cardetail_collocate_item_d">
+								<view class="collocate_item_n">{{info.k}}</view>
+								<view class="collocate_item_v">{{info.v}}</view>
+							</view>
+						</block>
+					</view>
+				</view>
+			</block>
+		</view>
+	</view>
+	<view class="cardetail_space">
+		<view class="cardetail_space_t">车辆实拍</view>
+		<view class="cardetail_img_l">
+			<block wx:for="{{detail.imgs}}" wx:key="item">
+				<image class='cardetail_img_i' src="{{item}}"/>
+			</block>  
+		</view>
+	</view>
+	<view class="cardetail_space">
+		<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">
+					<view class="cardetail_check_n">
+						<image src = "../../img/{{imagemap[item.name]}}.png"/>
+						<view>{{item.name}}</view>
+					</view>
+					<view class="cardetail_check_i">
+						<view>{{item.name}}</view>
+						<image src = "../../img/uncollect.png"/>
+					</view>
+				</view>
+			</block>  
+		</view>
+	</view>
+	<view class="cardetail_op_list">
+		<view class="cardetail_op_collect">
+			<image 
+				src="../../img/uncollect.png"
+				bindtap="collectCar"
+			/>
+			<view>收藏</view>
+		</view>
+		<view class="cardetail_op_phone">
+			<image src="../../img/phone.png"/>
+			<view>电话</view>
+		</view>
+		<view class="cardetail_op_appointment">
+			预约看车
+		</view>
+		<view class="cardetail_op_line"></view>
+		<view class="cardetail_op_buy">
+			分期购车
+		</view>
+	</view>
 </scroll-view>

+ 134 - 1
pages/cardetail/cardetail.wxss

@@ -138,18 +138,22 @@
 
 .cardetail_space{
 	background-color:white;
-	padding:38px;
+	padding-top:36rpx;
+	margin-top:20rpx;
 }
 .cardetail_space_t{
 	height: 32rpx;
 	line-height: 32rpx;
 	color: rgba(104, 104, 104, 1);
 	font-size: 32rpx;
+	text-indent:10rpx;
 	border-left:6rpx solid #FFE600;
+	margin:0rpx 40rpx;
 }
 .cardetail_baseinfo_c{
 	display: flex;
 	flex-wrap: wrap;
+	padding: 0rpx 48rpx 40rpx;
 }
 .cardetail_baseinfo_i{
 	width:33.3%;
@@ -166,4 +170,133 @@
 	line-height: 36rpx;
 	color: rgba(155, 155, 155, 1);
 	font-size: 24rpx;
+}
+.cardetail_describe{
+	line-height: 34rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 24rpx;
+	padding: 48rpx;
+	word-break: break-all;
+}
+
+.cardetail_collocate{
+	text-indent: 40rpx;
+	height: 30rpx;
+	line-height: 30rpx;
+	color: rgba(104, 104, 104, 1);
+	font-size: 20rpx;
+}
+.cardetail_collocate_list{
+	margin-top:40rpx;
+}
+.cardetail_collocate_item{
+}
+.cardetail_collocate_item_t{
+	border-top: 1rpx solid rgba(235, 235, 235, 1);
+	height: 88rpx;
+	line-height: 88rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 26rpx;
+	margin:0rpx 48rpx;
+	position: relative;
+}
+.cardetail_collocate_item_sw{	
+	position: absolute;
+	top: 33rpx;
+	right: 0rpx;
+	width: 22rpx;
+	height: 22rpx;
+	transition: transform 0.5s;
+}
+.collocate_open .cardetail_collocate_item_sw{
+	transform: rotate(180deg);
+}
+.cardetail_collocate_item_l{
+	height: 0rpx;
+	transition: height 0.5s;
+	overflow: hidden;
+	background-color: #fffef0;
+}
+/*.collocate_open .cardetail_collocate_item_l{
+	height: auto;
+}*/
+.cardetail_collocate_item_d{
+	height: 88rpx;
+	line-height: 88rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 26rpx;
+	border-top: 1rpx solid rgba(235, 235, 235, 1);
+	display: flex;
+}
+.collocate_item_n{
+	text-indent: 48rpx; 
+	width:316rpx;
+}
+.collocate_item_v{
+	flex: 1;
+	color: rgba(104, 104, 104, 1);
+	font-size: 24rpx;
+}
+
+.cardetail_img_i{
+	margin:32rpx 38rpx 0rpx;
+	width: 674rpx;
+}
+/*********检查样式************/
+.cardetail_check_report{
+	padding-bottom: 80rpx;
+	border-bottom: 1rpx solid rgba(235, 235, 235, 1); 
+}
+.cardetail_check_i{
+	display: flex;
+	height: 98rpx;
+	line-height: 98rpx;
+	border-bottom: 1rpx solid rgba(235, 235, 235, 1); 
+}
+.cardetail_check_n{
+	width: 450rpx;
+	text-align: 48rpx;
+}
+.cardetail_check_n image{
+	
+}
+
+/*******底部操作样式*******/
+.cardetail_op_list{
+	position: fixed;
+	left:0rpx;
+	bottom:0rpx;
+	width: 100%;
+	height: 98rpx;
+	display: flex;
+	background-color:white;
+	text-align: center;
+}
+.cardetail_op_collect,.cardetail_op_phone{
+	width: 136rpx;
+	text-align: center;
+	line-height: 24rpx;
+	color: rgba(104, 104, 104, 1);
+	font-size: 16rpx;
+}
+.cardetail_op_collect image,.cardetail_op_phone image{
+	width: 36rpx;
+	height: 36rpx;
+	display: block;
+	margin: 20rpx auto 0rpx;
+}
+.cardetail_op_appointment,.cardetail_op_buy{
+	flex: 1;
+	background-color: #FFE600;
+	line-height: 98rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 30rpx;
+}
+.cardetail_op_line{
+	border-top:25rpx solid #FFE600;
+	border-bottom:25rpx solid #FFE600;
+	width: 1rpx;
+	height: 48rpx;
+	background-color: rgba(155, 155, 155, 1);
+
 }

+ 1 - 1
pages/index/index.js

@@ -27,7 +27,7 @@ Page({
     this.loadRecommendedCar();
     this.loadLikeCar();
     bindSearch(this);
-    bindTopSource(this);
+    //bindTopSource(this);
   },
   loadBanner: function () {
     var _self = this;

+ 8 - 6
pages/index/index.wxml

@@ -5,19 +5,21 @@
 <import src="goodcar.wxml"/>
 <import src="cardetail.wxml"/>
 <import src="../../module/caritem/caritem.wxml"/>
+
+
+ <!--  upper-threshold="0"
+  bindscrolltoupper="sourceUp"
+  bindtouchstart="{{scrollsource.scrolltop?'':'sourceStart'}}"
+  bindtouchend="{{scrollsource.startdot?'sourceEnd':''}}"
+  bindtouchcancel="{{scrollsource.startdot?'sourceEnd':''}}" -->
 <scroll-view 
   class="conent"
   style="height:{{windowh}}rpx;"
   scroll-y="{{scrollsource.startdot&&scrollsource.distance>0?false:true}}"
   bindscroll=""
-  upper-threshold="0"
-  bindscrolltoupper="sourceUp"
-  bindtouchstart="{{scrollsource.scrolltop?'':'sourceStart'}}"
-  bindtouchend="{{scrollsource.startdot?'sourceEnd':''}}"
-  bindtouchcancel="{{scrollsource.startdot?'sourceEnd':''}}"
 >
+    <!-- bindtouchmove="sourceMove" -->
   <view
-    bindtouchmove="sourceMove"
   >    
     <template 
       is="header" 

+ 6 - 4
pages/logs/logs.wxml

@@ -1,6 +1,8 @@
 <!--logs.wxml-->
-<view class="container log-list">
-  <block wx:for="{{logs}}" wx:for-item="log">
-    <text class="log-item">{{index + 1}}. {{log}}</text>
-  </block>
+<view class="container">
+	<view class="logs_back">
+		
+	</view>
+	<view class="logs_c">
+	</view>
 </view>