|
@@ -145,17 +145,16 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
- beginCharge(e) {
|
|
|
-
|
|
|
+ beginChargeInner(that){
|
|
|
let userInfo = wx.getStorageSync('userInfo');
|
|
|
let isLogin = wx.getStorageSync('isLogin');
|
|
|
+ // 扫码启动
|
|
|
wx.showLoading({
|
|
|
title: '开启充电中...',
|
|
|
mask: true
|
|
|
});
|
|
|
log.info('[扫码]', '[开始充电流程]');
|
|
|
//同步用户数据
|
|
|
- let that = this;
|
|
|
log.info('[扫码]', '[同步用户数据]', '[请求]', {
|
|
|
loginName: userInfo.loginName
|
|
|
});
|
|
@@ -265,14 +264,85 @@ Page({
|
|
|
that.beginCharge_satrt();
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- fail(e) {
|
|
|
- console.log("用户数据同步失败");
|
|
|
- log.info('[扫码]', '[同步用户数据]', '[fail]', e);
|
|
|
}
|
|
|
});
|
|
|
+ // 扫描结束
|
|
|
+ },
|
|
|
+ beginCharge(e) {
|
|
|
+
|
|
|
+ let userInfo = wx.getStorageSync('userInfo');
|
|
|
+ let isLogin = wx.getStorageSync('isLogin');
|
|
|
+ let that = this
|
|
|
+ // 读取默认车牌
|
|
|
+ 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)
|
|
|
+ }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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
},
|
|
|
beginCharge_satrt() {
|
|
|
wx.showLoading({
|