@@ -27,10 +27,6 @@ Page({ | |||||
onLoad(options) { | onLoad(options) { | ||||
let that = this; | let that = this; | ||||
console.log(options); | |||||
console.log("couponChannelId" + options.couponChannelId); | |||||
console.log("couponId" + options.couponId); | |||||
console.log("传的变量的名字叫couponId"); | |||||
wx.showLoading({ | wx.showLoading({ | ||||
title: "加载中..." | title: "加载中..." | ||||
}); | }); | ||||
@@ -98,70 +94,70 @@ Page({ | |||||
/** | /** | ||||
* 拉取车牌列表 | * 拉取车牌列表 | ||||
*/ | */ | ||||
init: function () { | |||||
var that = this | |||||
// init: function () { | |||||
// var that = this | |||||
app.parkInitCallback = token => { | |||||
that.initPark() | |||||
that.initUsrCarList() | |||||
if (!app.globalData.carLogin) { | |||||
// 共同登录 | |||||
Http.post({ | |||||
url: config.api.carInit, | |||||
data: { | |||||
phone: app.globalData.phone | |||||
} | |||||
}).then(res => { | |||||
app.globalData.carLogin = true | |||||
app.globalData.parkVendor = res.data.vendor | |||||
if (res.data.token != "undefined") { | |||||
app.globalData.etcpToken = res.data.token | |||||
console.log("etcpToken", app.globalData.etcpToken) | |||||
} | |||||
// 获取 停车费 | |||||
that.getStopFee() | |||||
}) | |||||
} | |||||
} | |||||
if (app.globalData.token && app.globalData.token != null) { | |||||
app.parkInitCallback(app.globalData.token) | |||||
} | |||||
}, | |||||
getStopFee: function () { | |||||
var that = this | |||||
// carLogin | |||||
for (var i = 0; i < that.data.carList.length; i++) { | |||||
that.getStopFeeItem(that.data.carList[i], i) | |||||
} | |||||
// console.log(JSON.stringify(getStopFeeItem)) | |||||
}, | |||||
initPark: function () { | |||||
var that = this | |||||
// 车场信息获取 | |||||
Http.get({ | |||||
url: config.api.getParkInfo, | |||||
data: {} | |||||
}) | |||||
.then(res => { | |||||
console.log(res) | |||||
that.setData({ | |||||
park: res.data, | |||||
}) | |||||
}) | |||||
}, | |||||
initUsrCarList: function () { | |||||
var that = this | |||||
// 绑定车获取 | |||||
Http.get({ | |||||
url: config.api.getUserCarList, | |||||
data: {} | |||||
}).then(res => { | |||||
console.log('>>>>>>>>>>>>>>>>>1' + JSON.stringify(res)); | |||||
that.setData({ | |||||
carList: res.data | |||||
}) | |||||
}) | |||||
}, | |||||
// app.parkInitCallback = token => { | |||||
// that.initPark() | |||||
// that.initUsrCarList() | |||||
// if (!app.globalData.carLogin) { | |||||
// // 共同登录 | |||||
// Http.post({ | |||||
// url: config.api.carInit, | |||||
// data: { | |||||
// phone: app.globalData.phone | |||||
// } | |||||
// }).then(res => { | |||||
// app.globalData.carLogin = true | |||||
// app.globalData.parkVendor = res.data.vendor | |||||
// if (res.data.token != "undefined") { | |||||
// app.globalData.etcpToken = res.data.token | |||||
// console.log("etcpToken", app.globalData.etcpToken) | |||||
// } | |||||
// // 获取 停车费 | |||||
// that.getStopFee() | |||||
// }) | |||||
// } | |||||
// } | |||||
// if (app.globalData.token && app.globalData.token != null) { | |||||
// app.parkInitCallback(app.globalData.token) | |||||
// } | |||||
// }, | |||||
// getStopFee: function () { | |||||
// var that = this | |||||
// // carLogin | |||||
// for (var i = 0; i < that.data.carList.length; i++) { | |||||
// that.getStopFeeItem(that.data.carList[i], i) | |||||
// } | |||||
// // console.log(JSON.stringify(getStopFeeItem)) | |||||
// }, | |||||
// initPark: function () { | |||||
// var that = this | |||||
// // 车场信息获取 | |||||
// Http.get({ | |||||
// url: config.api.getParkInfo, | |||||
// data: {} | |||||
// }) | |||||
// .then(res => { | |||||
// console.log(res) | |||||
// that.setData({ | |||||
// park: res.data, | |||||
// }) | |||||
// }) | |||||
// }, | |||||
// initUsrCarList: function () { | |||||
// var that = this | |||||
// // 绑定车获取 | |||||
// Http.get({ | |||||
// url: config.api.getUserCarList, | |||||
// data: {} | |||||
// }).then(res => { | |||||
// console.log('>>>>>>>>>>>>>>>>>1' + JSON.stringify(res)); | |||||
// that.setData({ | |||||
// carList: res.data | |||||
// }) | |||||
// }) | |||||
// }, | |||||
/** | /** | ||||
* 发起支付 | * 发起支付 | ||||
*/ | */ | ||||
@@ -170,12 +166,7 @@ Page({ | |||||
wx.showLoading({ | wx.showLoading({ | ||||
title: "加载中..." | title: "加载中..." | ||||
}); | }); | ||||
if (that.data.data.type == 6) { | |||||
this.initUsrCarList() | |||||
// 领取 5.停车券 | |||||
// TODO 选取用户下的车牌 | |||||
} else { | |||||
if (that.data.data.type == 6) {} else { | |||||
Http.post({ | Http.post({ | ||||
url: config.api.checkPhoneStatus, | url: config.api.checkPhoneStatus, | ||||
data: {} | data: {} | ||||
@@ -7,14 +7,16 @@ Page({ | |||||
couponChannelId: "", | couponChannelId: "", | ||||
couponId: "" | couponId: "" | ||||
}, | }, | ||||
onLoad: function(options) { | |||||
onLoad: function (options) { | |||||
var that = this; | var that = this; | ||||
console.log(options); | console.log(options); | ||||
that.setData({ | |||||
couponChannelId: options.couponChannelId, | |||||
couponId: options.couponId | |||||
}); | |||||
if (options.couponChannelId && options.couponId) { | |||||
that.setData({ | |||||
couponChannelId: options.couponChannelId, | |||||
couponId: options.couponId | |||||
}); | |||||
} | |||||
Http.get({ | Http.get({ | ||||
url: config.api.marketicon, | url: config.api.marketicon, | ||||
@@ -31,8 +33,8 @@ Page({ | |||||
}) | }) | ||||
}); | }); | ||||
}, | }, | ||||
getPhoneNumber: function(e) { | |||||
getPhoneNumber: function (e) { | |||||
var that = this; | var that = this; | ||||
var iv = e.detail.iv; | var iv = e.detail.iv; | ||||
var encryptedData = e.detail.encryptedData; | var encryptedData = e.detail.encryptedData; | ||||
@@ -43,7 +45,7 @@ Page({ | |||||
iv: iv | iv: iv | ||||
} | } | ||||
}).then( | }).then( | ||||
function(res) { | |||||
function (res) { | |||||
console.log(res); | console.log(res); | ||||
console.log("这是用户授权手机号的结果"); | console.log("这是用户授权手机号的结果"); | ||||
console.log(that.data.couponChannelId); | console.log(that.data.couponChannelId); | ||||
@@ -53,18 +55,24 @@ Page({ | |||||
wx.showToast({ | wx.showToast({ | ||||
title: res.data.msg, | title: res.data.msg, | ||||
icon: "success", | icon: "success", | ||||
success: function(res) { | |||||
wx.redirectTo({ | |||||
url: "/pages/coupon/detail/index?couponChannelId=" + | |||||
that.data.couponChannelId + | |||||
"&couponId=" + | |||||
that.data.couponId + | |||||
"&flag=pay" | |||||
}); | |||||
success: function (res) { | |||||
if (that.data.couponChannelId && that.data.couponId) { | |||||
wx.redirectTo({ | |||||
url: "/pages/coupon/detail/index?couponChannelId=" + | |||||
that.data.couponChannelId + | |||||
"&couponId=" + | |||||
that.data.couponId + | |||||
"&flag=pay" | |||||
}) | |||||
} else { | |||||
wx.switchTab({ | |||||
url: '/pages/passCar/passCar', | |||||
}) | |||||
} | |||||
} | } | ||||
}); | }); | ||||
}, | }, | ||||
function(error) { | |||||
function (error) { | |||||
wx.showToast({ | wx.showToast({ | ||||
title: "请重新授权手机号", | title: "请重新授权手机号", | ||||
icon: "none" | icon: "none" | ||||
@@ -255,7 +255,6 @@ page { | |||||
.btn001 { | .btn001 { | ||||
margin: 0 auto; | margin: 0 auto; | ||||
width: 120rpx; | |||||
height: 180rpx; | height: 180rpx; | ||||
line-height: 180rpx; | line-height: 180rpx; | ||||
font-size: 32rpx; | font-size: 32rpx; | ||||
@@ -1,7 +1,7 @@ | |||||
// pages/passCar/passCar.js | |||||
let config = require("../../config/config.js"); | let config = require("../../config/config.js"); | ||||
let Http = require("../../utils/HttpBasics"); | let Http = require("../../utils/HttpBasics"); | ||||
const app = getApp(); | |||||
let Util = require("../../utils/util"); | |||||
let app = getApp(); | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
park: null, | park: null, | ||||
@@ -18,41 +18,39 @@ Page({ | |||||
interval: 5000, | interval: 5000, | ||||
duration: 1000, | duration: 1000, | ||||
current: 0, | current: 0, | ||||
list: [] | |||||
stopFees: {}, | |||||
}, | }, | ||||
/** | /** | ||||
* 轮播图 | |||||
* 车牌轮播滑动 | |||||
*/ | */ | ||||
onSlideChangeEnd: function(e) { | |||||
onSlideChangeEnd: function (e) { | |||||
var that = this; | var that = this; | ||||
console.log(e); | |||||
console.log(e.detail.current); | |||||
var listCardNum = (that.data.list)[e.detail.current].memberKeyword; | |||||
/** | |||||
* 获得当前的车牌号码 | |||||
*/ | |||||
var listCardNum = (that.data.carList)[e.detail.current].carNumber; | |||||
console.log(listCardNum); | console.log(listCardNum); | ||||
that.setData({ | that.setData({ | ||||
listCardNum: listCardNum | listCardNum: listCardNum | ||||
}) | |||||
console.log(that.data.listCardNum); | |||||
}); | |||||
/** | |||||
* 获得停车费用 | |||||
*/ | |||||
that.getStopFee(listCardNum); | |||||
}, | }, | ||||
gotomange: function() { | |||||
gotomange: function () { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/managelicenseplate/managelicenseplate', | url: '/pages/managelicenseplate/managelicenseplate', | ||||
}) | }) | ||||
}, | }, | ||||
/*车牌动态样式 */ | |||||
changeStyle: function() { | |||||
var height = this.data.dataHeight == "150rpx" ? "80rpx" : "150rpx"; | |||||
var lineHeight = this.data.dataHeight == "150rpx" ? "80rpx" : "150rpx"; | |||||
var fontWeight = this.data.fontWeight == "600" ? "500" : "600"; | |||||
this.setData({ | |||||
dataHeight: height, | |||||
dataLineHeight: lineHeight, | |||||
dataFontWeight: fontWeight | |||||
}); | |||||
}, | |||||
onLoad: function(options) { | |||||
onLoad: function (options) { | |||||
var that = this; | var that = this; | ||||
that.getList(); | |||||
/** | |||||
* 获得分享小程序的 | |||||
* title | |||||
* desc | |||||
*/ | |||||
Http.get({ | Http.get({ | ||||
url: config.api.getWeapNote, | url: config.api.getWeapNote, | ||||
data: { | data: { | ||||
@@ -60,108 +58,69 @@ Page({ | |||||
} | } | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
console.log(res.data.weapNote); | |||||
let weapNote = JSON.parse(res.data.weapNote); | let weapNote = JSON.parse(res.data.weapNote); | ||||
console.log(weapNote.carpage); | |||||
that.setData({ | that.setData({ | ||||
desc: weapNote.carpage.desc, | desc: weapNote.carpage.desc, | ||||
title: weapNote.carpage.title | title: weapNote.carpage.title | ||||
}) | }) | ||||
}) | |||||
}, | |||||
onShow: function(options) { | |||||
var that = this; | |||||
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() { | |||||
let that = this; | |||||
if (that.data.tcq == 1) { | |||||
that.setData({ | |||||
tcq: 2 | |||||
}); | |||||
} else if (that.data.tcq == 2) { | |||||
that.setData({ | |||||
tcq: 1 | |||||
}); | }); | ||||
} | |||||
}, | }, | ||||
jumpToAdd: function() { | |||||
jumpToAdd: function () { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: "/pages/addPark/addPark" | url: "/pages/addPark/addPark" | ||||
}); | }); | ||||
}, | }, | ||||
passc: function() { | |||||
passc: function () { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/ques/ques', | url: '/pages/ques/ques', | ||||
}) | }) | ||||
}, | }, | ||||
//券绑定车牌 | //券绑定车牌 | ||||
bindCoupon: function(e) { | |||||
bindCoupon: function (e) { | |||||
console.log(e); | |||||
var that = this; | var that = this; | ||||
wx.showLoading({ | wx.showLoading({ | ||||
title: '加载中...', | title: '加载中...', | ||||
}); | }); | ||||
if (that.data.couponList.length > 0) { | if (that.data.couponList.length > 0) { | ||||
/** | /** | ||||
* 如果1 已经绑定 | |||||
* 0 没有绑定 | |||||
* etcp | |||||
*/ | */ | ||||
for (let car of that.data.carList) { | |||||
if (car.stopFee.parkingFee) { | |||||
that.data.payList.push(car); | |||||
} | |||||
} | |||||
var etcpData = { | var etcpData = { | ||||
etcpToken: app.globalData.etcpToken, | etcpToken: app.globalData.etcpToken, | ||||
carNumber: that.data.payList[0].carNumber ? | |||||
that.data.payList[0].carNumber : | |||||
"", | |||||
carNumber: that.data.listCardNum, | |||||
/** | |||||
* 待解决 | |||||
*/ | |||||
couponOrderId: that.data.couponList[0].id | couponOrderId: that.data.couponList[0].id | ||||
}; | }; | ||||
console.log(etcpData); | console.log(etcpData); | ||||
// 停简单 | |||||
/** | |||||
* 停简单 | |||||
*/ | |||||
var tjdData = { | var tjdData = { | ||||
carNumber: that.data.payList[0].carNumber | |||||
carNumber: that.data.listCardNum | |||||
}; | }; | ||||
var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; | var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; | ||||
Http.post({ | Http.post({ | ||||
url: config.api.getCarCoupon, | url: config.api.getCarCoupon, | ||||
data: postCouponData | data: postCouponData | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
that.setData({ | |||||
flag: "1" | |||||
}); | |||||
that.initUsrCarList(); | that.initUsrCarList(); | ||||
console.log("loading") | |||||
wx.hideLoading(); | wx.hideLoading(); | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
console.log(error); | console.log(error); | ||||
if (error.code == 2056) { | |||||
that.setData({ | |||||
flags: "alreadybind" | |||||
}); | |||||
} | |||||
}); | |||||
}) | |||||
} else { | } else { | ||||
console.log("没有停车券可以绑定") | |||||
wx.hideLoading(); | wx.hideLoading(); | ||||
that.setData({ | |||||
flags: "alreadybind" | |||||
}); | |||||
} | } | ||||
}, | }, | ||||
@@ -176,17 +135,24 @@ Page({ | |||||
couponOrderStatus: 0 | couponOrderStatus: 0 | ||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
that.init(); | |||||
console.log(res); | |||||
that.setData({ | that.setData({ | ||||
couponList: res.data.list | couponList: res.data.list | ||||
}); | }); | ||||
setTimeout(function() { | |||||
wx.hideLoading(); | |||||
}, 1200); | |||||
}); | }); | ||||
}, | }, | ||||
bindCar: function(carNum) { | |||||
onShow: function (options) { | |||||
var that = this; | |||||
that.getList(); | |||||
that.init(); | |||||
}, | |||||
/** | |||||
* 绑定车牌 | |||||
*/ | |||||
bindCar: function (carNum) { | |||||
var that = this; | var that = this; | ||||
// ETCP | // ETCP | ||||
var etcpData = { | var etcpData = { | ||||
@@ -203,15 +169,12 @@ Page({ | |||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
console.log(res); | console.log(res); | ||||
that.setData({ | |||||
addCar: null | |||||
}); | |||||
that.initUsrCarList(); | |||||
// that.initUsrCarList(); | |||||
wx.showModal({ | wx.showModal({ | ||||
title: "提示", | title: "提示", | ||||
showCancel: false, | showCancel: false, | ||||
content: "绑车牌成功!", | content: "绑车牌成功!", | ||||
success: function() {} | |||||
success: function () {} | |||||
}); | }); | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
@@ -219,69 +182,77 @@ Page({ | |||||
wx.showModal({ | wx.showModal({ | ||||
title: "提示", | title: "提示", | ||||
showCancel: false, | showCancel: false, | ||||
content: error.data.message, | |||||
success: function() {} | |||||
content: error.message, | |||||
success: function () {} | |||||
}); | }); | ||||
}); | }); | ||||
}, | }, | ||||
// unbindCar: function(carNum) { | |||||
// var that = this; | |||||
// var postData = | |||||
// app.globalData.parkVendor == 1 | |||||
// ? { | |||||
// etcpToken: app.globalData.etcpToken, | |||||
// carNumber: carNum | |||||
// } | |||||
// : { | |||||
// carNumber: carNum | |||||
// }; | |||||
// Http.post({ | |||||
// url: config.api.unbindCar, | |||||
// data: postData | |||||
// }) | |||||
// .then(res => { | |||||
// console.log(res); | |||||
// that.initUsrCarList(); | |||||
// wx.showModal({ | |||||
// title: "提示", | |||||
// showCancel: false, | |||||
// content: "解绑车牌成功!", | |||||
// success: function() {} | |||||
// }); | |||||
// }) | |||||
// .catch(error => { | |||||
// wx.showModal({ | |||||
// title: "提示", | |||||
// showCancel: false, | |||||
// content: "解绑车牌失败!", | |||||
// success: function() {} | |||||
// }); | |||||
// }); | |||||
// }, | |||||
// unbindCarBtn: function(e) { | |||||
// console.log(e); | |||||
// var that = this; | |||||
// var carNum = e.currentTarget.dataset.car; | |||||
// that.unbindCar(carNum); | |||||
// }, | |||||
getStopFeeItem: function(carItem, i) { | |||||
/** | |||||
* 车场信息获取 | |||||
*/ | |||||
initPark: function () { | |||||
var that = this; | |||||
Http.get({ | |||||
url: config.api.getParkInfo, | |||||
data: {} | |||||
}).then(res => { | |||||
that.setData({ | |||||
park: res.data | |||||
}); | |||||
}); | |||||
}, | |||||
/** | |||||
* 绑定车获取 | |||||
*/ | |||||
initUsrCarList: function (flag) { | |||||
console.log(flag); | |||||
var that = this; | |||||
Http.get({ | |||||
url: config.api.getUserCarList, | |||||
data: {} | |||||
}).then(res => { | |||||
console.log(res) | |||||
that.setData({ | |||||
carList: res.data | |||||
}); | |||||
/** | |||||
* flag ==flags | |||||
* 表示从首页onShow进来的 | |||||
*/ | |||||
if (flag == "flags") { | |||||
var listCardNum = res.data[0].carNumber; | |||||
console.log(listCardNum); | |||||
that.setData({ | |||||
listCardNum: listCardNum | |||||
}) | |||||
/** | |||||
* 获得停车费用 | |||||
*/ | |||||
that.getStopFee(listCardNum); | |||||
} | |||||
}) | |||||
}, | |||||
/** | |||||
* 获得停车费用修改 | |||||
*/ | |||||
getStopFee: function (carNumber) { | |||||
var that = this; | var that = this; | ||||
var postData = | var postData = | ||||
app.globalData.parkVendor == 1 ? | |||||
{ | |||||
app.globalData.parkVendor == 1 ? { | |||||
etcpToken: app.globalData.etcpToken, | etcpToken: app.globalData.etcpToken, | ||||
carNumber: carItem.carNumber | |||||
} : | |||||
{ | |||||
carNumber: carItem.carNumber, | |||||
outCarId: carItem.outCarId | |||||
carNumber: carNumber | |||||
} : { | |||||
carNumber: carNumber, | |||||
outCarId: outCarId | |||||
}; | }; | ||||
var stopFee = "carList[" + i + "].stopFee"; | |||||
var extraData = "carList[" + i + "].extraData"; | |||||
console.log(extraData); | |||||
var extraDataStr = { | var extraDataStr = { | ||||
params: { | params: { | ||||
CarNumber: carItem.carNumber | |||||
CarNumber: carNumber | |||||
} | } | ||||
}; | }; | ||||
that.setData({ | that.setData({ | ||||
@@ -292,86 +263,100 @@ Page({ | |||||
data: postData | data: postData | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
/** | |||||
* 停车费用 | |||||
*/ | |||||
that.setData({ | that.setData({ | ||||
[stopFee]: res.data, | |||||
[extraData]: extraDataStr, | |||||
buttonBox: res.data.parkingFee | |||||
}) | |||||
stopFees: res.data | |||||
}) | |||||
that.setData({ | |||||
timecha: Util.timecha(res.data.exitTime, res.data.entranceTime) | |||||
}) | |||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
console.log(error); | console.log(error); | ||||
wx.showModal({ | |||||
title: '提示', | |||||
content: error.message, | |||||
showCancel: false | |||||
}) | |||||
that.setData({ | |||||
stopFees: {} | |||||
}) | |||||
}); | }); | ||||
}, | }, | ||||
getStopFee: function() { | |||||
var that = this; | |||||
// carLogin | |||||
for (var i = 0; i < that.data.carList.length; i++) { | |||||
that.getStopFeeItem(that.data.carList[i], i); | |||||
} | |||||
}, | |||||
initPark: function() { | |||||
var that = this; | |||||
// 车场信息获取 | |||||
Http.get({ | |||||
url: config.api.getParkInfo, | |||||
data: {} | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | |||||
park: res.data | |||||
}); | |||||
}); | |||||
}, | |||||
initUsrCarList: function() { | |||||
var that = this; | |||||
// 绑定车获取 | |||||
Http.get({ | |||||
url: config.api.getUserCarList, | |||||
data: {} | |||||
}).then(res => { | |||||
that.setData({ | |||||
carList: res.data | |||||
}); | |||||
}); | |||||
}, | |||||
init: function() { | |||||
/** | |||||
* 共同登录 | |||||
*/ | |||||
init: function (carNumber) { | |||||
var that = this; | var that = this; | ||||
app.parkInitCallback = token => { | app.parkInitCallback = token => { | ||||
that.initPark(); | that.initPark(); | ||||
that.initUsrCarList(); | |||||
if (!app.globalData.carLogin) { | if (!app.globalData.carLogin) { | ||||
// 共同登录 | |||||
/** | |||||
* 判断是否授权手机号 | |||||
*/ | |||||
Http.post({ | Http.post({ | ||||
url: config.api.carInit, | |||||
data: { | |||||
phone: app.globalData.phone | |||||
} | |||||
}).then(res => { | |||||
app.globalData.carLogin = true; | |||||
app.globalData.parkVendor = res.data.vendor; | |||||
if (res.data.token != "undefined") { | |||||
app.globalData.etcpToken = res.data.token; | |||||
console.log("etcpToken", app.globalData.etcpToken); | |||||
} | |||||
// 获取 停车费 | |||||
that.getStopFee(); | |||||
}); | |||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
.then(res => { | |||||
console.log(res); | |||||
Http.post({ | |||||
url: config.api.carInit, | |||||
data: { | |||||
phone: app.globalData.phone | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
app.globalData.carLogin = true; | |||||
app.globalData.parkVendor = res.data.vendor; | |||||
if (res.data.token) { | |||||
app.globalData.etcpToken = res.data.token; | |||||
} | |||||
/** | |||||
* 获得停车费用 | |||||
*/ | |||||
that.initUsrCarList("flags"); | |||||
console.log(app.globalData.etcpToken); | |||||
}); | |||||
}) | |||||
.catch(err => { | |||||
console.log(err); | |||||
if (err.code == 11005) { | |||||
// 用户手机未授权 | |||||
/** | |||||
* 将值传到用户手机号授权的页面 | |||||
* | |||||
*/ | |||||
wx.redirectTo({ | |||||
url: "/pages/getphoneInfo/index" | |||||
}); | |||||
} else if (err.code == 11006) { | |||||
// 用户手机已加密 | |||||
wx.redirectTo({ | |||||
url: "/pages/phoneinput/phoneinput" | |||||
}); | |||||
} | |||||
}) | |||||
} | } | ||||
}; | }; | ||||
if (app.globalData.token && app.globalData.token != null) { | if (app.globalData.token && app.globalData.token != null) { | ||||
app.parkInitCallback(app.globalData.token); | app.parkInitCallback(app.globalData.token); | ||||
} | } | ||||
}, | }, | ||||
/** | |||||
* 下拉刷新 | |||||
*/ | |||||
onPullDownRefresh: function(e) { | |||||
let that = this; | |||||
that.initUsrCarList("flags"); | |||||
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, | ||||
@@ -1,5 +1,6 @@ | |||||
{ | { | ||||
"component": true, | "component": true, | ||||
"usingComponents": {}, | "usingComponents": {}, | ||||
"navigationBarTitleText": "停车" | |||||
"navigationBarTitleText": "停车", | |||||
"enablePullDownRefresh": true | |||||
} | } |
@@ -1,35 +1,27 @@ | |||||
<view class='container'> | <view class='container'> | ||||
<view class='carmanage clearfix'> | |||||
<view class='fl'> | |||||
<image src='./../../assets/img/che.png' mode='widthFix'></image> | |||||
<text class='mycar'>我的爱车</text> | |||||
<text class='num'>最多可添加3辆</text> | |||||
</view> | |||||
<view class='fr' bindtap='gotomange'> | |||||
车辆管理 | |||||
<image src='./../../assets/img/jian.png' mode='widthFix'></image> | |||||
</view> | |||||
</view> | |||||
<view class='headBox'> | |||||
<view class='numberBox'> | |||||
<view class='titleName clearfix'>{{park.addr}}</view> | |||||
<view class='price clearfix'> | |||||
<text class='fl'>总车位:</text> | |||||
<label class='locationNumber fr'>{{park.number}}个</label> | |||||
<view class='top'> | |||||
<view class='carmanage clearfix'> | |||||
<view class='fl'> | |||||
<text class='mycar'>{{park.addr}}</text> | |||||
</view> | </view> | ||||
<view class='price clearfix'> | |||||
<text class='fl'>停车费:</text> | |||||
<label class='locationNumber fr'>{{park.stopFee}}</label> | |||||
<view class='fr' bindtap='gotomange'> | |||||
总车位:{{park.number}}个 | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class='price clearfix'> | |||||
<text class='fl'>停车费:</text> | |||||
<label class='locationNumber fr'>{{park.stopFee}}</label> | |||||
</view> | |||||
</view> | </view> | ||||
<view class='borderBox'> | <view class='borderBox'> | ||||
<view class='passNumberBox' wx:for='{{carList}}' wx:key='{{index}}'> | |||||
<view class='passNumberBox'> | |||||
<!-- 有车牌的时候显示 --> | <!-- 有车牌的时候显示 --> | ||||
<view class='passUp'> | <view class='passUp'> | ||||
<view class='addicense_active'> | |||||
<swiper current="{{current}}" bindchange='onSlideChangeEnd' class='swiper' circular='true' indicator-dots='{{indicatorDots}}' autoplay='{{autoplay}}' interval='2000' duration='2000'> | |||||
<block wx:for="{{carList}}" wx:key="unique"> | |||||
<view class='addicense_active' wx:if='{{carList.length>0}}'> | |||||
<swiper current="{{current}}" bindchange='onSlideChangeEnd' class='swiper' circular='true' indicator-dots='{{indicatorDots}}' | |||||
autoplay='{{autoplay}}' interval='500' duration='500'> | |||||
<block wx:for='{{carList}}' wx:key="unique"> | |||||
<swiper-item class="swiper-item" data-memberKeyword='{{item.carNumber}}'> | <swiper-item class="swiper-item" data-memberKeyword='{{item.carNumber}}'> | ||||
<view class='clearfix clearfix1'> | <view class='clearfix clearfix1'> | ||||
<text class='txt01'>{{item.carNumber}}</text> | <text class='txt01'>{{item.carNumber}}</text> | ||||
@@ -37,42 +29,47 @@ | |||||
</swiper-item> | </swiper-item> | ||||
</block> | </block> | ||||
</swiper> | </swiper> | ||||
<view class="dots"> | |||||
<!-- <view class="dots"> | |||||
<block wx:for="{{carList}}" wx:key="unique"> | <block wx:for="{{carList}}" wx:key="unique"> | ||||
<view class="dot{{index == current ? ' active' : ''}}"></view> | <view class="dot{{index == current ? ' active' : ''}}"></view> | ||||
</block> | </block> | ||||
</view> | |||||
</view> --> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<!-- <view class='orderBox clearfix' wx:if='{{item.stopFee.parkingFee}}'> --> | |||||
<view class='orderBox' wx:key="{{index}}" wx:for="{{carList}}" wx:if="{{carList.length>0&&3>=carList.length}}"> | |||||
<view class='orderBox' wx:if="{{stopFees.remainingFee&&carList.length>0&&3>=carList.length}}"> | |||||
<view class='clearfix'> | <view class='clearfix'> | ||||
<text class="fl">入场时间:</text> | <text class="fl">入场时间:</text> | ||||
<text class='fr time'>{{item.stopFee.entranceTime}}</text> | |||||
<text class='fr time'>{{stopFees.entranceTime}}</text> | |||||
</view> | </view> | ||||
<view class='coupon clearfix'> | |||||
<text class='fl'><text class='jians'>惠</text>优免券:</text> | |||||
<view class='clearfix'> | |||||
<text class="fl">停车时长:</text> | |||||
<text class='fr time'>{{timecha}}</text> | |||||
</view> | |||||
<view class='coupon clearfix' wx:if="{{couponList.length>0}}"> | |||||
<text class='fl'><text class='jians'>券</text>优惠券:</text> | |||||
<text class='fr'>2小时优免券</text> | <text class='fr'>2小时优免券</text> | ||||
</view> | </view> | ||||
<view class="clearfix"> | <view class="clearfix"> | ||||
<text class="fl">待缴费用:</text> | <text class="fl">待缴费用:</text> | ||||
<text class='fr'>{{item.stopFee.parkingFee}}<text class='yuan'>元</text></text> | |||||
<text class='fr'>{{stopFees.remainingFee}}<text class='yuan'>元</text></text> | |||||
</view> | </view> | ||||
<view bindtap='bindCoupon' class="buy-view" wx:if="{{buttonBox&&carList.length>0&&3>=carList.length}}"> | |||||
<navigator class='buyBox' target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" path="" extra-data='{{extraData}}' version="release"> | |||||
<view bindtap='bindCoupon' class="buy-view" wx:if="{{stopFees.remainingFee&&carList.length>0&&3>=carList.length}}"> | |||||
<navigator class='buyBox' target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" path="" | |||||
extra-data='{{extraData}}' version="release"> | |||||
</navigator> | </navigator> | ||||
<button class='buy' hover-class='active'>立即支付</button> | <button class='buy' hover-class='active'>立即支付</button> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<!-- 没有车牌的时候显示 --> | <!-- 没有车牌的时候显示 --> | ||||
<view class='borderUp' bindtap='jumpToAdd' wx:if="{{carList.length==0}}"> | <view class='borderUp' bindtap='jumpToAdd' wx:if="{{carList.length==0}}"> | ||||
<view class="myCars"> | <view class="myCars"> | ||||
<image src='./../../assets/img/add.png' mode="widthFix"></image>我的爱车</view> | |||||
<image src='./../../assets/img/add.png' mode="widthFix"></image>我的爱车 | |||||
</view> | |||||
<text class='carNumber'>车辆入场后,才能绑车牌</text> | <text class='carNumber'>车辆入场后,才能绑车牌</text> | ||||
</view> | </view> | ||||
<view class='bottonBox'> | <view class='bottonBox'> | ||||
@@ -86,6 +83,14 @@ | |||||
</view> | </view> | ||||
</navigator> | </navigator> | ||||
<view class='textStyle' bindtap='gotomange'> | |||||
<image src='../../assets/img/che.png'></image> | |||||
车辆管理 | |||||
<view class='detail'> | |||||
<image src='../../assets/img/jian.png'></image> | |||||
</view> | |||||
</view> | |||||
<view class='textStyle' bindtap='passc'> | <view class='textStyle' bindtap='passc'> | ||||
<image src='../../assets/img/wenti.png'></image> | <image src='../../assets/img/wenti.png'></image> | ||||
常见问题 | 常见问题 | ||||
@@ -93,9 +98,10 @@ | |||||
<image src='../../assets/img/jian.png'></image> | <image src='../../assets/img/jian.png'></image> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class='passNumberBox' wx:for='{{couponList}}' wx:key='{{index}}'> | |||||
<view class='voucher' wx:if="!{{tcq==1}}"> | |||||
<!-- <view class='passNumberBox' wx:for='{{couponList}}' wx:key='{{index}}'> | |||||
<view class='voucher' wx:if="!{{tcq==1}}"> | |||||
<text class='textV1 textV3'>{{item.title}}</text> | <text class='textV1 textV3'>{{item.title}}</text> | ||||
<text class='textV2'>{{item.merchantName}}</text> | <text class='textV2'>{{item.merchantName}}</text> | ||||
<text class='textV1'>{{'- '+item.price/100+'小时'}}</text> | <text class='textV1'>{{'- '+item.price/100+'小时'}}</text> | ||||
@@ -103,10 +109,5 @@ | |||||
<image src='../../assets/img/choiced.png'></image> | <image src='../../assets/img/choiced.png'></image> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | |||||
<!-- <view bindtap='bindCoupon' class="buy-view app-border-top" wx:if="{{buttonBox}}"> | |||||
<navigator wx:if="{{flag==1||flags=='alreadybind'}}" class='buyBox' target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" path="" extra-data='{{extraData}}' version="trial"> | |||||
</navigator> | |||||
<button class='buy'>立即支付</button> | |||||
</view> --> | </view> --> | ||||
</view> | </view> |
@@ -3,7 +3,8 @@ | |||||
page { | page { | ||||
background-color: #fff; | background-color: #fff; | ||||
} | } | ||||
.top{ | |||||
} | |||||
.headBox { | .headBox { | ||||
width: 690rpx; | width: 690rpx; | ||||
margin: 30rpx auto 0; | margin: 30rpx auto 0; | ||||
@@ -27,7 +28,7 @@ page { | |||||
font-size: 32rpx; | font-size: 32rpx; | ||||
word-break: break-all; | word-break: break-all; | ||||
text-align: justify; | text-align: justify; | ||||
font-weight:bold; | |||||
font-weight: bold; | |||||
} | } | ||||
::-webkit-scrollbar { | ::-webkit-scrollbar { | ||||
@@ -56,29 +57,33 @@ page { | |||||
} | } | ||||
.price { | .price { | ||||
width: 690rpx; | |||||
font-size: 28rpx; | font-size: 28rpx; | ||||
color: #999; | color: #999; | ||||
width: 100%; | |||||
margin-top: 10rpx; | |||||
line-height: 40rpx; | |||||
margin: 10rpx auto 60rpx; | |||||
} | } | ||||
.time{ | |||||
color: #999!important; | |||||
.time { | |||||
color: #999 !important; | |||||
} | } | ||||
.price .fl{ | |||||
.price .fl { | |||||
width: 15%; | width: 15%; | ||||
color: #666; | |||||
color: #333; | |||||
} | } | ||||
.price .fr{ | |||||
.price .fr { | |||||
width: 85%; | width: 85%; | ||||
color: #999; | color: #999; | ||||
line-height: 40rpx; | line-height: 40rpx; | ||||
font-size: 26rpx; | font-size: 26rpx; | ||||
} | } | ||||
.titleName .fr{ | |||||
.titleName .fr { | |||||
color: #999; | color: #999; | ||||
font-size: 27rpx; | font-size: 27rpx; | ||||
} | } | ||||
.borderBox { | .borderBox { | ||||
width: 750rpx; | width: 750rpx; | ||||
margin-top: 26rpx; | margin-top: 26rpx; | ||||
@@ -212,14 +217,16 @@ page { | |||||
} | } | ||||
.passNumberBox { | .passNumberBox { | ||||
width: 690rpx; | |||||
margin: 50rpx auto 0; | |||||
position: relative; | position: relative; | ||||
background-color: white; | background-color: white; | ||||
/* border-bottom: 1rpx #f8f8f8 solid; */ | |||||
margin-top: 60rpx; | |||||
} | } | ||||
.numberBox{ | |||||
.numberBox { | |||||
width: 100%; | width: 100%; | ||||
} | } | ||||
.passNumber { | .passNumber { | ||||
width: 400rpx; | width: 400rpx; | ||||
height: 100rpx; | height: 100rpx; | ||||
@@ -399,7 +406,7 @@ page { | |||||
left: 0; | left: 0; | ||||
top: 0; | top: 0; | ||||
z-index: 100000000; | z-index: 100000000; | ||||
border-radius:60rpx; | |||||
border-radius: 60rpx; | |||||
} | } | ||||
.active { | .active { | ||||
@@ -407,17 +414,17 @@ page { | |||||
} | } | ||||
.borderBox { | .borderBox { | ||||
width: 690rpx; | |||||
margin: 50rpx auto 0; | |||||
width: 750rpx; | |||||
border-top: 4rpx #f8f8f8 solid; | |||||
} | } | ||||
.carmanage { | .carmanage { | ||||
position: relative; | position: relative; | ||||
width: 690rpx; | width: 690rpx; | ||||
margin: 0 auto; | margin: 0 auto; | ||||
height: 88rpx; | |||||
line-height: 88rpx; | |||||
border-bottom: 1rpx solid #eee; | |||||
height: 80rpx; | |||||
line-height: 82rpx; | |||||
/* border-bottom: 1rpx solid #eee; */ | |||||
} | } | ||||
.carmanage .fr { | .carmanage .fr { | ||||
@@ -425,7 +432,6 @@ page { | |||||
color: #888; | color: #888; | ||||
letter-spacing: 1.16rpx; | letter-spacing: 1.16rpx; | ||||
text-align: right; | text-align: right; | ||||
margin-right: 40rpx; | |||||
} | } | ||||
.fl { | .fl { | ||||
@@ -457,9 +463,9 @@ page { | |||||
.mycar { | .mycar { | ||||
display: inline-block; | display: inline-block; | ||||
margin-left: 20rpx; | |||||
font-size: 30rpx; | |||||
font-size: 33rpx; | |||||
color: #333; | color: #333; | ||||
line-height: 35rpx; | |||||
letter-spacing: 1.16rpx; | letter-spacing: 1.16rpx; | ||||
} | } | ||||
@@ -555,7 +561,7 @@ button::after { | |||||
margin: 0 8rpx; | margin: 0 8rpx; | ||||
width: 32rpx; | width: 32rpx; | ||||
height: 14rpx; | height: 14rpx; | ||||
background: #fff; | |||||
background: #ccc; | |||||
border-radius: 8rpx; | border-radius: 8rpx; | ||||
transition: all 0.6s; | transition: all 0.6s; | ||||
} | } | ||||
@@ -581,7 +587,7 @@ button::after { | |||||
.orderBox .fr { | .orderBox .fr { | ||||
line-height: 60rpx; | line-height: 60rpx; | ||||
font-size: 28rpx; | font-size: 28rpx; | ||||
color: #FF4949; | |||||
color: #ff4949; | |||||
} | } | ||||
.jians { | .jians { | ||||
@@ -590,7 +596,7 @@ button::after { | |||||
width: 34rpx; | width: 34rpx; | ||||
height: 34rpx; | height: 34rpx; | ||||
text-align: center; | text-align: center; | ||||
background: orange; | |||||
background: #ff4949; | |||||
line-height: 34rpx; | line-height: 34rpx; | ||||
color: #fff; | color: #fff; | ||||
border-radius: 6rpx; | border-radius: 6rpx; | ||||
@@ -6,10 +6,6 @@ Page({ | |||||
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
// user: { | |||||
// avatar: | |||||
// "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" | |||||
// } | |||||
flag: 'hidden', | flag: 'hidden', | ||||
score:'0' | score:'0' | ||||
}, | }, | ||||
@@ -34,7 +30,7 @@ Page({ | |||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
}, | }, | ||||
/** | /** | ||||
@@ -71,7 +67,8 @@ Page({ | |||||
}).then(res=>{ | }).then(res=>{ | ||||
console.log(res); | console.log(res); | ||||
that.setData({ | that.setData({ | ||||
score: res.data.score | |||||
score: res.data.score, | |||||
levelName: res.data.levelName | |||||
}) | }) | ||||
}) | }) | ||||
}, | }, | ||||
@@ -8,7 +8,7 @@ | |||||
</view> | </view> | ||||
<view class="user-phone"> | <view class="user-phone"> | ||||
<open-data type="userNickName"></open-data> | <open-data type="userNickName"></open-data> | ||||
<view class='chengzhang'>微信用户</view> | |||||
<view class='chengzhang'>等级:{{levelName}}</view> | |||||
</view> | </view> | ||||
<view class='chengzhang1'> | <view class='chengzhang1'> | ||||
<view class="view">{{score}} | <view class="view">{{score}} | ||||
@@ -4,14 +4,14 @@ | |||||
"ignore": [] | "ignore": [] | ||||
}, | }, | ||||
"setting": { | "setting": { | ||||
"urlCheck": false, | |||||
"urlCheck": true, | |||||
"es6": true, | "es6": true, | ||||
"postcss": true, | "postcss": true, | ||||
"minified": true, | "minified": true, | ||||
"newFeature": true | "newFeature": true | ||||
}, | }, | ||||
"compileType": "miniprogram", | "compileType": "miniprogram", | ||||
"libVersion": "2.2.5", | |||||
"libVersion": "2.0.9", | |||||
"appid": "wx649b3be73c1afe47", | "appid": "wx649b3be73c1afe47", | ||||
"projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2", | "projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2", | ||||
"isGameTourist": false, | "isGameTourist": false, | ||||
@@ -96,10 +96,33 @@ function timechuo(startTime) { | |||||
console.log(month, day, hour, minute, second); | console.log(month, day, hour, minute, second); | ||||
return (day+"天"+hour+"小时"+minute+"分钟") | return (day+"天"+hour+"小时"+minute+"分钟") | ||||
} | } | ||||
//计算时间差 | |||||
function timecha(endTime,startTime) { | |||||
var s1 = new Date(endTime.replace(/-/g, "/")); | |||||
var s2 = new Date(startTime.replace(/-/g, "/")); | |||||
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); | |||||
var year = Math.floor(runTime / 86400 / 365); | |||||
var runTime = runTime % (86400 * 365); | |||||
var month = Math.floor(runTime / 86400 / 30); | |||||
var runTime = runTime % (86400 * 30); | |||||
var day = Math.floor(runTime / 86400); | |||||
var runTime = runTime % 86400; | |||||
var hour = Math.floor(runTime / 3600); | |||||
var runTime = runTime % 3600; | |||||
var minute = Math.floor(runTime / 60); | |||||
var runTime = runTime % 60; | |||||
var second = runTime; | |||||
console.log(month, day, hour, minute, second); | |||||
return (day+"天"+hour+"小时"+minute+"分钟") | |||||
} | |||||
module.exports = { | module.exports = { | ||||
formatTime: formatTime, | formatTime: formatTime, | ||||
barcode: barc, | barcode: barc, | ||||
qrcode: qrc, | qrcode: qrc, | ||||
fmtDate: fmtDate, | fmtDate: fmtDate, | ||||
timechuo:timechuo | |||||
timechuo:timechuo, | |||||
timecha:timecha | |||||
}; | }; |