index.vue 16 KB

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