AdCampaign.4e28b466.js 9.0 KB

1
  1. import{d as J,ay as K,r as n,Z as U,w as k,j as Q,ai as r,aq as W,o as p,c as _,P as X,M as V,O as s,U as l,a as o,F as D,a8 as P,S as f,R as ee,aF as ae,aG as te}from"./vue.adf17aba.js";import{g as le,a as oe,p as se}from"./index.6717ff78.js";import{u as de}from"./index.b098562c.js";import{e as ie}from"./emitter.c27b7986.js";import{E as z}from"./elementPlus.4833989a.js";import{_ as ne}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const u=b=>(ae("data-v-36f21bbc"),b=b(),te(),b),re={class:"customize-container"},pe=u(()=>o("div",{style:{"font-weight":"700","padding-bottom":"18px"}},[o("span",{style:{color:"#306cd7","font-size":"26px"}},"|"),o("span",{style:{"font-size":"18px","padding-left":"5px"}},"设置")],-1)),ue={class:"flex-between"},me={class:"flex-between"},ce={class:"flex-between",style:{width:"48%"}},ge={class:"flex-between",style:{width:"48%"}},fe=u(()=>o("div",{style:{"font-weight":"700","padding-bottom":"18px"}},[o("span",{style:{color:"#306cd7","font-size":"26px"}},"|"),o("span",{style:{"font-size":"18px","padding-left":"5px"}},"竞价")],-1)),_e=u(()=>o("span",{style:{"margin-left":"10px",color:"#88909b"}},"允许亚马逊自动优化搜索结果首页以外的广告位竞价",-1)),be={key:0,style:{width:"55%"}},ye=u(()=>o("div",{style:{"margin-bottom":"10px","font-weight":"500"}},[o("span",{style:{color:"#f56c6c","margin-right":"4px"}},"*"),f(" 展示位置出价调整 ")],-1)),ve={style:{display:"flex","align-items":"center"}},he=u(()=>o("div",{class:"left"},[o("div",{class:"title"},"商品页面"),o("div",{class:"tip"},"产品详情页面为顾客提供在亚马逊所售卖商品的详情信息")],-1)),xe={style:{display:"flex","align-items":"center","margin-top":"10px"}},we=u(()=>o("div",{class:"left"},[o("div",{class:"title"},"搜索结果顶部(首页)"),o("div",{class:"tip"},"亚马逊首页 http://www.amazon.com")],-1)),Ve={style:{display:"flex","align-items":"center","margin-top":"10px"}},De=u(()=>o("div",{class:"left"},[o("div",{class:"title"},"搜索结果的其余位置"),o("div",{class:"tip"},"其他位置集合, 例如搜索页")],-1)),Pe=u(()=>o("div",{style:{color:"#8d9095","padding-left":"60%","margin-top":"10px"}},"示例: $5.00 竞价降低 40% 将变为 $3.00",-1)),Ie=J({__name:"AdCampaign",emits:["update-campaign"],setup(b,{emit:A}){const B=de(),{profile:I}=K(B),S=n("default"),M=n(),e=U({campaignName:"",adMix:"",startDate:"",endDate:"",budget:"",frequency:"DAILY",brand:"",isBid:!1,commodityPage:"",otherPlace:"",firstPage:""}),R=U({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"}],commodityPage:[{required:!0,message:"必填",trigger:"blur"},{pattern:/^-?(99|[1-8]?[0-9]?[0-9])$/,message:"请输入-99到900之间的数字",trigger:"blur"}],otherPlace:[{required:!0,message:"必填",trigger:"blur"},{pattern:/^-?(99|[1-8]?[0-9]?[0-9])$/,message:"请输入-99到900之间的数字",trigger:"blur"}],firstPage:[{required:!0,message:"必填",trigger:"blur"},{pattern:/^-?(99|[1-8]?[0-9]?[0-9])$/,message:"请输入-99到900之间的数字",trigger:"blur"}]}),F=[{value:"DAILY",label:"每日"},{value:"lifeCycle",label:"生命周期",disabled:!0}],y=n([]),$=async i=>{i&&await i.validate((a,g)=>{a?(console.log("submit!"),L()):console.log("error submit!",g)})};async function E(){const i=await le({profile_id:I.value.profile_id});y.value=i.data}const C=n([]);async function O(){try{const i=await oe();C.value=i.data.map(a=>({value:a.portfolioId,label:a.name}))}catch(i){console.error("请求失败:",i)}}const v=n(!1),h=n(""),Y=n(""),m=n(""),c=n("");async function L(){v.value=!0;const i={profile_id:I.value.profile_id,budget:e.budget,budgetType:e.frequency,name:e.campaignName,brandEntityId:e.brand,bidOptimization:e.isBid,bidOptimizationStrategy:"",startDate:e.startDate,endDate:e.endDate,smartDefault:"MANUAL",costType:"CPC",goal:"PAGE_VISIT",state:"PAUSED",...e.firstPage&&{h_percentage:e.firstPage},...e.commodityPage&&{d_percentage:e.commodityPage},...e.otherPlace&&{o_percentage:e.otherPlace},...e.adMix&&{portfolioId:e.adMix}};try{const a=await se(i);m.value=a.data.campaignId,c.value=a.data.campaignName,a.data.campaignId?(h.value=m.value,Y.value=c.value,m.value=a.data.campaignId,c.value=a.data.campaignName,z({message:"广告活动创建成功",type:"success"})):(h.value&&(m.value=h.value,c.value=Y.value),z.error("广告活动创建失败!"))}catch(a){console.error("请求失败:",a)}finally{v.value=!1}}const T=A;return k([m,c],()=>{m.value&&c.value&&T("update-campaign",{id:m.value,name:c.value})}),k(()=>e.brand,()=>{ie.emit("brandEntityId",y.value)}),Q(()=>{O(),E()}),(i,a)=>{const g=r("el-input"),d=r("el-form-item"),x=r("el-option"),w=r("el-select"),N=r("el-date-picker"),G=r("el-switch"),q=r("el-card"),j=r("el-button"),Z=r("el-form"),H=W("loading");return p(),_("div",re,[X((p(),V(q,{"body-style":"padding: 20px 80px 0 80px;"},{default:s(()=>[pe,l(Z,{ref_key:"campaignRuleFormRef",ref:M,model:e,rules:R,"label-position":"top","label-width":"120px",class:"demo-ruleForm",size:S.value,"status-icon":""},{default:s(()=>[o("div",ue,[l(d,{label:"广告活动名称",prop:"campaignName",style:{width:"48%"}},{default:s(()=>[l(g,{modelValue:e.campaignName,"onUpdate:modelValue":a[0]||(a[0]=t=>e.campaignName=t),placeholder:"请输入广告活动名称"},null,8,["modelValue"])]),_:1}),l(d,{label:"广告组合",prop:"adMix",style:{width:"48%"}},{default:s(()=>[l(w,{modelValue:e.adMix,"onUpdate:modelValue":a[1]||(a[1]=t=>e.adMix=t),placeholder:"请选择",style:{width:"100%"}},{default:s(()=>[(p(!0),_(D,null,P(C.value,t=>(p(),V(x,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),o("div",me,[o("div",ce,[l(d,{label:"开始时间",prop:"startDate",style:{width:"49%"}},{default:s(()=>[l(N,{modelValue:e.startDate,"onUpdate:modelValue":a[2]||(a[2]=t=>e.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}),l(d,{label:"结束时间",prop:"endDate",style:{width:"49%"}},{default:s(()=>[l(N,{modelValue:e.endDate,"onUpdate:modelValue":a[3]||(a[3]=t=>e.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})]),o("div",ge,[l(d,{label:"预算",required:"",prop:"budget",style:{width:"65%"}},{default:s(()=>[l(g,{modelValue:e.budget,"onUpdate:modelValue":a[4]||(a[4]=t=>e.budget=t),minlength:"1",maxlength:"7",placeholder:"请输入",style:{width:"100%"}},{prepend:s(()=>[f("$")]),_:1},8,["modelValue"])]),_:1}),l(d,{label:"频率",prop:"frequency",style:{width:"34%"}},{default:s(()=>[l(w,{modelValue:e.frequency,"onUpdate:modelValue":a[5]||(a[5]=t=>e.frequency=t),placeholder:"请选择",style:{width:"100%"}},{default:s(()=>[(p(),_(D,null,P(F,t=>l(x,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},null,8,["label","value","disabled"])),64))]),_:1},8,["modelValue"])]),_:1})])]),l(d,{label:"品牌",prop:"brand",required:"",style:{width:"48%"}},{default:s(()=>[l(w,{modelValue:e.brand,"onUpdate:modelValue":a[6]||(a[6]=t=>e.brand=t),placeholder:"请选择",style:{width:"100%"}},{default:s(()=>[(p(!0),_(D,null,P(y.value,t=>(p(),V(x,{key:t.brandId,label:t.brandRegistryName,value:t.brandEntityId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),fe,l(d,{label:"自动竞价",style:{"margin-bottom":"-13px"}},{default:s(()=>[l(d,null,{default:s(()=>[l(G,{modelValue:e.isBid,"onUpdate:modelValue":a[7]||(a[7]=t=>e.isBid=t)},null,8,["modelValue"]),_e]),_:1})]),_:1}),e.isBid==!1?(p(),_("div",be,[l(q,{shadow:"never","body-style":"padding: 10px 10px 5px 10px;"},{default:s(()=>[ye,o("div",ve,[he,l(d,{prop:"commodityPage",style:{"margin-bottom":"0px !important",width:"37%"}},{default:s(()=>[l(g,{modelValue:e.commodityPage,"onUpdate:modelValue":a[8]||(a[8]=t=>e.commodityPage=t),maxlength:"3",placeholder:"-99 ~ 900"},{append:s(()=>[f("%")]),_:1},8,["modelValue"])]),_:1})]),o("div",xe,[we,l(d,{prop:"firstPage",style:{"margin-bottom":"0px !important",width:"37%"}},{default:s(()=>[l(g,{modelValue:e.firstPage,"onUpdate:modelValue":a[9]||(a[9]=t=>e.firstPage=t),maxlength:"3",placeholder:"-99 ~ 900",style:{width:"100%"}},{append:s(()=>[f("%")]),_:1},8,["modelValue"])]),_:1})]),o("div",Ve,[De,l(d,{prop:"otherPlace",style:{"margin-bottom":"0px !important",width:"37%"}},{default:s(()=>[l(g,{modelValue:e.otherPlace,"onUpdate:modelValue":a[10]||(a[10]=t=>e.otherPlace=t),maxlength:"3",placeholder:"-99 ~ 900"},{append:s(()=>[f("%")]),_:1},8,["modelValue"])]),_:1})]),Pe]),_:1})])):ee("",!0),l(d,{style:{margin:"20px 0 -10px 48%"}},{default:s(()=>[l(j,{type:"primary",plain:"",onClick:a[11]||(a[11]=t=>$(M.value))},{default:s(()=>[f("保存")]),_:1})]),_:1})]),_:1},8,["model","rules","size"])]),_:1})),[[H,v.value]])])}}});const ze=ne(Ie,[["__scopeId","data-v-36f21bbc"]]);export{ze as default};