index.vue 56 KB

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