user-center.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <app-layout>
  3. <app-user-center-top
  4. :top-style="userCenter.top_style"
  5. :top-pic-url="userCenter.top_pic_url"
  6. :member-pic-url="userCenter.member_pic_url"
  7. :is_icon_super_vip="is_icon_super_vip"
  8. ></app-user-center-top>
  9. <view class="u-foot-box main-center" v-if="userCenter.is_foot_bar_status == 1">
  10. <view @click="router(item.name)" class="u-foot-item main-center" v-for="(item, key) in foot_bar" :key="key">
  11. <image class="u-icon" :src="item.icon_url"></image>
  12. <view class="u-foot-info">
  13. <view class="u-foot-num">{{item.name | showNum(userInfo)}}</view>
  14. <view>{{item.name}}</view>
  15. </view>
  16. </view>
  17. <view class="u-line"></view>
  18. </view>
  19. <view style="padding: 0 24rpx">
  20. <app-vip-card></app-vip-card>
  21. </view>
  22. <app-account-balance
  23. v-if="userCenter.account_bar.status == 1"
  24. :margin="true"
  25. :round="true"
  26. :input-user-center="userCenter"
  27. ></app-account-balance>
  28. <app-my-order
  29. v-if="userCenter.is_order_bar_status == 1"
  30. :margin="true"
  31. :round="true"
  32. :theme="getTheme"
  33. :order_bar="userCenter.order_bar"
  34. ></app-my-order>
  35. <view class="app-my-service" v-if="userCenter.is_menu_status == 1">
  36. <view class="title" v-if="userCenter.menu_title">{{userCenter.menu_title}}</view>
  37. <view class="list" :class="[listStyle]">
  38. <view class="item" v-for="(item, index) in userCenter.menus" :key="index" >
  39. <app-jump-button form
  40. :url="item.link_url"
  41. :open_type="item.open_type"
  42. :item="item"
  43. :arrangement="`${userCenter.menu_style === '1' ? 'row' : userCenter.menu_style === '2' ? 'column' : ''}`">
  44. <view style="width: 100%"
  45. class="item-container"
  46. :class="[
  47. userCenter.menu_style=='1'?'dir-left-nowrap cross-center':'',
  48. userCenter.menu_style=='2'?'dir-top-nowrap cross-center':'',
  49. ]">
  50. <view class="box-grow-0">
  51. <image :src="item.icon_url" class="icon"></image>
  52. </view>
  53. <view class="box-grow-1" style="max-width: 100%">
  54. <view class="name">{{item.name}}</view>
  55. </view>
  56. <view class="box-grow-0" v-if="userCenter.menu_style=='1'">
  57. <image src="/static/image/icon/arrow-right.png" class="arrow"></image>
  58. </view>
  59. </view>
  60. </app-jump-button>
  61. </view>
  62. </view>
  63. </view>
  64. <app-copyright
  65. v-if="copyright && copyright.status == '1'"
  66. background-color="transparent"
  67. :link="copyrightLink"
  68. :pic-url="copyright.pic_url"
  69. :text="copyright.description"
  70. ></app-copyright>
  71. </app-layout>
  72. </template>
  73. <script>
  74. import {mapGetters, mapState} from 'vuex';
  75. import AppUserCenterTop from '../../components/page-component/app-user-center-top/app-user-center-top.vue';
  76. import AppAccountBalance from '../../components/page-component/app-account-balance/app-account-balance.vue';
  77. import AppMyOrder from '../../components/page-component/app-my-order/app-my-order.vue';
  78. import AppCopyright from '../../components/page-component/app-copyright/app-copyright.vue';
  79. import AppVipCard from '../../components/page-component/app-vip-card/app-vip-card.vue';
  80. export default {
  81. name: 'user-center',
  82. components: {
  83. AppCopyright,
  84. AppUserCenterTop,
  85. AppAccountBalance,
  86. AppMyOrder,
  87. AppVipCard,
  88. },
  89. computed: {
  90. ...mapState({
  91. copyright: state => state.mallConfig.copyright,
  92. userCenter: state => state.userCenter.data,
  93. userInfo: state => state.user.info,
  94. is_icon_super_vip: function (state) {
  95. return state.mallConfig.mall.setting.is_icon_super_vip;
  96. },
  97. foot_bar: function(state) {
  98. return state.userCenter.data.foot_bar;
  99. }
  100. }),
  101. copyrightLink() {
  102. if (!this.copyright) return {};
  103. let { open_type, new_link_url, params } = this.copyright.link;
  104. return {
  105. openType: open_type,
  106. url: new_link_url,
  107. params: params ? params : []
  108. };
  109. },
  110. ...mapGetters('mallConfig', {
  111. getTheme: 'getTheme'
  112. }),
  113. listStyle() {
  114. if (this.userCenter.menu_style == 1) return 'row';
  115. if (this.userCenter.menu_style == 2) return 'grid dir-left-wrap';
  116. return '';
  117. }
  118. },
  119. onShow() {
  120. this.$event.on(this.$const.EVENT_USER_LOGIN).then(() => {
  121. uni.redirectTo({
  122. url: `/pages/user-center/user-center`
  123. });
  124. });
  125. if (this.$user.isLogin()) {
  126. this.$store.dispatch('user/refresh');
  127. }
  128. this.$nextTick().then(() => {
  129. this.$store.dispatch('userCenter/data');
  130. });
  131. },
  132. methods: {
  133. router(name) {
  134. let url = '';
  135. if (name === '我的收藏') {
  136. url = `/pages/favorite/favorite`;
  137. } else {
  138. url = `/pages/foot/index/index`;
  139. }
  140. uni.navigateTo({
  141. url: url
  142. });
  143. }
  144. },
  145. filters: {
  146. showNum(name, userInfo) {
  147. if (name === '我的收藏') {
  148. return userInfo && userInfo.favorite ? userInfo.favorite : 0;
  149. } else {
  150. return userInfo && userInfo.footprint ? userInfo.footprint : 0;
  151. }
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .app-my-service {
  158. width: #{702rpx};
  159. border-radius: #{16rpx};
  160. margin: #{24rpx} auto;
  161. box-shadow: 0 0 #{8rpx} rgba(0, 0, 0, .05);
  162. background: #fff;
  163. .title {
  164. padding: #{32rpx} #{32rpx} #{16rpx};
  165. }
  166. .list {
  167. .item {
  168. .icon {
  169. width: #{50rpx};
  170. height: #{50rpx};
  171. display: block;
  172. }
  173. .arrow {
  174. width: #{12rpx};
  175. height: #{22rpx};
  176. }
  177. }
  178. }
  179. .list.row {
  180. .item-container {
  181. padding: #{20rpx} #{32rpx};
  182. }
  183. .icon {
  184. margin-right: #{16rpx};
  185. }
  186. }
  187. .list.grid {
  188. .item {
  189. width: 25%;
  190. .icon {
  191. margin-bottom: #{28rpx};
  192. }
  193. .name {
  194. padding: 0 #{12rpx};
  195. font-size: $uni-font-size-weak-one;
  196. color: $uni-general-color-one;
  197. white-space: nowrap;
  198. overflow: hidden;
  199. text-overflow: ellipsis;
  200. }
  201. }
  202. .item-container {
  203. padding: #{24rpx} 0;
  204. }
  205. }
  206. }
  207. .u-foot-box {
  208. position: relative;
  209. height: 104upx;
  210. }
  211. .u-icon {
  212. margin-top: 44upx;
  213. width: 40upx;
  214. height: 40upx;
  215. margin-right: 17upx;
  216. }
  217. .u-foot-item {
  218. font-size: #{26rpx};
  219. color: #666666;
  220. padding-top: #{14rpx};
  221. width: 50%;
  222. }
  223. .u-foot-info {
  224. text-align: center;
  225. }
  226. .u-foot-num {
  227. font-size: 32upx;
  228. margin-bottom: 10upx;
  229. }
  230. .u-line {
  231. height: 40upx;
  232. width: 2upx;
  233. background-color: #666666;
  234. position: absolute;
  235. top: 45upx;
  236. left: 50%;
  237. margin-left: -2upx;
  238. }
  239. </style>