import{t as e}from"./_plugin-vue2_normalizer-BHc2Ljhs.js";import{t}from"./render-ju_tzmp-.js";import{a as n,r,t as i}from"./spy-B6QTuXUw.js";import{n as a}from"./vue-composition-api-CTRLR5Xh.js";import{t as o}from"./Gallery-B97_CClI.js";import{r as s}from"./Table-Be4a8zWQ.js";var c=e({name:`ShopeeSpyProduct`,mixins:[a({props:{productId:{type:Number,require:!0},shopId:{type:Number,require:!0}},data(){return{productData:null,isAddedSpy:!1}},methods:{async addTracker(){return this.isAddedSpy=!0,await r(this.productData)}},async created(){this.productData=await this.ShopeeGetProduct({productId:this.productId,shopId:this.shopId}),this.productData&&(this.SetAppTitle(this.productData.name),this.isAddedSpy=!!await i.getId(n(this.productData)))},computed:{renderProduct(){return this.productData?t(this.productData):{listVariation:[],metaData:{},shopData:{}}},metaProduct(){return this.renderProduct.metaData},metaShop(){return this.renderProduct.shopData},tableVariation(){let{listVariation:e}=this.renderProduct;return{columns:s.columns,data:e.sort(({sold:e},{sold:t})=>t-e)}}}})],components:{"image-gallery":o}},function(){var e=this,t=e._self._c;return e.productData?t(`div`,[t(`div`,{staticClass:`text-right`},[t(`Button`,{attrs:{type:`primary`,disabled:e.isAddedSpy},nativeOn:{click:function(t){return e.addTracker.apply(null,arguments)}}},[e.isAddedSpy?t(`span`,[e._v(e._s(e.$t(`PRODUCT_ADD_TRACKED_BTN`)))]):t(`span`,[e._v(e._s(e.$t(`PRODUCT_ADD_TRACKER_BTN`)))])]),t(`div`,{staticClass:`mt-5`},[t(`router-link`,{attrs:{to:`/shopee/spy/dashboard`,target:`_blank`}},[e._v(` `+e._s(e.$t(`OPEN_SPY_LIST`))+` `)])],1)],1),t(`h2`,{staticClass:`mb-20`},[e._v(` `+e._s(e.productData.name)+` `)]),t(`div`,{staticClass:`mb-20`},[t(`Table`,{attrs:{columns:e.tableVariation.columns,data:e.tableVariation.data},scopedSlots:e._u([{key:`image`,fn:function({row:n}){return[n.image?t(`img`,{staticStyle:{width:`50px`},attrs:{src:n.image}}):e._e()]}}],null,!1,2069082099)})],1),t(`div`,{staticClass:`mb-20`},e._l(e.renderProduct.listTag,function(n,r){return t(`Tag`,{key:r,attrs:{color:`primary`}},[e._v(` `+e._s(n)+` `)])}),1),t(`div`,{staticClass:`mb-20`},[t(`image-gallery`,{attrs:{"list-image":e.renderProduct.listImage}})],1)]):e._e()},[],!1,null,`5e37d850`,null,null).exports,l=e({name:`ShopeeSpyProduct`,components:{"product-spy":c},data(){return{productId:this.$route.query.productId,shopId:this.$route.query.shopId}}},function(){var e=this,t=e._self._c;return t(`div`,[t(`product-spy`,{attrs:{"product-id":e.productId,"shop-id":e.shopId}})],1)},[],!1,null,null,null,null).exports;export{l as default};