瀏覽代碼

[修改停车]

tags/富茂链客4.1.0
meo 6 年之前
父節點
當前提交
c8d5f766a2
共有 1 個檔案被更改,包括 89 行新增89 行删除
  1. +89
    -89
      pages/passCar/passCar.js

+ 89
- 89
pages/passCar/passCar.js 查看文件

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


Loading…
取消
儲存