import{y as e,o as a,z as t,e as o,f as i,w as s,_ as r,l as n,k as l,r as g,F as p,g as c,m,j as d,v as u,s as _,t as f,u as k,C as y,$ as b,a7 as P,i as M,G as j}from"./index-9aa72eed.js";import{_ as x}from"./s-goods-item.61fdff9d.js";import{_ as S}from"./s-empty.3adf8b58.js";import{_ as h}from"./uni-load-more.93dce372.js";import{_ as v}from"./s-layout.bffb18b8.js";import{S as C}from"./spu.f61dd243.js";import{B as w}from"./brokerage.3a814b62.js";import{f as z}from"./useGoods.ce02ada2.js";import{_ as I}from"./_plugin-vue_export-helper.1b428a4d.js";/* empty css                                                                     *//* empty css                                                                */import"./form.c66b5271.js";const B=I({__name:"goods",setup(I){const B=e({pagination:{list:[],total:0,pageNo:1,pageSize:1},loadStatus:"",shareInfo:{}});async function G(){B.loadStatus="loading";let{code:e,data:a}=await C.getSpuPage({pageSize:B.pagination.pageSize,pageNo:B.pagination.pageNo});0===e&&(B.pagination.list=r.concat(B.pagination.list,a.list),B.pagination.total=a.total,B.loadStatus=B.pagination.list.length<B.pagination.total?"more":"noMore",a.list.forEach((e=>{w.getProductBrokeragePrice(e.id).then((a=>{e.brokerageMinPrice=a.data.brokerageMinPrice,e.brokerageMaxPrice=a.data.brokerageMaxPrice}))})))}function N(){"noMore"!==B.loadStatus&&(B.pagination.pageNo++,G())}return a((()=>{G()})),t((()=>{N()})),(e,a)=>{const t=M,r=j,C=n(m("s-goods-item"),x),w=n(m("s-empty"),S),I=n(m("uni-load-more"),h),G=n(m("s-layout"),v);return o(),i(G,{title:"推广商品",onShareAppMessage:B.shareInfo},{default:s((()=>[(o(!0),l(p,null,g(B.pagination.list,(e=>(o(),i(t,{class:"goods-item ss-m-20",key:e.id},{default:s((()=>[d(C,{size:"lg",img:e.picUrl,title:e.name,subTitle:e.introduction,price:e.price,originPrice:e.marketPrice,priceColor:"#333",onClick:a=>u(_).$router.go("/pages/goods/index",{id:e.id})},{rightBottom:s((()=>[d(t,{class:"ss-flex ss-row-between"},{default:s((()=>[void 0===e.brokerageMinPrice?(o(),i(t,{key:0,class:"commission-num"},{default:s((()=>[f("预计佣金：计算中")])),_:1})):e.brokerageMinPrice===e.brokerageMaxPrice?(o(),i(t,{key:1,class:"commission-num"},{default:s((()=>[f(" 预计佣金："+k(u(z)(e.brokerageMinPrice)),1)])),_:2},1024)):(o(),i(t,{key:2,class:"commission-num"},{default:s((()=>[f(" 预计佣金："+k(u(z)(e.brokerageMinPrice))+" ~ "+k(u(z)(e.brokerageMaxPrice)),1)])),_:2},1024)),d(r,{class:"ss-reset-button share-btn ui-BG-Main-Gradient",onClick:y((a=>{return t=e,B.shareInfo=b.getShareInfo({title:t.title,image:_.$url.cdn(t.image),desc:t.subtitle,params:{page:"2",query:t.id}},{type:"goods",title:t.title,image:_.$url.cdn(t.image),price:t.price[0],original_price:t.original_price}),void P();var t}),["stop"])},{default:s((()=>[f(" 分享赚 ")])),_:2},1032,["onClick"])])),_:2},1024)])),_:2},1032,["img","title","subTitle","price","originPrice","onClick"])])),_:2},1024)))),128)),0===B.pagination.total?(o(),i(w,{key:0,icon:"/static/goods-empty.png",text:"暂无推广商品"})):c("",!0),B.pagination.total>0?(o(),i(I,{key:1,status:B.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:N},null,8,["status"])):c("",!0)])),_:1},8,["onShareAppMessage"])}}},[["__scopeId","data-v-4b21ee3d"]]);export{B as default};
