liguorui 6 lat temu
rodzic
commit
38f77466fb

+ 2 - 1
app.json

@@ -1,7 +1,8 @@
 {
   "pages":[
-    "pages/evaluate/evaluate",
+    "pages/myloan/myloan",
     "pages/index/index",
+    "pages/evaluate/evaluate",
     "pages/sell/sell",
     "pages/loans/loans",
     "pages/collect/collect",

+ 18 - 2
common/request.js

@@ -27,7 +27,15 @@ export const get=(url,data,callback,failback)=>{
     },
     data:data,
     success: function (res){
-      console.debug(res);
+      if(res.statusCode!=200){
+        if(res.data.message){
+          wx.showToast({
+            title:res.data.message,
+            icon:"none"
+          })
+          return;
+        }
+      } 
       callback && callback(res);
     },
     fail: function (error){
@@ -58,7 +66,15 @@ export const post=(url,data,header,callback,failback,noauth)=>{
       },header),
       data:data,
       success: function (res){
-        //console.debug(res);
+        if(res.statusCode!=200){
+          if(res.data.message){
+            wx.showToast({
+              title:res.data.message,
+              icon:"none"
+            })
+            return;
+          }
+        } 
         callback && callback(res);
       },
       fail: function (error){

+ 115 - 0
components/carslider/carslider.js

@@ -0,0 +1,115 @@
+// components/carslider.js
+var app = getApp()
+
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    "min":{
+      value:0,
+      type:Number
+    },
+    "max":{
+      value:100,
+      type:Number
+    },
+    "splitnum":{
+      value:"0",
+      type:String
+    },
+    "unit":{
+      value:"0",
+      type:String
+    },
+    "splitvalue":{
+      value:NaN,
+      type:String
+    }
+    // "step":{
+    //   value:"",
+    //   type:String
+    // },
+    // "value":{
+    //   value:"",
+    //   type:String
+    // },
+    // "activeColor":{
+    //   value:"",
+    //   type:String
+    // },
+    // "backgroundColor":{
+    //   value:"",
+    //   type:String
+    // },
+    // "block-size":{
+    //   value:"",
+    //   type:String
+    // },
+    // "block-color":{
+    //   value:"",
+    //   type:String
+    // },
+    // "show-value":{
+    //   value:"",
+    //   type:String
+    // }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    scale:0,
+    gscale:app.globalData.scale
+  },
+  ready:function(){
+    if(this.data.splitnum>0){
+      var min = parseInt(this.data.min);
+      var space = this.data.max-this.data.min;
+      var gap = space/this.data.splitnum;
+      var list = [this.data.min];
+      for(var i=1;i<=this.data.splitnum;i++){
+        list.push(parseInt(this.data.min)+i*gap);
+      }
+      this.setData({
+        list:list,
+        value:min+gap*this.data.scale
+      });
+    }
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    changeScale:function(e){
+      var left = e.touches[0].pageX*this.data.gscale-45;
+      var scale = left/660;
+      if(scale>1){
+        scale=1;
+      }else if(scale<0){
+        scale=0;
+      }
+      var space = this.data.max-this.data.min;
+      var selectv = space*scale;      
+      if(this.data.splitvalue){
+        selectv = Math.round(selectv/this.data.splitvalue)*this.data.splitvalue;
+      }
+      scale = selectv/space;
+      var value = Math.round(selectv+parseInt(this.data.min));
+      var obj = {
+        scale:scale,
+        value:value
+      };
+      this.setData(obj)
+      this.triggerEvent("changevalue",obj);
+    },
+    changeEndScale:function(e){
+      var obj = {
+        scale:this.data.scale,
+        value:this.data.value
+      };
+      this.triggerEvent("changeend",obj);
+    }
+  }
+})

+ 4 - 0
components/carslider/carslider.json

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

+ 47 - 0
components/carslider/carslider.wxml

