wjt
2024-06-27 69a74309ed12cc13f0fa9fb90c5bffad17ade360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<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>