index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="mine-page">
  3. <!-- 顶部用户信息 -->
  4. <view class="user-info">
  5. <view class="user-header" @tap="handleUpdateUserInfo">
  6. <view class="user-avatar">
  7. <image class="avatar" :src="userInfo.imgPath || '/static/img/logo3.png'" mode="aspectFill"></image>
  8. </view>
  9. <view class="user-detail">
  10. <view class="nickname">{{ userInfo.nickName }}</view>
  11. <view class="user-tag" v-if="userInfo.labels">{{ userInfo.labels }}</view>
  12. </view>
  13. </view>
  14. <!-- 用户数据 -->
  15. <view class="user-data">
  16. <view class="data-item">
  17. <view class="amount">{{ userInfo.restMoney || 0 }}</view>
  18. <view class="label">我的钱包</view>
  19. </view>
  20. <view class="data-item">
  21. <view class="amount">{{ userInfo.couponCount || 0 }}</view>
  22. <view class="label">优惠券</view>
  23. <view class="badge" v-if="userInfo.availableCoupons">{{ userInfo.availableCoupons }}张可领</view>
  24. </view>
  25. <view class="data-item">
  26. <view class="amount">{{ userInfo.points || 0 }}</view>
  27. <view class="label">我的积分</view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 卖书订 -->
  32. <view class="order-section">
  33. <view class="section-header">
  34. <text>卖书订单</text>
  35. <view class="view-all" @click="viewAllOrders">
  36. <text>查看全部</text>
  37. <u-icon name="arrow-right" size="24" color="#999"></u-icon>
  38. </view>
  39. </view>
  40. <view class="order-types" style="padding: 0 20rpx;">
  41. <view class="type-item flex-d flex-a-c" v-for="(item, index) in orderTypes" :key="index"
  42. @click="navigateToOrder(item.path)">
  43. <image class="type-icon" :src="'/pages-mine/static/' + item.icon" mode="aspectFit"></image>
  44. <text>{{ item.name }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 实用工具 -->
  49. <view class="tools-section">
  50. <view class="section-title">实用工具</view>
  51. <view class="tools-grid">
  52. <view class="tool-item flex-d flex-a-c" v-for="(tool, index) in tools" :key="index"
  53. @click="navigateToTool(tool.path)">
  54. <image class="tool-icon" :src="'/pages-mine/static/' + tool.icon" mode="aspectFit"></image>
  55. <text>{{ tool.name }}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. userInfo: {
  66. avatar: '',
  67. nickname: '这里是微信昵称.',
  68. tag: '合伙人',
  69. balance: '26.00',
  70. couponCount: '66',
  71. availableCoupons: '99',
  72. points: '3630'
  73. },
  74. orderTypes: [
  75. { name: '待初审', icon: '1.png', path: '/pages/order/pending-review' },
  76. { name: '待取件', icon: '2.png', path: '/pages/order/pending-pickup' },
  77. { name: '待审核', icon: '3.png', path: '/pages/order/pending-audit' },
  78. { name: '待到款', icon: '4.png', path: '/pages/order/pending-payment' },
  79. { name: '申请退回', icon: '5.png', path: '/pages/order/return-request' }
  80. ],
  81. tools: [
  82. { name: '消息通知', icon: 't1.png', path: '/pages-mine/pages/notice' },
  83. { name: '我的收藏', icon: 't2.png', path: '/pages/tools/collection' },
  84. { name: '我的足迹', icon: 't3.png', path: '/pages/tools/footprint' },
  85. { name: '我的地址', icon: 't4.png', path: '/pages-mine/pages/address/list' },
  86. { name: '我的优惠券', icon: 't5.png', path: '/pages/tools/coupon' },
  87. { name: '联系客服', icon: 't6.png', path: '/pages/tools/service' },
  88. { name: '意见反馈', icon: 't7.png', path: '/pages-mine/pages/feedback' },
  89. { name: '到货提醒', icon: 't8.png', path: '/pages/tools/arrival-notice' },
  90. { name: '合伙人计划', icon: 't9.png', path: '/pages/tools/partner' },
  91. { name: '买卖答疑', icon: 't10.png', path: '/pages/tools/faq' },
  92. { name: '关于书嗨', icon: 't11.png', path: '/pages/tools/about' },
  93. { name: '我的余额', icon: 't12.png', path: '/pages/tools/balance' },
  94. { name: '用户设置', icon: 't13.png', path: '/pages/tools/settings' }
  95. ]
  96. }
  97. },
  98. methods: {
  99. //用户信息
  100. handleUpdateUserInfo() {
  101. uni.navigateTo({
  102. url: '/pages-mine/pages/setting'
  103. })
  104. },
  105. //查看全部订单
  106. viewAllOrders() {
  107. uni.navigateTo({
  108. url: '/pages-mine/pages/order-page'
  109. })
  110. },
  111. //跳转订单
  112. navigateToOrder(path) {
  113. uni.navigateTo({
  114. url: path
  115. })
  116. },
  117. //跳转工具
  118. navigateToTool(path) {
  119. uni.navigateTo({
  120. url: path
  121. })
  122. },
  123. //获取用户信息
  124. getUserInfo() {
  125. uni.$u.http.get('/token/user/detail').then(res => {
  126. console.log(res)
  127. if (res.code == 200) {
  128. this.userInfo = res.data
  129. }
  130. })
  131. }
  132. },
  133. onShow() {
  134. let token = uni.getStorageSync('token')
  135. if (token) {
  136. this.getUserInfo()
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .mine-page {
  143. min-height: 100vh;
  144. background-color: #f5f5f5;
  145. .user-info {
  146. background-color: #38C148;
  147. padding: 20rpx 50rpx 120rpx;
  148. color: #fff;
  149. position: relative;
  150. &::after {
  151. width: 140%;
  152. position: absolute;
  153. left: -20%;
  154. top: 0;
  155. z-index: -1;
  156. content: '';
  157. border-radius: 0 0 50% 50%;
  158. background: #fd6954;
  159. }
  160. .user-header {
  161. display: flex;
  162. align-items: center;
  163. margin-bottom: 40rpx;
  164. .user-avatar {
  165. border-radius: 50%;
  166. margin-right: 20rpx;
  167. border: 4rpx solid #fff;
  168. width: 128rpx;
  169. height: 128rpx;
  170. .avatar {
  171. width: 120rpx;
  172. height: 120rpx;
  173. border-radius: 50%;
  174. }
  175. }
  176. .user-detail {
  177. .nickname {
  178. font-size: 32rpx;
  179. font-weight: 500;
  180. margin-bottom: 8rpx;
  181. }
  182. .user-tag {
  183. display: inline-block;
  184. font-size: 22rpx;
  185. padding: 4rpx 12rpx;
  186. background: linear-gradient(-90deg, #272321, #4B4542);
  187. border-radius: 4rpx;
  188. margin-top: 8rpx;
  189. }
  190. }
  191. }
  192. .user-data {
  193. display: flex;
  194. justify-content: space-between;
  195. position: relative;
  196. z-index: 1;
  197. padding: 0 40rpx;
  198. .data-item {
  199. position: relative;
  200. text-align: center;
  201. .amount {
  202. font-size: 38rpx;
  203. font-weight: 500;
  204. margin-bottom: 8rpx;
  205. }
  206. .label {
  207. font-size: 24rpx;
  208. font-weight: 400;
  209. opacity: 0.9;
  210. }
  211. .badge {
  212. position: absolute;
  213. top: -15rpx;
  214. right: -120%;
  215. padding: 0 10rpx;
  216. font-size: 20rpx;
  217. line-height: 30rpx;
  218. height: 30rpx;
  219. background: #FF8400;
  220. border-radius: 15rpx 15rpx 15rpx 0rpx;
  221. }
  222. }
  223. }
  224. }
  225. .order-section {
  226. margin: -80rpx 30rpx 20rpx;
  227. background: #fff;
  228. border-radius: 12rpx;
  229. padding: 30rpx;
  230. position: relative;
  231. z-index: 2;
  232. .section-header {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. margin-bottom: 30rpx;
  237. .view-all {
  238. display: flex;
  239. align-items: center;
  240. color: #999;
  241. font-size: 26rpx;
  242. }
  243. }
  244. .order-types {
  245. display: flex;
  246. justify-content: space-between;
  247. .type-item {
  248. text-align: center;
  249. .type-icon {
  250. width: 60rpx;
  251. height: 60rpx;
  252. margin-bottom: 12rpx;
  253. }
  254. text {
  255. font-size: 24rpx;
  256. color: #333;
  257. }
  258. }
  259. }
  260. }
  261. .tools-section {
  262. margin: 30rpx;
  263. background: #fff;
  264. border-radius: 12rpx;
  265. padding: 30rpx;
  266. position: relative;
  267. z-index: 2;
  268. .section-title {
  269. font-size: 30rpx;
  270. font-weight: 500;
  271. margin-bottom: 30rpx;
  272. }
  273. .tools-grid {
  274. display: grid;
  275. grid-template-columns: repeat(4, 1fr);
  276. gap: 30rpx;
  277. .tool-item {
  278. text-align: center;
  279. .tool-icon {
  280. width: 60rpx;
  281. height: 60rpx;
  282. margin-bottom: 12rpx;
  283. }
  284. text {
  285. font-size: 24rpx;
  286. color: #333;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. </style>