statistics.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view>
  3. <view class="padding-main">
  4. <!-- 推广客户 -->
  5. <view class="container padding-main border-radius-main bg-white">
  6. <view class="title border-color-main padding-left-lg text-size fw-b">推广客户</view>
  7. <view class="margin-top-lg oh tc">
  8. <block v-for="(item, index) in stats_user_data_list" :key="index">
  9. <view class="item fl padding-main">
  10. <view class="cr-base">{{item.name}}</view>
  11. <view class="single-text margin-top-sm">
  12. <text class="text-size">{{item.value}}</text>
  13. <text class="cr-gray margin-left-sm">人</text>
  14. </view>
  15. </view>
  16. </block>
  17. </view>
  18. </view>
  19. <!-- 返利概况 -->
  20. <view class="container profit-container padding-main border-radius-main bg-white spacing-mt">
  21. <view class="title border-color-main padding-left-lg text-size fw-b">返利概况</view>
  22. <view class="margin-top-lg oh tc">
  23. <block v-for="(item, index) in stats_profit_data_list" :key="index">
  24. <view class="item fl padding-main">
  25. <view class="cr-base">{{item.name}}</view>
  26. <view class="single-text margin-top-sm">
  27. <text :class="'fw-b text-size '+item.ent">{{currency_symbol}}{{item.value}}</text>
  28. </view>
  29. </view>
  30. </block>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 结尾 -->
  35. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  36. </view>
  37. </template>
  38. <script>
  39. const app = getApp();
  40. import componentBottomLine from "../../../../components/bottom-line/bottom-line";
  41. export default {
  42. data() {
  43. return {
  44. data_list_loding_status: 1,
  45. data_list_loding_msg: '加载中...',
  46. data_bottom_line_status: true,
  47. stats_user_data_list: [
  48. {name: "已推广用户总数", value: 0},
  49. {name: "已消费用户总数", value: 0}
  50. ],
  51. stats_profit_data_list: [
  52. {name: "返佣总额", value: '0.00', ent: "cr-base"},
  53. {name: "待结算", value: '0.00', ent: "cr-yellow"},
  54. {name: "已结算", value: '0.00', ent: "cr-green"}
  55. ],
  56. user_data: null,
  57. profit_data: null,
  58. // 基础配置
  59. currency_symbol: app.globalData.data.currency_symbol
  60. };
  61. },
  62. components: {
  63. componentBottomLine
  64. },
  65. props: {},
  66. onShow() {
  67. // 数据加载
  68. this.init();
  69. // 初始化配置
  70. this.init_config();
  71. // 分享菜单处理
  72. app.globalData.page_share_handle();
  73. },
  74. // 下拉刷新
  75. onPullDownRefresh() {
  76. this.init();
  77. },
  78. methods: {
  79. // 初始化配置
  80. init_config(status) {
  81. if ((status || false) == true) {
  82. this.setData({
  83. currency_symbol: app.globalData.get_config('currency_symbol')
  84. });
  85. } else {
  86. app.globalData.is_config(this, 'init_config');
  87. }
  88. },
  89. // 获取数据
  90. init() {
  91. uni.showLoading({
  92. title: '加载中...'
  93. });
  94. this.setData({
  95. data_list_loding_status: 1
  96. });
  97. uni.request({
  98. url: app.globalData.get_request_url("index", "statistics", "membershiplevelvip"),
  99. method: 'POST',
  100. data: {},
  101. dataType: 'json',
  102. success: res => {
  103. uni.hideLoading();
  104. uni.stopPullDownRefresh();
  105. if (res.data.code == 0) {
  106. var data = res.data.data;
  107. // 用户统计
  108. var temp_stats_user = this.stats_user_data_list;
  109. temp_stats_user[0]['value'] = data.user_total.user_count || 0;
  110. temp_stats_user[1]['value'] = data.user_total.valid_user_count || 0;
  111. // 收益统计
  112. var temp_stats_profit = this.stats_profit_data_list;
  113. temp_stats_profit[0]['value'] = data.user_profit_total_price || '0.00';
  114. temp_stats_profit[1]['value'] = data.user_profit_stay_price || '0.00';
  115. temp_stats_profit[2]['value'] = data.user_profit_already_price || '0.00';
  116. // 数据设置
  117. this.setData({
  118. stats_user_data_list: temp_stats_user,
  119. stats_profit_data_list: temp_stats_profit,
  120. user_data: data.user_chart || null,
  121. profit_data: data.profit_chart || null,
  122. data_list_loding_status: 3,
  123. data_bottom_line_status: true,
  124. data_list_loding_msg: ''
  125. });
  126. } else {
  127. this.setData({
  128. data_list_loding_status: 2,
  129. data_bottom_line_status: false,
  130. data_list_loding_msg: res.data.msg
  131. });
  132. if (app.globalData.is_login_check(res.data, this, 'init')) {
  133. app.globalData.showToast(res.data.msg);
  134. }
  135. }
  136. },
  137. fail: () => {
  138. uni.hideLoading();
  139. uni.stopPullDownRefresh();
  140. this.setData({
  141. data_list_loding_status: 2,
  142. data_bottom_line_status: false,
  143. data_list_loding_msg: '服务器请求出错'
  144. });
  145. app.globalData.showToast('服务器请求出错');
  146. }
  147. });
  148. }
  149. }
  150. };
  151. </script>
  152. <style>
  153. @import './statistics.css';
  154. </style>