(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-512cbb9a"],{"7c87":function(t,e,s){},"8d40":function(t,e,s){"use strict";s.r(e);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"page default-main"},[s("div",{staticClass:"card list"},[s("div",{staticClass:"list-top"},[s("div",{staticClass:"list-top-item"},[s("el-input",{staticStyle:{width:"400px"},attrs:{placeholder:"Product name or product ID"},on:{change:t.reloadCartList},model:{value:t.query.keyword,callback:function(e){t.$set(t.query,"keyword",e)},expression:"query.keyword"}}),s("el-button",{staticClass:"list-top-button",attrs:{disabled:0===t.selectCarts.length},on:{click:t.bulkDeleteCartItem}},[t._v("Bulk delete")])],1),s("div",{staticClass:"list-top-item list-top-right"},[t.selectCarts&&t.selectCarts.length?s("div",{staticClass:"total-price"},[t._v("Total Price: $"+t._s(t.selectCartsTotalPrice))]):t._e(),s("el-button",{staticClass:"list-top-button",attrs:{disabled:0===t.selectCarts.length,type:"primary"},on:{click:t.onCheckout}},[t._v("Check out")])],1)]),s("cart-table",{attrs:{"max-col-num":t.maxColNum,"cart-list":t.cartList,"product-sku-item-map":t.productSkuItemMap,refresh:!0,"update-data-fn":t.getCartList},on:{"update:cartList":function(e){t.cartList=e},"update:cart-list":function(e){t.cartList=e},"selection-change":t.handleSelectionChange}}),s("div",{staticClass:"list-bottom"},[s("div",{staticClass:"list-bottom-item"},[t.selectCarts.length?s("div",[t._v(" Selected "+t._s(t.selectCarts.length)+" items ")]):t._e()]),s("div",{staticClass:"list-bottom-item list-bottom-right"},[t.selectCarts&&t.selectCarts.length?s("div",{staticClass:"total-price"},[t._v("Total Price: $"+t._s(t.selectCartsTotalPrice))]):t._e(),s("el-button",{staticClass:"list-bottom-button",attrs:{disabled:0===t.selectCarts.length,type:"primary"},on:{click:t.onCheckout}},[t._v("Check out")])],1)])],1)])},i=[],r=s("f8d6"),o=s("ed08"),c=s("2da9"),l=s("0145c"),n=s("5657"),d={name:"CartList",components:{CartTable:c["a"]},filters:{statusFilters(t,e){return e.find(e=>e.status===t).label}},data(){return{cartList:[],selectCarts:[],query:{keyword:"",status:"",startDate:"",endDate:"",total:0,current:1,size:10},maxColNum:0,category2Object:n["a"],productSkuItemMap:new Map}},computed:{selectCartsTotalPrice(){var t=0;if(this.selectCarts&&this.selectCarts.length)for(const e of this.selectCarts)t+=e.quantity*(e.discountPrice+e.fittingsPrice+e.blankGreetingCardPrice);return Object(o["d"])(t)},selectCartIds(){var t=[];for(const e of this.selectCarts)t.push(e.id);return t}},created(){this.getCartList()},methods:{async getCartList(){const t=Object.assign({},this.query),e=await Object(r["b"])(t);this.cartList=e.data.records,this.query.total=e.data.total;const s=[],a=[];this.cartList.forEach(t=>{const e=t.blankProductId,i=t.customProductId,r=t.fittingsList,o=new Map;r&&r.length>0&&r.forEach(t=>{t.customProductId?t.radioKey=Number(t.blankProductId+""+t.customProductId):t.radioKey=t.blankProductId,o.set(t.category2,t)}),a.push({cartId:t.id,selectedItemMap:o}),t.fittingsList&&t.fittingsList.length>this.maxColNum&&(this.maxColNum=t.fittingsList.length),s.push({blankProductId:e,customProductId:i})}),await this.getBindFittingsList(s,a)},async getBindFittingsList(t,e){if(!t)return;const s=await Object(l["g"])({records:t}),a=s.data.skuLevelItemList;this.productSkuItemMap=new Map,a.forEach(t=>{const s=t.fittingsList,i=a.indexOf(t),r=e[i].cartId,o=e[i].selectedItemMap,c=new Map,l=new Map;let n=[];for(let e=0;e{const e=t[1];return e.showItemSelect=!1,e})}this.maxColNum=l.size>this.maxColNum?l.size:this.maxColNum,this.productSkuItemMap.set(r,{skuListMap:l,skuCategory2List:n})}),console.log("productSkuItemMap: ",this.productSkuItemMap)},skuRadioClick(t,e){this.skuCategory2List[t].radioKey===e.radioKey?(this.skuCategory2List[t].radioKey=null,this.skuCategory2List[t].object=null):(this.skuCategory2List[t].radioKey=e.radioKey,this.skuCategory2List[t].object=e)},orderRadioClick(t){const e=t.radioKey;for(let s=0;s{t.doCartItemDelete(this.selectCartIds)})},async doCartItemDelete(t){this.loading=!0;try{var e={};e.ids=t,await Object(r["c"])(e),this.reloadCartList()}finally{this.loading=!1}},onCheckout(){this.toCreateOrder(this.selectCartIds)},toCreateOrder(t){this.callNewPage("/CartsConfirmOrder/"+t.join(","))}}},u=d,h=(s("a3ee"),s("2877")),C=Object(h["a"])(u,a,i,!1,null,"957d76ae",null);e["default"]=C.exports},a3ee:function(t,e,s){"use strict";s("7c87")}}]);