import{t as e}from"./_plugin-vue2_normalizer-BHc2Ljhs.js";import{a as t}from"./logger-m2skRwRe.js";import"./render-B_No5-zc.js";import{n}from"./vuex.esm-CDgO7zd-.js";import{n as r,r as i}from"./shop-CjthS7Gw.js";import{i as a}from"./seller-zKNLgd8i.js";import{i as o}from"./utils-BlhIOnbm.js";var s=e({data(){return{shopName:``,shopId:``,loading:!1,username:``,phone:``,email:``}},methods:{...n([`ShopeeSellerUnSync`,`ShopeeSellerConnect`]),async disconnectShop(){this.loading=!0,await this.ShopeeSellerUnSync(),this.loading=!1},async connectShop(){this.loading=!0;try{let 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`)),t.error({msg:`ERROR_CONNECT_SHOP`,error:e})}this.loading=!1},async init(){let e=await r();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;let t=await a();return t?(this.shopName=t.shopName,this.shopId=t.shopId,this.username=t.username,!0):!1}},created(){this.shopName=this.getShopeeShopName,this.username=this.getShopeeShopName,this.shopId=this.getShopeeShopId,this.ShopeeSellerInit(),this.init()},computed:{isConnected(){return!!this.getShopeeShopRef}}},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)])},[],!1,null,null,null,null).exports,c=e({name:`ShopInfo`,data(){return{msg:``,name:``,username:``,id:``,image:``,phone:``,email:``,spcf:``,data:{},loading:!1}},methods:{async init(){this.spcf=await i();let e=await r();if(e)return this.name=e.display_name,this.username=e.username,this.phone=e.phone,this.email=e.email,this.id=e.shopid,this.image=o(e.portrait),this.data=e,!0;let t=await a();return this.name=t.shopName,this.username=t.username,this.id=t.shopId,!0}},created(){this.init()},computed:{isShopAuthed(){return!!this.id}}},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)},[],!1,null,null,null,null).exports,l=e({name:`ShopeeShop`,components:{"shop-connect":s,"shop-info":c},created(){this.ShopeeSellerInit()}},function(){var e=this._self._c;return e(`div`,[e(`Row`,[e(`Col`,{attrs:{span:8,offset:8}},[e(`div`,{staticClass:`mb-20`},[e(`shop-connect`)],1),e(`div`,[e(`shop-info`)],1)])],1)],1)},[],!1,null,null,null,null).exports;export{l as default};