Analysis.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <style>
  2. .only-there .ant-tabs-bar{
  3. background: white;
  4. }
  5. #updateInfo .ant-modal-content,#updateInfo .ant-modal-body {
  6. width: 500px;
  7. /* height: 600px; */
  8. position: relative;
  9. }
  10. .Updatecontent{
  11. padding: 0 20px 40px;
  12. }
  13. .Updatetitle{
  14. text-align: center;
  15. font-size: 22px;
  16. font-weight: 500;
  17. color: #1890ff;
  18. margin-bottom: 20px;
  19. margin-top: 20px;
  20. }
  21. .Updatetime{
  22. font-size: 16px;
  23. font-weight: 700;
  24. color: #000;
  25. margin-bottom: 15px;
  26. }
  27. .updateicon{
  28. font-size: 26px;
  29. position: relative;
  30. top: 4px;;
  31. }
  32. .updateSpan{
  33. margin-left: 10px;
  34. }
  35. .textTitle{
  36. font-weight: 600;
  37. font-size: 1.17em;
  38. font-family:Helvetica,Arial,"\5b8b\4f53",sans-serif;
  39. }
  40. .okBtn{
  41. position: absolute;
  42. right: 3%;
  43. bottom: 3%;
  44. }
  45. .updatelist{
  46. list-style: disc;
  47. }
  48. </style>
  49. <template>
  50. <div class="page-header-index-wide">
  51. <div v-if="roleCode == 'operator'">
  52. <a-row :gutter="24">
  53. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  54. <chart-card :loading="loading" title="总销售额" total="¥126,560">
  55. <a-tooltip title="指标说明" slot="action">
  56. <a-icon type="info-circle-o" />
  57. </a-tooltip>
  58. <div>
  59. <trend flag="up" style="margin-right: 16px;">
  60. <span slot="term">周同比</span>
  61. 12%
  62. </trend>
  63. <trend flag="down">
  64. <span slot="term">日同比</span>
  65. 11%
  66. </trend>
  67. </div>
  68. <template slot="footer">
  69. 日均销售额
  70. <span>¥ 234.56</span>
  71. </template>
  72. </chart-card>
  73. </a-col>
  74. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  75. <chart-card :loading="loading" title="访问量" :total="8846 | NumberFormat">
  76. <a-tooltip title="指标说明" slot="action">
  77. <a-icon type="info-circle-o" />
  78. </a-tooltip>
  79. <div>
  80. <mini-area />
  81. </div>
  82. <template slot="footer">
  83. 日访问量
  84. <span>{{ '1234' | NumberFormat }}</span>
  85. </template>
  86. </chart-card>
  87. </a-col>
  88. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  89. <chart-card :loading="loading" title="支付笔数" :total="6560 | NumberFormat">
  90. <a-tooltip title="指标说明" slot="action">
  91. <a-icon type="info-circle-o" />
  92. </a-tooltip>
  93. <div>
  94. <mini-bar :height="40" />
  95. </div>
  96. <template slot="footer">
  97. 转化率
  98. <span>60%</span>
  99. </template>
  100. </chart-card>
  101. </a-col>
  102. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  103. <chart-card :loading="loading" title="运营活动效果" total="78%">
  104. <a-tooltip title="指标说明" slot="action">
  105. <a-icon type="info-circle-o" />
  106. </a-tooltip>
  107. <div>
  108. <mini-progress color="rgb(19, 194, 194)" :target="80" :percentage="78" :height="8" />
  109. </div>
  110. <template slot="footer">
  111. <trend flag="down" style="margin-right: 16px;">
  112. <span slot="term">同周比</span>
  113. 12%
  114. </trend>
  115. <trend flag="up">
  116. <span slot="term">日环比</span>
  117. 80%
  118. </trend>
  119. </template>
  120. </chart-card>
  121. </a-col>
  122. </a-row>
  123. <a-card :loading="loading" :bordered="false" :body-style="{ padding: '0' }">
  124. <div class="salesCard">
  125. <a-tabs default-active-key="1" size="large" :tab-bar-style="{ marginBottom: '24px', paddingLeft: '16px' }">
  126. <div class="extra-wrapper" slot="tabBarExtraContent">
  127. <div class="extra-item">
  128. <a>今日</a>
  129. <a>本周</a>
  130. <a>本月</a>
  131. <a>本年</a>
  132. </div>
  133. <a-range-picker :style="{ width: '256px' }" />
  134. </div>
  135. <a-tab-pane loading="true" tab="销售额" key="1">
  136. <a-row>
  137. <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
  138. <bar title="销售额排行" :dataSource="barData" />
  139. </a-col>
  140. <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
  141. <rank-list title="门店销售排行榜" :list="rankList" />
  142. </a-col>
  143. </a-row>
  144. </a-tab-pane>
  145. <a-tab-pane tab="访问量" key="2">
  146. <a-row>
  147. <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
  148. <bar title="销售额趋势" :dataSource="barData" />
  149. </a-col>
  150. <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
  151. <rank-list title="门店销售排行榜" :list="rankList" />
  152. </a-col>
  153. </a-row>
  154. </a-tab-pane>
  155. </a-tabs>
  156. </div>
  157. </a-card>
  158. <a-row>
  159. <a-col :span="24">
  160. <a-card :loading="loading" :bordered="false" title="最近一周访问次数统计" :style="{ marginTop: '24px' }">
  161. <a-row>
  162. <a-col :span="6">
  163. <head-info title="今日访问IP数" :content="loginfo.todayIp"></head-info>
  164. </a-col>
  165. <a-col :span="2">
  166. <a-spin class="circle-cust">
  167. <a-icon slot="indicator" type="environment" style="font-size: 24px" />
  168. </a-spin>
  169. </a-col>
  170. <a-col :span="6">
  171. <head-info title="今日访问次数" :content="loginfo.todayVisitCount"></head-info>
  172. </a-col>
  173. <a-col :span="2">
  174. <a-spin class="circle-cust">
  175. <a-icon slot="indicator" type="team" style="font-size: 24px" />
  176. </a-spin>
  177. </a-col>
  178. <a-col :span="6">
  179. <head-info title="访问总次数" :content="loginfo.totalVisitCount"></head-info>
  180. </a-col>
  181. <a-col :span="2">
  182. <a-spin class="circle-cust">
  183. <a-icon slot="indicator" type="rise" style="font-size: 24px" />
  184. </a-spin>
  185. </a-col>
  186. </a-row>
  187. <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
  188. </a-card>
  189. </a-col>
  190. </a-row>
  191. </div>
  192. <newHome v-else-if=" roleCode == 'touTiaoOperationManager'" />
  193. <statistics v-else-if="roleCode == 'kuaishouOperationManager'" />
  194. <statistics v-else-if="roleCode == 'sale'||roleCode=='saleDirector'" />
  195. <Workbench v-else-if="roleCode == 'clip'" />
  196. <Workbench v-else-if="roleCode == 'plane'" />
  197. <a-tabs default-active-key="1" v-else-if="roleCode == 'admin'" class="only-there">
  198. <a-tab-pane key="1" tab="快手">
  199. <statistics />
  200. </a-tab-pane>
  201. <a-tab-pane key="2" tab="头条">
  202. <newHome />
  203. </a-tab-pane>
  204. </a-tabs>
  205. <!-- 更新公告 -->
  206. <a-modal v-model="visible" title="" @ok="handleOk" :closable='false' :footer="null" id="updateInfo">
  207. <div class="Updatetitle">
  208. <a-icon type="notification" theme='twoTone'/> 更新通告
  209. </div>
  210. <div class="Updatecontent">
  211. <div class="Updateitem">
  212. <div class="Updatetime">
  213. <a-icon type="dashboard" theme='twoTone' class="updateicon" />
  214. <span class="updateSpan">{{updateTime[0]}}</span>
  215. </div>
  216. <div class="updateText">
  217. <div class="updateBox">
  218. <h3 class="textTitle">1.脚本素材功能迭代</h3>
  219. <ul class="updatelist">
  220. <li>可使用在线编辑并自动保存</li>
  221. <li>支持项目筛选、文件上传</li>
  222. </ul>
  223. </div>
  224. <div class="updateBox">
  225. <h3 class="textTitle">2.头条-账户报表上线通知</h3>
  226. <ul class="updatelist">
  227. <li>点击“统计报表-头条报表-账户报表”查看模块</li>
  228. <li>可根据项目账户筛选查看数据,支持时间筛选</li>
  229. <li>支持报表导出</li>
  230. </ul>
  231. </div>
  232. <div class="updateBox">
  233. <h3 class="textTitle">3.快手批量工具更新</h3>
  234. <ul>
  235. <li>在创建创意模块加了时间维度筛选</li>
  236. </ul>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. <a-button type='primary' class="okBtn" @click="handleOk">知道了</a-button>
  242. </a-modal>
  243. </div>
  244. </template>
  245. <script>
  246. import ChartCard from '@/components/ChartCard'
  247. import ACol from 'ant-design-vue/es/grid/Col'
  248. import ATooltip from 'ant-design-vue/es/tooltip/Tooltip'
  249. import MiniArea from '@/components/chart/MiniArea'
  250. import MiniBar from '@/components/chart/MiniBar'
  251. import MiniProgress from '@/components/chart/MiniProgress'
  252. import RankList from '@/components/chart/RankList'
  253. import Bar from '@/components/chart/Bar'
  254. import LineChartMultid from '@/components/chart/LineChartMultid'
  255. import HeadInfo from '@/components/tools/HeadInfo.vue'
  256. import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
  257. import Trend from '@/components/Trend'
  258. import {
  259. getLoginfo,
  260. getVisitInfo
  261. } from '@/api/api'
  262. import newHome from '@/views/modules/Statistics/newHome.vue'
  263. import Workbench from '@/views/dashboard/Workbench.vue'
  264. import Statistics from '@/views/modules/Statistics/Statistics.vue'
  265. const rankList = []
  266. for (let i = 0; i < 7; i++) {
  267. rankList.push({
  268. name: '白鹭岛 ' + (i + 1) + ' 号店',
  269. total: 1234.56 - i * 100
  270. })
  271. }
  272. const barData = []
  273. for (let i = 0; i < 12; i += 1) {
  274. barData.push({
  275. x: `${i + 1}月`,
  276. y: Math.floor(Math.random() * 1000) + 200
  277. })
  278. }
  279. export default {
  280. name: 'Analysis',
  281. components: {
  282. ATooltip,
  283. ACol,
  284. ChartCard,
  285. MiniArea,
  286. MiniBar,
  287. MiniProgress,
  288. RankList,
  289. Bar,
  290. Trend,
  291. LineChartMultid,
  292. HeadInfo,
  293. newHome,
  294. Workbench,
  295. Statistics
  296. },
  297. data() {
  298. return {
  299. loading: true,
  300. center: null,
  301. rankList,
  302. barData,
  303. loginfo: {},
  304. visitFields: ['ip', 'visit'],
  305. visitInfo: [],
  306. indicator: <a-icon type="loading" style="font-size: 24px" spin />,
  307. roleCode: localStorage.getItem('roleCode'),
  308. visible:false,//更新通知消息提示框
  309. updateTime:['2020-6-10'],
  310. versionId:0,//存储版本号 判断通知什么时候显示
  311. }
  312. },
  313. created() {
  314. setTimeout(() => {
  315. this.loading = !this.loading
  316. }, 1000)
  317. this.initLogInfo()
  318. },
  319. methods: {
  320. initLogInfo() {
  321. getLoginfo(null).then(res => {
  322. if (res.success) {
  323. Object.keys(res.result).forEach(key => {
  324. res.result[key] = res.result[key] + ''
  325. })
  326. this.loginfo = res.result
  327. }
  328. })
  329. getVisitInfo().then(res => {
  330. if (res.success) {
  331. console.log('aaaaaa', res.result)
  332. this.visitInfo = res.result
  333. }
  334. })
  335. },
  336. handleOk(e) {
  337. // console.log(e);
  338. this.visible = false;
  339. postAction('/ctop/releaseViewRecord/view', {
  340. versionId:this.versionId
  341. }).then(res => {
  342. console.log(res)
  343. if(res.success){
  344. // this.visible=res.showPopup;
  345. }
  346. })
  347. },
  348. },
  349. mounted() {
  350. postAction('/ctop/releaseViewRecord/check', {}).then(res => {
  351. console.log(res)
  352. if(res.success){
  353. this.visible=res.showPopup;
  354. this.versionId=res.data.id;
  355. }
  356. })
  357. },
  358. }
  359. </script>
  360. <style lang="scss" scoped>
  361. .circle-cust {
  362. position: relative;
  363. top: 28px;
  364. left: -100%;
  365. }
  366. .extra-wrapper {
  367. line-height: 55px;
  368. padding-right: 24px;
  369. .extra-item {
  370. display: inline-block;
  371. margin-right: 24px;
  372. a {
  373. margin-left: 24px;
  374. }
  375. }
  376. }
  377. /* 首页访问量统计 */
  378. .head-info {
  379. position: relative;
  380. text-align: left;
  381. padding: 0 32px 0 0;
  382. min-width: 125px;
  383. &.center {
  384. text-align: center;
  385. padding: 0 32px;
  386. }
  387. span {
  388. color: rgba(0, 0, 0, 0.45);
  389. display: inline-block;
  390. font-size: 0.95rem;
  391. line-height: 42px;
  392. margin-bottom: 4px;
  393. }
  394. p {
  395. line-height: 42px;
  396. margin: 0;
  397. a {
  398. font-weight: 600;
  399. font-size: 1rem;
  400. }
  401. }
  402. }
  403. </style>