...
|
...
|
@@ -18,12 +18,13 @@ Page({ |
|
|
insure: ['投保人', '投保人2'],
|
|
|
insureindex: -1,
|
|
|
beneficiary_list: [{
|
|
|
name: ['受益人1', '受益人2'],
|
|
|
name_array: ['受益人1', '受益人2'],
|
|
|
unit: ''
|
|
|
}],
|
|
|
beneficiaryindex: -1,
|
|
|
tempfavoree: [], // 已选择的受益人
|
|
|
beneficiaryList: [],
|
|
|
beneficiaryindex: -1,
|
|
|
name: '', //受益人的名字,
|
|
|
beneficiary_name: '',
|
|
|
imgs: [],
|
|
|
main_risk: [],
|
...
|
...
|
@@ -36,18 +37,37 @@ Page({ |
|
|
rang_beneficiary: [],
|
|
|
risk_list: [{
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
mo: [],
|
|
|
project_time: '',
|
|
|
time: 1
|
|
|
title: '',
|
|
|
num: ''
|
|
|
}],
|
|
|
main_array: [],
|
|
|
warranty_one: [],
|
|
|
warranty_two: [],
|
|
|
warranty_one: '',
|
|
|
warranty_two: {},
|
|
|
guarantee_name: '',
|
|
|
long_money: [],
|
|
|
long_money: {},
|
|
|
time_name: '',
|
|
|
type_money: '',
|
|
|
more: [],
|
|
|
guarantee: [],
|
|
|
InfoId: 0,
|
|
|
def_id: '',
|
|
|
edit_state: false
|
|
|
},
|
|
|
|
|
|
//保单号
|
|
|
policyNum(e) {
|
|
|
this.setData({
|
|
|
in_num: e.detail.value,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//保单号
|
|
|
setFirm(e) {
|
|
|
this.setData({
|
|
|
firm: e.detail.value,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//投保人
|
...
|
...
|
@@ -55,7 +75,7 @@ Page({ |
|
|
var insure = this.data.insure
|
|
|
this.setData({
|
|
|
insureindex: e.detail.value,
|
|
|
applicant_name: insure[e.detail.value]
|
|
|
applicant_name: insure[e.detail.value],
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -68,11 +88,43 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
//主险名称
|
|
|
setRiskName(e) {
|
|
|
// console.log(e)
|
|
|
this.setData({
|
|
|
main_risks: e.detail.value,
|
|
|
})
|
|
|
// console.log(this.data.main_risks)
|
|
|
},
|
|
|
|
|
|
//保费
|
|
|
yearMoney(e) {
|
|
|
this.setData({
|
|
|
year_money: e.detail.value,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//设置银行
|
|
|
setBank(e) {
|
|
|
this.setData({
|
|
|
bank: e.detail.value,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//设置账号
|
|
|
setBankNum(e) {
|
|
|
this.setData({
|
|
|
bank_num: e.detail.value,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//合同生效日
|
|
|
compactTime(e) {
|
|
|
this.setData({
|
|
|
compact_time: e.detail.value,
|
|
|
})
|
|
|
this.countImpletionTime()
|
|
|
this.countImpletionTime2()
|
|
|
},
|
|
|
|
|
|
//缴费期满日
|
...
|
...
|
@@ -91,13 +143,18 @@ Page({ |
|
|
|
|
|
//保障项目弹窗
|
|
|
ensureProject(e) {
|
|
|
this.setData({
|
|
|
edit_state: false
|
|
|
})
|
|
|
|
|
|
let that = this;
|
|
|
let type = e.currentTarget.dataset.type;
|
|
|
let index = e.currentTarget.dataset.xulie;
|
|
|
let tempProjectlist = Object.assign(this.data.projectlist, {});
|
|
|
// 已经添加的附加险
|
|
|
let rist_list = Object.assign(this.data.risk_list, {});
|
|
|
let tempRist = rist_list[index].projectlist;
|
|
|
console.log(rist_list)
|
|
|
let tempRist = rist_list[index].mo;
|
|
|
// 已经添加的主险
|
|
|
let tempMain_list = Object.assign(this.data.main_array, {})
|
|
|
if (type == 'zhuxian') {
|
...
|
...
|
@@ -120,18 +177,19 @@ Page({ |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '选择保障项目',
|
|
|
})
|
|
|
|
|
|
this.setData({
|
|
|
popup_state: true,
|
|
|
addType: type,
|
|
|
xulie: index,
|
|
|
projectlist: tempProjectlist
|
|
|
|
|
|
})
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
// 调取保障项目接口
|
...
|
...
|
@@ -167,6 +225,9 @@ Page({ |
|
|
var title = projectlist[index].title
|
|
|
for (var i = 0; i < title.length; i++) {
|
|
|
title[i].current = ''
|
|
|
if (title[i].current == '') {
|
|
|
title[i].label_state = false
|
|
|
}
|
|
|
}
|
|
|
projectlist[index].title[sindex].current = sindex
|
|
|
if (projectlist[index].title[sindex].current == sindex) {
|
...
|
...
|
@@ -197,8 +258,11 @@ Page({ |
|
|
projectlist[index].choose_status = !projectlist[index].choose_status;
|
|
|
// console.log(projectlist)
|
|
|
this.setData({
|
|
|
projectlist: projectlist
|
|
|
projectlist: projectlist,
|
|
|
})
|
|
|
if (this.data.inforid != 0) {
|
|
|
edit_state: false
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//确认选择的推荐方案
|
...
|
...
|
@@ -209,12 +273,27 @@ Page({ |
|
|
var main_array = []
|
|
|
var projectlist = Object.assign(this.data.projectlist, {})
|
|
|
for (var i = 0; i < projectlist.length; i++) {
|
|
|
|
|
|
// for (var j = 0; j < projectlist[i].title.length; j++) {
|
|
|
if (projectlist[i].choose_status) {
|
|
|
// if (projectlist[i].title[j].current == ''){
|
|
|
// projectlist[i].title[j].label_state=false
|
|
|
main_array.push(projectlist[i])
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
// }
|
|
|
}
|
|
|
// for (var i = 0; i < projectlist.length; i++) {
|
|
|
// for (var j = 0; j < projectlist[i].title.length; j++) {
|
|
|
// if (projectlist[i].choose_status) {
|
|
|
// if (projectlist[i].title[j].current == '') {
|
|
|
// projectlist[i].title[j].label_state = false
|
|
|
// main_array.push(projectlist[i])
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
if (main_array != '') {
|
|
|
wx.showToast({
|
|
|
title: '添加成功',
|
...
|
...
|
@@ -223,7 +302,8 @@ Page({ |
|
|
|
|
|
if (type == 'fujiaxian') {
|
|
|
let tempRist = that.data.risk_list;
|
|
|
tempRist[index]['projectlist'] = main_array;
|
|
|
console.log(tempRist)
|
|
|
tempRist[index]['mo'] = main_array;
|
|
|
that.setData({
|
|
|
risk_list: tempRist,
|
|
|
})
|
...
|
...
|
@@ -259,39 +339,106 @@ Page({ |
|
|
}, 1000)
|
|
|
},
|
|
|
|
|
|
//主线保障期
|
|
|
//重组主险的保障项目
|
|
|
tempMain() {
|
|
|
// var main_array = this.data.main_array
|
|
|
// var warranty_one = this.data.warranty_one
|
|
|
// var temp = {}
|
|
|
// var len = main_array.length
|
|
|
// for (var i = 0; i < main_array.length; i++) {
|
|
|
// if (main_array[i].choose_status) {
|
|
|
// temp.num = main_array[i].beneficiary_name
|
|
|
// temp.title = main_array[i].name
|
|
|
// warranty_one.push(temp)
|
|
|
// }
|
|
|
// var hash = {};
|
|
|
// var temrecommend = warranty_one.reduce(function (item, next) {
|
|
|
// hash[next.name] ? '' : hash[next.name] = true && item.push(next);
|
|
|
// return item
|
|
|
// }, [])
|
|
|
// console.log(temrecommend)
|
|
|
// this.setData({
|
|
|
// warranty_one: temrecommend
|
|
|
// })
|
|
|
// }
|
|
|
var main_array = this.data.main_array
|
|
|
var warranty_one1 = []
|
|
|
console.log(main_array)
|
|
|
for (var i = 0; i < main_array.length; i++) {
|
|
|
var temp = {}
|
|
|
for (var j = 0; j < main_array[i].title.length; j++) {
|
|
|
|
|
|
if (main_array[i].choose_status) {
|
|
|
if (main_array[i].title[j].label_state) {
|
|
|
temp.id = main_array[i].id
|
|
|
temp.name = main_array[i].name
|
|
|
temp.num = main_array[i].num
|
|
|
temp.title = main_array[i].title[j].name
|
|
|
temp.t_id = main_array[i].title[j].t_id
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
warranty_one1.push(temp)
|
|
|
console.log(warranty_one1)
|
|
|
this.setData({
|
|
|
guarantee: warranty_one1
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//主险名称
|
|
|
addRiskName(e) {
|
|
|
var risk_list = this.data.risk_list
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
risk_list[index].name = e.detail.value
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//主险保障其
|
|
|
addRiskUnit(e) {
|
|
|
var risk_list = this.data.risk_list
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
risk_list[index].num = e.detail.value
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//重组附加险整体数据结构
|
|
|
tempAddRisk() {
|
|
|
var risk_list = this.data.risk_list
|
|
|
var temp_risk = []
|
|
|
var sub_array = []
|
|
|
console.log(risk_list)
|
|
|
for (var i = 0; i < risk_list.length; i++) {
|
|
|
var temp = {}
|
|
|
for (var j = 0; j < risk_list[i].mo.length; j++) {
|
|
|
var subtemp = {}
|
|
|
for (var k = 0; k < risk_list[i].mo[j].title.length; k++) {
|
|
|
if (risk_list[i].name != '') {
|
|
|
if (risk_list[i].mo[j].choose_status) {
|
|
|
if (risk_list[i].mo[j].title[k].label_state) {
|
|
|
temp.name = risk_list[i].name
|
|
|
temp.num = risk_list[i].num
|
|
|
temp.title = risk_list[i].title
|
|
|
subtemp.id = risk_list[i].mo[j].id
|
|
|
subtemp.name = risk_list[i].mo[j].name
|
|
|
subtemp.num = risk_list[i].mo[j].num
|
|
|
subtemp.title = risk_list[i].mo[j].title[k].name
|
|
|
subtemp.t_id = risk_list[i].mo[j].title[k].t_id
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
sub_array.push(subtemp)
|
|
|
}
|
|
|
|
|
|
temp.mo = sub_array
|
|
|
temp_risk.push(temp)
|
|
|
console.log(temp_risk)
|
|
|
this.setData({
|
|
|
more: temp_risk
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//选择受益人姓名
|
|
|
beneficiarySelect(e) {
|
|
|
// console.log(e)
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false
|
|
|
})
|
|
|
}
|
|
|
var index = e.currentTarget.dataset.mindex
|
|
|
var beneficiary_list = Object.assign(this.data.beneficiary_list, {});
|
|
|
// 获取当前已选择的收益人
|
|
|
let tempBenefice = Object.assign(this.data.beneficiaryList, {})
|
|
|
// 当前选择的收益人
|
|
|
let nowPerson = beneficiary_list[index].name[e.detail.value];
|
|
|
let nowPerson = beneficiary_list[index].name_array[e.detail.value];
|
|
|
// 判断受益人是否已经添加
|
|
|
const add = tempBenefice.every((tempBenefice) => {
|
|
|
return tempBenefice != nowPerson
|
...
|
...
|
@@ -306,28 +453,14 @@ Page({ |
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
// for (var i = 0; i < beneficiary_list.length; i++) {
|
|
|
// for (var j = 0; j < beneficiary_list[i].name.length; j++) {
|
|
|
// var beneficiary_name =
|
|
|
|
|
|
// beneficiary_list[index].beneficiary_name = beneficiary_list[i].name[e.detail.value]
|
|
|
// // console.log(beneficiary_list)
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// let tempRangArry = this.data.rang_beneficiary;
|
|
|
// tempRangArry[index] = beneficiary_list[index].name[e.detail.value]
|
|
|
// console.log(tempRangArry)
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
beneficiaryList: tempBenefice
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
//添加收益比例
|
|
|
addUnit(e) {
|
|
|
var beneficiary_list = this.data.beneficiary_list;
|
...
|
...
|
@@ -354,7 +487,7 @@ Page({ |
|
|
})
|
|
|
} else {
|
|
|
list[len] = {
|
|
|
name: ['受益人1', '受益人2'],
|
|
|
name_array: this.data.insure,
|
|
|
unit: ''
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -365,7 +498,6 @@ Page({ |
|
|
},
|
|
|
|
|
|
//重组添加受益人
|
|
|
|
|
|
tempBeneficiary() {
|
|
|
var beneficiary_list = this.data.beneficiary_list
|
|
|
var len = beneficiary_list.length;
|
...
|
...
|
@@ -377,12 +509,6 @@ Page({ |
|
|
temp.unit = beneficiary_list[i].unit;
|
|
|
}
|
|
|
tempfavoree1.push(temp)
|
|
|
// var hash = {};
|
|
|
// var temrecommend = tempfavoree.reduce(function (item, next) {
|
|
|
// hash[next.name] ? '' : hash[next.name] = true && item.push(next);
|
|
|
// return item
|
|
|
// }, [])
|
|
|
|
|
|
this.setData({
|
|
|
tempfavoree: tempfavoree1
|
|
|
})
|
...
|
...
|
@@ -390,7 +516,6 @@ Page({ |
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
//删除收益人
|
|
|
deletebenefict(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
...
|
...
|
@@ -409,13 +534,19 @@ Page({ |
|
|
|
|
|
//添加附加险
|
|
|
addRisk() {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false
|
|
|
})
|
|
|
}
|
|
|
var risk_list = Object.assign(this.data.risk_list, {});
|
|
|
var len = risk_list.length
|
|
|
risk_list[len] = {
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
mo: [],
|
|
|
project_time: '',
|
|
|
time: ''
|
|
|
title: '',
|
|
|
num: ''
|
|
|
}
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
...
|
...
|
@@ -431,6 +562,7 @@ Page({ |
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//上传图片
|
|
|
uploadImage() {
|
|
|
let that = this;
|
...
|
...
|
@@ -533,12 +665,20 @@ Page({ |
|
|
});
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//保障期
|
|
|
warrantyTwo(e) {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false
|
|
|
})
|
|
|
}
|
|
|
var guarantee_name = e.detail.value
|
|
|
this.setData({
|
|
|
guarantee_name: guarantee_name
|
|
|
guarantee_name: e.detail.value
|
|
|
})
|
|
|
this.countImpletionTime2()
|
|
|
},
|
|
|
|
|
|
//选择各项单位
|
...
|
...
|
@@ -547,8 +687,10 @@ Page({ |
|
|
this.setData({
|
|
|
unit: unit
|
|
|
})
|
|
|
this.countImpletionTime2()
|
|
|
},
|
|
|
|
|
|
|
|
|
//重组保障期数据格式
|
|
|
tempWarranty() {
|
|
|
var guarantee_name = this.data.guarantee_name
|
...
|
...
|
@@ -556,14 +698,68 @@ Page({ |
|
|
var warranty_two = this.data.warranty_two
|
|
|
warranty_two.num = guarantee_name
|
|
|
warranty_two.title = unit
|
|
|
|
|
|
this.setData({
|
|
|
warranty_two: warranty_two
|
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
//计算缴费期满日,主线保障其
|
|
|
countImpletionTime2() {
|
|
|
var guarantee_name = parseInt(this.data.guarantee_name)
|
|
|
var unit = this.data.unit
|
|
|
var compact_time = this.data.compact_time
|
|
|
var year = parseInt(new Date(compact_time).getFullYear())
|
|
|
console.log(year)
|
|
|
var month = parseInt(new Date(compact_time).getMonth() + 1)
|
|
|
var day = parseInt(new Date(compact_time).getDate())
|
|
|
// var impletion_time = this.data.impletion_time
|
|
|
var warranty_one = this.data.warranty_one
|
|
|
|
|
|
var tempbirth_time = ''
|
|
|
var birthday = '1995-04-20'
|
|
|
var birthday_year = parseInt(new Date(birthday).getFullYear())
|
|
|
|
|
|
if (compact_time == '') {
|
|
|
wx.showToast({
|
|
|
title: '请选择合同生效日',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else {
|
|
|
if (unit == '年') {
|
|
|
var temp_year = (year + guarantee_name)
|
|
|
var temp_day = day - 1
|
|
|
if (month < 10) month = "0" + month;
|
|
|
if (temp_day < 10) temp_day = "0" + temp_day;
|
|
|
// impletion_time = temp_year + '-' + month + '-' + temp_day
|
|
|
warranty_one = temp_year + '-' + month + '-' + temp_day
|
|
|
} else if (unit == '岁') {
|
|
|
var temp_year = (birthday_year + guarantee_name - 1)
|
|
|
var temp_year2 = (birthday_year + guarantee_name)
|
|
|
var temp_month = month
|
|
|
if (temp_month < 10) temp_month = "0" + temp_month;
|
|
|
if (month < 10) month = "0" + month;
|
|
|
if (day < 10) day = "0" + day;
|
|
|
// impletion_time = temp_year + '-' + temp_month + '-' + day
|
|
|
warranty_one = temp_year2 + '-' + month + '-' + day
|
|
|
} else if (unit == '终身') {
|
|
|
// impletion_time = '终身缴费'
|
|
|
warranty_one = '终身'
|
|
|
}
|
|
|
this.setData({
|
|
|
// impletion_time: impletion_time,
|
|
|
warranty_one: warranty_one
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//缴费时长
|
|
|
burningTime(e) {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false
|
|
|
})
|
|
|
}
|
|
|
var time_name = e.detail.value
|
|
|
this.setData({
|
|
|
time_name: time_name
|
...
|
...
|
@@ -583,10 +779,10 @@ Page({ |
|
|
tempburningTime() {
|
|
|
var time_name = this.data.time_name
|
|
|
var unit = this.data.unit2
|
|
|
console.log(unit)
|
|
|
var long_money = this.data.long_money
|
|
|
long_money.num = time_name
|
|
|
long_money.title = unit
|
|
|
// console.log(long_money)
|
|
|
this.setData({
|
|
|
long_money: long_money
|
|
|
})
|
...
|
...
|
@@ -597,42 +793,49 @@ Page({ |
|
|
countImpletionTime() {
|
|
|
var time_name = parseInt(this.data.time_name)
|
|
|
var unit = this.data.unit2
|
|
|
|
|
|
var compact_time = this.data.compact_time
|
|
|
var year = parseInt(new Date(compact_time).getFullYear())
|
|
|
var month = parseInt(new Date(compact_time).getMonth() + 1)
|
|
|
var day = parseInt(new Date(compact_time).getDate())
|
|
|
var impletion_time = this.data.impletion_time
|
|
|
var warranty_one = this.data.warranty_one
|
|
|
// var warranty_one = this.data.warranty_one
|
|
|
|
|
|
var tempbirth_time = ''
|
|
|
var birthday = '1995-04-20'
|
|
|
var birthday_year = parseInt(new Date(birthday).getFullYear())
|
|
|
if (unit == '年') {
|
|
|
var temp_year = (year + time_name)
|
|
|
var temp_day = day - 1
|
|
|
if (month < 10) month = "0" + month;
|
|
|
if (temp_day < 10) temp_day = "0" + temp_day;
|
|
|
impletion_time = temp_year + '-' + month + '-' + temp_day
|
|
|
warranty_one = temp_year + '-' + month + '-' + temp_day
|
|
|
} else if (unit == '岁') {
|
|
|
|
|
|
var temp_year = (birthday_year + time_name - 1)
|
|
|
var temp_year2 = (birthday_year + time_name)
|
|
|
var temp_month = month
|
|
|
if (temp_month < 10) temp_month = "0" + temp_month;
|
|
|
if (month < 10) month = "0" + month;
|
|
|
if (day < 10) day = "0" + day;
|
|
|
impletion_time = temp_year + '-' + temp_month + '-' + day
|
|
|
warranty_one = temp_year2 + '-' + month + '-' + day
|
|
|
|
|
|
} else if (unit == '终身') {
|
|
|
impletion_time = '终身缴费'
|
|
|
warranty_one = '终身'
|
|
|
|
|
|
if (compact_time == '') {
|
|
|
wx.showToast({
|
|
|
title: '请选择合同生效日',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else {
|
|
|
if (unit == '年') {
|
|
|
var temp_year = (year + time_name)
|
|
|
var temp_day = day - 1
|
|
|
if (month < 10) month = "0" + month;
|
|
|
if (temp_day < 10) temp_day = "0" + temp_day;
|
|
|
impletion_time = temp_year + '-' + month + '-' + temp_day
|
|
|
// warranty_one = temp_year + '-' + month + '-' + temp_day
|
|
|
} else if (unit == '岁') {
|
|
|
var temp_year = (birthday_year + time_name - 1)
|
|
|
var temp_year2 = (birthday_year + time_name)
|
|
|
var temp_month = month
|
|
|
if (temp_month < 10) temp_month = "0" + temp_month;
|
|
|
if (month < 10) month = "0" + month;
|
|
|
if (day < 10) day = "0" + day;
|
|
|
impletion_time = temp_year + '-' + temp_month + '-' + day
|
|
|
// warranty_one = temp_year2 + '-' + month + '-' + day
|
|
|
} else if (unit == '终身') {
|
|
|
impletion_time = '终身缴费'
|
|
|
// warranty_one = '终身'
|
|
|
}
|
|
|
this.setData({
|
|
|
impletion_time: impletion_time,
|
|
|
// warranty_one: warranty_one
|
|
|
})
|
|
|
}
|
|
|
this.setData({
|
|
|
impletion_time: impletion_time,
|
|
|
warranty_one: warranty_one
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//缴费方式
|
...
|
...
|
@@ -644,49 +847,202 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
//附加险保障其
|
|
|
selectUnit4(e) {
|
|
|
var unit = e.currentTarget.dataset.unit;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
risk_list[index].time = unit
|
|
|
risk_list[index].title = unit
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 保单验证&&上传保单
|
|
|
listVerify(e) {
|
|
|
|
|
|
//家庭成员
|
|
|
familyMember() {
|
|
|
var FamilyId = this.data.FamilyId
|
|
|
let url = 'counselor/familyname'
|
|
|
let params = {
|
|
|
FamilyId: FamilyId,
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
// console.log(res)
|
|
|
var beneficiary_list = this.data.beneficiary_list
|
|
|
for (var i in beneficiary_list) {
|
|
|
beneficiary_list[i].name_array = res.data.data.list
|
|
|
}
|
|
|
// console.log(beneficiary_list)
|
|
|
|
|
|
if (res.data.code == 200) {
|
|
|
this.setData({
|
|
|
insure: res.data.data.list,
|
|
|
recognizee: res.data.data.list,
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
setStorge(e) {
|
|
|
this.tempBeneficiary()
|
|
|
this.tempWarranty()
|
|
|
this.tempburningTime()
|
|
|
this.tempMain()
|
|
|
this.tempAddRisk()
|
|
|
var favoree = JSON.stringify(this.data.tempfavoree)
|
|
|
var warranty_two = JSON.stringify(this.data.warranty_two)
|
|
|
var long_money = JSON.stringify(this.data.long_money)
|
|
|
var more = JSON.stringify(this.data.more)
|
|
|
var guarantee = JSON.stringify(this.data.guarantee)
|
|
|
var warn = ""; //弹框时提示的内容
|
|
|
var in_num = this.data.in_num
|
|
|
var firm = this.data.firm
|
|
|
var applicant = this.data.applicant_name
|
|
|
var recognizee = this.data.recognizee_name
|
|
|
var main_risks = this.data.main_risks
|
|
|
var year_money = this.data.year_money
|
|
|
var compact_time = this.data.compact_time
|
|
|
var impletion_time = this.data.impletion_time
|
|
|
var warranty_one = JSON.stringify(this.data.warranty_one)
|
|
|
var type_money = this.data.type_money
|
|
|
var bank = this.data.bank
|
|
|
var bank_num = this.data.bank_num
|
|
|
var picurl = JSON.stringify(this.data.imgs)
|
|
|
let url = 'counselor/inforsave'
|
|
|
let params = {
|
|
|
// InfoId: this.data.inforid,
|
|
|
def_id: this.data.def_id,
|
|
|
in_num: in_num,
|
|
|
firm: firm,
|
|
|
applicant: applicant,
|
|
|
recognizee: recognizee,
|
|
|
favoree: favoree,
|
|
|
main_risks: main_risks,
|
|
|
guarantee: guarantee,
|
|
|
year_money: year_money,
|
|
|
warranty_two: warranty_two,
|
|
|
compact_time: compact_time,
|
|
|
impletion_time: impletion_time,
|
|
|
warranty_one: warranty_one,
|
|
|
long_money: long_money,
|
|
|
type_money: type_money,
|
|
|
bank: bank,
|
|
|
bank_num: bank_num,
|
|
|
more: more,
|
|
|
picurl: picurl,
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
wx.navigateBack({
|
|
|
delta: 1,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//获取缓存内容
|
|
|
getStorage() {
|
|
|
let url = 'counselor/inforCopy'
|
|
|
let params = {
|
|
|
def_id: this.data.def_id,
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res)
|
|
|
if (res.data.code == 200) {
|
|
|
var warranty_two = res.data.data.def.warranty_two
|
|
|
var unit = this.data.unit
|
|
|
unit = warranty_two.title
|
|
|
var long_money = res.data.data.def.long_money
|
|
|
var unit2 = this.data.unit2
|
|
|
unit2 = long_money.title
|
|
|
var type_money = res.data.data.def.type_money
|
|
|
var unit3 = this.data.unit3
|
|
|
unit3 = type_money
|
|
|
var beneficiary_list = res.data.data.def.favoree
|
|
|
for (var obj in beneficiary_list) {
|
|
|
beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
|
|
|
beneficiary_list[obj].name_array = this.data.insure
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
imgs: res.data.data.def.picurl,
|
|
|
type_money: res.data.data.def.type_money,
|
|
|
unit3: unit3,
|
|
|
year_money: res.data.data.def.year_money,
|
|
|
long_money: res.data.data.def.long_money,
|
|
|
unit2: unit2,
|
|
|
in_num: res.data.data.def.in_num,
|
|
|
firm: res.data.data.def.firm,
|
|
|
main_risks: res.data.data.def.main_risks,
|
|
|
main_array: res.data.data.def.guarantee,
|
|
|
applicant_name: res.data.data.def.applicant,
|
|
|
recognizee_name: res.data.data.def.recognizee,
|
|
|
warranty_one: res.data.data.def.warranty_one,
|
|
|
warranty_two: res.data.data.def.warranty_two,
|
|
|
unit: unit,
|
|
|
compact_time: res.data.data.def.compact_time,
|
|
|
impletion_time: res.data.data.def.impletion_time,
|
|
|
bank: res.data.data.def.bank,
|
|
|
bank_num: res.data.data.def.bank_num,
|
|
|
risk_list: res.data.data.def.more,
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
edit_state: true,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 保单验证&&上传保单
|
|
|
listVerify(e) {
|
|
|
console.log(this.data.inforid)
|
|
|
if (this.data.inforid == 0 || this.data.inforid == undefined) {
|
|
|
this.tempBeneficiary()
|
|
|
this.tempWarranty()
|
|
|
this.tempburningTime()
|
|
|
this.tempMain()
|
|
|
this.tempAddRisk()
|
|
|
var favoree = JSON.stringify(this.data.tempfavoree)
|
|
|
var warranty_two = JSON.stringify(this.data.warranty_two)
|
|
|
var long_money = JSON.stringify(this.data.long_money)
|
|
|
var more = JSON.stringify(this.data.more)
|
|
|
var guarantee = JSON.stringify(this.data.guarantee)
|
|
|
} else if (this.data.edit_state) {
|
|
|
var favoree = JSON.stringify(this.data.beneficiary_list)
|
|
|
var warranty_two = JSON.stringify(this.data.warranty_two)
|
|
|
var long_money = JSON.stringify(this.data.long_money)
|
|
|
var more = JSON.stringify(this.data.risk_list)
|
|
|
var guarantee = JSON.stringify(this.data.main_array)
|
|
|
} else {
|
|
|
this.tempBeneficiary()
|
|
|
this.tempWarranty()
|
|
|
this.tempburningTime()
|
|
|
this.tempMain()
|
|
|
this.tempAddRisk()
|
|
|
var favoree = JSON.stringify(this.data.tempfavoree)
|
|
|
var warranty_two = JSON.stringify(this.data.warranty_two)
|
|
|
var long_money = JSON.stringify(this.data.long_money)
|
|
|
var more = JSON.stringify(this.data.more)
|
|
|
var guarantee = JSON.stringify(this.data.guarantee)
|
|
|
}
|
|
|
|
|
|
var warn = ""; //弹框时提示的内容
|
|
|
var flag = true; //判断信息输入是否完整判断弹窗
|
|
|
|
|
|
var in_num = e.detail.value.policy_num
|
|
|
var firm = e.detail.value.company;
|
|
|
var applicant = this.data.applicant_name
|
|
|
var recognizee = this.data.recognizee_name
|
|
|
var favoree = this.data.tempfavoree
|
|
|
var main_risks = e.detail.value.main_risks
|
|
|
|
|
|
var year_money = e.detail.value.year_money
|
|
|
var compact_time = this.data.compact_time
|
|
|
var impletion_time = this.data.impletion_time
|
|
|
var warranty_one = this.data.main_array
|
|
|
var warranty_two = this.data.warranty_two
|
|
|
var warranty_one = JSON.stringify(this.data.warranty_one)
|
|
|
var type_money = this.data.type_money
|
|
|
var bank = e.detail.value.bank
|
|
|
var bank_num = e.detail.value.bank_num
|
|
|
var type_money = this.data.type_money
|
|
|
var long_money = this.data.long_money
|
|
|
var year_money = e.detail.value.year_money
|
|
|
// var coverage = e.detail.value.base_money
|
|
|
var main_risks = e.detail.value.main_risks
|
|
|
|
|
|
var warranty = e.detail.value.Guarantee_period
|
|
|
var picurl = JSON.stringify(this.data.imgs)
|
|
|
var guarantee = JSON.stringify(this.data.selectitem) //保障项目
|
|
|
var more = JSON.stringify(this.data.addlist)
|
|
|
|
|
|
// if (this.data.inforid != undefined) {
|
|
|
if (in_num == '') {
|
|
|
warn = '请输入保单号!'
|
|
|
} else if (firm == '') {
|
...
|
...
|
@@ -697,28 +1053,30 @@ Page({ |
|
|
warn = '请输入被保险人!'
|
|
|
} else if (favoree == '') {
|
|
|
warn = '请输入受益人!'
|
|
|
} else if (main_risks == '') {
|
|
|
warn = '请输入主险名称!'
|
|
|
} else if (year_money == '') {
|
|
|
warn = '请输入年交保费!'
|
|
|
} else if (compact_time == '') {
|
|
|
warn = '请输入合同生效日!'
|
|
|
} else if (impletion_time == '') {
|
|
|
warn = '请输入缴费期满日!'
|
|
|
} else if (warranty == '') {
|
|
|
} else if (warranty_two.num == '') {
|
|
|
warn = '请输入保障期!'
|
|
|
} else if (long_money.num == '') {
|
|
|
warn = '请输入缴费时长!'
|
|
|
} else if (type_money == '') {
|
|
|
warn = '请输入缴费方式!'
|
|
|
} else if (bank == '') {
|
|
|
warn = '请输入续费银行!'
|
|
|
} else if (bank_num == '') {
|
|
|
warn = '请输入续费账号!'
|
|
|
} else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {
|
|
|
warn = '请输入正确续费账号!'
|
|
|
} else if (year_money == '') {
|
|
|
warn = '请输入年交保费!'
|
|
|
} else if (main_risks == '') {
|
|
|
warn = '请输入主险名称!'
|
|
|
} else if (coverage == '') {
|
|
|
warn = '请输入主险基本保额!'
|
|
|
} else if (more.length == 2) {
|
|
|
warn = '请上传上传附加险!'
|
|
|
} else if (guarantee.length == 0) {
|
|
|
warn = '请选择保障项目!'
|
|
|
} else if (impletion_time == '') {
|
|
|
warn = '请输入缴费期满日!'
|
|
|
} else if (warranty_one == '') {
|
|
|
warn = '请输入主险保障期!'
|
|
|
} else if (more == '') {
|
|
|
warn = '请输入附加险!'
|
|
|
} else if (picurl.length == 2) {
|
|
|
warn = '请选择图片!'
|
|
|
} else {
|
...
|
...
|
@@ -733,17 +1091,19 @@ Page({ |
|
|
applicant: applicant,
|
|
|
recognizee: recognizee,
|
|
|
favoree: favoree,
|
|
|
main_risks: main_risks,
|
|
|
guarantee: guarantee,
|
|
|
year_money: year_money,
|
|
|
warranty_two: warranty_two,
|
|
|
compact_time: compact_time,
|
|
|
impletion_time: impletion_time,
|
|
|
warranty: warranty,
|
|
|
warranty_one: warranty_one,
|
|
|
long_money: long_money,
|
|
|
type_money: type_money,
|
|
|
bank: bank,
|
|
|
bank_num: bank_num,
|
|
|
year_money: year_money,
|
|
|
main_risks: main_risks,
|
|
|
coverage: coverage,
|
|
|
more: more,
|
|
|
guarantee: guarantee,
|
|
|
picurl: picurl
|
|
|
picurl: picurl,
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if (res.data.code == 200) {
|
...
|
...
|
@@ -753,105 +1113,7 @@ Page({ |
|
|
}
|
|
|
})
|
|
|
}
|
|
|
// }
|
|
|
// else {
|
|
|
// if (in_num == '') {
|
|
|
// warn = '请输入保单号!'
|
|
|
// } else if (firm == '') {
|
|
|
// warn = '请输入所属公司!'
|
|
|
// } else if (applicant == '') {
|
|
|
// warn = '请输入投保人!'
|
|
|
// } else if (recognizee == '') {
|
|
|
// warn = '请输入被保险人!'
|
|
|
// } else if (favoree == '') {
|
|
|
// warn = '请输入受益人!'
|
|
|
// } else if (compact_time == '') {
|
|
|
// warn = '请输入合同生效日!'
|
|
|
// } else if (impletion_time == '') {
|
|
|
// warn = '请输入缴费期满日!'
|
|
|
// } else if (warranty == '') {
|
|
|
// warn = '请输入保障期!'
|
|
|
// } else if (bank == '') {
|
|
|
// warn = '请输入续费银行!'
|
|
|
// } else if (bank_num == '') {
|
|
|
// warn = '请输入续费账号!'
|
|
|
// } else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {
|
|
|
// warn = '请输入正确续费账号!'
|
|
|
// } else if (year_money == '') {
|
|
|
// warn = '请输入年交保费!'
|
|
|
// } else if (main_risks == '') {
|
|
|
// warn = '请输入主险名称!'
|
|
|
// } else if (coverage == '') {
|
|
|
// warn = '请输入主险基本保额!'
|
|
|
// } else if (more.length == 2) {
|
|
|
// warn = '请上传上传附加险!'
|
|
|
// } else if (guarantee.length == 2) {
|
|
|
// warn = '请选择保障项目!'
|
|
|
// } else if (picurl.length == 2) {
|
|
|
// warn = '请选择图片!'
|
|
|
// } else {
|
|
|
// flag = false
|
|
|
// // 添加、修改保单接口调取
|
|
|
// let url = 'counselor/inforuodate'
|
|
|
// let params = {
|
|
|
// def_id: this.data.def_id,
|
|
|
// in_num: in_num,
|
|
|
// firm: firm,
|
|
|
// applicant: applicant,
|
|
|
// recognizee: recognizee,
|
|
|
// favoree: favoree,
|
|
|
// compact_time: compact_time,
|
|
|
// impletion_time: impletion_time,
|
|
|
// warranty: warranty,
|
|
|
// bank: bank,
|
|
|
// bank_num: bank_num,
|
|
|
// year_money: year_money,
|
|
|
// main_risks: main_risks,
|
|
|
// coverage: coverage,
|
|
|
// more: more,
|
|
|
// guarantee: guarantee,
|
|
|
// picurl: picurl
|
|
|
// }
|
|
|
// app.post(url, params).then((res) => {
|
|
|
// var projectlist = this.data.projectlist
|
|
|
// for (var i = 0; i < projectlist.length; i++) {
|
|
|
// projectlist[i].status = false
|
|
|
// }
|
|
|
// if (res.data.code == 200) {
|
|
|
// var continue1 = e.detail.target.dataset.type
|
|
|
// var complete = e.detail.target.dataset.type
|
|
|
// if (continue1 == 'continue1') {
|
|
|
// wx.showToast({
|
|
|
// title: '添加成功',
|
|
|
// icon: 'none',
|
|
|
// duration: 2000,
|
|
|
// })
|
|
|
// this.setData({
|
|
|
// nullNum: '',
|
|
|
// addlist: [{
|
|
|
// name: '',
|
|
|
// num: '',
|
|
|
// title: ''
|
|
|
// }],
|
|
|
// projectlist: projectlist,
|
|
|
// imgs: [],
|
|
|
// compact_time: '',
|
|
|
// impletion_time: ''
|
|
|
// })
|
|
|
// } else if (complete == complete) {
|
|
|
// wx.showToast({
|
|
|
// title: '添加成功',
|
|
|
// icon: 'none',
|
|
|
// duration: 2000,
|
|
|
// })
|
|
|
// wx.navigateBack({
|
|
|
// delta: 1,
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
if (flag == true) {
|
|
|
wx.showToast({
|
|
|
title: warn,
|
...
|
...
|
@@ -862,11 +1124,107 @@ Page({ |
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//获取编辑保单接口
|
|
|
getlistVerify() {
|
|
|
let url = 'counselor/infordef'
|
|
|
let params = {
|
|
|
InfoId: this.data.inforid,
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res)
|
|
|
if (res.data.code == 200) {
|
|
|
var warranty_two = res.data.data.def.warranty_two
|
|
|
var unit = this.data.unit
|
|
|
unit = warranty_two.title
|
|
|
var long_money = res.data.data.def.long_money
|
|
|
var unit2 = this.data.unit2
|
|
|
unit2 = long_money.title
|
|
|
var type_money = res.data.data.def.type_money
|
|
|
var unit3 = this.data.unit3
|
|
|
unit3 = type_money
|
|
|
var beneficiary_list = res.data.data.def.favoree
|
|
|
for (var obj in beneficiary_list) {
|
|
|
beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
|
|
|
beneficiary_list[obj].name_array = this.data.insure
|
|
|
}
|
|
|
|
|
|
var risk_list = res.data.data.def.more
|
|
|
var projectlist = this.data.projectlist
|
|
|
for (var i = 0; i < risk_list.length; i++) {
|
|
|
for (var j = 0; j < projectlist.length; j++) {
|
|
|
for (var k = 0; k < projectlist[j].title.length; k++) {
|
|
|
if (risk_list[i].id == projectlist[j].id) {
|
|
|
if (risk_list[i].title == projectlist[j].title[k].name) {
|
|
|
var title = {}
|
|
|
title.name = projectlist[j].title[k]
|
|
|
// risk_list[i].push(title)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var warranty_two = res.data.data.def.warranty_two
|
|
|
var guarantee_name = warranty_two.num
|
|
|
|
|
|
var long_money = res.data.data.def.long_money
|
|
|
var time_name = long_money.num
|
|
|
|
|
|
this.setData({
|
|
|
imgs: res.data.data.def.picurl,
|
|
|
type_money: res.data.data.def.type_money,
|
|
|
unit3: unit3,
|
|
|
year_money: res.data.data.def.year_money,
|
|
|
long_money: res.data.data.def.long_money,
|
|
|
unit2: unit2,
|
|
|
in_num: res.data.data.def.in_num,
|
|
|
firm: res.data.data.def.firm,
|
|
|
main_risks: res.data.data.def.main_risks,
|
|
|
main_array: res.data.data.def.guarantee,
|
|
|
applicant_name: res.data.data.def.applicant,
|
|
|
recognizee_name: res.data.data.def.recognizee,
|
|
|
warranty_one: res.data.data.def.warranty_one,
|
|
|
warranty_two: res.data.data.def.warranty_two,
|
|
|
unit: unit,
|
|
|
compact_time: res.data.data.def.compact_time,
|
|
|
impletion_time: res.data.data.def.impletion_time,
|
|
|
bank: res.data.data.def.bank,
|
|
|
bank_num: res.data.data.def.bank_num,
|
|
|
risk_list: risk_list,
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
edit_state: true,
|
|
|
guarantee_name: guarantee_name,
|
|
|
time_name: time_name,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
this.ensureProjectList()
|
|
|
this.setData({
|
|
|
def_id: options.def_id,
|
|
|
inforid: options.inforid,
|
|
|
FamilyId: options.FamilyId,
|
|
|
recognizee_name: options.name
|
|
|
})
|
|
|
if (options.inforid == undefined) {
|
|
|
this.setData({
|
|
|
inforid: 0
|
|
|
})
|
|
|
}
|
|
|
if (options.FamilyId != '') {
|
|
|
this.familyMember()
|
|
|
}
|
|
|
if (options.inforid != undefined) {
|
|
|
this.getlistVerify()
|
|
|
} else {
|
|
|
// this.getStorage()
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|