import{d as T,ay as q,B as M,r as n,Z as I,w as E,ai as r,aq as O,o as h,c as P,U as o,O as t,P as R,M as U,a,S as v,u as $,aF as j,aG as L}from"./vue.adf17aba.js";import{a as Z}from"./index.6155c3d9.js";import H from"./PromoteProduct.9ae7a05d.js";import{u as J}from"./index.ad3efb29.js";import{e as K}from"./emitter.bff31cdd.js";import{E as G}from"./elementPlus.4833989a.js";import{_ as Q}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const p=l=>(j("data-v-2671e671"),l=l(),L(),l),W={class:"customize-container"},X=p(()=>a("div",{class:"custom-card-title"},[a("span",{class:"custom-card-icon"},"|"),a("span",{class:"custom-card-Text"},"广告组")],-1)),Y=p(()=>a("div",null,[a("div",null,"针对页面访问量"),a("div",{style:{color:"#8c8c8c","margin-top":"-5px"}}," 我们将优化您的竞价以获得更高的点击率。通过向更有可能点击广告的顾客展示您的广告来提高商品购买意向 ")],-1)),ee=p(()=>a("div",{style:{color:"#8c8c8c","margin-top":"-5px"}}," 我们将优化您的竞价以获得更高的转化率。通过向更有可能购买商品的顾客展示您的广告来提高销量 ",-1)),oe=p(()=>a("div",{style:{color:"#8c8c8c","margin-top":"-5px"}}," 我们将优化您的竞价以获得更高的可见展示次数。通过在亚马逊上向尽可能多的顾客展示您的广告来提高商品知名度 ",-1)),te=T({__name:"AdGroup",emits:["send-groupId"],setup(l,{emit:w}){const N=J(),{profile:V}=q(N),b=M("respCampaignId"),y=n(),u=I({groupName:"",adMix:"",startDate:"",endDate:"",budget:"1"}),A=I({groupName:[{required:!0,message:"请输入广告组名称",trigger:"blur"}],startDate:[{type:"date",required:!0,message:"请选择时间",trigger:"blur"}],budget:[{required:!0,message:"请输入预算",trigger:"blur"},{pattern:/^(?:[1-9]\d{0,5}|1000000)(?:\.\d{1,2})?$/,message:"预算必须是1到1000000之间的数字，小数点后最多两位",trigger:"blur"}]}),k=async s=>{s&&await s.validate((e,_)=>{e?z():console.error("error submit!",_)})},c=n("clicks"),m=n(!1),d=n("");async function z(){m.value=!0;const s={profile_id:V.value.profile_id,campaignId:b.value,defaultBid:.1,bidOptimization:c.value,state:"paused",creativeType:"IMAGE"};try{const e=await Z(s);e.data.adGroupId?(d.value=e.data.adGroupId,G({message:"广告组创建成功",type:"success"})):G.error("广告组创建失败!")}catch(e){console.log("error:",e)}finally{m.value=!1}}const B=w;return E(()=>d.value,()=>{B("send-groupId",{adGroupId:d.value}),setTimeout(()=>{K.emit("respAdGroupId",d.value)},2e3)}),(s,e)=>{const _=r("el-input"),g=r("el-form-item"),f=r("el-radio"),C=r("el-radio-group"),D=r("el-button"),x=r("el-card"),F=r("el-form"),S=O("loading");return h(),P("div",W,[o(x,{"body-style":"padding: 20px 80px 0 80px;"},{default:t(()=>[X,o(F,{ref_key:"ruleFormRef",ref:y,model:u,rules:A,"label-position":"top","label-width":"120px",size:"default","status-icon":""},{default:t(()=>[R((h(),U(x,{shadow:"never","body-style":"padding-bottom: 0px"},{default:t(()=>[o(g,{label:"广告组名称",prop:"groupName"},{default:t(()=>[o(_,{modelValue:u.groupName,"onUpdate:modelValue":e[0]||(e[0]=i=>u.groupName=i),placeholder:"请输入广告组名称",style:{width:"310px"}},null,8,["modelValue"])]),_:1}),o(g,{label:"竞价优化",prop:"groupName"},{default:t(()=>[a("div",null,[o(C,{modelValue:c.value,"onUpdate:modelValue":e[1]||(e[1]=i=>c.value=i),class:"custom-radio-group"},{default:t(()=>[o(f,{label:"reach",size:"large",border:"",class:"custom-radio-group-item",style:{margin:"0"}},{default:t(()=>[Y]),_:1}),o(f,{label:"clicks",size:"large",border:"",class:"custom-radio-group-item",style:{margin:"10px 0"}},{default:t(()=>[v(" 针对转化率 "),ee]),_:1}),o(f,{label:"conversions",size:"large",border:"",class:"custom-radio-group-item"},{default:t(()=>[v(" 针对可见展示量进行优化 "),oe]),_:1})]),_:1},8,["modelValue"])])]),_:1}),o(g,{style:{margin:"20px 0 -10px 48%"}},{default:t(()=>[o(D,{type:"primary",plain:"",disabled:!$(b),onClick:e[2]||(e[2]=i=>k(y.value))},{default:t(()=>[v("保存")]),_:1},8,["disabled"])]),_:1})]),_:1})),[[S,m.value]]),o(H)]),_:1},8,["model","rules"])]),_:1})])}}});const ue=Q(te,[["__scopeId","data-v-2671e671"]]);export{ue as default};
