(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2079d8c2"],{1428:function(t,e,a){"use strict";a("4e0a")},"329e":function(t,e,a){"use strict";a.d(e,"j",(function(){return r})),a.d(e,"g",(function(){return i})),a.d(e,"a",(function(){return o})),a.d(e,"b",(function(){return n})),a.d(e,"d",(function(){return l})),a.d(e,"e",(function(){return c})),a.d(e,"f",(function(){return d})),a.d(e,"h",(function(){return p})),a.d(e,"i",(function(){return u})),a.d(e,"c",(function(){return m})),a.d(e,"k",(function(){return f})),a.d(e,"l",(function(){return h})),a.d(e,"m",(function(){return g}));var s=a("66a5");const r=t=>Object(s["a"])({url:"/shopapi/order/page",method:"post",data:t}),i=t=>Object(s["a"])({url:"/shopapi/order/detail",method:"post",data:t}),o=t=>Object(s["a"])({url:"/shopapi/order/price/calculate",method:"post",data:t}),n=t=>Object(s["a"])({url:"/shopapi/order/price/calculateForOrder",method:"post",data:t}),l=t=>Object(s["a"])({url:"/shopapi/order/create",method:"post",data:t}),c=t=>Object(s["a"])({url:"/shopapi/order/create_for_design",method:"post",data:t}),d=t=>Object(s["a"])({url:"/shopapi/order/create_from_cart",method:"post",data:t}),p=t=>Object(s["a"])({url:"/shopapi/order/importOrder",method:"post",data:t}),u=t=>Object(s["a"])({url:"/shopapi/order/onHold",method:"post",data:t}),m=t=>Object(s["a"])({url:"/shopapi/order/cancel",method:"post",data:t}),f=t=>Object(s["a"])({url:"/shopapi/order/shipping/update",method:"post",data:t}),h=t=>Object(s["a"])({url:"/shopapi/order/updateItemLevelFittings",method:"post",data:t}),g=t=>Object(s["a"])({url:"/shopapi/order/updateOrderLevelFittings",method:"post",data:t})},"4e0a":function(t,e,a){},"52fd":function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"page default-main"},[a("BackPage",{attrs:{path:"/Carts",text:"Carts"}}),a("div",{staticClass:"card list"},[a("div",{staticClass:"confirmOrderContainer pb20"},[a("div",{staticClass:"pageContentView"},[a("div",{staticClass:"pageContentLeft"},[a("div",{staticClass:"pageTitle"},[t._v("Shipping address")]),a("div",{staticClass:"formView br-12"},[a("el-form",{ref:"formData",attrs:{model:t.formData,rules:t.formRule,"label-position":"top"}},[a("el-form-item",{staticClass:"item-label-row",attrs:{required:""}},[a("el-row",{attrs:{gutter:5}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"firstName",label:"First Name",required:""}},[a("el-input",{attrs:{"max-length":20,placeholder:"First name"},model:{value:t.formData.firstName,callback:function(e){t.$set(t.formData,"firstName",e)},expression:"formData.firstName"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"lastName",label:"Last Name",required:""}},[a("el-input",{attrs:{"max-length":20,placeholder:"Last name"},model:{value:t.formData.lastName,callback:function(e){t.$set(t.formData,"lastName",e)},expression:"formData.lastName"}})],1)],1)],1)],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Email(optional)",prop:"email"}},[a("el-input",{attrs:{"max-length":100,placeholder:"Email"},model:{value:t.formData.email,callback:function(e){t.$set(t.formData,"email",e)},expression:"formData.email"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Phone",prop:"phone"}},[a("el-input",{attrs:{"max-length":50,placeholder:"Phone"},model:{value:t.formData.phone,callback:function(e){t.$set(t.formData,"phone",e)},expression:"formData.phone"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Country",prop:"country"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{filterable:"",placeholder:""},on:{change:t.onCountryChange},model:{value:t.formData.country,callback:function(e){t.$set(t.formData,"country",e)},expression:"formData.country"}},t._l(t.countryList,(function(t){return a("el-option",{key:t.id,attrs:{label:t.enName,value:t.id}})})),1)],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Region/State/Province/Emirate",prop:"state"}},[t.provinceList&&t.provinceList.length?a("el-select",{attrs:{filterable:"",placeholder:""},model:{value:t.formData.state,callback:function(e){t.$set(t.formData,"state",e)},expression:"formData.state"}},t._l(t.provinceList,(function(t){return a("el-option",{key:t.id,attrs:{label:t.enName,value:t.enName}})})),1):a("el-input",{staticClass:"current-selection--single",attrs:{type:"text",autocomplete:"off"},model:{value:t.formData.state,callback:function(e){t.$set(t.formData,"state",e)},expression:"formData.state"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Address",prop:"address"}},[a("el-input",{attrs:{"max-length":100,placeholder:"Address"},model:{value:t.formData.address,callback:function(e){t.$set(t.formData,"address",e)},expression:"formData.address"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Address2",prop:"address2"}},[a("el-input",{attrs:{"max-length":100,placeholder:"Address2"},model:{value:t.formData.address2,callback:function(e){t.$set(t.formData,"address2",e)},expression:"formData.address2"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"City",prop:"city"}},[a("el-input",{attrs:{"max-length":50,placeholder:"City"},model:{value:t.formData.city,callback:function(e){t.$set(t.formData,"city",e)},expression:"formData.city"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Postal/zip code",prop:"postal"}},[a("el-input",{attrs:{"max-length":50,placeholder:"Postal/zip code"},model:{value:t.formData.postal,callback:function(e){t.$set(t.formData,"postal",e)},expression:"formData.postal"}})],1),a("el-form-item",{staticClass:"item-label-row",attrs:{label:"Note",prop:"note"}},[a("el-input",{attrs:{"max-length":50,placeholder:"Note"},model:{value:t.formData.note,callback:function(e){t.$set(t.formData,"note",e)},expression:"formData.note"}})],1)],1)],1)]),a("div",{staticClass:"pageContentRight"},[a("div",{staticClass:"shippingMethodView br-12"},[a("div",{staticClass:"font16 ff-ss fc-333 font-bold pageTitle"},[t._v("Shipping method")]),a("div",{staticClass:"shippingMethodContent"},t._l(t.shippingTypeList,(function(e){return a("div",{key:e.key,staticClass:"shippingItemView mt15",class:e.key===t.currentShippingType?"shippingItemSelect":"shippingItemNoSelect",on:{click:function(a){return a.stopPropagation(),t.handleShippingTypeChange(e,a)}}},[a("div",{staticClass:"pb15"},[a("span",{staticClass:"fs-14 fc-333 ff-ss shippingItemText"},[t._v(t._s(e.name))])]),a("div",{staticClass:"fc-999 fs-14 ff-ss"},[t._v(t._s(e.description))])])})),0)]),t.currentPriceInfo&&t.currentPriceInfo.total?a("div",{staticClass:"summaryView br-12"},[a("div",{staticClass:"font16 ff-ss fc-333 font-bold pageTitle"},[t._v("Summary")]),a("div",{staticClass:"summaryItem fs-14 fc-333 ff-ss pt25"},[a("div",[t._v("Product Price")]),a("div",{staticClass:"ml-auto"},[t._v("$"+t._s(t._f("moneyFormat")(t.currentPriceInfo.production-t.currentPriceInfo.blankFittingsPrice-t.currentPriceInfo.blankGreetingCardPrice)))])]),a("div",{staticClass:"summaryItem fs-14 fc-333 ff-ss pt25"},[a("div",[t._v("Package Price")]),a("div",{staticClass:"ml-auto"},[t._v("$"+t._s(t._f("moneyFormat")(t.currentPriceInfo.blankFittingsPrice)))])]),a("div",{staticClass:"summaryItem fs-14 fc-333 ff-ss pt25"},[a("div",[t._v("Shipping")]),a("div",{staticClass:"ml-auto"},[t._v("$"+t._s(t._f("moneyFormat")(t.currentPriceInfo.shipping)))])]),a("div",{staticClass:"summaryItem fs-14 fc-333 ff-ss pt25"},[a("div",[t._v("Discount")]),a("div",{staticClass:"ml-auto"},[t._v("$"+t._s(t._f("moneyFormat")(t.currentPriceInfo.discount)))])]),a("el-divider"),a("div",{staticClass:"summaryItem fs-14 fc-333 ff-ss"},[a("div",[t._v("Total")]),a("div",{staticClass:"ml-auto font-bold font16 ff-ss fc-333"},[t._v("$"+t._s(t._f("moneyFormat")(t.currentPriceInfo.totalCosts)))])]),a("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.payLoading,expression:"payLoading"}],staticStyle:{width:"100%","margin-top":"32px"},attrs:{type:"primary"},on:{click:t.toPay}},[t._v("Payment")])],1):t._e()])]),a("div",{staticClass:"productsView br-12"},[a("div",{staticClass:"pageTitle"},[t._v("Order review")]),a("div",{staticClass:"cartList"},[t.showCartList?a("cart-table",{attrs:{"max-col-num":t.maxColNum,"cart-list":t.cartList,"product-sku-item-map":t.productSkuItemMap,"show-selection":!1,"edit-quantity":!1,refresh:!1,"update-data-fn":t.updateCartList},on:{"update:cartList":function(e){t.cartList=e},"update:cart-list":function(e){t.cartList=e}}}):t._e()],1)]),a("div",{staticClass:"order-item-row"},[a("div",{staticClass:"box"},[a("el-collapse",{attrs:{value:t.openCollapseList}},t._l(t.category2List,(function(e){return a("el-collapse-item",{key:e.key,attrs:{name:e.key}},[a("template",{slot:"title"},[a("div",{staticClass:"collapse-header"},[a("div",{staticClass:"collapse-header-left"},[a("span",[t._v(t._s(e.label))])]),a("div",{staticClass:"collapse-header-right"},[a("span",{staticClass:"text"},[t._v(" "+t._s(e.radioKey?"checked":"unchecked")+" ")])])])]),a("div",{staticClass:"collapse-item-box"},[a("el-radio-group",{staticStyle:{width:"100%"},model:{value:e.radioKey,callback:function(a){t.$set(e,"radioKey",a)},expression:"category.radioKey"}},t._l(t.orderListMap.get(e.key),(function(e){return a("div",{key:e.radioKey,staticClass:"item",on:{click:function(a){return a.stopPropagation(),a.preventDefault(),t.orderRadioClick(e)}}},[a("el-radio",{staticClass:"radio-box",attrs:{label:e.radioKey}},[a("img",{staticClass:"item-image",attrs:{alt:e.title,src:e.mainImageUrl},on:{click:function(a){return a.stopPropagation(),a.preventDefault(),t.showImgList([e.mainImageUrl])}}}),a("div",{staticClass:"item-content"},[a("div",[t._v(t._s(e.title))]),a("div",[t._v("(US$"+t._s(e.price)+")")])]),a("div",{staticClass:"inventory-box"},[2===e.stockingStrategy?a("div",{staticClass:"inventory",on:{click:function(t){t.stopPropagation(),t.preventDefault()}}},[a("span",[t._v("Your inventory "+t._s(e.inventory?e.inventory:0)+" pic")]),!e.inventory||e.inventorye.status===t).label}},props:{ids:{type:String,default:null}},data(){return{showCartList:!0,cartList:[],countryList:[],provinceList:[],formData:{country:null,state:null,phone:null,firstName:null,lastName:null,email:null,address:null,address2:null,city:null,postal:null,note:null},formRule:{firstName:[{required:!0,message:"First name is required"}],lastName:[{required:!0,message:"Last name is required"}],email:[],country:[{required:!0,message:"Country is required"}],state:[{required:!0,message:"State is required"}],address:[{required:!0,message:"Address is required"},{max:40,message:"Max length 40"}],address2:[],city:[{required:!0,message:"City is required"},{max:40,message:"Max length 40"}],postal:[{required:!0,message:"ZIP code is required"}],note:[{max:200,message:"Max length 200"}]},priceInfo:{standard:null,express:null,notSupportExpressVariants:[],logisticsType:null,supportStandard:!1,supportExpress:!1},currentShippingType:"standard",showPaypal:!1,orderId:null,payLoading:!1,pageUrl:"",maxColNum:0,category2Object:c["a"],productSkuItemMap:new Map,category2List:[],orderLevelItemList:[],orderListMap:new Map,openCollapseList:[],showImgListTag:!1,currentImgList:[]}},computed:{...Object(f["c"])("comment",["shouldSuggest"]),selectCartsTotalPrice(){var t=0;if(this.selectCarts&&this.selectCarts.length)for(const e of this.selectCarts)t+=e.quantity*(e.discountPrice+e.fittingsPrice);return Object(m["d"])(t)},shippingTypeList(){var t={key:"standard",name:"Standard shipping",description:"Average fulfillment time 7-18 business days"},e={key:"fast",name:"Fast shipping",description:"Average fulfillment time 5-10 business days"},a=[];return this.priceInfo.supportStandard&&a.push(t),this.priceInfo.supportExpress&&a.push(e),a},currentPriceInfo(){if("standard"===this.currentShippingType){const t=Object.assign({},this.priceInfo.standard);return t}if("fast"===this.currentShippingType){const t=Object.assign({},this.priceInfo.express);return t}return{}}},watch:{orderId:{handler(t){if(!t)return;const e="/Orders/"+this.orderId;this.pageUrl=e,this.$store.commit("comment/setJumpToPage",!0),this.$store.commit("comment/setPageUrl",e)},immediate:!0}},created(){this.getCartList(),this.getCountrys()},methods:{showImgList(t){t&&t.length>0&&(this.currentImgList=t,this.showImgListTag=!0)},async updateCartList(){this.updated=!0,await this.getCartList(),await this.calculatePrice()},toReplenishInventory(t){localStorage.setItem("toReplenishInventoryObject",JSON.stringify(t)),this.callNewPage("/MyCustomAccessories/")},async orderRadioClick(t){if(2===t.stockingStrategy&&t.inventory{const e=t.blankProductId,a=t.customProductId,i=t.fittingsList,o=new Map;i&&i.length>0&&i.forEach(t=>{t.customProductId?t.radioKey=Number(t.blankProductId+""+t.customProductId):t.radioKey=t.blankProductId,o.set(t.category2,t)}),r.push({cartId:t.id,selectedItemMap:o}),t.fittingsList&&t.fittingsList.length>this.maxColNum&&(this.maxColNum=t.fittingsList.length),s.push({blankProductId:e,customProductId:a})}),await this.getBindFittingsList(s,r)},async getBindFittingsList(t,e){if(!t)return;const a=await Object(l["g"])({records:t});this.productSkuItemMap=new Map,this.category2List=[],this.orderLevelItemList=[],this.orderListMap=new Map,this.openCollapseList=[];const s=a.data.orderLevelItemList,r=new Map;s.forEach(t=>{t.customProductId?t.radioKey=Number(t.blankProductId+""+t.customProductId):t.radioKey=t.blankProductId;const e=r.get(t.category2);let a,s;e&&e.radioKey?(a=e.radioKey,s=e.object):t.bind&&(a=t.radioKey,s=t),r.set(t.category2,{key:t.category2,label:this.category2Object[t.category2],radioKey:a,object:s});let i=this.orderListMap.get(t.category2);i||(i=[]),i.push(t),this.orderListMap.set(t.category2,i)}),this.category2List=Array.from(r).map(t=>{const e=t[1];return this.openCollapseList.push(e.key),e});const i=a.data.skuLevelItemList;this.productSkuItemMap=new Map,i.forEach(t=>{const a=t.fittingsList,s=i.indexOf(t),r=e[s].cartId,o=e[s].selectedItemMap,n=new Map,l=new Map;let c=[];a.forEach(t=>{t.customProductId?t.radioKey=Number(t.blankProductId+""+t.customProductId):t.radioKey=t.blankProductId;const e=o?o.get(t.category2):null,a=n.get(t.category2);let s,r;e?(s=e.radioKey,r=e):a&&a.radioKey?(s=a.radioKey,r=a.object):t.bind&&(s=t.radioKey,r=t),n.set(t.category2,{key:t.category2,label:this.category2Object[t.category2],radioKey:s,object:r});let i=l.get(t.category2);i||(i=[]),i.push(t),l.set(t.category2,i),c=Array.from(n).map(t=>{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:c})})},async getCountrys(){const{data:t}=await Object(o["e"])();this.countryList=t.countryInfoList||[]},async getProvinces(t){if(!t)return;const{data:e}=await Object(o["n"])({countryId:t});this.provinceList=e.provinceInfoList||[]},onCountryChange(t){this.formData.state=null,this.getProvinces(t),this.calculatePrice()},async calculatePrice(){if(!this.formData.country)return;const t=[];for(const r of this.cartList){const e={};e.variantId=r.blankProductSkuId,e.num=r.quantity;const a=[];for(let t=0;t0&&(a.orderLevelFittingsList=e);const{data:s}=await Object(n["a"])(a);this.priceInfo.standard=s.standard||null,this.priceInfo.express=s.express||null,this.priceInfo.notSupportExpressVariants=s.notSupportExpressVariants||[],this.priceInfo.logisticsType=s.logisticsType,3===this.priceInfo.logisticsType?(this.priceInfo.supportExpress=!0,this.priceInfo.supportStandard=!0):(this.priceInfo.supportExpress=!1,this.priceInfo.supportStandard=!0,this.currentShippingType="standard")},countryFilterOption(t,e){return e.componentOptions.children[0].text.toLowerCase().indexOf(t.toLowerCase())>=0},handleShippingTypeChange(t,e){this.currentShippingType=t.key},toPay(){this.$refs.formData.validate(async t=>{if(t){this.payLoading=!0;try{if(this.orderId)return await this.updateOrderShipping(),void(this.showPaypal=!0);await this.createOrder(),this.showPaypal=!0}finally{this.payLoading=!1}}})},async createOrder(){var t=[];for(const s of this.cartList)t.push({cartItemId:s.id});var e={};if(e.firstName=this.formData.firstName,e.lastName=this.formData.lastName,e.email=this.formData.email,e.phone=this.formData.phone,e.countryId=this.formData.country,e.province=this.formData.state,e.address1=this.formData.address,e.address2=this.formData.address2,e.city=this.formData.city,e.zipCode=this.formData.postal,e.logsiticsType=1,"fast"===this.currentShippingType&&(e.logsiticsType=2),e.note=this.formData.note,e.itemList=t,this.category2List){const t=[];this.category2List.forEach(e=>{const a=e.object;a&&t.push({blankProductId:a.blankProductId,customProductId:a.customProductId})}),e.orderLevelFittingsList=t}var a=await Object(n["f"])(e);200===a.code?this.orderId=a.data.orderId:this.$message.error(a.msg)},async updateOrderShipping(){const t={};t.id=this.orderId,t.address1=this.formData.address,t.address2=this.formData.address2,t.city=this.formData.city,t.countryId=this.formData.country,t.email=this.formData.email,t.firstName=this.formData.firstName,t.phone=this.formData.phone,t.province=this.formData.state,t.lastName=this.formData.lastName,t.zipCode=this.formData.postal,t.logsiticsType=1,"fast"===this.currentShippingType&&(t.logsiticsType=2);const{code:e,msg:a}=await Object(n["k"])(t);200!==e&&this.$message.error(a)},onPaypalDialogClose(){!this.shouldSuggest&&this.orderId&&this.callNewPage(this.pageUrl)}}},g=h,y=(a("1428"),a("2877")),v=Object(y["a"])(g,s,r,!1,null,"486e1067",null);e["default"]=v.exports}}]);