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"),l=require("../../../sheep/api/promotion/rewardActivity.js"),d=require("../../../sheep/hooks/useGoods.js"),p=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 c={__name:"index",setup(t){const c=s.reactive({activityId:0,activityInfo:{},pagination:{list:[],total:1,pageNo:1,pageSize:8},loadStatus:"",leftGoodsList:[],rightGoodsList:[]});let u=0,f=0,g=0;function y(t=0,o="left"){c.pagination.list[u]&&("left"===o?f+=t:g+=t,f<=g?c.leftGoodsList.push(c.pagination.list[u]):c.rightGoodsList.push(c.pagination.list[u]),u++)}function m(){return n(this,null,(function*(){const t={};2===c.activityInfo.productScope?t.ids=c.activityInfo.productSpuIds.join(","):3===c.activityInfo.productScope&&(t.categoryIds=c.activityInfo.productSpuIds.join(",")),c.loadStatus="loading";const{code:n,data:r}=yield p.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:c.pagination.pageNo,pageSize:c.pagination.pageSize},t));0===n&&(c.pagination.list=s.lodash.concat(c.pagination.list,r.list),c.pagination.total=r.total,c.loadStatus=c.pagination.list.length<c.pagination.total?"more":"noMore",y())}))}function v(){"noMore"!==c.loadStatus&&(c.pagination.pageNo++,m())}return s.onReachBottom((()=>{v()})),s.onLoad((t=>n(this,null,(function*(){c.activityId=t.activityId,yield function(t){return n(this,null,(function*(){const{code:o,data:e}=yield l.RewardActivityApi.getRewardActivity(t);0===o&&(c.activityInfo=e)}))}(c.activityId),yield m(c.activityId)})))),(t,o)=>s.e({a:s.f(c.activityInfo.rules,((t,o,e)=>({a:s.t(s.unref(d.formatRewardActivityRule)(c.activityInfo,t)),b:t}))),b:s.p({bgColor:"#fff"}),c:s.f(c.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:"2b398f46-3-"+e+",2b398f46-1",d:s.p({size:"md",data:t}),e:t.id}))),d:s.f(c.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:"2b398f46-4-"+e+",2b398f46-1",d:s.p({size:"md",data:t}),e:t.id}))),e:c.pagination.total>0},c.pagination.total>0?{f:s.o(v),g:s.p({status:c.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{h:s.p({title:c.activityInfo.title})})}},u=s._export_sfc(c,[["__scopeId","data-v-2b398f46"]]);wx.createPage(u);
|