123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730 |
- <template>
- <view class="container user clearfix">
- <cm-custom :navbar-data="nvabarData" v-if="isCmcustom"></cm-custom>
- <view class="user-section">
- <view
- class="header"
- :style="{
- height: CustomBar + 120 - StatusBar + 'px',
- paddingTop: CustomBar + 'px',
- background: 'url(https://static.caimei365.com/app/mini-mcare/icon/icon_header@2x.png)',
- backgroundSize: 'cover'
- }"
- >
- <view class="header-main" v-if="hasLogin">
- <view class="header-icon">
- <view class="header-logo">
- <image :src="underInfo.shopPhoto ? underInfo.shopPhoto : `${staticUrl}icon_default@3x.png`" mode=""></image>
- </view>
- </view>
- <view class="header-text">
- <view class="user-item"
- ><text class="u-none">{{ underInfo.name }}</text></view
- >
- </view>
- </view>
- <view class="header-main" v-else-if="isUnderLogin">
- <view class="header-icon">
- <view class="header-logo">
- <image
- :src="underInfo.shopPhoto ? underInfo.shopPhoto : `${staticUrl}icon_default@3x.png`"
- mode=""
- ></image>
- </view>
- </view>
- <view class="header-text">
- <view class="user-item"
- ><text class="u-h1">{{ underInfo.name }}</text></view
- >
- <view class="user-item">
- <view class="user-item-tips none">
- <text v-if="underInfo.clubStatus === 1">待审核</text>
- <text v-if="underInfo.clubStatus === 92" @click="underNavigator"
- >审核未通过,请重新提交 ></text
- >
- </view>
- </view>
- </view>
- </view>
- <view class="header-main-none" v-else>
- <view class="header-icon" @click="navigator('/pages/login/login')">
- <view class="header-logo">
- <image :src="staticUrl + 'icon_default@2x.png'" mode=""></image>
- </view>
- </view>
- <view class="header-text">
- <view class="user-item" @click="navigator('/pages/login/login')"> 登录 / 注册 </view>
- </view>
- </view>
- <!-- 订单 -->
- <view class="header-main-order">
- <view class="user-order">
- <view class="tab-title" @click="navigator('/pages/user/order/order-list?state=0')">
- <text class="cell-tit">我的订单</text> <text class="cell-more">全部订单</text>
- <text class="iconfont icon-xiangyou"></text>
- </view>
- <view class="order-section">
- <view
- class="order-item"
- @click="navigator('/pages/user/order/order-list?state=2')"
- hover-class="common-hover"
- :hover-stay-time="50"
- >
- <view class="order-icon">
- <image :src="staticUrl + 'icon_order_2@2x.png'" mode=""></image>
- <text
- v-if="paymentCount > 0 && hasLogin"
- class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
- :class="[paymentCount < 10 ? 'goleft' : '']"
- >
- {{ paymentCount >= 99 ? '99+' : paymentCount }}
- </text>
- </view>
- <text class="order-t">待付款</text>
- </view>
- <view
- class="order-item"
- @click="navigator('/pages/user/order/order-list?state=3')"
- hover-class="common-hover"
- :hover-stay-time="50"
- >
- <view class="order-icon">
- <image :src="staticUrl + 'icon_order_3@2x.png'" mode=""></image>
- <text
- v-if="waitShipmentsCount > 0 && hasLogin"
- class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
- :class="[waitShipmentsCount < 10 ? 'goleft' : '']"
- >
- {{ waitShipmentsCount >= 99 ? '99+' : waitShipmentsCount }}
- </text>
- </view>
- <text class="order-t">待发货</text>
- </view>
- <view
- class="order-item"
- @click="navigator('/pages/user/order/order-list?state=4')"
- hover-class="common-hover"
- :hover-stay-time="50"
- >
- <view class="order-icon">
- <image :src="staticUrl + 'icon_order_4@2x.png'" mode=""></image>
- <text
- v-if="shipmentsCount > 0 && hasLogin"
- class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
- :class="[shipmentsCount < 10 ? 'goleft' : '']"
- >
- {{ shipmentsCount >= 99 ? '99+' : shipmentsCount }}
- </text>
- </view>
- <text class="order-t">已发货</text>
- </view>
- <view
- class="order-item"
- @click="navigator('/pages/user/order/order-list?state=5')"
- hover-class="common-hover"
- :hover-stay-time="50"
- >
- <view class="order-icon">
- <image :src="staticUrl + 'icon_order_5@2x.png'" mode=""></image>
- <text
- v-if="salesReturnCount > 0 && hasLogin"
- class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
- :class="[salesReturnCount < 10 ? 'goleft' : '']"
- >
- {{ salesReturnCount >= 99 ? '99+' : salesReturnCount }}
- </text>
- </view>
- <text class="order-t">退货/款</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 底部跳转 -->
- <view class="header-main-listcell">
- <view class="list-cell-item">
- <view
- class="list-cell"
- v-for="(item, index) in firstList"
- :key="index"
- @click="navigator(item.path)"
- hover-class="cell-hover"
- :hover-stay-time="50"
- >
- <view class="cell-icon">
- <image class="cell-icon-image" :src="staticUrl + item.icon" mode=""></image>
- </view>
- <text class="cell-tit"> {{ item.name }} </text>
- <text class="cell-more iconfont icon-xiangyou"></text>
- </view>
- <!-- #ifdef MP-WEIXIN -->
- <button class="list-cell" open-type="contact" @bindcontact="handleContact">
- <view class="cell-icon">
- <image class="cell-icon-image" :src="staticUrl + 'icon_club_5@2x.png'" mode=""></image>
- </view>
- <text class="cell-tit"> 官方客服 </text>
- <text class="cell-more iconfont icon-xiangyou"></text>
- </button>
- <!-- #endif -->
- </view>
- </view>
- </view>
- </view>
- <!-- 技术支持 -->
- <view class="copyright">
- <image class="image" :src="staticUrl + 'icon_caimei@2x.png'"></image>
- <view class="text">由采美365网提供技术服务</view>
- </view>
- </view>
- </template>
- <script>
- import authorize from '@/common/config/authorize.js'
- import { mapState, mapMutations } from 'vuex'
- export default {
- data() {
- return {
- nvabarData: {
- // 顶部自定义导航
- showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
- showSearch: 0,
- title: '个人中心', // 导航栏中间的标题
- haveBack: false,
- textLeft: this.$store.state.isIphone,
- textColor: '#333333',
- bgColor: ''
- },
- staticUrl: this.global.staticUrl,
- CustomBar: this.CustomBar, // 顶部导航栏高度
- StatusBar: this.StatusBar,
- userId: 0,
- isModify: false,
- isCmcustom: false,
- name: '',
- userType: '',
- shopPhoto: '',
- userVip: {}, // 超级会员信息
- userBeans: 0,
- userMoney: '0.00',
- couponNum: 0,
- bankNum: 0,
- contactNumber: '',
- openid: '',
- aboutHtml: '',
- telPhone: '',
- isSvip: false,
- isSvipType: 2,
- userIdentity: '', // 机构等级
- confirmedCount: 0, // 待确认
- paymentCount: 0, // 待付款角标
- waitShipmentsCount: 0, // 待收货角标
- shipmentsCount: 0, // 已发货角标
- salesReturnCount: '', // 退货/款角标
- firstList: [
- {
- name: '收藏商品',
- path: '/pages/user/collection/collection',
- icon: 'icon_club_1@2x.png'
- },
- {
- name: '收货地址管理',
- path: '/pages/user/address/address',
- icon: 'icon_club_2@2x.png'
- },
- {
- name: '机构资料',
- path: '/pages/login/information',
- icon: 'icon_club_3@2x.png'
- },
- {
- name: '账户设置',
- path: '/pages/user/setting/setting',
- icon: 'icon_club_4@2x.png'
- }
- ],
- underInfo: {},
- isUnderLogin: false
- }
- },
- onLoad(option) {},
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'isWxAuthorize'])
- },
- methods: {
- ...mapMutations(['updateNoticeNum']),
- async infoClucbUser() {
- const user = await this.$api.getStorage()
- console.log(user)
- this.underInfo = user
- if (this.underInfo.clubStatus === 1 || this.underInfo.clubStatus === 92) {
- this.isUnderLogin = true
- }
- },
- async getClubObtainCenter() {
- // 获取个人中心数据
- try{
- const res = await this.UserService.GetClubObtainCenter({ userId: this.userId })
- let data = res.data
- this.underInfo = { ...this.underInfo , ...data.user }
- }catch(e){
- this.$util.msg(error.msg, 2000)
- }
- },
- UserClubOrderCount() {
- //获取订单状态数量
- this.OrderService.UserClubOrderCount({ userId: this.userId })
- .then(response => {
- let data = response.data
- this.confirmedCount = this.showBadge(data.confirmedCount) //待确认
- this.paymentCount = this.showBadge(data.paymentCount) //待付款
- this.waitShipmentsCount = this.showBadge(data.waitShipmentsCount) //待收货
- this.shipmentsCount = this.showBadge(data.shipmentsCount) //已发货
- this.salesReturnCount = this.showBadge(data.salesReturnCount) //退货/款
- })
- .catch(error => {
- console.log('获取订单状态数量异常~')
- })
- },
- toPhone() {
- // 拨号
- uni.makePhoneCall({
- phoneNumber: this.contactNumber //仅为示例
- })
- },
- navigator(url) {
- if (this.hasLogin) {
- this.$api.navigateTo(url)
- } else {
- this.$api.navigateTo('/pages/login/login?type=0')
- }
- },
- underNavigator() {
- // 审核未通过修改资料
- this.$api.navigateTo('/pages/login/register-unid')
- },
- showBadge(n) {
- let num = ''
- if (n > 100) {
- num = 99
- } else {
- num = n
- }
- return num
- },
- clubStatusText(state) {
- let stateText
- switch (state) {
- case 90:
- stateText = ''
- break
- case 1:
- stateText = '正在审核中'
- break
- case 92:
- stateText = '审核不通过'
- break
- }
- return stateText
- },
- async initUserData() {
- const userInfo = await this.$api.getComStorage('userInfo')
- this.userId = userInfo.userId ? userInfo.userId : 0
- this.getClubObtainCenter()
- this.UserClubOrderCount()
- }
- },
- onPageScroll(e) {
- //实时获取到滚动的值
- if (e.scrollTop > 20) {
- this.isCmcustom = true
- this.nvabarData.bgColor = '#FFFFFF'
- this.nvabarData.textColor = '#333333'
- } else {
- this.isCmcustom = false
- this.nvabarData.bgColor = ''
- this.nvabarData.textColor = '#FFFFFF'
- }
- },
- onPullDownRefresh() {
- //下拉刷新
- if (this.hasLogin) {
- this.getClubObtainCenter()
- this.UserClubOrderCount()
- uni.stopPullDownRefresh()
- } else {
- uni.stopPullDownRefresh()
- }
- },
- onShow() {
- if (this.hasLogin) {
- this.initUserData()
- } else {
- this.infoClucbUser()
- this.$store.commit('updateAllNum', 0)
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/uni.scss';
- page {
- background-color: #f7f7f7;
- }
- .user {
- width: 100%;
- height: 100%;
- position: relative;
- background: rgba(247, 247, 247, 1);
- }
- .header {
- width: 100%;
- position: relative;
- background-size: cover;
- }
- .header-main {
- width: 702rpx;
- height: 130rpx;
- padding: 12rpx 24rpx;
- display: flex;
- .header-text {
- flex: 8;
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
- padding: 10rpx 0 0 20rpx;
- .user-item {
- flex: 1;
- height: 64rpx;
- line-height: 64rpx;
- .user-item-tips {
- display: inline-block;
- float: left;
- height: 40rpx;
- background: #fcc120;
- border-radius: 20rpx;
- line-height: 40rpx;
- font-size: $font-size-22;
- text-align: center;
- color: #ffffff;
- box-sizing: border-box;
- padding: 0 20rpx;
- position: relative;
- &.none {
- background: #f85050;
- }
- }
- .u-none {
- font-size: $font-size-32;
- line-height: 120rpx;
- color: #ffffff;
- text-align: left;
- }
- .u-h1 {
- width: 400rpx;
- float: left;
- font-size: $font-size-30;
- color: #ffffff;
- text-align: left;
- -o-text-overflow: ellipsis;
- text-overflow: ellipsis;
- display: -webkit-box;
- word-break: break-all;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- overflow: hidden;
- }
- .u-p {
- font-size: $font-size-24;
- line-height: 30rpx;
- color: #ffffff;
- text-align: left;
- }
- }
- }
- .header-icon {
- flex: 2;
- display: flex;
- margin-right: 20rpx;
- align-items: center;
- justify-content: center;
- .header-logo {
- width: 120rpx;
- height: 120rpx;
- box-sizing: border-box;
- background-color: #fff;
- border-radius: 100%;
- image {
- width: 120rpx;
- height: 120rpx;
- display: block;
- border-radius: 100%;
- }
- }
- }
- }
- .header-main-none {
- width: 702rpx;
- height: 152rpx;
- padding: 0 24rpx;
- display: flex;
- .header-text {
- flex: 8;
- display: flex;
- flex-direction: column;
- position: relative;
- box-sizing: border-box;
- padding: 20rpx 0;
- .user-item {
- flex: 1;
- height: 120rpx;
- line-height: 120rpx;
- font-size: $font-size-32;
- color: #ffffff;
- text-align: left;
- }
- }
- .header-icon {
- flex: 2;
- display: flex;
- margin-right: 20rpx;
- align-items: center;
- justify-content: center;
- .header-logo {
- width: 120rpx;
- height: 120rpx;
- box-sizing: border-box;
- padding: 21rpx;
- background-color: #fff;
- border-radius: 100%;
- image {
- width: 78rpx;
- height: 78rpx;
- display: block;
- }
- }
- }
- }
- .header-main-order {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 24rpx;
- margin-top: 26rpx;
- .user-order {
- width: 100%;
- height: auto;
- background-color: $bg-color;
- margin-bottom: 24rpx;
- border-radius: 20rpx;
- box-sizing: border-box;
- padding: 0 24rpx;
- }
- }
- .tab-title {
- font-size: $font-size-28;
- line-height: 80rpx;
- color: #333333;
- text-align: left;
- border-bottom: 1px solid #f8f8f8;
- position: relative;
- .cell-tit {
- font-size: $font-size-28;
- color: $text-color;
- }
- .cell-more {
- float: right;
- line-height: 80rpx;
- font-size: $font-size-24;
- color: $text-color;
- padding-right: 30rpx;
- }
- .iconfont {
- width: 30rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- position: absolute;
- right: 0;
- top: 0;
- display: block;
- font-size: $font-size-28;
- color: #b2b2b2;
- }
- }
- .order-section {
- display: flex;
- justify-content: space-around;
- align-items: center;
- flex-wrap: wrap;
- height: 99rpx;
- padding: 24rpx 0;
- }
- .order-item {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
- &:last-child {
- margin-right: 0;
- }
- .order-icon {
- width: 52rpx;
- height: 52rpx;
- position: relative;
- image {
- width: 52rpx;
- height: 52rpx;
- }
- .icon-num {
- position: absolute;
- right: -24rpx;
- top: -9rpx;
- }
- .icon-num.goleft {
- right: -12rpx;
- }
- }
- .order-t {
- line-height: 50rpx;
- font-size: $font-size-24;
- color: $text-color;
- }
- }
- .header-main-last {
- width: 100%;
- height: 20rpx;
- float: left;
- box-sizing: border-box;
- }
- .header-main-listcell {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 24rpx;
- margin-bottom: 60rpx;
- }
- .list-cell-item {
- width: 654rpx;
- height: auto;
- margin-bottom: 24rpx;
- padding: 0 24rpx;
- background: $bg-color;
- border-radius: 20rpx;
- }
- .list-cell {
- width: 100%;
- line-height: 100rpx;
- position: relative;
- background: $bg-color;
- border-bottom: 1px solid #ebebeb;
- height: 100rpx;
- &:last-child {
- border-bottom: none;
- }
- &.cell-hover {
- background: #fafafa;
- }
- .cell-icon {
- width: 60rpx;
- height: 100rpx;
- text-align: center;
- box-sizing: border-box;
- padding: 32rpx 12rpx;
- float: left;
- .cell-icon-image {
- width: 36rpx;
- height: 36rpx;
- display: block;
- }
- }
- .cell-more {
- height: 100rpx;
- line-height: 100rpx;
- text-align: right;
- position: absolute;
- right: 0;
- top: 0;
- font-size: $font-size-28;
- color: #b2b2b2;
- &.cont {
- width: 250rpx;
- }
- .txt {
- color: #fb4343;
- padding-right: 10rpx;
- }
- }
- .cell-tit {
- width: 465rpx;
- display: block;
- float: left;
- font-size: $font-size-28;
- color: #666666;
- margin-right: 10rpx;
- text-align: left;
- &.cont {
- width: 300rpx;
- }
- .cell-tips {
- width: 74rpx;
- height: 32rpx;
- line-height: 32rpx;
- padding: 0 7rpx;
- border-radius: 16rpx;
- background-color: #ffe6dc;
- color: $color-system;
- text-align: center;
- font-size: $font-size-20;
- margin-left: 8rpx;
- }
- }
- .cell-tip {
- font-size: $font-size-28;
- color: $text-color;
- }
- }
- .list-cell.last {
- border-bottom: none;
- }
- .uni-badge--small {
- -webkit-transform: scale(0.8);
- -ms-transform: scale(0.8);
- transform: scale(0.8);
- -webkit-transform-origin: center center;
- -ms-transform-origin: center center;
- transform-origin: center center;
- }
- .uni-badge {
- font-family: 'Helvetica Neue', Helvetica, sans-serif;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- font-size: 12px;
- line-height: 1;
- display: inline-block;
- padding: 3px 6px;
- color: #333;
- border-radius: 100px;
- background-color: #f1f1f1;
- }
- .uni-badge-error {
- color: #fff;
- background-color: #dd524d;
- }
- .copyright {
- width: 100%;
- position: absolute;
- bottom: 40rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- image {
- width: 180rpx;
- height: 60rpx;
- }
- .text {
- font-size: 20rpx;
- color: #cccccc;
- }
- }
- </style>
|