building-sign/pagesA/information/information.vue

231 lines
8.9 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>
<view class="cover">
<image :src="userInfo.headimgurl" mode="aspectFit"></image>
</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>
2022-11-17 11:40:25 +00:00
<view class="item" @tap="editEv(1,'position')">
2022-11-16 10:20:26 +00:00
<view class="title">技术岗位</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.position_name}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && userInfo.position_name!==userInfo.check_info.position_name">{{userInfo.check_info.position_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(2,'pay')">
<view class="title">工资</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.pay}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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')">
<view class="title">姓名</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.real_name}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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')">
<view class="title">电话号码</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.mobile}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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(5,'emergency_contact')">
<view class="title">紧急联系人</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.emergency_contact}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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')">
<view class="title">联系人电话</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.emergency_phone}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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')">
<view class="title">银行卡姓名</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.bank_card_name}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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')">
<view class="title">银行卡账号</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.bank_card_number}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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')">
<view class="title">开户行</view>
2022-11-28 06:26:17 +00:00
<view class="msg font24">{{userInfo.bank_name}}<text class="director-arrow" v-if="userInfo.check_info.status!==1 && 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>
</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>
<!-- 技术岗位显示 -->
<picker class="input picker-input" v-if="field=='position'" 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>
<!-- 其他显示 -->
<input class="input font26" v-else type="text" v-model="editMsg" :placeholder="`请输入${editTitle}`" placeholder-style="color:rgba(51,51,51,.4)">
<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:[], //技术岗位
positionIndex:0, //当前选择
2022-11-16 10:20:26 +00:00
ifShow:false, //是否展示弹窗
isLoding:false, //是否记载完成
}
},
onLoad() {
// 获取用户信息
this.getUserInfo();
2022-11-17 11:40:25 +00:00
// 获取技术岗位
this.getPositionList();
2022-11-28 09:44:22 +00:00
},
onShareAppMessage(res) {
let shareObj = {
title:'工地打卡',
path: '/pages/pagehome/pagehome',
imageUrl:'/static/share-logo.jpg',
}
// 返回shareObj
return shareObj;
2022-11-16 10:20:26 +00:00
},
methods: {
// 获取用户信息
getUserInfo(){
this.$requst.post('/api/v1/user/info').then(res=>{
if(res.code==0){
console.log(res,'用户信息');
this.userInfo = res.data;
this.isLoding = true;
}
})
},
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;
},
2022-11-16 10:20:26 +00:00
// 打开修改弹窗
editEv(num,type){
this.ifShow = true;
this.field = type;
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 = '技术岗位';
2022-11-17 11:40:25 +00:00
this.positionIndex = this.positionList.findIndex(item=> item.id === this.userInfo.position);
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;
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= '';
},
// 提交修改
submitEv(){
let params = {
field:this.field,
value:this.editMsg!==""?this.editMsg:this.positionList[this.positionIndex].id
}
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);
}
})
2022-11-16 10:20:26 +00:00
}
}
}
</script>
<style scoped>
</style>