index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <view class="content">
  3. <view :style="{ paddingTop: navBarHeight }" class="profile-box">
  4. <view class="header">
  5. <view @click="init" class="avatar">
  6. <image
  7. :src="userInfo.imgPath || defaultImg"
  8. mode="aspectFill"
  9. class="avatar-img"
  10. />
  11. </view>
  12. <view @click="init" 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. @click="jump(baseListItem.path)"
  35. >
  36. <!-- <u-icon
  37. :customStyle="{ paddingTop: 20 + 'rpx' }"
  38. :name="baseListItem.name"
  39. :size="50"
  40. ></u-icon> -->
  41. <image
  42. style="height: 50rpx; width: 50rpx; padding-top: 20rpx"
  43. :src="baseListItem.src"
  44. >
  45. </image>
  46. <text class="grid-text">{{ baseListItem.title }}</text>
  47. </u-grid-item>
  48. </u-grid>
  49. <view style="font-size: 34rpx; font-weight: bold; margin: 30rpx 0 0 30rpx">
  50. 常用功能
  51. </view>
  52. <view class="setting">
  53. <u-cell-group :border="false">
  54. <u-cell
  55. @click="jump(item.path)"
  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. path: "../../my/order/index",
  89. },
  90. {
  91. name: "red-packet",
  92. title: "待付款",
  93. src: "/static/icon/my/obligations.png",
  94. path: "../../my/order/index?type=WAIT_PAYMENT",
  95. },
  96. {
  97. name: "car",
  98. title: "待发货",
  99. src: "/static/icon/my/shipments.png",
  100. },
  101. {
  102. name: "bag",
  103. title: "待收货",
  104. src: "/static/icon/my/receiving.png",
  105. },
  106. {
  107. name: "rmb-circle",
  108. title: "退款",
  109. src: "/static/icon/my/refund.png",
  110. path: "../../my/order/index?type=APPLY_REFUND",
  111. },
  112. ],
  113. settingList: [
  114. // 会员码 、 收获地址 、 我的收藏 、 我的优惠券
  115. {
  116. name: "vip",
  117. title: "会员码",
  118. path:'../../my/memberCenter/index'
  119. },
  120. {
  121. name: "location",
  122. title: "收货地址",
  123. },
  124. {
  125. name: "heart",
  126. title: "我的收藏",
  127. },
  128. {
  129. name: "coupon",
  130. title: "我的优惠券",
  131. },
  132. ],
  133. };
  134. },
  135. created() {
  136. this.navBarHeight = this.$navHight();
  137. },
  138. onShow() {
  139. init();
  140. },
  141. methods: {
  142. init() {
  143. if (uni.getStorageSync("token")) {
  144. this.getUserDetail();
  145. } else {
  146. (this.userInfo = {
  147. imgPath: null,
  148. lastLogin: "",
  149. level: null,
  150. nickname: null,
  151. openId: "",
  152. phoneNum: "",
  153. sex: 0,
  154. userId: "",
  155. valid: 0,
  156. }),
  157. uni.showModal({
  158. title: "请登录",
  159. confirmText: "去登录",
  160. success(res) {
  161. console.log(res);
  162. if (res.confirm) {
  163. uni.navigateTo({
  164. url: "../../login/login/login",
  165. });
  166. }
  167. },
  168. });
  169. }
  170. },
  171. // 获取用户详情
  172. getUserDetail() {
  173. getUserDetail().then((res) => {
  174. if (res.state == "Success") {
  175. this.userInfo = res.content;
  176. uni.setStorageSync("userInfo", JSON.stringify(this.userInfo));
  177. }
  178. });
  179. },
  180. jump(url) {
  181. if (!uni.getStorageSync("token")) {
  182. return uni.showModal({
  183. title: "请登录",
  184. confirmText: "去登录",
  185. success(res) {
  186. console.log(res);
  187. if (res.confirm) {
  188. uni.navigateTo({
  189. url: "../../login/login/login?redirect=/pages/my/index",
  190. });
  191. }
  192. },
  193. });
  194. }
  195. uni.navigateTo({
  196. url,
  197. });
  198. },
  199. },
  200. };
  201. </script>
  202. <style>
  203. page {
  204. background-color: #ffffff;
  205. }
  206. </style>
  207. <style lang="scss" scoped>
  208. .content {
  209. .profile-box {
  210. background: url("http://jbm.dev.zonelife.cn/img/background.png") no-repeat;
  211. background-size: 100% 100%;
  212. overflow: hidden;
  213. border-bottom-left-radius: 40% 5%;
  214. border-bottom-right-radius: 40% 5%;
  215. .header {
  216. display: flex;
  217. align-items: center;
  218. padding: 40rpx;
  219. height: 300rpx;
  220. .avatar {
  221. width: 150rpx;
  222. height: 150rpx;
  223. margin-top: -40rpx;
  224. .avatar-img {
  225. width: 100%;
  226. height: 100%;
  227. border-radius: 50%;
  228. }
  229. }
  230. }
  231. .info {
  232. margin-left: 20rpx;
  233. display: flex;
  234. margin-top: -40rpx;
  235. flex-direction: column;
  236. justify-content: center;
  237. .name {
  238. font-size: 35rpx;
  239. font-weight: bold;
  240. }
  241. .desc {
  242. margin-top: 20rpx;
  243. min-width: 85rpx;
  244. background: #8b8b8b;
  245. font-size: 20rpx;
  246. color: white;
  247. padding: 5rpx 10rpx;
  248. border-radius: 12px;
  249. }
  250. }
  251. }
  252. .vip-card {
  253. display: flex;
  254. justify-content: flex-end;
  255. margin: -88rpx 20rpx 0 20rpx;
  256. padding: 20rpx;
  257. height: 80rpx;
  258. color: white;
  259. background: url("http://jbm.dev.zonelife.cn/img/vip.png") no-repeat;
  260. background-size: 100% 100%;
  261. border-radius: 10px 10px 0 0;
  262. .vip-btn {
  263. background: #fde9c7;
  264. padding: 20rpx 40rpx;
  265. line-height: 20rpx;
  266. height: 21rpx;
  267. color: #d6a873;
  268. border-radius: 17px;
  269. font-size: 30rpx;
  270. }
  271. }
  272. .grid-text {
  273. font-size: 14px;
  274. color: #909399;
  275. padding: 10rpx 0 20rpx 0rpx;
  276. /* #ifndef APP-PLUS */
  277. box-sizing: border-box;
  278. /* #endif */
  279. }
  280. .setting:not(:nth-child(1)) {
  281. font-size: 30rpx;
  282. font-weight: bold;
  283. // margin-top: 40rpx;
  284. background-color: white;
  285. border-radius: 20px;
  286. .setting-cell {
  287. margin-top: 40rpx;
  288. }
  289. }
  290. .btn-box {
  291. position: fixed;
  292. bottom: 15%;
  293. margin-left: 20rpx;
  294. width: 90%;
  295. height: 80rpx;
  296. background-color: rgba(#000000, 0.2);
  297. color: black;
  298. padding-left: 30rpx;
  299. line-height: 80rpx;
  300. font-size: 30rpx;
  301. border-radius: 5px;
  302. }
  303. }
  304. </style>