|
|
- <template>
- <view class="page">
-
- <navbar title="个人中心" />
-
- <view class="head">
- <view class="headImage">
- <image :src="headImage" mode="aspectFill"></image>
- </view>
- <view class="info">
- <view class="name">
- {{ username }}
- </view>
-
- <!-- 营业时间写这个view里面 -->
- <view v-if="userShop">
- <view class="jobTime" @click="$refs.seleteJobTimePopup.open()">
- {{ userInfo && userInfo.shop && userInfo.shop.jobTime ? '营业时间:'+userInfo.shop.jobTime : "请设置营业时间" }}
- </view>
-
- <!-- 往这里写 -->
- </view>
- <!-- <view class="vip">
- VIP1
- </view> -->
- <!-- <view class="tips">
- 今天是您来的的第32天
- </view> -->
- </view>
- <!-- <view class="headBtn" @click="headBtn">
- 角色切换
- </view> -->
- <view class="setting" @click="$utils.navigateTo('/pages_order/mine/updateUserInfo')">
- <uv-icon name="setting" size="40rpx"></uv-icon>
- </view>
- </view>
-
- <!-- 水洗店 -->
- <view class="userShop" v-if="userShop">
- <userShopCommission />
- <view class="line grid">
- <view class="title">
- 常用功能
- </view>
- <uv-grid :col="4" :border="false">
-
- <uv-grid-item @click="bindWx"
- v-if="!userInfo.appOpenid">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">绑定微信</text>
- </uv-grid-item>
-
- <uv-grid-item @click="logout">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">退出登录</text>
- </uv-grid-item>
-
- </uv-grid>
- </view>
- <view class="userList">
- <view class="title">
- 我的用户
- </view>
- <view class="list">
- <view class="item" @click="$utils.navigateTo('/index/order?uid=' + item.id)"
- v-for="(item, index) in userList" :key="index">
- <view class="name">
- 客户:{{ item.name }}
- </view>
- <view class="num">
- 剩余水洗布:{{ item.num }}
- </view>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 酒店 -->
- <view class="user" v-else>
- <view class="line">
- <view class="item">
- <view class="image">
- <image src="/static/image/center/1.png" mode=""></image>
- </view>
- <view class="">
- 余额¥ {{ userInfo.balance || 0 }}
- </view>
- </view>
- <view class="item">
- <view class="image">
- <image src="/static/image/center/4.png" mode=""></image>
- </view>
- <view class="">
- 押金¥{{ userInfo.deposit || 0 }}
- </view>
- </view>
- </view>
- <view class="line grid">
- <view class="title">
- 常用功能
- </view>
- <uv-grid :col="4" :border="false">
-
- <uv-grid-item @click="$utils.navigateTo('/pages_order/mine/address')">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">地址管理</text>
- </uv-grid-item>
-
- <uv-grid-item @click="$utils.redirectTo('/index/order')">
- <image class="image" src="/static/image/center/8.png" mode=""></image>
- <text class="grid-text">订单管理</text>
- </uv-grid-item>
-
- <uv-grid-item @click="$utils.navigateTo('/pages_order/order/refundsOrExchange?index='+0)">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">退货</text>
- </uv-grid-item>
-
- <uv-grid-item @click="$utils.navigateTo('/pages_order/order/refundsOrExchange?index='+1)">
- <image class="image" src="/static/image/center/5.png" mode=""></image>
- <text class="grid-text">换货</text>
- </uv-grid-item>
-
- </uv-grid>
- </view>
- <view class="line grid">
- <uv-grid :col="4" :border="false">
-
- <uv-grid-item @click="$refs.customerServicePopup.open()">
- <image class="image" src="/static/image/center/9.png" mode=""></image>
- <text class="grid-text">联系客服</text>
- </uv-grid-item>
-
- <uv-grid-item @click="$utils.navigateTo('/pages_order/mine/lease')">
- <image class="image" src="/static/image/center/6.png" mode=""></image>
- <text class="grid-text">我的物品</text>
- </uv-grid-item>
-
- <!-- <uv-grid-item @click="$utils.navigateTo('/pages_order/mine/coupon')">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">优惠劵</text>
- </uv-grid-item> -->
-
- <uv-grid-item @click="$utils.navigateTo('/pages_order/order/applyLaundryStore')">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">申请成为水洗店</text>
- </uv-grid-item>
-
- <uv-grid-item @click="logout">
- <image class="image" src="/static/image/center/7.png" mode=""></image>
- <text class="grid-text">退出登录</text>
- </uv-grid-item>
- </uv-grid>
- </view>
- </view>
-
-
-
- <!-- 联系客服弹框 -->
- <customerServicePopup ref="customerServicePopup" />
- <!-- 设置营业时间 -->
- <seleteJobTimePopup ref="seleteJobTimePopup" />
-
-
- <tabber select="4" />
- </view>
- </template>
-
- <script>
- import customerServicePopup from '@/components/config/customerServicePopup.vue'
- import seleteJobTimePopup from '@/components/userShop/seleteJobTime.vue'
- import tabber from '@/components/base/tabbar.vue'
- import {
- mapGetters,
- mapState,
- } from 'vuex'
- import userShopCommission from '@/components/userShop/userShopCommission.vue'
- export default {
- components: {
- tabber,
- userShopCommission,
- customerServicePopup,
- seleteJobTimePopup,
- },
- computed: {
- ...mapGetters(['userShop']),
- ...mapState(['userInfo']),
- username(){
- return this.userInfo.shop
- && this.userInfo.shop.name
- || this.userInfo.nickName
- || '用户昵称'
- },
- headImage(){
- return this.userInfo.shop
- && this.userInfo.shop.pic
- || this.userInfo.headImage
- || '/static/image/center/3.png'
- },
- },
- data() {
- return {
- userList: [],
- queryParams: {
- pageNo: 1,
- pageSize: 10,
- title: '',
- },
- total: 0,
- }
- },
- onShow() {
- this.$store.commit('getUserInfo')
- // 水洗店获取我的用户
- if (this.userShop) {
- this.getUserPage()
- }
- },
- //滚动到屏幕底部
- onReachBottom() {
- if (this.queryParams.pageSize < this.total) {
- this.queryParams.pageSize += 10
- // 水洗店获取我的用户
- if (this.userShop) {
- this.getUserPage()
- }
- }
- },
- methods: {
- headBtn() {
- let self = this
- uni.showModal({
- title: '演示切换角色之后的效果',
- success(res) {
- if (res.confirm) {
- self.$store.state.shop = !self.$store.state.shop
- }
- }
- })
- },
- // 获取客户数据
- getUserPage() {
- console.log(this.userInfo.nickName);
- this.$api('getMyUserPage', this.queryParams, res => {
- uni.stopPullDownRefresh()
- if (res.code == 200) {
- this.userList = res.result.records
- this.total = res.result.total
- }
- })
- },
- logout(){
- this.$store.commit('logout')
- },
- //绑定微信
- bindWx() {
-
- // uni.showModal({
- // title: '确认囊袋吗',
- // success(r) {
- // if(r.confirm){
- // }
- // }
- // })
- let self = this
-
- uni.login({
- success(res) {
- if(res.errMsg != "login:ok"){
- return
- }
-
- self.$api('bindWx', {
- code : res.code,
- }, res => {
- if (res.code == 200) {
- self.$store.commit('getUserInfo')
- }
- })
- }
- })
-
- },
- }
- }
- </script>
-
- <style scoped lang="scss">
- .page {}
-
- image {
- width: 100%;
- height: 100%;
- }
-
- .head {
- display: flex;
- background-color: #fff;
- padding: 40rpx 20rpx;
- align-items: center;
- position: relative;
-
- .headImage {
- width: 120rpx;
- height: 120rpx;
- // background-image: url(/static/image/center/3.png);
- background-size: 100% 100%;
- overflow: hidden;
- border-radius: 50%;
- margin-right: 40rpx;
- }
-
- .info {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- gap: 10rpx;
-
- font-size: 28rpx;
-
- .vip {
- background-color: #FCCC92;
- color: #FA6239;
- width: 100rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 40rpx;
- border-radius: 20rpx;
- margin-top: 20rpx;
-
- }
-
- .name {
- font-size: 36rpx;
- }
-
- .jobTime {
- font-size: 24rpx;
- }
-
- .tips {
- font-size: 26rpx;
- color: #ABABAB;
- }
- }
-
- .headBtn {
- margin-left: auto;
- padding: 15rpx 20rpx;
- background-color: $uni-color;
- color: #fff;
- border-radius: 20rpx;
- // margin-top: 50rpx;
- }
-
- .setting {
- position: absolute;
- right: 50rpx;
- top: 50rpx;
- margin-left: 20rpx;
- }
- }
-
- .userShop {
- .userList {
- .title {
- font-size: 32rpx;
- font-weight: 900;
- padding: 20rpx;
- }
-
- .list {
- display: flex;
- flex-wrap: wrap;
-
- .item {
- width: 270rpx;
- margin: 20rpx;
- display: flex;
- flex-direction: column;
- padding: 40rpx 30rpx;
- background-color: #fff;
- border-radius: 30rpx;
- line-height: 60rpx;
-
- .name {}
-
- .num {
- color: $uni-color;
- font-weight: 600;
- font-size: 28rpx;
- }
- }
- }
- }
- }
-
- .user {
-
- }
- .line {
- display: flex;
- background-color: #fff;
- margin-top: 20rpx;
- padding: 20rpx 0;
-
- .item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 20rpx 0;
-
- &:nth-child(1) {
- border-right: 1px solid #00000013;
- }
-
- .image {
- width: 100rpx;
- height: 70rpx;
- margin-right: 20rpx;
- }
- }
- }
- .grid {
- flex-direction: column;
- font-size: 26rpx;
- padding: 20rpx;
-
- .title {
- margin-bottom: 30rpx;
- font-size: 28rpx;
- font-weight: 600;
- }
-
- .image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
- }
-
- text {
- text-align: center;
- width: 120rpx;
- }
- }
- </style>
|