import{v as a,o as e,x as t,r as o,e as i,f as s,w as r,cD as n,j as l,l as g,m as c,F as p,g as m,k as d,u,s as f,p as k,t as _,B as b,$ as P,a7 as y,i as M,D as S}from"./index-CWyPMHxb.js";import{_ as h}from"./s-goods-item.DVomrksC.js";import{_ as x}from"./s-empty.Bcpb-H16.js";import{_ as j}from"./uni-load-more.jm2vzrn1.js";import{S as w}from"./s-layout.CUgh1tQ8.js";import{S as v}from"./spu.ChgsD2WR.js";import{f as C}from"./useGoods.BQLkjza8.js";import{_ as I}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{l as $}from"./lodash.default.DzSjahpS.js";import"./index.gxKvznCa.js";import"./min.DNgEVQjj.js";const z=I({__name:"goods",setup(I){const z=a({pagination:{list:[],total:0,pageNo:1,pageSize:8},loadStatus:"",shareInfo:{}});async function B(){z.loadStatus="loading";let{code:a,data:e}=await v.getSpuPage({pageSize:z.pagination.pageSize,pageNo:z.pagination.pageNo});0===a?(await Promise.all(e.list.map((async a=>{try{const e=await n.getProductBrokeragePrice(a.id);a.brokerageMinPrice=e.data.brokerageMinPrice,a.brokerageMaxPrice=e.data.brokerageMaxPrice}catch(e){console.error(`获取商品【${a.name}】的佣金时出错：`,e)}}))),z.pagination.list=$.concat(z.pagination.list,e.list),z.pagination.total=e.total,z.loadStatus=z.pagination.list.length<z.pagination.total?"more":"noMore"):z.loadStatus="error"}function N(){"noMore"!==z.loadStatus&&(z.pagination.pageNo++,B())}return e((()=>{B()})),t((()=>{N()})),(a,e)=>{const t=M,n=S,v=o(i("s-goods-item"),h),I=o(i("s-empty"),x),$=o(i("uni-load-more"),j),B=o(i("s-layout"),w);return l(),s(B,{title:"推广商品",onShareAppMessage:z.shareInfo},{default:r((()=>[(l(!0),g(p,null,c(z.pagination.list,(a=>(l(),s(t,{class:"goods-item ss-m-20",key:a.id},{default:r((()=>[d(v,{size:"lg",img:a.picUrl,title:a.name,subTitle:a.introduction,price:a.price,originPrice:a.marketPrice,priceColor:"#333",onClick:e=>u(f).$router.go("/pages/goods/index",{id:a.id})},{rightBottom:r((()=>[d(t,{class:"ss-flex ss-row-between"},{default:r((()=>[void 0===a.brokerageMinPrice?(l(),s(t,{key:0,class:"commission-num"},{default:r((()=>[k("预计佣金：计算中")])),_:1})):a.brokerageMinPrice===a.brokerageMaxPrice?(l(),s(t,{key:1,class:"commission-num"},{default:r((()=>[k(" 预计佣金："+_(u(C)(a.brokerageMinPrice)),1)])),_:2},1024)):(l(),s(t,{key:2,class:"commission-num"},{default:r((()=>[k(" 预计佣金："+_(u(C)(a.brokerageMinPrice))+" ~ "+_(u(C)(a.brokerageMaxPrice)),1)])),_:2},1024)),d(n,{class:"ss-reset-button share-btn ui-BG-Main-Gradient",onClick:b((e=>{return t=a,z.shareInfo=P.getShareInfo({title:t.title,image:f.$url.cdn(t.image),desc:t.subtitle,params:{page:"2",query:t.id}},{type:"goods",title:t.title,image:f.$url.cdn(t.image),price:t.price[0],original_price:t.original_price}),void y();var t}),["stop"])},{default:r((()=>[k(" 分享赚 ")])),_:2},1032,["onClick"])])),_:2},1024)])),_:2},1032,["img","title","subTitle","price","originPrice","onClick"])])),_:2},1024)))),128)),0===z.pagination.total?(l(),s(I,{key:0,icon:"/static/goods-empty.png",text:"暂无推广商品"})):m("",!0),z.pagination.total>0?(l(),s($,{key:1,status:z.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:N},null,8,["status"])):m("",!0)])),_:1},8,["onShareAppMessage"])}}},[["__scopeId","data-v-fe95f068"]]);export{z as default};
