Browse Source

停车初始化

tags/2.2.4
Stormeye.Wu 6 years ago
parent
commit
473fe5633a
1 changed files with 23 additions and 17 deletions
  1. +23
    -17
      pages/passCar/passCar.js

+ 23
- 17
pages/passCar/passCar.js View File

@@ -25,12 +25,26 @@ Page({
}, },
onShow: function(options) { onShow: function(options) {
var that = this; var that = this;
that.initPark();
Http.post({ Http.post({
url: config.api.checkPhoneStatus, url: config.api.checkPhoneStatus,
data: {} data: {}
}) })
.then(res => { .then(res => {
console.log(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 => { .catch(err => {
console.log(err); console.log(err);
@@ -50,20 +64,6 @@ Page({
url: "/pages/phoneinput/phoneinput"}); 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() { showquan: function() {
@@ -321,14 +321,16 @@ Page({
that.setData({ that.setData({
carList: res.data 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() { init: function() {
var that = this; var that = this;


app.parkInitCallback = token => { app.parkInitCallback = token => {
that.initPark();
// 获取 用户车牌
that.initUsrCarList(); that.initUsrCarList();
if (!app.globalData.carLogin) { if (!app.globalData.carLogin) {
// 共同登录 // 共同登录
@@ -344,8 +346,12 @@ Page({
app.globalData.etcpToken = res.data.token; app.globalData.etcpToken = res.data.token;
console.log("etcpToken", app.globalData.etcpToken); console.log("etcpToken", app.globalData.etcpToken);
} }
// 获取 用户车牌
if(that.data.carList.length == 0)
that.initUsrCarList();
// 获取 停车费 // 获取 停车费
that.getStopFee();
if (that.data.carList.length > 0)
that.getStopFee();
}); });
} }
}; };


Loading…
Cancel
Save