1 |
- import{d as fe,ay as _e,r as n,Z as D,j as ge,ai as i,aq as ve,o as c,c as f,P as E,U as a,O as s,a as r,T as P,R as G,S as p,u as T,F as q,a8 as he,M as ye,aF as be,aG as Ve}from"./vue.adf17aba.js";import{u as Ce,r as B}from"./index.b098562c.js";import{e as xe}from"./emitter.c27b7986.js";import{_ as we}from"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.js";import"./echarts.72dc8373.js";const v=h=>(be("data-v-a2e7d7fe"),h=h(),Ve(),h),ke={class:"custom-tree-node"},Se={style:{width:"75%"}},Re={key:0,style:{color:"rgb(50, 108, 216)"}},De=["onClick"],Pe=["onClick"],Te={style:{display:"flex","justify-content":"space-between"}},Be=v(()=>r("span",null,"根据特定品牌、价格范围、星级和Prime配送资格,细化分类",-1)),Ie=v(()=>r("span",{style:{"margin-right":"10px",color:"#616266","font-weight":"500"}},"品牌",-1)),Oe=v(()=>r("span",{style:{"margin-right":"10px",color:"#616266","font-weight":"500"}},"价格范围",-1)),Fe=v(()=>r("span",{style:{"margin-right":"15px",color:"#616266","font-weight":"500"}},"查看星级评定",-1)),Ue=v(()=>r("span",{style:{"margin-right":"10px",color:"#616266","font-weight":"500"}},"配送",-1)),Le={style:{display:"flex","justify-content":"space-between"}},je={key:0},Ne={class:"dialog-footer"},$e=fe({__name:"BuySearch",emits:["add-to-table","form-submitted"],setup(h,{emit:M}){const A=Ce(),{profile:C}=_e(A),x=n(!1);n("customBid");const _=n(!1),w=n(!1),k=n([]);let Z=n([]);const z={children:"ch",label:"cna"},g=n(!1);let S=n(""),y=n(""),u=n([]),b=n(0),I=n([]);const H=D({0:"0",1:"1",2:"2",3:"3",4:"4",5:"5"}),t=D({prices:{lowest:void 0,highest:void 0},starRating:[0,5],dialogselectValue:[],delivery:"all",isCount:!1}),O=n(),J=D({prices:[{validator:K,trigger:"blur"}]});async function K(o,e){return e.highest!==""&&e.lowest!==""&&e.highest<=e.lowest?Promise.reject("最高价格必须大于最低价格"):Promise.resolve()}async function Q(){x.value=!0;try{const o=await B({url:"/api/ad_manage/targetable/categories/",method:"GET",params:{profile_id:C.value.profile_id}});k.value=o.data}catch(o){console.error("请求失败:",o)}finally{x.value=!1}}function W(o){const e=t.dialogOptions.find(d=>d.value===o);e&&(I.value=e.label)}function F(){t.prices.lowest=void 0,t.prices.highest=void 0,t.starRating=[0,5],t.dialogselectValue=[],t.delivery="all",t.isCount=!1}function X(){b.value++,F(),t.isCount=!1,u.value=[],_.value=!1}async function Y(o){try{const e=await B({url:"/api/ad_manage/products/count/",method:"POST",data:{profile_id:C.value.profile_id,category_id:y.value}});o===b.value&&(u.value=e.data.AsinCounts)}catch(e){console.error("请求失败:",e)}finally{o===b.value&&(_.value=!1)}}function ee(){if(t.isCount){const o=b.value;_.value=!0,Y(o)}else _.value=!1,u.value=[]}async function te(){try{const e=(await B({url:"/api/ad_manage/categories/brands/",method:"GET",params:{profile_id:C.value.profile_id,category_id:y.value}})).data;t.dialogOptions=e.brands.map(d=>({label:d.name,value:d.id})),w.value=!1}catch(o){console.error("请求失败:",o)}}let le=n([]);function oe(o){u.value=[],S.value=o.cna,y.value=o.cid,le.value.push(o),g.value=!0,w.value=!0,te()}const U=M;function ae(o,e){Z.value.some(d=>d.cid===e.cid),U("add-to-table",e)}async function se(){if(!await O.value.validate()){console.log("表单数据验证失败");return}const e={dialogTitle:S.value,cid:y.value,prices:{lowest:t.prices.lowest,highest:t.prices.highest},starRating:t.starRating,selectedBrands:t.dialogselectValue,delivery:t.delivery,isCount:t.isCount,commodityCount:u.value,selectedLabels:I.value};U("form-submitted",e),g.value=!1,F()}return ge(()=>{xe.on("tree-node-data",()=>{k.value.length==0&&Q()})}),(o,e)=>{const d=i("el-tree"),ne=i("el-scrollbar"),ie=i("el-checkbox"),re=i("el-option"),de=i("el-select"),V=i("el-form-item"),L=i("el-input-number"),ue=i("el-slider"),R=i("el-radio"),ce=i("el-radio-group"),pe=i("el-form"),j=i("el-button"),me=i("el-dialog"),N=ve("loading");return c(),f(q,null,[E((c(),f("div",null,[a(ne,{height:"450px"},{default:s(()=>[a(d,{data:k.value,props:z,"expand-on-click-node":!1},{default:s(({node:l,data:m})=>[r("span",ke,[r("span",Se,P(l.label),1),m.ta==!0?(c(),f("span",Re,[r("a",{onClick:$=>oe(m)}," 细化 ",8,De),r("a",{style:{"margin-left":"8px"},onClick:$=>ae(l,m)}," 添加 ",8,Pe)])):G("",!0)])]),_:1},8,["data"])]),_:1})])),[[N,x.value]]),a(me,{modelValue:g.value,"onUpdate:modelValue":e[7]||(e[7]=l=>g.value=l),title:`细化分类: ${T(S)}`,onClose:X,"destroy-on-close":""},{footer:s(()=>{var l,m;return[r("div",Le,[E((c(),f("span",null,[p(" 定位到的商品数量: "),t.isCount==!0?(c(),f("span",je,P((l=T(u)[0])==null?void 0:l.min)+" - "+P((m=T(u)[0])==null?void 0:m.max),1)):G("",!0)])),[[N,_.value]]),r("span",Ne,[a(j,{onClick:e[6]||(e[6]=$=>g.value=!1)},{default:s(()=>[p("取消")]),_:1}),a(j,{type:"primary",onClick:se},{default:s(()=>[p("确定")]),_:1})])])]}),default:s(()=>[r("div",Te,[Be,r("span",null,[a(ie,{modelValue:t.isCount,"onUpdate:modelValue":e[0]||(e[0]=l=>t.isCount=l),label:"显示商品数量",onChange:ee},null,8,["modelValue"])])]),a(pe,{model:t,rules:J,ref_key:"dialogFormRef",ref:O,style:{"margin-top":"20px"}},{default:s(()=>[a(V,{style:{"padding-left":"140px"}},{default:s(()=>[Ie,a(de,{modelValue:t.dialogselectValue,"onUpdate:modelValue":e[1]||(e[1]=l=>t.dialogselectValue=l),onChange:W,placeholder:"请选择",loading:w.value},{default:s(()=>[(c(!0),f(q,null,he(t.dialogOptions,l=>(c(),ye(re,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),a(V,{prop:"prices",style:{"padding-left":"112px","margin-top":"10px"}},{default:s(()=>[Oe,a(L,{modelValue:t.prices.lowest,"onUpdate:modelValue":e[2]||(e[2]=l=>t.prices.lowest=l),min:1,controls:!1,placeholder:"无最低商品价格"},null,8,["modelValue"]),p(" -- "),a(L,{modelValue:t.prices.highest,"onUpdate:modelValue":e[3]||(e[3]=l=>t.prices.highest=l),min:1,controls:!1,placeholder:"无最高商品价格"},null,8,["modelValue"])]),_:1}),a(V,{prop:"starRating",style:{"padding-left":"85px","margin-top":"10px"}},{default:s(()=>[Fe,a(ue,{modelValue:t.starRating,"onUpdate:modelValue":e[4]||(e[4]=l=>t.starRating=l),range:"","show-stops":"",max:5,marks:H,style:{width:"70%"}},null,8,["modelValue","marks"])]),_:1}),a(V,{prop:"delivery",style:{"padding-left":"140px","margin-top":"30px"}},{default:s(()=>[Ue,a(ce,{modelValue:t.delivery,"onUpdate:modelValue":e[5]||(e[5]=l=>t.delivery=l)},{default:s(()=>[a(R,{label:"all",style:{"font-weight":"400"}},{default:s(()=>[p("所有")]),_:1}),a(R,{label:"eligible",style:{"font-weight":"400"}},{default:s(()=>[p("具备Prime资格")]),_:1}),a(R,{label:"diseligible",style:{"font-weight":"400"}},{default:s(()=>[p("不具备Prime资格")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])],64)}}});const ze=we($e,[["__scopeId","data-v-a2e7d7fe"]]);export{ze as default};
|