|
|
@@ -29,13 +29,13 @@ Page({ |
|
|
|
duration: 1000,
|
|
|
|
current: 0,
|
|
|
|
stopFees: {},
|
|
|
|
scroll:true,
|
|
|
|
scroll: true,
|
|
|
|
canIUse: wx.canIUse("navigator")
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 车牌轮播滑动
|
|
|
|
*/
|
|
|
|
onSlideChangeEnd: function(e) {
|
|
|
|
onSlideChangeEnd: function (e) {
|
|
|
|
var that = this;
|
|
|
|
/**
|
|
|
|
* 获得当前的车牌号码
|
|
|
@@ -47,44 +47,43 @@ Page({ |
|
|
|
/**
|
|
|
|
* 获得停车费用
|
|
|
|
*/
|
|
|
|
if(that.data.scroll){
|
|
|
|
if (that.data.scroll) {
|
|
|
|
that.getStopFee(listCardNum);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
gotomange: function() {
|
|
|
|
gotomange: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/managelicenseplate/managelicenseplate',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindfail:function(res){
|
|
|
|
bindfail: function (res) {
|
|
|
|
console.log(res)
|
|
|
|
},
|
|
|
|
gotoetcp:function(){
|
|
|
|
gotoetcp: function () {
|
|
|
|
console.log(this.data.passCarAppId)
|
|
|
|
wx.navigateToMiniProgram({
|
|
|
|
appId: that.data.passCarAppId,
|
|
|
|
extraData: this.data.extraData,
|
|
|
|
envVersion:'release',
|
|
|
|
path:"pages/main/main",
|
|
|
|
envVersion: 'release',
|
|
|
|
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;
|
|
|
|
console.log(extConfig);
|
|
|
|
that.setData({
|
|
|
|
passCarPath:extConfig.attr.passCarPath,
|
|
|
|
passCarAppId: extConfig.attr.passCarAppId,
|
|
|
|
etcpversion: extConfig.attr.etcpversion,
|
|
|
|
passCarreturnUrl: extConfig.attr.passCarreturnUrl,
|
|
|
@@ -94,9 +93,9 @@ Page({ |
|
|
|
if (app.globalData.token) {
|
|
|
|
that.getList();
|
|
|
|
that.init();
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
that.init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 只有用户选择了优惠券
|
|
|
|
* 才会进行券和车牌的绑定
|
|
|
@@ -111,7 +110,7 @@ Page({ |
|
|
|
if (app.globalData.token) {
|
|
|
|
that.initUsrCarList();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (that.data.addCar) {
|
|
|
|
// 绑车牌
|
|
|
|
if (app.globalData.carLogin) {
|
|
|
@@ -124,7 +123,7 @@ Page({ |
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad: function(options) {
|
|
|
|
onLoad: function (options) {
|
|
|
|
var that = this;
|
|
|
|
/**
|
|
|
|
* 获得分享小程序的
|
|
|
@@ -132,11 +131,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({
|
|
|
@@ -152,7 +151,7 @@ Page({ |
|
|
|
that.setData({
|
|
|
|
scene: scene
|
|
|
|
});
|
|
|
|
if (app.globalData.token){}else{
|
|
|
|
if (app.globalData.token) { } else {
|
|
|
|
app.getLocation();
|
|
|
|
that.userLogin()
|
|
|
|
}
|
|
|
@@ -217,11 +216,11 @@ Page({ |
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/getuserinfo/index"
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
wx.showModal({
|
|
|
|
title: '提示',
|
|
|
|
content: err.errMsg,
|
|
|
|
showCancel:false
|
|
|
|
showCancel: false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
@@ -245,8 +244,8 @@ Page({ |
|
|
|
that.userCarLogin();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 获取用户信息
|
|
|
@@ -266,12 +265,12 @@ Page({ |
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
jumpToAdd: function() {
|
|
|
|
jumpToAdd: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/pages/addPark/addPark?flags=managepalte`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
passc: function() {
|
|
|
|
passc: function () {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/ques/ques',
|
|
|
|
})
|
|
|
@@ -281,7 +280,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 券绑定车牌
|
|
|
|
*/
|
|
|
|
bindCoupon: function(quanid) {
|
|
|
|
bindCoupon: function (quanid) {
|
|
|
|
var that = this;
|
|
|
|
/**
|
|
|
|
* etcp
|
|
|
@@ -299,9 +298,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();
|
|
|
|
})
|
|
|
@@ -318,7 +317,7 @@ Page({ |
|
|
|
/**
|
|
|
|
* 选择优惠券
|
|
|
|
*/
|
|
|
|
gotoquan: function() {
|
|
|
|
gotoquan: function () {
|
|
|
|
let that = this;
|
|
|
|
if (that.data.quanid) {
|
|
|
|
wx.navigateTo({
|
|
|
@@ -347,16 +346,16 @@ Page({ |
|
|
|
couponList: res.data.list
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 共同登录
|
|
|
|
*/
|
|
|
|
init: function(carNumber) {
|
|
|
|
init: function (carNumber) {
|
|
|
|
var that = this;
|
|
|
|
app.parkInitCallback = token => {
|
|
|
|
that.initPark();
|
|
|
@@ -366,9 +365,9 @@ Page({ |
|
|
|
* 判断是否授权手机号
|
|
|
|
*/
|
|
|
|
Http.post({
|
|
|
|
url: config.api.checkPhoneStatus,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
url: config.api.checkPhoneStatus,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
Http.post({
|
|
|
|
url: config.api.carInit,
|
|
|
@@ -402,7 +401,7 @@ Page({ |
|
|
|
wx.redirectTo({
|
|
|
|
url: "/pages/phoneinput/phoneinput"
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
wx.showToast({
|
|
|
|
title: err.errMsg,
|
|
|
|
icon: 'none',
|
|
|
@@ -457,53 +456,53 @@ Page({ |
|
|
|
/**
|
|
|
|
* 车场信息获取
|
|
|
|
*/
|
|
|
|
initPark: function() {
|
|
|
|
initPark: function () {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getParkInfo,
|
|
|
|
data: {}
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
that.setData({
|
|
|
|
park: res.data
|
|
|
|
.then(res => {
|
|
|
|
that.setData({
|
|
|
|
park: res.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
// wx.showToast({
|
|
|
|
// title: err.message,
|
|
|
|
// icon: 'none',
|
|
|
|
// duration: 2000,
|
|
|
|
// mask: false
|
|
|
|
// });
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
// wx.showToast({
|
|
|
|
// title: err.message,
|
|
|
|
// icon: 'none',
|
|
|
|
// duration: 2000,
|
|
|
|
// mask: false
|
|
|
|
// });
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 车场状态获取
|
|
|
|
*/
|
|
|
|
getParkStatus: function() {
|
|
|
|
getParkStatus: function () {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getParkStatus,
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
console.log(res)
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
// wx.showToast({
|
|
|
|
// title: err.message,
|
|
|
|
// icon:"none"
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
console.log(res)
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
// wx.showToast({
|
|
|
|
// title: err.message,
|
|
|
|
// icon:"none"
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 绑定车获取
|
|
|
|
*/
|
|
|
|
initUsrCarList: function(flag) {
|
|
|
|
initUsrCarList: function (flag) {
|
|
|
|
var that = this;
|
|
|
|
Http.get({
|
|
|
|
url: config.api.getUserCarList,
|
|
|
@@ -527,42 +526,43 @@ Page({ |
|
|
|
that.getStopFee(listCardNum);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
wx.showToast({
|
|
|
|
title: err.message,
|
|
|
|
icon: 'none',
|
|
|
|
duration: 2000,
|
|
|
|
mask: false
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
wx.showToast({
|
|
|
|
title: err.message,
|
|
|
|
icon: 'none',
|
|
|
|
duration: 2000,
|
|
|
|
mask: false
|
|
|
|
});
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获得停车费用修改
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
};
|
|
|
|
console.log(that.data.passCarreturnUrl)
|
|
|
|
console.log("获得停车费用")
|
|
|
|
Http.post({
|
|
|
|
url: config.api.getCarStopFee,
|
|
|
|
data: postData
|
|
|
|
})
|
|
|
|
url: config.api.getCarStopFee,
|
|
|
|
data: postData
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
var extraDataStr = {
|
|
|
|
params: {
|
|
|
|
token: app.globalData.etcpToken,
|
|
|
|
syncId: res.data.orderId,
|
|
|
|
payType: 6, // 小程序支付
|
|
|
|
CarNumber: that.data.passCarreturnUrl,
|
|
|
|
CarNumber: carNumber,
|
|
|
|
returnUrl: passCarreturnUrl,
|
|
|
|
source: "FUMAO-001",
|
|
|
|
actionId: "1" //操作ID,1:小程序支付
|
|
|
|
}
|
|
|
@@ -570,11 +570,11 @@ Page({ |
|
|
|
that.setData({
|
|
|
|
extraData: extraDataStr,
|
|
|
|
stopFees: res.data,
|
|
|
|
timecha: Util.timecha(res.data.exitTime, res.data.entranceTime)
|
|
|
|
timecha: Util.timecha(res.data.exitTime, res.data.entranceTime)
|
|
|
|
});
|
|
|
|
that.setData({
|
|
|
|
scroll:true
|
|
|
|
})
|
|
|
|
scroll: true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.log(error)
|
|
|
@@ -588,17 +588,17 @@ Page({ |
|
|
|
/**
|
|
|
|
* 下拉刷新
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function(e) {
|
|
|
|
onPullDownRefresh: function (e) {
|
|
|
|
let that = this;
|
|
|
|
that.initUsrCarList("flags");
|
|
|
|
wx.stopPullDownRefresh();
|
|
|
|
},
|
|
|
|
// 用户点击右上角分享
|
|
|
|
onShareAppMessage: function() {
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
return {
|
|
|
|
title: this.data.title,
|
|
|
|
desc: this.data.desc,
|
|
|
|
success: function(res) {
|
|
|
|
success: function (res) {
|
|
|
|
wx.showToast({
|
|
|
|
title: "分享成功",
|
|
|
|
duration: 1000,
|
|
|
|