Browse Source

兼容非小程序端手机号绑定的功能

master
Gao xiaosong 4 years ago
parent
commit
b706b4f104
  1. 78
      pages/user/User/index.vue

78
pages/user/User/index.vue

@ -18,14 +18,17 @@
<text>ID{{ userInfo.uid || 0}}</text> <text>ID{{ userInfo.uid || 0}}</text>
<text class="iconfont icon-bianji1"></text> <text class="iconfont icon-bianji1"></text>
</view> </view>
<button <!-- #ifdef MP-WEIXIN -->
open-type="getPhoneNumber" <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
@getphonenumber="getPhoneNumber"
class="binding"
v-else
>
<text>绑定手机号</text> <text>绑定手机号</text>
</button> </button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="binding" @click="goBindPhone()" v-else>
<text>绑定手机号</text>
</button>
<!-- #endif -->
</view> </view>
</view> </view>
<text class="iconfont icon-shezhi" @click="goPersonalData()"></text> <text class="iconfont icon-shezhi" @click="goPersonalData()"></text>
@ -36,11 +39,7 @@
<text>我的余额</text> <text>我的余额</text>
<text class="num">{{ userInfo.nowMoney || 0 }}</text> <text class="num">{{ userInfo.nowMoney || 0 }}</text>
</view> </view>
<view <view @click="goUserPromotion()" class="item" v-if="userInfo.isPromoter === 1 || userInfo.statu === 2">
@click="goUserPromotion()"
class="item"
v-if="userInfo.isPromoter === 1 || userInfo.statu === 2"
>
<text>当前佣金</text> <text>当前佣金</text>
<text class="num">{{ userInfo.brokeragePrice || 0 }}</text> <text class="num">{{ userInfo.brokeragePrice || 0 }}</text>
</view> </view>
@ -65,50 +64,40 @@
<view @click="goMyOrder(0)" class="item"> <view @click="goMyOrder(0)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dfk.png" /> <image src="@/static/images/dfk.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.unpaidCount > 0">{{ userInfo.orderStatusNum.unpaidCount }}</text>
v-if="userInfo.orderStatusNum.unpaidCount > 0"
>{{ userInfo.orderStatusNum.unpaidCount }}</text>
</view> </view>
<view>待付款</view> <view>待付款</view>
</view> </view>
<view @click="goMyOrder(1)" class="item"> <view @click="goMyOrder(1)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dfh.png" /> <image src="@/static/images/dfh.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.unshippedCount > 0">{{ userInfo.orderStatusNum.unshippedCount }}</text>
v-if="userInfo.orderStatusNum.unshippedCount > 0"
>{{ userInfo.orderStatusNum.unshippedCount }}</text>
</view> </view>
<view>待发货</view> <view>待发货</view>
</view> </view>
<view @click="goMyOrder(2)" class="item"> <view @click="goMyOrder(2)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dsh.png" /> <image src="@/static/images/dsh.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.receivedCount > 0">{{ userInfo.orderStatusNum.receivedCount }}</text>
v-if="userInfo.orderStatusNum.receivedCount > 0"
>{{ userInfo.orderStatusNum.receivedCount }}</text>
</view> </view>
<text>待收货</text> <text>待收货</text>
</view> </view>
<view @click="goMyOrder(3)" class="item"> <view @click="goMyOrder(3)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dpj.png" /> <image src="@/static/images/dpj.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.evaluatedCount > 0">{{ userInfo.orderStatusNum.evaluatedCount }}</text>
v-if="userInfo.orderStatusNum.evaluatedCount > 0"
>{{ userInfo.orderStatusNum.evaluatedCount }}</text>
</view> </view>
<text>待评价</text> <text>待评价</text>
</view> </view>
<view @click="goReturnList()" class="item"> <view @click="goReturnList()" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/sh.png" /> <image src="@/static/images/sh.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.refundCount > 0">{{ userInfo.orderStatusNum.refundCount }}</text>
v-if="userInfo.orderStatusNum.refundCount > 0"
>{{ userInfo.orderStatusNum.refundCount }}</text>
</view> </view>
<text>售后/退款</text> <text>售后/退款</text>
</view> </view>
@ -148,9 +137,21 @@
</view> </view>
</template> </template>
<script> <script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex"; import {
import { getUserInfo, getMenuUser, bindingPhone } from "@/api/user"; mapState,
import { isWeixin, VUE_APP_RESOURCES_URL } from "@/utils"; 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 SwitchWindow from "@/components/SwitchWindow";
import Authorization from "@/pages/authorization/index"; import Authorization from "@/pages/authorization/index";
@ -184,6 +185,11 @@ export default {
} }
}); });
}, },
goBindPhone(){
this.$yrouter.push({
path: "/pages/user/BindingPhone/index",
});
},
goUserCoupon() { goUserCoupon() {
this.$yrouter.push("/pages/user/coupon/UserCoupon/index"); this.$yrouter.push("/pages/user/coupon/UserCoupon/index");
}, },
@ -237,8 +243,7 @@ export default {
thit.$store.dispatch("userInfo", true); thit.$store.dispatch("userInfo", true);
console.log(error); console.log(error);
uni.showToast({ uni.showToast({
title: title: error.msg ||
error.msg ||
error.response.data.msg || error.response.data.msg ||
error.response.data.message, error.response.data.message,
icon: "none", icon: "none",
@ -398,6 +403,7 @@ export default {
text-align: center; text-align: center;
padding: 30rpx 0; padding: 30rpx 0;
} }
.by-text { .by-text {
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;

Loading…
Cancel
Save