2 lines
3.2 KiB
JavaScript
2 lines
3.2 KiB
JavaScript
"use strict";var t=Object.defineProperty,o=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(o,e,i)=>e in o?t(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,n=(t,o,e)=>new Promise(((i,a)=>{var n=t=>{try{r(e.next(t))}catch(o){a(o)}},s=t=>{try{r(e.throw(t))}catch(o){a(o)}},r=t=>t.done?i(t.value):Promise.resolve(t.value).then(n,s);r((e=e.apply(t,o)).next())}));const s=require("../../../common/vendor.js"),r=require("../sheep/index.js"),c=require("../sheep/api/promotion/rewardActivity.js"),l=require("../sheep/hooks/useGoods.js"),d=require("../sheep/api/product/spu.js");if(!Array){(s.resolveComponent("su-sticky")+s.resolveComponent("s-goods-column")+s.resolveComponent("uni-load-more")+s.resolveComponent("s-layout")+s.resolveComponent("layout-default-uni"))()}Math||((()=>"../sheep/ui/su-sticky/su-sticky.js")+(()=>"../sheep/components/s-goods-column/s-goods-column.js")+(()=>"../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../sheep/components/s-layout/s-layout.js"))();const p={__name:"index",setup(t){const p=s.reactive({activityId:0,activityInfo:{},pagination:{list:[],total:1,pageNo:1,pageSize:8},loadStatus:"",leftGoodsList:[],rightGoodsList:[]});let u=0,g=0,f=0;function y(t=0,o="left"){p.pagination.list[u]&&("left"===o?g+=t:f+=t,g<=f?p.leftGoodsList.push(p.pagination.list[u]):p.rightGoodsList.push(p.pagination.list[u]),u++)}function m(){return n(this,null,(function*(){const t={};2===p.activityInfo.productScope?t.ids=p.activityInfo.productSpuIds.join(","):3===p.activityInfo.productScope&&(t.categoryIds=p.activityInfo.productSpuIds.join(",")),p.loadStatus="loading";const{code:n,data:r}=yield d.SpuApi.getSpuPage(((t,n)=>{for(var s in n||(n={}))e.call(n,s)&&a(t,s,n[s]);if(o)for(var s of o(n))i.call(n,s)&&a(t,s,n[s]);return t})({pageNo:p.pagination.pageNo,pageSize:p.pagination.pageSize},t));0===n&&(p.pagination.list=s.lodash.concat(p.pagination.list,r.list),p.pagination.total=r.total,p.loadStatus=p.pagination.list.length<p.pagination.total?"more":"noMore",y())}))}function v(){"noMore"!==p.loadStatus&&(p.pagination.pageNo++,m())}return s.onReachBottom((()=>{v()})),s.onLoad((t=>n(this,null,(function*(){p.activityId=t.activityId,yield function(t){return n(this,null,(function*(){const{code:o,data:e}=yield c.RewardActivityApi.getRewardActivity(t);0===o&&(p.activityInfo=e)}))}(p.activityId),yield m(p.activityId)})))),(t,o)=>s.e({a:s.f(p.activityInfo.rules,((t,o,e)=>({a:s.t(s.unref(l.formatRewardActivityRule)(p.activityInfo,t)),b:t}))),b:s.p({bgColor:"#fff"}),c:s.f(p.leftGoodsList,((t,o,e)=>({a:s.o((o=>s.unref(r.sheep).$router.go("/modules/mall/goods/index",{id:t.id})),t.id),b:s.o((t=>y(t,"left")),t.id),c:"e2aacc04-3-"+e+",e2aacc04-1",d:s.p({size:"md",data:t}),e:t.id}))),d:s.f(p.rightGoodsList,((t,o,e)=>({a:s.o((o=>s.unref(r.sheep).$router.go("/modules/mall/goods/index",{id:t.id})),t.id),b:s.o((t=>y(t,"right")),t.id),c:"e2aacc04-4-"+e+",e2aacc04-1",d:s.p({size:"md",data:t}),e:t.id}))),e:p.pagination.total>0},p.pagination.total>0?{f:s.o(v),g:s.p({status:p.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{h:s.p({title:p.activityInfo.title})})}},u=s._export_sfc(p,[["__scopeId","data-v-e2aacc04"]]);wx.createPage(u);
|