user-center.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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. <view class="app-my-service" v-if="userCenter.is_menu_status == 1">
  65. <view class="list" :class="[listStyle]">
  66. <view class="item" @click="goUrl">
  67. <app-jump-button form
  68. url="pages/sp/index/index"
  69. open_type="item.open_type"
  70. item="item"
  71. arrangement="`${userCenter.menu_style === '1' ? 'row' : userCenter.menu_style === '2' ? 'column' : ''}`">
  72. <view style="width: 100%" class="item-container dir-left-nowrap cross-center">
  73. <view class="box-grow-0">
  74. <image src="https://t12.9026.com/web/statics/img/mall/pick-link/icon-user-card.png" class="icon"></image>
  75. </view>
  76. <view class="box-grow-1" style="max-width: 100%">
  77. <view class="name">碎屏险中心</view>
  78. </view>
  79. <view class="box-grow-0">
  80. <image src="/static/image/icon/arrow-right.png" class="arrow"></image>
  81. </view>
  82. </view>
  83. </app-jump-button>
  84. </view>
  85. </view>
  86. </view>
  87. <app-copyright
  88. v-if="copyright && copyright.status == '1'"
  89. background-color="transparent"
  90. :link="copyrightLink"
  91. :pic-url="copyright.pic_url"
  92. :text="copyright.description"
  93. ></app-copyright>
  94. </app-layout>
  95. </template>
  96. <script>
  97. import {mapGetters, mapState} from 'vuex';
  98. import AppUserCenterTop from '../../components/page-component/app-user-center-top/app-user-center-top.vue';
  99. import AppAccountBalance from '../../components/page-component/app-account-balance/app-account-balance.vue';
  100. import AppMyOrder from '../../components/page-component/app-my-order/app-my-order.vue';
  101. import AppCopyright from '../../components/page-component/app-copyright/app-copyright.vue';
  102. import AppVipCard from '../../components/page-component/app-vip-card/app-vip-card.vue';
  103. export default {
  104. name: 'user-center',
  105. components: {
  106. AppCopyright,
  107. AppUserCenterTop,
  108. AppAccountBalance,
  109. AppMyOrder,
  110. AppVipCard,
  111. },
  112. computed: {
  113. ...mapState({
  114. copyright: state => state.mallConfig.copyright,
  115. userCenter: state => state.userCenter.data,
  116. userInfo: state => state.user.info,
  117. is_icon_super_vip: function (state) {
  118. return state.mallConfig.mall.setting.is_icon_super_vip;
  119. },
  120. foot_bar: function(state) {
  121. return state.userCenter.data.foot_bar;
  122. }
  123. }),
  124. copyrightLink() {
  125. if (!this.copyright) return {};
  126. let { open_type, new_link_url, params } = this.copyright.link;
  127. return {
  128. openType: open_type,
  129. url: new_link_url,
  130. params: params ? params : []
  131. };
  132. },
  133. ...mapGetters('mallConfig', {
  134. getTheme: 'getTheme'
  135. }),
  136. listStyle() {
  137. if (this.userCenter.menu_style == 1) return 'row';
  138. if (this.userCenter.menu_style == 2) return 'grid dir-left-wrap';
  139. return '';
  140. }
  141. },
  142. onShow() {
  143. this.$event.on(this.$const.EVENT_USER_LOGIN).then(() => {
  144. uni.redirectTo({
  145. url: `/pages/user-center/user-center`
  146. });
  147. });
  148. if (this.$user.isLogin()) {
  149. this.$store.dispatch('user/refresh');
  150. }
  151. this.$nextTick().then(() => {
  152. this.$store.dispatch('userCenter/data');
  153. });
  154. },
  155. methods: {
  156. goUrl(){
  157. uni.redirectTo({
  158. url: '/pages/sp/index/index'
  159. })
  160. },
  161. router(name) {
  162. let url = '';
  163. if (name === '我的收藏') {
  164. url = `/pages/favorite/favorite`;
  165. } else {
  166. url = `/pages/foot/index/index`;
  167. }
  168. uni.navigateTo({
  169. url: url
  170. });
  171. }
  172. },
  173. filters: {
  174. showNum(name, userInfo) {
  175. if (name === '我的收藏') {
  176. return userInfo && userInfo.favorite ? userInfo.favorite : 0;
  177. } else {
  178. return userInfo && userInfo.footprint ? userInfo.footprint : 0;
  179. }
  180. }
  181. }
  182. }
  183. </script>
  184. <style scoped lang="scss">
  185. .app-my-service {
  186. width: #{702rpx};
  187. border-radius: #{16rpx};
  188. margin: #{24rpx} auto;
  189. box-shadow: 0 0 #{8rpx} rgba(0, 0, 0, .05);
  190. background: #fff;
  191. .title {
  192. padding: #{32rpx} #{32rpx} #{16rpx};
  193. }
  194. .list {
  195. .item {
  196. .icon {
  197. width: #{50rpx};
  198. height: #{50rpx};
  199. display: block;
  200. }
  201. .arrow {
  202. width: #{12rpx};
  203. height: #{22rpx};
  204. }
  205. }
  206. }
  207. .list.row {
  208. .item-container {
  209. padding: #{20rpx} #{32rpx};
  210. }
  211. .icon {
  212. margin-right: #{16rpx};
  213. }
  214. }
  215. .list.grid {
  216. .item {
  217. width: 25%;
  218. .icon {
  219. margin-bottom: #{28rpx};
  220. }
  221. .name {
  222. padding: 0 #{12rpx};
  223. font-size: $uni-font-size-weak-one;
  224. color: $uni-general-color-one;
  225. white-space: nowrap;
  226. overflow: hidden;
  227. text-overflow: ellipsis;
  228. }
  229. }
  230. .item-container {
  231. padding: #{24rpx} 0;
  232. }
  233. }
  234. }
  235. .u-foot-box {
  236. position: relative;
  237. height: 104upx;
  238. }
  239. .u-icon {
  240. margin-top: 44upx;
  241. width: 40upx;
  242. height: 40upx;
  243. margin-right: 17upx;
  244. }
  245. .u-foot-item {
  246. font-size: #{26rpx};
  247. color: #666666;
  248. padding-top: #{14rpx};
  249. width: 50%;
  250. }
  251. .u-foot-info {
  252. text-align: center;
  253. }
  254. .u-foot-num {
  255. font-size: 32upx;
  256. margin-bottom: 10upx;
  257. }
  258. .u-line {
  259. height: 40upx;
  260. width: 2upx;
  261. background-color: #666666;
  262. position: absolute;
  263. top: 45upx;
  264. left: 50%;
  265. margin-left: -2upx;
  266. }
  267. </style>