1 |
- import{u as Ze,r as P}from"./index.34b03be2.js";import{d as Je,r as i,B as _e,ay as Qe,Z as J,j as Ye,ai as u,aq as el,o as p,c as _,U as t,O as o,P as fe,a as s,F as Q,a8 as Y,S as d,T as m,R as w,u as k,M as ll,D as tl,aF as ol,aG as al}from"./vue.adf17aba.js";import{E as ee}from"./elementPlus.4833989a.js";import{_ as sl}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const C=E=>(ol("data-v-7dc6869e"),E=E(),al(),E),nl={style:{width:"100%","margin-top":"20px"}},il=C(()=>s("span",{style:{"font-size":"18px","font-weight":"700"}},"商品定向",-1)),dl={style:{width:"100%",height:"600px",display:"flex",border:"1px solid #e5e7eb","border-radius":"6px"}},rl={style:{width:"50%","border-right":"1px solid #e5e7eb"}},ul={style:{display:"flex","align-items":"center"}},cl=C(()=>s("span",{style:{width:"40px"}},"竞价:",-1)),pl={class:"custom-tree-node"},_l={style:{width:"75%"}},fl={key:0,style:{color:"rgb(50, 108, 216)"}},gl=["onClick"],ml=["onClick"],vl={style:{display:"flex","justify-content":"space-between"}},hl=C(()=>s("span",null,"根据特定品牌、价格范围、星级和Prime配送资格,细化分类",-1)),yl=C(()=>s("span",{style:{"margin-right":"10px",color:"#616266","font-weight":"500"}},"品牌",-1)),bl=C(()=>s("span",{style:{"margin-right":"10px",color:"#616266","font-weight":"500"}},"价格范围",-1)),wl=C(()=>s("span",{style:{"margin-right":"15px",color:"#616266","font-weight":"500"}},"查看星级评定",-1)),xl=C(()=>s("span",{style:{"margin-right":"10px",color:"#616266","font-weight":"500"}},"配送",-1)),Vl={style:{display:"flex","justify-content":"space-between"}},Cl={key:0},kl={class:"dialog-footer"},Sl={style:{display:"flex","align-items":"center"}},Tl=C(()=>s("span",{style:{width:"40px"}},"竞价:",-1)),Il={style:{display:"flex","align-items":"center"}},Al=["src"],Dl={key:0},Bl={key:1},Ol={style:{width:"50%"}},Pl={class:"card-header"},El={style:{"font-weight":"550","font-size":"15px",color:"#1f2128"}},Rl={class:"card-body"},Ul={key:0},Gl={style:{color:"#000000"}},Fl={key:1},$l={key:2},Nl={style:{color:"#000000"}},jl={key:3},Ll={style:{color:"#000000"}},Ml={key:4},zl={style:{color:"#000000"}},ql={key:5},Hl={style:{color:"#000000"}},Xl={style:{display:"flex","justify-content":"space-around","margin-top":"-8px"}},Kl=Je({__name:"ProductOrientation",setup(E){let R=i([]),ge=[];const le=i("first"),me=_e("respCampaignId"),te=_e("respAdGroupId"),ve=Ze(),{profile:A}=Qe(ve),oe=i("first"),U=i("customBid"),he=[{value:"defaultBid",label:"默认竞价"},{value:"customBid",label:"自定义竞价"}];i("0.75");const G=i("customBid"),ye=[{value:"defaultBid",label:"默认竞价"},{value:"customBid",label:"自定义竞价"}],D=i("0.75"),ae=i(!0),se=i(!1),ne=i([]),ie=i([]),x=i(!1),M=i(!1),be={children:"ch",label:"cna"},B=i(!1),O=i(!1);let z=i(""),F=i("");i(""),i([]);const n=J({prices:{lowest:void 0,highest:void 0},starRating:[0,5],dialogselectValue:[],delivery:"all",isCount:!1}),de=i(),we=J({prices:[{validator:Ve,trigger:"blur"}]}),xe=J({0:"0",1:"1",2:"2",3:"3",4:"4",5:"5"});let S=i([]),$=i(0),f=i([]);async function Ve(a,l){return l.highest!==""&&l.lowest!==""&&l.highest<=l.lowest?Promise.reject("最高价格必须大于最低价格"):Promise.resolve()}async function Ce(){x.value=!0;try{const a=await P({url:"/api/ad_manage/targetable/categories/",method:"GET",params:{profile_id:A.value.profile_id}});ie.value=a.data,x.value=!1}catch(a){console.error("请求失败:",a)}}async function ke(){try{const l=(await P({url:"/api/ad_manage/categories/brands/",method:"GET",params:{profile_id:A.value.profile_id,category_id:F.value}})).data;n.dialogOptions=l.brands.map(r=>({label:r.name,value:r.id})),M.value=!1}catch(a){console.error("请求失败:",a)}}async function Se(a){try{const l=await P({url:"/api/ad_manage/products/count/",method:"POST",data:{profile_id:A.value.profile_id,category_id:F.value}});a===$.value&&(S.value=l.data.AsinCounts)}catch(l){console.error("请求失败:",l)}finally{a===$.value&&(B.value=!1)}}function Te(){$.value++,Ie(),n.isCount=!1,S.value=[],B.value=!1}function Ie(){n.prices.lowest=void 0,n.prices.highest=void 0,n.starRating=[0,5],n.dialogselectValue=[],n.delivery="all",n.isCount=!1}function Ae(){if(n.isCount){const a=$.value;B.value=!0,Se(a)}else B.value=!1,S.value=[]}function De(a){f.value.splice(a,1)}function Be(){f.value=[]}function re(){(G.value==="defaultBid"||U.value==="defaultBid")&&(D.value="")}let N=i(""),ue=i([]);function Oe(a="",l=""){return P({url:"/api/sellers/listings/our/",method:"GET",params:{profile_id:A.value.profile_id,asin:a,sku:l}}).then(r=>{ue.value=r.data,x.value=!1}).catch(r=>{console.error("Error fetching data:",r),x.value=!1})}function Pe(){x.value=!0,Oe()}function Ee(a){console.log("🚀 ~ addSingleSearch ~ scope-->>",a);const l=[];ae.value&&l.push("ASIN_EXPANDED_FROM"),se.value&&l.push("ASIN_SAME_AS");const r={ASIN_EXPANDED_FROM:"扩展",ASIN_SAME_AS:"精确"};l.forEach(c=>{if(f.value.some(v=>v.sku===a.row.sku&&v.productType===c))console.log(`${c} item is already added.`);else{const v={type:"p",asin:a.row.asin,sku:a.row.sku,productType:c,productTypeText:r[c]};f.value.push(v)}})}let q=i([]);function Re(a){console.log("🚀 ~ dialogSelectChange ~ event-->>",a),q.value=a.map(l=>{const r=n.dialogOptions.find(c=>c.value===l);return r?r.label:""}),console.log("🚀 ~ dialogSelectChange ~ selectedLabels-->>",q.value)}let Ue=i([]);function Ge(a){console.log("🚀 ~ refine ~ data-->>",a),S.value=[],z.value=a.cna,F.value=a.cid,Ue.value.push(a),O.value=!0,M.value=!0,ke()}function Fe(){de.value.validate(a=>{if(a){console.log("表单提交"),O.value=!1;const l=z.value,r=n.prices.lowest,c=n.prices.highest,V=n.starRating,v=V[0],g=V[1],h=n.delivery;console.log("🚀 ~ dialogFormRef.value.validate ~ dialogDelivery-->>",h);const T={all:"所有",eligible:"具备Prime资格",diseligible:"不具备Prime资格"};q.value.forEach(b=>{const j=n.dialogOptions.find(I=>I.label===b),X=j?j.value:"",L={type:"c",classification:l,classificationId:F.value,brand:b,brandId:X,low_price:r,high_price:c,low_rating:v,high_rating:g,delivery:h,deliveryText:T[h]};console.log("🚀 ~ dialogFormRef.value.validate ~ refineObj-->>",L),f.value.push(L)})}else console.log("验证失败")})}function $e(a,l){if(console.log("🚀 ~ orientate ~ data-->>",l),!f.value.some(c=>c.cid===l.cid)){const c={type:"c",classification:l.cna,classificationId:l.cid};f.value.push(c)}}let H=i([]);async function Ne(){if(console.log("tableData",f.value),f.value.some(l=>l.bid==null||l.bid==="")){console.log("存在空的 bid,不发送请求"),ee.error("存在空的 bid,无法创建商品!");return}f.value.forEach(l=>{H.value.push(l.bid)}),console.log("productTargetBidList",H.value),x.value=!0;try{const l={profile_id:A.value.profile_id,adGroupId:te.value,campaignId:me.value,expressionList:f.value,state:"PAUSED"},r=Object.fromEntries(Object.entries(l).filter(([V,v])=>v!=null)),c=await P({url:"/api/ad_manage/sptargets/manual/create/",method:"POST",data:r});console.log("🚀 ~ createTargetGroup ~ resp-->>",c),x.value=!1,te.value?ee({message:"商品创建成功",type:"success"}):ee.error("商品创建失败!")}catch(l){console.error("请求失败:",l)}f.value=[],H.value=[]}function je(){const a=ge.filter(l=>!R.value.some(r=>r.sku===l.sku));a.length>0&&R.value.push(...a)}function Le(a){R.value.some(r=>r.sku===a.row.sku)?console.log("Item is already added."):R.value.push(a.row)}const Me=a=>{if(a.rowIndex===0)return{backgroundColor:"rgba(245, 245, 245, 0.9)"}};function ze(a){if(a.rowIndex===0)return{color:"#505968",backgroundColor:"rgba(245, 245, 245, 0.9)"}}return Ye(()=>{Ce()}),(a,l)=>{const r=u("el-divider"),c=u("el-option"),V=u("el-select"),v=u("el-input"),g=u("el-table-column"),h=u("el-button"),T=u("el-table"),b=u("el-tab-pane"),j=u("el-tree"),X=u("el-scrollbar"),L=u("el-checkbox"),I=u("el-form-item"),K=u("el-input-number"),qe=u("el-slider"),W=u("el-radio"),He=u("el-radio-group"),Xe=u("el-form"),Ke=u("el-dialog"),Z=u("el-tabs"),We=u("el-card"),ce=el("loading");return p(),_("div",nl,[t(r,{"content-position":"left"},{default:o(()=>[il]),_:1}),fe((p(),_("div",dl,[s("div",rl,[t(Z,{type:"border-card",stretch:"",class:"goods-orientation-tabs",style:{border:"0","border-right":"0","border-bottom-left-radius":"6px","border-top-left-radius":"5px",overflow:"hidden"}},{default:o(()=>[t(b,{label:"品类",style:{"border-top-left-radius":"6px"}},{default:o(()=>[s("div",ul,[cl,t(V,{modelValue:U.value,"onUpdate:modelValue":l[0]||(l[0]=e=>U.value=e),onChange:re,class:"m-2",placeholder:"Select"},{default:o(()=>[(p(),_(Q,null,Y(he,e=>t(c,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),t(v,{modelValue:D.value,"onUpdate:modelValue":l[1]||(l[1]=e=>D.value=e),disabled:U.value==="defaultBid",style:{width:"200px"}},{prepend:o(()=>[d("$")]),_:1},8,["modelValue","disabled"])]),t(Z,{modelValue:oe.value,"onUpdate:modelValue":l[10]||(l[10]=e=>oe.value=e),class:"category-tabs"},{default:o(()=>[t(b,{label:"建议",name:"first"},{default:o(()=>[t(T,{data:ne.value,style:{width:"100%"},height:"422"},{default:o(()=>[t(g,{prop:"proposal",label:"建议",width:"520"},{header:o(()=>[d(" 0建议 ")]),_:1}),t(g,{prop:"address",label:"Address"},{header:o(()=>[t(h,{type:"primary",size:"normal",link:"",onClick:je},{default:o(()=>[d("全部添加")]),_:1})]),default:o(e=>[t(h,{type:"primary",size:"small",onClick:y=>Le(e),text:""},{default:o(()=>[d("添加")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1}),t(b,{label:"搜索",name:"second"},{default:o(()=>[t(v,{placeholder:"请输入关键词过滤"}),t(X,{height:"390px"},{default:o(()=>[t(j,{data:ie.value,props:be},{default:o(({node:e,data:y})=>[s("span",pl,[s("span",_l,m(e.label),1),y.ta==!0?(p(),_("span",fl,[s("a",{onClick:pe=>Ge(y)}," 细化 ",8,gl),s("a",{style:{"margin-left":"8px"},onClick:pe=>$e(e,y)}," 定向 ",8,ml)])):w("",!0)])]),_:1},8,["data"])]),_:1}),t(Ke,{modelValue:O.value,"onUpdate:modelValue":l[9]||(l[9]=e=>O.value=e),title:`细化分类: ${k(z)}`,onClose:Te,"destroy-on-close":""},{footer:o(()=>{var e,y;return[s("div",Vl,[fe((p(),_("span",null,[d("定位到的商品数量: "),n.isCount==!0?(p(),_("span",Cl,m((e=k(S)[0])==null?void 0:e.min)+" - "+m((y=k(S)[0])==null?void 0:y.max),1)):w("",!0)])),[[ce,B.value]]),s("span",kl,[t(h,{onClick:l[8]||(l[8]=pe=>O.value=!1)},{default:o(()=>[d("取消")]),_:1}),t(h,{type:"primary",onClick:Fe},{default:o(()=>[d("确定")]),_:1})])])]}),default:o(()=>[s("div",vl,[hl,s("span",null,[t(L,{modelValue:n.isCount,"onUpdate:modelValue":l[2]||(l[2]=e=>n.isCount=e),label:"显示商品数量",onChange:Ae},null,8,["modelValue"])])]),t(Xe,{model:n,rules:we,ref_key:"dialogFormRef",ref:de,style:{"margin-top":"20px"}},{default:o(()=>[t(I,{style:{"padding-left":"140px"}},{default:o(()=>[yl,t(V,{modelValue:n.dialogselectValue,"onUpdate:modelValue":l[3]||(l[3]=e=>n.dialogselectValue=e),onChange:Re,multiple:"",placeholder:"请选择",loading:M.value},{default:o(()=>[(p(!0),_(Q,null,Y(n.dialogOptions,e=>(p(),ll(c,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),t(I,{prop:"prices",style:{"padding-left":"112px","margin-top":"10px"}},{default:o(()=>[bl,t(K,{modelValue:n.prices.lowest,"onUpdate:modelValue":l[4]||(l[4]=e=>n.prices.lowest=e),min:1,controls:!1,placeholder:"无最低商品价格"},null,8,["modelValue"]),d(" -- "),t(K,{modelValue:n.prices.highest,"onUpdate:modelValue":l[5]||(l[5]=e=>n.prices.highest=e),min:1,controls:!1,placeholder:"无最高商品价格"},null,8,["modelValue"])]),_:1}),t(I,{prop:"starRating",style:{"padding-left":"85px","margin-top":"10px"}},{default:o(()=>[wl,t(qe,{modelValue:n.starRating,"onUpdate:modelValue":l[6]||(l[6]=e=>n.starRating=e),range:"","show-stops":"",max:5,marks:xe,style:{width:"70%"}},null,8,["modelValue","marks"])]),_:1}),t(I,{prop:"delivery",style:{"padding-left":"140px","margin-top":"30px"}},{default:o(()=>[xl,t(He,{modelValue:n.delivery,"onUpdate:modelValue":l[7]||(l[7]=e=>n.delivery=e)},{default:o(()=>[t(W,{label:"all",style:{"font-weight":"400"}},{default:o(()=>[d("所有")]),_:1}),t(W,{label:"eligible",style:{"font-weight":"400"}},{default:o(()=>[d("具备Prime资格")]),_:1}),t(W,{label:"diseligible",style:{"font-weight":"400"}},{default:o(()=>[d("不具备Prime资格")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(b,{label:"单个商品"},{default:o(()=>[s("div",Sl,[Tl,t(V,{class:"m-2",modelValue:G.value,"onUpdate:modelValue":l[11]||(l[11]=e=>G.value=e),onChange:re},{default:o(()=>[(p(),_(Q,null,Y(ye,e=>t(c,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),t(v,{modelValue:D.value,"onUpdate:modelValue":l[12]||(l[12]=e=>D.value=e),disabled:G.value=="defaultBid",style:{width:"200px"}},{prepend:o(()=>[d("$")]),_:1},8,["modelValue","disabled"])]),t(Z,{modelValue:le.value,"onUpdate:modelValue":l[14]||(l[14]=e=>le.value=e),class:"category-tabs"},{default:o(()=>[t(b,{label:"建议",name:"first"},{default:o(()=>[t(T,{data:ne.value,style:{width:"100%"},height:"342"},{default:o(()=>[t(g,{prop:"proposal",label:"商品",width:"520"}),t(g,{prop:"address",label:"类型"}),t(g,{prop:"operational",label:"操作"})]),_:1},8,["data"])]),_:1}),t(b,{label:"搜索",name:"second"},{default:o(()=>[t(v,{modelValue:k(N),"onUpdate:modelValue":l[13]||(l[13]=e=>tl(N)?N.value=e:N=e),onChange:Pe,placeholder:"按ASIN搜索"},null,8,["modelValue"]),t(T,{data:k(ue),style:{width:"100%"},height:"309"},{default:o(()=>[t(g,{prop:"asin",label:"商品",width:"520"},{default:o(({row:e})=>[s("div",Il,[s("img",{src:e.image_link,style:{width:"40px",height:"40px","margin-right":"10px"}},null,8,Al),s("span",null,m(e.title),1)])]),_:1}),t(g,{prop:"productTypes",label:"类型"},{default:o(e=>[ae.value?(p(),_("div",Dl,"扩展")):w("",!0),se.value?(p(),_("div",Bl,"精准")):w("",!0)]),_:1}),t(g,{prop:"operational",label:"操作"},{default:o(e=>[t(h,{class:"button",text:"",onClick:y=>Ee(e)},{default:o(()=>[d("添加")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1}),t(b,{label:"输入",name:"third"},{default:o(()=>[d("待完成")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),s("div",Ol,[t(We,{class:"box-card",shadow:"never",style:{border:"none"}},{header:o(()=>[s("div",Pl,[s("span",El,"已添加: "+m(k(f).length),1),t(h,{class:"button",type:"danger",text:"",bg:"",onClick:Be},{default:o(()=>[d("全部删除")]),_:1})])]),default:o(()=>[s("div",Rl,[t(T,{height:"460",data:k(f),style:{width:"100%"},"header-row-style":ze,"header-cell-style":Me},{default:o(()=>[t(g,{prop:"cna",label:"分类 & 商品",width:"300"},{default:o(e=>[e.row.cna||e.row.classification?(p(),_("div",Ul,[d(" 分类: "),s("span",Gl,m(e.row.cna?e.row.cna:e.row.classification),1)])):w("",!0),e.row.asin?(p(),_("div",Fl,m(e.row.asin?e.row.asin:"--"),1)):w("",!0),e.row.brand?(p(),_("div",$l,[d(" 品牌: "),s("span",Nl,m(e.row.brand),1)])):w("",!0),e.row.low_price||e.row.high_price?(p(),_("div",jl,[d(" 品牌价格: "),s("span",Ll,m(e.row.low_price?"$"+e.row.low_price:"--")+" - "+m(e.row.high_price?"$"+e.row.high_price:"--"),1)])):w("",!0),e.row.low_rating||e.row.high_rating?(p(),_("div",Ml,[d(" 评分: "),s("span",zl,m(e.row.low_rating)+" - "+m(e.row.high_rating),1)])):w("",!0),e.row.deliveryText?(p(),_("div",ql,[d(" 配送: "),s("span",Hl,m(e.row.deliveryText),1)])):w("",!0)]),_:1}),t(g,{prop:"type",label:"类型"},{default:o(e=>[d(m(e.row.productTypeText?e.row.productTypeText:"--"),1)]),_:1}),t(g,{prop:"bid",label:"竞价"},{default:o(e=>[t(K,{modelValue:e.row.bid,"onUpdate:modelValue":y=>e.row.bid=y,min:.02,max:1e6,controls:!1,size:"small"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),t(g,{prop:"operate",label:"操作",width:"60",align:"right"},{default:o(e=>[t(h,{text:"",size:"small",onClick:y=>De(e.$index)},{default:o(()=>[d("删除")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1}),s("div",Xl,[t(h,{type:"primary",plain:"",onClick:Ne},{default:o(()=>[d("保存")]),_:1})])])])),[[ce,x.value]])])}}});const et=sl(Kl,[["__scopeId","data-v-7dc6869e"]]);export{et as default};
|