"use strict";(self["webpackChunkautoshopee_kit"]=self["webpackChunkautoshopee_kit"]||[]).push([[4810],{34810:function(e,t,s){s.r(t),s.d(t,{default:function(){return E}});var a=function(){var e=this,t=e._self._c;return t("layout-single",{attrs:{"require-authed":""}},[t("template",{slot:"header"},[t("h1",{staticClass:"text-warning"},[t("i",{staticClass:"fa fa-home mr-5",attrs:{"aria-hidden":"true"}}),t("span",[e._v(e._s(e.$t("SHOPEE_MY_SHOP")))])])]),t("div",[t("Row",[t("Col",{attrs:{span:8,offset:8}},[t("div",{staticClass:"mb-20"},[t("shop-connect")],1),t("div",[t("shop-info")],1)])],1)],1)],2)},i=[],n=function(){var e=this,t=e._self._c;return t("div",[e.isConnected?t("div",[t("div",{staticClass:"text-right mb-10"},[t("Button",{attrs:{type:"error",loading:e.loading,size:"small"},on:{click:e.disconnectShop}},[e._v(" "+e._s(e.$t("SHOP_DISCONNECT_BTN"))+" ")])],1),t("Alert",{attrs:{"show-icon":"",type:"success"}},[t("div",[e._v(" "+e._s(e.$t("SHOP_WAS_CONNECTED",{shop:e.shopName}))+" ")]),e._e()])],1):t("div",[t("div",{staticClass:"text-right mb-10"},[t("Button",{attrs:{type:"success",loading:e.loading,size:"small"},on:{click:e.connectShop}},[e._v(" "+e._s(e.$t("SHOP_CONNECT_BTN"))+" ")])],1),t("Alert",{attrs:{"show-icon":"",type:"warning"}},[t("span",[e._v(e._s(e.$t("SHOP_NOT_CONNECTED",{shop:e.shopName})))])])],1)])},o=[],h=s(90408),r=s(57389),l=s(50282),p=s(25744),c={data(){return{shopName:"",shopId:"",loading:!1,username:"",phone:"",email:""}},methods:{...(0,h.nv)(["ShopeeSellerUnSync","ShopeeSellerConnect"]),async disconnectShop(){this.loading=!0,await this.ShopeeSellerUnSync(),this.loading=!1},async connectShop(){this.loading=!0;try{const e=await this.ShopeeSellerConnect();e.success?this.$Message.success(e.msg):this.$Message.error(e.msg)}catch(e){this.$Message.error(this.$t("SHOP_CONNECT_ERROR")),p.St.error({msg:"ERROR_CONNECT_SHOP",error:e})}this.loading=!1},async init(){const e=await(0,r.bI)();if(e)return this.shopName=e.username,this.shopId=e.shopid||e.shop_id,this.username=e.username,this.phone=e.phone,this.email=e.email,!0;const t=await(0,l.Kz)();return!!t&&(this.shopName=t.shopName,this.shopId=t.shopId,this.username=t.username,!0)}},created(){this.shopName=this.getShopeeShopName,this.username=this.getShopeeShopName,this.shopId=this.getShopeeShopId,this.ShopeeSellerInit(),this.init()},computed:{isConnected(){return!!this.getShopeeShopRef}}},u=c,m=s(1001),d=(0,m.Z)(u,n,o,!1,null,null,null),S=d.exports,_=function(){var e=this,t=e._self._c;return t("div",[t("Form",{attrs:{"label-position":"left","label-width":100}},[e.name?t("FormItem",{attrs:{label:e.$t("SHOP_USERNAME")}},[t("Input",{attrs:{readonly:""},model:{value:e.username,callback:function(t){e.username=t},expression:"username"}})],1):e._e(),t("FormItem",{attrs:{label:e.$t("SHOP_SPCF")}},[t("Input",{attrs:{readonly:""},model:{value:e.spcf,callback:function(t){e.spcf=t},expression:"spcf"}})],1),e.isShopAuthed?t("FormItem",{attrs:{label:e.$t("SHOP_PHONE_NUMBER")}},[t("Input",{attrs:{readonly:""},model:{value:e.phone,callback:function(t){e.phone=t},expression:"phone"}})],1):e._e(),e.isShopAuthed?t("FormItem",{attrs:{label:e.$t("SHOP_EMAIL")}},[t("Input",{attrs:{readonly:""},model:{value:e.email,callback:function(t){e.email=t},expression:"email"}})],1):e._e(),e.isShopAuthed?t("FormItem",{attrs:{label:e.$t("SHOP_ID")}},[t("Input",{attrs:{readonly:""},model:{value:e.id,callback:function(t){e.id=t},expression:"id"}})],1):e._e()],1),e.isShopAuthed?t("div",{staticClass:"text-right mt-10"},[t("span",{staticStyle:{float:"left"}},[e._v(e._s(e.msg))])]):e._e()],1)},f=[],g=s(19387),N={name:"ShopInfo",data(){return{msg:"",name:"",username:"",id:"",image:"",phone:"",email:"",spcf:"",data:{},loading:!1}},methods:{async init(){const e=await(0,r.Z7)();this.spcf=e;const t=await(0,r.bI)();if(t)return this.name=t.display_name,this.username=t.username,this.phone=t.phone,this.email=t.email,this.id=t.shopid,this.image=(0,g.sQ)(t.portrait),this.data=t,!0;const s=await(0,l.Kz)();return this.name=s.shopName,this.username=s.username,this.id=s.shopId,!0}},created(){this.init()},computed:{isShopAuthed(){return!!this.id}}},v=N,C=(0,m.Z)(v,_,f,!1,null,null,null),I=C.exports,O={name:"ShopeeShop",metaInfo(){return{title:this.$t("SHOPEE_MY_SHOP")}},components:{"shop-connect":S,"shop-info":I},created(){this.ShopeeSellerInit()}},b=O,y=(0,m.Z)(b,a,i,!1,null,null,null),E=y.exports}}]);
//# sourceMappingURL=4810.8a73ff48.js.map