(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-19e9f202"],{"14d9":function(t,e,n){"use strict";var r=n("23e7"),i=n("7b0b"),o=n("07fa"),c=n("3a34"),a=n("3511"),u=n("d039"),s=u((function(){return 4294967297!==[].push.call({length:4294967296},1)})),d=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},l=s||!d();r({target:"Array",proto:!0,arity:1,forced:l},{push:function(t){var e=i(this),n=o(e),r=arguments.length;a(n+r);for(var u=0;ui)throw r("Maximum allowed index exceeded");return t}},"3a34":function(t,e,n){"use strict";var r=n("83ab"),i=n("e8b5"),o=TypeError,c=Object.getOwnPropertyDescriptor,a=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=a?function(t,e){if(i(t)&&!c(t,"length").writable)throw new o("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},9831:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"e",(function(){return c})),n.d(e,"d",(function(){return a})),n.d(e,"c",(function(){return u}));var r=n("0088");function i(t){return Object(r["a"])({url:"pkgs/".concat(t),method:"get"})}function o(){return Object(r["a"])({url:"pkgs",method:"get"})}function c(){return Object(r["a"])({url:"upgradepkgs",method:"post"})}function a(t){return Object(r["a"])({url:"upgradepkg/".concat(t),method:"post"})}function u(t){return Object(r["a"])({url:"upgradeitems",method:"post",data:t})}},a6a0:function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t._self._c;return e("div",[e("van-nav-bar",{staticClass:"shadow",attrs:{title:t.pkg.name?t.pkg.name:"升级价计算","left-text":"返回","left-arrow":""},on:{"click-left":t.handleBack}}),e("div",[e("van-cell-group",[e("van-field",{attrs:{type:"number",label:"工程直接费优惠价","input-align":"right",placeholder:"工程直接费优惠价"},on:{input:t.calc},model:{value:t.pkg.price,callback:function(e){t.$set(t.pkg,"price",e)},expression:"pkg.price"}}),t._l(t.pkgitems,(function(n){return e("van-field",{key:n.id,attrs:{type:"number",label:n.name,"input-align":"right",placeholder:"数量"},on:{input:t.calc},model:{value:n.num,callback:function(e){t.$set(n,"num",e)},expression:"v.num"}})})),e("van-cell",{attrs:{title:"升级价"}},[e("span",{staticClass:"text-red-600 text-xl"},[t._v(t._s(Math.round(100*t.price)/100))])])],2)],1)],1)},i=[],o=(n("4160"),n("14d9"),n("d3b7"),n("e25e"),n("159b"),n("9831")),c={data:function(){return{pkgid:0,pkg:{},pkgitems:[],price:0}},created:function(){this.$route.query&&this.$route.query.pkg_id&&(this.pkgid=parseInt(this.$route.query.pkg_id)),this.loadUpgradePkg(),this.loadUpgradeItems()},methods:{loadUpgradePkg:function(){var t=this;this.$store.commit("loading/showLoading"),Object(o["d"])(this.pkgid).then((function(e){t.pkg=e.data,t.$store.commit("loading/hideLoading")}))},loadUpgradeItems:function(){var t=this;this.$store.commit("loading/showLoading"),Object(o["c"])({pkgid:this.pkgid}).then((function(e){t.pkgitems=e.data.list,t.$store.commit("loading/hideLoading")}))},handleBack:function(){this.$router.push("/")},calc:function(){var t=0;this.pkgitems.forEach((function(e){if(e.num){var n=(e.upgrade_control_price-e.control_price)*e.num*e.loss_coefficient/e.coefficient;n>0&&(t+=n)}})),this.pkg.price&&(t-=this.pkg.price*this.pkg.free_coefficient,t<0&&(t=0)),this.price=t}}},a=c,u=(n("fd18"),n("2877")),s=Object(u["a"])(a,r,i,!1,null,null,null);e["default"]=s.exports},d075:function(t,e,n){},fd18:function(t,e,n){"use strict";n("d075")}}]);