You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

762 lines
19 KiB

<template>
<view>
<topnav :title='pageTitle' @tohome="tohome"></topnav>
<view class="content">
<view class="pageTitle">身份信息</view>
<view class="listBox mp-20">
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred"> </view>头像
</view>
<view class="listBoxItemRight" @click="chooseImg" data-type="3">
<text v-if="iconFace==''">请选择头像</text>
<image :src="iconFace" v-else class="iconface"></image>
<text class="iconfont icon-Icons_ToolBar_ArrowRight"></text>
</view>
</view>
<view class="listBoxline"></view>
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>护工姓名
</view>
<view class="listBoxItemRight">
<input type="text" class="listBoxItemInput" placeholder-class="listBoxItemInputPlaceholder"
placeholder="请输入" :value="submitData.name" @input='bindChangeInfo' data-type='name' />
</view>
</view>
<view class="listBoxline"></view>
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>联系方式
</view>
<view class="listBoxItemRight">
<input type="number" class="listBoxItemInput" placeholder-class="listBoxItemInputPlaceholder"
placeholder="请输入" :value="submitData.mobile" @input='bindChangeInfo' data-type='mobile' />
</view>
</view>
<view class="listBoxline"></view>
<picker mode="date" :value="sdate" @change="bindDateChange">
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>入职日期
</view>
<view class="listBoxItemRight">
<text class="novalue" v-if="sdate==''">请选择</text>
<text v-else>{{sdate}}</text>
<text class="iconfont icon-Icons_ToolBar_ArrowRight"></text>
</view>
</view>
</picker>
<view class="listBoxline"></view>
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>身份证号码
</view>
<view class="listBoxItemRight">
<input type="idcard" class="listBoxItemInput" placeholder-class="listBoxItemInputPlaceholder"
placeholder="请输入" :value="submitData.id_card_number" @input='bindChangeInfo'
data-type='idcard' />
</view>
</view>
<view class="listBoxline"></view>
<view class="listBoxItem listImgBox">
<view class="imgboxTitle"><text class="vred">*</text>身份证照片</view>
<view class="imgboxContent">
<view v-if="imgCover==''">
<view @tap="chooseImg" class="zhengjian" data-type="1">
<view class="zhengjianadd">
<text class="iconfont icon-add2"></text>
</view>
<text class="tip">请选择身份证正面图片</text>
</view>
</view>
<view v-else>
<view @tap="chooseImg" class="zhengjian" data-type="1">
<image :src="imgCover" style="width:263rpx;height:182rpx"></image>
</view>
</view>
<view v-if="imgBack==''">
<view class="zhengjianadd" @tap="chooseImg" data-type="2">
<text class="iconfont icon-add2"></text>
</view>
<text class="tip">请选择身份证反面图片</text>
</view>
<view v-else>
<view @tap="chooseImg" class="zhengjian" data-type="2">
<image :src="imgBack" style="width:263rpx;height:182rpx"></image>
</view>
</view>
</view>
</view>
</view>
<view class="pageTitle">财务信息</view>
<view class="listBox mp-20">
<view class="listBoxItem">
<view class="listBoxItemLeft">银行卡号码
</view>
<view class="listBoxItemRight">
<input type="number" class="listBoxItemInput" placeholder-class="listBoxItemInputPlaceholder"
placeholder="请输入" :value="submitData.bank" @input='bindChangeInfo' data-type='bank' />
</view>
</view>
<view class="listBoxline"></view>
<view class="listBoxItem">
<view class="listBoxItemLeft">开户行名称
</view>
<view class="listBoxItemRight">
<input type="text" class="listBoxItemInput" placeholder-class="listBoxItemInputPlaceholder"
placeholder="请输入" :value="submitData.account" @input='bindChangeInfo' data-type='account' />
</view>
</view>
</view>
<view class="pageTitle">其它信息</view>
<view class="listBox mp-20">
<picker :value="pindex" @change="bindProjectChange" :range="projectArr">
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>项目归属
</view>
<view class="listBoxItemRight">
<text>{{projectArr[pindex]}}</text>
<text class="iconfont icon-Icons_ToolBar_ArrowRight"></text>
</view>
</view>
</picker>
<view class="listBoxline"></view>
<picker :value="lindex" @change="bindLevelChange" :range="levelsArr">
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>护工等级
</view>
<view class="listBoxItemRight">
<text>{{levelsArr[lindex]==""?'无':levelsArr[lindex]}}</text>
<text class="iconfont icon-Icons_ToolBar_ArrowRight"></text>
</view>
</view>
</picker>
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>护工护理年限
</view>
<view class="listBoxItemRight">
<input type="number" class="listBoxItemInput" placeholder-class="listBoxItemInputPlaceholder"
placeholder="请输入" :value="submitData.work_years" @input='bindChangeInfo'
data-type='workyears' />
</view>
</view>
<view class="listBoxline"></view>
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>健康证
</view>
<view class="listBoxItemRight">
<radio-group class="radiogroup" @change="radioChange" data-type='jiankan'>
<label class="radioitemlabel">
<view>
<radio class="radioitem" value="1"
:checked="submitData.has_health_certificate==1" />
</view>
<view></view>
</label>
<label class="radioitemlabel">
<view>
<radio class="radioitem" value="0"
:checked="submitData.has_health_certificate!=1" />
</view>
<view></view>
</label>
</radio-group>
</view>
</view>
<view class="listBoxline"></view>
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="vred">*</view>技能资格证书
</view>
<view class="listBoxItemRight">
<radio-group class="radiogroup" @change="radioChange" data-type='jineng'>
<label class="radioitemlabel">
<view>
<radio class="radioitem" value="1" :checked="submitData.has_work_certificate==1" />
</view>
<view></view>
</label>
<label class="radioitemlabel">
<view>
<radio class="radioitem" value="0" :checked="submitData.has_work_certificate!=1" />
</view>
<view></view>
</label>
</radio-group>
</view>
</view>
</view>
<view class="bottom">
<view class="bottomRight">
<view class="btnCancel btn" @click="bindBack"></view>
<view class="btnSubmit btn" @click="bindsubmitFun"></view>
</view>
</view>
</view>
<uni-popup ref="popup" type="bottom" @change="bindBack">
<view class="popupbox-msg" :style="'top:-'+(windowHeight/2+150)+'px;'+'left:'+((windowWidth-150)/2)+'px'">
<text class="iconfont icon-check popupbox-msg-icon-check"></text>
<text class="popupbox-msg-info">提交成功</text>
</view>
</uni-popup>
</view>
</template>
<script>
var util = require("../../../../utils/util.js");
var app = getApp();
export default {
data() {
return {
pageTitle: "护工录入",
sdate: "",
pindex: 0,
lindex: 0,
project: [],
projectArr: [],
levels: [],
levelsArr: [],
idcard: "",
idcardImgCover: "",
idcardImgBack: "",
imgCover: "",
imgBack: "",
iconFace: "",
isCopy:0,
submitData: {
project_id: "",
name: "",
id_card_number: "",
mobile: "",
join_at: "",
work_years: "",
paramedic_level_id: "",
account: "",
bank: '',
idcard_front: "",
idcard_back: "",
has_health_certificate: "",
has_work_certificate: "",
avatar: ""
},
windowHeight: 720,
windowWidth: 720
}
},
onLoad: function(option) {
this.loadhospital();
this.windowHeight = app.globalData.winHeight;
this.windowWidth = app.globalData.winWidth;
if (!util.isNull(option.id)) {
this.loadInfo(option.id);
}
},
methods: {
tohome:function(){
uni.navigateTo({
url:"../../../../pages/index/index"
})
},
open() {
// 通过组件定义的ref调用uni-popup方法
this.$refs.popup.open()
},
close() {
// 通过组件定义的ref调用uni-popup方法
this.$refs.popup.close()
},
bindChangeInfo: function(e) {
var that = this;
var type = e.currentTarget.dataset.type;
switch (type) {
case "name":
that.submitData.name = e.detail.value;
break;
case "mobile":
that.submitData.mobile = e.detail.value;
break;
case "idcard":
that.submitData.id_card_number = e.detail.value;
break;
case "workyears":
that.submitData.work_years = e.detail.value;
break;
case "bank":
that.submitData.bank = e.detail.value;
break;
case "account":
that.submitData.account = e.detail.value;
break;
}
},
radioChange: function(e) {
var that = this;
var type = e.currentTarget.dataset.type;
switch (type) {
case "sex":
that.submitData.sex = e.detail.value;
break;
case "jiankan":
that.submitData.has_health_certificate = e.detail.value;
break;
case "jineng":
that.submitData.has_work_certificate = e.detail.value;
break;
}
},
bindDateChange: function(e) {
this.sdate = e.detail.value;
this.submitData.join_at = e.detail.value;
},
bindProjectChange: function(e) {
var that = this;
this.pindex = e.detail.value;
that.submitData.project_id = that.project[this.pindex].id;
this.loadhospitalLevels(that.project[this.pindex].id);
},
bindLevelChange: function(e) {
var that = this;
that.lindex = e.detail.value;
that.submitData.paramedic_level_id = that.levels[e.detail.value].id;
},
loadhospital: function() {
var that = this;
var currentProject = uni.getStorageSync('currentProject');
util.request({
api: 'manager/get-projects',
utilSuccess: function(res) {
var arr = [];
for (var m of res) {
arr.push(m.name);
}
that.projectArr = arr;
that.project = res;
that.submitData.project_id = currentProject.id;
that.loadhospitalLevels(currentProject.id)
},
utilFail: function(err) {
util.alert(err);
}
});
},
loadhospitalLevels: function(id) {
var that = this;
util.request({
api: 'manager/get-project-paramedic-levels/' + id,
data: {
project_id: id
},
utilSuccess: function(res) {
var arr = [];
for (var m of res) {
arr.push(m.name);
}
that.levelsArr = arr;
that.levels = res;
that.submitData.paramedic_level_id = res[0].id;
},
utilFail: function(err) {
util.alert(err);
}
});
},
bindsubmitFun: function() {
let that = this; // 如果未登录,先跳转到登录页面
if (!util.isLogin()) {
uni.navigateTo({
url: '/pages/login/login'
});
return;
}
if (util.isNull(this.submitData.name)) {
uni.showModal({
title: '提示',
content: '请输入护工姓名',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.mobile)) {
uni.showModal({
title: '提示',
content: '请输入手机号码',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.join_at)) {
uni.showModal({
title: '提示',
content: '请选择入职日期',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.id_card_number)) {
uni.showModal({
title: '提示',
content: '请输入身份证号',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.idcard_front)) {
uni.showModal({
title: '提示',
content: '请选择身份证正面图片',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.idcard_back)) {
uni.showModal({
title: '提示',
content: '请选择身份证反面图片',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.paramedic_level_id)) {
uni.showModal({
title: '提示',
content: '请选择护工等级',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.project_id)) {
uni.showModal({
title: '提示',
content: '请选择护工归属项目',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.work_years)) {
uni.showModal({
title: '提示',
content: '请输入护工工作年限',
showCancel: false
});
return;
}
if (util.isNull(this.submitData.has_health_certificate)) {
uni.showModal({
title: '提示',
content: '请选择是否有健康证',
showCancel: false
});
return;
}
if (this.submitData.has_work_certificate == "") {
uni.showModal({
title: '提示',
content: '请选择是否有技能证书',
showCancel: false
});
return;
}
console.log("1.护工保存进入");
console.log(that.submitData);
var url = util.isNull(that.submitData.id) ? 'manager/create-paramedic' : 'manager/update-paramedic/' +
that.submitData.id;
console.log("2.护工保存url" + url);
util.request({
bindThis: that,
api: url,
data: that.submitData,
method: "POST",
utilSuccess: function(res) {
console.log("2.护工保存成功");
console.log(res);
util.alert("操作成功");
that.open();
},
utilFail: function(err) {
util.alert(err);
}
});
},
loadInfo: function(id) {
var that = this;
util.request({
bindThis: that,
api: 'manager/get-paramedic/' + id,
utilSuccess: function(res) {
console.log(res)
that.iconFace = res.avatar_url
that.submitData = res;
that.sdate = res.join_at;
util.getfile(res.idcard_front, function(r) {
that.imgCover = r;
}, function(r) {});
util.getfile(res.idcard_back, function(r) {
that.imgBack = r;
}, function(r) {});
},
utilFail: function(err) {
util.alert(err);
}
});
},
bindBack: function() {
uni.navigateTo({
url: "../carerlist/carerlist"
})
},
chooseImg: function(e) {
var type = e.currentTarget.dataset.type;
let that = this;
var user = uni.getStorageSync('userInfo');
uni.chooseImage({
success(res) {
const tempFilePaths = res.tempFilePaths;
if (type == 1) {
that.setData({
imgCover: tempFilePaths[0]
});
} else if (type == 2) {
that.setData({
imgBack: tempFilePaths[0]
});
} else if (type == 3) {
that.setData({
iconFace: tempFilePaths[0]
});
}
uni.uploadFile({
url: util.HOST + 'manager/upload-image',
//仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
formData: {
'token': user.access_token,
'folder': 'manager'
},
success(res) {
if (res.statusCode == "200") {
console.log(res.data);
var mod = JSON.parse(res.data);
console.log(mod);
if (type == "1") {
that.submitData.idcard_front = mod.id;
} else if (type == "2") {
that.submitData.idcard_back = mod.id;
} else if (type == "3") {
that.submitData.avatar = mod.public_path;
}
} else {
uni.showToast({
title: '上传出现错误'
});
}
}
});
}
});
}
}
}
</script>
<style>
page {
padding-top: 160rpx;
padding-bottom: 120rpx;
}
.bottom {
background: #FFFFFF;
box-shadow: 0 -2rpx 12rpx 0 rgba(0, 0, 0, 0.16), inset 0 1rpx 0 0 #E4E4E4;
width: 100%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 0;
display: flex;
justify-content: space-between;
}
.bottom .bottomLeft {
display: flex;
align-items: center;
}
.bottom .bottomRight {
display: flex;
flex: 1;
}
.btn {
width: 100%;
line-height: 100rpx;
text-align: center;
line-height: 100rpx;
font-family: SourceHanSansCN-Medium;
font-size: 32rpx;
letter-spacing: 0;
}
.btnCancel {
color: #666666;
background: #F0F0F0;
}
.btnSubmit {
color: #FFFFFF;
background: #0DC99E;
}
.priceTitle {
font-family: SourceHanSansCN-Normal;
font-size: 36rpx !important;
color: #999999;
letter-spacing: 0;
line-height: 28rpx;
margin-left: 32rpx;
}
.priceInfo {
font-family: SourceHanSansCN-Normal;
font-size: 36rpx !important;
color: orange;
margin-left: 10rpx;
letter-spacing: 0;
line-height: 28rpx;
}
.protocol {
padding: 30rpx 21rpx;
font-family: SourceHanSansCN-Normal;
font-size: 28rpx;
color: #999999;
letter-spacing: 0;
align-items: center;
display: flex;
}
.protocol .raInput {
transform: scale(0.7)
}
.iconface {
border: 4rpx solid #FFFFFF;
border-radius: 100%;
width: 90rpx;
height: 90rpx;
}
.icon-Icons_ToolBar_ArrowRight {
color: rgba(0, 0, 0, 0.45);
font-size: 22rpx;
margin-left: 13rpx;
margin-top: 5rpx;
}
.radiogroup {
display: flex;
flex-direction: row;
}
.radioitemlabel {
flex: 1;
display: flex;
align-items: center;
margin-left: 134rpx;
}
.radioitem {
transform: scale(0.7)
}
.listImgBox {
flex-direction: column;
align-items: unset;
}
.imgboxContent {
display: flex;
justify-content: space-around;
align-items: center;
}
.zhengjianadd {
width: 263rpx;
height: 182rpx;
border-radius: 20rpx;
background: rgba(19, 169, 135, 0.10);
align-items: center;
justify-content: center;
display: flex;
}
.icon-add2 {
color: #FFFFFF;
}
.tip {
font-size: 24rpx;
color: #999999;
}
.imgboxTitle {
font-size: 32rpx;
}
</style>