index.vue 8.1 KB

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