| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521 |
- <template>
- <view class="container">
- <!-- 页面标题 -->
- <view class="title" :style="{ height: customBarH * 2 + 'rpx', top: statusBarH * 2 + 'rpx' }" v-if="!headerType">我的</view>
- <view class="title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx', backgroundColor: '#fff', color: '#000' }" v-else>我的</view>
- <!-- 顶部用户信息区域 -->
- <view class="header">
- <img src="https://jinganminsu-1320402385.cos.ap-nanjing.myqcloud.com/static//20240523163442_12.png" />
- <!-- 头像区域 -->
- <img class="img" mode="aspectFill" v-if="flag" :src="userInfo.headPhoto" />
- <img class="img" v-else src="../../static/my/portrait.png" />
- <!-- 姓名区域 -->
- <view class="name" v-if="flag">{{ userInfo.user_name }}</view>
- <!-- 用户id区域 -->
- <view class="number" v-if="flag">ID:{{ userInfo.id }}</view>
- <view class="login" v-if="!flag" @click="goPageLogin">去登录</view>
- </view>
- <!-- 内容区域 -->
- <view class="body">
- <!-- 民宿管理区域 -->
- <view class="body_box">
- <view class="box_title">乡村民宿管理</view>
- <view class="box_list">
- <view class="item_box" @click="handleGoPage('/pages/orderManage/orderManage')">
- <img class="box_img" src="../../static/my/order.png" />
- <view class="box_text">订单管理</view>
- </view>
- <view class="item_box" @click="handleGoPage('/pagesSub/myEvaluate/myEvaluate')">
- <img class="box_img" src="../../static/my/evaluate.png" />
- <view class="box_text">我的评价</view>
- </view>
- <view class="item_box" @click="handleGoPage('/pagesSub/myComplaint/myComplaint')">
- <img class="box_img" src="../../static/my/complaint.png" />
- <view class="box_text">投诉进度</view>
- </view>
- <view class="item_box" @click="handleGoPage('/pagesSub/collect/collect')">
- <img class="box_img" src="../../static/my/collect.png" />
- <view class="box_text">收藏/住过</view>
- </view>
- <view class="item_box" @click="handleGoPage('/pagesSub/myCoupon/myCoupon')">
- <img class="box_img" src="../../static/my/coupon.png" />
- <view class="box_text">我的卡券</view>
- </view>
- <view class="item_box" @click="handleGoPage('/pagesSub/common/common')">
- <img class="box_img" src="../../static/my/people.png" />
- <view class="box_text">常用旅客</view>
- </view>
- </view>
- </view>
- <!-- 我的订单区域 -->
- <view class="myOrder">
- <view class="myOrder_header">
- <view class="header_title">商城订单</view>
- <view class="header_more" @click="toOrder('/packageShang/pages/user/order/order', '全部')">
- 全部订单
- <img class="more_img" src="../../static/my/right.png" />
- </view>
- </view>
- <view class="myOrder_list">
- <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待付款')">
- <img class="box_img" src="../../static/my/myorder.png" />
- <view class="box_text">待付款</view>
- </view>
- <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待发货')">
- <img class="box_img" src="../../static/my/myorder2.png" />
- <view class="box_text">待发货</view>
- </view>
- <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待收货')">
- <img class="box_img" src="../../static/my/myorder3.png" />
- <view class="box_text">待收货</view>
- </view>
- <view class="list_box" @click="toOrder('/packageShang/pages/user/order/order', '待评价')">
- <img class="box_img" src="../../static/my/myorder4.png" />
- <view class="box_text">待评价</view>
- </view>
- </view>
- </view>
- <!-- 常用工具区域 -->
- <view class="body_box">
- <view class="box_title">常用工具</view>
- <view class="box_list">
- <view class="item_box" @click="handleShowCar">
- <img class="box_img" src="../../static/my/shopcar.png" />
- <view class="box_text">购物车</view>
- </view>
- <view class="item_box" @click="handleShowAddress">
- <img class="box_img" src="../../static/my/address.png" />
- <view class="box_text">收货地址</view>
- </view>
- <view class="item_box" @click="handleGoPageHome">
- <img class="box_img" src="../../static/my/center.png" />
- <view class="box_text">个人主页</view>
- </view>
- <view class="item_box" @click="handleGoPage('/pagesSub/set/set')">
- <img class="box_img" src="../../static/my/set.png" />
- <view class="box_text">设置</view>
- </view>
- <view class="item_box" @click="handleGoPageHelp">
- <img class="box_img" src="../../static/my/help.png" />
- <view class="box_text">操作手册</view>
- </view>
- <view class="item_box" @click="handleGoPageLevel">
- <img class="box_img" src="../../static/my/level.png" />
- <view class="box_text">等级介绍</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { showTest } from '@/util/commonFunction.js'
- export default {
- data() {
- return {
- // 是否登录标识
- flag: false,
- // 用户信息
- userInfo: {},
- // 状态栏高度
- statusBarH: 0,
- // 胶囊按钮栏高度
- customBarH: 0,
- // 顶部页面标题栏显示隐藏控制
- headerType: false
- }
- },
- created() {
- // 获取系统信息
- uni.getSystemInfo({
- success: (e) => {
- // 获取状态栏高度
- this.statusBarH = e.statusBarHeight + 10
- // // 获取菜单按钮栏高度
- let custom = uni.getMenuButtonBoundingClientRect()
- this.customBarH = custom.height + 10
- }
- })
- },
- onPageScroll(e) {
- if (e.scrollTop > 50) {
- this.headerType = true
- } else {
- this.headerType = false
- }
- },
- onLoad() {
- uni.$on('changeFlag', this.changeFlag)
- },
- onShow() {
- let openid = uni.getStorageSync('openid')
- if (openid) {
- this.flag = true
- this.userInfo = uni.getStorageSync('userInfo')
- } else {
- this.flag = false
- }
- },
- methods: {
- // 跳转页面回调
- handleGoPage(url) {
- if (this.isLogin()) {
- uni.navigateTo({
- url
- })
- }
- },
- changeFlag(e) {
- // console.log(e)
- this.flag = e.data
- this.userInfo = uni.getStorageSync('userInfo')
- },
- // 去登录文字回调
- goPageLogin() {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- },
- isLogin() {
- if (this.flag) {
- return true
- } else {
- uni.showToast({
- title: '请先登录',
- icon: 'none',
- mask: true
- })
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }, 1500)
- }
- },
- handleGoPageHome() {
- let userId = uni.getStorageSync('userInfo').id
- uni.navigateTo({
- url: `/pagesSub/myHome/myHome?userId=${userId}`
- })
- },
- handleShowTest() {
- showTest()
- },
- //购物车
- handleShowCar() {
- let userInfo = uni.getStorageSync('userInfo')
- let tokenId = uni.getStorageSync('tokenId')
- if (!userInfo || !tokenId) {
- uni.showModal({
- title: '提示',
- content: '您当前未登录,请授权登录查看社区信息',
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- }
- })
- } else {
- uni.navigateTo({
- url: '/packageShang/pages/tabbar/cart'
- })
- }
- },
- //收货地址
- handleShowAddress() {
- let userInfo = uni.getStorageSync('userInfo')
- let tokenId = uni.getStorageSync('tokenId')
- if (!userInfo || !tokenId) {
- uni.showModal({
- title: '提示',
- content: '您当前未登录,请授权登录查看社区信息',
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- }
- })
- } else {
- uni.navigateTo({
- url: '/packageShang/pages/user/address/address'
- })
- }
- },
- // 跳转到 订单
- toOrder(url, state) {
- let userInfo = uni.getStorageSync('userInfo')
- let tokenId = uni.getStorageSync('tokenId')
- if (!userInfo || !tokenId) {
- uni.showModal({
- title: '提示',
- content: '您当前未登录,请授权登录查看社区信息',
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- }
- })
- } else {
- uni.setStorage({
- key: '__order_state',
- data: state,
- success(res) {},
- complete() {
- uni.navigateTo({
- url
- })
- }
- })
- }
- },
- handleGoPageHelp() {
- uni.navigateTo({
- url: '/pagesSub/web/web?url=https://www.jinganrenjiams.com/app/'
- })
- },
- handleGoPageLevel() {
- uni.navigateTo({
- url: '/pagesSub/level/level'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- position: relative;
- min-height: 100vh;
- .title {
- z-index: 999;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- font-size: 28rpx;
- color: #fff;
- text-align: center;
- }
- .header {
- position: relative;
- height: 480rpx;
- color: #fff;
- overflow: hidden;
- img {
- width: 100%;
- }
- .img {
- position: absolute;
- top: 190rpx;
- left: 32rpx;
- width: 140rpx;
- height: 140rpx;
- border-radius: 50%;
- }
- .name {
- position: absolute;
- top: 200rpx;
- left: 202rpx;
- font-size: 40rpx;
- font-weight: bold;
- }
- .number {
- position: absolute;
- top: 265rpx;
- left: 202rpx;
- font-size: 24rpx;
- opacity: 0.5;
- }
- .real {
- position: absolute;
- top: 285rpx;
- left: 202rpx;
- display: flex;
- align-items: center;
- box-sizing: border-box;
- padding-left: 13rpx;
- width: 179rpx;
- height: 42rpx;
- font-size: 24rpx;
- border-radius: 113rpx;
- background-color: rgba(255, 255, 255, 0.2);
- img {
- margin-right: 7rpx;
- width: 24rpx;
- height: 24rpx;
- }
- }
- .real2 {
- position: absolute;
- top: 285rpx;
- left: 202rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
- padding-left: 13rpx;
- padding-bottom: 5rpx;
- width: 179rpx;
- height: 42rpx;
- font-size: 24rpx;
- border-radius: 113rpx;
- background-color: rgba(255, 255, 255, 0.2);
- img {
- margin-left: 12rpx;
- width: 24rpx;
- height: 24rpx;
- }
- }
- .login {
- position: absolute;
- top: 235rpx;
- left: 202rpx;
- font-size: 40rpx;
- font-weight: bold;
- }
- }
- .body {
- position: absolute;
- top: 360rpx;
- width: 100%;
- min-height: calc(100vh - 360rpx);
- border-radius: 20rpx 20rpx 0 0;
- background-color: #f7f7f7;
- .myOrder {
- padding: 0 30rpx;
- margin-bottom: 23rpx;
- height: 224rpx;
- border-radius: 20rpx;
- background-color: #fff;
- .myOrder_header {
- display: flex;
- align-items: flex-end;
- height: 64rpx;
- .header_img {
- width: 42rpx;
- height: 42rpx;
- }
- .header_title {
- display: flex;
- align-items: flex-end;
- height: 64rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .header_more {
- display: flex;
- align-items: center;
- margin-left: auto;
- font-size: 24rpx;
- color: #b3b3b3;
- .more_img {
- margin-top: -5rpx;
- margin-left: 10rpx;
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- .myOrder_list {
- display: flex;
- justify-content: space-around;
- height: 160rpx;
- .list_box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 140rpx;
- .box_img {
- width: 50rpx;
- height: 50rpx;
- }
- .box_text {
- margin-top: 10rpx;
- color: #808080;
- font-size: 24rpx;
- }
- }
- }
- }
- .body_box {
- padding: 0 30rpx;
- margin-bottom: 23rpx;
- border-radius: 20rpx 20rpx 0 0;
- background-color: #fff;
- .box_title {
- display: flex;
- align-items: flex-end;
- height: 64rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .box_list {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- grid-auto-rows: 160rpx;
- .item_box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .box_img {
- width: 50rpx;
- height: 50rpx;
- }
- .box_text {
- margin-top: 10rpx;
- color: #333333;
- font-size: 28rpx;
- }
- }
- }
- }
- }
- }
- </style>
|