123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- // pages/scan_result/elpackage.js
- let log = require('../../utils/log.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- progressPercentage: 100, // 初始进度值为50%
- // chargPile: null,
- chargPile: {
- },
- parkObj:{},
- eleList:{},
- orderid: null,
- userInfo:{},
- userId: null,
- repaidbalance: 0,
- resultTable: [],
- selectEleIndex : -1,
- // 是否减免停车费
- carParkingRate: false,
- // 停车时间
- parkTime: 0,
- url:'/images/scan_result.png',
- authStatus: 1,
- defPlateNumber:'',
- car_active: false
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let that = this;
- let userInfo = wx.getStorageSync('userInfo');
- that.setData({
- userInfo
- })
- wx.getStorage({
- key: 'elpackage',
- success: function (res) {
- console.log(res);
- console.log(res.data);
- let chargPile = res.data.chargStation;
- let eleList = res.data.chargPileList;
- let parkObj = res.data
- eleList.forEach((key)=>{
- if(!key.currentSoc){
- key.currentSoc = 0
- }
- key['active'] = false
- })
- that.setData({
- chargPile,
- eleList,
- parkObj
- })
- // 更新是否减停车费
- wx.removeStorage({
- key: 'elpackage',
- success(res) {
- console.log(res);
- }
- });
- }
- });
- },
- selectEle(e){
- let idx = e.currentTarget.dataset.idx;
- let that = this;
- let eleList = that.data.eleList;
- let car_active = that.data.car_active;
- if(eleList[idx].active){
- eleList[idx].active = false;
- idx = -1
- }else{
- eleList[idx].active = true;
- if(that.data.selectEleIndex>=0){
- eleList[that.data.selectEleIndex].active = false;
- }
- }
- car_active = (idx>=0)
- that.setData({
- selectEleIndex: idx,
- eleList,
- car_active
- })
-
- },
- callCar(){
- let that = this
- let car_active = that.data.car_active;
- if(!car_active){
- return;
- }
- let ivParkPointId = that.data.parkObj.ivParkPointId
- let chargePileId = that.data.eleList[that.data.selectEleIndex].id
- let userId = that.data.userInfo.userId
- wx.request({
- url: getApp().globalData.postHeadAgreement + '/restapi/wechat/callCarRequirement?'
- + 'ivParkPointId=' + ivParkPointId
- + '&chargePileId=' + chargePileId
- + '&userId=' + userId
- + '&requirementType=0',
- data: {
- },
- method: 'POST',
- success: function (res) {
- if( res.data.code ==200){
- // 走你
- let url = `/pages/batteryPack/batteryPackWait`;
- wx.navigateTo({
- url
- });
- }else{
- // 给出提示
- wx.showModal({
- showCancel: false,
- content: "调度失败" + res.data?.msg,
- confirmColor:'#00AADD',
- });
- }
- },
- fail(e) {
- console.log("呼叫充电车失败");
- }
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- 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)
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|