|
@@ -17,6 +17,7 @@ Page({
|
|
|
parkTime: 0,
|
|
|
url:'/images/scan_result.png',
|
|
|
authStatus: 1,
|
|
|
+ defPlateNumber:''
|
|
|
},
|
|
|
resetResultList(resultList){
|
|
|
let that = this
|
|
@@ -265,99 +266,103 @@ Page({
|
|
|
// });
|
|
|
} else if (data.repaidbalance > 15) {
|
|
|
log.info('[扫码]', '[同步用户数据]', '[余额充足开始充电]', data);
|
|
|
- that.beginCharge_satrt(plateNumber);
|
|
|
+ that.beginCharge_satrt(plateNumber,1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
// 扫描结束
|
|
|
},
|
|
|
- beginCharge(e) {
|
|
|
+ beginChargeMsg(e){
|
|
|
let that = this
|
|
|
wx.requestSubscribeMessage({
|
|
|
tmplIds: ['3FR5XRyycT81ZWMdVi_ZQYKJcVatZr2Tm7DgcLwCD1I','KWHBIONCrdumgTkE1dpIpAZRgrN5TuhpHuZ0uU-Eud4','XWj70eHMLAjLlufPuhE_NQmdSQzhrOwEXIblWveH0bk'],
|
|
|
success (res33333) {
|
|
|
-
|
|
|
- let userInfo = wx.getStorageSync('userInfo');
|
|
|
- let isLogin = wx.getStorageSync('isLogin');
|
|
|
-
|
|
|
- if(!that.data.carParkingRate){
|
|
|
- that.beginChargeInner(that);
|
|
|
- return;
|
|
|
- }
|
|
|
- // 读取默认车牌
|
|
|
- wx.request({
|
|
|
- url: getApp().globalData.postHeadAgreement + '/restapi/wechat/carList?loginName=' + userInfo.loginName,
|
|
|
- // data: {
|
|
|
- // loginName: userInfo.loginName
|
|
|
- // },
|
|
|
- method: 'POST',
|
|
|
- success: function (res) {
|
|
|
- let userCarList = res.data;
|
|
|
- userCarList = userCarList.filter(it=>it.defaultType==1);
|
|
|
- console.info(userCarList)
|
|
|
- if(userCarList.length==0 ){
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '当前充电站可减免停车费,是否绑定车牌信息?',
|
|
|
- confirmText: '绑定车牌',
|
|
|
- cancelText: '直接启动',
|
|
|
- showCancel:true,
|
|
|
- confirmColor:'#00AADD',
|
|
|
- cancelColor:'#00AADD',
|
|
|
- success: function (ress1) {
|
|
|
- if(ress1.confirm){
|
|
|
- let url = '/pages/ucenter/car/car'
|
|
|
- wx.navigateTo({
|
|
|
- url
|
|
|
- });
|
|
|
- }else{
|
|
|
- that.beginChargeInner(that)
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }else{
|
|
|
- let userCar = userCarList[0]
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确定使用' + userCar.plateNumber + '车牌信息减免停车费?',
|
|
|
- confirmText: '确定',
|
|
|
- cancelText: '其他车牌',
|
|
|
- showCancel:true,
|
|
|
- confirmColor:'#00AADD',
|
|
|
- cancelColor:'#00AADD',
|
|
|
- success: function (ress1) {
|
|
|
- if(ress1.confirm){
|
|
|
- that.beginChargeInner(that,userCar.plateNumber)
|
|
|
- }else{
|
|
|
- let url = '/pages/ucenter/car/car'
|
|
|
- wx.navigateTo({
|
|
|
- url
|
|
|
- });
|
|
|
- }
|
|
|
- return;
|
|
|
-
|
|
|
- },
|
|
|
- fail: function(res1){
|
|
|
- console.info(res1)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- fail(e) {
|
|
|
- console.log("查询车辆失败");
|
|
|
- log.info('[查询车辆]','[fail]', e);
|
|
|
- }
|
|
|
- });
|
|
|
+ that.beginCharge(e)
|
|
|
},fail(reee){
|
|
|
console.info("ffffffffffffff")
|
|
|
console.info(reee)
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ beginCharge(e) {
|
|
|
+ let that = this
|
|
|
+ let userInfo = wx.getStorageSync('userInfo');
|
|
|
+ let isLogin = wx.getStorageSync('isLogin');
|
|
|
+
|
|
|
+ if(!that.data.carParkingRate){
|
|
|
+ that.beginChargeInner(that,'');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 读取默认车牌
|
|
|
+ wx.request({
|
|
|
+ url: getApp().globalData.postHeadAgreement + '/restapi/wechat/carList?loginName=' + userInfo.loginName,
|
|
|
+ // data: {
|
|
|
+ // loginName: userInfo.loginName
|
|
|
+ // },
|
|
|
+ method: 'POST',
|
|
|
+ success: function (res) {
|
|
|
+ let userCarList = res.data;
|
|
|
+ userCarList = userCarList.filter(it=>it.defaultType==1);
|
|
|
+ console.info(userCarList)
|
|
|
+ if(userCarList.length==0 ){
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '当前充电站可减免停车费,是否绑定车牌信息?',
|
|
|
+ confirmText: '绑定车牌',
|
|
|
+ cancelText: '直接启动',
|
|
|
+ showCancel:true,
|
|
|
+ confirmColor:'#00AADD',
|
|
|
+ cancelColor:'#00AADD',
|
|
|
+ success: function (ress1) {
|
|
|
+ if(ress1.confirm){
|
|
|
+ let url = '/pages/ucenter/car/chooseCar'
|
|
|
+ wx.navigateTo({
|
|
|
+ url
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ that.beginChargeInner(that,'')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ let userCar = userCarList[0]
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确定使用' + userCar.plateNumber + '车牌信息减免停车费?',
|
|
|
+ confirmText: '确定',
|
|
|
+ cancelText: '其他车牌',
|
|
|
+ showCancel:true,
|
|
|
+ confirmColor:'#00AADD',
|
|
|
+ cancelColor:'#00AADD',
|
|
|
+ success: function (ress1) {
|
|
|
+ if(ress1.confirm){
|
|
|
+ that.beginChargeInner(that,userCar.plateNumber)
|
|
|
+ }else{
|
|
|
+ let url = '/pages/ucenter/car/chooseCar'
|
|
|
+ wx.navigateTo({
|
|
|
+ url
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return;
|
|
|
+
|
|
|
+ },
|
|
|
+ fail: function(res1){
|
|
|
+ console.info(res1)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ console.log("查询车辆失败");
|
|
|
+ log.info('[查询车辆]','[fail]', e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
},
|
|
|
- beginCharge_satrt(plateNumber) {
|
|
|
+ beginCharge_satrt(plateNumber,runTimes) {
|
|
|
wx.showLoading({
|
|
|
title: '开启充电中...',
|
|
|
mask: true
|
|
@@ -386,7 +391,8 @@ Page({
|
|
|
chargPileId: terminalNum,
|
|
|
userId: userId,
|
|
|
chargstarttime: chargstarttime,
|
|
|
- userPlateNumber: plateNumber
|
|
|
+ userPlateNumber: plateNumber,
|
|
|
+ runTimes:runTimes
|
|
|
},
|
|
|
method: 'POST',
|
|
|
fail(e) {
|
|
@@ -434,6 +440,29 @@ Page({
|
|
|
confirmColor:'#00AADD',
|
|
|
});
|
|
|
log.info('[扫码]', '[开始充电]', '[失败data.code=502' + data.message + ']', data);
|
|
|
+ } else if (data && data.code == 503) {
|
|
|
+ //开启充电失败,提示用户
|
|
|
+ let msg = res?.data?.message
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ showCancel: true,
|
|
|
+ content: msg,
|
|
|
+ cancelText:'其他车辆',
|
|
|
+ confirmText:'继续启动',
|
|
|
+ confirmColor:'#00AADD',
|
|
|
+ cancelColor:'#00AADD',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.cancel) {
|
|
|
+ //点击取消,其他车辆
|
|
|
+ } else {
|
|
|
+ //点击确定,继续启动
|
|
|
+ that.beginCharge_satrt(plateNumber,runTimes + 1)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function (res) { },//接口调用失败的回调函数
|
|
|
+ complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行)
|
|
|
+ });
|
|
|
+ log.info('[扫码]', '[开始充电]', '[失败data.code=502' + data.message + ']', data);
|
|
|
} else {
|
|
|
//开启充电失败,提示用户
|
|
|
let msg = res?.data?.message
|
|
@@ -467,7 +496,20 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
+ let car = wx.getStorageSync('chooseCar_plateNumber')
|
|
|
+ let plateNumber = ''
|
|
|
+ if(car){
|
|
|
+ plateNumber = car.plateNumber;
|
|
|
+ wx.removeStorageSync('chooseCar_plateNumber')
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ plateNumber
|
|
|
+ })
|
|
|
+ console.info('将会自动跳过弹窗,默认车牌号:' + plateNumber)
|
|
|
|
|
|
+ if(car){
|
|
|
+ this.beginChargeInner(this,plateNumber)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|