(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-53c94083"],{7141:function(t,e,i){"use strict";i.r(e);var r=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"dropshinpper-detail default-main"},[i("BackPage"),i("el-form",{ref:"dropshinpperForm",attrs:{model:t.dropshinpperForm,rules:t.dropshinpperRules,"label-width":"100px","label-position":"top"}},[i("div",{staticClass:"dropshinpper-title"},[t._v(t._s(t.detailInfo.customProductInfo.title))]),i("div",{staticClass:"dropshinpper-card"},[i("div",{staticClass:"dropshinpper-card-title"},[t._v("Mockups")]),i("Mockups",{attrs:{images:t.detailInfo.images},model:{value:t.dropshinpperForm.mainImageUrl,callback:function(e){t.$set(t.dropshinpperForm,"mainImageUrl",e)},expression:"dropshinpperForm.mainImageUrl"}})],1),i("div",{staticClass:"dropshinpper-card"},[i("div",{staticClass:"dropshinpper-card-title"},[t._v("Store details")]),i("StoreDetails",{attrs:{"greeting-cards":t.greetingCards,"fittings-id":t.detailInfo.customProductInfo.fittingsId,"blank-fittings-level":t.detailInfo.customProductInfo.blankFittingsLevel,"collection-id":t.detailInfo.customProductInfo.collectionId,"hidden-in-store":t.detailInfo.customProductInfo.hiddenInStore,"blank-greeting-card-id":t.detailInfo.customProductInfo.blankGreetingCardId,"level-fittings":[].concat(t.detailInfo.level1Fittingses).concat(t.detailInfo.level2Fittingses),"show-package":!t.detailInfo.customProductInfo.isCustomDesignFittings,"show-blank-greeting-card":!t.detailInfo.customProductInfo.isCustomDesignFittings},on:{"update:fittingsId":function(e){return t.$set(t.detailInfo.customProductInfo,"fittingsId",e)},"update:fittings-id":function(e){return t.$set(t.detailInfo.customProductInfo,"fittingsId",e)},"update:blankFittingsLevel":function(e){return t.$set(t.detailInfo.customProductInfo,"blankFittingsLevel",e)},"update:blank-fittings-level":function(e){return t.$set(t.detailInfo.customProductInfo,"blankFittingsLevel",e)},"update:collectionId":function(e){return t.$set(t.detailInfo.customProductInfo,"collectionId",e)},"update:collection-id":function(e){return t.$set(t.detailInfo.customProductInfo,"collectionId",e)},"update:hiddenInStore":function(e){return t.$set(t.detailInfo.customProductInfo,"hiddenInStore",e)},"update:hidden-in-store":function(e){return t.$set(t.detailInfo.customProductInfo,"hiddenInStore",e)},"update:blankGreetingCardId":function(e){return t.$set(t.detailInfo.customProductInfo,"blankGreetingCardId",e)},"update:blank-greeting-card-id":function(e){return t.$set(t.detailInfo.customProductInfo,"blankGreetingCardId",e)}}})],1),i("div",{staticClass:"dropshinpper-card"},[i("div",{staticClass:"dropshinpper-card-title"},[t._v("Variants")]),i("Variants",{attrs:{"custom-product-info":t.detailInfo.customProductInfo,"variant-list":t.detailInfo.variantList},on:{change:t.changeVariants}})],1),i("div",{staticClass:"dropshinpper-card"},[i("div",{staticClass:"dropshinpper-card-title"},[t._v("Description")]),i("Description",{attrs:{"custom-product-info":t.detailInfo.customProductInfo},on:{change:t.changeDescription}})],1),i("div",{staticClass:"dropshinpper-button"},[i("el-button",{attrs:{loading:t.saveLoading},on:{click:function(e){return t.save("dropshinpperForm")}}},[t._v("Save as draft")]),2!==t.currentShop.shopType?i("el-button",{attrs:{loading:t.publishLoading,type:"primary"},on:{click:function(e){return t.release("dropshinpperForm")}}},[t._v("Publish")]):t._e()],1)])],1)},s=[],n=(i("d9e2"),i("2f69")),a=i("1635"),o=i("afad"),d=i("48c2"),c=i("cd9e"),l=i("2f62"),u=i("623f"),p={name:"DropshinpperDetail",components:{Mockups:a["a"],StoreDetails:o["a"],Variants:d["a"],Description:c["a"]},beforeRouteEnter(t,e,i){document.documentElement.scrollTop=0,i()},data(){return{id:"",customProductId:null,detailInfo:{customProductInfo:{tags:[]},images:[{url:""}],level1Fittings:[{id:""}],level2Fittings:[{id:""}],level1Fittingses:[],level2Fittingses:[],level3Fittings:[{id:""}],variantList:[{retailPrice:0,profit:0,profitMargin:0}]},saveLoading:!1,publishLoading:!1,dropshinpperForm:{blankProductId:0,mainImageUrl:"",title:"",description:"",isAddMertic:!0,tags:[],variantList:[],hiddenInStore:!1,blankFittingsLevel:1,collectionId:""},greetingCards:[],dropshinpperRules:{blankProductId:[{required:!0,message:"The BlankProductId field is required",trigger:"blur"}],mainImageUrl:[{required:!0,message:"The MainImageUrl field is required",trigger:"blur"}],title:[{required:!0,message:"The Title field is required",trigger:"blur"}],description:[{required:!0,message:"The Description field is required",trigger:"blur"}],hiddenInStore:[{required:!0,message:"The HiddenInStore field is required",trigger:"blur"}],blankFittingsLevel:[{required:!0,message:"The BlankFittingsLevel field is required",trigger:"blur"}],variantList:[{required:!0,message:"The VariantList field is required",trigger:"blur"}]},setIntervalTag:!1}},computed:{...Object(l["b"])("user",{currentShop:"getCurrentShop"})},created(){this.id=this.$route.params.id,this.customProductId=this.$route.params.customProductId,this.getDetail(),this.loadGreetingCards()},beforeDestroy(){clearInterval(this.setIntervalTag)},methods:{async getDetail(){var t={};this.customProductId&&(t.customProductId=this.customProductId);const e=await Object(n["c"])(this.id,t);this.detailInfo=e.data,this.detailInfo.variantList.forEach(t=>{const e=Number(t.retailPrice)-Number(t.costs),i=Number(t.profit)/Number(t.costs)*100;this.$set(t,"profit",e),this.$set(t,"profitMargin",i)})},async loadGreetingCards(){var t=await Object(u["h"])({blankProductId:this.id});this.greetingCards=t.data||[]},changeStore(t){this.dropshinpperForm=Object.assign(this.dropshinpperForm,t)},changeVariants(t){this.dropshinpperForm.variantList=t},changeDescription(t){this.dropshinpperForm=Object.assign(this.dropshinpperForm,t)},async save(t,e=!0){return new Promise(i=>{this.$refs[t].validate(async t=>{if(t){this.saveLoading=!0;try{var r=Object.assign({},this.dropshinpperForm);r.id=this.customProductId;const t=await Object(n["g"])(r);e&&(this.$message.success("Save success"),setTimeout(()=>{this.callNewPage("/DropshinpperList")},500)),i(t.data)}finally{this.saveLoading=!1}}})})},async release(t){this.publishLoading=!0;try{const e=await this.save(t,!1);await this.publish(e),this.callNewPage({name:"DropshinpperList",params:{id:e}})}finally{this.publishLoading=!1}},async publish(t){const e=await Object(n["k"])({customProductId:t});return e.data.customProductPublishId},async getPublishStatus(t){return new Promise((e,i)=>{const r=async()=>{const{data:{status:s}}=await Object(n["m"])({customProductPublishId:t});return 2===s?(clearInterval(this.setIntervalTag),e()):3===s&&(this.$message.error("publish failure"),clearInterval(this.setIntervalTag),i(new Error)),r};r(),this.setIntervalTag=setInterval(r,3e3)})}}},g=p,h=(i("b577"),i("2877")),f=Object(h["a"])(g,r,s,!1,null,"13374aa8",null);e["default"]=f.exports},"809e":function(t,e,i){},b577:function(t,e,i){"use strict";i("809e")}}]);