clarms-plugins-verifyform.js
3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import { mapState } from "vuex";
import api from '@/api/api'
import {
httpGet,
httpPost,
formdata
} from '@/api/fetch-api.js'
import { getPolicyIdTypeList } from '@/utils/biz.js';
import Vue from 'vue';
import DatePicker from '@/components/date-picker/date-picker.vue';
import { Loading } from 'vant';
import { Select, Option } from 'element-ui';
Vue.use(Select);
Vue.use(Option);
Vue.use(Loading);
export default {
data() {
return {
birthdayIllegal: false,
loading: false,
showTips: false,
data: {
// firstName: "玛丽",
// lastName: "何",
// birthDate: "1999-07-15",
// idNo: "H4099030",
// idType: "40"
firstName: "",
lastName: "",
birthDate: "",
idNo: "",
idType: ""
}
}
},
components: {
DatePicker
},
computed: {
...mapState({
userInfo: state => state.userInfo,
policyList: state => state.policyList
}),
i18n() {
return this.$i18n.messages && this.$i18n.locale ? this.$i18n.messages[this.$i18n.locale] : {};
},
policyIdTypeList() {
return getPolicyIdTypeList(this.$i18n.locale);
},
btnDisabled() {
let b1 = this.data.firstName ? false : true;
let b2 = this.data.lastName ? false : true;
let b3 = this.data.birthDate ? false : true;
let b4 = this.data.idType ? false : true;
let b5 = this.data.idNo ? false : true;
let b6 = this.birthdayIllegal;
return b1 || b2 || b3 || b4 || b5 || b6;
}
},
methods: {
initData() {
},
checkDate(data) {
this.birthdayIllegal = data.disable;
},
toRegisterPage() {
this.$router.push({
path: "/register"
});
},
toLoginPage() {
this.$router.push({
path: "/login"
});
},
toContactUs() {
this.$router.push({
path: "/custom/service?q=m1"
});
},
handleConfirm() {
if (this.btnDisabled) {
return;
}
if (this.loading) {
return;
}
this.loading = true;
httpPost({ url: api.getCidByVerify, data: this.data }).then(res => {
if (res) {
let cid = res;
httpPost({ url: api.clarmsCustomerList, data: { cid: cid } }).then(res => {
this.loading = false;
if (res && res.insuredInfoList && res.insuredInfoList.length > 0) {
sessionStorage.setItem("clarmsRequestCid", cid);
this.$emit("insuredInfoList", { cid: cid, list: res.insuredInfoList });
} else {
this.showTips = true;
}
}).catch(e => {
this.loading = false;
this.showTips = true;
});
} else {
this.loading = false;
this.showTips = true;
}
}).catch(e => {
this.loading = false;
});
}
},
watch: {
'data.firstName': function () {
this.showTips = false;
},
'data.lastName': function () {
this.showTips = false;
},
'data.birthDate': function () {
this.showTips = false;
},
'data.idNo': function () {
this.showTips = false;
},
'data.idType': function () {
this.showTips = false;
},
},
mounted() {
this.initData();
},
created() { }
}