index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <!-- 我的余额模块 -->
  3. <view :style="colorStyle">
  4. <view class='my-account'>
  5. <!-- #ifdef MP -->
  6. <view class="accountTitle">
  7. <view :style="{height:getHeight.barTop+'px'}"></view>
  8. <view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
  9. <view>我的账户</view>
  10. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  11. </view>
  12. </view>
  13. <view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
  14. <!-- #endif -->
  15. <view class='wrapper'>
  16. <view class='header'>
  17. <view class='headerCon'>
  18. <view class='account acea-row row-top row-between'>
  19. <view class='assets'>
  20. <view>总资产(元)</view>
  21. <view class='money'>{{userInfo.now_money || 0}}</view>
  22. </view>
  23. <!-- #ifdef APP-PLUS || H5 -->
  24. <navigator v-if="showApp" url="/pages/users/user_payment/index" hover-class="none" class='recharge'>充值
  25. </navigator>
  26. <!-- #endif -->
  27. <!-- #ifdef MP -->
  28. <view v-if="recharge_switch" @click="openSubscribe('/pages/users/user_payment/index')"
  29. class='recharge'>充值</view>
  30. <!-- #endif -->
  31. </view>
  32. <view class='cumulative acea-row row-middle'>
  33. <!-- #ifdef APP-PLUS || H5 -->
  34. <view class='item'>
  35. <view>累计充值(元)</view>
  36. <view class='money'>{{userInfo.recharge || 0}}</view>
  37. </view>
  38. <!-- #endif -->
  39. <!-- #ifdef MP -->
  40. <view class='item' v-if="recharge_switch">
  41. <view>累计充值(元)</view>
  42. <view class='money'>{{userInfo.recharge || 0}}</view>
  43. </view>
  44. <!-- #endif -->
  45. <view class='item'>
  46. <view>累计消费(元)</view>
  47. <view class='money'>{{userInfo.orderStatusSum || 0}}</view>
  48. </view>
  49. </view>
  50. <view class="pictrue">
  51. <image :src="imgHost+'/statics/images/users/pig.png'"></image>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="nav acea-row row-between-wrapper">
  56. <navigator class='item acea-row row-between-wrapper' hover-class='none'
  57. url='/pages/users/user_bill/index?type=1'>
  58. <view class="left">
  59. <view class="name">消费记录</view>
  60. <view>赚积分抵现金</view>
  61. </view>
  62. <view class="pictrue">
  63. <image src="../static/xiaofeijilu.png"></image>
  64. </view>
  65. </navigator>
  66. <navigator class='item acea-row row-between-wrapper' hover-class='none'
  67. url='/pages/users/user_bill/index?type=2' v-if="recharge_switch">
  68. <view class="left">
  69. <view class="name">充值记录</view>
  70. <view>满减享优惠</view>
  71. </view>
  72. <view class="pictrue">
  73. <image src="../static/chongzhijilu.png"></image>
  74. </view>
  75. </navigator>
  76. </view>
  77. </view>
  78. <view class="advert">
  79. <view class="title">热门活动</view>
  80. <view class="list acea-row row-middle row-around">
  81. <navigator hover-class='none' url='/pages/activity/goods_combination/index' class="item">
  82. <view class="pictrue">
  83. <image src="../static/pintuan.png"></image>
  84. </view>
  85. <view class="name">拼团活动</view>
  86. <view>优惠商品拼团</view>
  87. </navigator>
  88. <view class="line"></view>
  89. <navigator hover-class='none' url='/pages/activity/goods_seckill/index' class="item">
  90. <view class="pictrue">
  91. <image src="../static/miaosha.png"></image>
  92. </view>
  93. <view class="name">限时秒杀</view>
  94. <view>商品秒杀进行中</view>
  95. </navigator>
  96. <view class="line"></view>
  97. <navigator hover-class='none' url='/pages/activity/goods_bargain/index' class="item">
  98. <view class="pictrue">
  99. <image src="../static/kanjia.png"></image>
  100. </view>
  101. <view class="name">砍价活动</view>
  102. <view>呼朋唤友来砍价</view>
  103. </navigator>
  104. </view>
  105. </view>
  106. <!-- <recommend :hostProduct="hostProduct"></recommend> -->
  107. </view>
  108. <navigator url="/pages/users/user_payment/money">
  109. <view class="brokerageMoney">
  110. 转佣金
  111. </view>
  112. </navigator>
  113. </view>
  114. </template>
  115. <script>
  116. import {
  117. getProductHot
  118. } from '@/api/store.js';
  119. import {
  120. openRechargeSubscribe
  121. } from '@/utils/SubscribeMessage.js';
  122. import {
  123. getUserInfo,
  124. userActivity
  125. } from '@/api/user.js';
  126. import {
  127. toLogin
  128. } from '@/libs/login.js';
  129. import {
  130. mapGetters
  131. } from "vuex";
  132. import recommend from '@/components/recommend/index';
  133. import home from '@/components/home';
  134. import colors from "@/mixins/color";
  135. import {
  136. HTTP_REQUEST_URL
  137. } from '@/config/app';
  138. export default {
  139. components: {
  140. recommend,
  141. },
  142. mixins: [colors],
  143. data() {
  144. return {
  145. imgHost: HTTP_REQUEST_URL,
  146. // #ifdef MP
  147. getHeight: this.$util.getWXStatusHeight(),
  148. // #endif
  149. userInfo: {},
  150. hostProduct: [],
  151. isClose: false,
  152. recharge_switch: 0,
  153. activity: {},
  154. isAuto: false, //没有授权的不会自动授权
  155. isShowAuth: false, //是否隐藏授权
  156. hotScroll: false,
  157. hotPage: 1,
  158. hotLimit: 10,
  159. // #ifdef APP
  160. showApp:false
  161. // #endif
  162. // #ifndef APP
  163. showApp:true
  164. // #endif
  165. };
  166. },
  167. computed: mapGetters(['isLogin']),
  168. watch: {
  169. isLogin: {
  170. handler: function(newV, oldV) {
  171. if (newV) {
  172. this.getUserInfo();
  173. this.get_activity();
  174. }
  175. },
  176. deep: true
  177. }
  178. },
  179. onLoad() {
  180. this.get_host_product();
  181. if (this.isLogin) {
  182. this.getUserInfo();
  183. this.get_activity();
  184. } else {
  185. toLogin()
  186. }
  187. },
  188. onShow() {
  189. // #ifdef APP
  190. this.showApp = uni.getStorageSync("showAppHistary")||false
  191. // #endif
  192. uni.removeStorageSync('form_type_cart');
  193. },
  194. methods: {
  195. goarrow() {
  196. uni.navigateBack()
  197. },
  198. // #ifdef MP
  199. openSubscribe: function(page) {
  200. uni.showLoading({
  201. title: '正在加载',
  202. })
  203. openRechargeSubscribe().then(res => {
  204. uni.hideLoading();
  205. uni.navigateTo({
  206. url: page,
  207. });
  208. }).catch(() => {
  209. uni.hideLoading();
  210. });
  211. },
  212. // #endif
  213. /**
  214. * 获取用户详情
  215. */
  216. getUserInfo: function() {
  217. let that = this;
  218. getUserInfo().then(res => {
  219. that.$set(that, 'userInfo', res.data);
  220. that.recharge_switch = res.data.recharge_switch;
  221. });
  222. },
  223. /**
  224. * 获取活动可参与否
  225. */
  226. get_activity: function() {
  227. let that = this;
  228. userActivity().then(res => {
  229. that.$set(that, "activity", res.data);
  230. })
  231. },
  232. /**
  233. * 获取我的推荐
  234. */
  235. get_host_product: function() {
  236. let that = this;
  237. if (that.hotScroll) return
  238. getProductHot(
  239. that.hotPage,
  240. that.hotLimit,
  241. ).then(res => {
  242. that.hotPage++
  243. that.hotScroll = res.data.length < that.hotLimit
  244. that.hostProduct = that.hostProduct.concat(res.data)
  245. });
  246. }
  247. },
  248. onPageScroll(e) {
  249. uni.$emit('scroll');
  250. },
  251. onReachBottom() {
  252. this.get_host_product();
  253. }
  254. }
  255. </script>
  256. <style scoped lang="scss">
  257. /deep/.recommend {
  258. padding: 40rpx 20rpx 0 20rpx;
  259. }
  260. .my-account {
  261. .accountTitle {
  262. background-color: var(--view-minorColorT);
  263. position: fixed;
  264. left: 0;
  265. top: 0;
  266. width: 100%;
  267. z-index: 99;
  268. .sysTitle {
  269. width: 100%;
  270. position: relative;
  271. font-weight: 500;
  272. color: #333333;
  273. font-size: 30rpx;
  274. .iconfont {
  275. position: absolute;
  276. font-size: 36rpx;
  277. left: 11rpx;
  278. width: 60rpx;
  279. }
  280. }
  281. }
  282. .advert {
  283. width: 710rpx;
  284. height: 332rpx;
  285. background: #FFFFFF;
  286. border-radius: 24rpx;
  287. margin: 20rpx auto 0 auto;
  288. padding: 0 32rpx;
  289. .title {
  290. font-size: 32rpx;
  291. font-weight: 500;
  292. color: #333333;
  293. height: 108rpx;
  294. line-height: 108rpx;
  295. border-bottom: 1px solid #eee;
  296. }
  297. .list {
  298. margin-top: 34rpx;
  299. .line {
  300. height: 126rpx;
  301. width: 1rpx;
  302. background-color: #EEEEEE;
  303. }
  304. .item {
  305. text-align: center;
  306. font-weight: 400;
  307. color: #999999;
  308. font-size: 22rpx;
  309. .pictrue {
  310. width: 66rpx;
  311. height: 66rpx;
  312. margin: 0 auto;
  313. image {
  314. width: 100%;
  315. height: 100%;
  316. }
  317. }
  318. .name {
  319. font-weight: 500;
  320. color: #333333;
  321. font-size: 28rpx;
  322. margin: 20rpx 0 8rpx 0;
  323. }
  324. }
  325. }
  326. }
  327. }
  328. .my-account .wrapper {
  329. padding-top: 32rpx;
  330. background: linear-gradient(180deg, var(--view-minorColorT) 0%, #f5f5f5 100%);
  331. }
  332. .my-account .wrapper .header {
  333. width: 710rpx;
  334. height: 362rpx;
  335. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  336. border-radius: 32rpx;
  337. margin: 0 auto;
  338. box-sizing: border-box;
  339. color: rgba(255, 255, 255, 0.8);
  340. font-size: 24rpx;
  341. position: relative;
  342. }
  343. .my-account .wrapper .header .headerCon {
  344. padding-top: 36rpx;
  345. }
  346. .my-account .wrapper .header .headerCon .pictrue {
  347. height: 284rpx;
  348. width: 290rpx;
  349. position: absolute;
  350. right: 0;
  351. bottom: 0;
  352. image {
  353. width: 100%;
  354. height: 100%;
  355. }
  356. }
  357. .my-account .wrapper .header .headerCon .account {
  358. padding: 0 32rpx;
  359. }
  360. .my-account .wrapper .header .headerCon .account .assets .money {
  361. font-size: 64rpx;
  362. color: #fff;
  363. font-family: 'SemiBold';
  364. margin-top: 12rpx;
  365. }
  366. .my-account .wrapper .header .headerCon .account .recharge {
  367. font-size: 24rpx;
  368. width: 112rpx;
  369. height: 56rpx;
  370. border-radius: 50rpx;
  371. background-color: rgba(255, 255, 255, 0.8);
  372. text-align: center;
  373. line-height: 56rpx;
  374. color: var(--view-theme);
  375. font-weight: 500;
  376. }
  377. .my-account .wrapper .header .headerCon .cumulative {
  378. width: 100%;
  379. height: 142rpx;
  380. background: rgba(255, 255, 255, 0.1);
  381. margin-top: 62rpx;
  382. padding-left: 32rpx;
  383. position: absolute;
  384. left: 0;
  385. bottom: 0;
  386. }
  387. .my-account .wrapper .header .headerCon .cumulative .item {
  388. // flex: 1;
  389. width: 250rpx;
  390. position: static;
  391. z-index: 9;
  392. }
  393. .my-account .wrapper .header .headerCon .cumulative .item .money {
  394. font-size: 40rpx;
  395. font-family: 'SemiBold';
  396. color: #fff;
  397. margin-top: 12rpx;
  398. }
  399. .my-account .wrapper .nav {
  400. margin: 20rpx;
  401. }
  402. .my-account .wrapper .nav .item {
  403. font-size: 24rpx;
  404. color: #999;
  405. width: 348rpx;
  406. height: 152rpx;
  407. background: linear-gradient(180deg, #FFF7F0 0%, #FFFFFF 100%);
  408. border-radius: 24rpx;
  409. border: 4rpx solid #fff;
  410. padding: 0 31rpx;
  411. box-sizing: border-box;
  412. .name {
  413. font-size: 28rpx;
  414. color: #333;
  415. font-weight: 500;
  416. margin-bottom: 8rpx;
  417. }
  418. }
  419. .my-account .wrapper .nav .item .pictrue {
  420. width: 96rpx;
  421. height: 96rpx;
  422. image {
  423. width: 100%;
  424. height: 100%;
  425. }
  426. }
  427. .my-account .wrapper .list {
  428. padding: 0 30rpx;
  429. }
  430. .my-account .wrapper .list .item {
  431. margin-top: 44rpx;
  432. }
  433. .my-account .wrapper .list .item .picTxt .iconfont {
  434. width: 82rpx;
  435. height: 82rpx;
  436. border-radius: 50%;
  437. background-image: linear-gradient(to right, #ff9389 0%, #f9776b 100%);
  438. text-align: center;
  439. line-height: 82rpx;
  440. color: #fff;
  441. font-size: 40rpx;
  442. }
  443. .my-account .wrapper .list .item .picTxt .iconfont.yellow {
  444. background-image: linear-gradient(to right, #ffccaa 0%, #fea060 100%);
  445. }
  446. .my-account .wrapper .list .item .picTxt .iconfont.green {
  447. background-image: linear-gradient(to right, #a1d67c 0%, #9dd074 100%);
  448. }
  449. .my-account .wrapper .list .item .picTxt {
  450. width: 428rpx;
  451. font-size: 30rpx;
  452. color: #282828;
  453. }
  454. .my-account .wrapper .list .item .picTxt .text {
  455. width: 317rpx;
  456. }
  457. .my-account .wrapper .list .item .picTxt .text .infor {
  458. font-size: 24rpx;
  459. color: #999;
  460. margin-top: 5rpx;
  461. }
  462. .my-account .wrapper .list .item .bnt {
  463. font-size: 26rpx;
  464. color: #282828;
  465. width: 156rpx;
  466. height: 52rpx;
  467. border: 1px solid #ddd;
  468. border-radius: 26rpx;
  469. text-align: center;
  470. }
  471. .my-account .wrapper .list .item .bnt.end {
  472. font-size: 26rpx;
  473. color: #aaa;
  474. background-color: #f2f2f2;
  475. border-color: #f2f2f2;
  476. }
  477. .brokerageMoney {
  478. margin-right: 30rpx;
  479. border-radius: 50rpx;
  480. text-align: center;
  481. font-weight: bold;
  482. padding: 10rpx 30rpx;
  483. line-height: 1;
  484. position: absolute;
  485. bottom: 30rpx;
  486. width: 690rpx;
  487. margin: 0 30rpx;
  488. color: #FFF;
  489. padding: 30rpx 30rpx;
  490. font-size: 32rpx;
  491. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  492. }
  493. </style>