require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_company/order/cart"],{815:function(t,n,e){"use strict";(function(t,n){var c=e(4);e(26);c(e(25));var o=c(e(816));t.__webpack_require_UNI_MP_PLUGIN__=e,n(o.default)}).call(this,e(1)["default"],e(2)["createPage"])},816:function(t,n,e){"use strict";e.r(n);var c=e(817),o=e(819);for(var r in o)["default"].indexOf(r)<0&&function(t){e.d(n,t,(function(){return o[t]}))}(r);e(821);var a,i=e(34),u=Object(i["default"])(o["default"],c["render"],c["staticRenderFns"],!1,null,null,null,!1,c["components"],a);u.options.__file="pages_company/order/cart.vue",n["default"]=u.exports},817:function(t,n,e){"use strict";e.r(n);var c=e(818);e.d(n,"render",(function(){return c["render"]})),e.d(n,"staticRenderFns",(function(){return c["staticRenderFns"]})),e.d(n,"recyclableRender",(function(){return c["recyclableRender"]})),e.d(n,"components",(function(){return c["components"]}))},818:function(t,n,e){"use strict";var c;e.r(n),e.d(n,"render",(function(){return o})),e.d(n,"staticRenderFns",(function(){return a})),e.d(n,"recyclableRender",(function(){return r})),e.d(n,"components",(function(){return c}));var o=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}})},r=!1,a=[];o._withStripped=!0},819:function(t,n,e){"use strict";e.r(n);var c=e(820),o=e.n(c);for(var r in c)["default"].indexOf(r)<0&&function(t){e.d(n,t,(function(){return c[t]}))}(r);n["default"]=o.a},820:function(t,n,e){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var c=e(229),o=e(763),r={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=r}).call(this,e(2)["default"])},821:function(t,n,e){"use strict";e.r(n);var c=e(822),o=e.n(c);for(var r in c)["default"].indexOf(r)<0&&function(t){e.d(n,t,(function(){return c[t]}))}(r);n["default"]=o.a},822:function(t,n,e){}},[[815,"common/runtime","common/vendor","pages_company/common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages_company/order/cart.js.map