index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view class="my">
  3. <view class="top-box">
  4. <view class="user-info">
  5. <image class="image" :src="userInfo.imgPath || defaultImg" lazy-load mode=""></image>
  6. <view class="info">
  7. <view class="user-name">{{userInfo.nickname ||'用户'}}</view>
  8. <view class="tel">{{userInfo.phoneNum ||'-'}}</view>
  9. </view>
  10. <u-icon name="setting" class="stting" color="#FFF" size="38"
  11. @click="setting"></u-icon>
  12. </view>
  13. <view class="btn-group">
  14. <view class="item" @click="jump('../../my/order/index')">
  15. <image class="icon" src="../../static/icon1.png" mode=""></image>
  16. <view class="label">
  17. 我的订单
  18. </view>
  19. </view>
  20. <view class="item" @click="jump('../../my/card/index')">
  21. <image class="icon" src="../../static/icon2.png" mode=""></image>
  22. <view class="label">
  23. 我的权益
  24. </view>
  25. </view>
  26. <view class="item" @click="jump('../../my/favorite/index')">
  27. <image class="icon" src="../../static/icon3.png" mode=""></image>
  28. <view class="label">
  29. 我的收藏
  30. </view>
  31. </view>
  32. <view class="item" @click="jump('../../integral/store')">
  33. <image class="icon" src="../../static/icon4.png" mode=""></image>
  34. <view class="label">
  35. 我的积分
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="box-title">
  41. 商家推荐
  42. </view>
  43. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  44. <view class="left">
  45. <view class="store-item" v-for="(item,index) in list" :key="index" @click="goShopDetail(item)">
  46. <!-- <image class="icon" mode="" :src="item.src"> -->
  47. <zs-img :src="item.src" width="335rpx" mode="widthFix" ></zs-img>
  48. <view class="info">
  49. <view class="title">
  50. {{item.title}}
  51. </view>
  52. <view class="address">
  53. <image class="position" src="../../static/position.png" mode=""></image>
  54. {{item.distance}}km
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="right">
  60. <view class="store-item" v-for="(item,index) in list1" :key="index" @click="goShopDetail(item)">
  61. <!-- <image class="icon" mode="" :src="item.src"> -->
  62. <zs-img :src="item.src" width="335rpx" mode="widthFix" ></zs-img>
  63. <view class="info">
  64. <view class="title">
  65. {{item.title}}
  66. </view>
  67. <view class="address">
  68. <image class="position" src="../../static/position.png" mode=""></image>
  69. {{item.distance}}km
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </zs-list>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. getUserDetail
  80. } from '@/api/common.js'
  81. export default {
  82. data() {
  83. return {
  84. keyword: '',
  85. userId: '',
  86. loading: false,
  87. status: 'more',
  88. defaultImg:'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',
  89. userInfo: {
  90. imgPath: null,
  91. lastLogin: "",
  92. level: null,
  93. nickname: null,
  94. openId: "",
  95. phoneNum: "",
  96. sex: 0,
  97. userId: "",
  98. valid: 0
  99. },
  100. list: [{
  101. src: 'https://mstatic.gzstv.com/media/images/2021/06/09/w1nrZC8_x-PQ.jpg',
  102. title: '万安加油站(中石化)',
  103. distance: 13.62
  104. },
  105. {
  106. src: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fss2.meipian.me%2Fusers%2F159660028%2Fb327e4a2a3e1473a82e2a53b5a5d2db2.jpeg%3Fmeipian-raw%2Fbucket%2Fivwen%2Fkey%2FdXNlcnMvMTU5NjYwMDI4L2IzMjdlNGEyYTNlMTQ3M2E4MmUyYTUzYjVhNWQyZGIyLmpwZWc%3D%2Fsign%2Fcec9ce1dfb5e0c3e627e30fb099899da.jpg&refer=http%3A%2F%2Fss2.meipian.me&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1693560973&t=7b7dfb1cbf6a6759e70f868c894888c9',
  107. title: '万安加油站(中石化)',
  108. distance: 13.62
  109. },
  110. {
  111. id: 3,
  112. src:'https://img-md.veimg.cn/meadinindex/img5/2021/11/69F51D249ADA446EB5507352AA4ABD6E.jpg',
  113. title: '贵阳万丽酒店',
  114. distance: 5.23,
  115. },
  116. ],
  117. list1: [
  118. {
  119. id: 3,
  120. src:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fc7481b97-86a3-4aba-8d2c-d3c84d7ce831%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695542967&t=fe7462e4fc56e50b98013b198043278d',
  121. title: '黄果树瀑布',
  122. distance: 5.23,
  123. },
  124. {
  125. id: 3,
  126. src:'https://alipic.lanhuapp.com/XDSlicePNGMAXdb1c28750d2e8f45e7509c176f186600d2bafe09de15a8107b168c078801e1e7.png',
  127. title: '微笑牙科诊所',
  128. distance: 5.23,
  129. },
  130. {
  131. id: 2,
  132. src:'https://img2.baidu.com/it/u=242243300,1128843585&fm=253&fmt=auto&app=138&f=JPEG?w=696&h=500',
  133. title: '泊斯曼酒店',
  134. distance: 5.23,
  135. },
  136. ]
  137. }
  138. },
  139. onShow() {
  140. if (uni.getStorageSync('token')) {
  141. this.getUserDetail()
  142. }
  143. },
  144. onLoad() {
  145. },
  146. methods: {
  147. setting(){
  148. if(uni.getStorageSync('token')){
  149. uni.navigateTo({
  150. url:'../../my/edit/edit'
  151. })
  152. }else{
  153. uni.showToast({
  154. title:'请先登录',
  155. icon:'error'
  156. })
  157. }
  158. },
  159. loadMore() {
  160. // this.status = 'loading'
  161. // setTimeout(() => {
  162. // this.status = 'more'
  163. // this.list.push({
  164. // src: 'https://img2.baidu.com/it/u=3177584174,2077949726&fm=253&fmt=auto&app=120&f=JPEG?w=540&h=360',
  165. // title: '万安加油站(中石化)',
  166. // distance: 13.62
  167. // })
  168. // }, 1000)
  169. },
  170. jump(url) {
  171. uni.navigateTo({
  172. url
  173. })
  174. },
  175. goShopDetail(item) {
  176. uni.setStorageSync('shopInfo', JSON.stringify(item))
  177. uni.navigateTo({
  178. url: `../../detail/shopDetail/shopDetail`
  179. })
  180. },
  181. // 获取用户详情
  182. getUserDetail() {
  183. getUserDetail().then(res => {
  184. this.userInfo = res.content
  185. uni.setStorageSync('userInfo', JSON.stringify(this.userInfo))
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss">
  192. .my {
  193. height: 100vh;
  194. padding: 0 30rpx;
  195. background: #F9F9F9;
  196. .top-box {
  197. width: 750rpx;
  198. margin-left: -30rpx;
  199. padding: 150rpx 30rpx 0;
  200. box-sizing: border-box;
  201. background: url('../../static/top-bg.png') no-repeat;
  202. background-size: 100% 433rpx;
  203. .user-info {
  204. display: flex;
  205. align-items: center;
  206. justify-content: space-between;
  207. padding: 15rpx 0;
  208. color: #fff;
  209. .image {
  210. width: 108rpx;
  211. height: 108rpx;
  212. background: #f1f1f1;
  213. border-radius: 50%;
  214. }
  215. .info {
  216. flex: 1;
  217. margin-left: 30rpx;
  218. .user-name {
  219. font-size: 32rpx;
  220. font-weight: bold;
  221. }
  222. .tel {
  223. font-size: 24rpx;
  224. margin-top: 10rpx;
  225. }
  226. }
  227. .setting {}
  228. }
  229. .btn-group {
  230. display: flex;
  231. align-items: center;
  232. padding: 40rpx 20rpx;
  233. margin-top: 20rpx;
  234. border-radius: 16rpx;
  235. background: #fff;
  236. .item {
  237. flex: 1;
  238. display: flex;
  239. flex-direction: column;
  240. align-items: center;
  241. .icon {
  242. width: 80rpx;
  243. height: 80rpx;
  244. }
  245. .label {
  246. margin-top: 15rpx;
  247. font-size: 24rpx;
  248. color: #121212;
  249. }
  250. }
  251. }
  252. }
  253. .box-title {
  254. font-size: 34rpx;
  255. padding: 20rpx 0;
  256. font-weight: bold;
  257. }
  258. .zs-list {
  259. display: flex;
  260. flex-wrap: wrap;
  261. justify-content: space-between;
  262. .store-item {
  263. width: 335rpx;
  264. margin-bottom: 25rpx;
  265. box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0, 0, 0, 0.08);
  266. .icon {
  267. width: 100%;
  268. height: 300rpx;
  269. border-radius: 16rpx 16rpx 0 0;
  270. }
  271. .info {
  272. padding: 20rpx;
  273. background: #fff;
  274. border-radius: 0 0 16rpx 16rpx;
  275. .title {
  276. font-weight: bold;
  277. }
  278. .address {
  279. display: flex;
  280. align-items: center;
  281. margin-top: 15rpx;
  282. color: #999;
  283. .position{
  284. width: 25rpx;
  285. height: 29rpx;
  286. margin-right: 8rpx;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. </style>