acdr-ui/dist/build/mp-weixin/modules/mall/commission/commission-ranking.js

2 lines
2.1 KiB
JavaScript

"use strict";var e=(e,t,n)=>new Promise(((r,a)=>{var o=e=>{try{s(n.next(e))}catch(t){a(t)}},i=e=>{try{s(n.throw(e))}catch(t){a(t)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,i);s((n=n.apply(e,t)).next())}));const t=require("../../../common/vendor.js"),n=require("../../../sheep/index.js"),r=require("../../../sheep/api/trade/brokerage.js"),a=require("../../../sheep/hooks/useGoods.js");if(!Array){(t.resolveComponent("emptyPage")+t.resolveComponent("s-layout")+t.resolveComponent("layout-default-uni"))()}Math;const o={__name:"commission-ranking",setup(o){const i=["周排行","月排行"],s=t.reactive({currentTab:0,position:0,rankList:[]});function c(){return e(this,null,(function*(){const{code:e,data:t}=yield r.BrokerageApi.getBrokerageUserChildSummaryPageByPrice({pageNo:1,pageSize:10,"times[0]":s.times[0],"times[1]":s.times[1]});0===e&&(s.rankList=t.list)}))}function u(){return e(this,null,(function*(){const{code:e,data:t}=yield r.BrokerageApi.getRankByPrice({times:s.times});0===e&&(s.position=t)}))}function l(e){return n.sheep.$helper.timeFormat(e,"yyyy-mm-dd hh:MM:ss")}function g(){let e;e=0===s.currentTab?function(){const e=new Date,t=e.getDay();return[new Date(e.getFullYear(),e.getMonth(),e.getDate()-t,0,0,0),new Date(e.getFullYear(),e.getMonth(),e.getDate()+(6-t),23,59,59)]}():function(){const e=new Date,t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n,1,0,0,0),a=new Date(t,n+1,1),o=new Date(a.getTime()-1);return[r,o]}(),s.times=[l(e[0]),l(e[1])]}return t.onLoad((function(){g(),c(),u()})),(n,r)=>t.e({a:s.position},s.position?{b:t.t(s.position)}:{},{c:t.f(i,((n,r,a)=>({a:t.t(n),b:t.n(s.currentTab===r?"font-color":""),c:r,d:t.o((t=>function(t){return e(this,null,(function*(){s.currentTab=t,s.rankList=[],g(),c(),u()}))}(r)),r)}))),d:t.f(s.rankList,((e,n,r)=>t.e({a:n<=2},n<=2?{b:"/static/images/medal0"+(n+1)+".png"}:{c:t.t(n+1)},{d:e.avatar,e:t.t(e.nickname),f:t.t(t.unref(a.fen2yuan)(e.brokeragePrice)),g:n}))),e:0===s.rankList.length&&(1!==s.page||0===s.active)},0!==s.rankList.length||1===s.page&&0!==s.active?{}:{f:t.p({title:"暂无排行~"})},{g:t.p({title:"佣金排行榜"})})}},i=t._export_sfc(o,[["__scopeId","data-v-4f1f246d"]]);wx.createPage(i);