import{o as e}from"./chunk-mlkTr37E.js";import{t}from"./_plugin-vue2_normalizer-BHc2Ljhs.js";import{t as n}from"./lodash-DulIlzb9.js";import"./render-B_No5-zc.js";import{i as r}from"./utils-BlhIOnbm.js";import{n as i}from"./vue-composition-api-mb1sWs1Y.js";import{i as a,n as o,s,t as c}from"./Data-6suFg2TJ.js";var l=e(n()),u=t({name:`ShopeeAdsList`,mixins:[i({data(){return{tableCampagin:{column:o,data:[],loading:!0},query:{limit:10,page:0,state:`all`,type:``,search:``}}},methods:{openCampagin(e){return this.openExternalUrl(this.createPopupUrl(`/shopee/ads/${e}`))},async getList(){this.tableCampagin.loading=!0;let e=await s(this.query.limit,this.query.page,this.query.state,this.query.type,this.query.search);this.tableCampagin.data=e.map((e,t)=>{let n=e.product.images?e.product.images.split(`,`)[0]:``,i=l.default.get(e,`advertisements[1].extinfo.keywords`,[]),o={index:t+1,id:e.campaign.campaignid,type:this.$t(`SHOPEE_ADS_TYPE_BY.${e.campaign.type}`),state:this.$t(`SHOPEE_ADS_STATE_BY.${e.campaign.state}`),name:e.product.name||this.getShopeeShopName,itemid:e.product.itemid,stock:e.product.stock,image:n?r(n):this.getShopeeShopImage,timeStart:a(e.campaign.start_time),timeEnd:e.campaign.end_time?a(e.campaign.end_time):``,dailyExpense:Number(e.campaign.daily_expense)||0,dailyQuota:Number(e.campaign.daily_quota)||0,totalExpense:Number(e.campaign.total_expense)||0,listKeyword:i,countKeyword:i.length};return o.dailyExpense=this.$n(c(o.dailyExpense)),o.dailyQuota=this.$n(c(o.dailyQuota)),o.totalExpense=this.$n(c(o.totalExpense)),o.timeStart=this.$d(o.timeStart),o.timeEnd=o.timeEnd?this.$d(o.timeEnd):``,o}),this.tableCampagin.loading=!1}},created(){this.getList()}})]},function(){var e=this,t=e._self._c;return t(`div`,[t(`Table`,{attrs:{loading:e.tableCampagin.loading,columns:e.tableCampagin.column,data:e.tableCampagin.data,"highlight-row":``,size:`small`},scopedSlots:e._u([{key:`name`,fn:function({row:n}){return[t(`a`,{attrs:{href:`#`},on:{click:function(t){return e.openCampagin(n.id)}}},[e._v(e._s(n.name)+` `)])]}}])})],1)},[],!1,null,null,null,null).exports,d=t({name:`ShopeeAdsIndex`,components:{"ads-list":u}},function(){var e=this._self._c;return e(`div`,[e(`Row`,[e(`Col`,{attrs:{span:24}},[e(`ads-list`)],1)],1)],1)},[],!1,null,null,null,null).exports;export{d as default};