2 lines
3.0 KiB
JavaScript
2 lines
3.0 KiB
JavaScript
"use strict";const e=require("../../../common/vendor.js"),o=require("../sheep/index.js"),a=require("../sheep/platform/share.js"),t=require("../sheep/hooks/useModal.js"),i=require("../sheep/api/product/spu.js"),r=require("../sheep/api/trade/brokerage.js"),n=require("../sheep/hooks/useGoods.js");if(!Array){(e.resolveComponent("s-goods-item")+e.resolveComponent("s-empty")+e.resolveComponent("uni-load-more")+e.resolveComponent("s-layout")+e.resolveComponent("layout-default-uni"))()}Math||((()=>"../sheep/components/s-goods-item/s-goods-item.js")+(()=>"../sheep/components/s-empty/s-empty.js")+(()=>"../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../sheep/components/s-layout/s-layout.js"))();const s={__name:"goods",setup(s){const p=e.reactive({pagination:{list:[],total:0,pageNo:1,pageSize:1},loadStatus:"",shareInfo:{}});function g(){return o=this,a=null,t=function*(){p.loadStatus="loading";const{code:o,data:a}=yield i.SpuApi.getSpuPage({pageSize:p.pagination.pageSize,pageNo:p.pagination.pageNo});0===o&&(p.pagination.list=e.lodash.concat(p.pagination.list,a.list),p.pagination.total=a.total,p.loadStatus=p.pagination.list.length<p.pagination.total?"more":"noMore",a.list.forEach((e=>{r.BrokerageApi.getProductBrokeragePrice(e.id).then((o=>{e.brokerageMinPrice=o.data.brokerageMinPrice,e.brokerageMaxPrice=o.data.brokerageMaxPrice}))})))},new Promise(((e,i)=>{var r=e=>{try{s(t.next(e))}catch(o){i(o)}},n=e=>{try{s(t.throw(e))}catch(o){i(o)}},s=o=>o.done?e(o.value):Promise.resolve(o.value).then(r,n);s((t=t.apply(o,a)).next())}));var o,a,t}function l(){"noMore"!==p.loadStatus&&(p.pagination.pageNo++,g())}return e.onLoad((()=>{g()})),e.onReachBottom((()=>{l()})),(i,r)=>e.e({a:e.f(p.pagination.list,((i,r,s)=>e.e({a:void 0===i.brokerageMinPrice},void 0===i.brokerageMinPrice?{}:i.brokerageMinPrice===i.brokerageMaxPrice?{c:e.t(e.unref(n.fen2yuan)(i.brokerageMinPrice))}:{d:e.t(e.unref(n.fen2yuan)(i.brokerageMinPrice)),e:e.t(e.unref(n.fen2yuan)(i.brokerageMaxPrice))},{b:i.brokerageMinPrice===i.brokerageMaxPrice,f:e.o((e=>{return r=i,p.shareInfo=a.$share.getShareInfo({title:r.title,image:o.sheep.$url.cdn(r.image),desc:r.subtitle,params:{page:"2",query:r.id}},{type:"goods",title:r.title,image:o.sheep.$url.cdn(r.image),price:r.price[0],original_price:r.original_price}),void t.showShareModal();var r}),i.id),g:e.o((a=>e.unref(o.sheep).$router.go("/modules/mall/goods/index",{id:i.id})),i.id),h:"7b85f91c-2-"+s+",7b85f91c-1",i:e.p({size:"lg",img:i.picUrl,title:i.name,subTitle:i.introduction,price:i.price,originPrice:i.marketPrice,priceColor:"#333"}),j:i.id}))),b:0===p.pagination.total},0===p.pagination.total?{c:e.p({icon:"/static/goods-empty.png",text:"暂无推广商品"})}:{},{d:p.pagination.total>0},p.pagination.total>0?{e:e.o(l),f:e.p({status:p.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{g:e.p({title:"推广商品",onShareAppMessage:p.shareInfo})})}},p=e._export_sfc(s,[["__scopeId","data-v-7b85f91c"]]);s.__runtimeHooks=2,wx.createPage(p);
|