@@ -0,0 +1,47 @@
+<!--components/carslider.wxml-->
+<view class="carslider_content_c">
+	<!-- <slider
+		class="carslider_er"
+		min="{{min||'0'}}"
+		max="{{max||'50'}}"
+		value="{{value}}"
+		activeColor="#FFD800"
+		backgroundColor="#ffffff"
+		block-color="#FFD800"
+		bindchange="bindchange"
+		bindchanging="bindchanging"
+		block-src="../../img/slider.png"
+	>		
+	</slider> -->
+	<view class="slider_line_b">
+
+		<view class="slider_line_el">
+			<view 
+				style="width:{{scale*100}}%;"
+				class="slider_line_sl"
+			>
+				<view 
+					class="slider_control_b"
+					bindtouchmove="changeScale"
+					bindtouchend="changeEndScale"
+					>
+					<view
+						class="slider_control_v"
+					>{{value}}{{unit}}</view>
+					<view
+						class="slider_control_vb">
+					</view>
+					<image src="../../img/slider.png"/>
+				</view>
+			</view>
+		</view>
+	</view>
+	<view class="slider_value_b">
+		<view class=""></view>
+	</view>
+	<view class="space_box">
+		<block wx:for="{{list}}" wx:key="item">
+			<view>{{item}}{{unit}}</view>
+		</block>
+	</view>
+</view>

+ 75 - 0
components/carslider/carslider.wxss

@@ -0,0 +1,75 @@
+/* components/carslider.wxss */
+.carslider_content_c{
+	height: 140rpx;
+	position: relative;
+	overflow: hidden;
+}
+.slider_line_b{
+	height: 110rpx;
+	width: 660rpx;
+	margin:0px auto;
+	position: relative;
+}
+.slider_line_el{
+	position: absolute;
+	top:64rpx;
+	left:0rpx;
+	width:100%;
+	height: 4rpx;
+	background-color: white;
+}
+.slider_line_sl{
+	height: 100%;
+	background-color:#FFD800;
+	position: relative;
+}
+.slider_control_b{
+	width:40rpx;
+	height: 90rpx;
+	position: absolute;
+	top:-66rpx;
+	right:-20rpx;
+}
+.slider_control_v{
+	height: 20rpx;
+	line-height: 20rpx;
+	position: absolute;
+	top:0rpx;
+	background-color: #ffe600;
+	padding: 5rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 18rpx;
+	font-family: NotoSansHans-DemiLight;
+	white-space: nowrap;
+	border-radius: 6rpx;
+}
+.slider_control_vb{
+	content: "";
+	position: absolute;
+	top:22rpx;
+	left:10rpx;
+	border-top:22rpx solid #ffe600;
+	border-left:10rpx solid transparent;
+	border-right:10rpx solid transparent;
+}
+.slider_control_b image{	
+	width:40rpx;
+	height: 40rpx;
+	position: absolute;
+	bottom: 0rpx;
+}
+
+
+
+.carslider_er{
+	margin-top:54rpx;
+}
+.space_box{
+	display: flex;
+	justify-content:space-between;
+	margin:0px 45rpx;
+	height: 30rpx;
+	line-height: 30rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 20rpx;
+}

BIN
img/loans.png


BIN
img/slider.png


Plik diff jest za duży
+ 46 - 16
pages/evaluate/evaluate.js


+ 65 - 16
pages/evaluate/evaluate.wxml

@@ -153,35 +153,84 @@
   		class="sub_evaluate"
   		bindtap="subEvaluate"
   		>开始估价</view> 
-
-  	<view class="show_evaluate">
-  		<view class="show_evaluate_t">
-  			
-  		</view>
-  		<view class="show_evaluate_dt">
-  			
+<!-- 估价结果 -->
+  	<view 
+  		class="show_evaluate"
+  		style="left:{{showeva?'0rpx':'100%'}}"
+  	>
+	  	<view class="show_evaluate_back">
+  			你的爱车值这个价
+  			<image 
+  			bindtap="evaluateBack"
+  			src="../../img/back.png"/>
   		</view>
+  		<view class="show_evaluate_header"></view>
+	  	<view class="show_evaluate_tb">
+	  		<view class="show_evaluate_t">
+	  			{{series['2'][selectseries['2']].car_model_name}}
+	  		</view>
+	  		<view class="show_evaluate_dt">
+	  			{{data.split("-")[0]}}年{{data.split("-")[1]}}月上牌|{{mileage}}万公里|{{area['1'][areaselect['1']].area_name}}
+	  		</view>
+	  	</view>
   		<view class="show_evaluate_sp">
   			<view class="show_evaluate_type">
