You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
949 lines
30 KiB
949 lines
30 KiB
<template> |
|
<view class="user"> |
|
<view class="bg"> |
|
<image src="@/static/images/namecard-bg.png" mode=""></image> |
|
</view> |
|
<view> |
|
<!-- <view v-if="$store.getters.token || userInfo.uid"> --> |
|
<view :style="[{height:StatusBar + 'px'}]"></view> |
|
<!-- <view class="getUserBaseData header bg-color-red acea-row row-between-wrapper" v-if="!userInfo.avatar && !userInfo.nickname"> |
|
<button class="userDataBtn" v-if="canIUseGetUserProfile" @tap="getUserInfoProfile">授权并查看用户信息</button> |
|
<button class="userDataBtn" v-else @getuserinfo="getUserInfo" open-type="getUserInfo">授权并查看用户信息</button> |
|
</view> --> |
|
<view class="header acea-row row-between-wrapper"> |
|
<view class="picTxt acea-row row-between-wrapper"> |
|
<view class="pictrue" @click="goPersonalData()"> |
|
<image class="image" v-if="userInfo.avatar" :src="userInfo.avatar"/> |
|
<view class="noAvatar acea-row row-middle row-center" v-else> |
|
<image src="../../../static/images/yanjie-logo.png" mode="widthFix"></image> |
|
</view> |
|
</view> |
|
|
|
<view class="text" v-if="$store.getters.token || userInfo.uid"> |
|
<view class="acea-row"> |
|
<view class="name line1">{{ userInfo.nickname || '微信用户' }}</view> |
|
<image class="member" v-if="userInfo.vip" :src="userInfo.vipIcon" /> |
|
<!-- <image class="member" v-if="userInfo.vip" src="../../../static/images/vip-icon.png" /> --> |
|
<!-- <view class="member acea-row row-middle" v-if="userInfo.vip"> |
|
<image :src="userInfo.vipIcon" /> |
|
<text>{{ userInfo.vipName }}</text> |
|
</view> --> |
|
</view> |
|
<view class="id" v-if="userInfo.phone"> |
|
<text>账号:{{ userInfo.phone.substring(0, 3) }}****{{ userInfo.phone.substring(7, 11) }}</text> |
|
<!-- <text>账号:{{ userInfo.phone || userInfo.uid }}</text> --> |
|
<!-- <text class="iconfont icon-bianji1"></text> --> |
|
</view> |
|
<view class="id" v-else> |
|
未绑定手机号 |
|
<!-- <text>眼界ID:{{ userInfo.uid }}</text> --> |
|
</view> |
|
<!-- #ifdef MP-WEIXIN --> |
|
<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else> |
|
<text>绑定手机号</text> |
|
</button> --> |
|
<!-- #endif --> |
|
|
|
<!-- #ifndef MP-WEIXIN --> |
|
<!-- <button class="binding" @click="goBindPhone()" v-else> |
|
<text>绑定手机号</text> |
|
</button> --> |
|
<!-- #endif --> |
|
</view> |
|
<button class="text author-btn" v-else open-type="getPhoneNumber" @getphonenumber="phoneLogin">点击登录</button> |
|
|
|
</view> |
|
<image class="set-icon" src="../../../static/images/set-icon.png" mode="" @click="goPersonalData()"></image> |
|
<!-- <text class="iconfont icon-shezhi" @click="goPersonalData()"></text> --> |
|
</view> |
|
|
|
<view class="vip-box acea-row row-between-wrapper" v-if="$store.getters.token || userInfo.uid" @click="goVipCenter"> |
|
<view class="acea-row row-middle"> |
|
<image src="../../../static/images/earth-white.png" mode=""></image> |
|
<text>会员中心</text> |
|
</view> |
|
<view class="more acea-row row-middle"> |
|
<text>了解会员</text> |
|
<view class="jiantou-right"></view> |
|
</view> |
|
</view> |
|
|
|
<view class="user-info acea-row row-between"> |
|
<view class="coupon-box acea-row row-between-wrapper" @click="goUserCoupon"> |
|
<view class="title">我的券包</view> |
|
<view class="acea-row row-right"> |
|
<view v-if="String(userInfo.couponCount).length == 1" class="item acea-row row-column-between"> |
|
<view class="top"></view> |
|
<view class="bottom"></view> |
|
<view class="num">0</view> |
|
</view> |
|
<view class="item acea-row row-column-between" v-for="(item,index) in String(userInfo.couponCount)" :key="index"> |
|
<view class="top"></view> |
|
<view class="bottom"></view> |
|
<view class="num">{{item}}</view> |
|
</view> |
|
</view> |
|
</view> |
|
<view class="coupon-box integral-box acea-row row-between-wrapper" @click="goIntegral()"> |
|
<view class="title">我的积分</view> |
|
<view class="acea-row row-right"> |
|
<view v-if="5-String(userInfo.integral).length > 0" class="item acea-row row-column-between" v-for="(item,index) in 5-String(userInfo.integral).length" :key="index"> |
|
<view class="top"></view> |
|
<view class="bottom"></view> |
|
<view class="num">0</view> |
|
</view> |
|
<view class="item acea-row row-column-between" v-for="(item,index) in String(userInfo.integral)" :key="index"> |
|
<view class="top"></view> |
|
<view class="bottom"></view> |
|
<view class="num">{{item}}</view> |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
|
|
<view class="wrapper"> |
|
<!-- <view class="nav acea-row row-middle"> |
|
<view @click="goUserAccount()" class="item"> |
|
<text>我的余额</text> |
|
<text class="num">{{ userInfo.nowMoney || 0 }}</text> |
|
</view> |
|
<view @click="goUserPromotion()" class="item" v-if="userInfo.isPromoter === 1 || userInfo.statu === 2"> |
|
<text>当前佣金</text> |
|
<text class="num">{{ userInfo.brokeragePrice || 0 }}</text> |
|
</view> |
|
<view @click="goIntegral()" class="item" v-else> |
|
<text>当前积分</text> |
|
<text class="num">{{ userInfo.integral || 0 }}</text> |
|
</view> |
|
<view @click="goUserCoupon()" class="item"> |
|
<text>优惠券</text> |
|
<text class="num">{{ userInfo.couponCount || 0 }}</text> |
|
</view> |
|
</view> --> |
|
<view class="myOrder"> |
|
<view class="title acea-row row-between-wrapper"> |
|
<text>我的订单</text> |
|
<view @click="goMyOrder(-1)" class="allOrder acea-row row-middle"> |
|
<view>全部订单</view> |
|
<view class="jiantou-right"></view> |
|
</view> |
|
</view> |
|
<view class="orderState acea-row row-middle" v-if="userInfo.orderStatusNum !== undefined || userInfo.orderStatusNum !== null"> |
|
<view @click="goMyOrder(0)" class="item"> |
|
<view class="pictrue"> |
|
<image src="@/static/images/dfk.png" /> |
|
<text class="order-status-num" v-if="userInfo.orderStatusNum.unpaidCount > 0">{{ userInfo.orderStatusNum.unpaidCount }}</text> |
|
</view> |
|
<view>待付款</view> |
|
</view> |
|
<view @click="goMyOrder(1)" class="item"> |
|
<view class="pictrue"> |
|
<image src="@/static/images/dfh.png" /> |
|
<text class="order-status-num" v-if="userInfo.orderStatusNum.unshippedCount > 0">{{ userInfo.orderStatusNum.unshippedCount }}</text> |
|
</view> |
|
<view>待发货</view> |
|
</view> |
|
<view @click="goMyOrder(2)" class="item"> |
|
<view class="pictrue"> |
|
<image src="@/static/images/dsh.png" /> |
|
<text class="order-status-num" v-if="userInfo.orderStatusNum.receivedCount > 0">{{ userInfo.orderStatusNum.receivedCount }}</text> |
|
</view> |
|
<text>待收货</text> |
|
</view> |
|
<view @click="goMyOrder(3)" class="item"> |
|
<view class="pictrue"> |
|
<image src="@/static/images/dpj.png" /> |
|
<text class="order-status-num" v-if="userInfo.orderStatusNum.evaluatedCount > 0">{{ userInfo.orderStatusNum.evaluatedCount }}</text> |
|
</view> |
|
<text>待评价</text> |
|
</view> |
|
<view @click="goReturnList()" class="item"> |
|
<view class="pictrue"> |
|
<image src="@/static/images/sh.png" /> |
|
<text class="order-status-num" v-if="userInfo.orderStatusNum.refundCount > 0">{{ userInfo.orderStatusNum.refundCount }}</text> |
|
</view> |
|
<text>售后/退款</text> |
|
</view> |
|
</view> |
|
</view> |
|
|
|
<view class="myService"> |
|
<view class="title">我的管理</view> |
|
<view class="serviceList acea-row row-between"> |
|
<template v-for="(item, MyMenusIndex) in MyMenus"> |
|
<view class="item acea-row row-between-wrapper" :key="MyMenusIndex" @click="goPages(item)"> |
|
<view class="pictrue"> |
|
<image :src="item.pic" /> |
|
</view> |
|
<view class=""> |
|
<view class="cell">{{ item.name }}</view> |
|
<view class="enName">{{ item.enName }}</view> |
|
</view> |
|
<!-- <text class="iconfont icon-jiantou"></text> --> |
|
</view> |
|
</template> |
|
</view> |
|
</view> |
|
|
|
<view class="myService" v-if="$store.getters.token || userInfo.uid"> |
|
<view class="title">我的服务</view> |
|
<view class="serviceList acea-row row-between"> |
|
<template v-for="(item, MyMenusIndex) in MyMenus2"> |
|
<view class="item acea-row row-between-wrapper" :key="MyMenusIndex" @click="goPages(item)"> |
|
<view class="pictrue"> |
|
<image :src="item.pic" /> |
|
</view> |
|
<view class=""> |
|
<view class="cell">{{ item.name }}</view> |
|
<view class="enName">{{ item.enName }}</view> |
|
</view> |
|
<button class="contact" v-if="item.name == '联系客服'" hover-class="none" @click="contact"></button> |
|
<!-- <button class="contact" v-if="item.name == '联系客服'" open-type="contact" hover-class="none" bindcontact="handleContact"></button> --> |
|
</view> |
|
</template> |
|
</view> |
|
</view> |
|
|
|
</view> |
|
<!-- <view class="by"> |
|
<view> |
|
<text class="by-text">技术支持</text> |
|
</view> |
|
</view> --> |
|
<!-- <SwitchWindow |
|
v-on:changeswitch="changeswitch" |
|
:switchActive="switchActive" |
|
:login_type="userInfo.login_type" |
|
></SwitchWindow>--> |
|
</view> |
|
<!-- <Authorization v-else /> --> |
|
<Tabbar :pagePath="pagePath"></Tabbar> |
|
</view> |
|
</template> |
|
<script> |
|
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex' |
|
import { getUserInfo, getMenuUser, wxappAuth, bindingPhone, wxappBindingPhone, wxappGetUserInfo } from '@/api/user' |
|
import { login, isWeixin, VUE_APP_RESOURCES_URL, parseQuery, getProvider } from '@/utils' |
|
import SwitchWindow from '@/components/SwitchWindow' |
|
import Tabbar from '@/components/Tabbar'; |
|
// import Authorization from '@/pages/authorization/index' |
|
import dayjs from 'dayjs'; |
|
import cookie from '@/utils/store/cookie'; |
|
import store from '@/store'; |
|
|
|
const NAME = 'User' |
|
|
|
export default { |
|
name: NAME, |
|
components: { |
|
SwitchWindow, |
|
// Authorization, |
|
Tabbar |
|
}, |
|
props: {}, |
|
data: function() { |
|
return { |
|
StatusBar: this.StatusBar, |
|
pagePath: '', |
|
canIUseGetUserProfile: false, |
|
MyMenus: [ |
|
{ |
|
name: "我的收藏", |
|
enName: "MY FAVORITES", |
|
pic: "../../../static/images/my-favorites.png", |
|
uniapp_url: "/pages/shop/GoodsCollection/index" |
|
}, |
|
// { |
|
// name: "积分兑换", |
|
// enName: "EXCHANGE", |
|
// pic: "../../../static/images/exchange.png", |
|
// uniapp_url: "/pages/shop/IntegralList/index" |
|
// }, |
|
{ |
|
name: "地址管理", |
|
enName: "MY ADDRESS", |
|
pic: "../../../static/images/my-address.png", |
|
uniapp_url: "/pages/user/address/AddressManagement/index" |
|
}, |
|
{ |
|
name: "常见问题", |
|
enName: "Q&A", |
|
pic: "../../../static/images/Q&A.png", |
|
uniapp_url: "/pages/user/Problem/index" |
|
}, |
|
{ |
|
name: "我的足迹", |
|
enName: "HISTORY", |
|
pic: "../../../static/images/history.png", |
|
uniapp_url: "/pages/shop/GoodsFoot/index" |
|
} |
|
], |
|
MyMenus2: [ |
|
{ |
|
name: "关于我们", |
|
enName: "ABOUT US", |
|
pic: "../../../static/images/about-us.png", |
|
uniapp_url: "/pages/user/AboutUs/index" |
|
}, |
|
{ |
|
name: "联系客服", |
|
enName: "SERVICE", |
|
pic: "../../../static/images/service.png", |
|
uniapp_url: "" |
|
} |
|
], |
|
switchActive: false, |
|
isWeixin: false, |
|
} |
|
}, |
|
computed: mapGetters(['userInfo']), |
|
onLoad() { |
|
uni.hideTabBar(); |
|
let pages = getCurrentPages(); |
|
this.pagePath = '/' + pages[pages.length - 1].route; |
|
if (wx.getUserProfile) { |
|
this.canIUseGetUserProfile = true |
|
} |
|
}, |
|
watch: { |
|
userInfo() { |
|
// this.MenuUser() |
|
}, |
|
}, |
|
onShow() { |
|
if (this.$store.getters.token) { |
|
// |
|
// uni.showLoading({ |
|
// title: '加载中', |
|
// }) |
|
this.$store.dispatch('getUser', true) |
|
// this.MenuUser() |
|
this.isWeixin = isWeixin() |
|
} |
|
if(this.userInfo.integral === undefined) this.userInfo.integral = 0; |
|
if(this.userInfo.couponCount === undefined) this.userInfo.couponCount = 0; |
|
}, |
|
methods: { |
|
...mapMutations(['updateAuthorizationPage']), |
|
toLogin() { |
|
this.$yrouter.push('/pages/user/Login/index') |
|
}, |
|
goReturnList() { |
|
this.$yrouter.push('/pages/order/ReturnList/index') |
|
}, |
|
goMyOrder(type) { |
|
this.$yrouter.push({ |
|
path: '/pages/order/MyOrder/index', |
|
query: { |
|
type, |
|
}, |
|
}) |
|
}, |
|
// goBindPhone() { |
|
// this.$yrouter.push('/pages/user/BindingPhone/index') |
|
// }, |
|
goVipCenter() { |
|
this.$yrouter.push('/pages/user/UserVip/index') |
|
}, |
|
goUserCoupon() { |
|
this.$yrouter.push('/pages/user/coupon/UserCoupon/index') |
|
}, |
|
goIntegral() { |
|
this.$yrouter.push('/pages/user/signIn/Sign/index'); |
|
// this.$yrouter.push('/pages/user/signIn/Integral/index') |
|
}, |
|
// goUserPromotion() { |
|
// this.$yrouter.push('/pages/user/promotion/UserPromotion/index') |
|
// }, |
|
// goUserAccount() { |
|
// this.$yrouter.push('/pages/user/UserAccount/index') |
|
// }, |
|
goPersonalData() { |
|
if(this.$store.getters.token || this.userInfo.uid) { |
|
this.$yrouter.push('/pages/user/PersonalData/index') |
|
} |
|
}, |
|
// 微信用户手机号登录 |
|
phoneLogin(e) { |
|
console.log('用户微信手机号登录') |
|
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') { |
|
console.log(e.mp.detail) |
|
getProvider() |
|
.then(provider => { |
|
console.log('当前的环境商',provider) |
|
if (!provider) { |
|
reject() |
|
} |
|
let code = cookie.get('wxLoginCode'); |
|
if(code) { |
|
uni.checkSession({ |
|
success: () => { |
|
console.log('登录态未过期'); |
|
wxappAuth({ |
|
encryptedData: e.mp.detail.encryptedData, |
|
iv: e.mp.detail.iv, |
|
code: code, |
|
spread: cookie.get('spread'), |
|
}) |
|
.then( res => { |
|
console.log('登录成功,开始处理登录信息保存,并获取用户详情') |
|
uni.hideLoading() |
|
store.commit('login', res.data.token, dayjs(res.data.expires_time)) |
|
// store.dispatch('userInfo', true) |
|
getUserInfo() |
|
.then(user => { |
|
console.log('获取用户信息成功') |
|
uni.setStorageSync('uid', user.data.uid) |
|
store.dispatch('setUserInfo', user.data) |
|
this.$emit('success', this.$store.getters.token,"this.$store.getters.token") |
|
}) |
|
.catch(error => { |
|
console.log('获取用户信息失败') |
|
}) |
|
}) |
|
.catch(error => { |
|
console.log(error) |
|
console.log('登录接口调用失败') |
|
}) |
|
}, |
|
fail: () => { |
|
console.log('登录态过期'); |
|
uni.login({ |
|
provider: provider, |
|
success: async loginRes => { |
|
console.log(loginRes) |
|
cookie.set('wxLoginCode', loginRes.code) |
|
wxappAuth({ |
|
encryptedData: e.mp.detail.encryptedData, |
|
iv: e.mp.detail.iv, |
|
code: loginRes.code, |
|
spread: cookie.get('spread'), |
|
}) |
|
.then( res => { |
|
console.log('登录成功,开始处理登录信息保存,并获取用户详情') |
|
uni.hideLoading() |
|
store.commit('login', res.data.token, dayjs(res.data.expires_time)) |
|
// store.dispatch('userInfo', true) |
|
getUserInfo() |
|
.then(user => { |
|
console.log('获取用户信息成功') |
|
uni.setStorageSync('uid', user.data.uid) |
|
store.dispatch('setUserInfo', user.data) |
|
this.$emit('success', this.$store.getters.token,"this.$store.getters.token") |
|
}) |
|
.catch(error => { |
|
console.log('获取用户信息失败') |
|
}) |
|
}) |
|
.catch(error => { |
|
console.log(error) |
|
console.log('登录接口调用失败') |
|
}) |
|
} |
|
}) |
|
} |
|
}) |
|
} else { |
|
uni.login({ |
|
provider: 'weixin', |
|
success: async loginRes => { |
|
console.log(loginRes) |
|
cookie.set('wxLoginCode', loginRes.code) |
|
wxappAuth({ |
|
encryptedData: e.mp.detail.encryptedData, |
|
iv: e.mp.detail.iv, |
|
code: loginRes.code, |
|
spread: cookie.get('spread'), |
|
}) |
|
.then( res => { |
|
console.log('登录成功,开始处理登录信息保存,并获取用户详情') |
|
uni.hideLoading() |
|
store.commit('login', res.data.token, dayjs(res.data.expires_time)) |
|
// store.dispatch('userInfo', true) |
|
getUserInfo() |
|
.then(user => { |
|
console.log('获取用户信息成功') |
|
uni.setStorageSync('uid', user.data.uid) |
|
store.dispatch('setUserInfo', user.data) |
|
this.$emit('success', this.$store.getters.token,"this.$store.getters.token") |
|
}) |
|
.catch(error => { |
|
console.log('获取用户信息失败') |
|
}) |
|
}) |
|
.catch(error => { |
|
console.log(error) |
|
console.log('登录接口调用失败') |
|
}) |
|
} |
|
}) |
|
} |
|
|
|
|
|
// uni登录 |
|
// uni.login({ |
|
// provider: provider, |
|
// success: async loginRes => { |
|
// console.log(loginRes) |
|
// let code = loginRes.code // 获取开发code |
|
// cookie.set('wxLoginCode', loginRes.code) |
|
// wxappAuth({ |
|
// encryptedData: e.mp.detail.encryptedData, |
|
// iv: e.mp.detail.iv, |
|
// code: code, |
|
// spread: cookie.get('spread'), |
|
// }) |
|
// .then( res => { |
|
// console.log('登录成功,开始处理登录信息保存,并获取用户详情') |
|
// uni.hideLoading() |
|
// store.commit('login', res.data.token, dayjs(res.data.expires_time)) |
|
// store.dispatch('userInfo', true) |
|
// getUserInfo() |
|
// .then(user => { |
|
// console.log('获取用户信息成功') |
|
// uni.setStorageSync('uid', user.data.uid) |
|
// store.dispatch('setUserInfo', user.data) |
|
// this.$emit('success', this.$store.getters.token,"this.$store.getters.token") |
|
// // this.$yrouter.reLaunch({ |
|
// // path: cookie.get('redirect').replace(/\ /g, ''), |
|
// // }) |
|
// }) |
|
// .catch(error => { |
|
// console.log('获取用户信息失败') |
|
// }) |
|
// }) |
|
// .catch(error => { |
|
// console.log(error) |
|
// console.log('登录接口调用失败') |
|
// }) |
|
// } |
|
// }) |
|
}) |
|
.catch(err => {}) |
|
} else { |
|
uni.showToast({ |
|
title: '已拒绝授权', |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
} |
|
}, |
|
/* getPhoneNumber(e) { |
|
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定 |
|
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') { |
|
uni.showLoading({ |
|
title: '绑定中', |
|
}) |
|
wxappBindingPhone({ |
|
encryptedData: e.mp.detail.encryptedData, |
|
iv: e.mp.detail.iv, |
|
}) |
|
.then(res => { |
|
// this.User(); |
|
this.$store.dispatch('userInfo', true) |
|
uni.hideLoading() |
|
uni.showToast({ |
|
title: res.msg, |
|
icon: 'success', |
|
duration: 2000, |
|
}) |
|
}) |
|
.catch(error => { |
|
uni.hideLoading() |
|
this.$store.dispatch('userInfo', true) |
|
console.log(error) |
|
uni.showToast({ |
|
title: error.msg || error.response.data.msg || error.response.data.message, |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
}) |
|
// // 获取当前环境的服务商 |
|
// uni.getProvider({ |
|
// service: "oauth", |
|
// success: function (res) { |
|
// // 此处可以排除h5 |
|
// if (res.provider) { |
|
// uni.login({ |
|
// success: loginRes => { |
|
// bindingPhone({ |
|
// code: loginRes.code, |
|
// encryptedData: e.mp.detail.encryptedData, |
|
// iv: e.mp.detail.iv |
|
// }) |
|
// .then(res => { |
|
// // this.User(); |
|
// this.$store.dispatch("userInfo", true); |
|
// uni.hideLoading(); |
|
// uni.showToast({ |
|
// title: res.msg, |
|
// icon: "success", |
|
// duration: 2000 |
|
// }); |
|
// }) |
|
// .catch(error => { |
|
// uni.hideLoading(); |
|
// this.$store.dispatch("userInfo", true); |
|
// console.log(error); |
|
// uni.showToast({ |
|
// title: error.msg || |
|
// error.response.data.msg || |
|
// error.response.data.message, |
|
// icon: "none", |
|
// duration: 2000 |
|
// }); |
|
// }); |
|
// }, |
|
// fail() { |
|
// reject("绑定失败"); |
|
// } |
|
// }); |
|
// } |
|
// }, |
|
// fail() { |
|
// reject("获取环境服务商失败"); |
|
// } |
|
// }); |
|
} else { |
|
uni.showToast({ |
|
title: '已拒绝授权', |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
} |
|
}, */ |
|
// 获取用户授权,读取头像、昵称 |
|
getUserInfo(data) { |
|
if (data.detail.errMsg == 'getUserInfo:fail auth deny') { |
|
uni.showToast({ |
|
title: '取消授权', |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
return |
|
} |
|
}, |
|
// 申请获取用户信息 |
|
getUserInfoProfile(data) { |
|
wx.getUserProfile({ |
|
lang: 'zh_CN', |
|
desc: '需要获取您的信息用来展示', |
|
success: res => { |
|
uni.showLoading({ |
|
title: '正在更新信息...', |
|
duration: 2000, |
|
}) |
|
getProvider().then(provider => { |
|
// 环境提供商 |
|
if (!provider) { |
|
reject() |
|
} |
|
// 获取开发code |
|
uni.login({ |
|
provider: provider, |
|
success: async loginRes => { |
|
wxappGetUserInfo({ |
|
encryptedData: res.encryptedData, |
|
iv: res.iv, |
|
code: loginRes.code, // 开发code |
|
}).then(res => { |
|
if (res.status === 200) { |
|
this.userInfo.avatar = res.data.avatar |
|
this.userInfo.nickname = res.data.nickname |
|
} else { |
|
uni.showLoading({ |
|
title: res.msg, |
|
duration: 2000, |
|
}) |
|
} |
|
}) |
|
}, |
|
}) |
|
}) |
|
}, |
|
}) |
|
}, |
|
changeswitch(data) { |
|
this.switchActive = data |
|
}, |
|
// 获取用户信息 |
|
MenuUser() { |
|
getMenuUser() |
|
.then(res => { |
|
uni.hideLoading() |
|
this.MyMenus = res.data.routine_my_menus |
|
}) |
|
.catch(error => { |
|
uni.hideLoading() |
|
console.log(error) |
|
}) |
|
}, |
|
goPages(item) { |
|
if(!item.uniapp_url) return; |
|
let url = item.uniapp_url |
|
if (url === '/pages/user/promotion/UserPromotion/index' && this.userInfo.statu === 1) { |
|
if (!this.userInfo.isPromoter) { |
|
uni.showToast({ |
|
title: '您还没有推广权限!!', |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
return |
|
} |
|
} |
|
|
|
if (url === '/pages/orderAdmin/OrderIndex/index' && !this.userInfo.adminid) { |
|
uni.showToast({ |
|
title: '您还不是管理员!!', |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
return |
|
} |
|
console.log(this.userInfo) |
|
if (url === '/pages/orderAdmin/OrderCancellation/index' && !this.userInfo.checkStatus) { |
|
uni.showToast({ |
|
title: '您没有核销权限,请后台店员设置!!', |
|
icon: 'none', |
|
duration: 2000, |
|
}) |
|
return |
|
} |
|
|
|
this.$yrouter.push({ |
|
path: url, |
|
}) |
|
}, |
|
goPages2() { |
|
this.$yrouter.push({ |
|
path: '/pages/shop/GoodsList/index', |
|
query: { |
|
// id: 0, |
|
title: '积分商城', |
|
isIntegral: true, |
|
}, |
|
}) |
|
}, |
|
// 客服 |
|
contact() { |
|
wx.openCustomerServiceChat({ |
|
extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc3952c32f3d9b68c3'}, |
|
corpId: 'ww8bcef4602d97a76a', |
|
success(res) {} |
|
}) |
|
}, |
|
// handleContact (e) { |
|
// // console.log(e.detail.path) |
|
// // console.log(e.detail.query) |
|
// }, |
|
}, |
|
onHide() { |
|
console.log('离开用户中心') |
|
this.updateAuthorizationPage(false) |
|
}, |
|
} |
|
</script> |
|
<style> |
|
page { |
|
background-color: #FFFFFF; |
|
} |
|
</style> |
|
<style lang="less" scoped> |
|
.user .bg { |
|
width: 100vw; |
|
height: 530rpx; |
|
position: absolute; |
|
top: 0; |
|
left: 0; |
|
z-index: -1; |
|
image { |
|
width: 100%; |
|
height: 100%; |
|
} |
|
} |
|
|
|
.user .header { |
|
.set-icon { |
|
position: absolute; |
|
bottom: 14rpx; |
|
right: 24rpx; |
|
width: 62rpx; |
|
height: 62rpx; |
|
} |
|
.author-btn { |
|
padding: 0; |
|
width: auto; |
|
height: auto; |
|
border: 0 !important; |
|
background-color: transparent; |
|
} |
|
button::after{ |
|
border: 0; |
|
} |
|
} |
|
|
|
.user .vip-box { |
|
margin: 0rpx 32rpx 10rpx; |
|
padding-left: 10rpx; |
|
padding-right: 20rpx; |
|
width: 686rpx; |
|
height: 76rpx; |
|
box-shadow: inset 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.15); |
|
border-radius: 16rpx; |
|
font-size: 26rpx; |
|
font-family: PingFangTC; |
|
font-weight: 600; |
|
color: #F5F6F8; |
|
line-height: 34rpx; |
|
image { |
|
width: 36rpx; |
|
height: 36rpx; |
|
} |
|
.more { |
|
font-size: 20rpx; |
|
font-family: PingFang SC; |
|
font-weight: 400; |
|
color: #FFFFFF; |
|
line-height: 26rpx; |
|
.jiantou-right { |
|
width: 0; |
|
height: 0; |
|
border-top: 6rpx solid transparent; |
|
border-left: 10rpx solid #FFFFFF; |
|
border-bottom: 6rpx solid transparent; |
|
border-right: 0rpx solid transparent; |
|
margin-left: 8rpx; |
|
} |
|
} |
|
} |
|
|
|
.user .user-info { |
|
margin: 0rpx 32rpx 32rpx; |
|
.coupon-box { |
|
width: 290rpx; |
|
height: 76rpx; |
|
box-shadow: inset 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.15); |
|
border-radius: 16rpx; |
|
padding-left: 16rpx; |
|
padding-right: 12rpx; |
|
.title { |
|
font-size: 26rpx; |
|
font-family: PingFangTC; |
|
font-weight: 600; |
|
color: #F5F6F8; |
|
line-height: 34rpx; |
|
} |
|
.item { |
|
width: 40rpx; |
|
height: 56rpx; |
|
margin-left: 6rpx; |
|
position: relative; |
|
.top { |
|
width: 40rpx; |
|
height: 26rpx; |
|
background: #3A3A3C; |
|
border-radius: 8rpx 8rpx 0rpx 0rpx; |
|
} |
|
.bottom { |
|
width: 40rpx; |
|
height: 26rpx; |
|
background: #3A3A3C; |
|
border-radius: 0rpx 0rpx 8rpx 8rpx; |
|
} |
|
.num { |
|
position: absolute; |
|
top: 0; |
|
left: 0; |
|
width: 100%; |
|
height: 100%; |
|
font-size: 40rpx; |
|
font-family: Futura; |
|
font-weight: 600; |
|
color: #F5F6F8; |
|
line-height: 56rpx; |
|
text-align: center; |
|
} |
|
} |
|
} |
|
.integral-box { |
|
width: 384rpx; |
|
height: 76rpx; |
|
} |
|
} |
|
|
|
// .getUserBaseData { |
|
// .userDataBtn { |
|
// width: 80%; |
|
// height: 80rpx; |
|
// background: linear-gradient(to right, #f35447 0%, #ff8e3c 100%); |
|
// background: -moz-linear-gradient(to right, #f35447 0%, #ff8e3c 100%); |
|
// border-radius: 40rpx; |
|
// font-size: 30rpx; |
|
// font-family: PingFang SC; |
|
// font-weight: 500; |
|
// color: rgba(255, 255, 255, 1); |
|
// } |
|
// } |
|
// .footer-line-height { |
|
// height: 1 * 100rpx; |
|
// } |
|
|
|
|
|
.orderState .pictrue { |
|
position: relative; |
|
.order-status-num { |
|
// min-width: 20rpx; |
|
background-color: #F1F1F1; |
|
font-size: 16rpx; |
|
font-family: PingFang SC; |
|
font-weight: 500; |
|
line-height: 20rpx; |
|
color: #2DB5AE; |
|
border-radius: 12rpx; |
|
position: absolute; |
|
right: -2rpx; |
|
top: -2rpx; |
|
padding: 0 6rpx; |
|
border: 2rpx solid #2DB5AE; |
|
} |
|
} |
|
|
|
.serviceList .item { |
|
position: relative; |
|
.contact { |
|
width: 332rpx; |
|
height: 142rpx; |
|
opacity: 0; |
|
position: absolute; |
|
top: 0; |
|
left: 0; |
|
z-index: 1; |
|
} |
|
} |
|
|
|
.switch-h5 { |
|
margin-left: 0.2 * 100rpx; |
|
} |
|
|
|
.binding { |
|
margin-top: 0.1 * 100rpx; |
|
display: inline-block; |
|
padding: 0.05 * 100rpx 0.2 * 100rpx; |
|
background-color: #ca1f10; |
|
border-radius: 50px; |
|
font-size: 0.22 * 100rpx; |
|
line-height: 1.5; |
|
border: 1px solid #e8695e; |
|
color: #ffffff; |
|
} |
|
|
|
// .by { |
|
// text-align: center; |
|
// padding: 30rpx 0; |
|
// } |
|
|
|
// .by-text { |
|
// text-align: center; |
|
// font-size: 24rpx; |
|
// } |
|
</style>
|
|
|