| | |
| | | <view class="mine-page"> |
| | | <view class="top-bg"></view> |
| | | <view class="nav-wrap"> |
| | | <view :style="{ height: statusbarHeight + 'px' }"></view> |
| | | <view class="nav-bar" :style="{ height: navHeight + 'px' }"> |
| | | <view class="nav-spacer"></view> |
| | | <view class="nav-actions"> |
| | | <view class="nav-action-item"> |
| | | <u-icon name="more-dot-fill" size="30" color="#222222"></u-icon> |
| | | </view> |
| | | <view class="nav-divider"></view> |
| | | <view class="nav-action-item"> |
| | | <u-icon name="scan" size="24" color="#222222"></u-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view> |
| | | <view :style="{ width: '100%', height: navHeight + 'px' }"></view> |
| | | </view> |
| | | |
| | | <view class="page-scroll"> |
| | | <view class="page-content"> |
| | | <view class="profile-card"> |
| | | <image class="avatar" src="/static/image/tx@2x.png" mode="widthFix"></image> |
| | | <button open-type="getPhoneNumber" @getphonenumber="getphonenumber">授权手机号</button> |
| | | <image class="avatar" :src="userInfo.fullCoverImage ? userInfo.fullCoverImage : '/static/image/tx@2x.png'" mode="widthFix"></image> |
| | | <view class="profile-copy"> |
| | | <text class="login-text">{{ isLoggedIn ? maskedMobile : '点击登录' }}</text> |
| | | <text v-if="isLoggedIn" class="user-name">{{ userName }}</text> |
| | | <text class="login-text">{{ userInfo.nickName || '点击登录' }}</text> |
| | | </view> |
| | | <view v-if="isLoggedIn" class="profile-tools"> |
| | | <view class="tool-item"> |
| | | <view v-if="userInfo" class="profile-tools"> |
| | | <view class="tool-item" @click="toSetting"> |
| | | <image class="tool-icon" src="/static/icon/ic_option@2x.png" mode="aspectFit"></image> |
| | | </view> |
| | | <view class="tool-item has-badge"> |
| | | <image class="tool-icon" src="/static/icon/ic_notice@2x.png" mode="aspectFit"></image> |
| | | <view class="tool-badge"></view> |
| | | <view class="tool-badge" v-if="userInfo.hasMessage"></view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <view class="order-card section-card"> |
| | | <view class="section-head"> |
| | | <text class="section-title">我的订单</text> |
| | | <view class="more-wrap"> |
| | | <view class="more-wrap" @click="toAllOrders"> |
| | | <text class="more-text">全部订单</text> |
| | | <u-icon name="arrow-right" size="13" color="#999999"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="order-grid"> |
| | | <view v-for="item in orderMenus" :key="item.label" class="order-item"> |
| | | <view v-for="(item, index) in orderMenus" :key="index" class="order-item" @click="toOrderDetail(item.label)"> |
| | | <image class="order-icon" :src="item.url" mode="widthFix"></image> |
| | | <view v-if="item.badge && isLoggedIn" class="order-badge">{{ item.badge }}</view> |
| | | <view v-if="item.badge" class="order-badge">{{ item.badge }}</view> |
| | | <text class="order-label">{{ item.label }}</text> |
| | | </view> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | import { mapState } from 'vuex' |
| | | |
| | | export default { |
| | | computed: { |
| | | ...mapState(['navHeight', 'statusbarHeight']), |
| | | maskedMobile() { |
| | | if (!this.isLoggedIn || !this.mobile) { |
| | | return '点击登录' |
| | | } |
| | | return `${this.mobile.slice(0, 3)}****${this.mobile.slice(-4)}` |
| | | } |
| | | export default { |
| | | computed: { |
| | | ...mapState(['navHeight', 'statusbarHeight', 'openid', 'userInfo']) |
| | | }, |
| | | data() { |
| | | return { |
| | | userName: '', |
| | | orderMenus: [ |
| | | { label: '待支付', url: '/static/icon/mine_ic_daifukuan@2x.png', badge: 0 }, |
| | | { label: '待收货', url: '/static/icon/mine_ic_daishouhuo@2x.png', badge: 0 }, |
| | | { label: '退款/售后', url: '/static/icon/mine_ic_tuikuan@2x.png', badge: 0 } |
| | | ], |
| | | menuList: [ |
| | | { label: '门店入驻' }, |
| | | { label: '我的门店' }, |
| | | { label: '规范须知' }, |
| | | { label: '在线客服' }, |
| | | { label: '关于我们' } |
| | | ] |
| | | } |
| | | }, |
| | | async onShow() { |
| | | await this.$onLaunched |
| | | this.getOrderNum() |
| | | }, |
| | | methods: { |
| | | toAllOrders() { |
| | | uni.navigateTo({ |
| | | url: '/pages/orders/orders' |
| | | }) |
| | | }, |
| | | data() { |
| | | return { |
| | | isLoggedIn: true, |
| | | mobile: '18166669990', |
| | | userName: '蔡子瑄', |
| | | orderMenus: [ |
| | | { label: '待支付', url: '/static/icon/mine_ic_daifukuan@2x.png', badge: 12 }, |
| | | { label: '待收货', url: '/static/icon/mine_ic_daishouhuo@2x.png', badge: 2 }, |
| | | { label: '退款/售后', url: '/static/icon/mine_ic_tuikuan@2x.png' } |
| | | ], |
| | | menuList: [ |
| | | { label: '门店入驻' }, |
| | | { label: '我的门店' }, |
| | | { label: '规范须知' }, |
| | | { label: '在线客服' }, |
| | | { label: '关于我们' } |
| | | ] |
| | | toOrderDetail(label) { |
| | | uni.navigateTo({ |
| | | url: '/pages/orders/orders?status=' + label |
| | | }) |
| | | }, |
| | | toSetting() { |
| | | uni.navigateTo({ |
| | | url: '/pages/settings/settings' |
| | | }) |
| | | }, |
| | | getOrderNum() { |
| | | this.$u.api.getMemberInfo({}).then(res => { |
| | | if (res.code === 200) { |
| | | this.$store.commit('setUserInfo', res.data) |
| | | this.orderMenus.forEach(item => { |
| | | if (item.label === '待支付') { |
| | | item.badge = res.data.waitPayCount |
| | | } else if (item.label === '待收货') { |
| | | item.badge = res.data.waitReceiveCount |
| | | } else if (item.label === '退款/售后') { |
| | | item.badge = res.data.refundingCount |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 授权手机号 |
| | | getphonenumber(e) { |
| | | var that = this; |
| | | if (e.detail.errMsg === 'getPhoneNumber:ok') { |
| | | uni.login({ |
| | | provider: 'weixin', |
| | | success: async function (loginRes) { |
| | | let { code } = loginRes; |
| | | let res = await that.$u.api.wxLogin({ code }) |
| | | if (res.code === 200) { |
| | | that.$u.api.wxAuthPhone({ |
| | | code: e.detail.code, |
| | | openid: 'oKKHU5IFKpss_DIbFX1lqghFJOEg' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | that.$store.commit('setUserInfo', res.data.member) |
| | | that.$store.commit('setToken', res.data.token) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | z-index: 0; |
| | | } |
| | | |
| | | .nav-wrap, |
| | | .page-scroll { |
| | | position: relative; |
| | | z-index: 1; |
| | | } |
| | | |
| | | .nav-bar { |
| | | padding: 0 16rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .nav-spacer { |
| | | width: 52rpx; |
| | | height: 52rpx; |
| | | } |
| | | |
| | | .nav-actions { |
| | | min-width: 112rpx; |
| | | height: 52rpx; |
| | | padding: 0 10rpx; |
| | | background: rgba(255, 255, 255, 0.86); |
| | | border-radius: 26rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .nav-action-item { |
| | | width: 38rpx; |
| | | height: 38rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .nav-divider { |
| | | width: 1rpx; |
| | | height: 24rpx; |
| | | background: #e5e7eb; |
| | | } |
| | | |
| | | .page-content { |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 30rpx; |
| | | position: relative; |
| | | button { |
| | | position: absolute; |
| | | bottom: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | opacity: 0; |
| | | } |
| | | } |
| | | |
| | | .avatar { |