index.vue
3.37 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
<view class="wrap">
<u-radio-group v-model="userType" placement="row" @change="groupChange">
<view class="choose-type" v-for="(item, index) in typeList">
<u-radio size="28" labelSize="28" :key="index" :label="item.name" :name="item.name" @change="radioChange">
</u-radio>
</view>
</u-radio-group>
<!-- 角色信息匹配 -->
<view class="rule-label-info-box">
<view class="manager-info" v-if="userType === '居民用户'">
<view class="manager-info-parent-company-name">
派单前请输先完善地址信息~
</view>
</view>
<view class="manager-info" v-if="userType === '运输驾驶员'">
<view class="manager-info-parent-company-name">
长沙有限运输运输公司-运输驾驶员-李伟
</view>
<view class="manager-info-parent-company-name">
未匹配到该手机号绑定的运输公司!
</view>
</view>
<view class="manager-info" v-if="userType === '企业负责人'">
<view class="manager-info-parent-company-name">
长沙有限运输运输公司公司服务账号!
</view>
<view class="manager-info-parent-company-name">
未匹配到该手机号绑定运输公司公司服务账号!
</view>
</view>
</view>
<view class="choose-button">
<u-button shape="circle" color="#a9e08f" @click="submit(userType)">确定</u-button>
</view>
</view>
</template>
<script setup>
import { updateUserInfo } from "@/apis/user.js";
import { useMainStore } from '@/stores/index.js';
import { setRequestToken } from '@/utils/request/request.js';
import { onLoad } from "@dcloudio/uni-app";
import { ref } from 'vue';
const store = useMainStore();
const userType = ref("居民用户")
const typeList = ref([{ name: "居民用户" }, { name: "运输驾驶员" }, { name: "企业负责人" }])
const unitInfo = ref({})
const radioChange = (e) => {
}
const groupChange = (e) => {
}
const submit = (userType) => {
setRequestToken(store.tempToken)
updateUserInfo({ garUserType: userType }).then(res => {
store.token = store.tempToken
store.tempToken = "";
if (res.data.success) {
store.userType = userType;
unitInfo.value.userType = userType
store.userInfo = unitInfo.value
uni.$u.route({
type: "switchTab",
url: `pages/home/index`,
})
}
})
}
onLoad((options) => {
unitInfo.value = options
userType.value = options.userType
// submit(options.userType)
})
</script>
<style lang="scss" scoped>
.wrap {
height: 100%;
width: 100%;
box-sizing: border-box;
padding: 20rpx;
background-color: $u-info-light;
.choose-type {
// width: 100%;
box-sizing: border-box;
padding: 20rpx;
background-color: #ffffff;
border-radius: 20rpx;
margin-right: 20rpx;
display: flex;
align-items: center;
justify-content: center;
&:last-child {
margin-right: 20rpx;
}
}
.rule-label-info-box {
box-sizing: border-box;
margin-top: 20rpx;
.manager-info {
font-size: 25rpx;
color: $u-main-color;
box-sizing: border-box;
.manager-info-parent-company-name {
color: $u-info;
}
}
}
.choose-button {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}
</style>