index.fb30a76c.js 5.9 KB

1
  1. import{d as u,a as i,L as m,b as s,t as g,a9 as y,aa as C,z as n,x as b,ai as v,B as p,S as _,k as L,l as d,I as c,P as A}from"./vendor.6544a766.js";/* empty css *//* empty css *//* empty css */import{T as S}from"./index.2119dc4e.js";import{S as F,i as x}from"./index.c2e6003b.js";import{r as w}from"./index.bfda0881.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./index.f91e15be.js";/* empty css *//* empty css *//* empty css *//* empty css */const T="_active_8my7r_13",j="_filterBtn_8my7r_17",V="_filterTagWrap_8my7r_20",B="_filterTag_8my7r_20",k="_filterSort_8my7r_36";var r={"filter-top":"_filter-top_8my7r_1",active:T,filterBtn:j,filterTagWrap:V,filterTag:B,filterSort:k,"icon-active":"_icon-active_8my7r_43"};const P="_loading_1wy15_1",I="_titlePopup_1wy15_7",z="_title_1wy15_7",E="_radio_1wy15_21",W="_filterAction_1wy15_57";var o={loading:P,titlePopup:I,title:z,"radio-group":"_radio-group_1wy15_21",radio:E,filterAction:W};function $(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!b(t)}const h=()=>({productCategorySmallVoList:null,productAttributeCategoryList:null,brandList:null});var R=u({name:"goods-filter-list",props:{setFilter:{type:Function,default:t=>{}}},data(){return{dataShow:!0,loading:!1,brandList:[],productAttributeCategoryList:[],productCategorySmallVoList:[],params:h()}},mounted(){this.getFilterList()},methods:{async getFilterList(){this.loading=!0;try{const t=await w.get("/api-mall-portal/product/search/condition");this.dataShow=t.code===200;const{brandList:e=[],productAttributeCategoryList:a=[],productCategorySmallVoList:l=[]}=t.data||{};this.brandList=e,this.productAttributeCategoryList=a,this.productCategorySmallVoList=l}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(m,{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(g,{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(y,{class:o["radio-group"],modelValue:this.params[t],"onUpdate:modelValue":a=>this.params[t]=a},$(e=this[t].map((a,l)=>{const f=l===this.params[t]?"primary":"default";return i(C,{class:o.radio,name:l,onClick:()=>{}},{default:()=>[i(n,{size:"large",type:f},{default:()=>[a.name]})]})}))?e:{default:()=>[e]})}})),i(v,{style:{margin:"0"}},null),i("div",{class:o.filterAction},[i(p,{round:!0,style:{marginRight:"8px"},onClick:()=>this.params=h()},{default:()=>[s("\u91CD\u7F6E")]}),i(p,{round:!0,type:"primary",style:{marginLeft:"8px"},onClick:()=>this.onFilterClick()},{default:()=>[s("\u786E\u8BA4")]})])])])}}),rt=u({name:"goods-list",data(){return{typeId:0,filterActive:0,filterListShow:!1,productCategory:{name:"",id:0},productAttributeCategory:{name:"",id:0},brand:{name:"",id:0},keyword:""}},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;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(_,null,{default:()=>[i(F,{modelValue:this.keyword,onSearch:this.searchBtn},null),i(L,{class:r["filter-top"],align:"center"},{default:()=>[i(d,{span:6,class:this.filterActive===0?r.active:"",onClick:()=>this.onFilter(0)},{default:()=>[s("\u7EFC\u5408\u6392\u5E8F")]}),i(d,{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(c,{class:this.filterActive===3?r["icon-active"]:"",style:{transform:"rotate(-90deg)"},name:"play",size:12},null),i(c,{class:this.filterActive===4?r["icon-active"]:"",style:{transform:"rotate(90deg)",marginTop:"-5px"},name:"play",size:12},null)])]}),i(d,{span:6,class:this.filterActive===2?r.active:"",onClick:()=>this.onFilter(2)},{default:()=>[s("\u9500\u91CF")]}),i(d,{span:6,class:r.filterBtn,onClick:()=>this.filterListShow=!0},{default:()=>[s("\u7B5B\u9009"),i(c,{name:x,size:18},null)]})]})]}),i("div",{class:r.filterTagWrap},[this.productCategory.id?i(n,{class:r.filterTag,closeable:!0,onClose:()=>this.onClearTag("productCategory")},{default:()=>[this.productCategory.name]}):"",this.productAttributeCategory.id?i(n,{class:r.filterTag,closeable:!0,onClose:()=>this.onClearTag("productAttributeCategory")},{default:()=>[this.productAttributeCategory.name]}):"",this.brand.id?i(n,{class:r.filterTag,closeable:!0,onClose:()=>this.onClearTag("brand")},{default:()=>[this.brand.name]}):""]),i(S,{ref:"tabList",typeId: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(R,{ref:"goodsFilter",setFilter:this.setFilter},null)]})])}});export{rt as default};