|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
- <view class="container" :style="{paddingTop :CustomBar + 'px' }">
|
|
|
- <cm-custom :navbar-data='nvabarData'></cm-custom>
|
|
|
+ <view class="container" :style="{ paddingTop: CustomBar + 'px' }">
|
|
|
+ <cm-custom :navbar-data="nvabarData"></cm-custom>
|
|
|
<!-- 机构信息区域 -->
|
|
|
<template v-if="isRequest">
|
|
|
<!-- <view class="ws-title" :style="{lineHeight :CustomBar + 'px' }">维沙采购商城</view> -->
|
|
@@ -39,6 +39,11 @@
|
|
|
>
|
|
|
<image src="@/static/ws/dh_dfk_02.png" mode="widthFix"></image>
|
|
|
<text>待付款</text>
|
|
|
+ <view class="tui-badge tui-badge-box" v-if="paymentCount > 0">
|
|
|
+ <tui-badge :scaleRatio="0.8" type="danger">{{
|
|
|
+ paymentCount | countNum
|
|
|
+ }}</tui-badge>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view
|
|
|
class="order-nav-item"
|
|
@@ -46,6 +51,11 @@
|
|
|
>
|
|
|
<image src="@/static/ws/dh_dfh_03.png" mode="widthFix"></image>
|
|
|
<text>待发货</text>
|
|
|
+ <view class="tui-badge tui-badge-box" v-if="waitShipmentsCount > 0">
|
|
|
+ <tui-badge :scaleRatio="0.8" type="danger">{{
|
|
|
+ waitShipmentsCount | countNum
|
|
|
+ }}</tui-badge>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view
|
|
|
class="order-nav-item"
|
|
@@ -53,6 +63,11 @@
|
|
|
>
|
|
|
<image src="@/static/ws/dh_yfh_04.png" mode="widthFix"></image>
|
|
|
<text>已发货</text>
|
|
|
+ <view class="tui-badge tui-badge-box" v-if="shipmentsCount > 0">
|
|
|
+ <tui-badge :scaleRatio="0.8" type="danger">{{
|
|
|
+ shipmentsCount | countNum
|
|
|
+ }}</tui-badge>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view
|
|
|
class="order-nav-item"
|
|
@@ -60,6 +75,11 @@
|
|
|
>
|
|
|
<image src="@/static/ws/dh_tk_05.png" mode="widthFix"></image>
|
|
|
<text>退货/款</text>
|
|
|
+ <view class="tui-badge tui-badge-box" v-if="salesReturnCount > 0">
|
|
|
+ <tui-badge :scaleRatio="0.8" type="danger">{{
|
|
|
+ salesReturnCount | countNum
|
|
|
+ }}</tui-badge>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -96,24 +116,26 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- nvabarData: {//顶部自定义导航
|
|
|
+ nvabarData: {
|
|
|
+ //顶部自定义导航
|
|
|
showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
|
|
|
showSearch: 0,
|
|
|
title: '维沙采购商城', // 导航栏 中间的标题
|
|
|
- haveBack:false,
|
|
|
- textLeft:this.$store.state.isIphone,
|
|
|
- textColor:'#333333',
|
|
|
- bgColor:'#ffffff'
|
|
|
+ haveBack: false,
|
|
|
+ textLeft: this.$store.state.isIphone,
|
|
|
+ textColor: '#333333',
|
|
|
+ bgColor: '#ffffff'
|
|
|
},
|
|
|
- CustomBar:this.CustomBar,// 顶部导航栏高度
|
|
|
- organizeName: '', //采购员组织名称
|
|
|
+ CustomBar: this.CustomBar, // 顶部导航栏高度
|
|
|
+ organizeName: '', //采购员组织名称
|
|
|
isRequest: false,
|
|
|
+
|
|
|
paymentCount: 0, //待付款角标
|
|
|
waitShipmentsCount: 0, //待收货角标
|
|
|
shipmentsCount: 0, //已发货角标
|
|
|
- salesReturnCount: '', //退货/款角标
|
|
|
+ salesReturnCount: 0, //退货/款角标
|
|
|
organizeId: '',
|
|
|
- refresh:false
|
|
|
+ refresh: false
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -123,7 +145,7 @@ export default {
|
|
|
if (res == 1) {
|
|
|
console.log('用户已授权')
|
|
|
this.GetWxAuthorize()
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.isRequest = true
|
|
|
}
|
|
|
})
|
|
@@ -131,37 +153,44 @@ export default {
|
|
|
computed: {
|
|
|
...mapState(['hasLogin', 'userInfo'])
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ countNum(value) {
|
|
|
+ return value > 99 ? '99+' : value
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
...mapMutations(['login', 'logout']),
|
|
|
// 授权登录验证
|
|
|
async GetWxAuthorize() {
|
|
|
// 获取微信code
|
|
|
const wechatCode = await authorize.getCode('weixin')
|
|
|
- this.UserService.userInfoLogin({code:wechatCode}).then(res=>{
|
|
|
- // 登录成功 将信息保存在userInfo中 保存在本地和store
|
|
|
- this.login(res.data)
|
|
|
- this.organizeId = res.data.organizeId
|
|
|
- this.getUserInfoPersonal(this.organizeId)
|
|
|
- this.refresh = true
|
|
|
- this.isRequest = true
|
|
|
- }).catch(err=>{
|
|
|
- // 缓存游客openid
|
|
|
- uni.setStorageSync('openid',err.data.openid)
|
|
|
- this.logout()
|
|
|
- this.refresh = true
|
|
|
- this.isRequest = true
|
|
|
- })
|
|
|
+ this.UserService.userInfoLogin({ code: wechatCode })
|
|
|
+ .then(res => {
|
|
|
+ // 登录成功 将信息保存在userInfo中 保存在本地和store
|
|
|
+ this.login(res.data)
|
|
|
+ this.organizeId = res.data.organizeId
|
|
|
+ this.getUserInfoPersonal(this.organizeId)
|
|
|
+ this.refresh = true
|
|
|
+ this.isRequest = true
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // 缓存游客openid
|
|
|
+ uni.setStorageSync('openid', err.data.openid)
|
|
|
+ this.logout()
|
|
|
+ this.refresh = true
|
|
|
+ this.isRequest = true
|
|
|
+ })
|
|
|
},
|
|
|
//初始化个人中心数据
|
|
|
getUserInfoPersonal(organizeId) {
|
|
|
this.UserService.userInfoPersonal({ organizeId: organizeId })
|
|
|
.then(response => {
|
|
|
- this.organizeName = response.data.organizeName //采购员组织名称
|
|
|
- this.paymentCount = this.showBadge(response.data.paymentCount) //待付款
|
|
|
- this.waitShipmentsCount = this.showBadge(response.data.waitShipmentsCount) //待收货
|
|
|
- this.shipmentsCount = this.showBadge(response.data.shipmentsCount) //已发货
|
|
|
- this.salesReturnCount = this.showBadge(response.data.salesReturnCount) //退货/款
|
|
|
-
|
|
|
+ console.log(response)
|
|
|
+ this.organizeName = response.data.organizeName //采购员组织名称
|
|
|
+ this.paymentCount = response.data.paymentCount //待付款
|
|
|
+ this.waitShipmentsCount = response.data.waitShipmentsCount //待收货
|
|
|
+ this.shipmentsCount = response.data.shipmentsCount //已发货
|
|
|
+ this.salesReturnCount = response.data.salesReturnCount //退货/款
|
|
|
})
|
|
|
.catch(error => {
|
|
|
this.$util.msg(error.msg, 2000)
|
|
@@ -194,23 +223,25 @@ export default {
|
|
|
onPullDownRefresh() {
|
|
|
if (this.hasLogin) {
|
|
|
this.GetWxAuthorize()
|
|
|
- if(this.refresh){
|
|
|
+ if (this.refresh) {
|
|
|
uni.stopPullDownRefresh()
|
|
|
}
|
|
|
} else {
|
|
|
uni.stopPullDownRefresh()
|
|
|
}
|
|
|
},
|
|
|
- onShareAppMessage (res){//分享转发
|
|
|
+ onShareAppMessage(res) {
|
|
|
+ //分享转发
|
|
|
this.isShareModal = false
|
|
|
- if (res.from === 'button') {// 来自页面内转发按钮
|
|
|
- }
|
|
|
+ if (res.from === 'button') {
|
|
|
+ // 来自页面内转发按钮
|
|
|
+ }
|
|
|
return {
|
|
|
title: '维沙采购商城上线啦,快来采购吧~',
|
|
|
path: `/pages/index/index`,
|
|
|
- imageUrl:'https://static-b.caimei365.com/app/wisa/img/icon/icon-index.png'
|
|
|
+ imageUrl: 'https://static-b.caimei365.com/app/wisa/img/icon/icon-index.png'
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -218,13 +249,14 @@ export default {
|
|
|
<style lang="scss">
|
|
|
@import '@/uni.scss';
|
|
|
.container {
|
|
|
+ box-sizing: border-box;
|
|
|
background: #f7f7f7;
|
|
|
}
|
|
|
// 用户登录信息区域
|
|
|
-.ws-title{
|
|
|
+.ws-title {
|
|
|
width: 100%;
|
|
|
position: fixed;
|
|
|
- top:0 ;
|
|
|
+ top: 0;
|
|
|
left: 0;
|
|
|
font-size: 34rpx;
|
|
|
text-align: center;
|
|
@@ -314,6 +346,7 @@ export default {
|
|
|
align-items: center;
|
|
|
padding: 40rpx 0;
|
|
|
.order-nav-item {
|
|
|
+ position: relative;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
flex-direction: column;
|
|
@@ -326,6 +359,12 @@ export default {
|
|
|
line-height: 37rpx;
|
|
|
margin-top: 8rpx;
|
|
|
}
|
|
|
+ .tui-badge {
|
|
|
+ position: absolute;
|
|
|
+ top: -15rpx;
|
|
|
+ right: -20rpx;
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -369,7 +408,4 @@ export default {
|
|
|
margin-right: 6rpx;
|
|
|
}
|
|
|
}
|
|
|
-.badge {
|
|
|
- background-color: #ff0000;
|
|
|
-}
|
|
|
</style>
|