index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <view class="content">
  3. <swiper :current="current" class="swiper-box">
  4. <swiper-item class="swiper-item" style="padding: 0 15px 0px 15px;box-sizing: border-box;">
  5. <view class="chart-box">
  6. <canvas canvas-id="chartBox" id="chartBox" class="chart-canvas"></canvas>
  7. </view>
  8. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToTodayEnroll()">查看详情</u-button>
  9. <view class="section-title" style="margin-top: 40px;">
  10. <u-image width="20px" height="10px" :src="sectionIcon"></u-image>
  11. <u-section title="场馆推荐" sub-title="查看更多" font-size="32" :show-line="false" @click="goToVenueList()"></u-section>
  12. </view>
  13. <u-card :show-head="false" :show-foot="false" :border="false" margin="0px">
  14. <view class="class-show-box" slot="body">
  15. <view v-for="(item, index) in videoList" :key="index" class="class-show-card" @click="goToVenueDetail(item)">
  16. <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px"></u-image>
  17. <view class="class-show-name">{{item.name}}</view>
  18. </view>
  19. </view>
  20. </u-card>
  21. </swiper-item>
  22. <swiper-item class="swiper-item">
  23. <view class="enroll-fix-box">
  24. <view class="enroll-button" @click="goToAddForm('enrolledForm')">
  25. <view class="enroll-img">
  26. <u-image :src="enrolledIcon" mode="aspectFit" width="34px" height="34px"></u-image>
  27. </view>
  28. <view class="enroll-text">已报名</view>
  29. </view>
  30. <view class="enroll-button" @click="goToAddForm('intentionForm')">
  31. <view class="enroll-img">
  32. <u-image :src="intentionIcon" mode="aspectFit" width="34px" height="34px"></u-image>
  33. </view>
  34. <view class="enroll-text">有意向</view>
  35. </view>
  36. </view>
  37. </swiper-item>
  38. <swiper-item class="swiper-item">
  39. <view class="user-info">
  40. <view class="user-data">
  41. <view class="user-name">{{userData.nickName}}</view>
  42. <view class="user-phone">{{userData.phone}}</view>
  43. </view>
  44. <view class="user-img">
  45. <u-avatar :src="userData.headImage" size="160"></u-avatar>
  46. </view>
  47. </view>
  48. <view class="user-handle" v-for="(item, index) in handleList" :key="index" @click="goToHandle(item)">
  49. <view class="handle-icon">
  50. <u-image :src="item.icon" mode="aspectFit" width="28px" height="28px"></u-image>
  51. </view>
  52. <view class="handle-label">{{item.label}}</view>
  53. <view class="handle-arrow">
  54. <u-icon name="arrow-right" color="#cccccc" size="32"></u-icon>
  55. </view>
  56. </view>
  57. </swiper-item>
  58. </swiper>
  59. <u-top-tips ref="uTips"></u-top-tips>
  60. <u-tabbar v-model="current" :list="tabbarList" :mid-button="true" :active-color="mainColor" inactive-color="#cccccc"
  61. icon-size="60"></u-tabbar>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. mapGetters
  67. } from 'vuex'
  68. import uCharts from '@/js_sdk/u-charts/u-charts/u-charts.min.js';
  69. const NET = require('@/utils/request')
  70. const API = require('@/config/api')
  71. var _self;
  72. let chartBox = null;
  73. export default {
  74. computed: {
  75. ...mapGetters([
  76. 'mainColor',
  77. 'customStyle',
  78. ])
  79. },
  80. data() {
  81. return {
  82. cWidth: '',
  83. longitude: '',
  84. latitude: '',
  85. sectionIcon: API.getServerImg + 'biaoti.png',
  86. enrolledIcon: API.getServerImg + 'yibaoming.png ',
  87. intentionIcon: API.getServerImg + 'yixiangkehu.png',
  88. videoList: [],
  89. current: 0,
  90. tabbarList: [{
  91. iconPath: "../../../static/images/icon-index.png",
  92. selectedIconPath: "../../../static/images/icon-index-active.png",
  93. text: '首页',
  94. customIcon: false,
  95. },
  96. {
  97. iconPath: "plus-circle-fill",
  98. selectedIconPath: "close-circle-fill",
  99. text: '新增',
  100. midButton: true,
  101. customIcon: false,
  102. },
  103. {
  104. iconPath: "../../../static/images/icon-mine.png",
  105. selectedIconPath: "../../../static/images/icon-mine-active.png",
  106. text: '我的',
  107. customIcon: false,
  108. },
  109. ],
  110. userData: {
  111. headImage: '',
  112. userId: '',
  113. nickName: '',
  114. userName: '',
  115. phone: '',
  116. },
  117. handleList: [{
  118. label: '全部客户',
  119. path: 'customerList',
  120. icon: API.getServerImg + 'kehu.png'
  121. },
  122. {
  123. label: '营销业绩排行',
  124. path: 'marketRankList',
  125. icon: API.getServerImg + 'paihang.png'
  126. },
  127. {
  128. label: '续费提醒',
  129. path: 'renewList',
  130. icon: API.getServerImg + 'xufeitixing.png'
  131. },
  132. {
  133. label: '消息通知',
  134. path: 'messageList',
  135. icon: API.getServerImg + 'xiaoxi.png'
  136. },
  137. {
  138. label: '数据统计',
  139. path: 'dataCensus',
  140. icon: API.getServerImg + 'shujutongji.png'
  141. },
  142. {
  143. label: '我的二维码',
  144. path: 'shareInfo',
  145. icon: API.getServerImg + 'erweima.png'
  146. },
  147. ]
  148. }
  149. },
  150. onLoad() {
  151. // _self = this; // 浏览器调试时需要打开,微信调试时需关闭
  152. if (!uni.getStorageSync('token')) {
  153. uni.navigateTo({
  154. url: '/pages/login/index'
  155. });
  156. }
  157. },
  158. onReady() {
  159. this.cWidth = uni.upx2px(750) - 30;
  160. },
  161. onShow() {
  162. if (uni.getStorageSync('userData')) {
  163. this.userData = uni.getStorageSync('userData')
  164. }
  165. uni.getLocation({
  166. type: 'wgs84',
  167. geocode: true,
  168. success: (res) => {
  169. uni.setStorage({
  170. key: 'locationData',
  171. data: {
  172. longitude: res.longitude,
  173. latitude: res.latitude,
  174. }
  175. })
  176. this.initialize()
  177. }
  178. });
  179. },
  180. onPullDownRefresh() {
  181. this.initialize()
  182. setTimeout(() => {
  183. uni.stopPullDownRefresh();
  184. }, 500)
  185. },
  186. methods: {
  187. // 获取初始化数据
  188. initialize() {
  189. NET.request(API.getCensusChart, {}, 'POST').then(res => {
  190. let option = {
  191. $this: _self,
  192. canvasId: "chartBox",
  193. type: 'column',
  194. width: this.cWidth,
  195. height: 200,
  196. padding: [20, 10, 10, 10],
  197. pixelRatio: 1,
  198. animation: true,
  199. background: '#FFFFFF',
  200. fontSize: 11,
  201. xAxis: {
  202. type: 'grid',
  203. gridType: 'dash',
  204. disableGrid: true,
  205. itemCount: 10,
  206. },
  207. yAxis: {},
  208. categories: res.data.customerCreateListRes.map(site => {
  209. return site.week
  210. }),
  211. legend: {
  212. show: false
  213. },
  214. series: [{
  215. name: "",
  216. color: "#fcbd71",
  217. data: res.data.customerCreateListRes.map(site => {
  218. return site.newCount
  219. })
  220. }],
  221. }
  222. chartBox = new uCharts(option)
  223. }).catch(error => {
  224. this.$refs.uTips.show({
  225. title: error.message,
  226. type: 'warning',
  227. })
  228. })
  229. NET.request(API.getNearVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  230. this.videoList = res.data
  231. }).catch(error => {
  232. this.$refs.uTips.show({
  233. title: error.message,
  234. type: 'warning',
  235. })
  236. })
  237. },
  238. // 跳转今日新增
  239. goToTodayEnroll() {
  240. uni.navigateTo({
  241. url: '/pagesEnroll/todayEnroll'
  242. });
  243. },
  244. // 跳转所有场馆
  245. goToVenueList() {
  246. uni.navigateTo({
  247. url: '/pagesEnroll/venueList'
  248. });
  249. },
  250. // 跳转场馆详情
  251. goToVenueDetail(item) {
  252. uni.navigateTo({
  253. url: '/pagesEnroll/venueDetail?id=' + item.id
  254. });
  255. },
  256. // 跳转添加信息
  257. goToAddForm(path) {
  258. uni.navigateTo({
  259. url: '/pagesEnroll/' + path
  260. });
  261. },
  262. // 跳转我的各列表界面
  263. goToHandle(site) {
  264. uni.navigateTo({
  265. url: '/pagesMain/' + site.path
  266. });
  267. }
  268. },
  269. }
  270. </script>
  271. <style>
  272. page {
  273. width: 100%;
  274. height: 100%;
  275. overflow: hidden;
  276. }
  277. </style>
  278. <style lang="scss" scoped>
  279. @import "@/static/css/themes.scss";
  280. .content {
  281. width: 100%;
  282. float: left;
  283. .swiper-box {
  284. height: calc(100vh - 50px);
  285. .swiper-item {
  286. height: 100%;
  287. overflow-y: auto;
  288. position: relative;
  289. }
  290. }
  291. .chart-box {
  292. width: 100%;
  293. height: 240px;
  294. float: left;
  295. padding: 20px 0;
  296. .chart-canvas {
  297. width: 100% !important;
  298. height: 200px !important;
  299. float: left;
  300. }
  301. }
  302. .section-title {
  303. width: 100%;
  304. height: 28px;
  305. display: flex;
  306. align-items: center;
  307. u-section {
  308. margin-left: 10px;
  309. flex: 1;
  310. }
  311. }
  312. .class-show-box {
  313. width: calc(100% + 32px);
  314. margin: 0 -16px;
  315. .class-show-card {
  316. width: calc(50% - 16px);
  317. margin: 0 8px 16px 8px;
  318. float: left;
  319. .class-show-name {
  320. width: 100%;
  321. text-align: center;
  322. line-height: 18px;
  323. font-size: 12px;
  324. margin-top: 5px;
  325. }
  326. }
  327. }
  328. .enroll-fix-box {
  329. width: 100%;
  330. height: 90px;
  331. position: absolute;
  332. bottom: 40px;
  333. left: 0;
  334. display: flex;
  335. justify-content: space-around;
  336. .enroll-button {
  337. width: 60px;
  338. height: 90px;
  339. .enroll-img {
  340. width: 60px;
  341. height: 60px;
  342. padding-left: 5px;
  343. border-radius: 50%;
  344. background-color: #ffffff;
  345. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  346. display: flex;
  347. justify-content: center;
  348. align-items: center;
  349. }
  350. .enroll-text {
  351. width: 60px;
  352. height: 20px;
  353. margin-top: 10px;
  354. line-height: 20px;
  355. font-size: 14px;
  356. text-align: center;
  357. white-space: nowrap;
  358. }
  359. }
  360. }
  361. .user-info {
  362. width: 100%;
  363. height: 110px;
  364. margin-bottom: 20px;
  365. float: left;
  366. background-color: $mainColor;
  367. .user-data {
  368. width: calc(100% - 110px);
  369. height: 110px;
  370. padding: 15px 0 15px 15px;
  371. float: left;
  372. .user-name {
  373. width: 100%;
  374. float: left;
  375. font-size: 24px;
  376. color: #FFFFFF;
  377. line-height: 30px;
  378. margin: 10px 0;
  379. white-space: nowrap;
  380. overflow: hidden;
  381. text-overflow: ellipsis;
  382. }
  383. .user-phone {
  384. width: 100%;
  385. color: #FFFFFF;
  386. line-height: 20px;
  387. float: left;
  388. white-space: nowrap;
  389. overflow: hidden;
  390. text-overflow: ellipsis;
  391. }
  392. }
  393. .user-img {
  394. width: 110px;
  395. height: 110px;
  396. padding: 15px;
  397. float: left;
  398. display: flex;
  399. align-items: center;
  400. justify-content: center;
  401. }
  402. }
  403. .user-handle {
  404. width: 100vw;
  405. height: 40px;
  406. float: left;
  407. padding: 0 15px;
  408. margin-bottom: 10px;
  409. display: flex;
  410. align-items: center;
  411. .handle-icon {
  412. width: 40px;
  413. height: 40px;
  414. text-align: center;
  415. line-height: 40px;
  416. display: flex;
  417. align-items: center;
  418. }
  419. .handle-label {
  420. height: 40px;
  421. flex: 1;
  422. margin-left: 10px;
  423. line-height: 40px;
  424. font-size: 15px;
  425. }
  426. .handle-arrow {
  427. line-height: 40px;
  428. }
  429. }
  430. }
  431. </style>