index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view class="content">
  3. <view :style="{ paddingTop: navBarHeight }" class="profile-box">
  4. <view class="header">
  5. <view class="avatar">
  6. <image
  7. :src="userInfo.imgPath || defaultImg"
  8. mode="aspectFill"
  9. class="avatar-img"
  10. />
  11. </view>
  12. <view class="info">
  13. <view class="name">
  14. <text>{{ userInfo.nickname || "用户" }}</text>
  15. </view>
  16. <view class="desc">
  17. <text>{{ userInfo.phoneNum || "请先登录" }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="vip-card">
  22. <!-- <view class="vip-title">会员专属</view> -->
  23. <view class="vip-btn">开通</view>
  24. </view>
  25. </view>
  26. <view
  27. style="font-size: 34rpx; font-weight: bold; margin: 30rpx 0 20rpx 30rpx"
  28. >我的订单</view
  29. >
  30. <u-grid :border="false" col="5" @click="click">
  31. <u-grid-item
  32. v-for="(baseListItem, baseListIndex) in baseList"
  33. :key="baseListIndex"
  34. >
  35. <!-- <u-icon
  36. :customStyle="{ paddingTop: 20 + 'rpx' }"
  37. :name="baseListItem.name"
  38. :size="50"
  39. ></u-icon> -->
  40. <image
  41. style="height: 50rpx; width: 50rpx; padding-top: 20rpx"
  42. :src="baseListItem.src"
  43. >
  44. </image>
  45. <text class="grid-text">{{ baseListItem.title }}</text>
  46. </u-grid-item>
  47. </u-grid>
  48. <view
  49. style="font-size: 34rpx; font-weight: bold; margin: 30rpx 0 0 30rpx"
  50. >
  51. 常用功能
  52. </view>
  53. <view class="setting">
  54. <u-cell-group :border="false">
  55. <u-cell
  56. class="setting-cell"
  57. v-for="item in settingList"
  58. :rightIconStyle="{ fontSize: '15px' }"
  59. :isLink="true"
  60. :border="false"
  61. :title="item.title"
  62. >
  63. </u-cell>
  64. </u-cell-group>
  65. </view>
  66. <!-- <view class="btn-box"> 退出 </view> -->
  67. <zs-tab-bar :value="3"></zs-tab-bar>
  68. </view>
  69. </template>
  70. <script>
  71. import { getUserDetail } from "@/api/common.js";
  72. export default {
  73. data() {
  74. return {
  75. navBarHeight: 0,
  76. inOpter: false,
  77. defaultImg:
  78. "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fci.xiaohongshu.com%2Fc34b7b74-ba38-0456-982a-43c0f97522fe%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fci.xiaohongshu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1693532127&t=a2e186c12aecaab7723611cb52a6778f",
  79. userInfo: {
  80. nickName: "用户12332111",
  81. type: "尊享会员",
  82. },
  83. baseList: [
  84. {
  85. name: "order",
  86. title: "全部",
  87. src: "/static/icon/my/all.png",
  88. },
  89. {
  90. name: "red-packet",
  91. title: "待付款",
  92. src: "/static/icon/my/obligations.png",
  93. },
  94. {
  95. name: "car",
  96. title: "待发货",
  97. src: "/static/icon/my/shipments.png",
  98. },
  99. {
  100. name: "bag",
  101. title: "待收货",
  102. src: "/static/icon/my/receiving.png",
  103. },
  104. {
  105. name: "rmb-circle",
  106. title: "退款",
  107. src: "/static/icon/my/refund.png",
  108. },
  109. ],
  110. settingList: [
  111. // 会员码 、 收获地址 、 我的收藏 、 我的优惠券
  112. {
  113. name: "vip",
  114. title: "会员码",
  115. },
  116. {
  117. name: "location",
  118. title: "收货地址",
  119. },
  120. {
  121. name: "heart",
  122. title: "我的收藏",
  123. },
  124. {
  125. name: "coupon",
  126. title: "我的优惠券",
  127. },
  128. ],
  129. };
  130. },
  131. created() {
  132. this.navBarHeight = this.$navHight();
  133. },
  134. onShow() {
  135. if (uni.getStorageSync("token")) {
  136. this.getUserDetail();
  137. } else {
  138. (this.userInfo = {
  139. imgPath: null,
  140. lastLogin: "",
  141. level: null,
  142. nickname: null,
  143. openId: "",
  144. phoneNum: "",
  145. sex: 0,
  146. userId: "",
  147. valid: 0,
  148. }),
  149. uni.showModal({
  150. title: "请登录",
  151. confirmText: "去登录",
  152. success(res) {
  153. console.log(res);
  154. if (res.confirm) {
  155. uni.navigateTo({
  156. url: "../../login/login/login",
  157. });
  158. }
  159. },
  160. });
  161. }
  162. },
  163. methods: {
  164. // 获取用户详情
  165. getUserDetail() {
  166. getUserDetail().then((res) => {
  167. if (res.state == "Success") {
  168. this.userInfo = res.content;
  169. uni.setStorageSync("userInfo", JSON.stringify(this.userInfo));
  170. }
  171. });
  172. },
  173. },
  174. };
  175. </script>
  176. <style>
  177. page {
  178. background-color: #ffffff;
  179. }
  180. </style>
  181. <style lang="scss" scoped>
  182. .content {
  183. .profile-box {
  184. background: url("https://jbm.dev.zonelife.cn/img/background.png") no-repeat;
  185. background-size: 100% 100%;
  186. overflow: hidden;
  187. border-bottom-left-radius: 40% 5%;
  188. border-bottom-right-radius: 40% 5%;
  189. .header {
  190. display: flex;
  191. align-items: center;
  192. padding: 40rpx;
  193. height: 300rpx;
  194. .avatar {
  195. width: 150rpx;
  196. height: 150rpx;
  197. margin-top: -40rpx;
  198. .avatar-img {
  199. width: 100%;
  200. height: 100%;
  201. border-radius: 50%;
  202. }
  203. }
  204. }
  205. .info {
  206. margin-left: 20rpx;
  207. display: flex;
  208. margin-top: -40rpx;
  209. flex-direction: column;
  210. justify-content: center;
  211. .name {
  212. font-size: 35rpx;
  213. font-weight: bold;
  214. }
  215. .desc {
  216. margin-top: 20rpx;
  217. min-width: 85rpx;
  218. background: #8b8b8b;
  219. font-size: 20rpx;
  220. color: white;
  221. padding: 5rpx 10rpx;
  222. border-radius: 12px;
  223. }
  224. }
  225. }
  226. .vip-card {
  227. display: flex;
  228. justify-content: flex-end;
  229. margin: -88rpx 20rpx 0 20rpx;
  230. padding: 20rpx;
  231. height: 80rpx;
  232. color: white;
  233. background: url("https://jbm.dev.zonelife.cn/img/vip.png") no-repeat;
  234. background-size: 100% 100%;
  235. border-radius: 10px 10px 0 0;
  236. .vip-btn {
  237. background: #fde9c7;
  238. padding: 20rpx 40rpx;
  239. line-height: 20rpx;
  240. height: 21rpx;
  241. color: #d6a873;
  242. border-radius: 17px;
  243. font-size: 30rpx;
  244. }
  245. }
  246. .grid-text {
  247. font-size: 14px;
  248. color: #909399;
  249. padding: 10rpx 0 20rpx 0rpx;
  250. /* #ifndef APP-PLUS */
  251. box-sizing: border-box;
  252. /* #endif */
  253. }
  254. .setting:not(:nth-child(1)) {
  255. font-size: 30rpx;
  256. font-weight: bold;
  257. // margin-top: 40rpx;
  258. background-color: white;
  259. border-radius: 20px;
  260. .setting-cell {
  261. margin-top: 40rpx;
  262. }
  263. }
  264. .btn-box {
  265. position: fixed;
  266. bottom: 15%;
  267. margin-left: 20rpx;
  268. width: 90%;
  269. height: 80rpx;
  270. background-color: rgba( #000000, .2);
  271. color: black;
  272. padding-left: 30rpx;
  273. line-height: 80rpx;
  274. font-size: 30rpx;
  275. border-radius: 5px;
  276. }
  277. }
  278. </style>