...
|
...
|
@@ -21,7 +21,8 @@ Page({ |
|
|
name: ['受益人1', '受益人2'],
|
|
|
unit: ''
|
|
|
}],
|
|
|
tempfavoree: [],
|
|
|
tempfavoree: [], // 已选择的受益人
|
|
|
beneficiaryList: [],
|
|
|
beneficiaryindex: -1,
|
|
|
beneficiary_name: '',
|
|
|
imgs: [],
|
...
|
...
|
@@ -36,7 +37,8 @@ Page({ |
|
|
risk_list: [{
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
project_time: ''
|
|
|
project_time: '',
|
|
|
time: 1
|
|
|
}],
|
|
|
main_array: [],
|
|
|
warranty_one: [],
|
...
|
...
|
@@ -45,6 +47,7 @@ Page({ |
|
|
long_money: [],
|
|
|
time_name: '',
|
|
|
type_money: '',
|
|
|
|
|
|
},
|
|
|
|
|
|
//投保人
|
...
|
...
|
@@ -206,6 +209,7 @@ Page({ |
|
|
var main_array = []
|
|
|
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])
|
|
|
}
|
...
|
...
|
@@ -216,17 +220,20 @@ Page({ |
|
|
title: '添加成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
|
|
|
if (type == 'fujiaxian') {
|
|
|
let tempRist = that.data.risk_list;
|
|
|
tempRist[index]['projectlist'] = main_array;
|
|
|
that.setData({
|
|
|
risk_list: tempRist,
|
|
|
})
|
|
|
|
|
|
} 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++) {
|
...
|
...
|
@@ -280,22 +287,42 @@ Page({ |
|
|
beneficiarySelect(e) {
|
|
|
// console.log(e)
|
|
|
var index = e.currentTarget.dataset.mindex
|
|
|
var beneficiary_list = this.data.beneficiary_list;
|
|
|
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[i].name[e.detail.value]
|
|
|
beneficiary_list[index].beneficiary_name = beneficiary_name
|
|
|
// console.log(beneficiary_list)
|
|
|
}
|
|
|
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];
|
|
|
// 判断受益人是否已经添加
|
|
|
const add = tempBenefice.every((tempBenefice) => {
|
|
|
return tempBenefice != nowPerson
|
|
|
})
|
|
|
console.log()
|
|
|
if (add) {
|
|
|
beneficiary_list[index].beneficiary_name = nowPerson;
|
|
|
tempBenefice.push(nowPerson)
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '请不要重复添加受益人',
|
|
|
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({
|
|
|
beneficiaryindex: e.detail.value,
|
|
|
beneficiary_list: beneficiary_list
|
|
|
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
beneficiaryList: tempBenefice
|
|
|
})
|
|
|
|
|
|
},
|
...
|
...
|
@@ -303,7 +330,6 @@ Page({ |
|
|
|
|
|
//添加收益比例
|
|
|
addUnit(e) {
|
|
|
// console.log(e)
|
|
|
var beneficiary_list = this.data.beneficiary_list;
|
|
|
beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;
|
|
|
this.setData({
|
...
|
...
|
@@ -339,31 +365,48 @@ Page({ |
|
|
},
|
|
|
|
|
|
//重组添加受益人
|
|
|
|
|
|
tempBeneficiary() {
|
|
|
var beneficiary_list = this.data.beneficiary_list
|
|
|
var tempfavoree = this.data.tempfavoree
|
|
|
var temp = {}
|
|
|
var len = beneficiary_list.length
|
|
|
var len = beneficiary_list.length;
|
|
|
var tempfavoree1 = [];
|
|
|
for (var i = 0; i < beneficiary_list.length; i++) {
|
|
|
var temp = {}
|
|
|
if (beneficiary_list[i].unit != '') {
|
|
|
temp.name = beneficiary_list[i].beneficiary_name
|
|
|
temp.unit = beneficiary_list[i].unit
|
|
|
tempfavoree.push(temp)
|
|
|
temp.unit = beneficiary_list[i].unit;
|
|
|
}
|
|
|
var hash = {};
|
|
|
var temrecommend = tempfavoree.reduce(function(item, next) {
|
|
|
hash[next.name] ? '' : hash[next.name] = true && item.push(next);
|
|
|
return item
|
|
|
}, [])
|
|
|
// console.log(temrecommend)
|
|
|
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: temrecommend
|
|
|
tempfavoree: tempfavoree1
|
|
|
})
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
//删除收益人
|
|
|
deletebenefict(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let tempbenefict = Object.assign(this.data.beneficiary_list, {});
|
|
|
let beneficiaryList = Object.assign(this.data.beneficiaryList, {});
|
|
|
// 获取当前选项的受益人
|
|
|
let person = tempbenefict[index].beneficiary_name;
|
|
|
tempbenefict.splice(index, 1);
|
|
|
if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)
|
|
|
|
|
|
this.setData({
|
|
|
beneficiaryList: beneficiaryList,
|
|
|
beneficiary_list: tempbenefict
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//添加附加险
|
|
|
addRisk() {
|
|
|
var risk_list = Object.assign(this.data.risk_list, {});
|
...
|
...
|
@@ -371,13 +414,23 @@ Page({ |
|
|
risk_list[len] = {
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
project_time: ''
|
|
|
project_time: '',
|
|
|
time: ''
|
|
|
}
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//删除附加险
|
|
|
deleteRisk(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
risk_list.splice(index, 1);
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
//上传图片
|
|
|
uploadImage() {
|
|
|
let that = this;
|
...
|
...
|
@@ -503,7 +556,7 @@ Page({ |
|
|
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
|
|
|
})
|
...
|
...
|
@@ -533,54 +586,53 @@ Page({ |
|
|
var long_money = this.data.long_money
|
|
|
long_money.num = time_name
|
|
|
long_money.title = unit
|
|
|
console.log(long_money)
|
|
|
// 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 month = parseInt(new Date(compact_time).getMonth() + 1)
|
|
|
var day = parseInt(new Date(compact_time).getDate())
|
|
|
var runnian = ''
|
|
|
var cha=''
|
|
|
var impletion_time = this.data.impletion_time
|
|
|
var warranty_one = this.data.warranty_one
|
|
|
|
|
|
var birthday='1995-04-20'
|
|
|
var tempbirth_time = ''
|
|
|
var birthday = '1995-04-20'
|
|
|
var birthday_year = parseInt(new Date(birthday).getFullYear())
|
|
|
var tempbirth_time=''
|
|
|
|
|
|
if (unit == '年') {
|
|
|
|
|
|
var millSeconds = Math.abs(nDate) - (1 * 24 * 60 * 60 * 1000);
|
|
|
|
|
|
// 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=='岁'){
|
|
|
var temp_year = (birthday_year + time_name - 1)
|
|
|
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
|
|
|
tempbirth_time = temp_year + '-' + temp_month + '-'+day
|
|
|
console.log(tempbirth_time)
|
|
|
|
|
|
|
|
|
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
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//缴费方式
|
...
|
...
|
@@ -593,9 +645,12 @@ Page({ |
|
|
},
|
|
|
|
|
|
selectUnit4(e) {
|
|
|
var unit = e.currentTarget.dataset.unit
|
|
|
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
|
|
|
this.setData({
|
|
|
unit4: unit
|
|
|
risk_list: risk_list
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -604,28 +659,29 @@ Page({ |
|
|
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 impletion_time = this.data.impletion_time
|
|
|
var warranty_one = this.data.main_array
|
|
|
var warranty_two = this.data.warranty_two
|
|
|
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_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 coverage = e.detail.value.base_money
|
|
|
var picurl = JSON.stringify(this.data.imgs)
|
|
|
var guarantee = JSON.stringify(this.data.selectitem) //保障项目
|
|
|
var more = JSON.stringify(this.data.addlist)
|
...
|
...
|
|