|  |  | @@ -1,9 +1,8 @@ | 
		
	
		
			
			|  |  |  | // pages/passCar/passCar.js | 
		
	
		
			
			|  |  |  | let config = require('../../config/config.js') | 
		
	
		
			
			|  |  |  | let Http = require('../../utils/HttpBasics') | 
		
	
		
			
			|  |  |  | const app = getApp(); | 
		
	
		
			
			|  |  |  | Component({ | 
		
	
		
			
			|  |  |  | properties: { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | Page({ | 
		
	
		
			
			|  |  |  | data: { | 
		
	
		
			
			|  |  |  | parkVendor: 1, | 
		
	
		
			
			|  |  |  | park: null, | 
		
	
	
		
			
				|  |  | @@ -11,81 +10,120 @@ Component({ | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | etcpToken: null, | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | methods: { | 
		
	
		
			
			|  |  |  | jumpToAdd: function() { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/addPark/addPark' | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | jumpToPay: function() { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/pay/pay', | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | passb: function() { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: '货物在路上~', | 
		
	
		
			
			|  |  |  | onLoad: function(options) { | 
		
	
		
			
			|  |  |  | if (options.addcar != 'undefined') { | 
		
	
		
			
			|  |  |  | // 绑车牌 | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | this.init(); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | jumpToAdd: function() { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/addPark/addPark' | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | jumpToPay: function() { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/pay/pay', | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | passb: function() { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: '货物在路上~', | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | passc: function() { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: '宝宝最可爱~', | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | orderPay: function() { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/pay/pay' | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | bindCar: function(carNum) { | 
		
	
		
			
			|  |  |  | // ETCP | 
		
	
		
			
			|  |  |  | var etcpData = { | 
		
	
		
			
			|  |  |  | etcpToken: that.data.etcpToken, | 
		
	
		
			
			|  |  |  | carNumber: carNum, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | // 停简单 | 
		
	
		
			
			|  |  |  | var tjdData = { | 
		
	
		
			
			|  |  |  | carNumber: carNum, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | var postData = (parkVendor == 1) ? etcpData : tjdData | 
		
	
		
			
			|  |  |  | Http.post({ | 
		
	
		
			
			|  |  |  | url: config.api.bindCar, | 
		
	
		
			
			|  |  |  | data: postData, | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | passc: function() { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: '宝宝最可爱~', | 
		
	
		
			
			|  |  |  | .then(res => { | 
		
	
		
			
			|  |  |  | console.log(res) | 
		
	
		
			
			|  |  |  | wx.showModal({ | 
		
	
		
			
			|  |  |  | title: '提示', | 
		
	
		
			
			|  |  |  | showCancel: false, | 
		
	
		
			
			|  |  |  | content: "绑车牌成功!", | 
		
	
		
			
			|  |  |  | success: function() {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | orderPay: function() { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/pay/pay' | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | unbindCar: function() { | 
		
	
		
			
			|  |  |  | var that = this | 
		
	
		
			
			|  |  |  | // ETCP | 
		
	
		
			
			|  |  |  | var etcpData = { | 
		
	
		
			
			|  |  |  | etcpToken: that.data.etcpToken, | 
		
	
		
			
			|  |  |  | carNumber: null, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | // 停简单 | 
		
	
		
			
			|  |  |  | var tjdData = { | 
		
	
		
			
			|  |  |  | carNumber: null, | 
		
	
		
			
			|  |  |  | carNumColor: null, | 
		
	
		
			
			|  |  |  | outCarId: null, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | var postData = (parkVendor == 1) ? etcpData : tjdData | 
		
	
		
			
			|  |  |  | Http.post({ | 
		
	
		
			
			|  |  |  | url: config.api.unbindCar, | 
		
	
		
			
			|  |  |  | data: postData, | 
		
	
		
			
			|  |  |  | .catch(error => { | 
		
	
		
			
			|  |  |  | console.log(error) | 
		
	
		
			
			|  |  |  | wx.showModal({ | 
		
	
		
			
			|  |  |  | title: '提示', | 
		
	
		
			
			|  |  |  | showCancel: false, | 
		
	
		
			
			|  |  |  | content: "绑车牌失败!", | 
		
	
		
			
			|  |  |  | success: function() {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .then(res => { | 
		
	
		
			
			|  |  |  | console.log(res) | 
		
	
		
			
			|  |  |  | wx.showModal({ | 
		
	
		
			
			|  |  |  | title: '提示', | 
		
	
		
			
			|  |  |  | showCancel: false, | 
		
	
		
			
			|  |  |  | content: "解绑车牌成功!", | 
		
	
		
			
			|  |  |  | success: function() {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | unbindCar: function() { | 
		
	
		
			
			|  |  |  | var that = this | 
		
	
		
			
			|  |  |  | // ETCP | 
		
	
		
			
			|  |  |  | var etcpData = { | 
		
	
		
			
			|  |  |  | etcpToken: that.data.etcpToken, | 
		
	
		
			
			|  |  |  | carNumber: null, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | // 停简单 | 
		
	
		
			
			|  |  |  | var tjdData = { | 
		
	
		
			
			|  |  |  | carNumber: null, | 
		
	
		
			
			|  |  |  | carNumColor: null, | 
		
	
		
			
			|  |  |  | outCarId: null, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | var postData = (parkVendor == 1) ? etcpData : tjdData | 
		
	
		
			
			|  |  |  | Http.post({ | 
		
	
		
			
			|  |  |  | url: config.api.unbindCar, | 
		
	
		
			
			|  |  |  | data: postData, | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .then(res => { | 
		
	
		
			
			|  |  |  | console.log(res) | 
		
	
		
			
			|  |  |  | wx.showModal({ | 
		
	
		
			
			|  |  |  | title: '提示', | 
		
	
		
			
			|  |  |  | showCancel: false, | 
		
	
		
			
			|  |  |  | content: "解绑车牌成功!", | 
		
	
		
			
			|  |  |  | success: function() {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .catch(error => { | 
		
	
		
			
			|  |  |  | wx.showModal({ | 
		
	
		
			
			|  |  |  | title: '提示', | 
		
	
		
			
			|  |  |  | showCancel: false, | 
		
	
		
			
			|  |  |  | content: "解绑车牌失败!", | 
		
	
		
			
			|  |  |  | success: function () { } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .catch(error => { | 
		
	
		
			
			|  |  |  | wx.showModal({ | 
		
	
		
			
			|  |  |  | title: '提示', | 
		
	
		
			
			|  |  |  | showCancel: false, | 
		
	
		
			
			|  |  |  | content: "解绑车牌失败!", | 
		
	
		
			
			|  |  |  | success: function() {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | ready() { | 
		
	
		
			
			|  |  |  | init: function () { | 
		
	
		
			
			|  |  |  | var that = this | 
		
	
		
			
			|  |  |  | initCallback = token => { | 
		
	
		
			
			|  |  |  | app.parkInitCallback = token => { | 
		
	
		
			
			|  |  |  | // 车场信息获取 | 
		
	
		
			
			|  |  |  | Http.get({ | 
		
	
		
			
			|  |  |  | url: config.api.getParkInfo, | 
		
	
		
			
			|  |  |  | data: {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | url: config.api.getParkInfo, | 
		
	
		
			
			|  |  |  | data: {} | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .then(res => { | 
		
	
		
			
			|  |  |  | console.log(res) | 
		
	
		
			
			|  |  |  | that.setData({ | 
		
	
		
			
			|  |  |  | tabs: res.data | 
		
	
		
			
			|  |  |  | park: res.data | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | //绑定车获取 | 
		
	
	
		
			
				|  |  | @@ -100,9 +138,7 @@ Component({ | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | if (app.globalData.token && app.globalData.token != null) { | 
		
	
		
			
			|  |  |  | initCallback(app.globalData.token) | 
		
	
		
			
			|  |  |  | } else { | 
		
	
		
			
			|  |  |  | initCallback(app.globalData.token) | 
		
	
		
			
			|  |  |  | app.parkInitCallback(app.globalData.token) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) |