oil-station/gasStation-uni/unpackage/dist/build/mp-alipay/pages/refuel/refuel.js
2024-08-16 18:26:19 +08:00

1 line
8.3 KiB
JavaScript

(my["webpackJsonp"]=my["webpackJsonp"]||[]).push([["pages/refuel/refuel"],{3323:function(t,e,n){"use strict";var i=n("947c"),o=n.n(i);o.a},"71c4":function(t,e,n){"use strict";(function(t,i){var o=n("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=o(n("2eee")),r=o(n("c973")),s=(o(n("2594")),o(n("648b"))),u={data:function(){return{appltType:t.getStorageSync("appltType"),value:"",liters:0,show:!1,pic:0,hindex:0,qindex:0,aindex:null,sindex:null,store:{name:"测试油站",description:"济南分店",address:"济南槐荫区"},welfare:[],distance:"",storeId:"",oilNumberList:[],oilGunList:[],staffList:[],amountList:[100,200,300],baseUrl:this.$baseUrl,oilPrice:0,oilUnit:"",AppToken:t.getStorageSync("App-Token"),oilOrder:{storeId:"",couponId:"",commissionAmount:0,staffId:"",terminal:"applet",oils:"",oilGunNum:"",oilNum:"",orderAmount:0,discountAmount:0,payAmount:0,payType:t.getStorageSync("appltType")}}},components:{tabbar:function(){n.e("components/tabbar/tabbar").then(function(){return resolve(n("9924"))}.bind(null,n)).catch(n.oe)}},onLoad:function(e){if("WECHAT"==t.getStorageSync("appltType")){var n=decodeURIComponent(e.q);if(e.q){var i=n.split("?")[1],o="19",a="";if(i.includes("&")){var r=i.split("&");r.forEach((function(t){t.includes("storeId")?o=t.split("=")[1]:a=t.split("=")[1]}))}else o=i.split("=")[1];t.setStorageSync("storeId",o),t.setStorageSync("inviteStaffId",a),this.storeId=t.getStorageSync("storeId"),this.staffId=t.getStorageSync("inviteStaffId"),this.getStore(t.getStorageSync("storeId"))}}else t.getStorageSync("storeId")&&this.getStore(t.getStorageSync("storeId"))},onShow:function(){this.getStore(t.getStorageSync("storeId")),this.getTheJudgmentIsTheSame()},methods:{openKey:function(){this.show=!0,this.$refs.popup1.open("bottom")},isExistStoreId:function(){""!=t.getStorageSync("storeId")?this.getStore(t.getStorageSync("storeId")):this.getAddress()},getStore:function(e){var n=this;(0,s.default)({url:"business/storeInformation/store/queryStoreById",method:"post",data:{storeId:e}}).then((function(i){n.getOilNumber(e),n.getStaffList(e),n.store=i.data,n.storeId=i.data.id,t.setStorageSync("storeId",n.store.id),t.setStorageSync("chainStoreId",n.store.chainStoreId);var o=i.data.welfare;o&&(o.includes(",")?n.welfare=i.data.welfare.split(","):n.welfare.push(i.data.welfare))})).catch((function(e){t.showLoading({title:JSON.stringify(e)+222})}))},getAddress:function(){var e=this;t.getLocation({type:"gcj02",success:function(t){(0,s.default)({url:"business/storeInformation/store/recentlyStore",method:"post",data:{lon:t.longitude,lat:t.latitude}}).then((function(t){e.distance=t.data.distance.toFixed(1),e.store=t.data.store,e.storeId=t.data.store.id,e.getOilNumber(e.storeId),e.getStaffList(e.storeId);var n=t.data.store.welfare;void 0!=n&&null!=n&&""!=n&&(n.includes(",")?e.welfare=t.data.store.welfare.split(","):e.welfare.push(t.data.store.welfare))}))},fail:function(t){e.getStore(0)}})},getOilNumber:function(e){var n=this;(0,s.default)({url:"business/petrolStationManagement/oilGun/selectByNumber/"+e,method:"get"}).then((function(e){n.oilNumberList=e.data,e.data&&(n.oilPrice=e.data[0].oilPrice,n.oilUnit=e.data[0].unit,n.oilOrder.oils=e.data[0].oilNameId,e.data[0].oilGunList&&(n.oilGunList=e.data[0].oilGunList,n.oilOrder.oilGunNum=e.data[0].oilGunList[0].id,t.setStorageSync("tankId",e.data[0].oilGunList[0].tankId)))}))},getOilGun:function(t){var e=this;(0,s.default)({url:"business/petrolStationManagement/oilGun/queryGunList/"+t,method:"get"}).then((function(t){e.oilGunList=t.data,e.oilOrder.oilGunNum=t.data[0].id}))},getStaffList:function(t){var e=this;(0,s.default)({url:"business/member/staff/queryStaffList/"+t,method:"get"}).then((function(t){e.staffList=t.data}))},getSIndex:function(e,n){var i=this;this.sindex=e,(0,s.default)({url:"business/petrolStationManagement/oilTank/"+t.getStorageSync("tankId"),method:"get"}).then((function(e){e.data.storedQuantity-i.liters<0?t.showToast({title:"所加油的升数大于油罐内的升数,请重新选择加油升数",icon:"none"}):i.toPayment(n)}))},toPayment:function(e){this.oilOrder.orderAmount=this.value,this.oilOrder.storeId=this.storeId,this.oilOrder.staffId=e,this.oilOrder.oilNum=(this.value/this.oilPrice).toFixed(2),this.oilOrder.tankId=t.getStorageSync("tankId");(0,s.default)({url:"business/oilOrder/addOilOrder",method:"post",data:this.oilOrder}).then((function(e){t.navigateTo({url:"/pagesRefuel/orderDetail/index?orderNo="+e.data})}))},getAIndex:function(t,e){this.value=e+"",this.aindex=t,this.liters=(e/this.oilPrice).toFixed(2)},getHIndex:function(e,n){this.hindex=e,this.oilGunList=n.oilGunList,this.oilOrder.oilGunNum=n.oilGunList[0].id,this.oilPrice=n.oilPrice,this.oilUnit=n.unit,this.oilOrder.oils=n.oilNameId,t.setStorageSync("tankId",n.oilGunList[0].tankId)},getQIndex:function(e,n){this.qindex=e,this.oilOrder.oilGunNum=n.id,t.setStorageSync("tankId",n.tankId)},goRefuel:function(){t.navigateTo({url:"/pagesRefuel/pagesRefuel/index"})},change:function(){},closeStaff:function(){this.$refs.popup.close()},submitAmount:function(){var e=this;(0,s.default)({url:"business/petrolStationManagement/oilTank/"+t.getStorageSync("tankId"),method:"get"}).then((function(n){n.data.storedQuantity-e.liters<0?t.showToast({title:"所加油的升数大于油罐内的升数,请重新选择加油升数",icon:"none"}):""!=e.value&&null!=e.qindex?(e.show=!1,t.getStorageSync("inviteStaffId")?e.toPayment(t.getStorageSync("inviteStaffId")):e.$refs.popup.open("bottom")):""==e.value?t.showToast({title:"请输入加油金额",icon:"error"}):t.showToast({title:"请选择油枪号",icon:"error"})}))},changeVal:function(t){this.value=t,this.liters=(this.value/this.oilPrice).toFixed(2)},backspaceVal:function(t){this.value=t,""==t?(this.amount=0,this.liters=0):(this.amount=t,this.liters=(this.value/this.oilPrice).toFixed(2))},valChange:function(e){t.vibrateShort({success:function(){}});var n=this.value.indexOf(".");if(-1!=n){if(this.value.length-n>=3)return}else if(this.value.length>=7&&"."!=e)return;this.value+=e,this.liters=(this.value/this.oilPrice).toFixed(2)},getTheJudgmentIsTheSame:function(){var e=this;return(0,r.default)(a.default.mark((function n(){return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(e.AppToken){n.next=2;break}return n.abrupt("return");case 2:return n.next=4,(0,s.default)({url:"chainStoreInfo/theJudgmentIsTheSame",method:"get",data:{chainStoreId:t.getStorageSync("chainStoreId")}}).then((function(e){e.data||t.removeStorageSync("App-Token")}));case 4:"WECHAT"==t.getStorageSync("appltType")&&i.login({success:function(e){e.code?(0,s.default)({url:"clientApi/sign/mpWxLogin2",method:"POST",data:{code:e.code}}).then((function(e){e.data||t.removeStorageSync("App-Token")})):console.log("登录失败!"+e.errMsg)}});case 5:case"end":return n.stop()}}),n)})))()},backspace:function(){t.vibrateShort({success:function(){}}),this.value.length&&(this.value=this.value.substr(0,this.value.length-1),this.liters=(this.value/this.oilPrice).toFixed(2))}}};e.default=u}).call(this,n("c11b")["default"],n("c11b")["default"])},"947c":function(t,e,n){},"9fa1":function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return i}));var i={uniIcons:function(){return Promise.all([n.e("common/vendor"),n.e("node-modules/npm-scope-dcloudio/uni-ui/lib/uni-icons/uni-icons")]).then(n.bind(null,"fefe"))},uniPopup:function(){return n.e("node-modules/npm-scope-dcloudio/uni-ui/lib/uni-popup/uni-popup").then(n.bind(null,"09dd"))},keyboard:function(){return n.e("components/keyboard/keyboard").then(n.bind(null,"1891"))},tabbar:function(){return n.e("components/tabbar/tabbar").then(n.bind(null,"9924"))}},o=function(){var t=this.$createElement;this._self._c},a=[]},bd55:function(t,e,n){"use strict";n.r(e);var i=n("71c4"),o=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=o.a},cc2b:function(t,e,n){"use strict";(function(t){var e=n("4ea4");n("5e99");e(n("66fd"));var i=e(n("fcd7"));my.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("c11b")["createPage"])},fcd7:function(t,e,n){"use strict";n.r(e);var i=n("9fa1"),o=n("bd55");for(var a in o)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("3323");var r=n("f0c5"),s=Object(r["a"])(o["default"],i["b"],i["c"],!1,null,"4455a5c6",null,!1,i["a"],void 0);e["default"]=s.exports}},[["cc2b","common/runtime","common/vendor"]]]);