building-sign/pagesA/information/information.vue

433 lines
17 KiB
Vue
Raw Normal View History

2022-11-16 10:20:26 +00:00
<template>
<view class="pad-x120">
<!-- 头部 -->
<status-nav navBarTitle="基本信息"></status-nav>
2022-11-24 06:05:03 +00:00
<view class="content" :style="{'padding-top':statusHeight+50+'px'}" v-if="isLoding">
<view class="notice-tips color-red font24" v-if="userInfo.check_info.status==-1">
<text>温馨提示资料修改不通过原因是{{userInfo.check_info.refund_reason}}</text>
</view>
<view class="information-from font24">
2022-11-16 10:20:26 +00:00
<view class="item">
<view class="title">头像</view>
2023-01-15 07:31:11 +00:00
<view class="cover" @tap="changeImg('cover')">
<image :src="userInfo.headimgurl" mode="aspectFill"></image>
2022-11-16 10:20:26 +00:00
</view>
</view>
<view class="item" @tap="editEv(0,'nickname')">
<view class="title">昵称</view>
<view class="msg font24">{{userInfo.nickname}}</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">技术岗位</view>
<view class="msg picker-msg font24">
{{userInfo.position_name}}
2023-01-15 07:31:11 +00:00
<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.position_name!==userInfo.check_info.position_name">{{userInfo.check_info.position_name}}</text>
<picker mode="selector" :range="positionList" @change="bindPositionChange" :value="positionIndex" :range-key="'name'">
<view class="name">
<text class="font26">{{positionList[positionIndex].name}}</text>
<image src="/static/icon/icon-arrow-02.png" mode="aspectFit"></image>
</view>
</picker>
</view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
2023-02-16 08:19:34 +00:00
<view class="item" v-if="userInfo.role==1">
<view class="title">班组</view>
<view class="msg picker-msg font24">
{{userInfo.team_name}}
<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.team_name!==userInfo.check_info.team_name">{{userInfo.check_info.team_name}}</text>
<picker mode="selector" :range="teamList" @change="bindTeamChange" :value="teamIndex" :range-key="'name'">
<view class="name">
<text class="font26">{{teamList[teamIndex].name}}</text>
<image src="/static/icon/icon-arrow-02.png" mode="aspectFit"></image>
</view>
</picker>
</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(12,'certificate')" v-if="userInfo.role==1">
<view class="title">证书名称</view>
<view class="msg font24">{{userInfo.certificate}}</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
2022-11-16 10:20:26 +00:00
</view>
<view class="item" @tap="editEv(2,'pay')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">工资</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.pay}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.pay!==userInfo.check_info.pay">{{userInfo.check_info.pay}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(3,'real_name')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">姓名</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.real_name}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.real_name!==userInfo.check_info.real_name">{{userInfo.check_info.real_name}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(4,'mobile')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">电话号码</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.mobile}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.mobile!==userInfo.check_info.mobile">{{userInfo.check_info.mobile}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(10,'card_number')" v-if="userInfo.role==1">
<view class="title">身份证号</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.card_number}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.card_number!==userInfo.check_info.card_number">{{userInfo.check_info.card_number}}</text></view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" v-if="userInfo.role==1">
<view class="title">身份证正面</view>
<view class="msg font24" @tap="changeImg('positive')">
2023-01-16 07:10:35 +00:00
<image :src="baseHttps+userInfo.id_front" mode="widthFix"></image>
2023-01-15 07:31:11 +00:00
<view class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.id_front!==userInfo.check_info.id_front">
2023-01-16 07:10:35 +00:00
<image :src="baseHttps+userInfo.check_info.id_front" mode="widthFix"></image>
</view>
</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" v-if="userInfo.role==1">
<view class="title">身份证反面</view>
<view class="msg font24" @tap="changeImg('positive')">
2023-01-16 07:10:35 +00:00
<image :src="baseHttps+userInfo.id_back" mode="widthFix"></image>
<view class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.id_back!==userInfo.check_info.id_back">
2023-01-16 07:10:35 +00:00
<image :src="baseHttps+userInfo.check_info.id_back" mode="widthFix"></image>
</view>
</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
2022-11-16 10:20:26 +00:00
</view>
<view class="item" @tap="editEv(5,'emergency_contact')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">紧急联系人</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.emergency_contact}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.emergency_contact!==userInfo.check_info.emergency_contact">{{userInfo.check_info.emergency_contact}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(6,'emergency_phone')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">联系人电话</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.emergency_phone}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.emergency_phone!==userInfo.check_info.emergency_phone">{{userInfo.check_info.emergency_phone}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(7,'bank_card_name')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">银行卡姓名</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.bank_card_name}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.bank_card_name!==userInfo.check_info.bank_card_name">{{userInfo.check_info.bank_card_name}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(8,'bank_card_number')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">银行卡账号</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.bank_card_number}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.bank_card_number!==userInfo.check_info.bank_card_number">{{userInfo.check_info.bank_card_number}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(9,'bank_name')" v-if="userInfo.role==1">
2022-11-16 10:20:26 +00:00
<view class="title">开户行</view>
2023-01-15 07:31:11 +00:00
<view class="msg font24">{{userInfo.bank_name}}<text class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.bank_name!==userInfo.check_info.bank_name">{{userInfo.check_info.bank_name}}</text></view>
2022-11-16 10:20:26 +00:00
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" v-if="userInfo.role==1">
<view class="title">银行卡照片</view>
<view class="msg font24" @tap="changeImg('bank')">
2023-01-16 07:10:35 +00:00
<image :src="baseHttps+userInfo.bank_card_img" mode="widthFix"></image>
2023-01-15 07:31:11 +00:00
<view class="director-arrow" v-if="userInfo.check_info.status==0 && userInfo.bank_card_img!==userInfo.check_info.bank_card_img">
2023-01-16 07:10:35 +00:00
<image :src="baseHttps+userInfo.check_info.bank_card_img" mode="widthFix"></image>
</view>
</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(11,'work_experience')" v-if="userInfo.role==1">
<view class="title">工作经验</view>
<view class="msg font24">{{userInfo.work_experience}}</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" v-if="userInfo.role==1">
<view class="title">现住地址</view>
<view class="msg picker-msg font24">
{{userInfo.province}}{{userInfo.city}}{{userInfo.area}}
2023-01-15 07:31:11 +00:00
<text style="opacity: 0;" v-if="userInfo.province==''&&userInfo.city==''&&userInfo.area==''"></text>
<picker mode="region" @change="changeAddress">
<view class="addr-input">
<view class="input-box">
<input class="input-flex clips1" type="text" v-model="userInfo.province" disabled="true">
<image src="/static/icon/icon-arrow-01.png" mode="widthFix"></image>
</view>
<view class="input-box">
<input class="input-flex clips1" type="text" v-model="userInfo.city" disabled="true">
<image src="/static/icon/icon-arrow-01.png" mode="widthFix"></image>
</view>
<view class="input-box">
<input class="input-flex clips1" type="text" v-model="userInfo.area" disabled="true">
<image src="/static/icon/icon-arrow-01.png" mode="widthFix"></image>
</view>
</view>
</picker>
</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
</view>
<view class="item" @tap="editEv(1,'address_now')" v-if="userInfo.role==1">
<view class="title">详细地址</view>
<view class="msg font24">{{userInfo.address_now}}</view>
<image src="/static/icon/icon-arrow-03.png" mode="aspectFit"></image>
2022-11-16 10:20:26 +00:00
</view>
</view>
</view>
<!-- 修改弹窗 -->
2022-11-17 11:40:25 +00:00
<view class="pop-up-bg" v-if="ifShow">
2022-11-16 10:20:26 +00:00
<view class="edit-box bg-white">
2022-11-17 11:40:25 +00:00
<image class="close-btn" src="/static/icon/icon-close-btn.png" mode="aspectFit" @tap="closeEdit"></image>
<view class="title font36">{{editTitle}}</view>
<!-- 其他显示 -->
<input class="input font26" type="text" v-model="editMsg" :placeholder="`请输入${editTitle}`" placeholder-style="color:rgba(51,51,51,.4)">
2022-11-17 11:40:25 +00:00
<view class="submit-btn font30 color-white" @tap="submitEv"></view>
2022-11-16 10:20:26 +00:00
</view>
</view>
<!-- 尾部 -->
<tabbar :userType="userType" current="2"></tabbar>
</view>
</template>
<script>
import tabbar from '@/components/tabbar/tabbar';
export default {
components:{
tabbar
},
data() {
return {
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
userType:'worker', //账户类型 工人worker 负责人director
userInfo:{}, //用户信息
editTitle:'', //修改标题
editMsg:'', //修改内容
field:'', //修改栏目
2022-11-17 11:40:25 +00:00
positionList:[], //技术岗位
2023-02-16 08:19:34 +00:00
positionIndex:0, //当前选择
teamList:[], //班组岗位
teamIndex:0, //当前选择
2022-11-16 10:20:26 +00:00
ifShow:false, //是否展示弹窗
2023-01-16 07:10:35 +00:00
isLoding:false, //是否记载完成
baseHttps:`${getApp().globalData.hostapi}`,
2022-11-16 10:20:26 +00:00
}
},
onLoad() {
// 获取用户信息
this.getUserInfo();
2022-11-17 11:40:25 +00:00
// 获取技术岗位
this.getPositionList();
2022-11-28 09:44:22 +00:00
},
2022-11-16 10:20:26 +00:00
methods: {
// 获取用户信息
getUserInfo(){
this.$requst.post('/api/v1/user/info').then(res=>{
if(res.code==0){
2023-01-14 04:28:31 +00:00
console.log(res,'用户信息');
if(res.data.role!==uni.getStorageSync('worker_role')){
this.$toolAll.tools.showToast('身份已变更,正在切换');
setTimeout(()=>{
uni.reLaunch({
url:'/pages/pagehome/pagehome'
})
},2000)
}
2023-01-16 07:10:35 +00:00
this.userInfo = res.data;
this.isLoding = true;
2023-02-16 08:19:34 +00:00
// 获取班组
this.getTeamList();
this.positionIndex = this.positionList.findIndex(item=> item.id === res.data.position);
this.teamIndex = this.teamList.findIndex(item=> item.id === res.data.outsource_id);
2022-11-16 10:20:26 +00:00
}
})
},
2022-11-17 11:40:25 +00:00
// 获取技术岗位
getPositionList(){
this.$requst.get('/api/v1/common/position-list').then(res=>{
if(res.code == 0){
console.log(res,'技术岗位');
this.positionList = res.data.list;
}
})
},
// 选择技术岗位
bindPositionChange(e){
this.positionIndex = e.detail.value;
this.field = 'position';
this.editMsg = this.positionList[this.positionIndex].id;
setTimeout(()=>{
// 提交修改
this.submitEv();
},200)
2022-11-17 11:40:25 +00:00
},
2023-02-16 08:19:34 +00:00
// 获取班组
getTeamList(){
let worksite_id = this.userInfo.worksite_id;
this.$requst.get('/api/v1/common/team',{worksite_id:worksite_id}).then(res=>{
if(res.code == 0){
console.log(res,'班组');
this.teamList = res.data;
}
})
},
// 选择班组
bindTeamChange(e){
this.teamIndex = e.detail.value;
this.field = 'outsource_id';
this.editMsg = this.teamList[this.teamIndex].id;
setTimeout(()=>{
// 提交修改
this.submitEv();
},200)
},
2022-11-17 11:40:25 +00:00
2022-11-16 10:20:26 +00:00
// 打开修改弹窗
editEv(num,type){
2022-11-16 10:20:26 +00:00
this.ifShow = true;
this.field = type;
2022-11-16 10:20:26 +00:00
switch (num){
case 0:
this.editTitle = '昵称';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.nickname;
2022-11-16 10:20:26 +00:00
break;
case 1:
this.editTitle = '详细地址';
this.editMsg = this.userInfo.address_now;
2022-11-16 10:20:26 +00:00
break;
case 2:
this.editTitle = '工资';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.pay;
2022-11-16 10:20:26 +00:00
break;
case 3:
this.editTitle = '姓名';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.real_name;
2022-11-16 10:20:26 +00:00
break;
case 4:
this.editTitle = '电话号码';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.mobile;
2022-11-16 10:20:26 +00:00
break;
case 5:
this.editTitle = '紧急联系人';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.emergency_contact;
2022-11-16 10:20:26 +00:00
break;
case 6:
this.editTitle = '联系人电话';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.emergency_phone;
2022-11-16 10:20:26 +00:00
break;
case 7:
this.editTitle = '银行卡姓名';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.bank_card_name;
2022-11-16 10:20:26 +00:00
break;
case 8:
this.editTitle = '银行卡账号';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.bank_card_number;
2022-11-16 10:20:26 +00:00
break;
case 9:
this.editTitle = '开户行';
2022-11-17 11:40:25 +00:00
this.editMsg = this.userInfo.bank_name;
break;
case 10:
this.editTitle = '身份证号';
this.editMsg = this.userInfo.card_number;
break;
case 11:
this.editTitle = '工作经验';
this.editMsg = this.userInfo.work_experience;
break;
case 12:
this.editTitle = '证书名称';
this.editMsg = this.userInfo.certificate;
2022-11-16 10:20:26 +00:00
break;
}
},
// 关闭修改弹窗
closeEdit(){
this.ifShow = false;
this.editTitle = '';
this.field = '';
2022-11-17 11:40:25 +00:00
this.editMsg= '';
},
// 选择图片
changeImg(type){
uni.chooseImage({
count: 1, //默认9
sourceType: ['album','camera'], //从相册选择
success: (res)=> {
this.stagingImg = res.tempFilePaths[0];
// 上传图片
this.uploadImg(type);
}
})
},
// 上传图片
uploadImg(type){
uni.showLoading({
title: '上传中'
});
this.$requst.upload('/api/v1/file/upload/image',{path:this.stagingImg}).then(res=>{
if(res.code==0) {
2023-01-16 07:10:35 +00:00
this.editMsg = res.data.src
2023-01-15 07:31:11 +00:00
if(type=='cover'){
this.field = 'headimgurl';
}
if(type=='positive'){
this.field = 'id_front';
}
if(type=='back'){
this.field = 'id_back';
}
if(type=='bank'){
this.field = 'bank_card_img';
}
2023-01-15 07:31:11 +00:00
setTimeout(()=>{
// 提交修改
this.submitEv();
},200)
}
uni.hideLoading();
})
},
// 选择省市区
changeAddress(e){
this.userInfo.province = e.detail.value[0];
this.userInfo.city = e.detail.value[1];
this.userInfo.area = e.detail.value[2];
this.field = 'address';
this.editMsg = e.detail.value[0]+e.detail.value[1]+e.detail.value[2];
setTimeout(()=>{
// 提交修改
this.submitEv();
},200)
2022-11-17 11:40:25 +00:00
},
// 提交修改
submitEv(){
let params = {
field:this.field,
value:this.editMsg!==""?this.editMsg:this.positionList[this.positionIndex].id
}
2022-11-17 11:40:25 +00:00
this.$requst.post('/api/v1/worker/update-info',params).then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('提交成功');
setTimeout(()=>{
this.ifShow = false;
// 获取用户信息
this.getUserInfo();
},200)
}else{
this.$toolAll.tools.showToast(res.msg);
}
})
},
// 图片预览
previewImageEv(url) {
//uniapp预览轮播图
uni.previewImage({
current: 0, //预览图片的下标
urls: [url] //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
})
}
2022-11-16 10:20:26 +00:00
}
}
</script>
<style scoped>
</style>