From 473fe5633ae3b3b4d52d5d8653359a3db4c0abdc Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 13 Sep 2018 06:46:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/passCar/passCar.js | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 0537969..dba521f 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -25,12 +25,26 @@ Page({ }, onShow: function(options) { var that = this; + that.initPark(); Http.post({ url: config.api.checkPhoneStatus, data: {} }) .then(res => { console.log(res); + that.init(); + that.getList(); + if (that.data.addCar) { + // 绑车牌 + if (app.globalData.carLogin) { + that.bindCar(that.data.addCar); + } else { + that.bindCar(that.data.addCar); + } + that.setData({ + addCar: null + }); + } }) .catch(err => { console.log(err); @@ -50,20 +64,6 @@ Page({ url: "/pages/phoneinput/phoneinput"}); } }); - - that.init(); - that.getList(); - if (that.data.addCar) { - // 绑车牌 - if (app.globalData.carLogin) { - that.bindCar(that.data.addCar); - } else { - that.bindCar(that.data.addCar); - } - that.setData({ - addCar: null - }); - } }, //我的停车券的显示与消失 showquan: function() { @@ -321,14 +321,16 @@ Page({ that.setData({ carList: res.data }); - console.log("aaaa" + JSON.stringify(that.data.carList)); + console.log("initUsrCarList",JSON.stringify(that.data.carList)); + if (that.data.carList.length > 0) + that.getStopFee(); }); }, init: function() { var that = this; app.parkInitCallback = token => { - that.initPark(); + // 获取 用户车牌 that.initUsrCarList(); if (!app.globalData.carLogin) { // 共同登录 @@ -344,8 +346,12 @@ Page({ app.globalData.etcpToken = res.data.token; console.log("etcpToken", app.globalData.etcpToken); } + // 获取 用户车牌 + if(that.data.carList.length == 0) + that.initUsrCarList(); // 获取 停车费 - that.getStopFee(); + if (that.data.carList.length > 0) + that.getStopFee(); }); } };