index.vue 11 KB

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