|
@@ -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
|
|
|
+ })
|
|
|
}
|
|
|
})
|