index.f5dbec08.js 6.3 KB

1
  1. import{d as f,a as i,L as g,j as s,q as y,a9 as C,aa as b,z as d,x as _,aj as v,B as h,S as L,k as S,l as c,u as p,P as A}from"./vendor.f57b7239.js";/* empty css *//* empty css *//* empty css */import{T as w}from"./index.2e274a4f.js";import{C as x,i as F}from"./index.d616afcd.js";import{r as j}from"./index.ec559b5a.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./index.3b633759.js";/* empty css *//* empty css *//* empty css */const T="_active_m2ws6_13",V="_filterBtn_m2ws6_17",k="_filterTagWrap_m2ws6_20",B="_filterTag_m2ws6_20",I="_filterSort_m2ws6_36",P="_iconSort_m2ws6_46";var r={"filter-top":"_filter-top_m2ws6_1",active:T,filterBtn:V,filterTagWrap:k,filterTag:B,filterSort:I,"icon-active":"_icon-active_m2ws6_43",iconSort:P};const $="_loading_1wy15_1",q="_titlePopup_1wy15_7",G="_title_1wy15_7",N="_radio_1wy15_21",z="_filterAction_1wy15_57";var o={loading:$,titlePopup:q,title:G,"radio-group":"_radio-group_1wy15_21",radio:N,filterAction:z};function E(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!_(t)}const m=()=>({productCategorySmallVoList:null,productAttributeCategoryList:null,brandList:null});var W=f({name:"goods-filter-list",props:{setFilter:{type:Function,default:t=>{}},cateGoryId:{type:Number,default:0}},data(){return{dataShow:!0,loading:!1,brandList:[],productAttributeCategoryList:[],productCategorySmallVoList:[],params:m()}},mounted(){this.getFilterList()},methods:{async getFilterList(){this.loading=!0;try{const t=await j.get("/api-mall-portal/product/search/condition");this.dataShow=t.code===200;const{brandList:e=[],productAttributeCategoryList:a=[],productCategorySmallVoList:l=[]}=t.data||{};if(this.brandList=e,this.productAttributeCategoryList=a,this.productCategorySmallVoList=l,this.cateGoryId){let n=l.findIndex(u=>u.id==this.cateGoryId);console.log(n),this.params.productCategorySmallVoList=n>-1?n:null}}catch{this.dataShow=!1}this.loading=!1},onFilterClick(){this.setFilter({productCategory:this.productCategorySmallVoList[this.params.productCategorySmallVoList],productAttributeCategory:this.productAttributeCategoryList[this.params.productAttributeCategoryList],brand:this.brandList[this.params.brandList]})},setParams(t){this.params[t]=null}},render(){return i("div",null,[this.loading&&i("div",{class:o.loading},[i(g,{color:"var(--van-primary)"},null)]),i("div",{class:o.filterWrap},[i("div",{class:o.titlePopup},[s("\u7B5B\u9009")]),Object.keys(this.params).map(t=>i(y,{border:!1},{title:()=>i("div",null,[t==="productCategorySmallVoList"?"\u5546\u54C1\u5206\u7C7B":t==="productAttributeCategoryList"?"\u5546\u54C1\u7C7B\u578B":"\u54C1\u724C"]),label:()=>{let e;return i(C,{class:o["radio-group"],modelValue:this.params[t],"onUpdate:modelValue":a=>this.params[t]=a},E(e=this[t].map((a,l)=>{const u=l===this.params[t]?"primary":"default";return i(b,{class:o.radio,name:l,onClick:()=>{}},{default:()=>[i(d,{size:"large",type:u},{default:()=>[a.name]})]})}))?e:{default:()=>[e]})}})),i(v,{style:{margin:"0"}},null),i("div",{class:o.filterAction},[i(h,{round:!0,style:{marginRight:"8px"},onClick:()=>this.params=m()},{default:()=>[s("\u91CD\u7F6E")]}),i(h,{round:!0,type:"primary",style:{marginLeft:"8px"},onClick:()=>this.onFilterClick()},{default:()=>[s("\u786E\u8BA4")]})])])])}}),at=f({name:"goods-list",data(){const t=this.$route.query;return{typeId:0,filterActive:0,filterListShow:!1,productCategory:{name:t.tag||"",id:Number(t.id)||0},productAttributeCategory:{name:"",id:0},brand:{name:"",id:0},keyword:"",autofocus:!1}},mounted(){this.$nextTick(()=>{this.$route.query.input==="focus"&&document.querySelector(".van-field__control").focus()})},methods:{onFilter(t){this.filterActive===3&&t===3&&(t=4),this.filterActive===4&&t===3&&(t=3),this.filterActive!==t&&(this.filterActive=t,this.onSearch())},setFilter({productCategory:t,productAttributeCategory:e,brand:a}){this.productCategory=t||{id:0,name:""},this.productAttributeCategory=e||{id:0,name:""},this.brand=a||{id:0,name:""},this.onSearch(),this.filterListShow=!1},onClearTag(t){this[t]={id:0,name:""};let e=this.$refs.goodsFilter;e&&(t==="productCategory"?e.setParams("productCategorySmallVoList"):t==="productAttributeCategory"?e.setParams("productAttributeCategoryList"):e.setParams("brandList")),this.$nextTick(()=>{this.onSearch()})},onSearch(){this.$refs.tabList.onSearch()},searchBtn(t){this.keyword=t,this.$nextTick(()=>{this.onSearch()})}},render(){return i("div",null,[i(L,null,{default:()=>[i(x,{modelValue:this.keyword,onSearch:this.searchBtn},null),i(S,{class:r["filter-top"],align:"center"},{default:()=>[i(c,{span:6,class:this.filterActive===0?r.active:"",onClick:()=>this.onFilter(0)},{default:()=>[s("\u7EFC\u5408\u6392\u5E8F")]}),i(c,{span:6,class:this.filterActive===3||this.filterActive===4?r.active:"",onClick:()=>this.onFilter(3)},{default:()=>[s("\u4EF7\u683C"),i("div",{class:r.filterSort},[i(p,{class:this.filterActive===3?r["icon-active"]:"",style:{transform:"rotate(-90deg)"},name:"play",size:12},null),i(p,{class:[r.iconSort,this.filterActive===4?[r["icon-active"]]:""],style:{transform:"rotate(90deg)"},name:"play",size:12},null)])]}),i(c,{span:6,class:this.filterActive===2?r.active:"",onClick:()=>this.onFilter(2)},{default:()=>[s("\u9500\u91CF")]}),i(c,{span:6,class:r.filterBtn,onClick:()=>this.filterListShow=!0},{default:()=>[s("\u7B5B\u9009"),i(p,{name:F,size:18},null)]})]})]}),i("div",{class:r.filterTagWrap},[this.productCategory.id?i(d,{class:r.filterTag,closeable:!0,onClose:()=>this.onClearTag("productCategory")},{default:()=>[this.productCategory.name]}):"",this.productAttributeCategory.id?i(d,{class:r.filterTag,closeable:!0,onClose:()=>this.onClearTag("productAttributeCategory")},{default:()=>[this.productAttributeCategory.name]}):"",this.brand.id?i(d,{class:r.filterTag,closeable:!0,onClose:()=>this.onClearTag("brand")},{default:()=>[this.brand.name]}):""]),i(w,{ref:"tabList",typeId:Number(this.productCategory.id),productAttributeCategoryId:this.productAttributeCategory.id,brandId:this.brand.id,sort:this.filterActive,keyword:this.keyword},null),i(A,{show:this.filterListShow,closeable:!0,position:"bottom",round:!0,onClose:()=>{this.filterListShow=!1}},{default:()=>[i(W,{cateGoryId:this.productCategory.id,ref:"goodsFilter",setFilter:this.setFilter},null)]})])}});export{at as default};