main.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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. order_info({}).then(({
  179. data
  180. }) => {
  181. this.timers = setTimeout(this.getorder, 1000);
  182. this.now_jjfh = data.sum;
  183. this.now_num = data.every_piece;
  184. this.my_num = data.user_piece;
  185. this.my_money = data.award;
  186. this.bd_money = data.recommend_award;
  187. this.team_money = data.group_award;
  188. this.fh_money = data.day_award;
  189. console.log(this.timers);
  190. })
  191. },
  192. nav(url) {
  193. uni.navigateTo({
  194. url,
  195. fail() {
  196. uni.switchTab({
  197. url
  198. });
  199. }
  200. });
  201. },
  202. //轮播图切换修改背景色
  203. swiperChange(e) {
  204. const index = e.detail.current;
  205. this.swiperCurrent = index;
  206. this.titleNViewBackground = this.carouselList[index].background;
  207. },
  208. // 點擊搜索框
  209. clickSearch() {
  210. uni.navigateTo({
  211. url: '/pages/product/search'
  212. });
  213. },
  214. }
  215. };
  216. </script>
  217. <style lang="scss">
  218. page,
  219. .center {
  220. min-height: 100%;
  221. height: auto;
  222. background: #ffffff;
  223. }
  224. .vheigh {
  225. height: var(--status-bar-height);
  226. background-color: $base-color;
  227. }
  228. .top {
  229. position: relative;
  230. width: 100%;
  231. height: 360rpx;
  232. .top-bg {
  233. position: absolute;
  234. top: 0;
  235. left: 0;
  236. right: 0;
  237. width: 100%;
  238. height: 100%;
  239. }
  240. .top-main {
  241. position: relative;
  242. z-index: 2;
  243. padding: 30rpx;
  244. .search-box {
  245. justify-content: center;
  246. width: 698rpx;
  247. height: 60rpx;
  248. background: rgba(255, 240, 245, 0.4);
  249. box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  250. border-radius: 30rpx;
  251. .search {
  252. width: 34rpx;
  253. height: 34rpx;
  254. }
  255. .search-font {
  256. margin-left: 14rpx;
  257. font-size: 28rpx;
  258. font-family: PingFang SC;
  259. font-weight: 500;
  260. color: #ffffff;
  261. }
  262. }
  263. }
  264. }
  265. .carousel {
  266. width: 700rpx;
  267. height: 276rpx;
  268. /* #ifndef APP-PLUS */
  269. margin: -240rpx auto 0;
  270. /* #endif */
  271. /* #ifdef APP-PLUS */
  272. margin: -180rpx auto 0;
  273. /* #endif */
  274. border-radius: 40rpx;
  275. image {
  276. border-radius: 40rpx;
  277. width: 700rpx;
  278. height: 276rpx;
  279. }
  280. }
  281. .tongz {
  282. width: 690rpx;
  283. height: 70rpx;
  284. margin: 32rpx auto 0;
  285. padding: 18rpx 30rpx 18rpx 24rpx;
  286. align-items: center;
  287. position: relative;
  288. .tongz-bg {
  289. position: absolute;
  290. top: 0;
  291. right: 0;
  292. left: 0;
  293. width: 690rpx;
  294. height: 70rpx;
  295. image {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. }
  300. .tongz-left {
  301. width: 640rpx;
  302. .image-left {
  303. width: 28rpx;
  304. height: 34rpx;
  305. }
  306. .tongz-font {
  307. margin-left: 22rpx;
  308. font-size: 28rpx;
  309. font-family: Source Han Sans CN;
  310. font-weight: 400;
  311. color: #0f253a;
  312. }
  313. }
  314. .tongz-right {
  315. position: relative;
  316. z-index: 11;
  317. width: 12rpx;
  318. height: 26rpx;
  319. image {
  320. width: 100%;
  321. height: 100%;
  322. }
  323. }
  324. }
  325. .navbar-box {
  326. width: 700rpx;
  327. background: #FFFFFF;
  328. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  329. border-radius: 20rpx;
  330. padding: 30rpx 0;
  331. margin: 40rpx auto 0;
  332. }
  333. .navbar-title {
  334. display: flex;
  335. align-items: center;
  336. padding: 0 26rpx 20rpx;
  337. border-bottom: 1px solid #f5f5f5;
  338. .navbar-icon {
  339. width: 30rpx;
  340. height: 26rpx;
  341. }
  342. .navbar-font {
  343. margin-left: 10rpx;
  344. font-size: 30rpx;
  345. font-family: PingFang SC;
  346. font-weight: bold;
  347. color: #333333;
  348. }
  349. }
  350. .navbar-main {
  351. padding-top: 45rpx;
  352. display: flex;
  353. align-items: center;
  354. justify-content: space-around;
  355. line-height: 1;
  356. .xian {
  357. width: 1rpx;
  358. height: 31rpx;
  359. background: #333333;
  360. }
  361. .navbar-item {
  362. flex: 1;
  363. display: flex;
  364. flex-direction: column;
  365. align-items: center;
  366. .item-num {
  367. font-size: 39rpx;
  368. font-family: PingFang SC;
  369. font-weight: bold;
  370. color: #333333;
  371. }
  372. .item-font {
  373. margin-top: 20rpx;
  374. font-size: 21rpx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. color: #666666;
  378. }
  379. }
  380. }
  381. .main-box {
  382. display: flex;
  383. justify-content: space-between;
  384. flex-wrap: wrap;
  385. padding: 10rpx 24rpx;
  386. }
  387. .main-item {
  388. display: flex;
  389. flex-direction: column;
  390. justify-content: center;
  391. align-items: center;
  392. width: 342rpx;
  393. height: 200rpx;
  394. background: #FFFFFF;
  395. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  396. border-radius: 20rpx;
  397. margin-top: 20rpx;
  398. line-height: 1;
  399. .main-image {
  400. width: 68rpx;
  401. }
  402. .main-num {
  403. margin-top: 20rpx;
  404. font-size: 30rpx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #333333;
  408. }
  409. .main-font {
  410. margin-top: 20rpx;
  411. font-size: 26rpx;
  412. font-family: PingFang SC;
  413. font-weight: 500;
  414. color: #4D4D4D;
  415. line-height: 21rpx;
  416. }
  417. }
  418. </style>