<template>
|
<div class="loan-info-box">
|
<x-header slot="header"
|
style="width:100%;height:46px;background-color: #ec6758"
|
title="联系人信息"
|
:left-options="{backText: '', preventGoBack:true}"
|
@on-click-back="goBackPage"
|
></x-header>
|
<flow class="progressState">
|
<flow-state state="1" title="填写资料" class="currentStep porcolor"></flow-state>
|
<flow-line is-done></flow-line>
|
<flow-state state="2" title="绑定银行卡"></flow-state>
|
<flow-line></flow-line>
|
<flow-state state="3" title="照片上传"></flow-state>
|
<flow-line></flow-line>
|
<flow-state state="4" title="三方授权"></flow-state>
|
<flow-line></flow-line>
|
<flow-state state="5" title="提交申请"></flow-state>
|
</flow>
|
<group class="personInfo" text-align="right">
|
<x-input title="第一联系人"
|
placeholder="请输入姓名"
|
v-model.trim="Contact.contactName1"
|
></x-input>
|
<selector title="与联系人关系"
|
:options="contactRrel1List"
|
placeholder="请选择"
|
v-model="Contact.contactRel1"
|
@on-change="selectorChange(1)"
|
></selector>
|
<x-input title="联系人电话"
|
:max="11"
|
:min="11"
|
type="tel"
|
is-type="china-mobile"
|
placeholder="请输入11位手机号"
|
v-model.trim="Contact.contactMblNo1"
|
></x-input>
|
</group>
|
<group class="personInfo" text-align="right">
|
<x-input title="第二联系人"
|
placeholder="请输入姓名"
|
v-model.trim="Contact.contactName2"
|
></x-input>
|
<selector title="与联系人关系"
|
:options="contactRrel2List"
|
placeholder="请选择"
|
v-model="Contact.contactRel2"
|
@on-change="selectorChange(2)"
|
></selector>
|
<x-input title="联系人电话"
|
:max="11"
|
:min="11"
|
type="tel"
|
is-type="china-mobile"
|
placeholder="请输入11位手机号"
|
v-model.trim="Contact.contactMblNo2"
|
></x-input>
|
</group>
|
<div style="height: 20px"></div>
|
<box gap="0 15px">
|
<x-button type="primary" @click.native="handleUpStep">上一步</x-button>
|
<x-button type="primary" @click.native="handleNextStep">下一步</x-button>
|
</box>
|
<div style="height: 20px"></div>
|
</div>
|
</template>
|
|
<script>
|
import {
|
Flow,
|
FlowState,
|
FlowLine,
|
XHeader,
|
Group,
|
GroupTitle,
|
Cell,
|
XInput,
|
Selector,
|
XButton,
|
Box,
|
Actionsheet
|
} from 'vux';
|
|
import FSpace from '../../../components/common/FSpace.vue';
|
import validate from '../../../tool/validator';
|
import SysApi from '../../../api/api'
|
import statusCodeManage from '../../../api/statusCodeManage'
|
|
export default {
|
name: 'contactInfo',
|
data() {
|
return {
|
Contact: {
|
contactName1: '',
|
contactRel1: [],
|
contactMblNo1: '',
|
contactName2: '',
|
contactRel2: [],
|
contactMblNo2: '',
|
}, // 初始化的用户信息
|
isLastStep: false, // 是否是最后一步
|
activePageItem: 0, // 激活当前页
|
pageList: [], // 一共有几页
|
contactRrel1List: [],
|
contactRrel2List: [],
|
oldContactRrel1List: [],
|
oldContactRrel2List: []
|
};
|
},
|
|
methods: {
|
|
//初始化联系人信息
|
ContactInfo() {
|
let _this = this;
|
let prodId = {
|
prodId: this.$route.query.prodId,
|
};
|
SysApi.initContact(prodId).then(
|
res => {
|
_this.Contact.contactName1 = res.body.contactName1 || '';
|
_this.Contact.contactRel1 = res.body.contactRel1 || '';
|
_this.Contact.contactMblNo1 = res.body.contactMblNo1 || '';
|
_this.Contact.contactName2 = res.body.contactName2 || '';
|
_this.Contact.contactRel2 = res.body.contactRel2 || '';
|
_this.Contact.contactMblNo2 = res.body.contactMblNo2 || '';
|
console.log(res);
|
if (sessionStorage.userMarrStatus) {
|
let _index = null;
|
let arr = [];
|
res.body.contactRrel1List.map((val, index) => {
|
if (val.code == 4) {
|
arr.push(val)
|
_index = index
|
}
|
});
|
_this.contactRrel1List = this.getOptionsList(arr);
|
_this.oldContactRrel1List = this.getOptionsList(arr);
|
|
res.body.contactRre21List.splice(_index, 1)
|
_this.contactRrel2List = this.getOptionsList(res.body.contactRre21List);
|
_this.oldContactRrel2List = this.getOptionsList(res.body.contactRre21List);
|
this.Contact.contactRel1 = 4
|
|
} else {
|
_this.contactRrel1List = this.getOptionsList(res.body.contactRrel1List);
|
_this.oldContactRrel1List = this.getOptionsList(res.body.contactRrel1List);
|
|
_this.contactRrel2List = this.getOptionsList(res.body.contactRre21List);
|
_this.oldContactRrel2List = this.getOptionsList(res.body.contactRre21List);
|
}
|
|
}, error => {
|
statusCodeManage.showTipOfStatusCode(error)
|
}
|
)
|
},
|
selectorChange(flag) {
|
if (sessionStorage.userMarrStatus) return;
|
let index = 0
|
if (flag === 1 && this.Contact.contactRel1) {
|
this.contactRrel2List = JSON.parse(JSON.stringify((this.oldContactRrel2List)))
|
index = this.oldContactRrel2List.findIndex(val => {
|
return val.key === this.Contact.contactRel1
|
})
|
this.contactRrel2List.splice(index, 1)
|
} else if (flag === 2 && this.Contact.contactRel2) {
|
this.contactRrel1List = JSON.parse(JSON.stringify((this.oldContactRrel1List)))
|
index = this.oldContactRrel1List.findIndex(val => {
|
return val.key === this.Contact.contactRel2
|
})
|
this.contactRrel1List.splice(index, 1)
|
}
|
|
},
|
//上一步跳转
|
handleUpStep() {
|
this.$router.push({
|
path: '/bnd/credit/companyInfo', query: {prodId: this.$route.query.prodId}
|
});
|
},
|
//下一步的表单验证及提交
|
handleNextStep() {
|
if (validate.checkValEmpty(this.Contact.contactName1)) {
|
this.validateTip('请输入第一联系人的姓名');
|
return false;
|
}
|
if (validate.checkValEmpty(this.Contact.contactRel1)) {
|
this.validateTip('请选择与第一联系人的关系');
|
return false;
|
}
|
if (validate.checkValEmpty(this.Contact.contactMblNo1)) {
|
this.validateTip('请输入第一联系人的电话');
|
return false;
|
}
|
if (validate.checkValEmpty(this.Contact.contactName2)) {
|
this.validateTip('请输入第一联系人的姓名');
|
return false;
|
}
|
if (validate.checkValEmpty(this.Contact.contactRel2)) {
|
this.validateTip('请选择与第二联系人的关系');
|
return false;
|
}
|
if (validate.checkValEmpty(this.Contact.contactMblNo2)) {
|
this.validateTip('请输入第二联系人的电话');
|
return false;
|
}
|
if (!validate.checkPhone(this.Contact.contactMblNo1)) {
|
this.validateTip('请输入正确的第一联系人手机号码');
|
return false;
|
}
|
if (!validate.checkPhone(this.Contact.contactMblNo2)) {
|
this.validateTip('请输入正确的第二联系人手机号码');
|
return false;
|
}
|
|
let _this = this;
|
let Contact = {
|
prodId: this.$route.query.prodId,
|
contactName1: this.Contact.contactName1,
|
contactRel1: this.Contact.contactRel1,
|
contactMblNo1: this.Contact.contactMblNo1,
|
|
contactName2: this.Contact.contactName2,
|
contactRel2: this.Contact.contactRel2,
|
contactMblNo2: this.Contact.contactMblNo2,
|
};
|
SysApi.saveContactInfo(Contact).then(
|
res => {
|
this.$router.push({
|
path: '/bnd/credit/passwordInfo', query: {prodId: _this.$route.query.prodId,}
|
});
|
}, error => {
|
statusCodeManage.showTipOfStatusCode(error)
|
}
|
)
|
|
},
|
|
// 弹窗
|
validateTip(errorMsg) {
|
return this.$vux.toast.show({
|
width: 'auto',
|
type: 'text',
|
text: errorMsg,
|
time: 2000,
|
position: 'middle'
|
});
|
},
|
// 得到选项列表统一的方法
|
getOptionsList(optionList) {
|
let tmpList = [];
|
if (optionList instanceof Array) {
|
optionList.forEach(function (item) {
|
tmpList.push({
|
key: item.code,
|
value: item.name
|
});
|
});
|
}
|
return tmpList;
|
},
|
//返回上一页
|
goBackPage() {
|
// 如果是第一步的话,那么返回到上一个页面
|
if (this.activePageItem <= 1) {
|
this.$router.back();
|
// 不是的话,那么显示上一步
|
} else {
|
this.activePageItem--;
|
this.isLastStep = this.pageList.length === this.activePageItem;
|
}
|
},
|
},
|
activated: function () {
|
this.ContactInfo();
|
},
|
|
components: {
|
Group,
|
GroupTitle,
|
Cell,
|
XInput,
|
Selector,
|
XHeader,
|
XButton,
|
Box,
|
Flow,
|
FlowState,
|
FlowLine,
|
Actionsheet,
|
FSpace
|
}
|
};
|
</script>
|
|
<style lang="less">
|
@import "../../../style/mixin.less";
|
|
.loan-info-box {
|
background-color: @color-background-default;
|
.vux-header {
|
.color-linear-gradient(@color-primary-light, @color-primary, 90deg);
|
.vux-header-left {
|
.left-arrow:before {
|
border: solid 1px @color-white;
|
border-width: 2px 0 0 2px;
|
}
|
}
|
}
|
.progressState div p {
|
font-size: @font-size-tiny;
|
}
|
.weui-wepay-flow__state {
|
width: 16px;
|
height: 16px;
|
top: -1px;
|
padding-top: 1px;
|
}
|
.currentStep .weui-wepay-flow__state {
|
width: 16px;
|
height: 16px;
|
padding-top: 1px;
|
border: 1px solid @color-primary;
|
color: @color-primary;
|
border-radius: 50%;
|
background-color: @color-white;
|
}
|
.weui-input {
|
height: 28px;
|
line-height: 28px;
|
}
|
.weui-wepay-flow, .weui-wepay-flow-auto {
|
padding: 10px 40px 30px;
|
background: @color-white;
|
}
|
.weui-wepay-flow__li_done .weui-wepay-flow__state,
|
.weui-wepay-flow__process {
|
background-color: @color-primary;
|
}
|
}
|
|
.weui-wepay-flow {
|
background-color: @color-white;
|
}
|
|
.left-arrow:before {
|
border-color: @color-white;
|
}
|
|
.weui-cells__title {
|
margin: 0 !important;
|
font-size: 16PX !important;
|
}
|
|
.weui-input, .weui-cell__bd {
|
font-size: @font-size-base;
|
}
|
|
.weui-label {
|
font-size: @font-size-base;
|
}
|
|
.personInfo ::-webkit-input-placeholder { /* WebKit browsers */
|
color: #bfbfbf;
|
}
|
|
.personInfo :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
|
color: #bfbfbf;
|
}
|
|
.personInfo ::-moz-placeholder { /* Mozilla Firefox 19+ */
|
color: #bfbfbf;
|
}
|
|
.personInfo :-ms-input-placeholder { /* Internet Explorer 10+ */
|
color: #bfbfbf;
|
}
|
|
.header-space {
|
height: 46px;
|
}
|
|
.loan-info-box .weui-cell_select .weui-select {
|
padding-right: 2.5rem;
|
direction: rtl;
|
}
|
|
.loan-info-box .weui-input {
|
text-align: right;
|
font-size: @font-size-medium;
|
}
|
|
.loan-info-box .weui-btn_primary {
|
.color-linear-gradient(@color-primary-light, @color-primary, 90deg);
|
}
|
|
.loan-info-box .weui-btn_primary:not(.weui-btn_disabled):active {
|
color: rgba(255, 255, 255, 0.6);
|
background-color: rgb(241, 95, 79);;
|
}
|
|
/*------------------------------*/
|
.vux-no-group-title {
|
margin-top: 0.77rem !important;
|
}
|
|
.loan-info-box .currentStep .weui-wepay-flow__state {
|
background-color: @color-primary;
|
color: @color-white !important;
|
line-height: 1rem;
|
}
|
|
.weui-wepay-flow__li.weui-wepay-flow__li .weui-wepay-flow__state {
|
width: 1.33333rem;
|
height: 1.33333rem;
|
border-radius: 1.58333rem;
|
color: @color-text-third;
|
line-height: 1.33333rem;
|
}
|
|
.porcolor p {
|
color: @color-primary;
|
}
|
|
.loan-info-box .weui-wepay-flow, .loan-info-box .weui-wepay-flow-auto {
|
padding: 0.83333rem 2.33333rem 2.5rem;
|
}
|
|
select {
|
font-size: @font-size-medium !important;
|
}
|
|
.weui-btn:after {
|
border: none !important;
|
}
|
|
.weui-btn {
|
font-size: @font-size-primary !important;
|
}
|
</style>
|