-  				<view>车况优秀</view>
-  				<view>车况良好</view>
-  				<view>车况一般</view>
+  				<view 
+  					data-index="0"
+  					bindtap="swatchEva"
+  					class="show_evaluate_tpitem"
+  					>
+  					<view class="show_evaluate_tpn {{currenteva==0?'active':''}}">
+  						车况优秀
+  					</view>
+  				</view>
+  				<view 
+  					data-index="1"
+  					bindtap="swatchEva"
+  					class="show_evaluate_tpitem">
+	  				<view class="show_evaluate_tpn {{currenteva==1?'active':''}}">
+	  					车况良好
+	  				</view>
+	  			</view>
+  				<view 
+  					data-index="2"
+  					bindtap="swatchEva"
+  					class="show_evaluate_tpitem">
+  					<view class="show_evaluate_tpn {{currenteva==2?'active':''}}">
+  						车况一般
+  					</view>
+  				</view>
   			</view>
   			<swiper 
 		      class='show_evaluate_info' 
 		      duration='300' 
 		      bindchange='switchTab'
 		      circular='true'
+		      current="{{currenteva}}"
+		      previous-margin='102rpx'
+		      next-margin='102rpx'
 		    >
 		      <block wx:for="{{detail.eval_prices}}" wx:key="condition">
 		        <swiper-item>
 		          <view class="show_evaluate_detail">
-		          	<view></view>
-		          	<view></view>
-		          	<view>
-		          		<view>
-		          			<view></view>
-		          			<view></view>
+		          	<view class="show_evaluate_pt">估价范围(万元)</view>
+		          	<view class="show_evaluate_pv">{{item.dealer_low_buy_price}}-{{item.dealer_buy_price}}</view>
+		          	<view class="show_evaluate_dl">
+		          		<view class="show_evaluate_dt">
+		          			<view class="show_evaluate_dn">外观</view>
+		          			<text class="show_evaluate_dv">{{describe[index].dis}}</text>
+		          		</view>
+		          		<view class="show_evaluate_dt">
+		          			<view class="show_evaluate_dn">内饰</view>
+		          			<text class="show_evaluate_dv">{{describe[index].int}}</text>
+		          		</view>
+		          		<view class="show_evaluate_dt">
+		          			<view class="show_evaluate_dn">里程</view>
+		          			<text class="show_evaluate_dv">{{describe[index].mil}}</text>
+		          		</view>
+		          		<view class="show_evaluate_dt">
+		          			<view class="show_evaluate_dn">故障维修</view>
+		          			<text class="show_evaluate_dv">{{describe[index].maintain}}</text>
 		          		</view>
 		          	</view>
 		          </view>

+ 135 - 0
pages/evaluate/evaluate.wxss

@@ -61,4 +61,139 @@
 	font-size: 30rpx;
 	text-align: center;
 	font-family: NotoSansHans-DemiLight;
+}
+
+
+/*****估价结果页*****/
+.show_evaluate{
+	position: fixed;
+	top:0rpx;
+	width:100%;
+	height: 100%;
+	background-color:#F9F9F9;
+	overflow: hidden;
+  	z-index:101;
+  	left:100%;
+  	transition: all 0.5s;
+}
+.show_evaluate_back{
+  background-color:#fede18;
+  height:128rpx;
+  position: fixed;
+  top:0rpx;
+  width: 100%;  
+  font-size: 36rpx;
+  line-height: 128rpx;
+  text-align: center;
+}
+.show_evaluate_header{
+	height: 128rpx;
+}
+.show_evaluate_back image{  
+  width:30rpx;
+  height: 30rpx;
+  position: absolute;
+  top:70rpx;
+  left:40rpx;
+}
+.show_evaluate_tb{
+	background-color: white;
+	overflow: hidden;
+	padding-bottom: 20rpx;	
+}
+.show_evaluate_t{
+	line-height: 42rpx;
+	text-align: center;
+	margin:30rpx auto 0rpx;
+	width:578rpx;
+	color:#383735;
+}
+.show_evaluate_dt{
+	color: #878787;
+	margin:10rpx 0rpx 20rpx;
+	height: 28rpx;
+	line-height: 48rpx;
+	font-size: 28rpx;
+	text-align: center;
+	font-family: NotoSansHans-Regular;
+}
+.show_evaluate_sp{
+	background-color: white;
+	margin-top: 20rpx;
+}
+.show_evaluate_type{
+	width:516rpx;
+	display: flex;
+	margin:0rpx auto;
+}
+.show_evaluate_tpitem{
+	flex: 1;	
+}
+.show_evaluate_tpn{
+	width: 120rpx;
+	height: 44rpx;
+	margin:10rpx auto 10rpx;
+	line-height: 44rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 28rpx;
+	text-align: left;
+	font-family: NotoSansHans-Medium;
+	border-bottom: 4rpx solid white;
+}
+.show_evaluate_tpn.active{
+	border-bottom: 4rpx solid #FFE600;
+}
+.show_evaluate_info{
+	margin-top:40rpx;
+}
+.show_evaluate_detail{
+	width:516rpx;
+	height: 260rpx;
+	background-color: #FFE600;
+	border-radius: 12rpx;
+	overflow: hidden;
+	margin:0rpx auto;
+}
+.show_evaluate_pt{
+	height: 30rpx;
+	line-height: 30rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 20rpx;
+	text-align: center;
+	margin-top: 26rpx;
+	font-family: NotoSansHans-DemiLight;
+}
+.show_evaluate_pv{
+	color:#383735;
+	left: 281px;
+	height: 72rpx;
+	line-height: 72rpx;
+	font-size: 48rpx;
+	text-align: center;
+	margin-top: 10rpx;
+	font-family: NotoSansHans-Medium;
+}
+.show_evaluate_dl{
+	display: flex;
+	margin-top: 15rpx;
+}
+.show_evaluate_dt{
+	flex: 1;
+}
+.show_evaluate_dn{
+	height: 30rpx;
+	line-height: 30rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 20rpx;
+	text-align: center;
+	font-family: NotoSansHans-Light;
+}
+.show_evaluate_dv{
+	display: block;
+	line-height: 26rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 20rpx;
+	text-align: center;
+	font-family: NotoSansHans-Medium;
+	font-weight: bold;
 }

