index.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041
  1. <template>
  2. <div class="statistics-dashboard">
  3. <!-- 数据概览 (Data Overview) -->
  4. <el-card class="overview-section" shadow="never">
  5. <el-row :gutter="20">
  6. <el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16" class="companybox">
  7. <img src="../assets/images/topbg.png" alt="" class="topimg">
  8. <img src="../assets/images/topbg.png" alt="" class="bottomimg">
  9. <div class="companyboxtitle">
  10. 企业数据
  11. </div>
  12. <div class="companyflex">
  13. <div class="topbg companycard cardafter">
  14. <div class="card-title1">
  15. <img src="../assets/images/tab_company.png" alt="" class="icon-img">
  16. 分公司数量
  17. </div>
  18. <div class="card-value highlight1">
  19. <count-to :start-val="0" :end-val="dealderCount" :duration="3600"
  20. class="card-panel-num companynumber" />
  21. </div>
  22. </div>
  23. <div class="companycard cardafter">
  24. <div class="card-title1">
  25. <img src="../assets/images/salesperson.png" alt="" class="icon-img">
  26. 销售数量
  27. </div>
  28. <div class="card-value highlight1">
  29. <count-to :start-val="0" :end-val="groupMgrCount" :duration="3600"
  30. class="card-panel-num companynumber" />
  31. </div>
  32. </div>
  33. <div class="companycard cardafter">
  34. <div class="card-title1">
  35. <img src="../assets/images/member.png" alt="" class="icon-img">
  36. 会员数量
  37. </div>
  38. <div class="card-value highlight1">
  39. <count-to :start-val="0" :end-val="memberCount" :duration="3600" class="card-panel-num companynumber" />
  40. <span class="highlight-today-add companyadd">+{{todayIncreaseUserNum}}</span>
  41. </div>
  42. </div>
  43. <div class="botttombg companycard">
  44. <div class="card-title1">
  45. <img src="../assets/images/tab_enterprise.png" alt="" class="icon-img">
  46. 企微数量
  47. </div>
  48. <div class="card-value highlight1">
  49. <count-to :start-val="0" :end-val="qwMemberNum" :duration="3600" class="card-panel-num companynumber" />
  50. </div>
  51. </div>
  52. </div>
  53. </el-col>
  54. <el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8" class="propertyboxtitle">
  55. <div class="property_title">
  56. 资产概览
  57. </div>
  58. <div class="propertyboxflex">
  59. <div class="property-card propertyline">
  60. <div class="property-title">
  61. <i class="el-icon-money"></i>
  62. 企业资产(元)
  63. </div>
  64. <div class="card-value highlight">
  65. <count-to :start-val="0" :end-val="balance" :duration="3600" class="card-panel-num" />
  66. </div>
  67. </div>
  68. <div class="property-card">
  69. <div class="property-title">
  70. <span>今日消耗 (元)</span>
  71. </div>
  72. <div class="card-value highlight" style="color: rgba(32, 33, 36, 1);margin-top: 10px;">
  73. <count-to :start-val="0" :end-val="todayComsumption" :duration="3600" class="card-panel-num" />
  74. </div>
  75. <div class="card-compare">
  76. 较昨日 <span>+1</span>
  77. </div>
  78. </div>
  79. </div>
  80. </el-col>
  81. </el-row>
  82. <el-row :gutter="20">
  83. <el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  84. <div class="operatetitle">
  85. 经营数据
  86. </div>
  87. <div class="operatetitle-col">
  88. <div class="operatetitle-card">
  89. <div class="card-title">
  90. <i class="el-icon-shopping-cart-full"></i>
  91. 收款总数
  92. </div>
  93. <div class="operate-value highlight">
  94. <count-to :start-val="0" :end-val="recvTotalNum" :duration="3600" class="card-panel-num" />
  95. <div class="yesterdaybox">
  96. 较昨日 <span class="highlight-today-add2">+{{recvTodayNum}}</span>
  97. </div>
  98. </div>
  99. <div class="card-badge">
  100. </div>
  101. </div>
  102. <div class="operatetitle-card">
  103. <div class="card-title">
  104. <i class="el-icon-shopping-cart-full"></i>
  105. 订单总数
  106. </div>
  107. <div class="operate-value highlight">
  108. <count-to :start-val="0" :end-val="orderTotalNum" :duration="3600" class="card-panel-num" />
  109. <div class="yesterdaybox">
  110. 较昨日 <span class="highlight-today-add2">+{{todayOrderNum}}</span>
  111. </div>
  112. </div>
  113. <div class="card-badge">
  114. </div>
  115. </div>
  116. <div class="operatetitle-card">
  117. <div class="card-title">
  118. 平台今日看课人数
  119. </div>
  120. <div class="operate-value highlight">
  121. <count-to :start-val="0" :end-val="todayWatchUserCount" :duration="3600" class="card-panel-num" />
  122. </div>
  123. <div class="card-sub">
  124. <span>配额上限</span>
  125. <span class="sub-value">
  126. <count-to :start-val="0" :end-val="todayWatchUserCount" :duration="3600" class="card-panel-num"
  127. style="color: rgba(49, 185, 154, 1);" />
  128. /
  129. <count-to :start-val="0" :end-val="versionLimit" :duration="3600" class="card-panel-num" />
  130. </span>
  131. </div>
  132. <el-progress :percentage="todayWatchUserCount/versionLimit" :show-text="false"
  133. color="#409EFF"></el-progress>
  134. </div>
  135. <div class="operatetitle-card">
  136. <div class="card-title">
  137. <i class="el-icon-shopping-cart-full"></i>
  138. 商品总数
  139. </div>
  140. <div class="operate-value highlight">
  141. <count-to :start-val="0" :end-val="goodsTotalNum" :duration="3600" class="card-panel-num" />
  142. <div class="yesterdaybox">
  143. 较昨日 <span class="highlight-today-add2">+{{todayGoodsNum}}</span>
  144. </div>
  145. </div>
  146. <div class="card-badge">
  147. </div>
  148. </div>
  149. </div>
  150. </el-col>
  151. <el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8" style="padding-left: 15px;">
  152. <div class="internetbox">
  153. <div class="internet-cardtop">
  154. <div class="cardinnerbox">
  155. <div class="cardtopimg">
  156. <img src="../assets/images/liuliang.png" alt=""><span>剩余流量</span>
  157. </div>
  158. <div class="cardtopnumber">
  159. 100.00GB
  160. </div>
  161. </div>
  162. <div class="progress">
  163. <el-progress :percentage="90" :show-text="false" define-back-color="#000">
  164. </el-progress>
  165. </div>
  166. <div class="cardinnerbox2">
  167. <div>
  168. 今日消耗 <span>{{formatBytes(this.todayTraffic)}}</span>
  169. </div>
  170. <div>
  171. 本月 <span>{{formatBytes(this.thisMonthTraffic)}}</span>
  172. </div>
  173. </div>
  174. </div>
  175. <div class="internetbox-messge">
  176. <div class="internet-card">
  177. <img src="../assets/images/message.png" alt="">
  178. <span class="internet-title">
  179. 短信剩余条数 (条)
  180. </span>
  181. </div>
  182. <div class="internet-number">
  183. 0
  184. </div>
  185. </div>
  186. </div>
  187. </el-col>
  188. </el-row>
  189. </el-card>
  190. <!-- 分析概览 (Analysis Overview) -->
  191. <div class="analysis-section" shadow="never">
  192. <div slot="header" class="header">
  193. <div>分析概览</div>
  194. <div class="tab-group">
  195. <el-radio-group v-model="queryTime" size="medium" @change="handleAnalysis">
  196. <el-radio-button label="今日"></el-radio-button>
  197. <el-radio-button label="昨日"></el-radio-button>
  198. <el-radio-button label="本周"></el-radio-button>
  199. <el-radio-button label="本月"></el-radio-button>
  200. <el-radio-button label="上月"></el-radio-button>
  201. </el-radio-group>
  202. </div>
  203. <div class="action-group">
  204. <el-radio-group v-model="userTypeText" @change="handleUserType">
  205. <el-radio-button label="企微"></el-radio-button>
  206. </el-radio-group>
  207. <el-dropdown @command="handleAutoRefresh" trigger="click">
  208. <el-button size="small" plain>
  209. 自动刷新
  210. <i class="el-icon-arrow-down el-icon--right"></i>
  211. </el-button>
  212. <el-dropdown-menu slot="dropdown">
  213. <el-dropdown-item :command="0" :class="{ 'is-active': !autoRefreshInterval }">关闭</el-dropdown-item>
  214. <el-dropdown-item :command="5" :class="{ 'is-active': autoRefreshInterval === 5 }">5分钟</el-dropdown-item>
  215. <el-dropdown-item :command="10"
  216. :class="{ 'is-active': autoRefreshInterval === 10 }">10分钟</el-dropdown-item>
  217. <el-dropdown-item :command="15"
  218. :class="{ 'is-active': autoRefreshInterval === 15 }">15分钟</el-dropdown-item>
  219. </el-dropdown-menu>
  220. </el-dropdown>
  221. <el-button size="small" plain icon="el-icon-refresh" type="primary" @click="manualRefresh">手动刷新</el-button>
  222. </div>
  223. </div>
  224. </div>
  225. <div>
  226. <el-row :gutter="20">
  227. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="position: relative">
  228. <div class="analysis-card-check" :class="selectedDiv===0?'analysis-card-check-selected color':''"
  229. @click="handleToggleDiv(0)">
  230. <div class="analysis-card">
  231. <img class="card-icon" src="../assets/images/cishu_views.png"></img>
  232. <div class="card-content">
  233. <div class="card-row">
  234. <span>观看人数</span>
  235. <span class="highlight">
  236. <count-to :start-val="0" :end-val="watchUserCount" :duration="3600" class="card-panel-num" />
  237. </span>
  238. </div>
  239. <div class="card-row">
  240. <span>完播人数</span>
  241. <span class="highlight">
  242. <count-to :start-val="0" :end-val="completedUserCount" :duration="3600" class="card-panel-num" />
  243. </span>
  244. </div>
  245. <div class="card-row">
  246. <span>完播率</span>
  247. <span class="highlight">{{completedRate}}%</span>
  248. </div>
  249. </div>
  250. </div>
  251. <div class="analysis-card">
  252. <img class="card-icon" src="../assets/images/number_views.png"></img>
  253. <div class="card-content">
  254. <div class="card-row">
  255. <span>观看次数</span>
  256. <span class="highlight-red">
  257. <count-to :start-val="0" :end-val="watchCount" :duration="3600" class="card-panel-num" /></span>
  258. </div>
  259. <div class="card-row">
  260. <span>完播次数</span>
  261. <span class="highlight-red">
  262. <count-to :start-val="0" :end-val="completedCount" :duration="3600" class="card-panel-num" />
  263. </span>
  264. </div>
  265. <div class="card-row">
  266. <span>视频完播率</span>
  267. <span class="highlight-red">{{watchRate}}%</span>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. </el-col>
  273. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6" style="position: relative">
  274. <div class="analysis-card-check" :class="selectedDiv===1?'analysis-card-check-selected color':''"
  275. @click="handleToggleDiv(1)">
  276. <div class="analysis-card">
  277. <img class="card-icon" src="../assets/images/renshu_views.png"></img>
  278. <div class="card-content">
  279. <div class="card-row">
  280. <span>答题人数</span>
  281. <span class="highlight-black">
  282. <count-to :start-val="0" :end-val="answerMemberCount" :duration="3600" class="card-panel-num" />
  283. </span>
  284. </div>
  285. <div class="card-row">
  286. <span>正确人数</span>
  287. <span class="highlight-black">
  288. <count-to :start-val="0" :end-val="correctUserCount" :duration="3600" class="card-panel-num" />
  289. </span>
  290. </div>
  291. <div class="card-row">
  292. <span>正确率</span>
  293. <span class="highlight-black">{{correctRate}}%</span>
  294. </div>
  295. </div>
  296. </div>
  297. </div>
  298. </el-col>
  299. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6" style="position: relative">
  300. <div class="analysis-card-check" :class="selectedDiv===2?'analysis-card-check-selected color':''"
  301. @click="handleToggleDiv(2)">
  302. <div class="analysis-card">
  303. <img class="card-icon" src="../assets/images/hongbao_views.png"></img>
  304. <div class="card-content">
  305. <div class="card-row">
  306. <span>答题红包个数</span>
  307. <span class="highlight-black">
  308. <count-to :start-val="0" :end-val="rewardCount" :duration="3600" class="card-panel-num" />
  309. </span>
  310. </div>
  311. <div class="card-row">
  312. <span>答题红包金额(元)</span>
  313. <span class="highlight-black">
  314. <count-to :start-val="0" :end-val="rewardMoney" :duration="3600" class="card-panel-num" /></span>
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. </el-col>
  320. </el-row>
  321. </div>
  322. <!-- 图表区域 (Charts Area) -->
  323. <transition name="fade">
  324. <el-row :gutter="20" class="charts-section" v-show="selectedDiv===0">
  325. <el-col :span="12">
  326. <el-card shadow="never">
  327. <div slot="header" class="chart-header">
  328. <span>会员观看、完播人数趋势图</span>
  329. <div class="legend">
  330. <div class="legend-item">
  331. <span class="dot viewer-dot"></span>
  332. <span>观看人数</span>
  333. </div>
  334. <div class="legend-item">
  335. <span class="dot complete-dot"></span>
  336. <span>完播人数</span>
  337. </div>
  338. </div>
  339. <!-- <el-button size="small" plain class="view-more">平台每日统计 <i class="el-icon-arrow-right"></i></el-button>-->
  340. </div>
  341. <div ref="viewerChart" class="chart-container"></div>
  342. </el-card>
  343. </el-col>
  344. <el-col :span="12">
  345. <el-card shadow="never">
  346. <div slot="header" class="chart-header">
  347. <span>经销商会员观看TOP10</span>
  348. <div class="legend">
  349. <el-radio-group v-model="viewerType" size="small" @change="handleDealerChartData">
  350. <el-radio-button label="0">按观看人数</el-radio-button>
  351. <el-radio-button label="1">按完播人数</el-radio-button>
  352. </el-radio-group>
  353. </div>
  354. <!-- <el-button size="small" plain class="view-more">经销商统计 <i class="el-icon-arrow-right"></i></el-button>-->
  355. </div>
  356. <div ref="dealerChart" class="chart-container"></div>
  357. </el-card>
  358. </el-col>
  359. </el-row>
  360. </transition>
  361. <transition name="fade">
  362. <el-row :gutter="20" class="charts-section" v-show="selectedDiv===1">
  363. <el-card shadow="never">
  364. <div slot="header" class="chart-header">
  365. <span>课程观看TOP10</span>
  366. <div class="legend">
  367. <el-radio-group v-model="viewerType" size="small" @change="handleCourseWatchChart">
  368. <el-radio-button label="0">按观看人数</el-radio-button>
  369. <el-radio-button label="1">按完播人数</el-radio-button>
  370. <el-radio-button label="2">按答题人数</el-radio-button>
  371. <el-radio-button label="3">按正确人数</el-radio-button>
  372. </el-radio-group>
  373. </div>
  374. <div class="legend">
  375. <el-radio-group v-model="delerSort" @change="handleCourseWatchChart">
  376. <el-radio label="DESC">前10名</el-radio>
  377. <el-radio label="ASC">倒数10名</el-radio>
  378. </el-radio-group>
  379. </div>
  380. <div class="legend">
  381. <div class="legend-item">
  382. <span class="dot viewer-dot"></span>
  383. <span>观看人数</span>
  384. </div>
  385. <div class="legend-item">
  386. <span class="dot complete-dot"></span>
  387. <span>完播人数</span>
  388. </div>
  389. <div class="legend-item">
  390. <span class="dot" style="background-color: #E6A23C"></span>
  391. <span>答题人数</span>
  392. </div>
  393. <div class="legend-item">
  394. <span class="dot" style="background-color: #F56C6C"></span>
  395. <span>正确人数</span>
  396. </div>
  397. </div>
  398. <!-- <el-button size="small" plain class="view-more">经销商统计 <i class="el-icon-arrow-right"></i></el-button>-->
  399. </div>
  400. <div ref="courseWatchChart" class="chart-container"></div>
  401. </el-card>
  402. </el-row>
  403. </transition>
  404. <transition name="fade">
  405. <el-row :gutter="20" class="charts-section" v-show="selectedDiv===2">
  406. <el-col :span="12">
  407. <el-card shadow="never">
  408. <div slot="header" class="chart-header">
  409. <span>答题红包金额TOP10</span>
  410. <div class="legend">
  411. <el-radio-group v-model="dataType" size="small" @change="handleAnswerRedPackViewerChart">
  412. <el-radio-button label="0">按经销商排行</el-radio-button>
  413. <el-radio-button label="1">按课程排行</el-radio-button>
  414. </el-radio-group>
  415. </div>
  416. <!-- <el-button size="small" plain class="view-more">红包记录 <i class="el-icon-arrow-right"></i></el-button>-->
  417. </div>
  418. <div ref="answerRedPackViewerChart" class="chart-container"></div>
  419. </el-card>
  420. </el-col>
  421. <el-col :span="12">
  422. <el-card shadow="never">
  423. <div slot="header" class="chart-header">
  424. <span>答题红包金额趋势图</span>
  425. <div class="legend">
  426. <div class="legend-item">
  427. <span class="dot viewer-dot"></span>
  428. <span>答题红包金额</span>
  429. </div>
  430. </div>
  431. <!-- <el-button size="small" plain class="view-more">红包记录 <i class="el-icon-arrow-right"></i></el-button>-->
  432. </div>
  433. <div ref="answerRedPackMoneyViewerChart" class="chart-container"></div>
  434. </el-card>
  435. </el-col>
  436. </el-row>
  437. </transition>
  438. <el-row :gutter="20" class="charts-section">
  439. <el-col :span="12">
  440. <el-card shadow="never">
  441. <div slot="header" class="chart-header">
  442. <span>本月订单数</span>
  443. <div class="legend">
  444. <div class="legend-item">
  445. <span class="dot viewer-dot"></span>
  446. <span>订单数</span>
  447. </div>
  448. <div class="legend-item">
  449. <span class="dot complete-dot"></span>
  450. <span>订单金额</span>
  451. </div>
  452. </div>
  453. </div>
  454. <div ref="viewerOrderChart" class="chart-container"></div>
  455. </el-card>
  456. </el-col>
  457. <el-col :span="12">
  458. <el-card shadow="never">
  459. <div slot="header" class="chart-header">
  460. <span>本月收款数</span>
  461. <div class="legend">
  462. <div class="legend-item">
  463. <span class="dot viewer-dot"></span>
  464. <span>收款数</span>
  465. </div>
  466. <div class="legend-item">
  467. <span class="dot complete-dot"></span>
  468. <span>收款金额</span>
  469. </div>
  470. </div>
  471. </div>
  472. <div ref="viewerReceiveChart" class="chart-container"></div>
  473. </el-card>
  474. </el-col>
  475. </el-row>
  476. <br/>
  477. </div>
  478. </template>
  479. <script>
  480. import * as echarts from 'echarts'
  481. import CountTo from "vue-count-to";
  482. import {
  483. analysisPreview,
  484. authorizationInfo,
  485. dealerAggregated, deaMemberTopTen, rechargeComsumption, rewardMoneyTopTen, rewardMoneyTrend,
  486. smsBalance, thisMonthOrderCount, thisMonthRecvCount, trafficLog,
  487. watchCourseTopTen, watchEndPlayTrend
  488. } from "@/api/statistics/statistics";
  489. import dayjs from 'dayjs';
  490. const viewCharOption = {
  491. tooltip: {
  492. trigger: 'axis',
  493. axisPointer: {
  494. type: 'shadow'
  495. }
  496. },
  497. grid: {
  498. left: '3%',
  499. right: '4%',
  500. bottom: '3%',
  501. containLabel: true
  502. },
  503. xAxis: {
  504. type: 'category',
  505. data: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23']
  506. },
  507. yAxis: {
  508. type: 'value'
  509. },
  510. series: [
  511. {
  512. name: '观看人数',
  513. type: 'bar',
  514. data: [],
  515. itemStyle: {
  516. color: '#409EFF'
  517. }
  518. },
  519. {
  520. name: '完播人数',
  521. type: 'bar',
  522. data: [],
  523. itemStyle: {
  524. color: '#67C23A'
  525. }
  526. }
  527. ]
  528. }
  529. const thisMonthOrderCountOption = {
  530. tooltip: {
  531. trigger: 'axis',
  532. axisPointer: {
  533. type: 'shadow'
  534. }
  535. },
  536. grid: {
  537. left: '3%',
  538. right: '4%',
  539. bottom: '3%',
  540. containLabel: true
  541. },
  542. xAxis: {
  543. type: 'category',
  544. data: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23']
  545. },
  546. yAxis: {
  547. type: 'value'
  548. },
  549. series: [
  550. {
  551. name: '订单数',
  552. type: 'line',
  553. data: [],
  554. itemStyle: {
  555. color: '#409EFF'
  556. }
  557. },
  558. {
  559. name: '订单金额',
  560. type: 'line',
  561. data: [],
  562. itemStyle: {
  563. color: '#67C23A'
  564. }
  565. }
  566. ]
  567. }
  568. const thisMonthRecvCountOption = {
  569. tooltip: {
  570. trigger: 'axis',
  571. axisPointer: {
  572. type: 'shadow'
  573. }
  574. },
  575. grid: {
  576. left: '3%',
  577. right: '4%',
  578. bottom: '3%',
  579. containLabel: true
  580. },
  581. xAxis: {
  582. type: 'category',
  583. data: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23']
  584. },
  585. yAxis: {
  586. type: 'value'
  587. },
  588. series: [
  589. {
  590. name: '收款数',
  591. type: 'line',
  592. data: [],
  593. itemStyle: {
  594. color: '#409EFF'
  595. }
  596. },
  597. {
  598. name: '收款金额',
  599. type: 'line',
  600. data: [],
  601. itemStyle: {
  602. color: '#67C23A'
  603. }
  604. }
  605. ]
  606. }
  607. const dealerOption = {
  608. tooltip: {
  609. trigger: 'axis',
  610. axisPointer: {
  611. type: 'shadow'
  612. }
  613. },
  614. grid: {
  615. left: '3%',
  616. right: '4%',
  617. bottom: '3%',
  618. containLabel: true
  619. },
  620. xAxis: {
  621. type: 'value'
  622. },
  623. yAxis: {
  624. type: 'category',
  625. data: []
  626. },
  627. series: [
  628. {
  629. name: '观看人数',
  630. type: 'bar',
  631. data: [],
  632. itemStyle: {
  633. color: '#409EFF'
  634. }
  635. }
  636. ]
  637. }
  638. const courseWatchOption = {
  639. tooltip: {
  640. trigger: 'axis',
  641. axisPointer: {
  642. type: 'shadow'
  643. }
  644. },
  645. grid: {
  646. left: '3%',
  647. right: '4%',
  648. bottom: '8%',
  649. top: '3%',
  650. containLabel: true
  651. },
  652. xAxis: {
  653. type: 'category',
  654. data: [],
  655. axisLabel: {
  656. interval: 0,
  657. rotate: 30,
  658. fontSize: 10,
  659. width: 100,
  660. overflow: 'truncate'
  661. }
  662. },
  663. yAxis: {
  664. type: 'value',
  665. splitLine: {
  666. lineStyle: {
  667. type: 'dashed'
  668. }
  669. }
  670. },
  671. series: [
  672. {
  673. name: '观看人数',
  674. type: 'bar',
  675. data: [],
  676. itemStyle: {
  677. color: '#409EFF'
  678. }
  679. },
  680. {
  681. name: '完播人数',
  682. type: 'bar',
  683. data: [],
  684. itemStyle: {
  685. color: '#67C23A'
  686. }
  687. },
  688. {
  689. name: '答题人数',
  690. type: 'bar',
  691. data: [],
  692. itemStyle: {
  693. color: '#E6A23C'
  694. }
  695. },
  696. {
  697. name: '正确人数',
  698. type: 'bar',
  699. data: [],
  700. itemStyle: {
  701. color: '#F56C6C'
  702. }
  703. }
  704. ]
  705. }
  706. const lineChartOption = {
  707. tooltip: {
  708. trigger: 'axis',
  709. axisPointer: {
  710. type: 'cross' // 改为 'cross' 更适合折线图
  711. }
  712. },
  713. grid: {
  714. left: '3%',
  715. right: '4%',
  716. bottom: '8%', // 如果x轴标签旋转,可能需要更大的 bottom
  717. top: '5%', // 增加一点顶部空间给可能的 Y 轴名称
  718. containLabel: true
  719. },
  720. xAxis: {
  721. type: 'time', // X轴类型改为 'time'
  722. // data: [], // 时间轴不需要单独设置 data,数据在 series 中提供
  723. axisLabel: {
  724. // interval: 0, // 时间轴通常自动处理间隔,可以先移除或注释掉
  725. rotate: 30, // 保留旋转,如果标签可能重叠
  726. fontSize: 10,
  727. // width: 100, // width 和 overflow 对于时间轴可能行为不同,按需调整
  728. // overflow: 'truncate',
  729. formatter: null // ECharts 会自动格式化时间,如需特定格式可用 function 或字符串模板
  730. }
  731. },
  732. yAxis: {
  733. type: 'value',
  734. name: '金额 (元)', // 添加 Y 轴名称
  735. nameLocation: 'end', // 名称位置
  736. nameTextStyle: {
  737. align: 'right',
  738. padding: [0, 10, 0, 0] // 调整名称与轴线的距离
  739. },
  740. splitLine: {
  741. lineStyle: {
  742. type: 'dashed'
  743. }
  744. },
  745. axisLabel: {
  746. formatter: '{value} 元' // 可选:给 Y 轴刻度添加单位
  747. }
  748. },
  749. series: [
  750. {
  751. name: '答题红包金额',
  752. type: 'line', // 系列类型改为 'line'
  753. data: [
  754. ],
  755. itemStyle: { // 控制数据点(标记)的样式
  756. color: '#409EFF'
  757. },
  758. lineStyle: { // 控制线的样式
  759. color: '#409EFF'
  760. },
  761. smooth: false, // 是否平滑曲线,可设为 true
  762. symbol: 'circle', // 数据点标记形状,'emptyCircle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
  763. symbolSize: 4 // 数据点标记大小
  764. }
  765. ]
  766. };
  767. const redPackageOption = {
  768. tooltip: {
  769. trigger: 'axis',
  770. axisPointer: {
  771. type: 'shadow'
  772. }
  773. },
  774. grid: {
  775. left: '3%',
  776. right: '4%',
  777. bottom: '8%',
  778. top: '3%',
  779. containLabel: true
  780. },
  781. xAxis: {
  782. type: 'category',
  783. data: [],
  784. axisLabel: {
  785. interval: 0,
  786. rotate: 30,
  787. fontSize: 10,
  788. width: 100,
  789. overflow: 'truncate'
  790. }
  791. },
  792. yAxis: {
  793. type: 'value',
  794. splitLine: {
  795. lineStyle: {
  796. type: 'dashed'
  797. }
  798. }
  799. },
  800. series: [
  801. {
  802. name: '答题红包金额',
  803. type: 'bar',
  804. data: [],
  805. itemStyle: {
  806. color: '#409EFF'
  807. }
  808. }
  809. ]
  810. }
  811. export default {
  812. name: 'StatisticsDashboard',
  813. components: {CountTo},
  814. data() {
  815. return {
  816. percentage: 0,
  817. // 预测message
  818. remainMessage: '',
  819. // 当天使用流量
  820. todayTraffic: 0,
  821. // 当月使用流量
  822. thisMonthTraffic: 0,
  823. dataType: '0',
  824. delerSort: 'DESC',
  825. smsRemainCount: 0,
  826. viewerType: '0',
  827. viewerChart: null,
  828. userTypeText: '企微',
  829. userType: 2,
  830. dealerChart: null,
  831. // 分公司数量
  832. dealderCount: 0,
  833. // 销售数量
  834. groupMgrCount: 0,
  835. // 会员总数量
  836. memberCount: 0,
  837. // 企微数量
  838. qwMemberNum: 0,
  839. // 正常会员数量
  840. normalNum: 0,
  841. // 黑名单会员数量
  842. blackNum: 0,
  843. // 观看人数
  844. watchUserCount: 0,
  845. // 完播人数
  846. completedUserCount: 0,
  847. // 完播率
  848. completedRate: 0,
  849. // 观看次数
  850. watchCount:0,
  851. // 完播次数
  852. completedCount: 0,
  853. // 视频完播率
  854. watchRate: 0,
  855. // 答题人数
  856. answerMemberCount: 0,
  857. // 正确人数
  858. correctUserCount: 0,
  859. correctRate: 0.0,
  860. // 答题红包个数
  861. rewardCount: 0,
  862. // 答题红包金额
  863. rewardMoney: 0.0,
  864. queryTime: '今日',
  865. todayWatchUserCount: 0,
  866. versionLimit: 0,
  867. /// 选中的分析概览
  868. selectedDiv: 0,
  869. filterType: 0,
  870. answerRedPackViewerChart: null,
  871. answerRedPackMoneyViewerChart: null,
  872. todayComsumption: 0,
  873. yesterdayComsumption: 0,
  874. balance: 0,
  875. autoRefreshInterval: null,
  876. // 今日新增用户数
  877. todayIncreaseUserNum: 0,
  878. // 订单总数
  879. orderTotalNum: 0,
  880. // 今日新增订单数
  881. todayOrderNum: 0,
  882. // 收款总数
  883. recvTotalNum: 0,
  884. // 今日收款总数
  885. recvTodayNum: 0,
  886. // 商品总数
  887. goodsTotalNum: 0,
  888. // 今日商品总数
  889. todayGoodsNum: 0
  890. }
  891. },
  892. mounted() {
  893. this.$nextTick(() => {
  894. this.initViewerChart()
  895. this.initDealerChart()
  896. this.initCourseWatchChart();
  897. this.initAnswerRedPackViewerChart();
  898. this.initAnswerRedPackMoneyViewerChart();
  899. this.initThisMonthOrderChart();
  900. this.initThisMonthRecvChart()
  901. // 监听窗口大小变化,重新渲染图表
  902. window.addEventListener('resize', () => {
  903. this.viewerChart && this.viewerChart.resize()
  904. this.dealerChart && this.dealerChart.resize()
  905. })
  906. })
  907. },
  908. created() {
  909. this.refresh();
  910. },
  911. methods: {
  912. handleUserType(){
  913. if(this.userTypeText === '会员'){
  914. this.userType = 1
  915. }else{
  916. this.userType = 2
  917. }
  918. this.refresh()
  919. },
  920. /**
  921. * 计算余额预计可持续的天数
  922. * @param {number} balance - 当前账户余额
  923. * @param {number} todayConsumption - 今日消耗金额
  924. * @param {number} yesterdayConsumption - 昨日消耗金额
  925. * @return {Object} 包含天数和进度百分比的对象
  926. */
  927. calculateRemainingDays(balance, todayConsumption, yesterdayConsumption) {
  928. // 如果今日和昨日消耗都为0,则无法预测(避免除以0)
  929. if (todayConsumption === 0 && yesterdayConsumption === 0) {
  930. return {
  931. days: Infinity,
  932. percentage: 0,
  933. message: '暂无消耗数据'
  934. };
  935. }
  936. // 计算每日平均消耗量
  937. const avgDailyConsumption = (todayConsumption + yesterdayConsumption) / 2;
  938. // 如果平均消耗为0,则无法预测
  939. if (avgDailyConsumption === 0) {
  940. return {
  941. days: Infinity,
  942. percentage: 0,
  943. message: '暂无消耗数据'
  944. };
  945. }
  946. // 计算剩余天数(向下取整)
  947. const remainingDays = Math.floor(balance / avgDailyConsumption);
  948. // 计算进度条百分比,最大为100
  949. // 这里假设100天是满值,可以根据需要调整
  950. const maxDays = 100;
  951. const percentage = Math.min(100, Math.max(0, Math.round((remainingDays / maxDays) * 100)));
  952. let message = '';
  953. if (remainingDays > 365) {
  954. message = '预测余额充足';
  955. } else {
  956. message = `预测不足${remainingDays}天`;
  957. }
  958. return {
  959. days: remainingDays,
  960. percentage: 100 - percentage,
  961. message: message
  962. };
  963. },
  964. /**
  965. * 将字节数转换为合适的单位表示(Byte、KB、MB、GB、TB)
  966. * @param {number} bytes - 字节数
  967. * @param {number} [decimals=2] - 小数点后保留的位数
  968. * @returns {string} 格式化后的字符串,包含数值和单位
  969. */
  970. formatBytes(bytes, decimals = 2) {
  971. if (bytes === 0) return '0 Byte';
  972. const k = 1024;
  973. const sizes = ['Byte', 'KB', 'MB', 'GB', 'TB'];
  974. // 计算合适的单位级别
  975. const i = Math.floor(Math.log(bytes) / Math.log(k));
  976. // 转换为对应单位的值
  977. const value = bytes / Math.pow(k, i);
  978. // 格式化为指定小数位的字符串
  979. return parseFloat(value.toFixed(decimals)) + ' ' + sizes[Math.min(i, sizes.length - 1)];
  980. },
  981. // 手动刷新
  982. manualRefresh() {
  983. this.refresh();
  984. },
  985. // 处理自动刷新选项
  986. handleAutoRefresh(command) {
  987. // 清除之前的定时器
  988. if (this.timer) {
  989. clearInterval(this.timer);
  990. this.timer = null;
  991. }
  992. // 设置新的刷新间隔
  993. this.autoRefreshInterval = parseInt(command);
  994. // 如果间隔大于0,设置新的定时器
  995. if (this.autoRefreshInterval > 0) {
  996. this.timer = setInterval(() => {
  997. this.refresh();
  998. }, this.autoRefreshInterval * 60 * 1000); // 转换为毫秒
  999. this.$message.success(`已设置${this.autoRefreshInterval}分钟自动刷新`);
  1000. } else {
  1001. this.$message.info('已关闭自动刷新');
  1002. }
  1003. },
  1004. refresh() {
  1005. rechargeComsumption().then(res=>{
  1006. if(res.code === 200){
  1007. this.balance = res.data.balance;
  1008. this.todayComsumption = res.data.todayComsumption;
  1009. this.yesterdayComsumption = res.data.yesterdayComsumption;
  1010. let calculateRemainingDays1 = this.calculateRemainingDays(this.balance,this.todayComsumption,this.yesterdayComsumption);
  1011. this.percentage = calculateRemainingDays1.percentage;
  1012. this.remainMessage = calculateRemainingDays1.message;
  1013. }
  1014. });
  1015. trafficLog().then(res=>{
  1016. if(res.code === 200) {
  1017. this.todayTraffic = res.data.today;
  1018. this.thisMonthTraffic = res.data.thisMonth;
  1019. }
  1020. })
  1021. dealerAggregated().then(res=>{
  1022. if(res.code === 200){
  1023. this.dealderCount = res.data.dealderCount??0;
  1024. this.groupMgrCount = res.data.groupMgrCount??0;
  1025. this.memberCount = res.data.memberCount??0;
  1026. this.qwMemberNum = res.data.qwMemberNum??0;
  1027. this.normalNum = res.data.normalNum??0;
  1028. this.blackNum = res.data.blackNum??0;
  1029. this.todayIncreaseUserNum = res.data.todayIncreaseUserNum??0;
  1030. this.orderTotalNum = res.data.orderTotalNum??0;
  1031. this.todayOrderNum = res.data.todayOrderNum??0;
  1032. this.recvTotalNum = res.data.recvTotalNum??0;
  1033. this.recvTodayNum = res.data.recvTodayNum??0;
  1034. this.goodsTotalNum = res.data.goodsTotalNum??0;
  1035. this.todayGoodsNum = res.data.todayGoodsNum??0;
  1036. }
  1037. })
  1038. let param = this.getParam();
  1039. // 获取当前日期时间
  1040. const today = dayjs();
  1041. param.startTime = this.formatDate(today);
  1042. param.endTime = this.formatDate(today);
  1043. analysisPreview(param).then(res=>{
  1044. if(res.code === 200){
  1045. this.watchUserCount = res.data.watchUserCount;
  1046. this.completedUserCount = res.data.completedUserCount;
  1047. this.completedRate = res.data.completedRate;
  1048. this.watchCount = res.data.watchCount;
  1049. this.completedCount = res.data.completedCount;
  1050. this.answerMemberCount = res.data.answerMemberCount;
  1051. this.correctUserCount = res.data.correctUserCount;
  1052. this.correctRate = res.data.correctRate;
  1053. this.rewardCount = res.data.rewardCount;
  1054. this.rewardMoney = res.data.rewardMoney;
  1055. this.watchRate = res.data.watchRate;
  1056. }
  1057. })
  1058. smsBalance().then(res=>{
  1059. if(res.code === 200){
  1060. if(res.data == null) {
  1061. this.smsRemainCount = 0;
  1062. } else {
  1063. this.smsRemainCount = res.data;
  1064. }
  1065. }
  1066. })
  1067. authorizationInfo().then(res=>{
  1068. if(res.code === 200){
  1069. this.todayWatchUserCount = res.data.todayWatchUserCount;
  1070. this.versionLimit = res.data.versionLimit;
  1071. }
  1072. })
  1073. this.handleCourseWatchChart()
  1074. this.handleViewChartData()
  1075. // 经销商会员观看TOP10
  1076. this.handleDealerChartData()
  1077. this.handleAnswerRedPackViewerChart()
  1078. this.handleAnswerRedPackMoneyViewerChart()
  1079. this.handleThisMonthRecvCount();
  1080. this.handleThisMonthOrderCount();
  1081. },
  1082. /**
  1083. * 将数字添加千位分隔符
  1084. * @param {number|string} num - 需要格式化的数字
  1085. * @return {string} 添加千位分隔符后的字符串
  1086. */
  1087. formatNumberWithCommas(num) {
  1088. if (num === null || num === undefined || isNaN(Number(num))) {
  1089. return '0';
  1090. }
  1091. const numStr = String(num);
  1092. // 处理负数
  1093. const isNegative = numStr.startsWith('-');
  1094. const absNumStr = isNegative ? numStr.slice(1) : numStr;
  1095. // 分离整数部分和小数部分
  1096. const parts = absNumStr.split('.');
  1097. const integerPart = parts[0];
  1098. const decimalPart = parts.length > 1 ? '.' + parts[1] : '';
  1099. const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  1100. return (isNegative ? '-' : '') + formattedInteger + decimalPart;
  1101. },
  1102. handleToggleDiv(selected) {
  1103. this.selectedDiv = selected;
  1104. if (selected === 1) {
  1105. this.$nextTick(() => {
  1106. if (this.courseWatchChart) {
  1107. this.courseWatchChart.resize();
  1108. } else {
  1109. }
  1110. });
  1111. }
  1112. else if (selected === 0) {
  1113. this.$nextTick(() => {
  1114. if (this.viewerChart) this.viewerChart.resize();
  1115. if (this.dealerChart) this.dealerChart.resize();
  1116. });
  1117. } else if (selected === 2) {
  1118. this.$nextTick(() => {
  1119. if (this.answerRedPackViewerChart) this.answerRedPackViewerChart.resize();
  1120. if (this.answerRedPackMoneyViewerChart) this.answerRedPackMoneyViewerChart.resize();
  1121. });
  1122. }
  1123. if (this.selectedDiv === 0) {
  1124. this.handleViewChartData()
  1125. this.handleDealerChartData()
  1126. } else if (this.selectedDiv === 1) {
  1127. this.handleCourseWatchChart()
  1128. } else if (this.selectedDiv === 2) {
  1129. this.handleAnswerRedPackViewerChart()
  1130. this.handleAnswerRedPackMoneyViewerChart()
  1131. }
  1132. },
  1133. formatDate(date) {
  1134. return dayjs(date).format('YYYY-MM-DD');
  1135. },
  1136. getParam(){
  1137. let param = {
  1138. startTime: '',
  1139. endTime: '',
  1140. userType: this.userType
  1141. };
  1142. // 获取当前日期时间
  1143. const today = dayjs();
  1144. let type = 0;
  1145. if (this.queryTime === '今日') {
  1146. param.startTime = this.formatDate(today);
  1147. param.endTime = this.formatDate(today);
  1148. type = 0;
  1149. } else if (this.queryTime === '昨日') {
  1150. const yesterday = today.subtract(1, 'day');
  1151. param.startTime = this.formatDate(yesterday);
  1152. param.endTime = this.formatDate(yesterday);
  1153. type = 1;
  1154. } else if (this.queryTime === '本周') {
  1155. param.startTime = this.formatDate(today.startOf('week'));
  1156. param.endTime = this.formatDate(today.endOf('week'));
  1157. type = 2;
  1158. } else if (this.queryTime === '本月') {
  1159. param.startTime = this.formatDate(today.startOf('month'));
  1160. param.endTime = this.formatDate(today.endOf('month'));
  1161. type = 3;
  1162. } else if (this.queryTime === '上月') {
  1163. const lastMonth = today.subtract(1, 'month');
  1164. param.startTime = this.formatDate(lastMonth.startOf('month'));
  1165. param.endTime = this.formatDate(lastMonth.endOf('month'));
  1166. type = 4;
  1167. } else {
  1168. console.warn(`未知的 queryTime: ${this.queryTime}, 默认使用今日`);
  1169. param.startTime = this.formatDate(today);
  1170. param.endTime = this.formatDate(today);
  1171. }
  1172. param.type = type;
  1173. param.sort = this.delerSort;
  1174. return param;
  1175. },
  1176. // 分析概览
  1177. handleAnalysis(e) {
  1178. let param = this.getParam();
  1179. analysisPreview(param).then(res => {
  1180. if (res.code === 200) {
  1181. this.watchUserCount = res.data.watchUserCount;
  1182. this.completedUserCount = res.data.completedUserCount;
  1183. this.completedRate = res.data.completedRate;
  1184. this.watchCount = res.data.watchCount;
  1185. this.completedCount = res.data.completedCount;
  1186. this.answerMemberCount = res.data.answerMemberCount;
  1187. this.correctUserCount = res.data.correctUserCount;
  1188. this.correctRate = res.data.correctRate;
  1189. this.rewardCount = res.data.rewardCount;
  1190. this.rewardMoney = res.data.rewardMoney;
  1191. this.watchRate = res.data.watchRate;
  1192. }
  1193. })
  1194. if (this.selectedDiv === 0) {
  1195. this.handleViewChartData()
  1196. this.handleDealerChartData()
  1197. } else if (this.selectedDiv === 1) {
  1198. this.handleCourseWatchChart()
  1199. } else if (this.selectedDiv === 2) {
  1200. this.handleAnswerRedPackViewerChart()
  1201. this.handleAnswerRedPackMoneyViewerChart()
  1202. }
  1203. },
  1204. handleAnswerRedPackViewerChart(){
  1205. let param = this.getParam();
  1206. param = {...param,statisticalType:this.viewerType,dataType: this.dataType};
  1207. rewardMoneyTopTen(param).then(res=>{
  1208. if(res.code === 200){
  1209. let data = res.data;
  1210. let companyNameList = data.map(e=>e.companyName)
  1211. let courseNameList = data.map(e=>e.courseName)
  1212. let rewardMoneyList = data.map(e=>e.rewardMoney)
  1213. if(this.dataType === '0'){
  1214. redPackageOption.xAxis.data = companyNameList;
  1215. }else{
  1216. redPackageOption.xAxis.data = courseNameList;
  1217. }
  1218. redPackageOption.series[0].data = rewardMoneyList;
  1219. this.answerRedPackViewerChart.setOption(redPackageOption)
  1220. }
  1221. })
  1222. },
  1223. handleAnswerRedPackMoneyViewerChart(){
  1224. let param = this.getParam();
  1225. param = {...param,statisticalType:this.viewerType,dataType: this.dataType};
  1226. rewardMoneyTrend(param).then(res=>{
  1227. if(res.code === 200){
  1228. let data = res.data;
  1229. let option = data.map(e=>[e.x,e.rewardMoney])
  1230. lineChartOption.series[0].data = option;
  1231. this.answerRedPackMoneyViewerChart.setOption(lineChartOption)
  1232. }
  1233. })
  1234. },
  1235. handleCourseWatchChart() {
  1236. let param = this.getParam();
  1237. param = {...param,statisticalType:this.viewerType};
  1238. watchCourseTopTen(param).then(res=>{
  1239. if(res.code === 200){
  1240. let data = res.data;
  1241. let watchUserCountList = data.map(e=>e.watchUserCount);
  1242. let completedUserCountList = data.map(e=>e.completedUserCount);
  1243. let answerUserCountList = data.map(e=>e.answerUserCount);
  1244. let correctUserCountList = data.map(e=>e.correctUserCount);
  1245. let courseNameList = data.map(e=>e.courseName);
  1246. courseWatchOption.xAxis.data = courseNameList;
  1247. courseWatchOption.series[0].data = watchUserCountList;
  1248. courseWatchOption.series[1].data = completedUserCountList;
  1249. courseWatchOption.series[2].data = answerUserCountList;
  1250. courseWatchOption.series[3].data = correctUserCountList;
  1251. this.courseWatchChart.setOption(courseWatchOption)
  1252. }
  1253. })
  1254. },
  1255. handleDealerChartData(){
  1256. let param = this.getParam();
  1257. // 经销商会员观看TOP10
  1258. deaMemberTopTen({...param,statisticalType: this.viewerType}).then(res=>{
  1259. if(res.code === 200){
  1260. let data = res.data;
  1261. let companyNameList = data.map(e=>e.companyName);
  1262. let watchUserList = data.map(e=>e.watchUserCount);
  1263. dealerOption.yAxis.data = companyNameList;
  1264. dealerOption.series[0].data = watchUserList;
  1265. this.dealerChart.setOption(dealerOption)
  1266. }
  1267. })
  1268. },
  1269. handleThisMonthOrderCount(){
  1270. thisMonthOrderCount().then(res=>{
  1271. if(res.code === 200){
  1272. let dates = res.dates;
  1273. let orderCount = res.orderCount;
  1274. let payPrice = res.payPrice;
  1275. thisMonthOrderCountOption.series[0].data = orderCount;
  1276. thisMonthOrderCountOption.series[1].data = payPrice;
  1277. thisMonthOrderCountOption.xAxis.data = dates;
  1278. this.thisMonthOrderChart.setOption(thisMonthOrderCountOption)
  1279. }
  1280. })
  1281. },
  1282. handleThisMonthRecvCount(){
  1283. thisMonthRecvCount().then(res=>{
  1284. if(res.code === 200){
  1285. let dates = res.dates;
  1286. let orderCount = res.orderCount;
  1287. let payMoney = res.payMoney;
  1288. thisMonthRecvCountOption.series[0].data = orderCount;
  1289. thisMonthRecvCountOption.series[1].data = payMoney;
  1290. thisMonthRecvCountOption.xAxis.data = dates;
  1291. this.thisMonthRecvChart.setOption(thisMonthRecvCountOption)
  1292. }
  1293. })
  1294. },
  1295. handleViewChartData(){
  1296. let param = this.getParam();
  1297. watchEndPlayTrend({...param}).then(res=>{
  1298. if(res.code === 200){
  1299. let data = res.data;
  1300. let watchUserCountList = data.map(e=>e.watchUserCount);
  1301. let completedUserCountList = data.map(e=>e.completedUserCount);
  1302. let xAxis = data.map(e=>e.x);
  1303. viewCharOption.series[0].data = watchUserCountList;
  1304. viewCharOption.series[1].data = completedUserCountList;
  1305. viewCharOption.xAxis.data = xAxis;
  1306. this.viewerChart.setOption(viewCharOption);
  1307. }
  1308. })
  1309. },
  1310. initThisMonthOrderChart(){
  1311. this.thisMonthOrderChart = echarts.init(this.$refs.viewerOrderChart)
  1312. this.thisMonthOrderChart.setOption(thisMonthOrderCountOption)
  1313. },
  1314. initThisMonthRecvChart(){
  1315. this.thisMonthRecvChart = echarts.init(this.$refs.viewerReceiveChart)
  1316. this.thisMonthRecvChart.setOption(thisMonthOrderCountOption)
  1317. },
  1318. initViewerChart() {
  1319. this.viewerChart = echarts.init(this.$refs.viewerChart)
  1320. this.viewerChart.setOption(viewCharOption)
  1321. },
  1322. initDealerChart() {
  1323. this.dealerChart = echarts.init(this.$refs.dealerChart)
  1324. this.dealerChart.setOption(dealerOption)
  1325. },
  1326. initCourseWatchChart() {
  1327. this.courseWatchChart = echarts.init(this.$refs.courseWatchChart)
  1328. this.courseWatchChart.setOption(courseWatchOption)
  1329. },
  1330. initAnswerRedPackViewerChart(){
  1331. this.answerRedPackViewerChart = echarts.init(this.$refs.answerRedPackViewerChart)
  1332. this.answerRedPackViewerChart.setOption(redPackageOption)
  1333. },
  1334. initAnswerRedPackMoneyViewerChart(){
  1335. this.answerRedPackMoneyViewerChart = echarts.init(this.$refs.answerRedPackMoneyViewerChart)
  1336. this.answerRedPackMoneyViewerChart.setOption(lineChartOption)
  1337. }
  1338. },
  1339. beforeDestroy() {
  1340. // 组件销毁时清除定时器
  1341. if (this.timer) {
  1342. clearInterval(this.timer);
  1343. this.timer = null;
  1344. }
  1345. // window.removeEventListener('resize', this.resizeHandler)
  1346. this.viewerChart && this.viewerChart.dispose()
  1347. this.dealerChart && this.dealerChart.dispose()
  1348. }
  1349. }
  1350. </script>
  1351. <style scoped>
  1352. .highlight-today-add {
  1353. color: green;
  1354. font-size: 17px;
  1355. font-weight: normal;
  1356. }
  1357. .highlight-today-add2 {
  1358. color: rgba(49, 185, 154, 1);
  1359. font-size: 14px;
  1360. font-weight: normal;
  1361. transform: scale(.9);
  1362. }
  1363. .action-group .el-button+.el-button,
  1364. .action-group .el-dropdown {
  1365. margin-left: 10px;
  1366. }
  1367. .is-active {
  1368. color: #409EFF;
  1369. font-weight: bold;
  1370. }
  1371. ::v-deep .el-radio-button__inner:hover {
  1372. color: #409EFF;
  1373. /* 鼠标悬浮时的文字颜色,可以根据需要调整 */
  1374. }
  1375. ::v-deep .el-radio-button.is-active .el-radio-button__inner {
  1376. background-color: #409EFF;
  1377. /* 选中时的背景色 */
  1378. border-color: #409EFF;
  1379. /* 选中时的边框色 */
  1380. color: #FFFFFF;
  1381. /* 选中时的文字颜色 (通常是白色) */
  1382. box-shadow: -1px 0 0 0 #409EFF;
  1383. /* 处理按钮间的连接缝隙 */
  1384. }
  1385. /* 如果需要,也可以修改非选中状态下的聚焦(focus)或悬浮(hover)样式 */
  1386. /* 例如,让非选中按钮悬浮时边框和文字也变蓝 */
  1387. ::v-deep .el-radio-button:not(.is-active) .el-radio-button__inner:hover {
  1388. color: #409EFF;
  1389. /* border-color: #b3d8ff; Element UI 默认悬浮边框色,可以按需修改 */
  1390. }
  1391. /* 聚焦时的外框,如果需要的话 */
  1392. ::v-deep .el-radio-button:focus:not(.is-checked) .el-radio-button__inner {
  1393. /* border-color: #409EFF; */
  1394. /* Element UI 默认的 focus 颜色通常关联主题色 */
  1395. /* box-shadow: 0 0 2px 2px rgba(64, 158, 255, 0.2); */
  1396. /* 示例 focus 光晕 */
  1397. }
  1398. .statistics-dashboard {
  1399. padding: 20px;
  1400. background-color: #f5f7fa;
  1401. }
  1402. .overview-section,
  1403. .analysis-section {
  1404. margin-bottom: 20px;
  1405. border-radius: 4px;
  1406. }
  1407. .header {
  1408. display: flex;
  1409. justify-content: space-between;
  1410. align-items: center;
  1411. font-size: 16px;
  1412. font-weight: 500;
  1413. }
  1414. .data-card {
  1415. background-color: #fff;
  1416. border-radius: 4px;
  1417. padding: 15px;
  1418. height: 120px;
  1419. display: flex;
  1420. flex-direction: column;
  1421. position: relative;
  1422. transition: background-color 0.3s ease-in-out;
  1423. }
  1424. .data-card:hover {
  1425. border: 1px solid #4592ff;
  1426. background-color: #e7f1ff;
  1427. }
  1428. .card-title {
  1429. color: #606266;
  1430. font-size: 14px;
  1431. margin-bottom: 10px;
  1432. }
  1433. .card-title1 {
  1434. color: white;
  1435. font-size: 14px;
  1436. margin-bottom: 10px;
  1437. }
  1438. .card-value {
  1439. font-size: 24px;
  1440. font-weight: bold;
  1441. margin-top: 20px;
  1442. }
  1443. .highlight {
  1444. color: #409EFF;
  1445. }
  1446. .card-sub {
  1447. display: flex;
  1448. justify-content: space-between;
  1449. font-size: 12px;
  1450. color: #909399;
  1451. margin-top: 5px;
  1452. }
  1453. .card-desc {
  1454. font-size: 12px;
  1455. color: #909399;
  1456. margin-top: 5px;
  1457. }
  1458. .card-badge {
  1459. position: absolute;
  1460. top: 15px;
  1461. right: 15px;
  1462. background: #f0f9eb;
  1463. color: #67c23a;
  1464. padding: 2px 5px;
  1465. border-radius: 4px;
  1466. }
  1467. .cdn-label {
  1468. background-color: #409EFF;
  1469. color: white;
  1470. padding: 2px 5px;
  1471. border-radius: 4px;
  1472. margin-right: 5px;
  1473. font-size: 12px;
  1474. }
  1475. .tab-group {
  1476. display: flex;
  1477. gap: 10px;
  1478. }
  1479. .action-group {
  1480. display: flex;
  1481. gap: 10px;
  1482. }
  1483. .analysis-card {
  1484. border-radius: 4px;
  1485. padding: 20px;
  1486. display: flex;
  1487. align-items: center;
  1488. }
  1489. .card-icon {
  1490. width: 50px;
  1491. height: 50px;
  1492. background-color: rgba(64, 158, 255, 0.1);
  1493. border-radius: 8px;
  1494. display: flex;
  1495. justify-content: center;
  1496. align-items: center;
  1497. font-size: 24px;
  1498. color: #409EFF;
  1499. margin-right: 20px;
  1500. }
  1501. .card-content {
  1502. display: flex;
  1503. }
  1504. .card-row {
  1505. display: flex;
  1506. justify-content: center;
  1507. justify-items: center;
  1508. flex-direction: column;
  1509. padding: 10px;
  1510. .highlight {
  1511. text-align: center;
  1512. margin-top: 1em;
  1513. font-family: BebasNeue;
  1514. color: #1677ff;
  1515. font-size: 21px;
  1516. line-height: 42px;
  1517. font-weight: 600;
  1518. margin-top: 8px;
  1519. }
  1520. font-size: 15px;
  1521. color: #000;
  1522. }
  1523. .charts-section {
  1524. margin-top: 20px;
  1525. }
  1526. .chart-header {
  1527. display: flex;
  1528. justify-content: space-between;
  1529. align-items: center;
  1530. }
  1531. .view-more {
  1532. font-size: 12px;
  1533. }
  1534. .legend {
  1535. display: flex;
  1536. gap: 15px;
  1537. }
  1538. .legend-item {
  1539. display: flex;
  1540. align-items: center;
  1541. font-size: 12px;
  1542. }
  1543. .dot {
  1544. width: 10px;
  1545. height: 10px;
  1546. border-radius: 50%;
  1547. margin-right: 5px;
  1548. }
  1549. .viewer-dot {
  1550. background-color: #409EFF;
  1551. }
  1552. .complete-dot {
  1553. background-color: #67C23A;
  1554. }
  1555. .chart-container {
  1556. height: 350px;
  1557. width: 100%;
  1558. }
  1559. .analysis-card-check {
  1560. display: flex;
  1561. flex-direction: row;
  1562. border: 1px solid transparent;
  1563. background-color: #fff;
  1564. border-radius: 4px;
  1565. }
  1566. .analysis-card-check:hover {
  1567. cursor: pointer;
  1568. }
  1569. .analysis-card-check-selected:after {
  1570. content: "";
  1571. display: block;
  1572. border-width: 15px;
  1573. position: absolute;
  1574. bottom: -30px;
  1575. left: 50%;
  1576. margin-left: -32px;
  1577. border-style: solid dashed dashed solid;
  1578. border-color: #4592FF transparent transparent transparent;
  1579. font-size: 0;
  1580. line-height: 0;
  1581. z-index: 1;
  1582. }
  1583. .analysis-card-check-selected:before {
  1584. content: "";
  1585. display: block;
  1586. border-width: 15px;
  1587. position: absolute;
  1588. bottom: -30px;
  1589. left: 50%;
  1590. margin-left: -32px;
  1591. border-style: solid dashed dashed solid;
  1592. border-color: #4592FF transparent transparent transparent;
  1593. font-size: 0;
  1594. line-height: 0;
  1595. z-index: 1;
  1596. }
  1597. .analysis-card-check-selected {
  1598. border: 1px solid #4592FF;
  1599. background-color: #e7f1ff;
  1600. }
  1601. .color {
  1602. position: relative;
  1603. border: 1px solid #4592FF;
  1604. background-color: #e7f1ff;
  1605. }
  1606. .color:after {
  1607. bottom: -27px;
  1608. border-color: #E7F1FF transparent transparent transparent;
  1609. }
  1610. .companybox {
  1611. color: white;
  1612. background-color: #006CFF;
  1613. padding: 10px 10px 40px 10px;
  1614. box-sizing: border-box;
  1615. position: relative;
  1616. border-radius: 6px;
  1617. .topimg {
  1618. width: 100px;
  1619. height: 80px;
  1620. position: absolute;
  1621. top: 0px;
  1622. left: 0;
  1623. }
  1624. .bottomimg {
  1625. width: 100px;
  1626. height: 80px;
  1627. position: absolute;
  1628. bottom: -10px;
  1629. right: 0;
  1630. transform: rotate(180deg);
  1631. }
  1632. .companyboxtitle {
  1633. height: 30px;
  1634. margin-bottom: 20px;
  1635. font-weight: 600;
  1636. }
  1637. .companyflex {
  1638. display: flex;
  1639. justify-content: space-around;
  1640. }
  1641. }
  1642. .companynumber {
  1643. color: white;
  1644. }
  1645. .companycard {
  1646. width: 25%;
  1647. }
  1648. .companyadd {
  1649. color: white;
  1650. }
  1651. .cardafter {
  1652. position: relative;
  1653. }
  1654. .cardafter::after {
  1655. content: "";
  1656. height: 60px;
  1657. border-right: 1px solid rgba(255, 255, 255, 0.20);
  1658. position: absolute;
  1659. right: 30px;
  1660. top: 0px;
  1661. }
  1662. .highlight1 {
  1663. margin-top: 10px;
  1664. margin-left: 20px;
  1665. }
  1666. .propertyboxtitle {
  1667. background-image: url(../assets/images/zcgl_bg.png);
  1668. height: 100px;
  1669. }
  1670. .propertyboxflex {
  1671. display: flex;
  1672. background-color: white;
  1673. justify-content: space-between;
  1674. }
  1675. .property-card {
  1676. width: 48%;
  1677. border-radius: 4px;
  1678. padding: 15px;
  1679. height: 100px;
  1680. display: flex;
  1681. flex-direction: column;
  1682. position: relative;
  1683. transition: background-color 0.3s ease-in-out;
  1684. }
  1685. .property_title {
  1686. height: 40px;
  1687. line-height: 40px;
  1688. color: rgba(32, 33, 36, 1);
  1689. box-sizing: border-box;
  1690. padding-left: 10px;
  1691. font-weight: 600;
  1692. }
  1693. .card-compare {
  1694. margin-top: 5px;
  1695. font-size: 14px;
  1696. color: rgba(92, 95, 102, 1);
  1697. span {
  1698. font-size: 13px;
  1699. transform: scale(.8);
  1700. color: rgba(49, 185, 154, 1);
  1701. }
  1702. }
  1703. .propertyline {
  1704. position: relative;
  1705. }
  1706. .propertyline::after {
  1707. position: absolute;
  1708. content: "";
  1709. height: 80px;
  1710. border-right: 1px solid rgba(237, 239, 242, 1);
  1711. right: 0;
  1712. }
  1713. .operatetitle {
  1714. font-weight: 600;
  1715. height: 50px;
  1716. line-height: 50px;
  1717. }
  1718. .operatetitle-col{
  1719. display: flex;
  1720. justify-content: space-between;
  1721. padding-bottom: 20px;
  1722. padding-right: 5px;
  1723. .operatetitle-card {
  1724. width: 24%;
  1725. border: 1px solid transparent;
  1726. background-color: rgba(245, 247, 250, 1);
  1727. border-radius: 4px;
  1728. padding: 15px;
  1729. display: flex;
  1730. flex-direction: column;
  1731. position: relative;
  1732. transition: background-color 0.3s ease-in-out;
  1733. .operate-value {
  1734. font-size: 24px;
  1735. font-weight: bold;
  1736. }
  1737. }
  1738. }
  1739. .yesterdaybox {
  1740. font-size: 14px;
  1741. color: rgba(92, 95, 102, 1);
  1742. font-weight: 200;
  1743. margin-top: 10px;
  1744. }
  1745. .internetbox {
  1746. background: linear-gradient(to right, rgba(255, 99, 0, 1), rgba(255, 159, 1, 1));
  1747. border-radius: 6px;
  1748. padding: 2px 5px 15px 5px;
  1749. width: 100%;
  1750. .internet-cardtop {
  1751. background-color: white;
  1752. border-radius: 3px;
  1753. margin-top: 5px;
  1754. justify-content: space-between;
  1755. padding: 15px;
  1756. box-sizing: border-box;
  1757. color: rgba(32, 33, 36, 1);
  1758. .cardinnerbox {
  1759. display: flex;
  1760. justify-content: space-between;
  1761. .cardtopimg {
  1762. display: flex;
  1763. align-items: center;
  1764. font-size: 15px;
  1765. img {
  1766. height: 18px;
  1767. width: 18px;
  1768. }
  1769. }
  1770. .cardtopnumber {
  1771. font-size: 25px;
  1772. color: rgba(32, 33, 36, 1);
  1773. font-weight: bold;
  1774. }
  1775. }
  1776. .cardinnerbox2 {
  1777. display: flex;
  1778. justify-content: space-between;
  1779. font-size: 14px;
  1780. color: rgba(92, 95, 102, 1);
  1781. }
  1782. }
  1783. .internetbox-messge{
  1784. color: white;
  1785. display: flex;
  1786. justify-content: space-between;
  1787. padding: 15px 10px 10px 10px;
  1788. .internet-card{
  1789. display: flex;
  1790. font-size: 14px;
  1791. align-items: center;
  1792. img{
  1793. height: 18px;
  1794. width: 18px;
  1795. }
  1796. span{
  1797. padding-left: 5px;
  1798. }
  1799. }
  1800. .internet-number{
  1801. font-size: 25px;
  1802. }
  1803. }
  1804. .internetbox {
  1805. display: flex;
  1806. color: white;
  1807. .internet-card {
  1808. width: 100%;
  1809. display: flex;
  1810. color: white;
  1811. }
  1812. }
  1813. .internet-title {
  1814. font-size: 14px;
  1815. }
  1816. }
  1817. .company {
  1818. background-color: 006CFF;
  1819. }
  1820. .highlight-red{
  1821. text-align: center;
  1822. margin-top: 1em;
  1823. font-family: BebasNeue;
  1824. color: rgba(255, 82, 82, 1);
  1825. font-size: 21px;
  1826. line-height: 42px;
  1827. font-weight: 600;
  1828. margin-top: 8px;
  1829. }
  1830. .highlight-black{
  1831. text-align: center;
  1832. margin-top: 1em;
  1833. font-family: BebasNeue;
  1834. color: rgba(32, 33, 36, 1);
  1835. font-size: 21px;
  1836. line-height: 42px;
  1837. font-weight: 600;
  1838. margin-top: 8px;
  1839. }
  1840. .operatetitle-card:hover{
  1841. border: 1px solid #4592ff;
  1842. background-color: #e7f1ff;
  1843. }
  1844. .icon-img{
  1845. height: 14px;
  1846. width: 14px;
  1847. }
  1848. .progress{
  1849. transform: rotate(180deg);
  1850. margin-top: 20px;
  1851. }
  1852. .progress ::v-deep .el-progress-bar__outer{
  1853. background-color: rgba(247, 152, 11, 0.2);
  1854. }
  1855. ::v-deep .el-progress {
  1856. .el-progress-bar {
  1857. .el-progress-bar__inner {
  1858. background: linear-gradient(to right, #FF6300,#FF9F01)
  1859. }
  1860. }
  1861. }
  1862. </style>