user.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. userInfo: { // TODO 芋艿:读取
  68. nickname: '芋艿'
  69. },
  70. hasLogin: true, // TODO 芋艿:读取
  71. orderCount: { // TODO 芋艿:读取
  72. c0: 1,
  73. c1: 2,
  74. c2: 3,
  75. c3: 4
  76. }
  77. };
  78. },
  79. onShow() {
  80. // TODO 芋艿:加载用户信息
  81. // TODO 芋艿:获得订单数量
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. .app {
  87. padding-bottom: 20rpx;
  88. }
  89. .user-wrapper {
  90. position: relative;
  91. overflow: hidden;
  92. padding-top: calc(var(--status-bar-height) + 52rpx);
  93. padding-bottom: 6rpx;
  94. .user {
  95. display: flex;
  96. flex-direction: column;
  97. flex-direction: row;
  98. align-items: center;
  99. position: relative;
  100. z-index: 5;
  101. padding: 20rpx 30rpx 60rpx;
  102. .avatar {
  103. flex-shrink: 0;
  104. width: 130rpx;
  105. height: 130rpx;
  106. border-radius: 100px;
  107. margin-right: 24rpx;
  108. border: 4rpx solid #fff;
  109. background-color: #fff;
  110. }
  111. .username {
  112. font-size: 34rpx;
  113. color: #fff;
  114. }
  115. .group {
  116. align-self: flex-start;
  117. padding: 10rpx 14rpx;
  118. margin: 16rpx 10rpx; // 10rpx 避免距离昵称太近
  119. font-size: 20rpx;
  120. color: #fff;
  121. background-color: rgba(255, 255, 255,.3);
  122. border-radius: 100rpx;
  123. }
  124. .login-box {
  125. font-size: 36rpx;
  126. color: #fff;
  127. }
  128. }
  129. .user-background {
  130. position: absolute;
  131. left: 0;
  132. top: 0;
  133. width: 100%;
  134. height: 330rpx;
  135. }
  136. .user-background-arc-line {
  137. position: absolute;
  138. left: 0;
  139. bottom: 0;
  140. z-index: 9;
  141. width: 100%;
  142. height: 32rpx;
  143. }
  144. }
  145. .order-wrap {
  146. width: 700rpx;
  147. margin: 20rpx auto 0;
  148. background: #fff;
  149. border-radius: 10rpx;
  150. .order-header{
  151. padding: 28rpx 20rpx 6rpx 26rpx;
  152. .title {
  153. flex: 1;
  154. font-size: 32rpx;
  155. color: #333;
  156. font-weight: 700;
  157. }
  158. .more {
  159. font-size: 24rpx;
  160. color: #999;
  161. }
  162. .icon-you {
  163. margin-left: 4rpx;
  164. font-size: 20rpx;
  165. color: #999;
  166. }
  167. }
  168. .order-list {
  169. display:flex;
  170. justify-content: space-around;
  171. padding: 20rpx 0;
  172. .item{
  173. flex-direction: column;
  174. width: 130rpx;
  175. height: 130rpx;
  176. border-radius: 8rpx;
  177. font-size: 24rpx;
  178. color: #606266;
  179. position: relative;
  180. .mix-icon {
  181. font-size: 50rpx;
  182. margin-bottom: 20rpx;
  183. color: #fa436a;
  184. }
  185. .icon-shouhoutuikuan {
  186. font-size: 44rpx;
  187. }
  188. .number {
  189. position: absolute;
  190. right: 22rpx;
  191. top: 6rpx;
  192. min-width: 34rpx;
  193. height: 34rpx;
  194. line-height: 30rpx;
  195. text-align: center;
  196. padding: 0 8rpx;
  197. font-size: 18rpx;
  198. color: #fff;
  199. border: 2rpx solid #fff;
  200. background-color: $base-color;
  201. border-radius: 100rpx;
  202. }
  203. }
  204. }
  205. }
  206. .option-wrap{
  207. width: 700rpx;
  208. margin: 20rpx auto 0;
  209. margin-top: 20rpx;
  210. background: #fff;
  211. border-radius:10rpx;
  212. .sec-header{
  213. padding: 26rpx 14rpx 0 24rpx;
  214. font-size: 28rpx;
  215. color: #333;
  216. .icon-lishijilu{
  217. font-size: 46rpx;
  218. color: #50bf8b;
  219. margin-right: 16rpx;
  220. line-height: 40rpx;
  221. }
  222. .icon-lajitong{
  223. padding: 4rpx 10rpx;
  224. font-size: 36rpx;
  225. color: #999;
  226. }
  227. }
  228. .pro-list{
  229. flex-wrap: nowrap;
  230. padding: 20rpx 0 12rpx;
  231. &:before, &:after{
  232. content: '';
  233. min-width: 30rpx;
  234. height: 30rpx;
  235. }
  236. &:after{
  237. min-width: 20rpx;
  238. }
  239. image{
  240. flex-shrink: 0;
  241. width: 144rpx;
  242. height: 144rpx;
  243. margin-right: 16rpx;
  244. border-radius: 8rpx;
  245. }
  246. }
  247. }
  248. </style>