charging.js 4.7 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/charging/charging"],{"00bc":function(e,t,i){"use strict";(function(e,t){var r=i("47a9");i("2acb");r(i("3240"));var n=r(i("efe0"));e.__webpack_require_UNI_MP_PLUGIN__=i,t(n.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},"00d1":function(e,t,i){"use strict";var r=i("91fb"),n=i.n(r);n.a},"91fb":function(e,t,i){},b69e:function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"c",(function(){return o})),i.d(t,"a",(function(){return r}));var r={axBody:function(){return i.e("components/ax-body/ax-body").then(i.bind(null,"8839"))},axIosIndicator:function(){return i.e("components/ax-ios-indicator/ax-ios-indicator").then(i.bind(null,"2348"))}},n=function(){var e=this,t=e.$createElement,i=(e._self._c,e.getVolt());e._isMounted||(e.e0=function(t){e.exiting.lock=!0},e.e1=function(t){e.exiting.lock=!1},e.e2=function(t){e.exiting.visible=!1},e.e3=function(t){e.exiting.visible=!1},e.e4=function(t){e.exiting.visible=!0}),e.$mp.data=Object.assign({},{$root:{m0:i}})},o=[]},cbf7:function(e,t,i){"use strict";i.r(t);var r=i("f8b0"),n=i.n(r);for(var o in r)["default"].indexOf(o)<0&&function(e){i.d(t,e,(function(){return r[e]}))}(o);t["default"]=n.a},efe0:function(e,t,i){"use strict";i.r(t);var r=i("b69e"),n=i("cbf7");for(var o in n)["default"].indexOf(o)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(o);i("00d1");var a=i("828b"),c=Object(a["a"])(n["default"],r["b"],r["c"],!1,null,"6a403404",null,!1,r["a"],void 0);t["default"]=c.exports},f8b0:function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={onLoad:function(e){console.log("启动充值页面的参数:",e),this.orderInfo.id=e.orderId,this.deviceInfo.id=e.deviceId},onShow:function(){this.getDeviceInfo(),this.getOrderInfo()},data:function(){return{exiting:{visible:!1,lock:!1},timer:{id:0,start:"2024/08/07 09:00:00",text:"00:00:00",isSatrt:!1},orderTimer:{id:0,isSatrt:!1,timeInterval:10},statInfo:{electricity:0,cost:0},nowPriceTime:{},deviceInfo:{},orderInfo:{id:1},isShowBtn:!0}},destroyed:function(){console.log("关闭页面了。。。。。。"),clearInterval(this.timer.id),clearInterval(this.orderTimer.id)},methods:{getDeviceInfo:function(e){var t=this;this.$api.base("post","/chargeApi/getDevicesDetial",{deviceId:this.deviceInfo.id},{}).then((function(e){t.deviceInfo=e.device,t.nowPriceTime=e.nowPriceTime}))},isShowEendBtn:function(e){var t=new Date(e).getTime(),i=(new Date).getTime(),r=(i-t)/1e3;(r>=60||1==this.orderInfo.status)&&(this.isShowBtn=!0)},getOrderInfo:function(){var t=this;this.$api.base("post","/chargeApi/queryIsSuccessStop",{id:this.orderInfo.id},{loading:!1}).then((function(i){t.orderInfo=i.obj.orderInfo,t.timer.start=i.obj.orderInfo.startTime.replaceAll("-","/"),t.isShowEendBtn(i.obj.orderInfo.startTime.replaceAll("-","/")),null!=t.orderInfo.totalCharge&&(t.statInfo.electricity=t.orderInfo.totalCharge);var r=(t.statInfo.electricity*t.nowPriceTime.price).toFixed(2);if(isNaN(r)||0!=t.orderInfo.thirdPartyElecfee||(t.statInfo.cost=r),!isNaN(t.orderInfo.realCost)&&t.orderInfo.thirdPartyElecfee>0&&(t.statInfo.cost=t.orderInfo.realCost.toFixed(4)),3==t.orderInfo.status||5==t.orderInfo.status)return e.hideLoading(),clearInterval(t.timer.id),clearInterval(t.orderTimer.id),void t.$app.url.goto("/pages/order-detail/order-detail?orderId="+t.orderInfo.id,!1);1!=t.orderInfo.status||t.timer.isSatrt||t.startup(),t.orderTimer.isSatrt||(t.orderTimer.isSatrt=!0,t.startCheckOrderTimer())}))},getVolt:function(){if(!this.deviceInfo.power)return 0;var e=this.deviceInfo.power/this.deviceInfo.current*1e3;return e},startCheckOrderTimer:function(){var e=this;clearInterval(this.orderTimer.id),this.orderTimer.id=setInterval((function(){e.getOrderInfo(e.orderInfo.id)}),1e3*this.orderTimer.timeInterval)},startup:function(){var e=this,t=new Date(this.timer.start),i={hour:0,minute:0,second:0},r=function(){e.timer.isSatrt=!0;var r=Date.now()-t.getTime();i.hour=Math.floor(r/1e3/60/60),i.minute=Math.floor(r/1e3/60%60),i.second=Math.floor(r/1e3%60),e.timer.text="".concat(String(i.hour).padStart(2,"0"),":").concat(String(i.minute).padStart(2,"0"),":").concat(String(i.second).padStart(2,"0"))};clearInterval(this.timer.id),this.timer.id=setInterval(r,1e3),r()},exit:function(){var e=this;this.$api.base("post","/chargeApi/stopCharge",{id:this.orderInfo.id},{}).then((function(t){e.exiting.lock=!1,clearInterval(e.orderTimer.id),e.orderTimer.isSatrt=!1,e.orderTimer.timeInterval=2,e.$app.popup.loading(!0,{title:"结算中,请稍候",timeout:12e4}),setTimeout((function(){e.getOrderInfo(e.orderInfo.id)}),2e3)}))},submitExit:function(){this.exiting.lock=!1,this.exiting.visible=!1,this.exit()}}};t.default=i}).call(this,i("df3c")["default"])}},[["00bc","common/runtime","common/vendor"]]]);