...
|
...
|
@@ -53,8 +53,8 @@ Page({ |
|
|
guarantee: [],
|
|
|
InfoId: 0,
|
|
|
def_id: '',
|
|
|
edit_state: false,
|
|
|
edit_state2: false,
|
|
|
// edit_state: false,
|
|
|
// edit_state2: false,
|
|
|
// risk_listitm: '',
|
|
|
storge_state: false,
|
|
|
warranty_info: '请输入',
|
...
|
...
|
@@ -203,15 +203,19 @@ 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 tempProjectlist = JSON.parse(JSON.stringify(this.data.projectlist));
|
|
|
console.log(tempProjectlist)
|
|
|
var sub_index = that.data.sub_index
|
|
|
var edit_state3 = that.data.edit_state3
|
|
|
|
|
|
// 已经添加的附加险
|
|
|
let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
let risk_list = Object.assign({},this.data.risk_list);
|
|
|
let tempRist = risk_list[index].mo;
|
|
|
this.setData({
|
|
|
type: type
|
|
|
type: type,
|
|
|
xielie: index
|
|
|
})
|
|
|
|
|
|
if (type == 'fujiaxian') {
|
...
|
...
|
@@ -220,114 +224,117 @@ Page({ |
|
|
})
|
|
|
}
|
|
|
// 已经添加的主险
|
|
|
let tempMain_list = Object.assign(this.data.main_array, {})
|
|
|
// this.data.inforid != 0 && this.data.inforid != undefined
|
|
|
let tempMain_list = Object.assign({},this.data.main_array)
|
|
|
this.data.inforid != 0 && this.data.inforid != undefined
|
|
|
//编辑/缓存状态
|
|
|
if (that.data.temp_state) {
|
|
|
console.log('edit')
|
|
|
//edit_state3:代表是刚获取到信息是的结构,还是重新选择之后的数据结构
|
|
|
if (edit_state3) {
|
|
|
//获取到的信息结构
|
|
|
if (type == 'zhuxian') {
|
|
|
console.log('zx')
|
|
|
this.setData({
|
|
|
focus: false
|
|
|
})
|
|
|
if (tempMain_list.length > 0) {
|
|
|
for (let i in tempProjectlist) {
|
|
|
for (let j in tempMain_list) {
|
|
|
if (tempProjectlist[i].id == tempMain_list[j].id) {
|
|
|
tempProjectlist[i].choose_status = true
|
|
|
tempProjectlist[i].num = tempMain_list[j].num
|
|
|
for (let g in tempProjectlist[i].title) {
|
|
|
if (tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id) {
|
|
|
tempProjectlist[i].title[g].label_state = true
|
|
|
if (tempProjectlist[i].title[g].name == tempMain_list[j].title) {
|
|
|
tempProjectlist[i].title[g].current = parseInt(g)
|
|
|
sub_index = parseInt(g)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
console.log('fjx')
|
|
|
if (tempRist.length) {
|
|
|
for (let i in tempProjectlist) {
|
|
|
for (let j in tempRist) {
|
|
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
tempProjectlist[i].choose_status = true
|
|
|
tempProjectlist[i].num = tempRist[j].num
|
|
|
for (let g in tempProjectlist[i].title) {
|
|
|
if (tempProjectlist[i].title[g].t_id == tempRist[j].t_id) {
|
|
|
tempProjectlist[i].title[g].label_state = true
|
|
|
if (tempProjectlist[i].title[g].name == tempRist[j].title) {
|
|
|
tempProjectlist[i].title[g].current = parseInt(g)
|
|
|
sub_index = parseInt(g)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
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) {
|
|
|
tempProjectlist[i].choose_status = true
|
|
|
tempProjectlist[i].num = tempMain_list[j].num
|
|
|
for (let g in tempProjectlist[i].title) {
|
|
|
for (let k in tempMain_list[j].title) {
|
|
|
if (tempMain_list[j].title[k].label_state) {
|
|
|
if (tempProjectlist[i].title[g].t_id == tempMain_list[j].title[k].t_id) {
|
|
|
tempProjectlist[i].title[g].label_state = true
|
|
|
tempProjectlist[i].title[g].current = tempMain_list[j].title[k].current
|
|
|
sub_index = tempMain_list[j].title[k].current
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
if (tempRist.length) {
|
|
|
for (let i in tempProjectlist) {
|
|
|
for (let j in tempRist) {
|
|
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
tempProjectlist[i].choose_status = true
|
|
|
tempProjectlist[i].num = tempRist[j].num
|
|
|
for (let g in tempProjectlist[i].title) {
|
|
|
for (let k in tempRist[j].title) {
|
|
|
if (tempRist[j].title[k].label_state) {
|
|
|
if (tempProjectlist[i].title[g].t_id == tempRist[j].title[k].t_id) {
|
|
|
tempProjectlist[i].title[g].label_state = true
|
|
|
tempProjectlist[i].title[g].current = tempRist[j].title[k].current
|
|
|
sub_index = tempRist[j].title[k].current
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
console.log('add')
|
|
|
// if (that.data.temp_state) {
|
|
|
// console.log('edit')
|
|
|
// //edit_state3:代表是刚获取到信息是的结构,还是重新选择之后的数据结构
|
|
|
// if (edit_state3) {
|
|
|
// //获取到的信息结构
|
|
|
// if (type == 'zhuxian') {
|
|
|
// this.setData({
|
|
|
// focus: false
|
|
|
// })
|
|
|
// if (tempMain_list.length > 0) {
|
|
|
// for (let i in tempProjectlist) {
|
|
|
// for (let j in tempMain_list) {
|
|
|
// if (tempProjectlist[i].id == tempMain_list[j].id) {
|
|
|
// tempProjectlist[i].choose_status = true
|
|
|
// tempProjectlist[i].num = tempMain_list[j].num
|
|
|
// for (let g in tempProjectlist[i].title) {
|
|
|
// if (tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id) {
|
|
|
// tempProjectlist[i].title[g].label_state = true
|
|
|
// if (tempProjectlist[i].title[g].name == tempMain_list[j].title) {
|
|
|
// tempProjectlist[i].title[g].current = parseInt(g)
|
|
|
// sub_index = parseInt(g)
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// } else {
|
|
|
// console.log('fjx')
|
|
|
// if (tempRist.length) {
|
|
|
// for (let i in tempProjectlist) {
|
|
|
// for (let j in tempRist) {
|
|
|
// if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
// console.log(tempRist[j])
|
|
|
// console.log(tempProjectlist[i])
|
|
|
// tempProjectlist[i].choose_status = true
|
|
|
// tempProjectlist[i].num = tempRist[j].num
|
|
|
// for (let g in tempProjectlist[i].title) {
|
|
|
// if (tempProjectlist[i].title[g].t_id == tempRist[j].t_id) {
|
|
|
// tempProjectlist[i].title[g].label_state = true
|
|
|
// if (tempProjectlist[i].title[g].name == tempRist[j].title) {
|
|
|
// tempProjectlist[i].title[g].current = parseInt(g)
|
|
|
// sub_index = parseInt(g)
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// } else {
|
|
|
// 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) {
|
|
|
// tempProjectlist[i].choose_status = true
|
|
|
// tempProjectlist[i].num = tempMain_list[j].num
|
|
|
// for (let g in tempProjectlist[i].title) {
|
|
|
// for (let k in tempMain_list[j].title) {
|
|
|
// if (tempMain_list[j].title[k].label_state) {
|
|
|
// if (tempProjectlist[i].title[g].t_id == tempMain_list[j].title[k].t_id) {
|
|
|
// tempProjectlist[i].title[g].label_state = true
|
|
|
// tempProjectlist[i].title[g].current = tempMain_list[j].title[k].current
|
|
|
// sub_index = tempMain_list[j].title[k].current
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// } else {
|
|
|
// if (tempRist.length) {
|
|
|
// for (let i in tempProjectlist) {
|
|
|
// for (let j in tempRist) {
|
|
|
// if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
// tempProjectlist[i].choose_status = true
|
|
|
// tempProjectlist[i].num = tempRist[j].num
|
|
|
// for (let g in tempProjectlist[i].title) {
|
|
|
// for (let k in tempRist[j].title) {
|
|
|
// if (tempRist[j].title[k].label_state) {
|
|
|
// if (tempProjectlist[i].title[g].t_id == tempRist[j].title[k].t_id) {
|
|
|
// tempProjectlist[i].title[g].label_state = true
|
|
|
// tempProjectlist[i].title[g].current = tempRist[j].title[k].current
|
|
|
// sub_index = tempRist[j].title[k].current
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// } else {
|
|
|
// console.log('add')
|
|
|
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) {
|
|
|
console.log(tempProjectlist[i])
|
|
|
console.log(tempMain_list[j].id)
|
|
|
tempProjectlist[i].choose_status = true
|
|
|
tempProjectlist[i].num = tempMain_list[j].num
|
|
|
for (let g in tempProjectlist[i].title) {
|
...
|
...
|
@@ -352,31 +359,34 @@ Page({ |
|
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
tempProjectlist[i].choose_status = true
|
|
|
tempProjectlist[i].num = tempRist[j].num
|
|
|
console.log(tempProjectlist[i])
|
|
|
console.log(tempRist[j])
|
|
|
for (let g in tempProjectlist[i].title) {
|
|
|
for (let k in tempRist[j].title) {
|
|
|
if (tempRist[j].title[k].label_state) {
|
|
|
if (tempProjectlist[i].title[g].t_id == tempRist[j].title[k].t_id) {
|
|
|
// for (let k in tempRist[j].title) {
|
|
|
// if (tempRist[j].title[k].label_state) {
|
|
|
if (tempProjectlist[i].title[g].t_id == tempRist[j].t_id) {
|
|
|
tempProjectlist[i].title[g].label_state = true
|
|
|
tempProjectlist[i].title[g].current = tempRist[j].title[k].current
|
|
|
sub_index = tempRist[j].title[k].current
|
|
|
// tempProjectlist[i].title[g].current = tempRist[j].title[k].current
|
|
|
// sub_index = tempRist[j].title[k].current
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '选择保障项目',
|
|
|
})
|
|
|
console.log(tempProjectlist)
|
|
|
this.setData({
|
|
|
popup_state: true,
|
|
|
addType: type,
|
|
|
xulie: index,
|
|
|
projectlist: tempProjectlist,
|
|
|
showProjectlist: tempProjectlist,
|
|
|
sub_index: sub_index
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -398,7 +408,8 @@ Page({ |
|
|
// projectlist[i].title[0].label_state = true
|
|
|
}
|
|
|
this.setData({
|
|
|
projectlist: res.data.data.def
|
|
|
projectlist: res.data.data.def,
|
|
|
showProjectlist: res.data.data.def
|
|
|
})
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -409,7 +420,7 @@ Page({ |
|
|
var main_risk = this.data.main_risk
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var sindex = e.currentTarget.dataset.sindex;
|
|
|
var projectlist = this.data.projectlist;
|
|
|
var projectlist = JSON.parse(JSON.stringify(this.data.showProjectlist));
|
|
|
var title = projectlist[index].title
|
|
|
for (var i = 0; i < title.length; i++) {
|
|
|
title[i].current = ''
|
...
|
...
|
@@ -422,7 +433,7 @@ Page({ |
|
|
projectlist[index].title[sindex].label_state = true
|
|
|
}
|
|
|
this.setData({
|
|
|
projectlist: projectlist,
|
|
|
showProjectlist: projectlist,
|
|
|
sub_index: sindex
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -430,23 +441,23 @@ Page({ |
|
|
//保障项目金额
|
|
|
popupNum(e) {
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var projectlist = this.data.projectlist;
|
|
|
var projectlist = JSON.parse(JSON.stringify(this.data.showProjectlist))
|
|
|
if (projectlist[index].choose_status) {
|
|
|
projectlist[index].num = e.detail.value
|
|
|
}
|
|
|
this.setData({
|
|
|
projectlist: projectlist
|
|
|
showProjectlist: projectlist
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择保障项目
|
|
|
popupState(e) {
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var projectlist = this.data.projectlist;
|
|
|
var projectlist = JSON.parse(JSON.stringify(this.data.showProjectlist))
|
|
|
projectlist[index].choose_status = !projectlist[index].choose_status;
|
|
|
|
|
|
this.setData({
|
|
|
projectlist: projectlist,
|
|
|
showProjectlist: projectlist,
|
|
|
})
|
|
|
if (this.data.inforid != 0) {
|
|
|
edit_state: false;
|
...
|
...
|
@@ -456,15 +467,15 @@ Page({ |
|
|
|
|
|
//确认选择的推荐方案
|
|
|
confirmCase() {
|
|
|
if (this.data.type == 'fujiaxian') {
|
|
|
this.setData({
|
|
|
edit_state2: false
|
|
|
})
|
|
|
} else {
|
|
|
this.setData({
|
|
|
edit_state: false
|
|
|
})
|
|
|
}
|
|
|
// if (this.data.type == 'fujiaxian') {
|
|
|
// this.setData({
|
|
|
// edit_state2: false
|
|
|
// })
|
|
|
// } else {
|
|
|
// this.setData({
|
|
|
// edit_state: false
|
|
|
// })
|
|
|
// }
|
|
|
|
|
|
|
|
|
let index = this.data.xulie;
|
...
|
...
|
@@ -472,7 +483,7 @@ Page({ |
|
|
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])
|
...
|
...
|
@@ -591,15 +602,15 @@ Page({ |
|
|
//选择受益人姓名
|
|
|
beneficiarySelect(e) {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: true,
|
|
|
edit_state2: true
|
|
|
})
|
|
|
// this.setData({
|
|
|
// edit_state: true,
|
|
|
// edit_state2: true
|
|
|
// })
|
|
|
}
|
|
|
var index = e.currentTarget.dataset.mindex
|
|
|
var beneficiary_list = Object.assign(this.data.beneficiary_list, {});
|
|
|
var beneficiary_list = Object.assign({}, this.data.projectlist)
|
|
|
// 获取当前已选择的收益人
|
|
|
let tempBenefice = Object.assign(this.data.beneficiaryList, {})
|
|
|
let tempBenefice = Object.assign({}, this.data.projectlist)
|
|
|
// 当前选择的收益人
|
|
|
// let nowPerson = beneficiary_list[index].name_array[e.detail.value];
|
|
|
// let nowPerson = beneficiary_list[index].beneficiary_name
|
...
|
...
|
@@ -750,8 +761,8 @@ 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 tempbenefict = Object.assign({},this.data.beneficiary_list);
|
|
|
let beneficiaryList = Object.assign({},this.data.beneficiaryList);
|
|
|
// 获取当前选项的受益人
|
|
|
// let person = tempbenefict[index].beneficiary_name;
|
|
|
let person = tempbenefict[index].name;
|
...
|
...
|
@@ -767,12 +778,12 @@ Page({ |
|
|
//添加附加险
|
|
|
addRisk() {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false,
|
|
|
edit_state2: false
|
|
|
})
|
|
|
// this.setData({
|
|
|
// edit_state: false,
|
|
|
// edit_state2: false
|
|
|
// })
|
|
|
}
|
|
|
var risk_list = Object.assign(this.data.risk_list, {});
|
|
|
var risk_list = Object.assign({},this.data.risk_list);
|
|
|
var len = risk_list.length
|
|
|
risk_list[len] = {
|
|
|
name: '',
|
...
|
...
|
@@ -789,7 +800,7 @@ Page({ |
|
|
//删除附加险
|
|
|
deleteRisk(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
let risk_list = Object.assign({},this.data.risk_list);
|
|
|
risk_list.splice(index, 1);
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
...
|
...
|
@@ -902,10 +913,10 @@ Page({ |
|
|
//保障期
|
|
|
warrantyTwo(e) {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false,
|
|
|
edit_state2: false
|
|
|
})
|
|
|
// this.setData({
|
|
|
// edit_state: false,
|
|
|
// edit_state2: false
|
|
|
// })
|
|
|
}
|
|
|
var guarantee_name = e.detail.value
|
|
|
var warranty_two = this.data.warranty_two
|
...
|
...
|
@@ -1000,10 +1011,10 @@ Page({ |
|
|
//缴费时长
|
|
|
burningTime(e) {
|
|
|
if (this.data.inforid != 0) {
|
|
|
this.setData({
|
|
|
edit_state: false,
|
|
|
edit_state2: false,
|
|
|
})
|
|
|
// this.setData({
|
|
|
// edit_state: false,
|
|
|
// edit_state2: false,
|
|
|
// })
|
|
|
}
|
|
|
var time_name = e.detail.value
|
|
|
var long_money = this.data.long_money
|
...
|
...
|
@@ -1107,7 +1118,7 @@ Page({ |
|
|
selectUnit4(e) {
|
|
|
var unit = e.currentTarget.dataset.unit;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
let risk_list = Object.assign({},this.data.risk_list);
|
|
|
risk_list[index].title = unit
|
|
|
if (risk_list[index].title == '终身') {
|
|
|
risk_list[index].num = ''
|
...
|
...
|
@@ -1269,9 +1280,9 @@ Page({ |
|
|
bank_num: res.data.data.def.bank_num,
|
|
|
risk_list: res.data.data.def.more,
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
edit_state: true,
|
|
|
edit_state2: true,
|
|
|
edit_state3: true,
|
|
|
// edit_state: true,
|
|
|
// edit_state2: true,
|
|
|
// edit_state3: true,
|
|
|
temp_state: true
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -1501,7 +1512,7 @@ Page({ |
|
|
}
|
|
|
|
|
|
var risk_list = res.data.data.def.more
|
|
|
var projectlist = this.data.projectlist
|
|
|
var projectlist = Object.assign({},this.data.projectlist)
|
|
|
|
|
|
for (var i = 0; i < risk_list.length; i++) {
|
|
|
for (var j = 0; j < projectlist.length; j++) {
|
...
|
...
|
@@ -1545,9 +1556,9 @@ Page({ |
|
|
bank_num: res.data.data.def.bank_num,
|
|
|
risk_list: risk_list,
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
edit_state: true,
|
|
|
edit_state2: true,
|
|
|
edit_state3: true,
|
|
|
// edit_state: true,
|
|
|
// edit_state2: true,
|
|
|
// edit_state3: true,
|
|
|
temp_state: true,
|
|
|
guarantee_name: guarantee_name,
|
|
|
time_name: time_name,
|
...
|
...
|
@@ -1564,8 +1575,8 @@ Page({ |
|
|
let that = this;
|
|
|
options.inforid ? (that.getlistVerify(options.inforid), that.setData({
|
|
|
inforid: options.inforid,
|
|
|
edit_state: true,
|
|
|
edit_state2: true,
|
|
|
// edit_state: true,
|
|
|
// edit_state2: true,
|
|
|
}), wx.setNavigationBarTitle({
|
|
|
title: '编辑保单',
|
|
|
})) : ""
|
...
|
...
|
|