2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
"use strict";var e=(e,t,o)=>new Promise(((i,s)=>{var n=e=>{try{a(o.next(e))}catch(t){s(t)}},l=e=>{try{a(o.throw(e))}catch(t){s(t)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(n,l);a((o=o.apply(e,t)).next())}));const t=require("../../../common/vendor.js"),o=require("../../../sheep/index.js"),i=require("../../../sheep/api/product/history.js"),s=require("../../../sheep/helper/utils.js");if(!Array){(t.resolveComponent("s-goods-item")+t.resolveComponent("su-fixed")+t.resolveComponent("uni-load-more")+t.resolveComponent("s-empty")+t.resolveComponent("s-layout")+t.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../sheep/components/s-goods-item/s-goods-item.js")+(()=>"../../../sheep/ui/su-fixed/su-fixed.js")+(()=>"../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../../../sheep/components/s-empty/s-empty.js")+(()=>"../../../sheep/components/s-layout/s-layout.js"))();const n={__name:"goods-log",setup(n){t.useCssVars((e=>({"7fcd9f6e":t.unref(l)})));const l=o.sheep.$platform.navbar,a={list:[],pageNo:1,total:1,pageSize:10},d=t.reactive({pagination:s.cloneDeep(a),loadStatus:"",editMode:!1,selectedSpuIdList:[],selectAll:!1});function p(){return e(this,null,(function*(){d.loadStatus="loading";const{code:e,data:o}=yield i.SpuHistoryApi.getBrowseHistoryPage({pageNo:d.pagination.pageNo,pageSize:d.pagination.pageSize});0===e&&(d.pagination.list=t.lodash.concat(d.pagination.list,o.list),d.pagination.total=o.total,d.loadStatus=d.pagination.list.length<d.pagination.total?"more":"noMore")}))}const u=e=>{d.selectedSpuIdList.includes(e)?d.selectedSpuIdList.splice(d.selectedSpuIdList.indexOf(e),1):d.selectedSpuIdList.push(e),d.selectAll=d.selectedSpuIdList.length===d.pagination.list.length},c=()=>{d.selectAll=!d.selectAll,d.selectAll?d.pagination.list.forEach((e=>{d.selectedSpuIdList.includes(e.spuId)&&d.selectedSpuIdList.splice(d.selectedSpuIdList.indexOf(e.spuId),1),d.selectedSpuIdList.push(e.spuId)})):d.selectedSpuIdList=[]};function r(){return e(this,null,(function*(){if(d.selectedSpuIdList.length<=0)return;const{code:e}=yield i.SpuHistoryApi.deleteBrowseHistory(d.selectedSpuIdList);0===e&&m()}))}function g(){return e(this,null,(function*(){const{code:e}=yield i.SpuHistoryApi.cleanBrowseHistory();0===e&&m()}))}function m(){d.editMode=!1,d.selectedSpuIdList=[],d.selectAll=!1,d.pagination=a,p()}function h(){"noMore"!==d.loadStatus&&(d.pagination.pageNo+=1,p())}return t.onReachBottom((()=>{h()})),t.onLoad((()=>{p()})),(e,i)=>t.e({a:t.t(d.pagination.total),b:d.editMode&&d.pagination.total},d.editMode&&d.pagination.total?{c:t.o((e=>d.editMode=!1))}:{},{d:!d.editMode&&d.pagination.total},!d.editMode&&d.pagination.total?{e:t.o((e=>d.editMode=!0))}:{},{f:t.f(d.pagination.list,((e,i,s)=>t.e(d.editMode?{a:d.selectedSpuIdList.includes(e.spuId),b:t.o((t=>u(e.spuId)),e.id),c:t.o((t=>u(e.spuId)),e.id)}:{},{d:t.o((i=>t.unref(o.sheep).$router.go("/modules/mall/goods/index",{id:e.spuId})),e.id),e:"7b781b0d-2-"+s+",7b781b0d-1",f:t.p({title:e.spuName,img:e.picUrl,price:e.price,skuText:e.introduction,priceColor:"#FF3000",titleWidth:400}),g:e.id}))),g:d.editMode,h:d.selectAll,i:t.o(c),j:t.o(c),k:t.n({"ui-BG-Main-Gradient":d.selectedSpuIdList.length>0,"ui-Shadow-Main":d.selectedSpuIdList.length>0}),l:t.o(r),m:t.o(g),n:d.editMode,o:t.p({bottom:!0,val:0,placeholder:!0}),p:d.pagination.total>0},d.pagination.total>0?{q:t.o(h),r:t.p({status:d.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{s:0===d.pagination.total},0===d.pagination.total?{t:t.p({text:"暂无浏览记录",icon:"/static/collect-empty.png"})}:{},{v:t.p({title:"我的足迹",bgStyle:{color:"#f2f2f2"}}),w:t.s(e.__cssVars())})}},l=t._export_sfc(n,[["__scopeId","data-v-7b781b0d"]]);wx.createPage(l);
|