<template>
|
<view style="height: 100%">
|
<view class="add-address">
|
<view class="add-form">
|
<view class="form-item">
|
<input class="input" @input="bindinputcusName" placeholder="姓名" :value="inspect.cusName"
|
auto-focus />
|
</view>
|
<view class="form-item">
|
<input class="input" @input="bindinputcusPhone" :value="inspect.cusPhone" placeholder="手机号码" />
|
<!-- <button style="background-color:#ff834c;color: #fff;" class="iph" open-type="getPhoneNumber"
|
@getphonenumber="getPhoneNumber" size="mini">绑定手机</button> -->
|
</view>
|
<view class="form-item">
|
<input class="input" @input="bindinputcusIdcard" :value="inspect.cusIdcard" placeholder="身份证号" />
|
</view>
|
<view class="form-item">
|
<uni-forms-item prop="cusNational">
|
<picker style="margin-top: 20px;" class="pic" v-model="inspect.cusNational" @change="picker2"
|
range-key="dictLabel" mode="selector" :value="NationalOptions.dictValue"
|
:range="NationalOptions">
|
<view class="uni-input">{{inspect.cusNational}}</view>
|
</picker>
|
</uni-forms-item>
|
<!-- <input class="input" @input="bindinputcusNational" :value="inspect.cusNational" placeholder="民族" /> -->
|
</view>
|
<view class="form-item">
|
<uni-forms-item prop="cusMarryStatus">
|
<picker style="margin-top: 20px;" class="pic" v-model="inspect.cusMarryStatus" @change="picker1"
|
range-key="dictLabel" mode="selector" :value="marryOptions.dictValue" :range="marryOptions">
|
<view class="uni-input">{{inspect.cusMarryStatus}}</view>
|
</picker>
|
</uni-forms-item>
|
<!-- <input class="input" @input="bindinputcusMarryStatus" :value="inspect.cusMarryStatus"
|
placeholder="婚姻状况" /> -->
|
|
</view>
|
<!-- <view class="form-default">
|
<checkbox :value="address.isDefault == 1" >设为默认体检人</checkbox>
|
</view> -->
|
</view>
|
|
<view class="btns">
|
<button class="cannel" @tap="cancelAddress">取消</button>
|
<button class="save" @tap="saveInspect">保存</button>
|
</view>
|
|
<!-- <view class="region-select" v-if="openSelectRegion">
|
<view class="hd">
|
<view class="region-selected">
|
<view
|
:class="'item ' + (item.code == 0 ? 'disabled' : '') + ' ' + (regionType - 1 === index ? 'selected' : '')"
|
@tap="selectRegionType" :data-region-type-index="index"
|
v-for="(item, index) in selectRegionList" :key="index">
|
{{ item.name }}
|
</view>
|
</view>
|
<view :class="'done ' + (selectRegionDone ? '' : 'disabled')" @tap="doneSelectRegion">确定</view>
|
</view> -->
|
<!-- <view class="bd">
|
<scroll-view scroll-y class="region-list">
|
<view :class="'item ' + (item.selected ? 'selected' : '')" @tap="selectRegion"
|
:data-region-index="index" v-for="(item, index) in regionList" :key="index">
|
{{ item.name }}
|
</view>
|
</scroll-view>
|
</view> -->
|
</view>
|
</view>
|
<!-- <view class="bg-mask" @tap="cancelSelectRegion" v-if="openSelectRegion"></view> -->
|
</view>
|
</template>
|
|
<script>
|
import {
|
bindPhone,
|
getIdCardByPhone
|
} from "@/api/login";
|
import {
|
getDicts
|
} from "@/api/system/dict/data";
|
import {
|
updateCustomerBy,
|
showCustomer,
|
} from "@/api/system/inspect";
|
import {
|
getInfo
|
} from "@/api/login";
|
import {
|
CLIENT_RENEG_LIMIT
|
} from "tls";
|
export default {
|
data() {
|
return {
|
phone: "",
|
marryOptions: [],
|
NationalOptions: [],
|
connect: "",
|
cusName: "",
|
cusPhone: "",
|
cusIdcard: "",
|
cusNational: "",
|
cusMarryStatus: "",
|
inspect: {
|
cusName: '',
|
cusPhone: '',
|
cusIdcard: '',
|
cusNational: '',
|
cusMarryStatus: '',
|
}
|
}
|
},
|
onLoad(option) {
|
this.connect = option.connect;
|
this.cusName = option.cusName;
|
this.cusPhone = option.cusPhone;
|
this.cusIdcard = option.cusIdcard;
|
this.cusNational = option.cusNational;
|
this.cusMarryStatus = option.cusMarryStatus;
|
this.getList();
|
},
|
created() {
|
this.getList();
|
|
},
|
methods: {
|
getList() {
|
getDicts("dict_user_marry").then(response => {
|
this.marryOptions = response.data;
|
getDicts("dict_user_national").then(response => {
|
this.NationalOptions = response.data;
|
let that = this;
|
let tjCustomer = {
|
connect: that.connect,
|
cusName: that.cusName,
|
cusPhone: that.cusPhone,
|
cusIdcard: that.cusIdcard,
|
cusNational: that.cusNational,
|
cusMarryStatus: that.cusMarryStatus,
|
}
|
showCustomer(tjCustomer).then(res => {
|
that.inspect = res.data;
|
that.NationalOptions.forEach(item1 => {
|
// console.log(item1, 111);
|
if (that.inspect.cusNational == item1.dictValue) {
|
that.inspect.cusNational = item1.dictLabel
|
}
|
})
|
// })
|
// this.inspect.forEach(item=>{
|
that.marryOptions.forEach(item1 => {
|
if (that.inspect.cusMarryStatus == item1.dictValue) {
|
that.inspect.cusMarryStatus = item1.dictLabel
|
}
|
})
|
// })
|
// this.inspect = res.data;
|
// for (let i = 0; i <= this.NationalOptions.length; i++) {
|
// if (this.inspect.cusNational == i) {
|
// this.inspect.cusNational = this.NationalOptions[i].dictLabel;
|
// }
|
// }
|
// for (let i = 0; i <= this.marryOptions.length; i++) {
|
// if (this.inspect.cusMarryStatus == i) {
|
// this.inspect.cusMarryStatus = this.marryOptions[i].dictLabel;
|
// }
|
// }
|
|
})
|
});
|
});
|
|
|
|
},
|
|
picker1(cusMarryStatus) {
|
this.index = cusMarryStatus.detail.value;
|
for (var i = 0; i <= this.marryOptions.length; i++) {
|
if (i == cusMarryStatus.detail.value) {
|
this.inspect.cusMarryStatus = this.marryOptions[i].dictLabel
|
}
|
}
|
|
},
|
picker2(cusNational) {
|
this.index1 = cusNational.detail.value;
|
for (var i = 0; i <= this.NationalOptions.length; i++) {
|
if (i == cusNational.detail.value) {
|
this.inspect.cusNational = this.NationalOptions[i].dictLabel
|
}
|
}
|
|
},
|
getPhoneNumber(e) {
|
let _this = this;
|
wx.login({
|
success(res) {
|
const sessionKey = uni.getStorageSync('sessionKey');
|
const openId = uni.getStorageSync('openId');
|
const iv = uni.getStorageSync('iv');
|
const encryptedData = uni.getStorageSync('encryptedData');
|
let data = {
|
code: e.detail.code,
|
sessionKey: sessionKey,
|
openId: openId,
|
iv: iv,
|
encryptedData: encryptedData,
|
}
|
bindPhone(data).then(response => {
|
uni.setStorageSync('msg', response.msg);
|
_this.inspect.cusPhone = response.msg;
|
// console.log(_this.inspect.cusPhone);
|
})
|
}
|
})
|
},
|
cancelAddress() {
|
uni.navigateBack();
|
},
|
bindinputcusName(e) {
|
let inspect = this.inspect;
|
inspect.cusName = e.detail.value;
|
},
|
bindinputcusPhone(e) {
|
let inspect = this.inspect;
|
inspect.cusPhone = e.detail.value;
|
},
|
bindinputcusIdcard(e) {
|
let inspect = this.inspect;
|
inspect.cusIdcard = e.detail.value;
|
},
|
bindinputcusNational(e) {
|
let inspect = this.inspect;
|
inspect.cusNational = e.detail.value;
|
},
|
bindinputcusMarryStatus(e) {
|
let inspect = this.inspect;
|
inspect.cusMarryStatus = e.detail.value;
|
},
|
saveInspect() {
|
let inspect = this.inspect;
|
if (inspect.cusName == '') {
|
this.$modal.msgError("请输入姓名")
|
return false;
|
}
|
if (inspect.cusPhone == '') {
|
this.$modal.msgError("请输入手机号");
|
return false;
|
}
|
if (inspect.cusIdcard == '') {
|
this.$modal.msgError("请输入身份证号");
|
return false;
|
}
|
if (inspect.cusNational == '') {
|
this.$modal.msgError("请输入民族");
|
return false;
|
}
|
if (inspect.cusMarryStatus == '') {
|
this.$modal.msgError("请输入婚姻状况");
|
return false;
|
}
|
const openId = uni.getStorageSync('openId');
|
if (this.index) {
|
this.inspect.cusMarryStatus = this.marryOptions[this.index].dictValue;
|
}
|
if (this.index1) {
|
this.inspect.cusNational = this.NationalOptions[this.index1].dictValue;
|
}
|
|
|
// console.log(this.marryOptions[this.index]);
|
// console.log(this.NationalOptions[this.index1]);
|
let tjCustomer = {
|
cusId: this.inspect.cusId,
|
connect: this.inspect.connect,
|
cusName: this.inspect.cusName,
|
cusPhone: this.inspect.cusPhone,
|
cusIdcard: this.inspect.cusIdcard,
|
cusNational: this.inspect.cusNational,
|
cusMarryStatus: this.inspect.cusMarryStatus,
|
}
|
updateCustomerBy(tjCustomer).then(res => {
|
if (res.code == 200)
|
this.$modal.showToast('修改成功');
|
uni.navigateBack();
|
})
|
},
|
}
|
}
|
</script>
|
|
<style>
|
page {
|
height: 100%;
|
background: #f4f4f4;
|
}
|
|
.add-address .add-form {
|
background: #fff;
|
width: 100%;
|
height: auto;
|
overflow: hidden;
|
}
|
|
.add-address .form-item {
|
height: 116rpx;
|
padding-left: 31.25rpx;
|
border-bottom: 1px solid #d9d9d9;
|
display: flex;
|
align-items: center;
|
padding-right: 31.25rpx;
|
}
|
|
.add-address .input {
|
flex: 1;
|
height: 44rpx;
|
line-height: 44rpx;
|
overflow: hidden;
|
}
|
|
.add-address .form-default {
|
border-bottom: 1px solid #d9d9d9;
|
height: 96rpx;
|
background: #fff;
|
padding-top: 28rpx;
|
font-size: 28rpx;
|
padding-left: 31.25rpx;
|
}
|
|
.add-address .form-default .van-checkbox .van-icon {
|
color: #fff;
|
}
|
|
.add-address .btns {
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
overflow: hidden;
|
display: flex;
|
height: 100rpx;
|
width: 100%;
|
}
|
|
.add-address .cannel,
|
.add-address .save {
|
flex: 1;
|
height: 100rpx;
|
text-align: center;
|
line-height: 100rpx;
|
font-size: 28rpx;
|
color: #fff;
|
border: none;
|
border-radius: 0;
|
}
|
|
.add-address .cannel {
|
background: #333;
|
}
|
|
.add-address .save {
|
background: #b4282d;
|
}
|
|
.region-select {
|
width: 100%;
|
height: 600rpx;
|
background: #fff;
|
position: fixed;
|
z-index: 10;
|
left: 0;
|
bottom: 0;
|
}
|
|
.region-select .hd {
|
height: 108rpx;
|
width: 100%;
|
border-bottom: 1px solid #f4f4f4;
|
padding: 46rpx 30rpx 0 30rpx;
|
}
|
|
.region-select .region-selected {
|
float: left;
|
height: 60rpx;
|
display: flex;
|
}
|
|
.region-select .region-selected .item {
|
max-width: 140rpx;
|
margin-right: 30rpx;
|
text-align: left;
|
line-height: 60rpx;
|
height: 100%;
|
color: #333;
|
font-size: 28rpx;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
|
.region-select .region-selected .item.disabled {
|
color: #999;
|
}
|
|
.region-select .region-selected .item.selected {
|
color: #b4282d;
|
}
|
|
.region-select .done {
|
float: right;
|
height: 60rpx;
|
width: 60rpx;
|
border: none;
|
background: #fff;
|
line-height: 60rpx;
|
text-align: center;
|
color: #333;
|
font-size: 28rpx;
|
}
|
|
.region-select .done.disabled {
|
color: #999;
|
}
|
|
.region-select .bd {
|
height: 492rpx;
|
width: 100%;
|
padding: 0 30rpx;
|
}
|
|
.region-select .region-list {
|
height: 492rpx;
|
}
|
|
.region-select .region-list .item {
|
width: 100%;
|
height: 104rpx;
|
line-height: 104rpx;
|
text-align: left;
|
color: #333;
|
font-size: 28rpx;
|
}
|
|
.region-select .region-list .item.selected {
|
color: #b4282d;
|
}
|
|
.bg-mask {
|
height: 100%;
|
width: 100%;
|
background: rgba(0, 0, 0, 0.4);
|
position: fixed;
|
top: 0;
|
left: 0;
|
z-index: 8;
|
}
|
</style>
|