...
|
...
|
@@ -21,8 +21,8 @@ Page({ |
|
|
name: ['受益人1', '受益人2'],
|
|
|
unit: ''
|
|
|
}],
|
|
|
tempfavoree: [],
|
|
|
beneficiaryindex: -1,
|
|
|
tempfavoree: [],// 已选择的受益人
|
|
|
beneficiaryList:[], beneficiaryindex: -1,
|
|
|
beneficiary_name: '',
|
|
|
imgs: [],
|
|
|
main_risk: [],
|
...
|
...
|
@@ -33,10 +33,11 @@ Page({ |
|
|
applicant_name: '',
|
|
|
recognizee_name: '',
|
|
|
rang_beneficiary: [],
|
|
|
risk_list: [{
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
project_time: ''
|
|
|
risk_list:[{
|
|
|
name:'',
|
|
|
projectlist:[],
|
|
|
project_time:'',
|
|
|
time: 1
|
|
|
}],
|
|
|
main_array: [],
|
|
|
warranty_one: [],
|
...
|
...
|
@@ -206,6 +207,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 +218,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 +285,43 @@ 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
|
|
|
})
|
|
|
|
|
|
},
|
...
|
...
|
@@ -337,8 +363,7 @@ Page({ |
|
|
})
|
|
|
console.log(this.data.beneficiary_list)
|
|
|
},
|
|
|
|
|
|
//重组添加受益人
|
|
|
//重组添加受益人
|
|
|
tempBeneficiary() {
|
|
|
var beneficiary_list = this.data.beneficiary_list
|
|
|
var tempfavoree = this.data.tempfavoree
|
...
|
...
|
@@ -364,6 +389,21 @@ Page({ |
|
|
},
|
|
|
|
|
|
|
|
|
//删除收益人
|
|
|
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,20 +411,29 @@ 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;
|
|
|
wx.chooseImage({
|
|
|
count: 6,
|
|
|
sizeType: ['original', 'compressed'],
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
let successUp = 0; //成功个数
|
|
|
let failUp = 0; //失败个数
|
|
|
let i = 0; //第几个
|
...
|
...
|
@@ -396,7 +445,7 @@ Page({ |
|
|
})
|
|
|
that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)
|
|
|
},
|
|
|
fail: function(res) {}
|
|
|
fail: function (res) { }
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -412,7 +461,7 @@ Page({ |
|
|
'strtime': strtime,
|
|
|
'token': app.strTime(strtime)
|
|
|
},
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
wx.hideNavigationBarLoading()
|
|
|
wx.hideLoading()
|
|
|
if (res.statusCode == '200') {
|
...
|
...
|
@@ -443,7 +492,7 @@ Page({ |
|
|
})
|
|
|
}
|
|
|
},
|
|
|
fail: function(res) {
|
|
|
fail: function (res) {
|
|
|
wx.hideNavigationBarLoading()
|
|
|
wx.hideLoading()
|
|
|
},
|
...
|
...
|
@@ -480,14 +529,6 @@ Page({ |
|
|
});
|
|
|
},
|
|
|
|
|
|
//保障期
|
|
|
warrantyTwo(e) {
|
|
|
var guarantee_name = e.detail.value
|
|
|
this.setData({
|
|
|
guarantee_name: guarantee_name
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择各项单位
|
|
|
selectUnit(e) {
|
|
|
var unit = e.currentTarget.dataset.unit
|
...
|
...
|
@@ -496,124 +537,61 @@ 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,
|
|
|
type_money: unit
|
|
|
unit3: unit
|
|
|
})
|
|
|
},
|
|
|
|
|
|
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
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 保单验证&&上传保单
|
|
|
listVerify(e) {
|
|
|
this.tempBeneficiary()
|
|
|
this.tempWarranty()
|
|
|
this.tempburningTime()
|
|
|
// 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
|
|
|
// })
|
|
|
// }
|
|
|
// }
|
|
|
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 warranty_one = this.data.main_array
|
|
|
var compact_time = this.data.compact_time
|
|
|
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) //保障项目
|
...
|
...
|
@@ -798,56 +776,56 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
onLoad: function (options) {
|
|
|
this.ensureProjectList()
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
onShow: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|