index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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">
  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 20rpx 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: "activityManage",
  123. title: "活动管理",
  124. // path: "../../my/activityManage/index",
  125. },
  126. {
  127. name: "location",
  128. title: "收货地址",
  129. },
  130. {
  131. name: "heart",
  132. title: "我的收藏",
  133. },
  134. {
  135. name: "coupon",
  136. title: "我的优惠券",
  137. path: "../../pay/coupon",
  138. },
  139. ],
  140. };
  141. },
  142. created() {
  143. this.navBarHeight = this.$navHight();
  144. },
  145. onShow() {
  146. this.init();
  147. },
  148. methods: {
  149. edit() {
  150. if (uni.getStorageSync("token")) {
  151. uni.navigateTo({
  152. url: "../../my/edit/edit",
  153. });
  154. } else {
  155. uni.showModal({
  156. title: "请登录",
  157. confirmText: "去登录",
  158. success(res) {
  159. console.log(res);
  160. if (res.confirm) {
  161. uni.navigateTo({
  162. url: "../../login/login/login?redirect=/pages/my/index",
  163. });
  164. }
  165. },
  166. });
  167. }
  168. },
  169. init() {
  170. if (uni.getStorageSync("token")) {
  171. this.getUserDetail();
  172. } else {
  173. (this.userInfo = {
  174. imgPath: null,
  175. lastLogin: "",
  176. level: null,
  177. nickname: null,
  178. openId: "",
  179. phoneNum: "",
  180. sex: 0,
  181. userId: "",
  182. valid: 0,
  183. }),
  184. uni.showModal({
  185. title: "请登录",
  186. confirmText: "去登录",
  187. success(res) {
  188. console.log(res);
  189. if (res.confirm) {
  190. uni.navigateTo({
  191. url: "../../login/login/login",
  192. });
  193. }
  194. },
  195. });
  196. }
  197. },
  198. // 获取用户详情
  199. getUserDetail() {
  200. getUserDetail().then((res) => {
  201. if (res.state == "Success") {
  202. this.userInfo = res.content;
  203. uni.setStorageSync("userInfo", JSON.stringify(this.userInfo));
  204. }
  205. });
  206. },
  207. jump(url) {
  208. if (!uni.getStorageSync("token")) {
  209. return uni.showModal({
  210. title: "请登录",
  211. confirmText: "去登录",
  212. success(res) {
  213. console.log(res);
  214. if (res.confirm) {
  215. uni.navigateTo({
  216. url: "../../login/login/login?redirect=/pages/my/index",
  217. });
  218. }
  219. },
  220. });
  221. }
  222. uni.navigateTo({
  223. url,
  224. });
  225. },
  226. },
  227. };
  228. </script>
  229. <style>
  230. page {
  231. background-color: #ffffff;
  232. }
  233. </style>
  234. <style lang="scss" scoped>
  235. .content {
  236. .profile-box {
  237. background: url("https://oss.dev.zonelife.cn/static/guida/img/my/background.png") no-repeat;
  238. background-size: 100% 100%;
  239. overflow: hidden;
  240. border-bottom-left-radius: 40% 5%;
  241. border-bottom-right-radius: 40% 5%;
  242. .header {
  243. display: flex;
  244. align-items: center;
  245. padding: 40rpx;
  246. height: 300rpx;
  247. .avatar {
  248. width: 150rpx;
  249. height: 150rpx;
  250. margin-top: -40rpx;
  251. .avatar-img {
  252. width: 100%;
  253. height: 100%;
  254. border-radius: 50%;
  255. }
  256. }
  257. }
  258. .info {
  259. margin-left: 20rpx;
  260. display: flex;
  261. margin-top: -40rpx;
  262. flex-direction: column;
  263. justify-content: center;
  264. .name {
  265. font-size: 35rpx;
  266. font-weight: bold;
  267. }
  268. .desc {
  269. margin-top: 20rpx;
  270. min-width: 85rpx;
  271. background: #8b8b8b;
  272. font-size: 20rpx;
  273. color: white;
  274. padding: 5rpx 10rpx;
  275. border-radius: 12px;
  276. }
  277. }
  278. }
  279. .vip-card {
  280. display: flex;
  281. justify-content: flex-end;
  282. margin: -88rpx 20rpx 0 20rpx;
  283. padding: 20rpx;
  284. height: 80rpx;
  285. color: white;
  286. background: url("https://oss.dev.zonelife.cn/static/guida/img/my/vip.png") no-repeat;
  287. background-size: 100% 100%;
  288. border-radius: 10px 10px 0 0;
  289. .vip-btn {
  290. background: #fde9c7;
  291. padding: 20rpx 40rpx;
  292. line-height: 20rpx;
  293. height: 21rpx;
  294. color: #d6a873;
  295. border-radius: 17px;
  296. font-size: 30rpx;
  297. }
  298. }
  299. .grid-text {
  300. font-size: 14px;
  301. color: #909399;
  302. padding: 10rpx 0 20rpx 0rpx;
  303. /* #ifndef APP-PLUS */
  304. box-sizing: border-box;
  305. /* #endif */
  306. }
  307. .setting:not(:nth-child(1)) {
  308. font-size: 30rpx;
  309. font-weight: bold;
  310. // margin-top: 40rpx;
  311. background-color: white;
  312. border-radius: 20px;
  313. .setting-cell {
  314. margin-top: 40rpx;
  315. }
  316. }
  317. .btn-box {
  318. position: fixed;
  319. bottom: 15%;
  320. margin-left: 20rpx;
  321. width: 90%;
  322. height: 80rpx;
  323. background-color: rgba(#000000, 0.2);
  324. color: black;
  325. padding-left: 30rpx;
  326. line-height: 80rpx;
  327. font-size: 30rpx;
  328. border-radius: 5px;
  329. }
  330. }
  331. </style>