index-data.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="index-data">
  3. <custom-nav :title="title" noback></custom-nav>
  4. <veiw v-if="logged" class="content">
  5. <view class="data-card">
  6. <image src="../../static/icon/data-card.png" class="position-center"></image>
  7. <view class="data-card-text position-center">
  8. <text class="text">累计业绩(元)</text>
  9. <text class="num">{{ total_income | numDot }}元</text>
  10. </view>
  11. </view>
  12. <view class="storage">
  13. <view class="storage-item">
  14. <text class="storage-text">{{ my_storage | numDot }}件</text>
  15. <text class="storage-num">我的库存</text>
  16. </view>
  17. <view class="line"></view>
  18. <view class="storage-item">
  19. <text class="storage-text">{{ down_storage | numDot }}件</text>
  20. <text class="storage-num">下级库存</text>
  21. </view>
  22. </view>
  23. <view class="income">
  24. <view class="nav">
  25. <text class="nav-text">本月营收情况</text>
  26. <navigator class="nav-more" url="../income-running/income-running">
  27. <text class="more">更多</text>
  28. <text class="cuIcon-right"></text>
  29. </navigator>
  30. </view>
  31. <view class="data">
  32. <view class="chart">
  33. <chart-progress :chartData="moneyChartData" width="210" height="210" title="总业绩" :value="total_income + '元'" />
  34. </view>
  35. <view class="data-nums">
  36. <view class="data-item">
  37. <text class="data-text">本月业绩</text>
  38. <text class="data-num">{{ month_income | numDot }}元</text>
  39. </view>
  40. <view class="data-item">
  41. <text class="data-text">本月收款</text>
  42. <text class="data-num">{{ month_order_income | numDot }}元</text>
  43. </view>
  44. <view class="data-item">
  45. <text class="data-text">本月零售</text>
  46. <text class="data-num">{{ month_sold_income | numDot }}元</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="team">
  52. <view class="nav">
  53. <text class="nav-text">本月新增团队成员</text>
  54. <navigator class="nav-more" url="../team-manage/team-manage">
  55. <text class="more">更多</text>
  56. <text class="cuIcon-right"></text>
  57. </navigator>
  58. </view>
  59. <view class="data">
  60. <view class="chart">
  61. <chart-progress :chartData="teamChartData" width="210" height="210" title="总人数" :value="total_team_num + '人'" />
  62. </view>
  63. <view class="data-nums">
  64. <view class="data-item">
  65. <text class="data-text">新增总数</text>
  66. <text class="data-num">{{ month_team_num | numDot }}人</text>
  67. </view>
  68. <view class="data-item">
  69. <text class="data-text">特级代理</text>
  70. <text class="data-num">{{ month_super_num | numDot }}人</text>
  71. </view>
  72. <view class="data-item">
  73. <text class="data-text">顶级代理</text>
  74. <text class="data-num">{{ month_top_num | numDot }}人</text>
  75. </view>
  76. <view class="data-item">
  77. <text class="data-text">直属下级</text>
  78. <text class="data-num">{{ month_direct_num | numDot }}人</text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="rank">
  84. <view class="nav">
  85. <text class="nav-text">本月团队个人业绩排行榜</text>
  86. <navigator class="nav-more" url="../team-achievement/team-achievement">
  87. <text class="more">更多</text>
  88. <text class="cuIcon-right"></text>
  89. </navigator>
  90. </view>
  91. <view class="team-rank-item" v-for="(item, index) in team_rank" :key="index">
  92. <image :src="item.avatar"></image>
  93. <text class="user_name">{{ item.nickname }}</text>
  94. <text class="level_name"><text class="levelname"><text class="cuIcon-crownfill"></text>{{ item.level }}</text></text>
  95. <text class="moneyNum">{{ item.money }}元</text>
  96. </view>
  97. </view>
  98. </veiw>
  99. <view v-else class="login-btn" style="height: 100%;">
  100. <navigator open-type="reLaunch" url="../../pages/login-reg/login-reg">登录/注册</navigator>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import { _API_IndexData } from '@/apis/app.js'
  106. import chartProgress from '@/components/charts/chart-progress.vue'
  107. export default {
  108. components: {
  109. chartProgress
  110. },
  111. data() {
  112. return {
  113. title: '数据',
  114. total_income: 0, // 累计业绩
  115. my_storage: 0, // 我的库存
  116. down_storage: 0, // 下级库存
  117. month_income: 0, // 本月业绩
  118. month_order_income: 0, // 本月收款
  119. month_sold_income: 0, // 本月零售
  120. total_team_num: 0, // 团队总人数
  121. month_team_num: 0, // 本月新增人数
  122. month_super_num: 0, // 本月新增特级代理人数
  123. month_top_num: 0, // 本月新增顶级代理人数
  124. month_direct_num: 0, // 本月新增直属代理人数
  125. team_rank: []
  126. }
  127. },
  128. computed: {
  129. logged() { return this.$store.state.app.token ? true : false},
  130. moneyChartData () {
  131. return {
  132. series: [
  133. {
  134. name: '本月新增业绩人数占比总业绩',
  135. data: this.month_team_num / this.total_income,
  136. color: '#F76454'
  137. }
  138. ]
  139. }
  140. },
  141. teamChartData () {
  142. return {
  143. series: [
  144. {
  145. name: '本月新增团队人数占比总团队人数',
  146. data: this.month_income / this.total_team_num,
  147. color: '#F76454'
  148. }
  149. ]
  150. }
  151. },
  152. },
  153. created() {
  154. uni.startPullDownRefresh()
  155. },
  156. onPullDownRefresh() {
  157. this.getData()
  158. },
  159. methods: {
  160. getData() {
  161. _API_IndexData().then(res => {
  162. this.total_income = res.data.total_income
  163. this.my_storage = res.data.my_storage
  164. this.down_storage = res.data.down_storage
  165. this.month_income = res.data.month_income
  166. this.month_order_income = res.data.month_order_income
  167. this.month_sold_income = res.data.month_sold_income
  168. this.total_team_num = res.data.total_team_num
  169. this.month_team_num = res.data.month_team_num
  170. this.month_super_num = res.data.month_super_num
  171. this.month_top_num = res.data.month_top_num
  172. this.month_direct_num = res.data.month_direct_num
  173. this.team_rank = res.data.team_rank
  174. uni.stopPullDownRefresh()
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .index-data {
  182. @include page();
  183. .content {
  184. .storage {
  185. height: 160rpx;
  186. background: #FFFFFF;
  187. @include flex();
  188. justify-content: space-between;
  189. .storage-item {
  190. @include flex(column);
  191. flex: 1;
  192. height: 100%;
  193. .storage-text {
  194. font-size: 32rpx;
  195. color: $app-base-color;
  196. }
  197. .storage-num {
  198. font-size: 26rpx;
  199. margin-top: 20rpx;
  200. }
  201. }
  202. .line {
  203. width: 1rpx;
  204. height: 100rpx;
  205. background: #F2F2F2;
  206. }
  207. }
  208. .income, .team, .rank {
  209. height: 360rpx;
  210. background: #FFFFFF;
  211. border-top: 10rpx solid $app-base-bg;
  212. .nav {
  213. @include flex();
  214. height: 90rpx;
  215. padding: 0 30rpx;
  216. font-size: 32rpx;
  217. box-sizing: border-box;
  218. justify-content: space-between;
  219. border-bottom: 1rpx solid $app-base-bg;
  220. .nav-more {
  221. @include flex();
  222. height: 100%;
  223. width: 123rpx;
  224. justify-content: flex-end;
  225. color: $app-sec-text-color;
  226. .more {
  227. font-size: 26rpx;
  228. margin-right: 8rpx;
  229. }
  230. }
  231. }
  232. .data {
  233. @include flex();
  234. height: 270rpx;
  235. padding: 30rpx 60rpx;
  236. box-sizing: border-box;
  237. justify-content: space-between;
  238. .chart {
  239. height: 100%;
  240. width: 210rpx;
  241. }
  242. .data-nums {
  243. @include flex(column);
  244. height: 100%;
  245. width: 280rpx;
  246. .data-item {
  247. @include flex();
  248. flex: 1;
  249. width: 100%;
  250. font-size: 26rpx;
  251. justify-content: space-between;
  252. .data-num {
  253. color: $app-base-color;
  254. }
  255. }
  256. }
  257. }
  258. .team-rank-item {
  259. @include flex();
  260. height: 90rpx;
  261. padding: 12rpx 30rpx;
  262. box-sizing: border-box;
  263. justify-content: space-between;
  264. border-bottom: 1rpx solid $app-base-bg;
  265. image {
  266. width: 66rpx;
  267. height: 66rpx;
  268. border-radius: 50%;
  269. margin-right: 30rpx;
  270. }
  271. .user_name {
  272. font-size: 32rpx;
  273. margin-right: 30rpx;
  274. }
  275. .level_name {
  276. @include flex();
  277. flex: 1;
  278. height: 100%;
  279. justify-content: flex-start;
  280. .levelname {
  281. @include flex();
  282. width: 130rpx;
  283. height: 36rpx;
  284. color: #FFFFFF;
  285. font-size: 20rpx;
  286. border-radius: 18rpx;
  287. background: $app-base-color;
  288. .cuIcon-crownfill {
  289. margin-right: 6rpx;
  290. }
  291. }
  292. }
  293. .moneyNum {
  294. font-size: 26rpx;
  295. color: $app-base-color;
  296. }
  297. }
  298. }
  299. }
  300. }
  301. </style>