main.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <view class="vheigh"></view>
  5. <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
  6. <view class="top-main flex">
  7. <view class="search-box flex" @click="clickSearch()">
  8. <image class="search" src="../../static/img/search.png" mode=""></image>
  9. <view class="search-font">输入关键词搜索</view>
  10. </view>
  11. </view>
  12. </view>
  13. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  14. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  15. @click="bannerNavToUrl(item)">
  16. <image :src="item.pic" />
  17. </swiper-item>
  18. </swiper>
  19. <view class="tongz flex">
  20. <view>
  21. <view class="tongz-bg">
  22. <image src="../../static/img/tongz-bg.png" mode=""></image>
  23. </view>
  24. <view class="tongz-left flex">
  25. <image class="image-left" src="../../static/img/ling.png" mode=""></image>
  26. <u-notice-bar style="width: 100%;" mode="vertical" type="none" :volume-icon="false"
  27. :more-icon="false" :list="text"></u-notice-bar>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="navbar-box">
  32. <view class="navbar-title">
  33. <image class="navbar-icon" src="../../static/icon/title-icon.png" mode=""></image>
  34. <view class="navbar-font">
  35. 分红数据
  36. </view>
  37. </view>
  38. <view class="navbar-main">
  39. <view class="navbar-item">
  40. <view class="item-num">{{now_jjfh}}</view>
  41. <view class="item-font">当前分红基金</view>
  42. </view>
  43. <view class="xian"></view>
  44. <view class="navbar-item">
  45. <view class="item-num">{{now_num}}</view>
  46. <view class="item-font">当前每股股价</view>
  47. </view>
  48. <view class="xian"></view>
  49. <view class="navbar-item">
  50. <view class="item-num">{{my_num}}</view>
  51. <view class="item-font">我的当前股数</view>
  52. </view>
  53. <view class="xian"></view>
  54. <view class="navbar-item">
  55. <view class="item-num">{{my_money}}</view>
  56. <view class="item-font">我的当前分红</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="main-box">
  61. <view class="main-item" @click="nav('/pages/navigation/bdjj?money='+bd_money)">
  62. <image class="main-image" src="../../static/icon/n1.png" mode="widthFix"></image>
  63. <view class="main-num">¥{{bd_money}}</view>
  64. <view class="main-font">报单奖金</view>
  65. </view>
  66. <view class="main-item" @click="nav('/pages/navigation/tdjj?money='+team_money)">
  67. <image class="main-image" src="../../static/icon/n2.png" mode="widthFix"></image>
  68. <view class="main-num">¥{{team_money}}</view>
  69. <view class="main-font">团队奖金</view>
  70. </view>
  71. <view class="main-item" @click="nav('/pages/navigation/fhsy?money='+fh_money)">
  72. <image class="main-image" src="../../static/icon/n3.png" mode="widthFix"></image>
  73. <view class="main-num">¥{{fh_money}}</view>
  74. <view class="main-font">分红收益</view>
  75. </view>
  76. <view class="main-item" @click="nav('/pages/navigation/team')">
  77. <image class="main-image" src="../../static/icon/n4.png" mode="widthFix"></image>
  78. <view class="main-num">{{team}}</view>
  79. <view class="main-font">我的团队</view>
  80. </view>
  81. <view class="main-item" @click="nav('/pages/user/shareQrCode')">
  82. <image class="main-image" src="../../static/icon/n5.png" mode="widthFix"></image>
  83. <view class="main-font">邀请好友</view>
  84. </view>
  85. <view class="main-item" @click="nav('/pages/set/userinfo')">
  86. <image class="main-image" src="../../static/icon/n6.png" mode="widthFix"></image>
  87. <view class="main-font">个人资料</view>
  88. </view>
  89. <view class="main-item" @click="nav('/pages/money/withdrawal?way=brokerage_price')">
  90. <image class="main-image" src="../../static/icon/n7.png" mode="widthFix"></image>
  91. <view class="main-font">发起提现</view>
  92. </view>
  93. <view class="main-item" @click="nav('/pages/navigation/productlist')">
  94. <image class="main-image" src="../../static/icon/n8.png" mode="widthFix"></image>
  95. <view class="main-font">产品咨讯</view>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. import {
  102. loadIndexs,
  103. order_info
  104. } from '@/api/index.js';
  105. import {
  106. link
  107. } from '@/api/user.js';
  108. import {
  109. mapState,
  110. mapMutations
  111. } from 'vuex';
  112. export default {
  113. data() {
  114. return {
  115. current: 0,
  116. titleNViewBackground: '',
  117. swiperCurrent: 0,
  118. swiperLength: 0,
  119. carouselList: [], //轮播图列表
  120. text: ['双模式 双系统 开创第三代新零售'],
  121. now_jjfh: 0,
  122. now_num: 0,
  123. my_num: 0,
  124. my_money: 0,
  125. bd_money: 0,
  126. team_money: 0,
  127. fh_money: 0,
  128. team: 0,
  129. timers: '',
  130. };
  131. },
  132. onShow() {
  133. this.loadData();
  134. },
  135. onHide() {
  136. clearTimeout(this.timers);
  137. console.log(this.timers, 'onhide');
  138. },
  139. // 监听页面卸载
  140. onUnload() {
  141. // 关闭倒计时
  142. clearTimeout(this.timers);
  143. console.log(this.timers, 'unload');
  144. },
  145. // 监听页面后退
  146. onBackPress() {
  147. // 关闭倒计时
  148. clearTimeout(this.timers);
  149. console.log(this.timers, 'back');
  150. },
  151. methods: {
  152. ...mapMutations(['setLat', 'setLon', 'setChoose']),
  153. loadData() {
  154. this.getorder()
  155. loadIndexs({})
  156. .then(({
  157. data
  158. }) => {
  159. let goods = data.info;
  160. this.dataList = goods.bastList; //精品推荐
  161. this.carouselList = data.banner;
  162. })
  163. .catch(e => {});
  164. link({
  165. page: 1,
  166. limit: 1,
  167. })
  168. .then(({
  169. data
  170. }) => {
  171. this.team = data.total + data.totalLevel
  172. })
  173. .catch(e => {
  174. console.log(e);
  175. });
  176. },
  177. getorder() {
  178. if(this.timers){
  179. clearTimeout(this.timers);
  180. }
  181. order_info({}).then(({
  182. data
  183. }) => {
  184. // this.timers = setTimeout(this.getorder, 1000);
  185. this.now_jjfh = data.sum;
  186. this.now_num = data.every_piece;
  187. this.my_num = data.user_piece;
  188. this.my_money = data.award;
  189. this.bd_money = data.recommend_award;
  190. this.team_money = data.group_award;
  191. this.fh_money = data.day_award;
  192. console.log(this.timers);
  193. })
  194. },
  195. nav(url) {
  196. uni.navigateTo({
  197. url,
  198. fail() {
  199. uni.switchTab({
  200. url
  201. });
  202. }
  203. });
  204. },
  205. //轮播图切换修改背景色
  206. swiperChange(e) {
  207. const index = e.detail.current;
  208. this.swiperCurrent = index;
  209. this.titleNViewBackground = this.carouselList[index].background;
  210. },
  211. // 點擊搜索框
  212. clickSearch() {
  213. uni.navigateTo({
  214. url: '/pages/product/search'
  215. });
  216. },
  217. }
  218. };
  219. </script>
  220. <style lang="scss">
  221. page,
  222. .center {
  223. min-height: 100%;
  224. height: auto;
  225. background: #ffffff;
  226. }
  227. .vheigh {
  228. height: var(--status-bar-height);
  229. background-color: $base-color;
  230. }
  231. .top {
  232. position: relative;
  233. width: 100%;
  234. height: 360rpx;
  235. .top-bg {
  236. position: absolute;
  237. top: 0;
  238. left: 0;
  239. right: 0;
  240. width: 100%;
  241. height: 100%;
  242. }
  243. .top-main {
  244. position: relative;
  245. z-index: 2;
  246. padding: 30rpx;
  247. .search-box {
  248. justify-content: center;
  249. width: 698rpx;
  250. height: 60rpx;
  251. background: rgba(255, 240, 245, 0.4);
  252. box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  253. border-radius: 30rpx;
  254. .search {
  255. width: 34rpx;
  256. height: 34rpx;
  257. }
  258. .search-font {
  259. margin-left: 14rpx;
  260. font-size: 28rpx;
  261. font-family: PingFang SC;
  262. font-weight: 500;
  263. color: #ffffff;
  264. }
  265. }
  266. }
  267. }
  268. .carousel {
  269. width: 700rpx;
  270. height: 276rpx;
  271. /* #ifndef APP-PLUS */
  272. margin: -240rpx auto 0;
  273. /* #endif */
  274. /* #ifdef APP-PLUS */
  275. margin: -180rpx auto 0;
  276. /* #endif */
  277. border-radius: 40rpx;
  278. image {
  279. border-radius: 40rpx;
  280. width: 700rpx;
  281. height: 276rpx;
  282. }
  283. }
  284. .tongz {
  285. width: 690rpx;
  286. height: 70rpx;
  287. margin: 32rpx auto 0;
  288. padding: 18rpx 30rpx 18rpx 24rpx;
  289. align-items: center;
  290. position: relative;
  291. .tongz-bg {
  292. position: absolute;
  293. top: 0;
  294. right: 0;
  295. left: 0;
  296. width: 690rpx;
  297. height: 70rpx;
  298. image {
  299. width: 100%;
  300. height: 100%;
  301. }
  302. }
  303. .tongz-left {
  304. width: 640rpx;
  305. .image-left {
  306. width: 28rpx;
  307. height: 34rpx;
  308. }
  309. .tongz-font {
  310. margin-left: 22rpx;
  311. font-size: 28rpx;
  312. font-family: Source Han Sans CN;
  313. font-weight: 400;
  314. color: #0f253a;
  315. }
  316. }
  317. .tongz-right {
  318. position: relative;
  319. z-index: 11;
  320. width: 12rpx;
  321. height: 26rpx;
  322. image {
  323. width: 100%;
  324. height: 100%;
  325. }
  326. }
  327. }
  328. .navbar-box {
  329. width: 700rpx;
  330. background: #FFFFFF;
  331. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  332. border-radius: 20rpx;
  333. padding: 30rpx 0;
  334. margin: 40rpx auto 0;
  335. }
  336. .navbar-title {
  337. display: flex;
  338. align-items: center;
  339. padding: 0 26rpx 20rpx;
  340. border-bottom: 1px solid #f5f5f5;
  341. .navbar-icon {
  342. width: 30rpx;
  343. height: 26rpx;
  344. }
  345. .navbar-font {
  346. margin-left: 10rpx;
  347. font-size: 30rpx;
  348. font-family: PingFang SC;
  349. font-weight: bold;
  350. color: #333333;
  351. }
  352. }
  353. .navbar-main {
  354. padding-top: 45rpx;
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-around;
  358. line-height: 1;
  359. .xian {
  360. width: 1rpx;
  361. height: 31rpx;
  362. background: #333333;
  363. }
  364. .navbar-item {
  365. flex: 1;
  366. display: flex;
  367. flex-direction: column;
  368. align-items: center;
  369. .item-num {
  370. font-size: 39rpx;
  371. font-family: PingFang SC;
  372. font-weight: bold;
  373. color: #333333;
  374. }
  375. .item-font {
  376. margin-top: 20rpx;
  377. font-size: 21rpx;
  378. font-family: PingFang SC;
  379. font-weight: 500;
  380. color: #666666;
  381. }
  382. }
  383. }
  384. .main-box {
  385. display: flex;
  386. justify-content: space-between;
  387. flex-wrap: wrap;
  388. padding: 10rpx 24rpx;
  389. }
  390. .main-item {
  391. display: flex;
  392. flex-direction: column;
  393. justify-content: center;
  394. align-items: center;
  395. width: 342rpx;
  396. height: 200rpx;
  397. background: #FFFFFF;
  398. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  399. border-radius: 20rpx;
  400. margin-top: 20rpx;
  401. line-height: 1;
  402. .main-image {
  403. width: 68rpx;
  404. }
  405. .main-num {
  406. margin-top: 20rpx;
  407. font-size: 30rpx;
  408. font-family: PingFang SC;
  409. font-weight: 500;
  410. color: #333333;
  411. }
  412. .main-font {
  413. margin-top: 20rpx;
  414. font-size: 26rpx;
  415. font-family: PingFang SC;
  416. font-weight: 500;
  417. color: #4D4D4D;
  418. line-height: 21rpx;
  419. }
  420. }
  421. </style>