+ 7 - 2
pages/loans/loans.js

@@ -1,18 +1,23 @@
 // pages/loans/loans.js
+import { get,post } from "../../common/request.js"
+import stylemap from "../../common/stylemap"
+const app = getApp();
+
+
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-  
+    windowh: app.globalData.windowh
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-  
+    this.setData(stylemap);
   },
 
   /**

+ 18 - 1
pages/loans/loans.wxml

@@ -1,2 +1,19 @@
 <!--pages/loans/loans.wxml-->
-<text>pages/loans/loans.wxml</text>
+<import src="../../module/header.wxml"/>
+<scroll-view 
+  class="conent"
+  style="height:{{windowh}}rpx;"
+  scroll-y="{{selectbar==''?'true':'false'}}"
+  bindscrolltolower="{{hasloadall?'':'getMyBuy'}}"
+>
+	<template 
+		is="header"
+		data="{{title:'我要贷款',headerheight:headerheight,hasback:true}}"
+	/>
+	<view class="page-content">
+		<image src="../../img/loans.png"/>
+	</view>
+	<navigator class="to_loan" url="../myloan/myloan">
+		好一车贷款计算器
+	</navigator>
+</scroll-view>

+ 18 - 1
pages/loans/loans.wxss

@@ -1 +1,18 @@
-/* pages/loans/loans.wxss */
+/* pages/loans/loans.wxss */
+.page-content image{
+	width:100%;
+	height: 834rpx;
+}
+.to_loan{
+	position: fixed;
+	bottom:0rpx;
+	width:750rpx;
+	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;
+	font-family: NotoSansHans-DemiLight;
+}

+ 116 - 0
pages/myloan/myloan.js

@@ -0,0 +1,116 @@
+// pages/myloan/myloan.js
+import { get,post } from "../../common/request.js"
+import pathmap from "../../common/pathmap"
+import stylemap from "../../common/stylemap"
+const app = getApp();
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    windowh: app.globalData.windowh,
+    timetorate:{
+      "12":"rates_a",
+      "24":"rates_b",
+      "36":"rates_c"
+    },
+    price:50,
+    time:12,
+    scale:0
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData(stylemap);
+    this.getRate();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  },
+  getRate:function(){
+    var _self=this;
+    var mobile = wx.getStorageSync("mobile");
+    get(pathmap.rates,{
+      mobile:mobile
+    },function(json){
+      _self.setData(json.data);
+    })
+  },
+  getPrice:function(e){
+    var price = e.detail.value;
+    this.setData({price:price});
+    this.getResult();
+  },
+  getFirstPay:function(e){    
+    var scale = e.detail.value;
+    this.setData({scale:scale});
+    this.getResult();
+  },
+  getTime:function(e){
+    var time = e.detail.value;
+    this.setData({time:time});
+    this.getResult();
+  },
+  getResult:function(){
+    var price = this.data.price*10000;
+    var scale = this.data.scale;
+    var time = this.data.time;
+    var interestrate = this.data[this.data.timetorate[time]]/100;
+    var firstpay = price*scale/10000;
+    var premonthpay = (price-firstpay)*interestrate*(Math.pow((1+interestrate),time))/(Math.pow((1+interestrate),time)-1);
+    this.setData({
+      firstpay:firstpay,
+      premonthpay:Math.round(premonthpay)
+    })
+  }
+})

