index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  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('/pages/inviteTenders/index')">
  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. <u-row justify="space-between" gutter="14">
  134. <u-col span="6">
  135. <view class="menu-item flex_l flex-colunm" @click="handleHomeLink('/pages/partners/index')">
  136. <view class="menu-img-box">
  137. <image class="menu-img" src="../../static/images/menu1.png" mode="scaleToFill" />
  138. </view>
  139. <view class="menu-info flex flex-column">
  140. <view class="tit1">合作伙伴</view>
  141. <view class="tit2">合作伙伴展示</view>
  142. </view>
  143. </view>
  144. </u-col>
  145. <!-- <u-col span="6">
  146. <view class="menu-item flex_l flex-colunm" @click="handleHomeLink('/pages/inviteTenders/index')">
  147. <view class="menu-img-box">
  148. <image class="menu-img" src="../../static/images/menu6.png" mode="scaleToFill" />
  149. </view>
  150. <view class="menu-info flex flex-column">
  151. <view class="tit1">招标信息</view>
  152. <view class="tit2">招标信息查询</view>
  153. </view>
  154. </view>
  155. </u-col> -->
  156. </u-row>
  157. </view>
  158. <view class="data-container">
  159. <h4>个人看板</h4>
  160. <view class="flex flex-wrap flex-around">
  161. <view class="board-data" v-for="(v, i) in privateBoard" :key="i">
  162. <view>
  163. <u-text :bold="true" :text="v.report_data"></u-text>
  164. </view>
  165. <view>
  166. <u-text lines="1" :text="v.report_name"></u-text>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. <view class="check" @click="toCheckIn">卡</view>
  174. </view>
  175. </template>
  176. <script>
  177. import indexApi from '@/api/system/index.js'
  178. import homeApi from '@/api/home'
  179. import to from 'await-to-js'
  180. export default {
  181. name: 'omsIndex',
  182. data() {
  183. return {
  184. showSaleType: false,
  185. showCollectionType: false,
  186. saleVal: '全年',
  187. collectionVal: '全年',
  188. saleType: 0,
  189. collectionType: 0,
  190. quarter: [
  191. {
  192. name: '一季度',
  193. type: 1,
  194. },
  195. {
  196. name: '二季度',
  197. type: 2,
  198. },
  199. {
  200. name: '三季度',
  201. type: 3,
  202. },
  203. {
  204. name: '四季度',
  205. type: 4,
  206. },
  207. {
  208. name: '全年',
  209. type: 0,
  210. },
  211. ],
  212. bannerList: [
  213. require('@/static/images/swiper/banner1.png'),
  214. require('@/static/images/swiper/banner2.png'),
  215. require('@/static/images/swiper/banner3.png'),
  216. ],
  217. privateBoard: [], //个人看板数据
  218. height: '',
  219. paddingTop: '',
  220. tabDate: 'week',
  221. newCustomer: 0,
  222. newBusiness: 0,
  223. newTask: 0,
  224. }
  225. },
  226. created() {
  227. const navData = uni.getMenuButtonBoundingClientRect()
  228. this.height = navData.height + 'px'
  229. this.paddingTop = navData.top + 'px'
  230. },
  231. mounted() {
  232. this.getHomeConfig()
  233. },
  234. onShow() {
  235. this.getReport('week')
  236. },
  237. methods: {
  238. // 获取首页新增数据
  239. async getReport(type) {
  240. this.tabDate = type
  241. let params = { viewInterval: this.tabDate }
  242. const [err, res] = await to(homeApi.getReportData(params))
  243. if (err) return
  244. if (res.code == 200) {
  245. this.newCustomer = res.data.newCustomer
  246. this.newBusiness = res.data.newBusiness
  247. this.newTask = res.data.newTask
  248. }
  249. },
  250. handleHomeLink(url, linkType) {
  251. if (!url) {
  252. uni.showToast({
  253. title: '功能开发中~',
  254. icon: 'none',
  255. })
  256. return
  257. }
  258. if (linkType && linkType == '2') {
  259. uni.reLaunch({
  260. url,
  261. })
  262. } else {
  263. uni.navigateTo({
  264. //保留当前页面,跳转到应用内的某个页面
  265. url,
  266. })
  267. }
  268. },
  269. // 获取首页配置
  270. async getHomeConfig() {
  271. const [err, res] = await to(
  272. indexApi.getHomeReport({
  273. module_code: 'HomePage',
  274. })
  275. )
  276. if (err) return
  277. if (res && res.data) {
  278. const obj = JSON.parse(res.data.configInfo)
  279. this.privateBoard = obj.num_report_config || []
  280. this.getHomeNumReportData()
  281. }
  282. },
  283. // 获取首页个人看板数据
  284. async getHomeNumReportData() {
  285. let ids = this.privateBoard.map((item) => {
  286. return item.id
  287. })
  288. const {
  289. data: { num_report_response },
  290. } = await indexApi.getHomeNumReportData({ ids: ids })
  291. let privateBoardData = []
  292. this.privateBoard.forEach((item, index) => {
  293. num_report_response.forEach((val) => {
  294. if (item.id === val.id) {
  295. this.privateBoard[index].report_data = val.data
  296. privateBoardData.push(this.privateBoard[index])
  297. }
  298. })
  299. })
  300. this.privateBoard = privateBoardData.splice(0, 6)
  301. },
  302. toCheckIn() {
  303. uni.navigateTo({
  304. //保留当前页面,跳转到应用内的某个页面
  305. url: '/pages/home/checkIn',
  306. })
  307. },
  308. },
  309. }
  310. </script>
  311. <style>
  312. page {
  313. background: #f2f3f5;
  314. }
  315. </style>
  316. <style lang="scss" scoped>
  317. .home {
  318. padding-top: 200rpx;
  319. // position: relative;
  320. .check {
  321. position: fixed;
  322. right: 20rpx;
  323. bottom: 20rpx;
  324. width: 90rpx;
  325. height: 90rpx;
  326. line-height: 90rpx;
  327. text-align: center;
  328. border-radius: 45rpx;
  329. background-color: #3e7ef8;
  330. color: #fff;
  331. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  332. }
  333. .nav {
  334. position: absolute;
  335. left: 0;
  336. top: 0;
  337. width: 100%;
  338. height: 556rpx;
  339. background: #3e7ef8;
  340. border-radius: 0 0 92rpx 92rpx;
  341. z-index: -1;
  342. .title {
  343. text-align: center;
  344. font-size: 32rpx;
  345. font-weight: bold;
  346. color: #ffffff;
  347. }
  348. }
  349. .main {
  350. box-sizing: border-box;
  351. padding: 0 0 46rpx;
  352. position: absolute;
  353. width: 100%;
  354. height: calc(100vh - 200rpx);
  355. .content {
  356. padding: 0 32rpx;
  357. }
  358. // overflow: hidden;
  359. .msg-box {
  360. width: 100%;
  361. height: 185rpx;
  362. background: #ffffff;
  363. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  364. border-radius: 31rpx 31rpx 31rpx 31rpx;
  365. margin: 0 auto;
  366. .tab-date-wrap {
  367. padding: 8rpx 0 24rpx 38rpx;
  368. .tab-date-item {
  369. font-size: 24rpx;
  370. font-weight: bold;
  371. color: #d8e5fe;
  372. margin-right: 16rpx;
  373. }
  374. .dateActive {
  375. font-size: 28rpx;
  376. color: #3e7ef8;
  377. }
  378. }
  379. .date-msg {
  380. .num {
  381. font-size: 38rpx;
  382. font-weight: bold;
  383. color: #fe6936;
  384. margin-bottom: 4rpx;
  385. }
  386. .txt {
  387. font-size: 24rpx;
  388. color: #646464;
  389. }
  390. }
  391. }
  392. .menu-wrap {
  393. .menu-item {
  394. margin-top: 32rpx;
  395. background: #ffffff;
  396. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  397. border-radius: 31rpx;
  398. padding: 40rpx 0 40rpx 52rpx;
  399. .menu-img-box {
  400. margin-right: 14rpx;
  401. display: flex;
  402. align-items: center;
  403. justify-content: center;
  404. }
  405. .menu-img {
  406. width: 36px;
  407. height: 36px;
  408. }
  409. .menu-info {
  410. display: flex;
  411. .tit1 {
  412. font-size: 28rpx;
  413. font-weight: bold;
  414. color: #323232;
  415. margin-bottom: 12rpx;
  416. }
  417. .tit2 {
  418. font-size: 24rpx;
  419. color: #646464;
  420. }
  421. }
  422. }
  423. }
  424. .rank-wrap {
  425. margin-top: 34rpx;
  426. .rank-tit {
  427. margin-bottom: 18rpx;
  428. .rank-tit-img {
  429. margin: 0 10rpx 0 28rpx;
  430. width: 31rpx;
  431. height: 31rpx;
  432. }
  433. text {
  434. font-size: 28rpx;
  435. font-weight: bold;
  436. color: #323232;
  437. }
  438. }
  439. .rank-list-wrap {
  440. width: 100%;
  441. background: #ffffff;
  442. border-radius: 31rpx;
  443. .rank-th {
  444. padding: 34rpx 0 20rpx 72rpx;
  445. }
  446. .rank-list {
  447. margin-bottom: 24rpx;
  448. .rank-item {
  449. .rank-box {
  450. .rank-img {
  451. width: 41px;
  452. height: 42px;
  453. }
  454. .rank {
  455. width: 41px;
  456. height: 42px;
  457. line-height: 42px;
  458. font-size: 28rpx;
  459. font-weight: bold;
  460. color: #969696;
  461. }
  462. }
  463. padding: 19rpx 0 19rpx 72rpx;
  464. &:not(:last-child) {
  465. border-bottom: 2rpx solid #f2f3f5;
  466. }
  467. }
  468. }
  469. }
  470. .view-all {
  471. font-size: 24rpx;
  472. color: #3e7ef8;
  473. text-align: center;
  474. height: 60rpx;
  475. }
  476. }
  477. .data-container {
  478. background-color: #fff;
  479. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  480. border-radius: 31rpx 31rpx 31rpx 31rpx;
  481. margin: 0 auto;
  482. margin-top: 32rpx;
  483. padding: 0 20rpx 20rpx;
  484. h4 {
  485. font-size: 28rpx;
  486. line-height: 80rpx;
  487. font-weight: bold;
  488. color: #323232;
  489. padding-left: 40rpx;
  490. }
  491. .board-data {
  492. width: 46%;
  493. border-radius: 10rpx;
  494. padding: 0 20rpx;
  495. border: 1px solid #eee;
  496. line-height: 50rpx;
  497. margin-bottom: 20rpx;
  498. }
  499. .echarts {
  500. height: 500rpx;
  501. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  502. border-radius: 31rpx 31rpx 31rpx 31rpx;
  503. + .echarts {
  504. margin-top: 32rpx;
  505. }
  506. .chart {
  507. height: 420rpx;
  508. }
  509. }
  510. }
  511. }
  512. }
  513. </style>