index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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 class="check" @click="toCheckIn">
  184. </view>
  185. </view>
  186. </template>
  187. <script>
  188. import indexApi from '@/api/system/index.js'
  189. import to from 'await-to-js'
  190. import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
  191. import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
  192. export default {
  193. name: 'omsIndex',
  194. data() {
  195. return {
  196. height: '',
  197. paddingTop: '',
  198. tabDate: 'week',
  199. rankList: [{
  200. name: '邱国辉',
  201. money: '100000',
  202. },
  203. {
  204. name: '邱国辉',
  205. money: '100000000',
  206. },
  207. {
  208. name: '邱国辉',
  209. money: '100000000',
  210. },
  211. {
  212. name: '邱国辉',
  213. money: '100000000',
  214. },
  215. {
  216. name: '邱国辉',
  217. money: '100000000',
  218. },
  219. ],
  220. echarts: [],
  221. }
  222. },
  223. created() {
  224. const navData = uni.getMenuButtonBoundingClientRect()
  225. this.height = navData.height + 'px'
  226. this.paddingTop = navData.top + 'px'
  227. },
  228. mounted() {
  229. this.getEcharts()
  230. },
  231. components: {
  232. LEchart
  233. },
  234. methods: {
  235. handleHomeLink(url) {
  236. uni.navigateTo({
  237. //保留当前页面,跳转到应用内的某个页面
  238. url,
  239. })
  240. },
  241. async getEcharts() {
  242. const [err, res] = await to(indexApi.getHomeReport({
  243. module_code: 'HomePage'
  244. }))
  245. if (err) return
  246. const obj = JSON.parse(res.data.configInfo)
  247. this.echarts = obj.data_report_config || []
  248. },
  249. async init(id) {
  250. console.log(id, 'id')
  251. const [err, res] = await to(indexApi.getHomeDataReportData({
  252. id
  253. }))
  254. if (err) return
  255. const option = {
  256. grid: {
  257. bottom: 10,
  258. top: 20,
  259. right: 10,
  260. containLabel: true
  261. },
  262. tooltip: {
  263. trigger: 'axis',
  264. },
  265. xAxis: [{
  266. type: 'category',
  267. data: res.data.data.xData,
  268. axisTick: {
  269. alignWithLabel: true,
  270. },
  271. }, ],
  272. yAxis: [{
  273. type: 'value',
  274. name: '(元)',
  275. nameLocation: 'start'
  276. }, ],
  277. series: [{
  278. name: '销售指标',
  279. type: 'bar',
  280. data: res.data.data.yDataTarget,
  281. },
  282. {
  283. name: '销售额度',
  284. type: 'bar',
  285. data: res.data.data.yDataReal,
  286. },
  287. ],
  288. }
  289. this.$refs[id][0].init(echarts, chart => {
  290. chart.setOption(option);
  291. });
  292. },
  293. toCheckIn() {
  294. uni.navigateTo({
  295. //保留当前页面,跳转到应用内的某个页面
  296. url: '/pages/home/checkIn',
  297. })
  298. }
  299. },
  300. }
  301. </script>
  302. <style>
  303. page {
  304. background: #f2f3f5;
  305. }
  306. </style>
  307. <style lang="scss" scoped>
  308. .home {
  309. padding-top: 210rpx;
  310. position: relative;
  311. .check {
  312. position: fixed;
  313. right: 20rpx;
  314. bottom: 20rpx;
  315. width: 90rpx;
  316. height: 90rpx;
  317. line-height: 90rpx;
  318. text-align: center;
  319. border-radius: 45rpx;
  320. background-color: #3e7ef8;
  321. color: #fff;
  322. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  323. }
  324. .nav {
  325. position: absolute;
  326. left: 0;
  327. top: 0;
  328. width: 100%;
  329. height: 556rpx;
  330. background: linear-gradient(193deg, rgba(62, 126, 248, 1) 0%, rgba(226, 236, 255, 1) 100%);
  331. border-radius: 0 0 92rpx 92rpx;
  332. z-index: -1;
  333. .title {
  334. text-align: center;
  335. font-size: 32rpx;
  336. font-weight: bold;
  337. color: #ffffff;
  338. }
  339. }
  340. .header {
  341. padding: 0 75rpx;
  342. display: flex;
  343. .h-left {
  344. box-sizing: border-box;
  345. padding-top: 30rpx;
  346. display: flex;
  347. color: #ffffff;
  348. flex: 1;
  349. display: flex;
  350. flex-flow: column;
  351. .name {
  352. font-size: 32rpx;
  353. font-weight: bold;
  354. margin-bottom: 12rpx;
  355. }
  356. .txt {
  357. font-size: 24rpx;
  358. margin-bottom: 20rpx;
  359. }
  360. .line {
  361. width: 46rpx;
  362. border: 2rpx solid #ffffff;
  363. }
  364. }
  365. .h-right {
  366. width: 115px;
  367. height: 115px;
  368. background: url('../../static/images/home1.png') no-repeat;
  369. background-size: cover;
  370. }
  371. }
  372. .main {
  373. box-sizing: border-box;
  374. padding: 0 32rpx 46rpx;
  375. .msg-box {
  376. width: 100%;
  377. height: 185rpx;
  378. background: #ffffff;
  379. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  380. border-radius: 31rpx 31rpx 31rpx 31rpx;
  381. margin: 0 auto;
  382. .tab-date-wrap {
  383. padding: 8rpx 0 24rpx 38rpx;
  384. .tab-date-item {
  385. font-size: 24rpx;
  386. font-weight: bold;
  387. color: #d8e5fe;
  388. margin-right: 16rpx;
  389. }
  390. .dateActive {
  391. font-size: 28rpx;
  392. color: #3e7ef8;
  393. }
  394. }
  395. .date-msg {
  396. .num {
  397. font-size: 38rpx;
  398. font-weight: bold;
  399. color: #fe6936;
  400. margin-bottom: 4rpx;
  401. }
  402. .txt {
  403. font-size: 24rpx;
  404. color: #646464;
  405. }
  406. }
  407. }
  408. .menu-wrap {
  409. .menu-item {
  410. margin-top: 32rpx;
  411. background: #ffffff;
  412. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  413. border-radius: 31rpx;
  414. padding: 40rpx 0 40rpx 52rpx;
  415. .menu-img-box {
  416. margin-right: 14rpx;
  417. display: flex;
  418. align-items: center;
  419. justify-content: center;
  420. }
  421. .menu-img {
  422. width: 36px;
  423. height: 36px;
  424. }
  425. .menu-info {
  426. display: flex;
  427. .tit1 {
  428. font-size: 28rpx;
  429. font-weight: bold;
  430. color: #323232;
  431. margin-bottom: 12rpx;
  432. }
  433. .tit2 {
  434. font-size: 24rpx;
  435. color: #646464;
  436. }
  437. }
  438. }
  439. }
  440. .rank-wrap {
  441. margin-top: 34rpx;
  442. .rank-tit {
  443. margin-bottom: 18rpx;
  444. .rank-tit-img {
  445. margin: 0 10rpx 0 28rpx;
  446. width: 31rpx;
  447. height: 31rpx;
  448. }
  449. text {
  450. font-size: 28rpx;
  451. font-weight: bold;
  452. color: #323232;
  453. }
  454. }
  455. .rank-list-wrap {
  456. width: 100%;
  457. background: #ffffff;
  458. border-radius: 31rpx;
  459. .rank-th {
  460. padding: 34rpx 0 20rpx 72rpx;
  461. }
  462. .rank-list {
  463. margin-bottom: 24rpx;
  464. .rank-item {
  465. .rank-box {
  466. .rank-img {
  467. width: 41px;
  468. height: 42px;
  469. }
  470. .rank {
  471. width: 41px;
  472. height: 42px;
  473. line-height: 42px;
  474. font-size: 28rpx;
  475. font-weight: bold;
  476. color: #969696;
  477. }
  478. }
  479. padding: 19rpx 0 19rpx 72rpx;
  480. &:not(:last-child) {
  481. border-bottom: 2rpx solid #f2f3f5;
  482. }
  483. }
  484. }
  485. }
  486. .view-all {
  487. font-size: 24rpx;
  488. color: #3e7ef8;
  489. text-align: center;
  490. height: 60rpx;
  491. }
  492. }
  493. .echarts-container {
  494. background-color: #fff;
  495. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  496. border-radius: 31rpx 31rpx 31rpx 31rpx;
  497. margin: 0 auto;
  498. margin-top: 32rpx;
  499. padding: 0 20rpx 20rpx;
  500. h4 {
  501. font-size: 28rpx;
  502. line-height: 80rpx;
  503. font-weight: bold;
  504. color: #323232;
  505. padding-left: 40rpx;
  506. }
  507. .echarts {
  508. height: 480rpx;
  509. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  510. border-radius: 31rpx 31rpx 31rpx 31rpx;
  511. +.echarts {
  512. margin-top: 32rpx;
  513. }
  514. .chart {
  515. height: 400rpx;
  516. }
  517. }
  518. }
  519. }
  520. }
  521. </style>