+ 5 - 0
pages/myloan/myloan.json

@@ -0,0 +1,5 @@
+{
+	"usingComponents":{
+		"carslider":"../../components/carslider/carslider"
+	}
+}

+ 89 - 0
pages/myloan/myloan.wxml

@@ -0,0 +1,89 @@
+<!--pages/loans/loans.wxml-->
+<import src="../../module/header.wxml"/>
+<scroll-view 
+  class="conent"
+  style="height:{{windowh}}rpx;"
+  scroll-y="{{selectbar==''?'true':'false'}}"
+  bindscrolltolower="{{hasloadall?'':'getMyBuy'}}"
+>
+	<template 
+		is="header"
+		data="{{title:'贷款计算器',headerheight:headerheight,hasback:true}}"
+	/>
+	<view class="myloan_con_c">
+		<view class="myloan_con_i">
+			<view class="myloan_con_it">
+				车价<view class="myloan_con_itu">(万)</view>
+			</view>
+			<view class="myloan_con_linec">
+				<carslider
+					min="50"
+					max="260"
+					show-value="true"
+					splitnum="7"
+					unit="万"
+					bind:changeend="getPrice"
+				>
+					
+				</carslider>
+			</view>
+		</view>
+		<view class="myloan_con_i">
+			<view class="myloan_con_it">
+				首付
+			</view>
+			<view class="myloan_con_linec">
+				<carslider
+					min="0"
+					max="60"
+					show-value="true"
+					splitnum="6"
+					unit="%"
+					bind:changeend="getFirstPay"
+				>
+					
+				</carslider>
+			</view>
+		</view>
+		<view class="myloan_con_i">
+			<view class="myloan_con_it">
+				贷款期数
+			</view>
+			<view class="myloan_con_linec">
+				<carslider
+					min="12"
+					max="36"
+					show-value="true"
+					splitnum="2"
+					unit="个月"
+					splitvalue="12"
+					bind:changeend="getTime"
+				>
+					
+				</carslider>
+			</view>
+		</view>
+	</view>
+	<view class="myloan_result">
+		<view class="myloan_result_i">
+			<view>车价</view>
+			<view class="myloan_result_iv">¥{{price}}万</view>
+		</view>
+		<view class="myloan_result_i">
+			<view>首付成数</view>
+			<view class="myloan_result_iv"></view>
+		</view>
+		<view class="myloan_result_i">
+			<view>首付款</view>
+			<view class="myloan_result_iv">{{firstpay}}万</view>
+		</view>
+		<view class="myloan_result_i">
+			<view>月供</view>
+			<view class="myloan_result_iv">{{premonthpay}}元</view>
+		</view>
+		<view class="myloan_result_i">
+			<view>分期</view>
+			<view class="myloan_result_iv">{{time}}期</view>
+		</view>
+	</view>
+</scroll-view>

+ 49 - 0
pages/myloan/myloan.wxss

@@ -0,0 +1,49 @@
+/* pages/myloan/myloan.wxss */
+.myloan_con_c{
+	background-color: #f9f8ee;
+	overflow: hidden;
+	padding-bottom: 170rpx;
+}
+.myloan_con_i{
+	margin-top:40rpx;
+}
+.myloan_con_it{
+	height: 30rpx;
+	line-height: 30rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 30rpx;
+	text-align: left;
+	font-family: NotoSansHans-Medium;	
+}
+.myloan_con_itu{
+	display: inline;	
+	color: #c1c1bc;
+	font-size: 24rpx;
+}
+.myloan_con_linec{
+	margin-top: 23rpx;
+}
+
+.myloan_result{
+	width:454rpx;
+	margin:-110rpx auto 0rpx;
+	background-color: white;
+	padding: 0rpx 100rpx;
+	overflow: hidden;
+}
+.myloan_result_i{
+	height: 36rpx;
+	line-height: 36rpx;
+	margin-top: 40rpx;
+	display: flex;
+	justify-content:space-between;
+	color: rgba(104, 104, 104, 1);
+	font-size: 24rpx;
+	font-family: NotoSansHans-DemiLight;
+
+}
+.myloan_result_iv{
+	color: rgba(191, 163, 104, 1);
+	font-size: 36rpx;
+	font-family: NotoSansHans-Medium;
+}