employeeAdditionCount.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view>
  3. <view class="headers ">
  4. <view class="header">
  5. <view class="dis a-c j-start ">
  6. <u-icon name="arrow-left" size="40" @tap="back"></u-icon>
  7. <text style="margin: auto;">新增统计</text>
  8. </view>
  9. </view>
  10. <view class="sub">
  11. <u-subsection :list="list" mode="subsection" :current="current" :bold="false" @change="subChange"
  12. active-color="rgba(255,140,4,0.6)" style="background-color: white;"></u-subsection>
  13. </view>
  14. </view>
  15. <view style="padding: 164px 16px 16px;">
  16. <view class="dataset">
  17. <view class="title dis a-c ">
  18. <view class="tag"></view>
  19. <text>新增人员数据统计</text>
  20. </view>
  21. <view class="data dis f-wrap a-c j-c">
  22. <view class="dis f-c a-c ">
  23. <text>{{dataInfo.allCount}}</text>
  24. <text>全部人员</text>
  25. </view>
  26. <view class="dis f-c a-c ">
  27. <text>{{dataInfo.yesCount}}</text>
  28. <text>已认证</text>
  29. </view>
  30. <view class="dis f-c a-c ">
  31. <text>{{dataInfo.noCount}}</text>
  32. <text>未认证</text>
  33. </view>
  34. <view class="dis f-c a-c ">
  35. <text>{{dataInfo.oneCount}}</text>
  36. <text>一级代理</text>
  37. </view>
  38. <view class="dis f-c a-c ">
  39. <text>{{dataInfo.twoCount}}</text>
  40. <text>二级代理</text>
  41. </view>
  42. <view class="dis f-c a-c ">
  43. <text>{{dataInfo.threeCount}}</text>
  44. <text>三级代理</text>
  45. </view>
  46. <view class="dis f-c a-c ">
  47. <text>{{dataInfo.tempCount}}</text>
  48. <text>临时代理</text>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="chartData">
  53. <view class="title dis a-c ">
  54. <view class="tag"></view>
  55. <text>新增人员数据列表</text>
  56. </view>
  57. <view class="echarts-data">
  58. <qiun-data-charts v-if="current==0" type="column" :opts="opts1" :chartData="chartData1"
  59. :ontouch="true" style="height: 250px;" />
  60. <view class="">
  61. <qiun-data-charts v-if="current==1 || current==2" type="bar" :opts="opts2"
  62. :chartData="chartData2" :ontouch="true" :style="{height:current==1?'250px':'600px'}" />
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. mapState
  72. } from "vuex"
  73. export default {
  74. data() {
  75. return {
  76. list: [{
  77. name: '当日'
  78. },
  79. {
  80. name: '7天'
  81. },
  82. {
  83. name: '近30天'
  84. }
  85. ],
  86. current: 0,
  87. chartData1: {
  88. },
  89. chartData2: {},
  90. opts1: {
  91. dataLabel: false,
  92. color: ["#FFB632"],
  93. padding: [15, 15, 0, 5],
  94. touchMoveLimit: 24,
  95. legend: {
  96. show: false,
  97. position: "top"
  98. },
  99. xAxis: {
  100. disableGrid: true,
  101. scrollShow: true,
  102. itemCount: 4
  103. },
  104. yAxis: {
  105. disableGrid: true,
  106. splitNumber: 5,
  107. data: [{}]
  108. },
  109. extra: {
  110. column: {
  111. type: "group",
  112. width: 22,
  113. linearType: "custom",
  114. seriesGap: 5,
  115. barBorderCircle: true,
  116. customColor: [
  117. "#FF910A"
  118. ],
  119. }
  120. }
  121. },
  122. opts2: {
  123. dataLabel: false,
  124. color: ["#41B9F7", "#FF920B", "#FDD96B", "#6A95F6"],
  125. padding: [15, 30, 0, 5],
  126. enableScroll: false,
  127. legend: {},
  128. xAxis: {
  129. boundaryGap: "justify",
  130. disableGrid: false,
  131. min: 0,
  132. axisLine: false,
  133. max: 70
  134. },
  135. yAxis: {
  136. showTitle: true,
  137. data: [{
  138. type: "categories",
  139. title: "日期/人数"
  140. }]
  141. },
  142. extra: {
  143. bar: {
  144. type: "stack",
  145. width: 5,
  146. meterBorde: 1,
  147. meterFillColor: "#FFFFFF",
  148. activeBgColor: "#000000",
  149. activeBgOpacity: 0.08,
  150. categoryGap: 2
  151. },
  152. tooltip: {
  153. borderRadius: 2,
  154. boxPadding: 6,
  155. }
  156. }
  157. },
  158. dateType: 1,
  159. dataInfo: {}
  160. }
  161. },
  162. computed: {},
  163. onShow() {
  164. },
  165. onLoad() {
  166. this.getServerData1();
  167. },
  168. methods: {
  169. getMaxOrFive(arr) {
  170. if (arr.length === 0) {
  171. console.log("数组是空的,无法判断最大值。");
  172. return null; // 如果数组为空,返回 null 或者其他您希望的值
  173. }
  174. const maxValue = Math.max(...arr); // 获取数组中的最大值
  175. return maxValue < 10 ? maxValue : 5; // 判断并返回最大值或5
  176. },
  177. async getServerData1() {
  178. let res = await this.$http.get(
  179. `/app/customer/authStatics?dateType=${this.dateType}`);
  180. if (res.code == '200') {
  181. this.dataInfo = res.data;
  182. let rualit = {
  183. categories: res.data.staticsData.categories,
  184. series: [{
  185. name: "人数",
  186. data: res.data.staticsData.series
  187. }]
  188. };
  189. let sum = this.getMaxOrFive(res.data.staticsData.series);
  190. if (sum) {
  191. this.opts1.yAxis.splitNumber = sum;
  192. }
  193. this.chartData1 = JSON.parse(JSON.stringify(rualit));
  194. }
  195. },
  196. async getServerData2() {
  197. let res = await this.$http.get(
  198. `/app/customer/authStatics?dateType=${this.dateType}`);
  199. if (res.code == '200') {
  200. this.dataInfo = res.data;
  201. let rualit = {
  202. categories: res.data.staticsData.categories,
  203. series: [{
  204. name: "一级代理",
  205. data: res.data.staticsData.series[0].data,
  206. },
  207. {
  208. name: "二级代理",
  209. data: res.data.staticsData.series[1].data,
  210. },
  211. {
  212. name: "三级代理",
  213. data: res.data.staticsData.series[2].data,
  214. },
  215. {
  216. name: "临时代理",
  217. data: res.data.staticsData.series[3].data,
  218. }
  219. ]
  220. };
  221. this.chartData2 = JSON.parse(JSON.stringify(rualit));
  222. }
  223. },
  224. subChange(index) {
  225. this.current = index;
  226. switch (index) {
  227. case 0:
  228. this.dateType = 1;
  229. this.getServerData1();
  230. break;
  231. case 1:
  232. this.dateType = 2;
  233. this.getServerData2();
  234. break;
  235. case 2:
  236. this.dateType = 3;
  237. this.getServerData2();
  238. break;
  239. }
  240. },
  241. //页面返回按钮
  242. back() {
  243. uni.navigateBack({
  244. delta: 1, // 返回的页面数,如果是1表示返回上一页
  245. success: function() {}
  246. });
  247. },
  248. }
  249. }
  250. </script>
  251. <style lang="scss" scoped>
  252. /deep/ {
  253. .u-subsection {}
  254. }
  255. page {
  256. background-color: #F7F7F7;
  257. }
  258. .headers {
  259. position: fixed;
  260. top: 0;
  261. left: 0;
  262. z-index: 999999;
  263. width: 100%;
  264. .header {
  265. width: 100%;
  266. height: auto;
  267. padding: 50px 16px 14px;
  268. background: linear-gradient(180deg, #FEECD1 0%, #FFFFFF 100%);
  269. text {
  270. font-size: 18px;
  271. font-weight: bold;
  272. color: #000;
  273. }
  274. }
  275. .sub {
  276. padding: 8px 15px;
  277. background: #fff;
  278. border-bottom: 1px solid #EEEEEE;
  279. }
  280. }
  281. .dataset {
  282. background: #FFFFFF;
  283. border-radius: 5px;
  284. border-bottom: 1px solid #EEEEEE;
  285. .title {
  286. padding: 11px 0;
  287. .tag {
  288. width: 4px;
  289. height: 16px;
  290. background: linear-gradient(132deg, #FFB834 0%, #FF8D04 100%);
  291. border-radius: 5px;
  292. }
  293. text {
  294. font-size: 16px;
  295. color: #333;
  296. font-weight: bold;
  297. margin-left: 6px;
  298. }
  299. }
  300. .data {
  301. margin: 0 10px 10px;
  302. background: #FBFBFB;
  303. border-radius: 4px;
  304. padding: 15px;
  305. >view {
  306. width: 33.33%;
  307. text:first-child {
  308. font-size: 22px;
  309. color: #333;
  310. font-weight: bold;
  311. }
  312. text:last-child {
  313. font-size: 12px;
  314. color: #999;
  315. }
  316. }
  317. }
  318. }
  319. .chartData {
  320. background: #FFFFFF;
  321. border-radius: 5px;
  322. border-bottom: 1px solid #EEEEEE;
  323. margin-top: 12px;
  324. .title {
  325. padding: 11px 0;
  326. .tag {
  327. width: 4px;
  328. height: 16px;
  329. background: linear-gradient(132deg, #FFB834 0%, #FF8D04 100%);
  330. border-radius: 5px;
  331. }
  332. text {
  333. font-size: 16px;
  334. color: #333;
  335. font-weight: bold;
  336. margin-left: 6px;
  337. }
  338. }
  339. .echarts-data {
  340. padding: 0 8px 12px;
  341. }
  342. }
  343. </style>