require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_company/order/cart"],{"0aa9":function(t,n,e){},"2a06":function(t,n,e){"use strict";e.r(n);var c=e("4de8"),o=e("ba38");for(var a in o)["default"].indexOf(a)<0&&function(t){e.d(n,t,(function(){return o[t]}))}(a);e("a899");var r=e("828b"),i=Object(r["a"])(o["default"],c["b"],c["c"],!1,null,null,null,!1,c["a"],void 0);n["default"]=i.exports},"4de8":function(t,n,e){"use strict";e.d(n,"b",(function(){return c})),e.d(n,"c",(function(){return o})),e.d(n,"a",(function(){}));var c=function(){var t=this,n=t.$createElement,e=(t._self._c,t.__map(t.carts,(function(n,e){var c=t.__get_orig(n),o=t.utils.getDictLabelName("storeProductType",n.productType);return{$orig:c,g0:o}}))),c=t.totalMoney.toFixed(2);t.$mp.data=Object.assign({},{$root:{l0:e,g1:c}})},o=[]},"6d88":function(t,n,e){"use strict";(function(t,n){var c=e("47a9");e("584a");c(e("3240"));var o=c(e("2a06"));t.__webpack_require_UNI_MP_PLUGIN__=e,n(o.default)}).call(this,e("3223")["default"],e("df3c")["createPage"])},9478:function(t,n,e){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var c=e("f5b2"),o=e("9dab"),a={data:function(){return{totalMoney:0,carts:[],checkAll:!1}},onLoad:function(){this.getCarts()},methods:{changeNum:function(n,e){e.cartNum=n.detail.value.replace(/\D/g,""),e.cartNum<=1?t.showToast({title:"已经是底线啦!",icon:"none",duration:2e3}):(e.cartNum<1&&(e.cartNum=1),e.cartNum>=e.stock&&(e.cartNum=e.stock),this.changeCartNum(e))},delCart:function(){var n=this,e=this.carts.filter((function(t){return 1==t.checked})).map((function(t){return t.id}));if(0!=e.length){var o={ids:e};(0,c.delCart)(o).then((function(e){200==e.code?(t.showToast({icon:"success",title:"操作成功"}),n.getCarts()):t.showToast({icon:"none",title:e.msg})}),(function(t){})),console.log(e)}else t.showToast({icon:"none",title:"请选择商品删除"})},computedMoney:function(){var t=0;this.carts.forEach((function(n,e,c){n.checked&&(t+=n.price*n.cartNum)})),console.log(t),this.totalMoney=t},handleCheckAll:function(){this.checkAll=!this.checkAll;var t=this;this.carts.forEach((function(n,e,c){n.checked=t.checkAll})),this.computedMoney()},checkChange:function(t){t.checked=!t.checked,this.computedMoney()},changeCartNum:function(n){var e=this,o={number:n.cartNum,id:n.id};(0,c.cartNum)(o).then((function(n){200==n.code?(t.showToast({icon:"none",title:"操作成功"}),e.computedMoney()):t.showToast({icon:"none",title:n.msg})}),(function(t){}))},getCarts:function(){var n=this;(0,c.getCarts)().then((function(e){200==e.code?(n.carts=e.carts,n.carts.forEach((function(t,n,e){t.checked=!1})),n.computedMoney()):t.showToast({icon:"none",title:"请求失败"})}),(function(t){}))},delNum:function(n){n.cartNum<=1?t.showToast({title:"已经是底线啦!",icon:"none",duration:2e3}):(n.cartNum--,n.cartNum<1&&(n.cartNum=1),this.changeCartNum(n))},addNum:function(t){console.log(t),t.cartNum++,t.cartNum>=t.stock&&(t.cartNum=t.stock),this.changeCartNum(t)},submit:function(){var n=this.carts.filter((function(t){return 1==t.checked})).map((function(t){return t.id}));if(0!=n.length){var e={token:t.getStorageSync("CompanyUserToken"),cateIds:n.toString()};(0,o.createSalesOrder)(e).then((function(n){200==n.code?t.navigateTo({url:"./confirmCompanyOrder?orderKey="+n.orderKey}):t.showToast({icon:"none",title:"请求失败"})}),(function(t){}))}else t.showToast({icon:"none",title:"请选择商品"})}}};n.default=a}).call(this,e("df3c")["default"])},a899:function(t,n,e){"use strict";var c=e("0aa9"),o=e.n(c);o.a},ba38:function(t,n,e){"use strict";e.r(n);var c=e("9478"),o=e.n(c);for(var a in c)["default"].indexOf(a)<0&&function(t){e.d(n,t,(function(){return c[t]}))}(a);n["default"]=o.a}},[["6d88","common/runtime","common/vendor","pages_company/common/vendor"]]]);