<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> -->
|
<view class="uni-input">{{NationalOptions[index].dictLabel}}</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">{{marryOptions[index3].dictLabel}}</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 {
|
addNew
|
} from "@/api/system/inspect";
|
import {
|
getInfo
|
} from "@/api/login";
|
import {
|
CLIENT_RENEG_LIMIT
|
} from "tls";
|
export default {
|
data() {
|
return {
|
marryOptions: [],
|
NationalOptions: [],
|
index: 0,
|
index3: 0,
|
inspect: {
|
cusName: '',
|
cusPhone: '',
|
cusIdcard: '',
|
cusNational: '',
|
cusMarryStatus: '',
|
}
|
}
|
},
|
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;
|
});
|
},
|
picker1(cusMarryStatus) {
|
this.index3 = cusMarryStatus.detail.value;
|
console.log(this.index3);
|
|
},
|
picker2(cusNational) {
|
this.index = cusNational.detail.value;
|
console.log(this.index);
|
|
},
|
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 (this.index3 == '') {
|
// this.$modal.msgError("请输入民族");
|
// return false;
|
// }
|
// if (this.index == '') {
|
// this.$modal.msgError("请输入婚姻状况");
|
// return false;
|
// }
|
const openId = uni.getStorageSync('openId');
|
this.inspect.cusMarryStatus = this.marryOptions[this.index3].dictValue;
|
this.inspect.cusNational = this.NationalOptions[this.index].dictValue;
|
let tjCustomer = {
|
connect: openId,
|
cusName: inspect.cusName,
|
cusPhone: inspect.cusPhone,
|
cusIdcard: inspect.cusIdcard,
|
cusNational: this.inspect.cusNational,
|
cusMarryStatus: this.inspect.cusMarryStatus,
|
}
|
addNew(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>
|