1 |
- import{u as Y,i as Z,l as ye}from"./index.6717ff78.js";import{v as $,p as he,E as g}from"./elementPlus.4833989a.js";import{e as H}from"./emitter.c27b7986.js";import{d as be,ay as xe,B as N,r as p,Z as K,w as Q,j as we,Y as Ie,ai as n,aq as Fe,o as _,c as b,U as s,O as o,P as E,u as k,a as t,S as c,M as G,F as Ne,a8 as ke,T as W,aF as De,aG as Ce}from"./vue.adf17aba.js";import{u as Le}from"./index.b098562c.js";import{_ as Se}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const i=x=>(De("data-v-9e379b8c"),x=x(),Ce(),x),Ve={class:"customize-container"},Ae=i(()=>t("div",{style:{"font-weight":"700","padding-bottom":"18px"}},[t("span",{style:{color:"#306cd7","font-size":"26px"}},"|"),t("span",{style:{"font-size":"18px","padding-left":"5px"}},"创意")],-1)),Ue={style:{display:"flex",border:"1px solid #dddfe6",padding:"0 0 0 5px","margin-bottom":"20px"}},Ee={style:{width:"50%","padding-left":"5px","border-right":"1px solid #dddfe6"}},Ge=i(()=>t("span",{style:{color:"#e47470","margin-right":"4px"}},"*",-1)),Te=i(()=>t("div",{class:"el-upload__text"},[c("Drop file here or "),t("em",null,"click to upload")],-1)),Be={style:{"margin-top":"10px"}},Pe={style:{display:"flex","align-items":"center","justify-content":"space-between"}},je=i(()=>t("span",{style:{"line-height":"17px","font-weight":"600",color:"#1e2128"}},"徽标规格",-1)),Me=i(()=>t("div",{class:"introduce-item"},"1、图片大小: 400x400 像素或更大",-1)),ze=i(()=>t("div",{class:"introduce-item"},"2、文件大小: 1MB 或更小",-1)),Oe=i(()=>t("div",{class:"introduce-item"},"3、文件格式: PNG 或 JPG",-1)),qe={class:"introduce-item"},Je={style:{"margin-left":"25px",position:"relative"}},Re=["src"],Ye={style:{"margin-top":"10px"}},Ze={style:{display:"flex","align-items":"center","justify-content":"space-between"}},$e=i(()=>t("span",{style:{"line-height":"17px","font-weight":"600",color:"#1e2128"}},"图片规格",-1)),He=i(()=>t("div",{class:"introduce-item"},"1、图片大小: 1200 x 628 像素或更大",-1)),Ke=i(()=>t("div",{class:"introduce-item"},"2、文件大小: 5MB 或更小",-1)),Qe=i(()=>t("div",{class:"introduce-item"},"3、文件格式: PNG 或 JPG",-1)),We=i(()=>t("div",{class:"introduce-item"},"4、内容: 图片中未添加文本、图形或徽标",-1)),Xe=i(()=>t("span",{style:{color:"#e47470","margin-right":"4px"}},"*",-1)),et={style:{padding:"10px",display:"flex","align-items":"center"}},tt={style:{"margin-right":"8px","line-height":"normal"}},ot={style:{position:"relative"}},at={class:"single-line"},st=i(()=>t("span",{style:{color:"#6d7784"}},"ASIN: ",-1)),lt={class:"data-color",style:{"margin-right":"8px"}},nt=i(()=>t("span",{style:{color:"#e47470","margin-right":"4px"}},"*",-1)),it={style:{width:"50%",padding:"0 10px",position:"relative"}},dt=be({__name:"ProductSetCreativity2",setup(x){const X=Le(),{profile:v}=xe(X),ee=N("respAdGroupId"),te=N("setBrandName"),oe=N("addedTableDataForVc2"),T=p(),u=K({name:"",brandName:"",title:""}),ae=K({name:[{required:!0,message:"请输入广告名称",trigger:"blur"}],brandName:[{required:!0,message:"请输入品牌名称",trigger:"blur"}],title:[{required:!0,message:"请输入标题",trigger:"blur"}]}),se=async a=>{a&&await a.validate((e,d)=>{e?(console.log("submit!"),ce()):console.log("error submit!",d)})},B=p(["1"]),le=a=>{console.log(a)},w=p([]),P=p([]),j=(a,e)=>{w.value=[]},D=p(!1);let M="",C={},L=p(!1);const z=N("brandEntityId");function ne(a){ie(a)}async function ie(a){const e=new FormData;e.append("file",a.raw),e.append("profile_id",v.value.profile_id),e.append("brandEntityId",z.value),e.append("assetType","IMAGE"),e.append("assetSubTypeList",JSON.stringify(["LOGO"])),D.value=!0;try{const m=(await Y(e)).data.file_name,y={profile_id:v.value.profile_id,file_name:m},r=await Z(y);M=r.data.assetId;const{width:f,height:h}=r.data.fileMetadata;C={width:f,height:h,top:0,left:0},r.data.checkresult=="success"?g({message:"上传成功",type:"success"}):g.error("上传失败")}catch(d){console.error("上传失败:",d)}finally{D.value=!1}}const S=p(!1),V=p("");let O="",de={};function re(a){pe(a)}async function pe(a){const e=new FormData;e.append("file",a.raw),e.append("profile_id",v.value.profile_id),e.append("brandEntityId",z.value),e.append("assetType","IMAGE"),e.append("assetSubTypeList",JSON.stringify(["LOGO"])),S.value=!0;try{const m=(await Y(e)).data.file_name,y={profile_id:v.value.profile_id,file_name:m},r=await Z(y);O=r.data.assetId;const{width:f,height:h}=r.data.fileMetadata;C={width:f,height:h,top:0,left:0},r.data.checkresult=="success"?g({message:"上传成功",type:"success"}):g.error("上传失败")}catch(d){console.error("上传失败:",d)}finally{S.value=!1}}async function ce(){L.value=!0;try{const a={profile_id:v.value.profile_id,casins:V.value,lasins:V.value,url:"https://www.amazon.com/stores/page/1D1DD2FD-CF54-4FE5-B1A0-9E01F12F8144",name:u.name,state:"PAUSED",adGroupId:ee.value,brandName:te.value,brandLogoCrop:C,brandLogoAssetID:M,customImageCrop:de,customImageAssetId:O,headline:u.title};(await ye(a)).data.creative_state=="success"?g({message:"创建成功",type:"success"}):g.error("上传失败")}catch(a){console.error("error:",a)}finally{L.value=!1}}let I=p([]);Q(oe,a=>{I.value=[],Array.isArray(a)&&a.length>0&&a.forEach(e=>{e.asin&&!I.value.includes(e.asin)&&I.value.push(e.asin)}),console.log("Updated ASINs:",I.value)},{deep:!0});const A=p([]);Q(A,a=>{V.value=a.map(e=>e.asin)},{deep:!0}),we(()=>{H.on("addedTableData",a=>{A.value=a})}),Ie(()=>{H.off("addedTableData")});const q=p("");return(a,e)=>{const d=n("el-input"),m=n("el-form-item"),y=n("upload-filled"),r=n("el-icon"),f=n("el-button"),h=n("Link"),ue=n("el-link"),J=n("el-upload"),F=n("el-collapse-item"),_e=n("el-image"),me=n("el-tooltip"),R=n("el-card"),fe=n("el-collapse"),ge=n("el-scrollbar"),ve=n("el-form"),U=Fe("loading");return _(),b("div",Ve,[s(R,{"body-style":"padding: 20px 80px 0 80px;"},{default:o(()=>[Ae,s(ve,{ref_key:"ruleFormRef",ref:T,model:u,rules:ae,"label-width":"120px",class:"demo-ruleForm",size:"default","label-position":"top","status-icon":""},{default:o(()=>[s(m,{label:"广告名称",prop:"name"},{default:o(()=>[s(d,{modelValue:u.name,"onUpdate:modelValue":e[0]||(e[0]=l=>u.name=l),style:{width:"50%"}},null,8,["modelValue"])]),_:1}),E((_(),b("div",Ue,[t("div",Ee,[s(ge,{height:"700px"},{default:o(()=>[s(fe,{modelValue:B.value,"onUpdate:modelValue":e[5]||(e[5]=l=>B.value=l),onChange:le,style:{"border-top":"none","border-bottom":"none","padding-right":"10px"}},{default:o(()=>[s(F,{name:"1"},{title:o(()=>[Ge,c("品牌名称和徽标")]),default:o(()=>[s(m,{prop:"brandName"},{default:o(()=>[s(d,{modelValue:u.brandName,"onUpdate:modelValue":e[1]||(e[1]=l=>u.brandName=l),placeholder:"请输入品牌名称",style:{padding:"0 10px 5px 0"}},null,8,["modelValue"])]),_:1}),E((_(),G(J,{drag:"","file-list":w.value,"onUpdate:fileList":e[2]||(e[2]=l=>w.value=l),"on-change":ne,action:"#",accept:".png, .jpg","auto-upload":!1,"on-remove":j,style:{"padding-right":"10px"}},{tip:o(()=>[t("div",Be,[t("div",Pe,[je,s(f,{type:"primary",icon:k($)},{default:o(()=>[c("从素材库中选择")]),_:1},8,["icon"])]),Me,ze,Oe,t("div",qe,[c(" 4、内容: 徽标必须填满图片或置于白色或透明背景上详细了解我们的徽标要求 "),t("span",Je,[s(r,{size:"14",style:{position:"absolute",left:"-14px",top:"1px"}},{default:o(()=>[s(h)]),_:1}),s(ue,{type:"primary",underline:!1,href:"https://advertising.amazon.com/resources/ad-policy/sponsored-ads-policies#brandlogo",target:"_blank"},{default:o(()=>[c("查看要求")]),_:1})])])])]),default:o(()=>[s(r,{class:"el-icon--upload"},{default:o(()=>[s(y)]),_:1}),Te]),_:1},8,["file-list"])),[[U,D.value]])]),_:1}),s(F,{name:"2"},{title:o(()=>[c("自定义图片(可选)")]),default:o(()=>[E((_(),G(J,{class:"avatar-uploader","file-list":P.value,"onUpdate:fileList":e[3]||(e[3]=l=>P.value=l),"on-change":re,action:"#",accept:".png, .jpg","auto-upload":!1,"on-remove":j,style:{"padding-right":"10px"}},{tip:o(()=>[t("div",Ye,[t("div",Ze,[$e,s(f,{type:"primary",icon:k($)},{default:o(()=>[c("从素材库中选择")]),_:1},8,["icon"])]),He,Ke,Qe,We])]),default:o(()=>[q.value?(_(),b("img",{key:0,src:q.value,class:"avatar"},null,8,Re)):(_(),G(r,{key:1,class:"avatar-uploader-icon"},{default:o(()=>[s(k(he))]),_:1}))]),_:1},8,["file-list"])),[[U,S.value]])]),_:1}),s(F,{name:"3"},{title:o(()=>[Xe,c("商品")]),default:o(()=>[(_(!0),b(Ne,null,ke(A.value,l=>(_(),b("div",{key:l.asin,style:{"padding-bottom":"5px"}},[s(R,{shadow:"hover","body-style":"padding: 10px"},{default:o(()=>[t("div",et,[t("div",tt,[s(_e,{class:"img-box",src:l.image_link},null,8,["src"])]),t("div",ot,[s(me,{class:"box-item",effect:"dark",content:l.title,placement:"top"},{default:o(()=>[t("div",at,W(l.title),1)]),_:2},1032,["content"]),t("span",null,[st,t("span",lt,W(l.asin),1)])])])]),_:2},1024)]))),128))]),_:1}),s(F,{name:"4"},{title:o(()=>[nt,c("标题")]),default:o(()=>[s(m,{prop:"title"},{default:o(()=>[s(d,{modelValue:u.title,"onUpdate:modelValue":e[4]||(e[4]=l=>u.title=l),maxlength:"50",placeholder:"请输入标题","show-word-limit":"",style:{padding:"0 10px 0 0"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),t("div",it,[s(f,{type:"primary",plain:"",onClick:e[6]||(e[6]=l=>se(T.value)),disabled:!w.value.length,style:{position:"absolute",top:"92%",left:"46%"}},{default:o(()=>[c(" 保存 ")]),_:1},8,["disabled"])])])),[[U,k(L)]])]),_:1},8,["model","rules"])]),_:1})])}}});const gt=Se(dt,[["__scopeId","data-v-9e379b8c"]]);export{gt as default};
|