兼容非小程序端手机号绑定的功能
This commit is contained in:
@ -18,14 +18,17 @@
|
||||
<text>ID:{{ userInfo.uid || 0}}</text>
|
||||
<text class="iconfont icon-bianji1"></text>
|
||||
</view>
|
||||
<button
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
class="binding"
|
||||
v-else
|
||||
>
|
||||
<!-- #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>
|
||||
</view>
|
||||
<text class="iconfont icon-shezhi" @click="goPersonalData()"></text>
|
||||
@ -36,11 +39,7 @@
|
||||
<text>我的余额</text>
|
||||
<text class="num">{{ userInfo.nowMoney || 0 }}</text>
|
||||
</view>
|
||||
<view
|
||||
@click="goUserPromotion()"
|
||||
class="item"
|
||||
v-if="userInfo.isPromoter === 1 || userInfo.statu === 2"
|
||||
>
|
||||
<view @click="goUserPromotion()" class="item" v-if="userInfo.isPromoter === 1 || userInfo.statu === 2">
|
||||
<text>当前佣金</text>
|
||||
<text class="num">{{ userInfo.brokeragePrice || 0 }}</text>
|
||||
</view>
|
||||
@ -65,50 +64,40 @@
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<text class="order-status-num"
|
||||
v-if="userInfo.orderStatusNum.refundCount > 0">{{ userInfo.orderStatusNum.refundCount }}</text>
|
||||
</view>
|
||||
<text>售后/退款</text>
|
||||
</view>
|
||||
@ -148,22 +137,34 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
|
||||
import { getUserInfo, 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 {
|
||||
mapState,
|
||||
mapGetters,
|
||||
mapMutations,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import {
|
||||
getUserInfo,
|
||||
getMenuUser,
|
||||
bindingPhone
|
||||
} from "@/api/user";
|
||||
import {
|
||||
isWeixin,
|
||||
VUE_APP_RESOURCES_URL
|
||||
} from "@/utils";
|
||||
import SwitchWindow from "@/components/SwitchWindow";
|
||||
import Authorization from "@/pages/authorization/index";
|
||||
|
||||
const NAME = "User";
|
||||
const NAME = "User";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
SwitchWindow,
|
||||
Authorization
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
data: function () {
|
||||
return {
|
||||
MyMenus: [],
|
||||
switchActive: false,
|
||||
@ -184,6 +185,11 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
goBindPhone(){
|
||||
this.$yrouter.push({
|
||||
path: "/pages/user/BindingPhone/index",
|
||||
});
|
||||
},
|
||||
goUserCoupon() {
|
||||
this.$yrouter.push("/pages/user/coupon/UserCoupon/index");
|
||||
},
|
||||
@ -201,7 +207,7 @@ export default {
|
||||
goPersonalData() {
|
||||
this.$yrouter.push("/pages/user/PersonalData/index");
|
||||
},
|
||||
getPhoneNumber: function(e) {
|
||||
getPhoneNumber: function (e) {
|
||||
let thit = this;
|
||||
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定
|
||||
if (e.mp.detail.errMsg == "getPhoneNumber:ok") {
|
||||
@ -211,7 +217,7 @@ export default {
|
||||
// 获取当前环境的服务商
|
||||
uni.getProvider({
|
||||
service: "oauth",
|
||||
success: function(res) {
|
||||
success: function (res) {
|
||||
// 此处可以排除h5
|
||||
if (res.provider) {
|
||||
uni.login({
|
||||
@ -237,8 +243,7 @@ export default {
|
||||
thit.$store.dispatch("userInfo", true);
|
||||
console.log(error);
|
||||
uni.showToast({
|
||||
title:
|
||||
error.msg ||
|
||||
title: error.msg ||
|
||||
error.response.data.msg ||
|
||||
error.response.data.message,
|
||||
icon: "none",
|
||||
@ -264,17 +269,17 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
changeswitch: function(data) {
|
||||
changeswitch: function (data) {
|
||||
this.switchActive = data;
|
||||
},
|
||||
User: function() {
|
||||
User: function () {
|
||||
let that = this;
|
||||
getUserInfo().then(res => {
|
||||
that.user = res.data;
|
||||
that.orderStatusNum = res.data.orderStatusNum;
|
||||
});
|
||||
},
|
||||
MenuUser: function() {
|
||||
MenuUser: function () {
|
||||
let that = this;
|
||||
getMenuUser()
|
||||
.then(res => {
|
||||
@ -286,7 +291,7 @@ export default {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
goPages: function(index) {
|
||||
goPages: function (index) {
|
||||
let url = this.MyMenus[index].uniapp_url;
|
||||
if (
|
||||
url === "/pages/user/promotion/UserPromotion/index" &&
|
||||
@ -327,7 +332,7 @@ export default {
|
||||
path: this.MyMenus[index].uniapp_url
|
||||
});
|
||||
},
|
||||
goPages2: function() {
|
||||
goPages2: function () {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/orderAdmin/OrderCancellation/index"
|
||||
});
|
||||
@ -353,15 +358,15 @@ export default {
|
||||
console.log("离开用户中心");
|
||||
this.updateAuthorizationPage(false);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.footer-line-height {
|
||||
.footer-line-height {
|
||||
height: 1 * 100rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-status-num {
|
||||
.order-status-num {
|
||||
min-width: 0.33 * 100rpx;
|
||||
background-color: #fff;
|
||||
color: #eb3729;
|
||||
@ -372,17 +377,17 @@ export default {
|
||||
font-size: 0.2 * 100rpx;
|
||||
padding: 0 0.08 * 100rpx;
|
||||
border: 1px solid #eb3729;
|
||||
}
|
||||
}
|
||||
|
||||
.pictrue {
|
||||
.pictrue {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
.switch-h5 {
|
||||
.switch-h5 {
|
||||
margin-left: 0.2 * 100rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.binding {
|
||||
.binding {
|
||||
margin-top: 0.1 * 100rpx;
|
||||
display: inline-block;
|
||||
padding: 0.05 * 100rpx 0.2 * 100rpx;
|
||||
@ -392,14 +397,15 @@ export default {
|
||||
line-height: 1.5;
|
||||
border: 1px solid #e8695e;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.by {
|
||||
.by {
|
||||
text-align: center;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
.by-text {
|
||||
}
|
||||
|
||||
.by-text {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user