gaoxs
5 years ago
47 changed files with 943 additions and 919 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,192 +1,213 @@
|
||||
<template> |
||||
<view class="container"> |
||||
<view v-if="!isAuthorization"> |
||||
<view class="getUserInfo"> |
||||
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text> |
||||
<view style="height:20rpx"></view> |
||||
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button> |
||||
<view style="height:20rpx"></view> |
||||
<button @click="back">取消微信登录授权</button> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="container"> |
||||
<view v-if="!$store.getters.token&&$deviceType=='Weixin'"> |
||||
<view class="getUserInfo"> |
||||
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text> |
||||
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button> |
||||
<view style="height:20rpx"></view> |
||||
<button @click="back">取消微信登录授权</button> |
||||
</view> |
||||
</view> |
||||
<view v-if="!$store.getters.token&&$deviceType!='Weixin'"> |
||||
<view class="getUserInfo"> |
||||
<text>请先登录</text> |
||||
<button type="primary" @click="this.toLogin">去登录</button> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState, mapMutations, mapActions } from "vuex"; |
||||
// 组件 |
||||
// import request from "@//api/request"; |
||||
import { wxappAuth, getUser } from "@/api/user"; |
||||
import dayjs from "dayjs"; |
||||
import cookie from "@/utils/store/cookie"; |
||||
import { login } from "@/utils"; |
||||
|
||||
export default { |
||||
data() { |
||||
return {}; |
||||
}, |
||||
computed: { |
||||
...mapState(["isAuthorization"]) |
||||
}, |
||||
onShow() { |
||||
this.UPDATE_AUTHORIZATIONPAGE(true); |
||||
}, |
||||
onHide() { |
||||
this.UPDATE_AUTHORIZATIONPAGE(false); |
||||
this.changeAuthorization(false); |
||||
}, |
||||
onUnload() { |
||||
this.UPDATE_AUTHORIZATIONPAGE(false); |
||||
this.changeAuthorization(false); |
||||
}, |
||||
methods: { |
||||
...mapActions(["changeAuthorization", "setUserInfo"]), |
||||
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]), |
||||
back() { |
||||
this.$yrouter.switchTab({ |
||||
path: "/pages/home/index", |
||||
query: {} |
||||
}); |
||||
}, |
||||
getUserInfo(data) { |
||||
if (data.detail.errMsg == "getUserInfo:fail auth deny") { |
||||
uni.showToast({ |
||||
title: "取消授权", |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
return; |
||||
} |
||||
uni.showLoading({ |
||||
title: "登录中" |
||||
}); |
||||
login({ |
||||
success: () => {} |
||||
}); |
||||
} |
||||
}, |
||||
onUnload() {}, |
||||
mounted() {} |
||||
}; |
||||
import { |
||||
mapState, |
||||
mapMutations, |
||||
mapActions |
||||
} from "vuex"; |
||||
// 组件 |
||||
// import request from "@//api/request"; |
||||
import { |
||||
wxappAuth, |
||||
getUser |
||||
} from "@/api/user"; |
||||
import dayjs from "dayjs"; |
||||
import cookie from "@/utils/store/cookie"; |
||||
import { |
||||
login |
||||
} from "@/utils"; |
||||
|
||||
export default { |
||||
data() { |
||||
return {}; |
||||
}, |
||||
computed: { |
||||
...mapState(["isAuthorization"]) |
||||
}, |
||||
onShow() { |
||||
this.UPDATE_AUTHORIZATIONPAGE(true); |
||||
}, |
||||
onHide() { |
||||
this.UPDATE_AUTHORIZATIONPAGE(false); |
||||
this.changeAuthorization(false); |
||||
}, |
||||
onUnload() { |
||||
this.UPDATE_AUTHORIZATIONPAGE(false); |
||||
this.changeAuthorization(false); |
||||
}, |
||||
methods: { |
||||
...mapActions(["changeAuthorization", "setUserInfo"]), |
||||
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]), |
||||
back() { |
||||
this.$yrouter.switchTab({ |
||||
path: "/pages/home/index", |
||||
query: {} |
||||
}); |
||||
}, |
||||
getUserInfo(data) { |
||||
if (data.detail.errMsg == "getUserInfo:fail auth deny") { |
||||
uni.showToast({ |
||||
title: "取消授权", |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
return; |
||||
} |
||||
uni.showLoading({ |
||||
title: "登录中" |
||||
}); |
||||
login({ |
||||
success: () => {} |
||||
}); |
||||
}, |
||||
toLogin() { |
||||
this.$yrouter.push({ |
||||
path: "/pages/user/Login/index", |
||||
query: {} |
||||
}); |
||||
} |
||||
}, |
||||
onUnload() {}, |
||||
mounted() {} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="less"> |
||||
.sp-cell { |
||||
height: 20rpx; |
||||
} |
||||
|
||||
.getUserInfo { |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
padding: 30px; |
||||
|
||||
p { |
||||
margin-bottom: 20px; |
||||
} |
||||
} |
||||
|
||||
.container { |
||||
flex: 1; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: flex-start; |
||||
position: relative; |
||||
} |
||||
|
||||
.tab-bar { |
||||
font-size: 0; |
||||
display: flex; |
||||
align-items: center; |
||||
background: rgba(255, 255, 255, 0.9); |
||||
position: fixed; |
||||
bottom: 0; |
||||
left: 0; |
||||
right: 0; |
||||
z-index: 99; |
||||
border-top: 1px solid rgba(248, 248, 248, 1); |
||||
|
||||
.tab-bar-item { |
||||
flex: 1; |
||||
height: 49px; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
|
||||
&.active { |
||||
text { |
||||
color: #ee7559; |
||||
} |
||||
|
||||
.tab-bar-pic { |
||||
display: none; |
||||
background: #f9f9f9; |
||||
|
||||
&.active { |
||||
display: block; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-bar-pic { |
||||
display: block; |
||||
background: #f9f9f9; |
||||
|
||||
&.active { |
||||
display: none; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-bar-pic { |
||||
width: 25px; |
||||
height: 25px; |
||||
background: #f9f9f9; |
||||
|
||||
image { |
||||
width: 25px; |
||||
height: 25px; |
||||
} |
||||
} |
||||
|
||||
.tab-bar-pic-active { |
||||
} |
||||
|
||||
text { |
||||
font-size: 10px; |
||||
color: rgb(160, 160, 160); |
||||
line-height: 10px; |
||||
margin-top: 5px; |
||||
} |
||||
} |
||||
|
||||
.tab-bar-bg { |
||||
padding-top: 46px; |
||||
width: 100%; |
||||
} |
||||
|
||||
.view-item { |
||||
display: none; |
||||
width: 100%; |
||||
} |
||||
|
||||
.view-item-active { |
||||
display: block; |
||||
} |
||||
|
||||
.getUserInfo { |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
padding: 30px; |
||||
|
||||
p { |
||||
margin-bottom: 20px; |
||||
} |
||||
} |
||||
|
||||
._van-dialog { |
||||
z-index: 99999999999; |
||||
} |
||||
</style> |
||||
.sp-cell { |
||||
height: 20rpx; |
||||
} |
||||
|
||||
.getUserInfo { |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
padding: 30px; |
||||
|
||||
text { |
||||
font-size: 30rpx; |
||||
text-align: center; |
||||
margin-bottom: 20px; |
||||
} |
||||
} |
||||
|
||||
.container { |
||||
flex: 1; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: flex-start; |
||||
position: relative; |
||||
} |
||||
|
||||
.tab-bar { |
||||
font-size: 0; |
||||
display: flex; |
||||
align-items: center; |
||||
background: rgba(255, 255, 255, 0.9); |
||||
position: fixed; |
||||
bottom: 0; |
||||
left: 0; |
||||
right: 0; |
||||
z-index: 99; |
||||
border-top: 1px solid rgba(248, 248, 248, 1); |
||||
|
||||
.tab-bar-item { |
||||
flex: 1; |
||||
height: 49px; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
|
||||
&.active { |
||||
text { |
||||
color: #ee7559; |
||||
} |
||||
|
||||
.tab-bar-pic { |
||||
display: none; |
||||
background: #f9f9f9; |
||||
|
||||
&.active { |
||||
display: block; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-bar-pic { |
||||
display: block; |
||||
background: #f9f9f9; |
||||
|
||||
&.active { |
||||
display: none; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-bar-pic { |
||||
width: 25px; |
||||
height: 25px; |
||||
background: #f9f9f9; |
||||
|
||||
image { |
||||
width: 25px; |
||||
height: 25px; |
||||
} |
||||
} |
||||
|
||||
.tab-bar-pic-active {} |
||||
|
||||
text { |
||||
font-size: 10px; |
||||
color: rgb(160, 160, 160); |
||||
line-height: 10px; |
||||
margin-top: 5px; |
||||
} |
||||
} |
||||
|
||||
.tab-bar-bg { |
||||
padding-top: 46px; |
||||
width: 100%; |
||||
} |
||||
|
||||
.view-item { |
||||
display: none; |
||||
width: 100%; |
||||
} |
||||
|
||||
.view-item-active { |
||||
display: block; |
||||
} |
||||
|
||||
.getUserInfo { |
||||
display: flex; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
padding: 30px; |
||||
|
||||
p { |
||||
margin-bottom: 20px; |
||||
} |
||||
} |
||||
|
||||
._van-dialog { |
||||
z-index: 99999999999; |
||||
} |
||||
</style> |
||||
|
@ -1,359 +1,355 @@
|
||||
<template> |
||||
<view class="user"> |
||||
<view v-if="userInfo.uid"> |
||||
<view class="header bg-color-red acea-row row-between-wrapper"> |
||||
<view class="picTxt acea-row row-between-wrapper"> |
||||
<view class="pictrue"> |
||||
<image :src="userInfo.avatar" /> |
||||
</view> |
||||
<view class="text"> |
||||
<view class="acea-row row-middle"> |
||||
<view class="name line1">{{ userInfo.nickname }}</view> |
||||
<view class="member acea-row row-middle" v-if="userInfo.vip"> |
||||
<image :src="userInfo.vipIcon" /> |
||||
<text>{{ userInfo.vipName }}</text> |
||||
</view> |
||||
</view> |
||||
<view @click="goPersonalData()" class="id" v-if="userInfo.phone"> |
||||
<text>ID:{{ userInfo.uid || 0}}</text> |
||||
<text class="iconfont icon-bianji1"></text> |
||||
</view> |
||||
<button |
||||
open-type="getPhoneNumber" |
||||
@getphonenumber="getPhoneNumber" |
||||
class="binding" |
||||
v-else |
||||
> |
||||
<text>绑定手机号</text> |
||||
</button> |
||||
</view> |
||||
</view> |
||||
<text class="iconfont icon-shezhi" @click="goPersonalData()"></text> |
||||
</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> |
||||
<text @click="goMyOrder()" class="allOrder"> |
||||
<text>全部订单</text> |
||||
<text class="iconfont icon-jiantou"></text> |
||||
</text> |
||||
</view> |
||||
<view class="orderState acea-row row-middle"> |
||||
<view @click="goMyOrder(0)" class="item"> |
||||
<view class="pictrue"> |
||||
<image :src="$VUE_APP_RESOURCES_URL + '/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="$VUE_APP_RESOURCES_URL+'/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="$VUE_APP_RESOURCES_URL+'/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="$VUE_APP_RESOURCES_URL+'/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="$VUE_APP_RESOURCES_URL+'/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 acea-row row-middle"> |
||||
<text>我的服务</text> |
||||
</view> |
||||
<view class="serviceList acea-row row-middle"> |
||||
<template v-for="(item, MyMenusIndex) in MyMenus"> |
||||
<view class="item" :key="MyMenusIndex" @click="goPages(MyMenusIndex)" v-if="item.url"> |
||||
<view class="pictrue"> |
||||
<image :src="item.pic" /> |
||||
</view> |
||||
<view>{{ item.name }}</view> |
||||
</view> |
||||
</template> |
||||
</view> |
||||
</view> |
||||
<!--<view --> |
||||
<!--class="item"--> |
||||
<!--@click="changeswitch(true)"--> |
||||
<!--v-if="userInfo.phone && isWeixin"--> |
||||
<!-->--> |
||||
<!--<view class="pictrue"><image :src="$VUE_APP_RESOURCES_URL+'/images/switch.png'" /></view>--> |
||||
<!--<view>账号切换</!--<view>--> |
||||
<!--</!--<view>--> |
||||
<!-- </view> |
||||
<view class="user"> |
||||
<view v-if="userInfo.uid"> |
||||
<view class="header bg-color-red acea-row row-between-wrapper"> |
||||
<view class="picTxt acea-row row-between-wrapper"> |
||||
<view class="pictrue"> |
||||
<image :src="userInfo.avatar" /> |
||||
</view> |
||||
<view class="text"> |
||||
<view class="acea-row row-middle"> |
||||
<view class="name line1">{{ userInfo.nickname }}</view> |
||||
<view class="member acea-row row-middle" v-if="userInfo.vip"> |
||||
<image :src="userInfo.vipIcon" /> |
||||
<text>{{ userInfo.vipName }}</text> |
||||
</view> |
||||
</view> |
||||
<view @click="goPersonalData()" class="id" v-if="userInfo.phone"> |
||||
<text>ID:{{ userInfo.uid || 0}}</text> |
||||
<text class="iconfont icon-bianji1"></text> |
||||
</view> |
||||
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else> |
||||
<text>绑定手机号</text> |
||||
</button> |
||||
</view> |
||||
</view> |
||||
<text class="iconfont icon-shezhi" @click="goPersonalData()"></text> |
||||
</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> |
||||
<text @click="goMyOrder()" class="allOrder"> |
||||
<text>全部订单</text> |
||||
<text class="iconfont icon-jiantou"></text> |
||||
</text> |
||||
</view> |
||||
<view class="orderState acea-row row-middle"> |
||||
<view @click="goMyOrder(0)" class="item"> |
||||
<view class="pictrue"> |
||||
<image :src="$VUE_APP_RESOURCES_URL + '/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="$VUE_APP_RESOURCES_URL+'/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="$VUE_APP_RESOURCES_URL+'/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="$VUE_APP_RESOURCES_URL+'/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="$VUE_APP_RESOURCES_URL+'/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 acea-row row-middle"> |
||||
<text>我的服务</text> |
||||
</view> |
||||
<view class="serviceList acea-row row-middle"> |
||||
<template v-for="(item, MyMenusIndex) in MyMenus"> |
||||
<view class="item" :key="MyMenusIndex" @click="goPages(MyMenusIndex)" v-if="item.url"> |
||||
<view class="pictrue"> |
||||
<image :src="item.pic" /> |
||||
</view> |
||||
<view>{{ item.name }}</view> |
||||
</view> |
||||
</template> |
||||
</view> |
||||
</view> |
||||
<!--<view --> |
||||
<!--class="item"--> |
||||
<!--@click="changeswitch(true)"--> |
||||
<!--v-if="userInfo.phone && isWeixin"--> |
||||
<!-->--> |
||||
<!--<view class="pictrue"><image :src="$VUE_APP_RESOURCES_URL+'/images/switch.png'" /></view>--> |
||||
<!--<view>账号切换</!--<view>--> |
||||
<!--</!--<view>--> |
||||
<!-- </view> |
||||
</view>--> |
||||
</view> |
||||
<view style="text-align: center;margin-top: 1rem">By@意象</view> |
||||
<view class="footer-line-height"></view> |
||||
<!-- <SwitchWindow |
||||
</view> |
||||
<view class="by"> |
||||
<text class="by-text">By@意象</text> |
||||
</view> |
||||
<view class="footer-line-height"></view> |
||||
<!-- <SwitchWindow |
||||
v-on:changeswitch="changeswitch" |
||||
:switchActive="switchActive" |
||||
:login_type="userInfo.login_type" |
||||
></SwitchWindow> --> |
||||
</view> |
||||
<Authorization v-else /> |
||||
</view> |
||||
</view> |
||||
<Authorization v-if="!$store.getters.token" /> |
||||
</view> |
||||
</template> |
||||
<script> |
||||
import { getUser, getMenuUser, bindingPhone } from "@/api/user"; |
||||
import { isWeixin, VUE_APP_RESOURCES_URL } from "@/utils"; |
||||
import SwitchWindow from "@/components/SwitchWindow"; |
||||
import Authorization from "@/pages/authorization/index"; |
||||
import { mapGetters } from "vuex"; |
||||
import { |
||||
getUser, |
||||
getMenuUser, |
||||
bindingPhone |
||||
} from "@/api/user"; |
||||
import { |
||||
isWeixin, |
||||
VUE_APP_RESOURCES_URL |
||||
} from "@/utils"; |
||||
import SwitchWindow from "@/components/SwitchWindow"; |
||||
import Authorization from "@/pages/authorization/index"; |
||||
import { |
||||
mapGetters |
||||
} from "vuex"; |
||||
|
||||
const NAME = "User"; |
||||
const NAME = "User"; |
||||
|
||||
export default { |
||||
name: NAME, |
||||
components: { |
||||
SwitchWindow, |
||||
Authorization |
||||
}, |
||||
props: {}, |
||||
data: function() { |
||||
return { |
||||
MyMenus: [], |
||||
switchActive: false, |
||||
isWeixin: false |
||||
}; |
||||
}, |
||||
computed: mapGetters(["userInfo"]), |
||||
methods: { |
||||
goReturnList() { |
||||
this.$yrouter.push("/pages/order/ReturnList/index"); |
||||
}, |
||||
goMyOrder(type) { |
||||
this.$yrouter.push({ |
||||
path: "/pages/order/MyOrder/index", |
||||
query: { |
||||
type |
||||
} |
||||
}); |
||||
}, |
||||
goUserCoupon() { |
||||
this.$yrouter.push("/pages/user/coupon/UserCoupon/index"); |
||||
}, |
||||
goIntegral() { |
||||
this.$yrouter.push("/pages/user/signIn/Integral/index"); |
||||
}, |
||||
goUserPromotion() { |
||||
this.$yrouter.push("/pages/user/promotion/UserPromotion/index"); |
||||
}, |
||||
goUserAccount() { |
||||
this.$yrouter.push({ |
||||
path: "/pages/user/UserAccount/index" |
||||
}); |
||||
}, |
||||
goPersonalData() { |
||||
this.$yrouter.push("/pages/user/PersonalData/index"); |
||||
}, |
||||
getPhoneNumber: function(e) { |
||||
console.log(e.mp.detail); |
||||
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定 |
||||
if (e.mp.detail.errMsg == "getPhoneNumber:ok") { |
||||
uni.showLoading({ |
||||
title: "绑定中" |
||||
}); |
||||
// 获取当前环境的服务商 |
||||
uni.getProvider({ |
||||
service: "oauth", |
||||
success: function(res) { |
||||
console.log(res.provider); |
||||
// 此处可以排除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(); |
||||
uni.hideLoading(); |
||||
uni.showToast({ |
||||
title: res.msg, |
||||
icon: "success", |
||||
duration: 2000 |
||||
}); |
||||
}) |
||||
.catch(error => { |
||||
uni.showToast({ |
||||
title: error.msg || error.response.data.msg, |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
uni.showToast({ |
||||
title: "已拒绝授权", |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
} |
||||
}, |
||||
changeswitch: function(data) { |
||||
this.switchActive = data; |
||||
}, |
||||
User: function() { |
||||
let that = this; |
||||
// getUser().then(res => { |
||||
// that.user = res.data; |
||||
// that.orderStatusNum = res.data.orderStatusNum; |
||||
// }); |
||||
}, |
||||
MenuUser: function() { |
||||
let that = this; |
||||
getMenuUser().then(res => { |
||||
that.MyMenus = res.data.routine_my_menus; |
||||
}); |
||||
}, |
||||
goPages: function(index) { |
||||
let url = this.MyMenus[index].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; |
||||
} |
||||
} |
||||
export default { |
||||
name: NAME, |
||||
components: { |
||||
SwitchWindow, |
||||
Authorization |
||||
}, |
||||
props: {}, |
||||
data: function() { |
||||
return { |
||||
MyMenus: [], |
||||
switchActive: false, |
||||
isWeixin: false |
||||
}; |
||||
}, |
||||
computed: mapGetters(["userInfo"]), |
||||
methods: { |
||||
goReturnList() { |
||||
this.$yrouter.push("/pages/order/ReturnList/index"); |
||||
}, |
||||
goMyOrder(type) { |
||||
this.$yrouter.push({ |
||||
path: "/pages/order/MyOrder/index", |
||||
query: { |
||||
type |
||||
} |
||||
}); |
||||
}, |
||||
goUserCoupon() { |
||||
this.$yrouter.push("/pages/user/coupon/UserCoupon/index"); |
||||
}, |
||||
goIntegral() { |
||||
this.$yrouter.push("/pages/user/signIn/Integral/index"); |
||||
}, |
||||
goUserPromotion() { |
||||
this.$yrouter.push("/pages/user/promotion/UserPromotion/index"); |
||||
}, |
||||
goUserAccount() { |
||||
this.$yrouter.push({ |
||||
path: "/pages/user/UserAccount/index" |
||||
}); |
||||
}, |
||||
goPersonalData() { |
||||
this.$yrouter.push("/pages/user/PersonalData/index"); |
||||
}, |
||||
getPhoneNumber: function(e) { |
||||
console.log(e.mp.detail); |
||||
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定 |
||||
if (e.mp.detail.errMsg == "getPhoneNumber:ok") { |
||||
uni.showLoading({ |
||||
title: "绑定中" |
||||
}); |
||||
// 获取当前环境的服务商 |
||||
uni.getProvider({ |
||||
service: "oauth", |
||||
success: function(res) { |
||||
console.log(res.provider); |
||||
// 此处可以排除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(); |
||||
uni.hideLoading(); |
||||
uni.showToast({ |
||||
title: res.msg, |
||||
icon: "success", |
||||
duration: 2000 |
||||
}); |
||||
}) |
||||
.catch(error => { |
||||
uni.showToast({ |
||||
title: error.msg || error.response.data.msg, |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
uni.showToast({ |
||||
title: "已拒绝授权", |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
} |
||||
}, |
||||
changeswitch: function(data) { |
||||
this.switchActive = data; |
||||
}, |
||||
User: function() { |
||||
let that = this; |
||||
// getUser().then(res => { |
||||
// that.user = res.data; |
||||
// that.orderStatusNum = res.data.orderStatusNum; |
||||
// }); |
||||
}, |
||||
MenuUser: function() { |
||||
let that = this; |
||||
getMenuUser().then(res => { |
||||
that.MyMenus = res.data.routine_my_menus; |
||||
}); |
||||
}, |
||||
goPages: function(index) { |
||||
let url = this.MyMenus[index].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; |
||||
} |
||||
if ( |
||||
url === "/pages/orderAdmin/OrderIndex/index" && |
||||
!this.userInfo.adminid |
||||
) { |
||||
uni.showToast({ |
||||
title: "您还不是管理员!!", |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
this.$yrouter.push({ |
||||
path: this.MyMenus[index].uniapp_url |
||||
}); |
||||
} |
||||
}, |
||||
watch: { |
||||
userInfo() { |
||||
this.MenuUser(); |
||||
} |
||||
}, |
||||
onShow() { |
||||
console.log(this.userInfo); |
||||
if (this.$store.getters.token) { |
||||
this.User(); |
||||
this.MenuUser(); |
||||
this.isWeixin = isWeixin(); |
||||
} |
||||
} |
||||
}; |
||||
this.$yrouter.push({ |
||||
path: this.MyMenus[index].uniapp_url |
||||
}); |
||||
} |
||||
}, |
||||
watch: { |
||||
userInfo() { |
||||
this.MenuUser(); |
||||
} |
||||
}, |
||||
onShow() { |
||||
console.log(this.userInfo); |
||||
if (this.$store.getters.token) { |
||||
this.User(); |
||||
this.MenuUser(); |
||||
this.isWeixin = isWeixin(); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style> |
||||
.footer-line-height { |
||||
height: 1rem; |
||||
} |
||||
<style lang="less"> |
||||
.footer-line-height { |
||||
height: 1*100rpx; |
||||
} |
||||
|
||||
.order-status-num { |
||||
min-width: 0.33rem; |
||||
background-color: #fff; |
||||
color: #73cbb6; |
||||
border-radius: 15px; |
||||
position: absolute; |
||||
right: -0.14rem; |
||||
top: -0.15rem; |
||||
font-size: 0.2rem; |
||||
padding: 0 0.08rem; |
||||
border: 1px solid #73cbb6; |
||||
} |
||||
.order-status-num { |
||||
min-width: 0.33*100rpx; |
||||
background-color: #fff; |
||||
color: #73cbb6; |
||||
border-radius: 15px; |
||||
position: absolute; |
||||
right: -0.14*100rpx; |
||||
top: -0.15*100rpx; |
||||
font-size: 0.2*100rpx; |
||||
padding: 0 0.08*100rpx; |
||||
border: 1px solid #73cbb6; |
||||
} |
||||
|
||||
.pictrue { |
||||
position: relative; |
||||
} |
||||
.pictrue { |
||||
position: relative; |
||||
} |
||||
|
||||
.switch-h5 { |
||||
margin-left: 0.2rem; |
||||
} |
||||
.switch-h5 { |
||||
margin-left: 0.2*100rpx; |
||||
} |
||||
|
||||
.binding { |
||||
margin-top: 0.1rem; |
||||
display: inline-block; |
||||
padding: 0.05rem 0.2rem; |
||||
background-color: #ca1f10; |
||||
border-radius: 50px; |
||||
font-size: 0.22rem; |
||||
line-height: 1.5; |
||||
border: 1px solid #e8695e; |
||||
color: #ffffff; |
||||
} |
||||
</style> |
||||
.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; |
||||
margin-top: 30rpx |
||||
} |
||||
.by-text{ |
||||
text-align:center; |
||||
font-size: 30rpx; |
||||
} |
||||
</style> |
||||
|
Loading…
Reference in new issue