index.vue 15 KB

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