import{d as l,i as s,A as r,by as n,e as u,C as c,aT as h}from"./index.6b776f4b.js";import{L as g}from"./index.9b1da5d2.js";import{A as p}from"./index.6c305541.js";import{I as i}from"./index.7cc0b0e7.js";import{i as m}from"./icon-sell-out.98742fd0.js";const f="_goods_126oz_1",_="_goodsSection_126oz_9",y="_sellOut_126oz_14",I="_sellOutImg_126oz_25",b="_goodsImg_126oz_29",C="_goodsInfo_126oz_33",w="_goodsName_126oz_37",S="_goodsSale_126oz_43",L="_pre_126oz_48",k="_goodsPrice_126oz_51",N="_addCart_126oz_57",v="_addCartDisabled_126oz_62";var o={goods:f,goodsSection:_,sellOut:y,sellOutImg:I,goodsImg:b,goodsInfo:C,goodsName:w,goodsSale:S,pre:L,goodsPrice:k,addCart:N,addCartDisabled:v},z=l({name:"goods",props:{showAdd:{type:Boolean,default:!0},item:{type:Object,default:{}},onItemClick:{type:Function,default:t=>{}},onBuyClick:{type:Function,default:t=>{}}},render(){const t=this.item;return s("div",{class:o.goods,onClick:()=>this.onItemClick(t)},[s("div",{class:o.goodsSection},[s(i,{src:t.pic,fit:"cover",class:o.goodsImg},null),t.stock<=0&&s("div",{class:o.sellOut},[s(i,{src:m,fit:"cover",class:o.sellOutImg},null)])]),s("div",{class:o.goodsInfo},[s("div",{class:[o.goodsName,"van-ellipsis"]},[t.name]),s("div",{class:o.goodsBuy},[s("p",{class:o.goodsPrice},[s("span",{class:o.pre},[r("\uFFE5")]),n(t.price)])])])])}});const A="_tabList_1we34_1",O="_goodsList_1we34_6";var a={tabList:A,goodsList:O},F=l({name:"tab-list",props:{showAdd:{type:Boolean,default:!0},typeId:{type:Number,default:0},productAttributeCategoryId:{type:Number,default:0},brandId:{type:Number,default:0},sort:{type:Number,defalut:0},keyword:{type:String,defalut:""},isTab:{type:Boolean,default:!1},onOpenWebView:{type:Function,default:t=>{}}},data(){return{list:[],loading:!1,finished:!1,params:{productCategoryId:void 0,productAttributeCategoryId:void 0,brandId:null,sort:null,keyword:"",pageNum:1,pageSize:20},addGoodsShow:!1,selectGoodsItem:{}}},mounted(){this.getList()},methods:{onSearch(){this.finished=!1,this.list=[],this.params.pageNum=1,this.getList()},async getList(){this.loading=!0;try{let t=this.params;t.productCategoryId=this.typeId?this.typeId:void 0,t.productAttributeCategoryId=this.productAttributeCategoryId?this.productAttributeCategoryId:void 0,t.brandId=this.brandId?this.brandId:void 0,t.sort=this.sort?this.sort:void 0,t.keyword=this.keyword?this.keyword:void 0;const e=(await u.post("/api-mall-portal/product/search",{data:{...t}})).data||{};if(this.list.length>0&&e.pageNum===1)return;this.list=this.list.concat(e.list||[]),this.finished=e.pageNum>=e.totalPage,this.params.pageNum=e.pageNum+1}catch{this.finished=!0}this.loading=!1},onDetailClick(t){if(this.isTab){let d=this.$router.resolve({path:"/goodsDetail",query:{id:t.id}}).fullPath;this.onOpenWebView(d);return}this.$router.push({path:"/goodsDetail",query:{id:t.id}})},onBuyClick(t){this.selectGoodsItem=t,this.addGoodsShow=!0}},render(){return s("div",{class:a.tabList},[s(g,{loading:this.loading,"onUpdate:loading":t=>this.loading=t,finished:this.finished,finishedText:" ",immediateCheck:!1,class:[a.goodsList,"mb12"],onLoad:this.getList},{default:()=>[this.list.length&&this.list.map(t=>s(z,{item:t,onItemClick:this.onDetailClick,onBuyClick:this.onBuyClick,showAdd:this.showAdd},null))||null,!this.loading&&!this.list.length&&s(c,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u5546\u54C1"},null)||null]}),s(h,{show:this.addGoodsShow,closeable:!0,position:"bottom",round:!0,onClose:()=>{this.addGoodsShow=!1}},{default:()=>[s(p,{show:this.addGoodsShow,item:this.selectGoodsItem},null)]})])}});export{F as T};