|
|
@@ -36,7 +36,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 车牌轮播滑动
|
|
|
|
*/
|
|
|
|
onSlideChangeEnd: function(e) {
|
|
|
|
onSlideChangeEnd: function (e) {
|
|
|
|
var that = this;
|
|
|
|
/**
|
|
|
|
* 获得当前的车牌号码
|
|
|
@@ -48,13 +48,13 @@ Page({ |
|
|
|
/**
|
|
|
|
* 获得停车费用
|
|
|
|
*/
|
|
|
|
if (that.data.scroll && app.globalData.etcpToken) {
|
|
|
|
if (that.data.scroll) {
|
|
|
|
that.getStopFee(listCardNum);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
//停车费用为0
|
|
|
|
paySuccess: function() {
|
|
|
|
paySuccess: function () {
|
|
|
|
wx.showModal({
|
|
|
|
title: '支付成功',
|
|
|
|
content: '请尽快离场',
|
|
|
@@ -62,15 +62,15 @@ Page({ |
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
gotomange: function() {
|
|
|
|
gotomange: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/managelicenseplate/managelicenseplate',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindfail: function(res) {
|
|
|
|
bindfail: function (res) {
|
|
|
|
console.log(res)
|
|
|
|
},
|
|
|
|
gotoetcp: function() {
|
|
|
|
gotoetcp: function () {
|
|
|
|
wx.navigateToMiniProgram({
|
|
|
|
appId: that.data.etcpAppId,
|
|
|
|
extraData: this.data.extraData,
|
|
|
@@ -78,19 +78,19 @@ Page({ |
|
|
|
path: "pages/main/main",
|
|
|
|
})
|
|
|
|
},
|
|
|
|
showquan: function() {
|
|
|
|
showquan: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/passCar/couponList/couponList',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
gotodetail: function(e) {
|
|
|
|
gotodetail: function (e) {
|
|
|
|
wx.showModal({
|
|
|
|
title: '缴费规则',
|
|
|
|
content: e.target.dataset.rule,
|
|
|
|
showCancel: false,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onShow: function(options) {
|
|
|
|
onShow: function (options) {
|
|
|
|
var that = this;
|
|
|
|
that.setData({
|
|
|
|
etcpAppId: extConfig.attr.etcpAppId,
|
|
|
@@ -109,9 +109,7 @@ Page({ |
|
|
|
* 才会进行券和车牌的绑定
|
|
|
|
*/
|
|
|
|
if (wx.getStorageSync("chosed") && that.data.quanid) {
|
|
|
|
if (app.globalData.etcpToken){
|
|
|
|
that.getStopFee(that.data.listCardNum);
|
|
|
|
}
|
|
|
|
that.getStopFee(that.data.listCardNum);
|
|
|
|
that.bindCoupon(that.data.quanid);
|
|
|
|
wx.setStorage({
|
|
|
|
key: 'chosed',
|
|
|
@@ -134,7 +132,7 @@ Page({ |
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad: function(options) {
|
|
|
|
onLoad: function (options) {
|
|
|
|
var that = this;
|
|
|
|
/**
|
|
|
|
* 获得分享小程序的
|
|
|
@@ -142,11 +140,11 @@ Page({ |
|
|
|
* desc
|
|
|
|
*/
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getWeapNote,
|
|
|
|
data: {
|
|
|
|
appId: config.weapp.AppId,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
url: config.api.getWeapNote,
|
|
|
|
data: {
|
|
|
|
appId: config.weapp.AppId,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
let weapNote = JSON.parse(res.data.weapNote);
|
|
|
|
that.setData({
|
|
|
@@ -162,7 +160,7 @@ Page({ |
|
|
|
that.setData({
|
|
|
|
scene: scene
|
|
|
|
});
|
|
|
|
if (app.globalData.token) {} else {
|
|
|
|
if (app.globalData.token) { } else {
|
|
|
|
// app.getLocation();
|
|
|
|
that.userLogin()
|
|
|
|
}
|
|
|
@@ -170,7 +168,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 用户登录
|
|
|
|
*/
|
|
|
|
userLogin: function() {
|
|
|
|
userLogin: function () {
|
|
|
|
var that = this;
|
|
|
|
// 登录
|
|
|
|
wx.login({
|
|
|
@@ -178,7 +176,7 @@ Page({ |
|
|
|
code
|
|
|
|
}) => {
|
|
|
|
wx.getSystemInfo({
|
|
|
|
success: function(res) {
|
|
|
|
success: function (res) {
|
|
|
|
that.setData({
|
|
|
|
systemInfo: JSON.stringify(res)
|
|
|
|
})
|
|
|
@@ -203,9 +201,9 @@ Page({ |
|
|
|
};
|
|
|
|
}
|
|
|
|
Http.post({
|
|
|
|
url: config.api.login,
|
|
|
|
data: usrdata
|
|
|
|
})
|
|
|
|
url: config.api.login,
|
|
|
|
data: usrdata
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
app.globalData.token = res.data.token;
|
|
|
|
Http.setToken(res.data.token);
|
|
|
@@ -218,7 +216,7 @@ Page({ |
|
|
|
data: {}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.then(res => {})
|
|
|
|
.then(res => { })
|
|
|
|
.catch(err => {
|
|
|
|
if (err.code == 11004) {
|
|
|
|
// 用户昵称未授权
|
|
|
@@ -239,28 +237,28 @@ Page({ |
|
|
|
/**
|
|
|
|
* 检查用户是否有车
|
|
|
|
*/
|
|
|
|
checkUserCarStatus: function() {
|
|
|
|
checkUserCarStatus: function () {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.userCarCount,
|
|
|
|
data: {}
|
|
|
|
}).then(res => {
|
|
|
|
if (res.data > 0) {
|
|
|
|
// 用户名下有车
|
|
|
|
app.globalData.phone = res.data.phone;
|
|
|
|
app.globalData.supportCar = true;
|
|
|
|
// 共同登录
|
|
|
|
that.userCarLogin();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(err => {})
|
|
|
|
url: config.api.userCarCount,
|
|
|
|
data: {}
|
|
|
|
}).then(res => {
|
|
|
|
if (res.data > 0) {
|
|
|
|
// 用户名下有车
|
|
|
|
app.globalData.phone = res.data.phone;
|
|
|
|
app.globalData.supportCar = true;
|
|
|
|
// 共同登录
|
|
|
|
that.userCarLogin();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(err => { })
|
|
|
|
},
|
|
|
|
jumpToAdd: function() {
|
|
|
|
jumpToAdd: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/pages/addPark/addPark?flags=managepalte`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
passc: function() {
|
|
|
|
passc: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/ques/ques',
|
|
|
|
})
|
|
|
@@ -270,7 +268,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 券绑定车牌
|
|
|
|
*/
|
|
|
|
bindCoupon: function(quanid) {
|
|
|
|
bindCoupon: function (quanid) {
|
|
|
|
var that = this;
|
|
|
|
/**
|
|
|
|
* etcp
|
|
|
@@ -288,9 +286,9 @@ Page({ |
|
|
|
};
|
|
|
|
var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
|
|
|
|
Http.post({
|
|
|
|
url: config.api.getCarCoupon,
|
|
|
|
data: postCouponData
|
|
|
|
})
|
|
|
|
url: config.api.getCarCoupon,
|
|
|
|
data: postCouponData
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
that.initUsrCarList();
|
|
|
|
})
|
|
|
@@ -307,7 +305,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 选择优惠券
|
|
|
|
*/
|
|
|
|
gotoquan: function() {
|
|
|
|
gotoquan: function () {
|
|
|
|
let that = this;
|
|
|
|
if (that.data.quanid) {
|
|
|
|
wx.navigateTo({
|
|
|
@@ -325,17 +323,17 @@ Page({ |
|
|
|
getList() {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0",
|
|
|
|
data: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 8,
|
|
|
|
couponOrderStatus: 0
|
|
|
|
}
|
|
|
|
}).then(res => {
|
|
|
|
that.setData({
|
|
|
|
couponList: res.data.list
|
|
|
|
});
|
|
|
|
})
|
|
|
|
url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0",
|
|
|
|
data: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 8,
|
|
|
|
couponOrderStatus: 0
|
|
|
|
}
|
|
|
|
}).then(res => {
|
|
|
|
that.setData({
|
|
|
|
couponList: res.data.list
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
@@ -345,7 +343,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 共同登录
|
|
|
|
*/
|
|
|
|
init: function(carNumber) {
|
|
|
|
init: function (carNumber) {
|
|
|
|
var that = this;
|
|
|
|
app.parkInitCallback = token => {
|
|
|
|
that.initPark();
|
|
|
@@ -355,9 +353,9 @@ Page({ |
|
|
|
* 判断是否授权手机号
|
|
|
|
*/
|
|
|
|
Http.get({
|
|
|
|
url: config.api.checkPhoneStatus,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
url: config.api.checkPhoneStatus,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
Http.post({
|
|
|
|
url: config.api.carInit,
|
|
|
@@ -407,7 +405,7 @@ Page({ |
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
bindCar: function(carNum) {
|
|
|
|
bindCar: function (carNum) {
|
|
|
|
var that = this;
|
|
|
|
// ETCP
|
|
|
|
var etcpData = {
|
|
|
@@ -419,9 +417,9 @@ Page({ |
|
|
|
};
|
|
|
|
var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
|
|
|
|
Http.post({
|
|
|
|
url: config.api.bindCar,
|
|
|
|
data: postData
|
|
|
|
})
|
|
|
|
url: config.api.bindCar,
|
|
|
|
data: postData
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
that.setData({
|
|
|
|
addCar: null
|
|
|
@@ -431,7 +429,7 @@ Page({ |
|
|
|
title: "提示",
|
|
|
|
showCancel: false,
|
|
|
|
content: "绑车牌成功!",
|
|
|
|
success: function() {}
|
|
|
|
success: function () { }
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
@@ -439,19 +437,19 @@ Page({ |
|
|
|
title: "提示",
|
|
|
|
showCancel: false,
|
|
|
|
content: error.data.message,
|
|
|
|
success: function() {}
|
|
|
|
success: function () { }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 车场信息获取
|
|
|
|
*/
|
|
|
|
initPark: function() {
|
|
|
|
initPark: function () {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getParkInfo,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
url: config.api.getParkInfo,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
that.setData({
|
|
|
|
park: res.data
|
|
|
@@ -471,11 +469,11 @@ Page({ |
|
|
|
/**
|
|
|
|
* 车场状态获取
|
|
|
|
*/
|
|
|
|
getParkStatus: function() {
|
|
|
|
getParkStatus: function () {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getParkStatus,
|
|
|
|
})
|
|
|
|
url: config.api.getParkStatus,
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
console.log(res)
|
|
|
|
})
|
|
|
@@ -492,30 +490,30 @@ Page({ |
|
|
|
/**
|
|
|
|
* 绑定车获取
|
|
|
|
*/
|
|
|
|
initUsrCarList: function(flag) {
|
|
|
|
initUsrCarList: function (flag) {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getUserCarList,
|
|
|
|
data: {}
|
|
|
|
}).then(res => {
|
|
|
|
url: config.api.getUserCarList,
|
|
|
|
data: {}
|
|
|
|
}).then(res => {
|
|
|
|
that.setData({
|
|
|
|
carList: res.data
|
|
|
|
});
|
|
|
|
/**
|
|
|
|
* flag ==flags
|
|
|
|
* 表示从首页onShow进来的
|
|
|
|
*/
|
|
|
|
if (flag == "flags" && res.data.length > 0) {
|
|
|
|
var listCardNum = res.data[0].carNumber;
|
|
|
|
that.setData({
|
|
|
|
carList: res.data
|
|
|
|
});
|
|
|
|
if (res.data&&res.data.length > 0) {
|
|
|
|
var listCardNum = res.data[0].carNumber;
|
|
|
|
that.setData({
|
|
|
|
listCardNum: listCardNum,
|
|
|
|
current: 0
|
|
|
|
})
|
|
|
|
/**
|
|
|
|
* 获得停车费用
|
|
|
|
*/
|
|
|
|
if (app.globalData.etcpToken){
|
|
|
|
that.getStopFee(listCardNum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
listCardNum: listCardNum
|
|
|
|
})
|
|
|
|
/**
|
|
|
|
* 获得停车费用
|
|
|
|
*/
|
|
|
|
that.getStopFee(listCardNum);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
wx.showToast({
|
|
|
|
title: err.message,
|
|
|
@@ -529,20 +527,20 @@ Page({ |
|
|
|
/**
|
|
|
|
* 获得停车费用修改
|
|
|
|
*/
|
|
|
|
getStopFee: function(carNumber) {
|
|
|
|
getStopFee: function (carNumber) {
|
|
|
|
let that = this;
|
|
|
|
let postData =
|
|
|
|
app.globalData.parkVendor == 1 ? {
|
|
|
|
etcpToken: app.globalData.etcpToken,
|
|
|
|
carNumber: carNumber
|
|
|
|
} : {
|
|
|
|
carNumber: carNumber,
|
|
|
|
outCarId: outCarId
|
|
|
|
};
|
|
|
|
carNumber: carNumber,
|
|
|
|
outCarId: outCarId
|
|
|
|
};
|
|
|
|
Http.post({
|
|
|
|
url: config.api.getCarStopFee,
|
|
|
|
data: postData
|
|
|
|
})
|
|
|
|
url: config.api.getCarStopFee,
|
|
|
|
data: postData
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
console.log(res)
|
|
|
|
var extraDataStr = {
|
|
|
@@ -576,9 +574,12 @@ Page({ |
|
|
|
/**
|
|
|
|
* 下拉刷新
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function(e) {
|
|
|
|
onPullDownRefresh: function (e) {
|
|
|
|
let that = this;
|
|
|
|
that.initUsrCarList("flags");
|
|
|
|
that.setData({
|
|
|
|
current:0
|
|
|
|
})
|
|
|
|
wx.stopPullDownRefresh();
|
|
|
|
}
|
|
|
|
}); |