my.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <view class="container">
  3. <!-- 页面标题 -->
  4. <view class="title" :style="{ height: customBarH * 2 + 'rpx', top: statusBarH * 2 + 'rpx' }" v-if="!headerType">我的</view>
  5. <view class="title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx', backgroundColor: '#fff', color: '#000' }" v-else>我的</view>
  6. <!-- 顶部用户信息区域 -->
  7. <view class="header">
  8. <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/18.png" />
  9. <!-- 头像区域 -->
  10. <img class="img" mode="aspectFill" v-if="flag" :src="userInfo.headPhoto" />
  11. <img class="img" v-else src="../../static/my/portrait.png" />
  12. <!-- 姓名区域 -->
  13. <view class="name" v-if="flag">{{ userInfo.user_name }}</view>
  14. <!-- 用户id区域 -->
  15. <view class="number" v-if="flag">ID:{{ userInfo.id }}</view>
  16. <view class="login" v-if="!flag" @click="goPageLogin">去登录</view>
  17. </view>
  18. <!-- 内容区域 -->
  19. <view class="body">
  20. <!-- 民宿管理区域 -->
  21. <view class="body_box">
  22. <view class="box_title">民宿管理</view>
  23. <view class="box_list">
  24. <view class="item_box" @click="handleGoPage('/pages/orderManage/orderManage')">
  25. <img class="box_img" src="../../static/my/order.png" />
  26. <view class="box_text">订单管理</view>
  27. </view>
  28. <view class="item_box" @click="handleGoPage('/pagesSub/myEvaluate/myEvaluate')">
  29. <img class="box_img" src="../../static/my/evaluate.png" />
  30. <view class="box_text">我的评价</view>
  31. </view>
  32. <view class="item_box" @click="handleGoPage('/pagesSub/myComplaint/myComplaint')">
  33. <img class="box_img" src="../../static/my/complaint.png" />
  34. <view class="box_text">投诉进度</view>
  35. </view>
  36. <view class="item_box" @click="handleGoPage('/pagesSub/collect/collect')">
  37. <img class="box_img" src="../../static/my/collect.png" />
  38. <view class="box_text">收藏/住过</view>
  39. </view>
  40. <view class="item_box" @click="handleGoPage('/pagesSub/myCoupon/myCoupon')">
  41. <img class="box_img" src="../../static/my/coupon.png" />
  42. <view class="box_text">我的卡券</view>
  43. </view>
  44. <view class="item_box" @click="handleGoPage('/pagesSub/common/common')">
  45. <img class="box_img" src="../../static/my/people.png" />
  46. <view class="box_text">常用旅客</view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 我的订单区域 -->
  51. <view class="myOrder">
  52. <view class="myOrder_header">
  53. <view class="header_title">商城订单</view>
  54. <view class="header_more" @click="toOrder('/packageShang/pages/user/order/order', '全部')">
  55. 全部订单
  56. <img class="more_img" src="../../static/my/right.png" />
  57. </view>
  58. </view>
  59. <view class="myOrder_list">
  60. <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待付款')">
  61. <img class="box_img" src="../../static/my/myorder.png" />
  62. <view class="box_text">待付款</view>
  63. </view>
  64. <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待发货')">
  65. <img class="box_img" src="../../static/my/myorder2.png" />
  66. <view class="box_text">待发货</view>
  67. </view>
  68. <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待收货')">
  69. <img class="box_img" src="../../static/my/myorder3.png" />
  70. <view class="box_text">待收货</view>
  71. </view>
  72. <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待评价')">
  73. <img class="box_img" src="../../static/my/myorder4.png" />
  74. <view class="box_text">待评价</view>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 常用工具区域 -->
  79. <view class="body_box">
  80. <view class="box_title">常用工具</view>
  81. <view class="box_list">
  82. <view class="item_box" @click="handleShowCar">
  83. <img class="box_img" src="../../static/my/shopcar.png" />
  84. <view class="box_text">购物车</view>
  85. </view>
  86. <view class="item_box" @click="handleShowAddress">
  87. <img class="box_img" src="../../static/my/address.png" />
  88. <view class="box_text">收货地址</view>
  89. </view>
  90. <view class="item_box" @click="handleGoPageHome">
  91. <img class="box_img" src="../../static/my/center.png" />
  92. <view class="box_text">个人主页</view>
  93. </view>
  94. <view class="item_box" @click="handleGoPage('/pagesSub/set/set')">
  95. <img class="box_img" src="../../static/my/set.png" />
  96. <view class="box_text">设置</view>
  97. </view>
  98. <view class="item_box" @click="handleGoPageHelp">
  99. <img class="box_img" src="../../static/my/help.png" />
  100. <view class="box_text">操作手册</view>
  101. </view>
  102. <view class="item_box" @click="handleGoPageLevel">
  103. <img class="box_img" src="../../static/my/level.png" />
  104. <view class="box_text">等级介绍</view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </template>
  111. <script>
  112. import { showTest } from '@/util/commonFunction.js'
  113. export default {
  114. data() {
  115. return {
  116. // 是否登录标识
  117. flag: false,
  118. // 用户信息
  119. userInfo: {},
  120. // 状态栏高度
  121. statusBarH: 0,
  122. // 胶囊按钮栏高度
  123. customBarH: 0,
  124. // 顶部页面标题栏显示隐藏控制
  125. headerType: false
  126. }
  127. },
  128. created() {
  129. // 获取系统信息
  130. uni.getSystemInfo({
  131. success: (e) => {
  132. // 获取状态栏高度
  133. this.statusBarH = e.statusBarHeight + 10
  134. // // 获取菜单按钮栏高度
  135. let custom = uni.getMenuButtonBoundingClientRect()
  136. this.customBarH = custom.height + 10
  137. }
  138. })
  139. },
  140. onPageScroll(e) {
  141. if (e.scrollTop > 50) {
  142. this.headerType = true
  143. } else {
  144. this.headerType = false
  145. }
  146. },
  147. onLoad() {
  148. uni.$on('changeFlag', this.changeFlag)
  149. },
  150. onShow() {
  151. let openid = uni.getStorageSync('openid')
  152. if (openid) {
  153. this.flag = true
  154. this.userInfo = uni.getStorageSync('userInfo')
  155. } else {
  156. this.flag = false
  157. }
  158. },
  159. methods: {
  160. // 跳转页面回调
  161. handleGoPage(url) {
  162. if (this.isLogin()) {
  163. uni.navigateTo({
  164. url
  165. })
  166. }
  167. },
  168. changeFlag(e) {
  169. // console.log(e)
  170. this.flag = e.data
  171. this.userInfo = uni.getStorageSync('userInfo')
  172. },
  173. // 去登录文字回调
  174. goPageLogin() {
  175. uni.navigateTo({
  176. url: '/pages/login/login'
  177. })
  178. },
  179. isLogin() {
  180. if (this.flag) {
  181. return true
  182. } else {
  183. uni.showToast({
  184. title: '请先登录',
  185. icon: 'none',
  186. mask: true
  187. })
  188. setTimeout(() => {
  189. uni.navigateTo({
  190. url: '/pages/login/login'
  191. })
  192. }, 1500)
  193. }
  194. },
  195. handleGoPageHome() {
  196. let userId = uni.getStorageSync('userInfo').id
  197. uni.navigateTo({
  198. url: `/pagesSub/myHome/myHome?userId=${userId}`
  199. })
  200. },
  201. handleShowTest() {
  202. showTest()
  203. },
  204. //购物车
  205. handleShowCar() {
  206. let userInfo = uni.getStorageSync('userInfo')
  207. let tokenId = uni.getStorageSync('tokenId')
  208. if (!userInfo || !tokenId) {
  209. uni.showModal({
  210. title: '提示',
  211. content: '您当前未登录,请授权登录查看社区信息',
  212. showCancel: false,
  213. success: (res) => {
  214. if (res.confirm) {
  215. uni.navigateTo({
  216. url: '/pages/login/login'
  217. })
  218. }
  219. }
  220. })
  221. } else {
  222. uni.navigateTo({
  223. url: '/packageShang/pages/tabbar/cart'
  224. })
  225. }
  226. },
  227. //收货地址
  228. handleShowAddress() {
  229. let userInfo = uni.getStorageSync('userInfo')
  230. let tokenId = uni.getStorageSync('tokenId')
  231. if (!userInfo || !tokenId) {
  232. uni.showModal({
  233. title: '提示',
  234. content: '您当前未登录,请授权登录查看社区信息',
  235. showCancel: false,
  236. success: (res) => {
  237. if (res.confirm) {
  238. uni.navigateTo({
  239. url: '/pages/login/login'
  240. })
  241. }
  242. }
  243. })
  244. } else {
  245. uni.navigateTo({
  246. url: '/packageShang/pages/user/address/address'
  247. })
  248. }
  249. },
  250. // 跳转到 订单
  251. toOrder(url, state) {
  252. let userInfo = uni.getStorageSync('userInfo')
  253. let tokenId = uni.getStorageSync('tokenId')
  254. if (!userInfo || !tokenId) {
  255. uni.showModal({
  256. title: '提示',
  257. content: '您当前未登录,请授权登录查看社区信息',
  258. showCancel: false,
  259. success: (res) => {
  260. if (res.confirm) {
  261. uni.navigateTo({
  262. url: '/pages/login/login'
  263. })
  264. }
  265. }
  266. })
  267. } else {
  268. uni.setStorage({
  269. key: '__order_state',
  270. data: state,
  271. success(res) {},
  272. complete() {
  273. uni.navigateTo({
  274. url
  275. })
  276. }
  277. })
  278. }
  279. },
  280. handleGoPageHelp() {
  281. uni.navigateTo({
  282. url: '/pagesSub/web/web?url=https://www.jinganrenjiams.com/app/'
  283. })
  284. },
  285. handleGoPageLevel() {
  286. uni.navigateTo({
  287. url: '/pagesSub/level/level'
  288. })
  289. }
  290. }
  291. }
  292. </script>
  293. <style lang="scss" scoped>
  294. .container {
  295. position: relative;
  296. min-height: 100vh;
  297. .title {
  298. z-index: 999;
  299. position: fixed;
  300. top: 0;
  301. left: 0;
  302. right: 0;
  303. font-size: 28rpx;
  304. color: #fff;
  305. text-align: center;
  306. }
  307. .header {
  308. position: relative;
  309. height: 480rpx;
  310. color: #fff;
  311. overflow: hidden;
  312. img {
  313. width: 100%;
  314. }
  315. .img {
  316. position: absolute;
  317. top: 190rpx;
  318. left: 32rpx;
  319. width: 140rpx;
  320. height: 140rpx;
  321. border-radius: 50%;
  322. }
  323. .name {
  324. position: absolute;
  325. top: 200rpx;
  326. left: 202rpx;
  327. font-size: 40rpx;
  328. font-weight: bold;
  329. }
  330. .number {
  331. position: absolute;
  332. top: 265rpx;
  333. left: 202rpx;
  334. font-size: 24rpx;
  335. opacity: 0.5;
  336. }
  337. .real {
  338. position: absolute;
  339. top: 285rpx;
  340. left: 202rpx;
  341. display: flex;
  342. align-items: center;
  343. box-sizing: border-box;
  344. padding-left: 13rpx;
  345. width: 179rpx;
  346. height: 42rpx;
  347. font-size: 24rpx;
  348. border-radius: 113rpx;
  349. background-color: rgba(255, 255, 255, 0.2);
  350. img {
  351. margin-right: 7rpx;
  352. width: 24rpx;
  353. height: 24rpx;
  354. }
  355. }
  356. .real2 {
  357. position: absolute;
  358. top: 285rpx;
  359. left: 202rpx;
  360. display: flex;
  361. justify-content: center;
  362. align-items: center;
  363. box-sizing: border-box;
  364. padding-left: 13rpx;
  365. padding-bottom: 5rpx;
  366. width: 179rpx;
  367. height: 42rpx;
  368. font-size: 24rpx;
  369. border-radius: 113rpx;
  370. background-color: rgba(255, 255, 255, 0.2);
  371. img {
  372. margin-left: 12rpx;
  373. width: 24rpx;
  374. height: 24rpx;
  375. }
  376. }
  377. .login {
  378. position: absolute;
  379. top: 235rpx;
  380. left: 202rpx;
  381. font-size: 40rpx;
  382. font-weight: bold;
  383. }
  384. }
  385. .body {
  386. position: absolute;
  387. top: 360rpx;
  388. width: 100%;
  389. min-height: calc(100vh - 360rpx);
  390. border-radius: 20rpx 20rpx 0 0;
  391. background-color: #f7f7f7;
  392. .myOrder {
  393. padding: 0 30rpx;
  394. margin-bottom: 23rpx;
  395. height: 224rpx;
  396. border-radius: 20rpx;
  397. background-color: #fff;
  398. .myOrder_header {
  399. display: flex;
  400. align-items: flex-end;
  401. height: 64rpx;
  402. .header_img {
  403. width: 42rpx;
  404. height: 42rpx;
  405. }
  406. .header_title {
  407. display: flex;
  408. align-items: flex-end;
  409. height: 64rpx;
  410. font-size: 32rpx;
  411. font-weight: bold;
  412. }
  413. .header_more {
  414. display: flex;
  415. align-items: center;
  416. margin-left: auto;
  417. font-size: 24rpx;
  418. color: #b3b3b3;
  419. .more_img {
  420. margin-top: -5rpx;
  421. margin-left: 10rpx;
  422. width: 30rpx;
  423. height: 30rpx;
  424. }
  425. }
  426. }
  427. .myOrder_list {
  428. display: flex;
  429. justify-content: space-around;
  430. height: 160rpx;
  431. .list_box {
  432. display: flex;
  433. flex-direction: column;
  434. justify-content: center;
  435. align-items: center;
  436. width: 140rpx;
  437. .box_img {
  438. width: 50rpx;
  439. height: 50rpx;
  440. }
  441. .box_text {
  442. margin-top: 10rpx;
  443. color: #808080;
  444. font-size: 24rpx;
  445. }
  446. }
  447. }
  448. }
  449. .body_box {
  450. padding: 0 30rpx;
  451. margin-bottom: 23rpx;
  452. border-radius: 20rpx 20rpx 0 0;
  453. background-color: #fff;
  454. .box_title {
  455. display: flex;
  456. align-items: flex-end;
  457. height: 64rpx;
  458. font-size: 32rpx;
  459. font-weight: bold;
  460. }
  461. .box_list {
  462. display: grid;
  463. grid-template-columns: repeat(4, 1fr);
  464. grid-auto-rows: 160rpx;
  465. .item_box {
  466. display: flex;
  467. flex-direction: column;
  468. justify-content: center;
  469. align-items: center;
  470. .box_img {
  471. width: 50rpx;
  472. height: 50rpx;
  473. }
  474. .box_text {
  475. margin-top: 10rpx;
  476. color: #333333;
  477. font-size: 28rpx;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. }
  484. </style>