diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 57c7005..1e76aca 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -6,11 +6,10 @@ Page({ data: { park: null, carList: [], - payList:[], - aaaaa:[], + payList: [], addCar: null, tcq: 2, - flag:'' + flag: '', }, /*车牌动态样式 */ changeStyle: function () { @@ -25,15 +24,12 @@ Page({ }, onLoad: function (options) { var that = this - that.init(); - this.getList(); + that.getList(); }, onShow: function (options) { - var that = this - if (options) - console.log(options) + var that = this; + console.log("车牌号") if (that.data.addCar) { - console.log(JSON.stringify(that.data.addCar)) // 绑车牌 if (app.globalData.carLogin) { that.bindCar(that.data.addCar) @@ -75,104 +71,81 @@ Page({ // }); // }, - //券绑定卡 - bindCoupon: function () { - var that = this - // ETCP - for(let car of that.data.carList){ - console.log('11111111111' + JSON.stringify(car) ) - if (car.stopFee.remainingFee){ - that.data.payList.push(car) - console.log(car) - } + //券绑定车牌 + bindCoupon: function (e) { + var that = this; + console.log(e.currentTarget.dataset.checkbind); + /** + * 如果1 已经绑定 + * 0 没有绑定 + */ + for (let car of that.data.carList) { + if (car.stopFee.parkingFee) { + that.data.payList.push(car) + console.log('bbbb' + car); + } } - // if (that.data.payList.length==0){ - // wx.showModal({ - // title: '提示', - // showCancel: false, - // content: "您还没有在场车辆!", - // }) - // return - // } var etcpData = { etcpToken: app.globalData.etcpToken, - carNumber: that.data.payList[0].carNumber ? that.data.payList[0].carNumber:'', + carNumber: that.data.payList[0].carNumber ? that.data.payList[0].carNumber : '', couponFreeId: that.data.couponList[0].couponFreeId, - merchantId: that.data.couponList[0].id, + merchantId: that.data.couponList[0].merchantId, } - console.log('--->>>'+JSON.stringify(etcpData)) + console.log(etcpData) // 停简单 - var tjdData = { - carNumber: that.data.payList[0].carNumber, - } - var postCouponData = (app.globalData.parkVendor == 1) ? etcpData : tjdData - // that.setData({ - // loading: true, - // content: "正在进行车牌绑定券,请稍后...", - // }); - // wx.showToast({ - // title: '00000', - // }) - Http.post({ - url: config.api.getCarCoupon, - data: postCouponData, - }) - .then(res => { - console.log('>>>>>>>>>>' + res.code) - // that.initUsrCarList() - wx.showModal({ - title: '提示', - showCancel: false, - content: "车牌绑定优免券成功!", - success: function (res) { - // console.log(res.data.code); - that.setData({ - // flag:res - }) - } - }) + // var tjdData = { + // carNumber: that.data.payList[0].carNumber, + // } + var postCouponData = (app.globalData.parkVendor == 1) ? etcpData : tjdData; + + Http.post({ + url: config.api.getCarCoupon, + data: postCouponData, + }) + .then(res => { + that.setData({ + flag: '1' + }); + // that.initUsrCarList() + wx.showModal({ + title: '提示', + showCancel: false, + content: "车牌绑定优免券成功!", + success: function (res) { + // console.log('>>>>>>>>>>>.'+res.data.code); + } }) - .catch(error => { - console.log(error) - wx.showModal({ - title: '提示', - showCancel: false, - content: error.message, - success: function () { } + }) + .catch(error => { + console.log(error); + if (error.code==2056){ + that.setData({ + flags:'alreadybind' }) - }) + } + }) }, - -//获取名下停车券列表 + //获取名下停车券列表 getList() { var that = this; - // console.log('1111111111111111111111.......'); - // console.log(key); - // console.log(pageNum); - if (1) { - // wx.showLoading({ - // title: "加载中" - // }); - Http.get({ - url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", - data: { - pageNum: 1, - pageSize: 8, - couponOrderStatus: 0 - } - }).then(res => { - // console.log('>>>>>>>>>>>>>>Res'+JSON.stringify(res)) - that.setData({ - couponList: res.data.list - }) - setTimeout(function () { - wx.hideLoading(); - }, 1200); - }); - } else { - console.log("加载完成allow_load设置成false"); - } + Http.get({ + url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", + data: { + pageNum: 1, + pageSize: 8, + couponOrderStatus: 0 + } + }).then(res => { + that.init(); + that.setData({ + couponList: res.data.list + }) + setTimeout(function () { + wx.hideLoading(); + }, 1200); + }); + }, bindCar: function (carNum) { @@ -182,7 +155,6 @@ Page({ etcpToken: app.globalData.etcpToken, carNumber: carNum, } - // 停简单 var tjdData = { carNumber: carNum, } @@ -253,7 +225,7 @@ Page({ that.unbindCar(carNum) }, getStopFeeItem: function (carItem, i) { - var that = this + var that = this; var postData = (app.globalData.parkVendor == 1) ? { etcpToken: app.globalData.etcpToken, @@ -263,15 +235,20 @@ Page({ outCarId: carItem.outCarId, } var stopFee = 'carList[' + i + '].stopFee' - var extraData = 'carList[' + i + '].extraData' - var extraDataStr = {params:{CarNumber:carItem.carNumber}} - console.log(postData) + var extraData = 'carList[' + i + '].extraData'; + console.log(extraData); + var extraDataStr = { params: { CarNumber: carItem.carNumber } }; + that.setData({ + extraData: extraDataStr + }) Http.post({ url: config.api.getCarStopFee, data: postData }) .then(res => { - console.log(res) + /** + * 停车费用 + */ console.log(stopFee) that.setData({ [stopFee]: res.data, @@ -290,6 +267,7 @@ Page({ } // console.log(JSON.stringify(getStopFeeItem)) }, + initPark: function () { var that = this // 车场信息获取 @@ -298,7 +276,6 @@ Page({ data: {} }) .then(res => { - console.log(res) that.setData({ park: res.data, }) @@ -311,10 +288,12 @@ Page({ url: config.api.getUserCarList, data: {} }).then(res => { - console.log(res); that.setData({ carList: res.data }) + console.log('aaaa' + JSON.stringify(that.data.carList) ); + + }) }, init: function () { diff --git a/pages/passCar/passCar.wxml b/pages/passCar/passCar.wxml index b7b0b58..6bb1c2e 100644 --- a/pages/passCar/passCar.wxml +++ b/pages/passCar/passCar.wxml @@ -22,12 +22,13 @@ - + 入场时间:{{item.stopFee.entranceTime}} - 待缴金额:¥{{item.stopFee.remainingFee}} + 待缴金额:¥{{item.stopFee.parkingFee}} + @@ -61,7 +62,7 @@ - + diff --git a/pages/passCar/passCar.wxss b/pages/passCar/passCar.wxss index 29de3ee..ed13b3d 100644 --- a/pages/passCar/passCar.wxss +++ b/pages/passCar/passCar.wxss @@ -249,6 +249,8 @@ color: transparent; font-size: 36rpx; line-height: 88rpx; border-radius: 6rpx; + position: relative; + z-index: 100; } .borderBox{ width: 750rpx; @@ -314,4 +316,5 @@ border:none; position:absolute; left: 0; top: 0; + z-index: 100000000; } \ No newline at end of file