user-center.vue 11 KB

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