(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7679687c"],{7141:function(t,e,i){"use strict";i.r(e);var s=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:{"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,"level-fittings":[].concat(t.detailInfo.level1Fittingses).concat(t.detailInfo.level2Fittingses)},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)}}})],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)},r=[],n=(i("d9e2"),i("2f69")),a=i("1635"),o=i("afad"),d=i("48c2"),l=i("cd9e"),c=i("2f62"),u={name:"DropshinpperDetail",components:{Mockups:a["a"],StoreDetails:o["a"],Variants:d["a"],Description:l["a"]},beforeRouteEnter(t,e,i){document.documentElement.scrollTop=0,i()},data(){return{id:"",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:""},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(c["b"])("user",{currentShop:"getCurrentShop"})},created(){this.id=this.$route.params.id,this.getDetail()},beforeDestroy(){clearInterval(this.setIntervalTag)},methods:{async getDetail(){const t=await Object(n["c"])(this.id);this.detailInfo=t.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)})},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{const t=await Object(n["f"])(this.dropshinpperForm);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["i"])({customProductId:t});return e.data.customProductPublishId},async getPublishStatus(t){return new Promise((e,i)=>{const s=async()=>{const{data:{status:r}}=await Object(n["j"])({customProductPublishId:t});return console.log(r,"status"),2===r?(clearInterval(this.setIntervalTag),e()):3===r&&(this.$message.error("publish failure"),clearInterval(this.setIntervalTag),i(new Error)),s};s(),this.setIntervalTag=setInterval(s,3e3)})}}},p=u,h=(i("87b8"),i("2877")),f=Object(h["a"])(p,s,r,!1,null,"32e2ab00",null);e["default"]=f.exports},"87b8":function(t,e,i){"use strict";i("f3b4")},f3b4:function(t,e,i){}}]);