index.vue 16 KB

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