| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- // pages/evaluate/evaluate.js
- import { get,post,upload } from "../../common/request.js"
- import pathmap from "../../common/pathmap"
- import stylemap from "../../common/stylemap"
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- windowh: app.globalData.windowh,
- area:{},
- areaselect:{},
- series:{},
- selectseries:{},
- date:"2018-01-01",
- detail:{"status":"1","default_car_condition":"good","eval_prices":[{"condition":"excellent","dealer_low_buy_price":13.78,"dealer_buy_price":14.44,"individual_low_sold_price":14.97,"individual_price":15.3,"dealer_low_sold_price":15.43,"dealer_price":15.79,"dealer_high_sold_price":16.58},{"condition":"good","dealer_low_buy_price":12.94,"dealer_buy_price":13.56,"individual_low_sold_price":14.06,"individual_price":14.37,"dealer_low_sold_price":14.49,"dealer_price":14.83,"dealer_high_sold_price":15.57},{"condition":"normal","dealer_low_buy_price":12.12,"dealer_buy_price":12.7,"individual_low_sold_price":13.17,"individual_price":13.46,"dealer_low_sold_price":13.57,"dealer_price":13.89,"dealer_high_sold_price":14.59}],"discharge_standard":"\u56fd4","model_price":"27.28","detail_report_url":"https:\/\/www.che300.com\/pinggu\/v1c1m1r2013-10g7.5?from=zxhc&_s=72771012f6c3e623"},
- describe:[{
- dis:"无瑕疵无色差",
- int:"无磨损无异味",
- mil:"4万公里以内",
- maintain:"无事故维修"
- },{
- dis:"无色差个别瑕疵",
- int:"轻微磨损无异味",
- mil:"15万公里以内",
- maintain:"无事故少量维修"
- },{
- dis:"轻微色差少量瑕疵",
- int:"个别严重磨损",
- mil:"20万公里以内",
- maintain:"有碰撞事故少量维修"
- }]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData(stylemap);
- this.getCararea(0,0,0);
- this.getCarSeries(0,0,0);
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- },
- getCararea:function(id,index,sel){
- var _self=this;
- sel = sel||0;
- get(pathmap.cararea,{pid:id},function(json){
- var obj = {},select={};
- obj[index] = json.data;
- select[index] = sel;
- _self.setData({
- area:Object.assign({},_self.data.area,obj),
- areaselect:Object.assign({},_self.data.areaselect,select)
- });
- if(index<1){
- _self.getCararea(obj[index][sel]['area_id'],1+parseInt(index),0);
- }
- })
- },
- changeArea:function(e){
- var index = e.currentTarget.dataset.index;
- var select = e.detail.value;
- var obj = {};
- obj[index]=select;
- this.setData({areaselect:Object.assign(this.data.areaselect,obj)});
- if(index<1){
- this.getCararea(this.data.area[index][select]['area_id'],1+parseInt(index),0);
- }
- },
- // getCarModel:function(){
- // var _self=this;
- // get(pathmap.carmodel,{pid:id},function(json){
- // var obj = {},select={};
- // obj[index] = json.data;
- // select[index] = sel;
- // _self.setData({
- // area:Object.assign({},_self.data.area,obj),
- // select:Object.assign({},_self.data.areaselect,select)
- // });
- // if(index<1){
- // _self.getCararea(obj[index][sel]['area_id'],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;
- this.setData({mileage:mileage});
- },
- bindDateChange: function(e) {
- this.setData({
- date: e.detail.value
- })
- },
- getMobile:function(e){
- var mobile = e.detail.value;
- this.setData({mobile:mobile});
- },
- subEvaluate:function(){
- var _self=this;
- post(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,
- 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){
- var obj = {
- title:json.data.message||"估价成功!"
- }
- if(json.statusCode!=200){
- obj.icon="none"
- }
- wx.showToast(obj);
- })
- }
- })
|