1 line
36 KiB
Plaintext
1 line
36 KiB
Plaintext
|
{"version":3,"file":"commission-ranking.js","sources":["../../../../../../src/modules/mall/commission/commission-ranking.vue","../../../../../../uniPage:/bW9kdWxlc1xtYWxsXGNvbW1pc3Npb25cY29tbWlzc2lvbi1yYW5raW5nLnZ1ZQ"],"sourcesContent":["<!-- 佣金排行榜 -->\r\n<template>\r\n <s-layout title=\"佣金排行榜\">\r\n <view class=\"CommissionRank\">\r\n <view class=\"header\">\r\n <view class=\"rank\" v-if=\"state.position\">\r\n 您目前的排名\r\n <text class=\"num\">{{ state.position }}</text>\r\n 名\r\n </view>\r\n <view class=\"rank\" v-else>您目前暂无排名</view>\r\n </view>\r\n <view class=\"wrapper\">\r\n <view class=\"nav acea-row row-around\" style=\"display: flex; justify-content: space-around\">\r\n <view\r\n class=\"item\"\r\n :class=\"state.currentTab === index ? 'font-color' : ''\"\r\n v-for=\"(item, index) in tabMaps\"\r\n :key=\"index\"\r\n @click=\"switchTap(index)\"\r\n >\r\n {{ item }}\r\n </view>\r\n </view>\r\n <view class=\"list\">\r\n <view\r\n class=\"item acea-row row-between-wrapper\"\r\n v-for=\"(item, index) in state.rankList\"\r\n :key=\"index\"\r\n >\r\n <view class=\"num\" v-if=\"index <= 2\">\r\n <image :src=\"'/static/images/medal0' + (index + 1) + '.png'\" />\r\n </view>\r\n <view class=\"num\" v-else>\r\n {{ index + 1 }}\r\n </view>\r\n <view class=\"picTxt acea-row row-between-wrapper\">\r\n <view class=\"pictrue\">\r\n <image :src=\"item.avatar\" />\r\n </view>\r\n <view class=\"text line1\">{{ item.nickname }}</view>\r\n </view>\r\n <view class=\"people font-color\">¥{{ fen2yuan(item.brokeragePrice) }}</view>\r\n </view>\r\n </view>\r\n <view\r\n class=\"noCommodity\"\r\n v-if=\"state.rankList.length === 0 && (state.page !== 1 || state.active === 0)\"\r\n >\r\n <emptyPage title=\"暂无排行~\" />\r\n </view>\r\n </view>\r\n </view>\r\n </s-layout>\r\n</template>\r\n\r\n<script setup>\r\nimport sheep from '@/sheep'\r\nimport { onLoad } from '@dcloudio/uni-app'\r\nimport { reactive } from 'vue'\r\nimport BrokerageApi from '@/sheep/api/trade/brokerage'\r\nimport { fen2yuan } from '@/sheep/hooks/useGoods'\r\n\r\nconst tabMaps = ['周排行', '月排行']\r\n\r\nconst state = reactive({\r\n currentTab: 0,\r\n position: 0, // 排名\r\n rankList: [],\r\n})\r\n\r\nasync function switchTap(index) {\r\n state.currentTab = index\r\n state.rankList = []\r\n calculateTimes()\r\n getBrokerageRankList()\r\n getBrokerageRankNumber()\r\n}\r\n\r\nasync function getBrokerageRankList() {\r\n const { code, data } = await BrokerageApi.getBrokerageUserChildSummaryPageByPrice({\r\n pageNo: 1,\r\n pageSize: 10,\r\n 'times[0]': state.times[0],\r\n 'times[1]': state.times[1],\r\n })\r\n if (code !== 0) {\r\n return\r\n }\r\n state.rankList = data.list\r\n}\r\n\r\nasync function getBrokerageRankNumber() {\r\n const { code, data } = await BrokerageApi.getRankByPrice({\r\n times: state.times,\r\n })\r\n if (code !== 0) {\r\n return\r\n }\r\n state.position = data\r\n}\r\n\r\nfunction formatDate(date) {\r\n return sheep.$helper.timeFormat(date, 'yyyy-mm-dd hh:MM:ss')\r\n}\r\n\r\nfunction calculateTimes() {\r\n let times\r\n if (state.currentTab === 0) {\r\n times = getWeekTimes()\r\n } else {\r\n times = getMonthTimes()\r\n }\r\n state.times = [formatDate(times[0]), formatDate(times[1])]\r\n}\r\n\r\nonLoad(function () {\r\n calculateTimes()\r\n getBrokerageRankList()\r\n getBrokerageRankNumber()\r\n})\r\n\r\n// TODO 芋艿:此处可考虑抽离\r\n/**\r\n * 获得当前周的开始和结束时间\r\n */\r\nfunction getWeekTimes() {\r\n const today = new Date()\r\n const dayOfWeek = t
|