index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="minepage">
  3. <!-- 用户 -->
  4. <UserInfo :data="userInfo" :isLogin="token"></UserInfo>
  5. <!-- 用户数据 -->
  6. <!-- <view class="user-count"><LabelCount :ops="mineCountOps"></LabelCount></view> -->
  7. <!-- 我的订单 -->
  8. <view class="order-nav">
  9. <DialNav :mode="5" shadow :list="orderNavOps" nameSize="24rpx" imgSize="72rpx">
  10. <TitleOperate
  11. padding="30rpx 30rpx 0 30rpx"
  12. showMore
  13. title="我的订单"
  14. moreLabel="全部订单"
  15. @clickMore="$u.route({ url: '/pages-mall/pages/order/list' })"
  16. ></TitleOperate>
  17. </DialNav>
  18. </view>
  19. <view class="oparbox shadow">
  20. <!-- <view class="oparTit">
  21. 常用工具
  22. </view> -->
  23. <!-- title="常用工具" -->
  24. <u-cell-group :border="false">
  25. <u-cell-item icon="star" title="我的收藏" :border-bottom="false" @click="goUrl('/pages-mine/pages/collection')"></u-cell-item>
  26. <u-cell-item icon="clock" title="我的足迹" :border-bottom="false" @click="goUrl('/pages-mine/pages/history')"></u-cell-item>
  27. <u-cell-item icon="coupon" title="我的优惠券" :border-bottom="false" @click="goUrl('/pages-mine/pages/discounts')"></u-cell-item>
  28. <u-cell-item icon="map" title="地址管理" :border-bottom="false" @click="goUrl('/pages-mine/pages/address/list')"></u-cell-item>
  29. </u-cell-group>
  30. </view>
  31. <view class="oparbox shadow">
  32. <!-- <view class="oparTit">
  33. 常用工具
  34. </view> -->
  35. <!-- title="常用工具" -->
  36. <u-cell-group :border="false">
  37. <u-cell-item icon="info-circle" title="关于我们" :border-bottom="false" @click="goArticleDetail('about_us','关于我们')"></u-cell-item>
  38. <u-cell-item icon="error-circle" title="投诉/建议" :border-bottom="false" @click="goUrl('/pages-mine/pages/feedback')"></u-cell-item>
  39. <u-cell-item icon="setting" title="设置中心" :border-bottom="false" @click="goUrl('/pages-mine/pages/setting')"></u-cell-item>
  40. </u-cell-group>
  41. </view>
  42. <!-- <view class="loginBox">
  43. <u-button type="primary" shape="circle" @click="logout"><text>退出登录</text></u-button>
  44. </view> -->
  45. </view>
  46. </template>
  47. <script>
  48. import UserInfo from '@/pages/mine/components/user-info.vue';
  49. import LabelCount from '@/components/nav/label-count.vue';
  50. import DialNav from '@/components/nav/dial-nav.vue';
  51. import TitleOperate from '@/components/title-operate.vue';
  52. import {articleOpar} from '@/pages-pub/mixins/article.js'
  53. export default {
  54. mixins:[articleOpar],
  55. components: {
  56. UserInfo,
  57. LabelCount,
  58. DialNav,
  59. TitleOperate
  60. },
  61. data() {
  62. return {
  63. token:'',
  64. isLogin:false,
  65. // 用户信息
  66. userInfo: {
  67. nickname: '',
  68. avatar: ''
  69. },
  70. // 订单导航配置
  71. orderNavOps: [
  72. { name: '待付款', img: require('../../static/nav/mine-order-1.png'), url: '/pages-mall/pages/order/list?tabIndex=1' },
  73. { name: '待发货', img: require('../../static/nav/mine-order-2.png'), url: '/pages-mall/pages/order/list?tabIndex=2' },
  74. { name: '待收货', img: require('../../static/nav/mine-order-3.png'), url: '/pages-mall/pages/order/list?tabIndex=3' },
  75. { name: '已完成', img: require('../../static/nav/mine-order-4.png'), url: '/pages-mall/pages/order/list?tabIndex=4' },
  76. { name: '退款售后', img: require('../../static/nav/mine-order-5.png'), url: '/pages-mall/pages/after-sales/list' },
  77. ],
  78. };
  79. },
  80. onShow() {
  81. this.token = uni.getStorageSync('token');
  82. },
  83. onLoad(){
  84. this.getUserInfo();
  85. uni.$on('getUserInfo',()=>{
  86. this.getUserInfo();
  87. })
  88. },
  89. methods: {
  90. getUserInfo(){
  91. this.$u.api.getUserBaseInfoAjax().then(({code,data}) => {
  92. console.log({code,data});
  93. if(code==1){
  94. this.userInfo = data;
  95. // this.isLogin = true;
  96. }
  97. }).catch((error)=>{
  98. console.log('error>>>>',error)
  99. })
  100. },
  101. goUrl(url){
  102. uni.navigateTo({
  103. url:url
  104. })
  105. },
  106. // 退出登录
  107. logout() {
  108. console.log(11)
  109. uni.showModal({
  110. title: '提示',
  111. content: '是否退出当前账号?',
  112. confirmColor: this.$appTheme.appThemeColor,
  113. success(res) {
  114. if (res.confirm) {
  115. uni.removeStorageSync('token');
  116. uni.navigateTo({
  117. url:'/pages/login/index'
  118. })
  119. }
  120. }
  121. });
  122. },
  123. }
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .minepage{
  128. padding-bottom: 20rpx;
  129. }
  130. .order-nav{
  131. margin-top: -70rpx;
  132. }
  133. .user-count,
  134. .order-nav,
  135. .other-nav {
  136. position: relative;
  137. z-index: $app-zIndex-normal;
  138. padding: 0 30rpx 30rpx 30rpx;
  139. }
  140. .oparbox{
  141. border-radius: 16rpx;
  142. background-color: $app-theme-bg-color;
  143. overflow: hidden;
  144. margin: 0 30rpx 20rpx;
  145. &.shadow {
  146. box-shadow: $app-theme-shadow;
  147. }
  148. .oparTit{
  149. padding: 30rpx 30rpx 20rpx;
  150. font-size: 34rpx;
  151. }
  152. }
  153. .loginBox {
  154. padding: 60rpx;
  155. }
  156. </style>