my.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import { showTest } from '@/util/commonFunction.js'
  109. export default {
  110. data() {
  111. return {
  112. // 是否登录标识
  113. flag: false,
  114. // 用户信息
  115. userInfo: {},
  116. // 状态栏高度
  117. statusBarH: 0,
  118. // 胶囊按钮栏高度
  119. customBarH: 0,
  120. // 顶部页面标题栏显示隐藏控制
  121. headerType: false
  122. }
  123. },
  124. created() {
  125. // 获取系统信息
  126. uni.getSystemInfo({
  127. success: (e) => {
  128. // 获取状态栏高度
  129. this.statusBarH = e.statusBarHeight + 10
  130. // // 获取菜单按钮栏高度
  131. let custom = uni.getMenuButtonBoundingClientRect()
  132. this.customBarH = custom.height + 10
  133. }
  134. })
  135. },
  136. onPageScroll(e) {
  137. if (e.scrollTop > 50) {
  138. this.headerType = true
  139. } else {
  140. this.headerType = false
  141. }
  142. },
  143. onLoad() {
  144. uni.$on('changeFlag', this.changeFlag)
  145. },
  146. onShow() {
  147. let openid = uni.getStorageSync('openid')
  148. if (openid) {
  149. this.flag = true
  150. this.userInfo = uni.getStorageSync('userInfo')
  151. } else {
  152. this.flag = false
  153. }
  154. },
  155. methods: {
  156. // 跳转页面回调
  157. handleGoPage(url) {
  158. if (this.isLogin()) {
  159. uni.navigateTo({
  160. url
  161. })
  162. }
  163. },
  164. changeFlag(e) {
  165. // console.log(e)
  166. this.flag = e.data
  167. this.userInfo = uni.getStorageSync('userInfo')
  168. },
  169. // 去登录文字回调
  170. goPageLogin() {
  171. uni.navigateTo({
  172. url: '/pages/login/login'
  173. })
  174. },
  175. isLogin() {
  176. if (this.flag) {
  177. return true
  178. } else {
  179. uni.showToast({
  180. title: '请先登录',
  181. icon: 'none',
  182. mask: true
  183. })
  184. setTimeout(() => {
  185. uni.navigateTo({
  186. url: '/pages/login/login'
  187. })
  188. }, 1500)
  189. }
  190. },
  191. handleGoPageHome() {
  192. let userId = uni.getStorageSync('userInfo').id
  193. uni.navigateTo({
  194. url: `/pagesSub/myHome/myHome?userId=${userId}`
  195. })
  196. },
  197. handleShowTest() {
  198. showTest()
  199. },
  200. //购物车
  201. handleShowCar() {
  202. let userInfo = uni.getStorageSync('userInfo')
  203. let tokenId = uni.getStorageSync('tokenId')
  204. if (!userInfo || !tokenId) {
  205. uni.showModal({
  206. title: '提示',
  207. content: '您当前未登录,请授权登录查看社区信息',
  208. showCancel: false,
  209. success: (res) => {
  210. if (res.confirm) {
  211. uni.navigateTo({
  212. url: '/pages/login/login'
  213. })
  214. }
  215. }
  216. })
  217. } else {
  218. uni.navigateTo({
  219. url: '/packageShang/pages/tabbar/cart'
  220. })
  221. }
  222. },
  223. //收货地址
  224. handleShowAddress() {
  225. let userInfo = uni.getStorageSync('userInfo')
  226. let tokenId = uni.getStorageSync('tokenId')
  227. if (!userInfo || !tokenId) {
  228. uni.showModal({
  229. title: '提示',
  230. content: '您当前未登录,请授权登录查看社区信息',
  231. showCancel: false,
  232. success: (res) => {
  233. if (res.confirm) {
  234. uni.navigateTo({
  235. url: '/pages/login/login'
  236. })
  237. }
  238. }
  239. })
  240. } else {
  241. uni.navigateTo({
  242. url: '/packageShang/pages/user/address/address'
  243. })
  244. }
  245. },
  246. // 跳转到 订单
  247. toOrder(url, state) {
  248. let userInfo = uni.getStorageSync('userInfo')
  249. let tokenId = uni.getStorageSync('tokenId')
  250. if (!userInfo || !tokenId) {
  251. uni.showModal({
  252. title: '提示',
  253. content: '您当前未登录,请授权登录查看社区信息',
  254. showCancel: false,
  255. success: (res) => {
  256. if (res.confirm) {
  257. uni.navigateTo({
  258. url: '/pages/login/login'
  259. })
  260. }
  261. }
  262. })
  263. } else {
  264. uni.setStorage({
  265. key: '__order_state',
  266. data: state,
  267. success(res) {},
  268. complete() {
  269. uni.navigateTo({
  270. url
  271. })
  272. }
  273. })
  274. }
  275. },
  276. handleGoPageHelp() {
  277. uni.navigateTo({
  278. url: '/pagesSub/web/web?url=https://www.jinganrenjiams.com/app/'
  279. })
  280. }
  281. }
  282. }
  283. </script>
  284. <style lang="scss" scoped>
  285. .container {
  286. position: relative;
  287. min-height: 100vh;
  288. .title {
  289. z-index: 999;
  290. position: fixed;
  291. top: 0;
  292. left: 0;
  293. right: 0;
  294. font-size: 28rpx;
  295. color: #fff;
  296. text-align: center;
  297. }
  298. .header {
  299. position: relative;
  300. height: 480rpx;
  301. color: #fff;
  302. overflow: hidden;
  303. img {
  304. width: 100%;
  305. }
  306. .img {
  307. position: absolute;
  308. top: 190rpx;
  309. left: 32rpx;
  310. width: 140rpx;
  311. height: 140rpx;
  312. border-radius: 50%;
  313. }
  314. .name {
  315. position: absolute;
  316. top: 200rpx;
  317. left: 202rpx;
  318. font-size: 40rpx;
  319. font-weight: bold;
  320. }
  321. .number {
  322. position: absolute;
  323. top: 265rpx;
  324. left: 202rpx;
  325. font-size: 24rpx;
  326. opacity: 0.5;
  327. }
  328. .real {
  329. position: absolute;
  330. top: 285rpx;
  331. left: 202rpx;
  332. display: flex;
  333. align-items: center;
  334. box-sizing: border-box;
  335. padding-left: 13rpx;
  336. width: 179rpx;
  337. height: 42rpx;
  338. font-size: 24rpx;
  339. border-radius: 113rpx;
  340. background-color: rgba(255, 255, 255, 0.2);
  341. img {
  342. margin-right: 7rpx;
  343. width: 24rpx;
  344. height: 24rpx;
  345. }
  346. }
  347. .real2 {
  348. position: absolute;
  349. top: 285rpx;
  350. left: 202rpx;
  351. display: flex;
  352. justify-content: center;
  353. align-items: center;
  354. box-sizing: border-box;
  355. padding-left: 13rpx;
  356. padding-bottom: 5rpx;
  357. width: 179rpx;
  358. height: 42rpx;
  359. font-size: 24rpx;
  360. border-radius: 113rpx;
  361. background-color: rgba(255, 255, 255, 0.2);
  362. img {
  363. margin-left: 12rpx;
  364. width: 24rpx;
  365. height: 24rpx;
  366. }
  367. }
  368. .login {
  369. position: absolute;
  370. top: 235rpx;
  371. left: 202rpx;
  372. font-size: 40rpx;
  373. font-weight: bold;
  374. }
  375. }
  376. .body {
  377. position: absolute;
  378. top: 360rpx;
  379. width: 100%;
  380. min-height: calc(100vh - 360rpx);
  381. border-radius: 20rpx 20rpx 0 0;
  382. background-color: #f7f7f7;
  383. .myOrder {
  384. padding: 0 30rpx;
  385. margin-bottom: 23rpx;
  386. height: 224rpx;
  387. border-radius: 20rpx;
  388. background-color: #fff;
  389. .myOrder_header {
  390. display: flex;
  391. align-items: flex-end;
  392. height: 64rpx;
  393. .header_img {
  394. width: 42rpx;
  395. height: 42rpx;
  396. }
  397. .header_title {
  398. display: flex;
  399. align-items: flex-end;
  400. height: 64rpx;
  401. font-size: 32rpx;
  402. font-weight: bold;
  403. }
  404. .header_more {
  405. display: flex;
  406. align-items: center;
  407. margin-left: auto;
  408. font-size: 24rpx;
  409. color: #b3b3b3;
  410. .more_img {
  411. margin-top: -5rpx;
  412. margin-left: 10rpx;
  413. width: 30rpx;
  414. height: 30rpx;
  415. }
  416. }
  417. }
  418. .myOrder_list {
  419. display: flex;
  420. justify-content: space-around;
  421. height: 160rpx;
  422. .list_box {
  423. display: flex;
  424. flex-direction: column;
  425. justify-content: center;
  426. align-items: center;
  427. width: 140rpx;
  428. .box_img {
  429. width: 50rpx;
  430. height: 50rpx;
  431. }
  432. .box_text {
  433. margin-top: 10rpx;
  434. color: #808080;
  435. font-size: 24rpx;
  436. }
  437. }
  438. }
  439. }
  440. .body_box {
  441. padding: 0 30rpx;
  442. margin-bottom: 23rpx;
  443. border-radius: 20rpx 20rpx 0 0;
  444. background-color: #fff;
  445. .box_title {
  446. display: flex;
  447. align-items: flex-end;
  448. height: 64rpx;
  449. font-size: 32rpx;
  450. font-weight: bold;
  451. }
  452. .box_list {
  453. display: grid;
  454. grid-template-columns: repeat(4, 1fr);
  455. grid-auto-rows: 160rpx;
  456. .item_box {
  457. display: flex;
  458. flex-direction: column;
  459. justify-content: center;
  460. align-items: center;
  461. .box_img {
  462. width: 50rpx;
  463. height: 50rpx;
  464. }
  465. .box_text {
  466. margin-top: 10rpx;
  467. color: #333333;
  468. font-size: 28rpx;
  469. }
  470. }
  471. }
  472. }
  473. }
  474. }
  475. </style>