(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2994c425"],{"09a5":function(t,o,e){"use strict";e("29f9")},"29f9":function(t,o,e){},"4fa4":function(t,o,e){"use strict";e.r(o);var i=function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"set-shop-logo-page"},[e("div",{staticClass:"title"},[t._v("Jewerly Box Packaging Customization")]),t._m(0),e("div",{staticClass:"customizer"},[e("div",{staticClass:"upload-logo-box"},[e("ImageUploader",{ref:"imageUpload",attrs:{"file-type":6},model:{value:t.logoUrl,callback:function(o){t.logoUrl=o},expression:"logoUrl"}},[t.logoUrl?e("el-row",{staticClass:"btn-row",attrs:{slot:"extend"},slot:"extend"},[t.logoUrl!==t.oldLogoUrl?e("el-row",{attrs:{gutter:5}},[e("el-col",{attrs:{span:4}},[e("el-button",{staticClass:"btn",on:{click:t.removeUploadedLogo}},[t._v("X")])],1),e("el-col",{attrs:{span:20}},[e("el-button",{staticClass:"btn",attrs:{type:"primary"},on:{click:t.saveFittingsLogo}},[t._v("Save")])],1)],1):e("el-row",{attrs:{gutter:5}},[e("el-col",{attrs:{span:4}},[e("el-button",{staticClass:"btn",on:{click:t.removeUploadedLogo}},[t._v("X")])],1),e("el-col",{attrs:{span:20}},[e("el-button",{staticClass:"btn"},[t._v("The logo has been uploaded!")])],1)],1)],1):e("el-button",{staticClass:"btn upload-btn",attrs:{slot:"trigger",type:"primary"},slot:"trigger"},[t._v("Upload logo")])],1)],1),e("div",{staticClass:"fittings-container"},t._l(t.fittingsInfos,(function(o,i){return e("div",{key:o.name+i,staticClass:"fittings-box"},[e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("div",{staticClass:"fittings-name"},[t._v(t._s(o.name))])]),e("div",{staticClass:"fittings-imgs"},t._l(o.customizeInfos.slice(0,10),(function(o){return e("fittings-img",{key:o.bottomImageUrl,staticClass:"fittings-img",attrs:{"bottom-image-url":o.bottomImageUrl,"logo-x":o.logoX,"logo-y":o.logoY,"logo-w":o.logoW,"logo-h":o.logoH,"logo-url":t.logoUrl}})})),1),e("div",[t.logoUrl?e("el-button",{staticClass:"fittings-check-btn",on:{click:function(e){return t.showFittingsImgDialog(o)}}},[t._v("Check")]):t._e()],1)])],1)})),0)]),e("fittings-img-dialog",{attrs:{show:t.fittingsImgDialog.show,"logo-url":t.fittingsImgDialog.logoUrl,fittings:t.fittingsImgDialog.fittings},on:{"update:show":function(o){return t.$set(t.fittingsImgDialog,"show",o)}}}),e("subscription-action",{ref:"SubscriptionAction"})],1)},s=[function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"warn"},[e("div",{staticClass:"warn-title"},[t._v("According to the market big data research,the jewerly box with your exclusive logo wil help you to promote your own brand, ad at the same time provide repurchase in your store,")]),e("div",{staticClass:"warn-content"},[t._v("After uploading your exclusive logo, we will make a small batch of jewerly boxes with your logo printed on it for you. When you have an order to ship,the jewerlry will be put into the jewerly box with your logo")])])}],a=e("35f2"),l=e("b0dc"),n=function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{ref:"main"},[e("el-upload",{ref:"uploader",staticClass:"avatar-uploader",attrs:{"show-file-list":!1,"http-request":t.ossRequest,accept:t.accept,disabled:!t.uploadable,action:""}},[e("el-row",{directives:[{name:"loading",rawName:"v-loading",value:t.form.loading,expression:"form.loading"}],staticClass:"avatar-uploader-img-box"},[t.value?e("img",{staticClass:"avatar",attrs:{width:230,height:230,src:t.value}}):e("span",{staticClass:"el-icon-plus avatar-uploader-icon"},[t._v(" Upload ")])]),t._t("trigger")],2),t._t("extend")],2)},r=[],c=e("88e7"),g=e("2f62"),u={props:{value:{type:String,default:""},accept:{type:String,default:"image/*"},fileType:{type:Number,required:!0},uploadable:{type:Boolean,default:!0}},data(){return{form:{loading:!1}}},computed:{...Object(g["b"])("app",{submitOssFileApi:"submitOssFileApi",stsApi:"stsApi"})},mounted(){},methods:{removeFile(){this.$emit("update:fileUrl",null),this.$emit("input",null)},beforeUpload(){this.form.loading=!0},toUpload(){this.$refs.uploader.dispatchEvent(new MouseEvent("click"))},async ossRequest(t){this.form.loading=!0;const o=t.file;var e=await c["a"].oss(this.stsApi),i=c["a"].getRandomObjectName(e.ossObjectNamePrefix,e.domain,o.name);try{const t=await e.client.multipartUpload(i.objectName,o,{progress:async t=>{},headers:{"Cache-Control":"max-age=360000"}}),s=new Image;s.src=i.objectUrl,s.onload=async()=>{await this.submitOssFileApi({fileName:o.name,fileType:this.fileType,width:s.width,height:s.height,fileUrl:i.objectUrl,bucketName:t.bucket,objectName:t.name,fileSize:o.size}),this.$emit("update:value",i.objectUrl),this.$emit("input",i.objectUrl),this.form.loading=!1}}catch(s){console.log(s),this.form.loading=!1}}}},d=u,p=(e("d30c"),e("2877")),f=Object(p["a"])(d,n,r,!1,null,"032c2b2a",null),h=f.exports,m=e("e112"),b=e("1cf3"),v=e("7f5a"),w={name:"SetShopLogo",components:{ImageUploader:h,FittingsImgDialog:b["a"],FittingsImg:m["a"],SubscriptionAction:v["a"]},inject:["reload"],data(){return{fittingsInfos:[],shopInfo:{},oldLogoUrl:null,logoUrl:null,fittingsImgDialog:{show:!1,logoUrl:null,fittings:null}}},computed:{...Object(g["b"])("user",{currentShop:"getCurrentShop",fittingsLevel:"getFittingsLevel"}),...Object(g["b"])("shopify",{app:"getApp",shop:"getShop"})},mounted(){this.getCurrentShopInfo(),this.getFittingsInfos()},methods:{getFittingsInfos(){Object(l["a"])({level:2}).then(t=>{if(200===t.code){var o=t.data.records||[];for(const t of o)t.customizeInfos&&t.customizeInfos.length&&this.fittingsInfos.push(t)}})},getCurrentShopInfo(){Object(a["c"])().then(t=>{200===t.code&&(this.shopInfo=t.data||{},this.logoUrl=this.shopInfo.fittingsLogoUrl||null,this.oldLogoUrl=this.shopInfo.fittingsLogoUrl||null)})},saveFittingsLogo(){this.logoUrl?this.fittingsLevel<2?this.$confirm("Dear customer, custom logo for jewelry box needs to be subscribed first","",{confirmButtonText:"Subscribe",cancelButtonText:"Details",type:"warning"}).then(async()=>{this.$refs.SubscriptionAction.SelectSubscription(2)}).catch(()=>{this.callNewPage("/Subscription")}):Object(a["i"])({fittingsLogoUrl:this.logoUrl}).then(t=>{200===t.code&&(this.$message.success("Update logo success"),this.reload())}):this.$message.error("Please upload your logo")},removeUploadedLogo(){this.$refs.imageUpload.removeFile()},showFittingsImgDialog(t){this.fittingsImgDialog.fittings=t,this.fittingsImgDialog.logoUrl=this.logoUrl,this.fittingsImgDialog.show=!0}}},U=w,y=(e("09a5"),Object(p["a"])(U,i,s,!1,null,"1620c636",null));o["default"]=y.exports},"9a07":function(t,o,e){},b0dc:function(t,o,e){"use strict";e.d(o,"a",(function(){return s}));var i=e("66a5");const s=t=>Object(i["a"])({url:"/shopapi/blankFittings/list",method:"post",data:t})},d30c:function(t,o,e){"use strict";e("9a07")}}]);