This commit is contained in:
caolc
2023-07-05 18:19:02 +08:00
parent e883da3fff
commit cf253870a3
17 changed files with 861 additions and 343 deletions

View File

@@ -32,15 +32,17 @@
</view>
</view>
</view>
<view class="xu-content margin">
<view style="position: relative;" class="xu-content margin">
<view @click="isSwitchEnterprises=true" class="switch">切换企业</view>
<view class="bg-white self-card person-card radius my-shadow" v-if="isCompany">
<view class="flex solid-bottom padding-xs justify-between company-vip">
<view class="radius padding-xs text-xs">
<view style="display: flex;" class="radius padding-xs text-xs">
<!-- <text class="icon-company cuIcon-crownfill padding-right-xs"></text> -->
<my-icon iconName="wd-qy-hy.png" class="padding-right-xs"></my-icon>
<text class="icon-company text-xs">企业会员</text>
<!-- <my-icon iconName="wd-qy-hy.png" class="padding-right-xs"></my-icon> -->
<text class="icon-company text-xs">{{companyCard.name}}</text>
<view :class="company_tag===1?'company_tag company_tag_SelfOperated':'company_tag company_tag_externalOperated'">{{companyCard.companyNature===1?'自营':'外请'}}</view>
</view>
</view>
<view class="padding-sm margin-bottom" @tap="toCards">
<view class="color-666 text-sm">
@@ -53,11 +55,11 @@
钱包余额
</view>
</view>
<view class="text-center">
<text class="text-sm">您一共有
<text
class="oil-main-color padding-left-xs padding-right-xs">{{cardSum.length}}</text>
class="oil-main-color padding-left-xs padding-right-xs">{{userTotal.oilCardNumber}}</text>
张油卡</text>
</view>
</view>
@@ -110,11 +112,11 @@
</view>
<view class="action">
<!-- <button class="cu-btn oil-main-btn-color" open-type="contact" @contact="onContact"> -->
<!-- <text class="text-grey text-sm">打开会话</text> -->
<!-- <text class="text-grey text-sm">打开会话</text> -->
<!-- </button> -->
<view class="cu-btn oil-main-btn-color" @click="makeCall">
<text class="text-grey text-sm">联系客服</text>
</view>
</view>
</view>
</view>
@@ -126,22 +128,29 @@
</view>
</view>
</view>
<SwitchEnterprises @submit='upadteCompanyCard' @logout='logout' :is-show.sync="isSwitchEnterprises"></SwitchEnterprises>
</view>
</template>
<script>
import oilSiteApi from '@/api/oil-site.js'
import SwitchEnterprises from '@/components/SwitchEnterprises.vue'
import accountApi from '@/api/account.js'
export default {
components: {
SwitchEnterprises
},
props: {
},
data() {
return {
showCard:[],
hideCard:[],
cardSum:[],
companyCard: null,
isSwitchEnterprises: false,
showCard: [],
hideCard: [],
cardSum: [],
yellowURL: this.global.yellowURL,
imgURL: this.global.imgURL,
starUrl: this.global.starUrl,
@@ -152,10 +161,20 @@
};
},
onShow() {
this.getAuthInfo()
this.getAmount()
this.getAmount();
this.upadteCompanyCard()
},
methods: {
logout(){
this.isSwitchEnterprises = false
},
upadteCompanyCard() {
if (uni.getStorageSync('companyCard')) {
this.companyCard = JSON.parse(uni.getStorageSync('companyCard'))
}
},
goToPage(url) {
if (!url) return;
uni.navigateTo({
@@ -185,41 +204,41 @@
}
})
},
onTapUserInfo(){
if(uni.getStorageSync('user')){
onTapUserInfo() {
if (uni.getStorageSync('user')) {
this.routerTo('/BagSetup/setup/setup')
}else{
} else {
uni.reLaunch({
url:'../../../BagAuth/pages/login/login'
url: '../../../BagAuth/pages/login/login'
})
}
},
toCards() {
if(Number(this.userTotal.oilCardNumber)<=0) return
if (Number(this.userTotal.oilCardNumber) <= 0) return
uni.navigateTo({
url: '/BagMoney/pages/oilCards/oilCards'
url: '/BagMoney/pages/oilCards/oilCards'
})
},
async getAmount() {
await accountApi.getTotalOilCardInfo().then(res => {
console.log(1)
async getAmount() {
await accountApi.getTotalOilCardInfo().then(res => {
console.log(1)
if (res.code == 20000) {
this.userTotal = res.data
}
})
await accountApi.getUserAccount().then(res => {
console.log(2)
await accountApi.getUserAccount().then(res => {
console.log(2)
this.showCard = []
res.data.forEach(item=>{
res.data.forEach(item => {
this.showCard.push(item.companyId)
})
})
await accountApi.getSyncDeductions().then(res => {
console.log(3)
await accountApi.getSyncDeductions().then(res => {
console.log(3)
if (res.code == 20000) {
this.cardSum = this.showCard.filter(item=>!res.data.companyIds.includes(item))
this.cardSum = this.showCard.filter(item => !res.data.companyIds.includes(item))
}
})
},
@@ -286,6 +305,46 @@
</script>
<style scoped>
.company_tag_externalOperated {
background: #FDDBDB;
color: #FE0505;
}
.company_tag_SelfOperated {
background: #FDE9DB;
color: #FF6700;
}
.company_tag {
width: 62rpx;
font-size: 22rpx;
height: 30rpx;
border-radius: 10rpx 3rpx 10rpx 3rpx;
opacity: 1;
margin-left: 20rpx;
display: flex;
justify-content: center;
align-items: center;
}
.switch {
width: 143rpx;
font-size: 24rpx;
padding: 15rpx 0;
color: #FFFFFF;
background: linear-gradient(90deg, rgba(255, 110, 11, 0.85) 0%, #FFBA8B 100%);
box-shadow: 0rpx 2rpx 7rpx 2rpx rgba(191, 191, 191, 0.2);
border-radius: 40rpx 0rpx 0rpx 40rpx;
opacity: 1;
position: absolute;
z-index: 1;
right: 0;
top: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.content {
height: 100%;
}
@@ -365,4 +424,4 @@
.cu-avatar {
background-color: transparent !important;
}
</style>
</style>