...
|
...
|
@@ -21,6 +21,7 @@ Page({ |
|
|
name: ['受益人1', '受益人2'],
|
|
|
unit: ''
|
|
|
}],
|
|
|
tempfavoree: [],
|
|
|
beneficiaryindex: -1,
|
|
|
beneficiary_name: '',
|
|
|
imgs: [],
|
...
|
...
|
@@ -32,13 +33,18 @@ Page({ |
|
|
applicant_name: '',
|
|
|
recognizee_name: '',
|
|
|
rang_beneficiary: [],
|
|
|
risk_list:[{
|
|
|
name:'',
|
|
|
projectlist:[],
|
|
|
project_time:''
|
|
|
risk_list: [{
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
project_time: ''
|
|
|
}],
|
|
|
main_array:[]
|
|
|
|
|
|
main_array: [],
|
|
|
warranty_one: [],
|
|
|
warranty_two: [],
|
|
|
guarantee_name: '',
|
|
|
long_money: [],
|
|
|
time_name: '',
|
|
|
type_money: '',
|
|
|
},
|
|
|
|
|
|
//投保人
|
...
|
...
|
@@ -85,14 +91,14 @@ Page({ |
|
|
let that = this;
|
|
|
let type = e.currentTarget.dataset.type;
|
|
|
let index = e.currentTarget.dataset.xulie;
|
|
|
let tempProjectlist = Object.assign(this.data.projectlist, {}) ;
|
|
|
let tempProjectlist = Object.assign(this.data.projectlist, {});
|
|
|
// 已经添加的附加险
|
|
|
let rist_list = Object.assign(this.data.risk_list,{});
|
|
|
let rist_list = Object.assign(this.data.risk_list, {});
|
|
|
let tempRist = rist_list[index].projectlist;
|
|
|
// 已经添加的主险
|
|
|
let tempMain_list = Object.assign(this.data.main_array, {})
|
|
|
if(type=='zhuxian'){
|
|
|
if (tempMain_list.length>0) {
|
|
|
if (type == 'zhuxian') {
|
|
|
if (tempMain_list.length > 0) {
|
|
|
for (let i in tempProjectlist) {
|
|
|
for (let j in tempMain_list) {
|
|
|
if (tempProjectlist[i].id == tempMain_list[j].id) {
|
...
|
...
|
@@ -101,17 +107,17 @@ Page({ |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
if (tempRist.length){
|
|
|
} else {
|
|
|
if (tempRist.length) {
|
|
|
for (let i in tempProjectlist) {
|
|
|
for (let j in tempRist){
|
|
|
for (let j in tempRist) {
|
|
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
tempProjectlist[i] = tempRist[j]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '选择保障项目',
|
...
|
...
|
@@ -144,7 +150,7 @@ Page({ |
|
|
this.setData({
|
|
|
projectlist: res.data.data.def
|
|
|
})
|
|
|
console.log(this.data.projectlist)
|
|
|
// console.log(this.data.projectlist)
|
|
|
}
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -170,12 +176,10 @@ Page({ |
|
|
|
|
|
//保障项目金额
|
|
|
popupNum(e) {
|
|
|
// var main_risk = this.data.main_risk
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var projectlist = this.data.projectlist;
|
|
|
if (projectlist[index].choose_status) {
|
|
|
projectlist[index].num = e.detail.value
|
|
|
// main_risk[index].num = projectlist[index].num
|
|
|
}
|
|
|
console.log(main_risk)
|
|
|
this.setData({
|
...
|
...
|
@@ -188,10 +192,10 @@ Page({ |
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var projectlist = this.data.projectlist;
|
|
|
projectlist[index].choose_status = !projectlist[index].choose_status;
|
|
|
console.log(projectlist)
|
|
|
// console.log(projectlist)
|
|
|
this.setData({
|
|
|
projectlist: projectlist
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//确认选择的推荐方案
|
...
|
...
|
@@ -200,11 +204,11 @@ Page({ |
|
|
let type = this.data.addType;
|
|
|
var that = this
|
|
|
var main_array = []
|
|
|
var projectlist = Object.assign(this.data.projectlist,{})
|
|
|
var projectlist = Object.assign(this.data.projectlist, {})
|
|
|
for (var i = 0; i < projectlist.length; i++) {
|
|
|
if (projectlist[i].choose_status) {
|
|
|
main_array.push(projectlist[i])
|
|
|
}
|
|
|
if (projectlist[i].choose_status) {
|
|
|
main_array.push(projectlist[i])
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (main_array != '') {
|
...
|
...
|
@@ -212,18 +216,18 @@ Page({ |
|
|
title: '添加成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
if(type=='fujiaxian'){
|
|
|
if (type == 'fujiaxian') {
|
|
|
let tempRist = that.data.risk_list;
|
|
|
tempRist[index]['projectlist'] = main_array;
|
|
|
that.setData({
|
|
|
risk_list: tempRist,
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
that.setData({
|
|
|
main_array: main_array,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
console.log(this.data.main_array)
|
|
|
// var temp = main_array
|
|
|
// for (var i = 0; i < main_array.length; i++) {
|
|
|
// for (var j = 0; j < main_array[i].title.length; j++) {
|
...
|
...
|
@@ -248,6 +252,30 @@ 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
|
|
|
// })
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
//选择受益人姓名
|
|
|
beneficiarySelect(e) {
|
|
|
// console.log(e)
|
...
|
...
|
@@ -269,8 +297,10 @@ Page({ |
|
|
beneficiaryindex: e.detail.value,
|
|
|
beneficiary_list: beneficiary_list
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
//添加收益比例
|
|
|
addUnit(e) {
|
|
|
// console.log(e)
|
...
|
...
|
@@ -305,12 +335,39 @@ Page({ |
|
|
this.setData({
|
|
|
beneficiary_list: list
|
|
|
})
|
|
|
console.log(this.data.beneficiary_list)
|
|
|
},
|
|
|
|
|
|
//添加附加险
|
|
|
addRisk(){
|
|
|
var risk_list = Object.assign(this.data.risk_list,{});
|
|
|
var len=risk_list.length
|
|
|
//重组添加受益人
|
|
|
tempBeneficiary() {
|
|
|
var beneficiary_list = this.data.beneficiary_list
|
|
|
var tempfavoree = this.data.tempfavoree
|
|
|
var temp = {}
|
|
|
var len = beneficiary_list.length
|
|
|
for (var i = 0; i < beneficiary_list.length; i++) {
|
|
|
if (beneficiary_list[i].unit != '') {
|
|
|
temp.name = beneficiary_list[i].beneficiary_name
|
|
|
temp.unit = beneficiary_list[i].unit
|
|
|
tempfavoree.push(temp)
|
|
|
}
|
|
|
var hash = {};
|
|
|
var temrecommend = tempfavoree.reduce(function(item, next) {
|
|
|
hash[next.name] ? '' : hash[next.name] = true && item.push(next);
|
|
|
return item
|
|
|
}, [])
|
|
|
// console.log(temrecommend)
|
|
|
this.setData({
|
|
|
tempfavoree: temrecommend
|
|
|
})
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
//添加附加险
|
|
|
addRisk() {
|
|
|
var risk_list = Object.assign(this.data.risk_list, {});
|
|
|
var len = risk_list.length
|
|
|
risk_list[len] = {
|
|
|
name: '',
|
|
|
projectlist: [],
|
...
|
...
|
@@ -321,9 +378,6 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传图片
|
|
|
uploadImage() {
|
|
|
let that = this;
|
...
|
...
|
@@ -426,6 +480,14 @@ Page({ |
|
|
});
|
|
|
},
|
|
|
|
|
|
//保障期
|
|
|
warrantyTwo(e) {
|
|
|
var guarantee_name = e.detail.value
|
|
|
this.setData({
|
|
|
guarantee_name: guarantee_name
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择各项单位
|
|
|
selectUnit(e) {
|
|
|
var unit = e.currentTarget.dataset.unit
|
...
|
...
|
@@ -434,17 +496,88 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
//重组保障期数据格式
|
|
|
tempWarranty() {
|
|
|
var guarantee_name = this.data.guarantee_name
|
|
|
var unit = this.data.unit
|
|
|
var warranty_two = this.data.warranty_two
|
|
|
warranty_two.num = guarantee_name
|
|
|
warranty_two.title = unit
|
|
|
// console.log(warranty_two)
|
|
|
this.setData({
|
|
|
warranty_two: warranty_two
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//缴费时长
|
|
|
burningTime(e) {
|
|
|
var time_name = e.detail.value
|
|
|
this.setData({
|
|
|
time_name: time_name
|
|
|
})
|
|
|
this.countImpletionTime()
|
|
|
},
|
|
|
|
|
|
selectUnit2(e) {
|
|
|
var unit = e.currentTarget.dataset.unit
|
|
|
this.setData({
|
|
|
unit2: unit
|
|
|
})
|
|
|
this.countImpletionTime()
|
|
|
},
|
|
|
|
|
|
//重组缴费时长数据格式
|
|
|
tempburningTime() {
|
|
|
var time_name = this.data.time_name
|
|
|
var unit = this.data.unit2
|
|
|
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
|
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
//计算缴费期满日
|
|
|
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())
|
|
|
var day = parseInt(new Date(compact_time).getDate())
|
|
|
var runnian = ''
|
|
|
var cha=''
|
|
|
|
|
|
var birthday='1995-04-20'
|
|
|
var birthday_year = parseInt(new Date(birthday).getFullYear())
|
|
|
|
|
|
if (unit == '年') {
|
|
|
runnian = parseInt(time_name / 4)
|
|
|
cha = time_name - runnian
|
|
|
var dateTemp = compact_time.split("-");
|
|
|
var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);
|
|
|
var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);
|
|
|
var rDate = new Date(millSeconds);
|
|
|
var year = rDate.getFullYear();
|
|
|
var month = rDate.getMonth() + 1;
|
|
|
if (month < 10) month = "0" + month;
|
|
|
var date = rDate.getDate();
|
|
|
if (date < 10) date = "0" + date;
|
|
|
console.log(year + "-" + month + "-" + date);
|
|
|
}else if(unit=='岁'){
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//缴费方式
|
|
|
selectUnit3(e) {
|
|
|
var unit = e.currentTarget.dataset.unit
|
|
|
this.setData({
|
|
|
unit3: unit
|
|
|
unit3: unit,
|
|
|
type_money: unit
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -455,39 +588,32 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 保单验证&&上传保单
|
|
|
listVerify(e) {
|
|
|
// this.insureItem()
|
|
|
// var addlist = this.data.addlist
|
|
|
// if (addlist[0].name != '') {
|
|
|
// var name = addlist[addlist.length - 1].name
|
|
|
// var num = addlist[addlist.length - 1].num
|
|
|
// var title = addlist[addlist.length - 1].title
|
|
|
// if (name == '' || num == '' || title == '') {
|
|
|
// addlist.pop()
|
|
|
// this.setData({
|
|
|
// addlist: addlist
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
this.tempBeneficiary()
|
|
|
this.tempWarranty()
|
|
|
this.tempburningTime()
|
|
|
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 warranty_two = this.data.warranty_two
|
|
|
var type_money = this.data.type_money
|
|
|
|
|
|
var favoree = this.data.favoreename
|
|
|
|
|
|
var compact_time = this.data.compact_time
|
|
|
var warranty_one = this.data.main_array
|
|
|
var impletion_time = this.data.impletion_time
|
|
|
var warranty = e.detail.value.Guarantee_period
|
|
|
var bank = e.detail.value.Renew_bank
|
|
|
var bank_num = e.detail.value.renew_num
|
|
|
var year_money = e.detail.value.year_money
|
|
|
var main_risks = e.detail.value.main_risks
|
|
|
|
|
|
|
|
|
var coverage = e.detail.value.base_money
|
|
|
var picurl = JSON.stringify(this.data.imgs)
|
|
|
var guarantee = JSON.stringify(this.data.selectitem) //保障项目
|
...
|
...
|
|