index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: wanglj
  5. * @LastEditTime: 2023-02-20 10:05:52
  6. * @Description: file content
  7. * @FilePath: \frontend_mobile\pages\home\index.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">首页</view>
  14. </view>
  15. </view>
  16. <view class="header">
  17. <view class="h-left">
  18. <text class="name">大数华创</text>
  19. <text class="txt">提升工作效率,降低管理难度</text>
  20. <view class="line"></view>
  21. </view>
  22. <view class="h-right"></view>
  23. </view>
  24. <view class="main">
  25. <view class="msg-box">
  26. <view class="tab-date-wrap">
  27. <text class="tab-date-item" @click="tabDate = 'week'" :class="{ dateActive: tabDate == 'week' }">本周</text>
  28. <text class="tab-date-item" @click="tabDate = 'month'" :class="{ dateActive: tabDate == 'month' }">本月</text>
  29. </view>
  30. <view class="date-msg">
  31. <u-row justify="space-between">
  32. <u-col span="4">
  33. <view class="center flex-column">
  34. <view class="num">12</view>
  35. <view class="txt">新增客户</view>
  36. </view>
  37. </u-col>
  38. <u-col span="4">
  39. <view class="center flex-column">
  40. <view class="num">19</view>
  41. <view class="txt">新增项目</view>
  42. </view>
  43. </u-col>
  44. <u-col span="4">
  45. <view class="center flex-column">
  46. <view class="num">12</view>
  47. <view class="txt">督办事项</view>
  48. </view>
  49. </u-col>
  50. </u-row>
  51. </view>
  52. </view>
  53. <view class="menu-wrap">
  54. <u-row justify="space-between" gutter="14">
  55. <u-col span="6">
  56. <view class="menu-item flex_l flex-colunm" @click="handleHomeLink('/pages/openSeaCustomer/index')">
  57. <view class="menu-img-box">
  58. <image class="menu-img" src="../../static/images/menu5.png" mode="scaleToFill" />
  59. </view>
  60. <view class="menu-info flex flex-column">
  61. <view class="tit1">公海客户</view>
  62. <view class="tit2">公海客户管理</view>
  63. </view>
  64. </view>
  65. </u-col>
  66. <u-col span="6">
  67. <view class="menu-item flex_l flex-colunm" @click="handleHomeLink('/pages/customer/index')">
  68. <view class="menu-img-box">
  69. <image class="menu-img" src="../../static/images/menu1.png" mode="scaleToFill" />
  70. </view>
  71. <view class="menu-info flex flex-column">
  72. <view class="tit1">客户管理</view>
  73. <view class="tit2">客户信息管理</view>
  74. </view>
  75. </view>
  76. </u-col>
  77. </u-row>
  78. <u-row justify="space-between" gutter="14">
  79. <u-col span="6">
  80. <view class="menu-item flex_l flex-colunm" @click="handleHomeLink('/pages/project/index')">
  81. <view class="menu-img-box">
  82. <image class="menu-img" src="../../static/images/menu2.png" mode="scaleToFill" />
  83. </view>
  84. <view class="menu-info flex flex-column">
  85. <view class="tit1">项目管理</view>
  86. <view class="tit2">项目进展查询</view>
  87. </view>
  88. </view>
  89. </u-col>
  90. <u-col span="6">
  91. <view class="menu-item flex_l flex-colunm" @click="handleHomeLink('/pages/contract/index')">
  92. <view class="menu-img-box">
  93. <image class="menu-img" src="../../static/images/menu3.png" mode="scaleToFill" />
  94. </view>
  95. <view class="menu-info flex flex-column">
  96. <view class="tit1">合同管理</view>
  97. <view class="tit2">合同信息查阅</view>
  98. </view>
  99. </view>
  100. </u-col>
  101. </u-row>
  102. <u-row justify="space-between" gutter="14">
  103. <u-col span="6">
  104. <view class="menu-item flex_l flex-colunm">
  105. <view class="menu-img-box">
  106. <image class="menu-img" src="../../static/images/menu4.png" mode="scaleToFill" />
  107. </view>
  108. <view class="menu-info flex flex-column">
  109. <view class="tit1">回款管理</view>
  110. <view class="tit2">回款数据展示</view>
  111. </view>
  112. </view>
  113. </u-col>
  114. <u-col span="6">
  115. <view class="menu-item flex_l flex-colunm">
  116. <view class="menu-img-box">
  117. <image class="menu-img" src="../../static/images/menu6.png" mode="scaleToFill" />
  118. </view>
  119. <view class="menu-info flex flex-column">
  120. <view class="tit1">工单管理</view>
  121. <view class="tit2">工单进度查询</view>
  122. </view>
  123. </view>
  124. </u-col>
  125. </u-row>
  126. </view>
  127. <view class="echarts-container">
  128. <h4>个人报表</h4>
  129. <view class="echarts" v-for="item in echarts" :key="item.id">
  130. <h4>{{item.report_name}}</h4>
  131. <view class="chart">
  132. <l-echart :ref="item.id + ''" @finished="init(item.id)"></l-echart>
  133. </view>
  134. </view>
  135. </view>
  136. <!-- <view class="rank-wrap">
  137. <view class="rank-tit flex_l">
  138. <image class="rank-tit-img" src="../../static/images/rank-img.png" mode="scaleToFill" />
  139. <text>回款排名</text>
  140. </view>
  141. <view class="rank-list-wrap">
  142. <view class="rank-th">
  143. <u-row justify="space-between">
  144. <u-col span="2">
  145. <view class="th1 text-center">排名</view>
  146. </u-col>
  147. <u-col span="4">
  148. <view class="th2 text-center">姓名</view>
  149. </u-col>
  150. <u-col span="6">
  151. <view class="th3 text-center">回款额</view>
  152. </u-col>
  153. </u-row>
  154. </view>
  155. <view class="rank-list">
  156. <view class="rank-item" v-for="(v, i) in rankList" :key="i">
  157. <u-row justify="space-between">
  158. <u-col span="2">
  159. <view class="rank-box center">
  160. <image
  161. class="rank-img"
  162. v-if="i < 3"
  163. :src="require(`../../static/images/rank${i + 1}.png`)"
  164. mode=""></image>
  165. <view v-else class="th1 text-center rank">{{ i + 1 }}</view>
  166. </view>
  167. </u-col>
  168. <u-col span="4">
  169. <view class="th2 text-center">{{ v.name }}</view>
  170. </u-col>
  171. <u-col span="6">
  172. <view class="th3 text-center">
  173. <u-text mode="price" :text="v.money"></u-text>
  174. </view>
  175. </u-col>
  176. </u-row>
  177. </view>
  178. </view>
  179. <view class="view-all">查看全部排名 ></view>
  180. </view>
  181. </view> -->
  182. </view>
  183. </view>
  184. </template>
  185. <script>
  186. import indexApi from '@/api/system/index.js'
  187. import to from 'await-to-js'
  188. import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
  189. import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
  190. export default {
  191. name: 'omsIndex',
  192. data() {
  193. return {
  194. height: '',
  195. paddingTop: '',
  196. tabDate: 'week',
  197. rankList: [{
  198. name: '邱国辉',
  199. money: '100000',
  200. },
  201. {
  202. name: '邱国辉',
  203. money: '100000000',
  204. },
  205. {
  206. name: '邱国辉',
  207. money: '100000000',
  208. },
  209. {
  210. name: '邱国辉',
  211. money: '100000000',
  212. },
  213. {
  214. name: '邱国辉',
  215. money: '100000000',
  216. },
  217. ],
  218. echarts: [],
  219. }
  220. },
  221. created() {
  222. const navData = uni.getMenuButtonBoundingClientRect()
  223. this.height = navData.height + 'px'
  224. this.paddingTop = navData.top + 'px'
  225. },
  226. mounted() {
  227. this.getEcharts()
  228. },
  229. components: {
  230. LEchart
  231. },
  232. methods: {
  233. handleHomeLink(url) {
  234. uni.navigateTo({
  235. //保留当前页面,跳转到应用内的某个页面
  236. url,
  237. })
  238. },
  239. async getEcharts() {
  240. const [err, res] = await to(indexApi.getHomeReport({
  241. module_code: 'HomePage'
  242. }))
  243. if (err) return
  244. const obj = JSON.parse(res.data.configInfo)
  245. this.echarts = obj.data_report_config || []
  246. },
  247. async init(id) {
  248. console.log(id, 'id')
  249. const [err, res] = await to(indexApi.getHomeDataReportData({
  250. id
  251. }))
  252. if (err) return
  253. const option = {
  254. grid: {
  255. bottom: 10,
  256. top: 20,
  257. right: 10,
  258. containLabel: true
  259. },
  260. tooltip: {
  261. trigger: 'axis',
  262. },
  263. xAxis: [{
  264. type: 'category',
  265. data: res.data.data.xData,
  266. axisTick: {
  267. alignWithLabel: true,
  268. },
  269. }, ],
  270. yAxis: [{
  271. type: 'value',
  272. name: '(元)',
  273. nameLocation: 'start'
  274. }, ],
  275. series: [{
  276. name: '销售指标',
  277. type: 'bar',
  278. data: res.data.data.yDataTarget,
  279. },
  280. {
  281. name: '销售额度',
  282. type: 'bar',
  283. data: res.data.data.yDataReal,
  284. },
  285. ],
  286. }
  287. console.log(this.$refs[id][0], 'id')
  288. this.$refs[id][0].init(echarts, chart => {
  289. chart.setOption(option);
  290. });
  291. },
  292. },
  293. }
  294. </script>
  295. <style>
  296. page {
  297. background: #f2f3f5;
  298. }
  299. </style>
  300. <style lang="scss" scoped>
  301. .home {
  302. padding-top: 210rpx;
  303. .nav {
  304. position: absolute;
  305. left: 0;
  306. top: 0;
  307. width: 100%;
  308. height: 556rpx;
  309. background: linear-gradient(193deg, rgba(62, 126, 248, 1) 0%, rgba(226, 236, 255, 1) 100%);
  310. border-radius: 0 0 92rpx 92rpx;
  311. z-index: -1;
  312. .title {
  313. text-align: center;
  314. font-size: 32rpx;
  315. font-weight: bold;
  316. color: #ffffff;
  317. }
  318. }
  319. .header {
  320. padding: 0 75rpx;
  321. display: flex;
  322. .h-left {
  323. box-sizing: border-box;
  324. padding-top: 30rpx;
  325. display: flex;
  326. color: #ffffff;
  327. flex: 1;
  328. display: flex;
  329. flex-flow: column;
  330. .name {
  331. font-size: 32rpx;
  332. font-weight: bold;
  333. margin-bottom: 12rpx;
  334. }
  335. .txt {
  336. font-size: 24rpx;
  337. margin-bottom: 20rpx;
  338. }
  339. .line {
  340. width: 46rpx;
  341. border: 2rpx solid #ffffff;
  342. }
  343. }
  344. .h-right {
  345. width: 115px;
  346. height: 115px;
  347. background: url('../../static/images/home1.png') no-repeat;
  348. background-size: cover;
  349. }
  350. }
  351. .main {
  352. box-sizing: border-box;
  353. padding: 0 32rpx 46rpx;
  354. .msg-box {
  355. width: 100%;
  356. height: 185rpx;
  357. background: #ffffff;
  358. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  359. border-radius: 31rpx 31rpx 31rpx 31rpx;
  360. margin: 0 auto;
  361. .tab-date-wrap {
  362. padding: 8rpx 0 24rpx 38rpx;
  363. .tab-date-item {
  364. font-size: 24rpx;
  365. font-weight: bold;
  366. color: #d8e5fe;
  367. margin-right: 16rpx;
  368. }
  369. .dateActive {
  370. font-size: 28rpx;
  371. color: #3e7ef8;
  372. }
  373. }
  374. .date-msg {
  375. .num {
  376. font-size: 38rpx;
  377. font-weight: bold;
  378. color: #fe6936;
  379. margin-bottom: 4rpx;
  380. }
  381. .txt {
  382. font-size: 24rpx;
  383. color: #646464;
  384. }
  385. }
  386. }
  387. .menu-wrap {
  388. .menu-item {
  389. margin-top: 32rpx;
  390. background: #ffffff;
  391. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  392. border-radius: 31rpx;
  393. padding: 40rpx 0 40rpx 52rpx;
  394. .menu-img-box {
  395. margin-right: 14rpx;
  396. display: flex;
  397. align-items: center;
  398. justify-content: center;
  399. }
  400. .menu-img {
  401. width: 36px;
  402. height: 36px;
  403. }
  404. .menu-info {
  405. display: flex;
  406. .tit1 {
  407. font-size: 28rpx;
  408. font-weight: bold;
  409. color: #323232;
  410. margin-bottom: 12rpx;
  411. }
  412. .tit2 {
  413. font-size: 24rpx;
  414. color: #646464;
  415. }
  416. }
  417. }
  418. }
  419. .rank-wrap {
  420. margin-top: 34rpx;
  421. .rank-tit {
  422. margin-bottom: 18rpx;
  423. .rank-tit-img {
  424. margin: 0 10rpx 0 28rpx;
  425. width: 31rpx;
  426. height: 31rpx;
  427. }
  428. text {
  429. font-size: 28rpx;
  430. font-weight: bold;
  431. color: #323232;
  432. }
  433. }
  434. .rank-list-wrap {
  435. width: 100%;
  436. background: #ffffff;
  437. border-radius: 31rpx;
  438. .rank-th {
  439. padding: 34rpx 0 20rpx 72rpx;
  440. }
  441. .rank-list {
  442. margin-bottom: 24rpx;
  443. .rank-item {
  444. .rank-box {
  445. .rank-img {
  446. width: 41px;
  447. height: 42px;
  448. }
  449. .rank {
  450. width: 41px;
  451. height: 42px;
  452. line-height: 42px;
  453. font-size: 28rpx;
  454. font-weight: bold;
  455. color: #969696;
  456. }
  457. }
  458. padding: 19rpx 0 19rpx 72rpx;
  459. &:not(:last-child) {
  460. border-bottom: 2rpx solid #f2f3f5;
  461. }
  462. }
  463. }
  464. }
  465. .view-all {
  466. font-size: 24rpx;
  467. color: #3e7ef8;
  468. text-align: center;
  469. height: 60rpx;
  470. }
  471. }
  472. .echarts-container {
  473. background-color: #fff;
  474. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  475. border-radius: 31rpx 31rpx 31rpx 31rpx;
  476. margin: 0 auto;
  477. margin-top: 32rpx;
  478. padding: 0 20rpx 20rpx;
  479. h4 {
  480. font-size: 28rpx;
  481. line-height: 80rpx;
  482. font-weight: bold;
  483. color: #323232;
  484. padding-left: 40rpx;
  485. }
  486. .echarts {
  487. height: 480rpx;
  488. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  489. border-radius: 31rpx 31rpx 31rpx 31rpx;
  490. + .echarts {
  491. margin-top: 32rpx;
  492. }
  493. .chart {
  494. height: 400rpx;
  495. }
  496. }
  497. }
  498. }
  499. }
  500. </style>