<template>
|
<view>
|
<view style="padding: 32rpx;">
|
<u-radio-group iconPlacement="right" v-model="value" placement="column">
|
<u-radio v-for="(item,index) in list" :key="index" :label="item.companyName" :name="item.companyId"></u-radio>
|
</u-radio-group>
|
<view class="down-button">
|
<u-button shape="circle" color="#1171E0" @click="entery">确定</u-button>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { getInfo,getCompanyList } from '@/api/auth.js'
|
import { company } from '@/api/qiye.js'
|
export default {
|
|
data() {
|
return {
|
list: [],
|
value: ""
|
}
|
},
|
onLoad() {
|
this.getInfo()
|
},
|
methods: {
|
getInfo(){
|
getInfo().then(val => {
|
if(val.data.code === 200) {
|
this.value = Number(uni.getStorageSync("companyId"))
|
this.getCompanyList(val.data.data.phonenumber)
|
}
|
})
|
|
},
|
getCompanyList(companyPhone) {
|
getCompanyList({companyPhone, companyStatus: 0, checkStatus: 2}).then(val => {
|
this.list = val.data.rows
|
})
|
},
|
entery() {
|
uni.setStorageSync("companyId", this.value)
|
company(this.value).then(val => {
|
if(val.data.code == 200) {
|
uni.setStorageSync('qiyedata', val.data.data)
|
uni.showToast({
|
title: "切换成功",
|
icon: 'none'
|
})
|
setTimeout(() => {
|
uni.navigateBack()
|
}, 500)
|
} else {
|
uni.showToast({
|
title: val.data.msg,
|
icon: 'none'
|
})
|
}
|
|
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.title{
|
font-size: 36rpx;
|
font-weight: 700;
|
text-align: center;
|
margin-bottom: 20rpx;
|
}
|
.down-button{
|
margin-top: 30rpx;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
padding: 32rpx;
|
box-sizing: border-box;
|
left: 0;
|
}
|
/deep/ .u-radio{
|
margin-bottom: 40rpx;
|
}
|
</style>
|