1 |
- import{d as pe,ay as _e,r as d,B as k,w as F,j as me,ai as r,aq as he,P as K,o as I,c as L,a,U as t,O as s,M as fe,T as c,S as u,F as ve,a8 as ge,u as j,aF as ye,aG as we}from"./vue.adf17aba.js";import{e as xe}from"./emitter.233282e9.js";import{u as be,r as Se}from"./index.34b03be2.js";import{_ as Ce}from"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.js";import"./echarts.72dc8373.js";const V=y=>(ye("data-v-f407db33"),y=y(),we(),y),ke={prop:"commodity",style:{width:"100%"}},Ie={style:{width:"100%",height:"620px",display:"flex",border:"1px solid #e5e7ec","border-radius":"6px"}},Ve={style:{width:"50%","border-right":"1px solid #e5e7ec"}},Ae={style:{"margin-bottom":"10px"}},Ne={style:{display:"flex","align-items":"center"}},Te={style:{"margin-right":"8px","line-height":"normal"}},ze={class:"single-line"},De={class:"data-color"},Ge={style:{"font-weight":"500",color:"rgb(30, 33, 41)"}},Ue=V(()=>a("span",{style:{margin:"0 5px",color:"#cacdd4"}},"|",-1)),Ee={style:{color:"#6d7784"}},Pe={class:"data-color",style:{"margin-right":"8px"}},$e={class:"data-color"},Be={style:{display:"flex","flex-direction":"row-reverse","margin-top":"10px"}},qe={style:{width:"50%"}},Fe={class:"card-header"},Ke={style:{"font-weight":"550","font-size":"15px",color:"#1f2128"}},Le=V(()=>a("div",{class:"card-body"},null,-1)),je={style:{padding:"0 10px 0 10px","margin-top":"-12px"}},Me={style:{display:"flex","align-items":"center"}},Oe={style:{"margin-right":"8px","line-height":"normal"}},Re={class:"single-line"},He={class:"data-color"},Je={style:{"font-weight":"500",color:"rgb(30, 33, 41)"}},Qe=V(()=>a("span",{style:{margin:"0 5px",color:"#cacdd4"}},"|",-1)),We={style:{color:"#6d7784"}},Xe={class:"data-color",style:{"margin-right":"8px"}},Ye={class:"data-color"},Ze=pe({__name:"ProductSetCommodity",setup(y){const M=be(),{profile:O}=_e(M),x=d(""),R=d(!1);let A=d([]);const g=d(),b=d(20),N=d(),T=d([]),p=d(!1);let i=d([]),z=[],S=[];const w=d(""),m=d("name"),H=[{type:"primary",text:"添加"}],D=d("first"),G=d("latest");k("respCampaignId"),k("respCampaignName"),k("respAdGroupId");function _(l="",n=""){return Se({url:"/api/sellers/listings/our/",method:"GET",params:{page:g.value,limit:b.value,profile_id:O.value.profile_id,asin:l,sku:n}}).then(o=>{T.value=o.data,N.value=o.total,g.value=o.page,p.value=!1}).catch(o=>{console.error("Error fetching data:",o),p.value=!1})}function J(l){i.value.some(o=>o.asin===l.row.asin)?console.log("Item is already added."):i.value.push(l.row)}function Q(){x.value.split(/[\n,]+/).forEach(o=>{o.trim()&&_(o.trim()).then(h=>{console.log(`Data for ASIN ${o}:`,h)}).catch(h=>{console.error(`Error fetching data for ASIN ${o}:`,h)})})}function W(l){const n=i.value.findIndex(o=>o.asin===l.row.asin);n!==-1?(i.value.splice(n,1),console.log("Item removed successfully.")):console.log("Item not found.")}function X(){i.value=[]}function Y(){i.value=i.value.filter(l=>!S.includes(l)),S=[]}function Z(l){const n=l;m.value==="asin"?(p.value=!0,_(n)):m.value==="sku"&&(p.value=!0,_("",n))}function ee(l){console.log("e",l);const n=l;m.value==="asin"&&w.value?(p.value=!0,_(n)):m.value==="sku"&&w.value&&(p.value=!0,_("",n))}function te(l){z=l}function le(l){S=l}function ae(){const l=z.filter(n=>!i.value.some(o=>o.asin===n.asin));l.length>0&&i.value.push(...l)}function oe(l,n){return n.some(o=>o.sku===l.sku&&o.asin===l.asin)}F(i,(l,n)=>{l.forEach(o=>{oe(o,A.value)||A.value.push({sku:o.sku,asin:o.asin})})},{deep:!0});function ne(l){g.value=l,p.value=!0,_()}function se(l){b.value=l,g.value=1}F(i,()=>{i.value.length>0&&xe.emit("addedTableData",i.value)},{deep:!0});const U=l=>{if(l.rowIndex===0)return{backgroundColor:"rgba(245, 245, 245, 0.9)"}};return me(()=>{_()}),(l,n)=>{const o=r("el-option"),h=r("el-select"),E=r("el-input"),f=r("el-table-column"),P=r("el-image"),C=r("el-tooltip"),v=r("el-button"),$=r("el-table"),ie=r("el-pagination"),B=r("el-tab-pane"),de=r("el-tabs"),re=r("el-text"),ce=r("el-card"),q=he("loading");return K((I(),L("div",ke,[a("div",Ie,[a("div",Ve,[t(de,{modelValue:D.value,"onUpdate:modelValue":n[4]||(n[4]=e=>D.value=e),class:"demo-tabs"},{default:s(()=>[t(B,{label:"搜索",name:"first"},{default:s(()=>[a("div",Ae,[t(E,{modelValue:w.value,"onUpdate:modelValue":n[2]||(n[2]=e=>w.value=e),placeholder:"Please input",class:"input-with-select",onChange:Z,clearable:""},{prepend:s(()=>[t(h,{modelValue:m.value,"onUpdate:modelValue":n[0]||(n[0]=e=>m.value=e),style:{width:"100px"},onChange:ee},{default:s(()=>[t(o,{label:"名称",value:"name"}),t(o,{label:"ASIN",value:"asin"}),t(o,{label:"SKU",value:"sku"})]),_:1},8,["modelValue"])]),append:s(()=>[t(h,{modelValue:G.value,"onUpdate:modelValue":n[1]||(n[1]=e=>G.value=e),style:{width:"100px"}},{default:s(()=>[t(o,{label:"最新优先",value:"latest"}),t(o,{label:"最早优先",value:"earliest"}),t(o,{label:"优选广告",value:"optimal"})]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),K((I(),fe($,{height:"490",style:{width:"100%"},data:T.value,"header-cell-style":U,onSelectionChange:te},{default:s(()=>[t(f,{type:"selection",width:"50"}),t(f,{prop:"asin",label:"商品"},{default:s(e=>[a("div",Ne,[a("div",Te,[t(P,{class:"img-box",src:e.row.image_link},null,8,["src"])]),a("div",null,[t(C,{class:"box-item",effect:"dark",content:e.row.title,placement:"top"},{default:s(()=>[a("div",ze,c(e.row.title?e.row.title:"--"),1)]),_:2},1032,["content"]),a("div",De,[a("span",Ge,"$"+c(e.row.price?e.row.price:"--"),1),Ue,a("span",Ee,c(e.row.quantity),1)]),a("span",null,[u(" ASIN: "),a("span",Pe,c(e.row.asin?e.row.asin:"--"),1)]),a("span",null,[u(" SKU: "),a("span",$e,c(e.row.sku?e.row.sku:"--"),1)])])])]),_:1}),t(f,{prop:"name",label:"Name",width:"120",align:"right"},{header:s(()=>[t(v,{type:"primary",size:"normal",link:"",onClick:ae},{default:s(()=>[u("添加已选中")]),_:1})]),default:s(e=>[t(v,{type:"primary",size:"small",onClick:ue=>J(e),text:""},{default:s(()=>[u("添加")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])),[[q,p.value]]),t(ie,{onCurrentChange:ne,onSizeChange:se,"current-page":g.value,"page-size":b.value,total:N.value,layout:"prev, pager, next"},null,8,["current-page","page-size","total"])]),_:1}),t(B,{label:"输入",name:"second"},{default:s(()=>[t(E,{style:{padding:"10px"},modelValue:x.value,"onUpdate:modelValue":n[3]||(n[3]=e=>x.value=e),rows:20,type:"textarea",placeholder:"请输入ASIN,多个ASIN使用逗号、空格或换行符分隔。(未完成)",maxlength:"11000"},null,8,["modelValue"]),a("div",Be,[(I(),L(ve,null,ge(H,e=>t(v,{key:e.text,type:e.type,link:"",onClick:Q},{default:s(()=>[u(c(e.text),1)]),_:2},1032,["type"])),64))])]),_:1})]),_:1},8,["modelValue"])]),a("div",qe,[t(ce,{class:"box-card",shadow:"never",style:{border:"0"}},{header:s(()=>[a("div",Fe,[a("span",Ke,"已添加: "+c(j(i).length),1),t(C,{content:"添加最少3件商品。我们建议添加至少5件商品,以降低在商品缺货时出现广告活动暂停的可能性。",placement:"top"},{default:s(()=>[t(re,{type:"warning",truncated:"",style:{width:"350px"}},{default:s(()=>[u("添加最少3件商品。我们建议添加至少5件商品,以降低在商品缺货时出现广告活动暂停的可能性")]),_:1})]),_:1}),t(v,{class:"button",type:"danger",text:"",bg:"",onClick:X},{default:s(()=>[u("全部删除")]),_:1})])]),default:s(()=>[Le]),_:1}),a("div",je,[t($,{data:j(i),height:"510",style:{width:"100%"},"header-cell-style":U,onSelectionChange:le},{default:s(()=>[t(f,{type:"selection",width:"50"}),t(f,{prop:"asin",label:"ASIN"},{default:s(e=>[a("div",Me,[a("div",Oe,[t(P,{class:"img-box",src:e.row.image_link},null,8,["src"])]),a("div",null,[t(C,{class:"box-item",effect:"dark",content:e.row.title,placement:"top"},{default:s(()=>[a("div",Re,c(e.row.title?e.row.title:"--"),1)]),_:2},1032,["content"]),a("div",He,[a("span",Je,"$"+c(e.row.price?e.row.price:"--"),1),Qe,a("span",We,c(e.row.quantity),1)]),a("span",null,[u("ASIN: "),a("span",Xe,c(e.row.asin?e.row.asin:"--"),1)]),a("span",null,[u("SKU: "),a("span",Ye,c(e.row.sku?e.row.sku:"--"),1)])])])]),_:1}),t(f,{prop:"name",label:"Name",width:"120",align:"right"},{header:s(()=>[t(v,{type:"danger",size:"normal",link:"",onClick:Y},{default:s(()=>[u("删除已选中")]),_:1})]),default:s(e=>[t(v,{type:"primary",size:"small",onClick:ue=>W(e),text:""},{default:s(()=>[u("删除")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])])])])),[[q,R.value]])}}});const st=Ce(Ze,[["__scopeId","data-v-f407db33"]]);export{st as default};
|