user.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="app">
  3. <!-- 个人信息 -->
  4. <view class="user-wrapper">
  5. <image class="user-background" src="/static/backgroud/user.jpg"></image>
  6. <view class="user">
  7. <!-- 头像 -->
  8. <image class="avatar" :src="userInfo.avatar || '/static/icon/default-avatar.png'" @click="navTo('/pages/set/userInfo', {login: true})"></image>
  9. <!-- 已登陆,展示昵称 -->
  10. <view class="cen column" v-if="hasLogin">
  11. <text class="username f-m">{{ userInfo.nickname }}</text>
  12. <text class="group">普通会员</text>
  13. </view>
  14. <!-- 未登陆,引导登陆 -->
  15. <view class="login-box" v-else @click="navTo('/pages/auth/login')">
  16. <text>点击注册/登录</text>
  17. </view>
  18. </view>
  19. <!-- 下面的圆弧 -->
  20. <image class="user-background-arc-line" src="/static/icon/arc.png" mode="aspectFill"></image>
  21. </view>
  22. <!-- 订单信息 -->
  23. <view class="order-wrap">
  24. <view class="order-header row" @click="navTo('/pages/order/list?current=0', {login: true})">
  25. <text class="title">我的订单</text>
  26. <text class="more">查看全部</text>
  27. <text class="mix-icon icon-you"></text>
  28. </view>
  29. <view class="order-list">
  30. <view class="item center" @click="navTo('/pages/order/list?current=1', {login: true})" hover-class="hover-gray" :hover-stay-time="50">
  31. <text class="mix-icon icon-daifukuan"></text>
  32. <text>待付款</text>
  33. <text v-if="orderCount.c0 > 0" class="number">{{ orderCount.c0 }}</text>
  34. </view>
  35. <view class="item center" @click="navTo('/pages/order/list?current=2', {login: true})" hover-class="hover-gray" :hover-stay-time="50">
  36. <text class="mix-icon icon-daifahuo"></text>
  37. <text>待发货</text>
  38. <text v-if="orderCount.c1 > 0" class="number">{{ orderCount.c1 }}</text>
  39. </view>
  40. <view class="item center" @click="navTo('/pages/order/list?current=3', {login: true})" hover-class="hover-gray" :hover-stay-time="50">
  41. <text class="mix-icon icon-yishouhuo"></text>
  42. <text>待收货</text>
  43. <text v-if="orderCount.c2 > 0" class="number">{{ orderCount.c2 }}</text>
  44. </view>
  45. <view class="item center" @click="navTo('/pages/order/list?current=4', {login: true})" hover-class="hover-gray" :hover-stay-time="50">
  46. <text class="mix-icon icon-daipingjia"></text>
  47. <text>待评价</text>
  48. <text v-if="orderCount.c3 > 0" class="number">{{ orderCount.c3 }}</text>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 功能入口 -->
  53. <view class="option-wrap">
  54. <!-- <mix-list-cell icon="icon-iconfontweixin" iconColor="#fa436a" title="我的钱包" @onClick="navTo('/pages/wallet/index', {login: true})"></mix-list-cell> -->
  55. <!-- <mix-list-cell icon="icon-dizhi" iconColor="#5fcda2" title="地址管理" @onClick="navTo('/pages/address/list', {login: true})"></mix-list-cell> -->
  56. <!-- <mix-list-cell icon="icon-share" iconColor="#9789f7" title="分享" tips="呼朋唤友赢好礼"></mix-list-cell> -->
  57. <!-- <mix-list-cell icon="icon-shoucang_xuanzhongzhuangtai" iconColor="#54b4ef" title="我的收藏" @onClick="navTo('/pages/favorite/favorite', {login: true})"></mix-list-cell> -->
  58. <!-- <mix-list-cell icon="icon-pinglun-copy" iconColor="#ee883b" title="意见反馈" @onClick="navTo('/pages/feedback/feedback', {login: true})"></mix-list-cell> -->
  59. <!-- <mix-list-cell icon="icon-shezhi1" iconColor="#37b0fb" title="设置" border="" @onClick="navTo('/pages/set/set', {login: true})"></mix-list-cell> -->
  60. <mix-list-cell icon="icon-bianji" iconColor="#5fcda2" title="个人信息" border="" @onClick="navTo('/pages/set/userInfo', {login: true})"></mix-list-cell>
  61. <mix-list-cell icon="icon-shezhi1" iconColor="#37b0fb" title="账号安全" border="" @onClick="navTo('/pages/set/set', {login: true})"></mix-list-cell>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. userInfo: { // TODO 芋艿:读取
  70. nickname: '芋艿'
  71. },
  72. hasLogin: true, // TODO 芋艿:读取
  73. orderCount: { // TODO 芋艿:读取
  74. c0: 1,
  75. c1: 2,
  76. c2: 3,
  77. c3: 4
  78. }
  79. };
  80. },
  81. onShow() {
  82. // 获得用户信息
  83. this.$store.dispatch('obtainUserInfo');
  84. // TODO 芋艿:获得订单数量
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .app {
  90. padding-bottom: 20rpx;
  91. }
  92. .user-wrapper {
  93. position: relative;
  94. overflow: hidden;
  95. padding-top: calc(var(--status-bar-height) + 52rpx);
  96. padding-bottom: 6rpx;
  97. .user {
  98. display: flex;
  99. flex-direction: column;
  100. flex-direction: row;
  101. align-items: center;
  102. position: relative;
  103. z-index: 5;
  104. padding: 20rpx 30rpx 60rpx;
  105. .avatar {
  106. flex-shrink: 0;
  107. width: 130rpx;
  108. height: 130rpx;
  109. border-radius: 100px;
  110. margin-right: 24rpx;
  111. border: 4rpx solid #fff;
  112. background-color: #fff;
  113. }
  114. .username {
  115. font-size: 34rpx;
  116. color: #fff;
  117. }
  118. .group {
  119. align-self: flex-start;
  120. padding: 10rpx 14rpx;
  121. margin: 16rpx 10rpx; // 10rpx 避免距离昵称太近
  122. font-size: 20rpx;
  123. color: #fff;
  124. background-color: rgba(255, 255, 255,.3);
  125. border-radius: 100rpx;
  126. }
  127. .login-box {
  128. font-size: 36rpx;
  129. color: #fff;
  130. }
  131. }
  132. .user-background {
  133. position: absolute;
  134. left: 0;
  135. top: 0;
  136. width: 100%;
  137. height: 330rpx;
  138. }
  139. .user-background-arc-line {
  140. position: absolute;
  141. left: 0;
  142. bottom: 0;
  143. z-index: 9;
  144. width: 100%;
  145. height: 32rpx;
  146. }
  147. }
  148. .order-wrap {
  149. width: 700rpx;
  150. margin: 20rpx auto 0;
  151. background: #fff;
  152. border-radius: 10rpx;
  153. .order-header {
  154. padding: 28rpx 20rpx 6rpx 26rpx;
  155. .title {
  156. flex: 1;
  157. font-size: 32rpx;
  158. color: #333;
  159. font-weight: 700;
  160. }
  161. .more {
  162. font-size: 24rpx;
  163. color: #999;
  164. }
  165. .icon-you {
  166. margin-left: 4rpx;
  167. font-size: 20rpx;
  168. color: #999;
  169. }
  170. }
  171. .order-list {
  172. display:flex;
  173. justify-content: space-around;
  174. padding: 20rpx 0;
  175. .item{
  176. flex-direction: column;
  177. width: 130rpx;
  178. height: 130rpx;
  179. border-radius: 8rpx;
  180. font-size: 24rpx;
  181. color: #606266;
  182. position: relative;
  183. .mix-icon {
  184. font-size: 50rpx;
  185. margin-bottom: 20rpx;
  186. color: #fa436a;
  187. }
  188. .icon-shouhoutuikuan {
  189. font-size: 44rpx;
  190. }
  191. .number {
  192. position: absolute;
  193. right: 22rpx;
  194. top: 6rpx;
  195. min-width: 34rpx;
  196. height: 34rpx;
  197. line-height: 30rpx;
  198. text-align: center;
  199. padding: 0 8rpx;
  200. font-size: 18rpx;
  201. color: #fff;
  202. border: 2rpx solid #fff;
  203. background-color: $base-color;
  204. border-radius: 100rpx;
  205. }
  206. }
  207. }
  208. }
  209. .option-wrap {
  210. width: 700rpx;
  211. margin: 20rpx auto 0;
  212. margin-top: 20rpx;
  213. background: #fff;
  214. border-radius: 10rpx;
  215. }
  216. </style>