From f635d1674986d1e5ea1a4efbb885acb2cf218918 Mon Sep 17 00:00:00 2001 From: shark <717155252@qq.com> Date: Tue, 4 Sep 2018 19:06:10 +0800 Subject: [PATCH] edit passcar --- config/config.js | 2 +- pages/passCar/passCar.js | 105 +++++++++++++++++++++---------------- pages/passCar/passCar.wxml | 2 +- project.config.json | 2 +- 4 files changed, 63 insertions(+), 48 deletions(-) diff --git a/config/config.js b/config/config.js index 7cd2b6b..02c30d4 100755 --- a/config/config.js +++ b/config/config.js @@ -135,7 +135,7 @@ var config = { }, weapp: { - AppId: "wx8eb8275b78db4ede" + AppId: "wxb11603577a84a86d" }, ErrorCode: { NICK_NOT_AUTH: 11004, diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 9714950..7df58a7 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -72,58 +72,73 @@ Page({ // url: '/pages/pay/pay' // }); // }, - + // payButton:function(){ + // if (that.data.couponList.length>0){ + // console.log('>>>'+that.data.couponList.length) + // that.bindCoupon(e); + // } + // }, //券绑定车牌 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) + if (that.data.couponList.length>0){ + console.log('00000000000000') + console.log(e.currentTarget.dataset.checkbind); + /** + * 如果1 已经绑定 + * 0 没有绑定 + */ + for (let car of that.data.carList) { + if (car.stopFee.parkingFee) { + that.data.payList.push(car) + } } - } - var etcpData = { - etcpToken: app.globalData.etcpToken, - carNumber: that.data.payList[0].carNumber ? that.data.payList[0].carNumber : '', - couponFreeId: that.data.couponList[0].couponFreeId ? that.data.couponList[0].couponFreeId:'', - merchantId: that.data.couponList[0].merchantId ? that.data.couponList[0].merchantId:'', - } - console.log(etcpData) - // 停简单 - 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) { - } - }) + var etcpData = { + etcpToken: app.globalData.etcpToken, + carNumber: that.data.payList[0].carNumber ? that.data.payList[0].carNumber : '', + couponFreeId: that.data.couponList[0].couponFreeId ? that.data.couponList[0].couponFreeId : '', + merchantId: that.data.couponList[0].merchantId ? that.data.couponList[0].merchantId : '', + } + console.log(etcpData) + // 停简单 + var tjdData = { + carNumber: that.data.payList[0].carNumber, + } + var postCouponData = (app.globalData.parkVendor == 1) ? etcpData : tjdData; + + Http.post({ + url: config.api.getCarCoupon, + data: postCouponData, }) - .catch(error => { - console.log(error); - if (error.code==2056){ + .then(res => { that.setData({ - flags:'alreadybind' + flag: '1' + }); + // that.initUsrCarList() + wx.showModal({ + title: '提示', + showCancel: false, + content: "车牌绑定优免券成功!", + success: function (res) { + } }) - } - }) + }) + .catch(error => { + console.log(error); + if (error.code == 2056) { + that.setData({ + flags: 'alreadybind' + }) + } + }) + }else{ + console.log('1111111111111111111') + that.setData({ + flags: 'alreadybind' + }) + console.log(that.data.flags) + } + }, //获取名下停车券列表 diff --git a/pages/passCar/passCar.wxml b/pages/passCar/passCar.wxml index 53eafba..5c7ec6f 100644 --- a/pages/passCar/passCar.wxml +++ b/pages/passCar/passCar.wxml @@ -62,7 +62,7 @@ - + diff --git a/project.config.json b/project.config.json index 9eb02ef..d7c39ff 100644 --- a/project.config.json +++ b/project.config.json @@ -12,7 +12,7 @@ }, "compileType": "miniprogram", "libVersion": "2.2.5", - "appid": "wx8eb8275b78db4ede", + "appid": "wxb11603577a84a86d", "projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2", "isGameTourist": false, "condition": {