import{d as E,ay as L,r as i,Z as h,w as O,j,ai as n,aq as G,o as g,c as V,P as Z,M,O as o,U as a,a as r,F as H,a8 as J,S as f,aF as K,aG as Q}from"./vue.adf17aba.js";import{g as W,p as X}from"./index.6155c3d9.js";import{u as ee}from"./index.ad3efb29.js";import{E as Y}from"./elementPlus.4833989a.js";import{_ as ae}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const te=u=>(K("data-v-03112452"),u=u(),Q(),u),le={class:"customize-container"},oe=te(()=>r("div",{style:{"font-weight":"700","padding-bottom":"18px"}},[r("span",{style:{color:"#306cd7","font-size":"26px"}},"|"),r("span",{style:{"font-size":"18px","padding-left":"5px"}},"广告活动")],-1)),se={class:"flex-between"},ne={class:"flex-between"},de={class:"flex-between",style:{width:"48%"}},re={class:"flex-between",style:{width:"48%"}},ie=E({__name:"AdCampaign",emits:["send-campaign","send-targetType"],setup(u,{emit:C}){const T=ee(),{profile:N}=L(T),p=i("T00030"),y=i(),l=h({campaignName:"",adMix:"",startDate:"",endDate:"",budget:"1"}),k=h({campaignName:[{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"}]}),I=async s=>{s&&await s.validate((e,_)=>{e?R():console.log("error submit!",_)})},b=i([]);async function F(){try{const s=await W();b.value=s.data.map(e=>({value:e.portfolioId,label:e.name}))}catch(s){console.error("请求失败：",s)}}const v=i(!1),m=i(""),c=i("");async function R(){v.value=!0;const s={profile_id:N.value.profile_id,budget:l.budget,budgetType:"daily",name:l.campaignName,startDate:l.startDate,endDate:l.endDate,costType:"cpc",state:"paused",tactic:p.value};try{const e=await X(s);m.value=e.data.campaignId,c.value=e.data.campaignName,e.data.campaignId?Y({message:"广告活动创建成功",type:"success"}):Y.error("广告活动创建失败!")}catch(e){console.error("请求失败：",e)}finally{v.value=!1}}const x=C;O([m,c],()=>{m.value&&c.value&&x("send-campaign",{id:m.value,name:c.value})});function U(s){p.value=s,x("send-targetType",{type:p.value})}return j(()=>{F()}),(s,e)=>{const _=n("el-input"),d=n("el-form-item"),S=n("el-option"),q=n("el-select"),w=n("el-date-picker"),D=n("el-radio"),A=n("el-radio-group"),z=n("el-button"),B=n("el-form"),P=n("el-card"),$=G("loading");return g(),V("div",le,[Z((g(),M(P,{"body-style":"padding: 20px 80px 0 80px;"},{default:o(()=>[oe,a(B,{ref_key:"campaignRuleFormRef",ref:y,model:l,rules:k,"label-position":"top","label-width":"120px",class:"demo-ruleForm",size:"default","status-icon":""},{default:o(()=>[r("div",se,[a(d,{label:"广告活动名称",prop:"campaignName",style:{width:"48%"}},{default:o(()=>[a(_,{modelValue:l.campaignName,"onUpdate:modelValue":e[0]||(e[0]=t=>l.campaignName=t),placeholder:"请输入广告活动名称"},null,8,["modelValue"])]),_:1}),a(d,{label:"广告组合",prop:"adMix",style:{width:"48%"}},{default:o(()=>[a(q,{modelValue:l.adMix,"onUpdate:modelValue":e[1]||(e[1]=t=>l.adMix=t),placeholder:"请选择",style:{width:"100%"}},{default:o(()=>[(g(!0),V(H,null,J(b.value,t=>(g(),M(S,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),r("div",ne,[r("div",de,[a(d,{label:"开始时间",prop:"startDate",style:{width:"49%"}},{default:o(()=>[a(w,{modelValue:l.startDate,"onUpdate:modelValue":e[2]||(e[2]=t=>l.startDate=t),type:"date",label:"Pick a date",placeholder:"开始时间",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),a(d,{label:"结束时间",prop:"endDate",style:{width:"49%"}},{default:o(()=>[a(w,{modelValue:l.endDate,"onUpdate:modelValue":e[3]||(e[3]=t=>l.endDate=t),type:"date",label:"Pick a date",placeholder:"开始时间",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),r("div",re,[a(d,{label:"预算",required:"",prop:"budget",style:{width:"100%"}},{default:o(()=>[a(_,{modelValue:l.budget,"onUpdate:modelValue":e[4]||(e[4]=t=>l.budget=t),minlength:"1",maxlength:"7",placeholder:"请输入",style:{width:"100%"}},{prepend:o(()=>[f("$")]),_:1},8,["modelValue"])]),_:1})])]),a(d,{label:"投放类型"},{default:o(()=>[a(A,{modelValue:p.value,"onUpdate:modelValue":e[5]||(e[5]=t=>p.value=t),onChange:U},{default:o(()=>[a(D,{label:"T00030"},{default:o(()=>[f("受众")]),_:1}),a(D,{label:"T00020"},{default:o(()=>[f("内容相关投放")]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(d,{style:{margin:"20px 0 -10px 48%"}},{default:o(()=>[a(z,{type:"primary",plain:"",onClick:e[6]||(e[6]=t=>I(y.value))},{default:o(()=>[f("保存")]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})),[[$,v.value]])])}}});const fe=ae(ie,[["__scopeId","data-v-03112452"]]);export{fe as default};
