1 |
- import{u as ae,r as U}from"./index.34b03be2.js";import{d as le,r as i,B as z,ay as oe,Z as se,ai as d,aq as ne,o as I,c as B,U as t,O as l,P as j,u as ie,a as o,M as de,T as g,S as c,aF as re,aG as ce}from"./vue.adf17aba.js";import{E as q}from"./elementPlus.4833989a.js";import{_ as ue}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const L=v=>(re("data-v-700bf56e"),v=v(),ce(),v),pe={prop:"matchType",style:{width:"100%","margin-top":"20px"}},_e=L(()=>o("span",{style:{"font-size":"18px","font-weight":"700"}},"否定商品",-1)),ge={style:{width:"100%",height:"600px",display:"flex",border:"1px solid #e5e7ec","border-radius":"6px"}},ve={style:{width:"50%","border-right":"1px solid #e5e7ec"}},me={style:{"margin-bottom":"10px"}},fe={style:{display:"flex","align-items":"center"}},he={style:{"margin-right":"8px","line-height":"normal"}},ye={class:"single-line"},be={class:"data-color",style:{"margin-right":"8px"}},xe={style:{display:"flex","flex-direction":"row-reverse","margin-top":"10px"}},we={style:{width:"50%"}},Ie={class:"card-header"},Ne={style:{"font-weight":"550","font-size":"15px",color:"#1f2128"}},Se=L(()=>o("div",{class:"card-body"},null,-1)),Ge={style:{padding:"0 10px 0 10px","margin-top":"-30px"}},Ae={style:{display:"flex","align-items":"center"}},Ce={style:{"margin-right":"8px","line-height":"normal"}},ke={class:"single-line"},Te={class:"data-color",style:{"margin-right":"8px"}},Ve={style:{display:"flex","justify-content":"space-around","padding-top":"10px"}},De=le({__name:"NegativeGood",setup(v){const O=i(),P=i(20);i();const N=i("first"),S=i("first"),b=i(!1),M=z("respCampaignId"),R=z("respAdGroupId"),$=ae(),{profile:G}=oe($),x=i([]),n=i([]);let u=i(!1),F=se([]),A=i([]);const C=i("");function k(s=""){return u.value=!0,U({url:"/api/sellers/listings/all/",method:"GET",params:{page:O.value,limit:P.value,profile_id:G.value.profile_id,asin:s}}).then(a=>{x.value=a.data,A.value=a.data,u.value=!1}).catch(a=>{console.error("Error fetching data:",a),u.value=!1})}const m=i("");function W(){console.log("negativeGoodsTextarea",m.value),b.value=!0,k(m.value).then(()=>{n.value=[...n.value,...A.value]}).catch(s=>{console.error("Error fetching data:",s)}).finally(()=>{b.value=!1})}function Z(s){n.value.some(r=>r.asin===s.row.asin)?console.log("Item is already added."):n.value.push(s.row)}function H(){n.value=[]}function J(s){const a=n.value.findIndex(r=>r.asin===s.row.asin);a!==-1?(n.value.splice(a,1),console.log("Item removed successfully.")):console.log("Item not found.")}function K(s){console.log(s),s===""?x.value=[]:k(s)}function Q(s){}async function X(){console.log(n.value);const s=n.value.map(a=>a.asin);console.log("🚀 ~ negativeGoodsSave ~ asinList-->>",s),u.value=!0,console.log("addedNegetiveTableData",n.value);try{const a={profile_id:G.value.profile_id,campaignId:M.value,adGroupId:R.value,asinList:s,matchType:"ASIN_SAME_AS",state:"PAUSED"},r=Object.fromEntries(Object.entries(a).filter(([w,f])=>f!=null)),p=await U({url:"/api/ad_manage/sptargets/add/negative/targets/",method:"POST",data:r});console.log("🚀 ~ negativeWordsSave ~ resp-->>",p),u.value=!1,p.data.success.length!==0?(q({message:"否定商品创建成功",type:"success"}),Y()):q.error("否定商品创建失败!")}catch(a){console.error("请求失败:",a)}}function Y(){F.length=0}const T=s=>{if(s.rowIndex===0)return{backgroundColor:"rgba(245, 245, 245, 0.9)"}};return(s,a)=>{const r=d("el-divider"),p=d("el-input"),w=d("el-image"),f=d("el-tooltip"),h=d("el-table-column"),_=d("el-button"),V=d("el-table"),y=d("el-tab-pane"),D=d("el-tabs"),ee=d("el-card"),E=ne("loading");return I(),B("div",pe,[t(r,{"content-position":"left"},{default:l(()=>[_e]),_:1}),j((I(),B("div",ge,[o("div",ve,[t(D,{modelValue:S.value,"onUpdate:modelValue":a[3]||(a[3]=e=>S.value=e),stretch:""},{default:l(()=>[t(y,{label:"排除商品",name:"first"},{default:l(()=>[t(D,{modelValue:N.value,"onUpdate:modelValue":a[2]||(a[2]=e=>N.value=e),class:"demo-tabs"},{default:l(()=>[t(y,{label:"搜索",name:"first"},{default:l(()=>[o("div",me,[t(p,{placeholder:"按ASIN搜索",modelValue:C.value,"onUpdate:modelValue":a[0]||(a[0]=e=>C.value=e),onChange:K,clearable:""},null,8,["modelValue"])]),j((I(),de(V,{height:"495",style:{width:"100%"},data:x.value,"header-cell-style":T,"show-header":!1},{default:l(()=>[t(h,{prop:"asin",label:"商品"},{default:l(e=>[o("div",fe,[o("div",he,[t(w,{class:"img-box",src:e.row.image_link},null,8,["src"])]),o("div",null,[t(f,{class:"box-item",effect:"dark",content:e.row.title,placement:"top"},{default:l(()=>[o("div",ye,g(e.row.title?e.row.title:"--"),1)]),_:2},1032,["content"]),o("span",null,[c(" ASIN: "),o("span",be,g(e.row.asin?e.row.asin:"--"),1)])])])]),_:1}),t(h,{prop:"name",label:"Name",width:"120",align:"right"},{header:l(()=>[]),default:l(e=>[t(_,{type:"primary",size:"small",onClick:te=>Z(e),text:""},{default:l(()=>[c("添加")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])),[[E,b.value]])]),_:1}),t(y,{label:"输入",name:"second"},{default:l(()=>[t(p,{modelValue:m.value,"onUpdate:modelValue":a[1]||(a[1]=e=>m.value=e),rows:17,type:"textarea",disabled:"true",maxlength:"11000",style:{padding:"10px 10px"}},null,8,["modelValue"]),o("div",xe,[t(_,{style:{"margin-right":"10px"},type:"primary",text:"",bg:"",onClick:W},{default:l(()=>[c("添加")]),_:1})])]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(y,{label:"排除品牌",name:"second"})]),_:1},8,["modelValue"])]),o("div",we,[t(ee,{class:"box-card",shadow:"never",style:{border:"none"}},{header:l(()=>[o("div",Ie,[o("span",Ne,"已添加: "+g(n.value.length),1),t(_,{class:"button",type:"danger",text:"",bg:"",onClick:H},{default:l(()=>[c("全部删除")]),_:1})])]),default:l(()=>[Se]),_:1}),o("div",Ge,[t(V,{data:n.value,height:"473",style:{width:"100%"},"header-cell-style":T,onSelectionChange:Q},{default:l(()=>[t(h,{prop:"asin",label:"商品"},{default:l(e=>[o("div",Ae,[o("div",Ce,[t(w,{class:"img-box",src:e.row.image_link},null,8,["src"])]),o("div",null,[t(f,{class:"box-item",effect:"dark",content:e.row.title,placement:"top"},{default:l(()=>[o("div",ke,g(e.row.title?e.row.title:"--"),1)]),_:2},1032,["content"]),o("span",null,[c("ASIN: "),o("span",Te,g(e.row.asin?e.row.asin:"--"),1)])])])]),_:1}),t(h,{label:"操作",width:"120",align:"right"},{default:l(e=>[t(_,{type:"primary",size:"small",onClick:te=>J(e),text:""},{default:l(()=>[c("删除")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),o("div",Ve,[t(_,{plain:"",type:"primary",onClick:X,disabled:!n.value.length},{default:l(()=>[c("保存")]),_:1},8,["disabled"])])])])),[[E,ie(u)]])])}}});const qe=ue(De,[["__scopeId","data-v-700bf56e"]]);export{qe as default};
|