...
|
...
|
@@ -32,12 +32,12 @@ Page({ |
|
|
applicant_name: '',
|
|
|
recognizee_name: '',
|
|
|
rang_beneficiary: [],
|
|
|
|
|
|
risk_list:[{
|
|
|
name:'',
|
|
|
projectlist:[{}],
|
|
|
projectlist:[],
|
|
|
project_time:''
|
|
|
}],
|
|
|
main_array:[]
|
|
|
|
|
|
},
|
|
|
|
...
|
...
|
@@ -81,12 +81,47 @@ Page({ |
|
|
},
|
|
|
|
|
|
//保障项目弹窗
|
|
|
ensureProject() {
|
|
|
ensureProject(e) {
|
|
|
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;
|
|
|
// 已经添加的主险
|
|
|
let tempMain_list = Object.assign(this.data.main_array, {})
|
|
|
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] = tempMain_list[j]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
if (tempRist.length){
|
|
|
for (let i in tempProjectlist) {
|
|
|
for (let j in tempRist){
|
|
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
tempProjectlist[i] = tempRist[j]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '选择保障项目',
|
|
|
})
|
|
|
this.setData({
|
|
|
popup_state: true
|
|
|
popup_state: true,
|
|
|
addType: type,
|
|
|
xulie: index,
|
|
|
projectlist: tempProjectlist
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -135,12 +170,12 @@ Page({ |
|
|
|
|
|
//保障项目金额
|
|
|
popupNum(e) {
|
|
|
var main_risk = this.data.main_risk
|
|
|
// 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
|
|
|
// main_risk[index].num = projectlist[index].num
|
|
|
}
|
|
|
console.log(main_risk)
|
|
|
this.setData({
|
...
|
...
|
@@ -152,16 +187,8 @@ Page({ |
|
|
popupState(e) {
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var projectlist = this.data.projectlist;
|
|
|
var checkstate = projectlist[index].choose_status;
|
|
|
var selectitem = [];
|
|
|
var length = this.data.projectlist.length
|
|
|
var main_risk = this.data.main_risk
|
|
|
var popup_state = this.data.popup_state
|
|
|
if (checkstate == false) {
|
|
|
projectlist[index].choose_status = true
|
|
|
} else {
|
|
|
projectlist[index].choose_status = false
|
|
|
}
|
|
|
projectlist[index].choose_status = !projectlist[index].choose_status;
|
|
|
console.log(projectlist)
|
|
|
this.setData({
|
|
|
projectlist: projectlist
|
|
|
})
|
...
|
...
|
@@ -169,41 +196,51 @@ Page({ |
|
|
|
|
|
//确认选择的推荐方案
|
|
|
confirmCase() {
|
|
|
let index = this.data.xulie;
|
|
|
let type = this.data.addType;
|
|
|
var that = this
|
|
|
var main_array = []
|
|
|
let dindex = wx.getStorageSync('dindex')
|
|
|
var projectlist = this.data.projectlist
|
|
|
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].label_state) {
|
|
|
main_array.push(projectlist[i])
|
|
|
}
|
|
|
}
|
|
|
console.log(main_array)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (main_array != '') {
|
|
|
wx.showToast({
|
|
|
title: '添加成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
var temp = main_array
|
|
|
for (var i = 0; i < main_array.length; i++) {
|
|
|
for (var j = 0; j < main_array[i].title.length; j++) {
|
|
|
if (main_array[i].title[j].label_state) {
|
|
|
main_array[i].title = main_array[i].title[j].name
|
|
|
}
|
|
|
console.log(main_array)
|
|
|
}
|
|
|
}
|
|
|
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
|
|
|
main_array: 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++) {
|
|
|
// if (main_array[i].title[j].label_state) {
|
|
|
// main_array[i].title = main_array[i].title[j].name
|
|
|
// }
|
|
|
// console.log(main_array)
|
|
|
// }
|
|
|
// }
|
|
|
// that.setData({
|
|
|
// main_array: main_array
|
|
|
// })
|
|
|
}
|
|
|
setTimeout(function() {
|
|
|
that.ensureProjectList()
|
|
|
that.setData({
|
|
|
popup_state: false,
|
|
|
popup_state: false
|
|
|
})
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: '添加保单',
|
...
|
...
|
@@ -272,11 +309,11 @@ Page({ |
|
|
|
|
|
//添加附加险
|
|
|
addRisk(){
|
|
|
var risk_list=this.data.risk_list
|
|
|
var risk_list = Object.assign(this.data.risk_list,{});
|
|
|
var len=risk_list.length
|
|
|
risk_list[len] = {
|
|
|
name: '',
|
|
|
projectlist: [{}],
|
|
|
projectlist: [],
|
|
|
project_time: ''
|
|
|
}
|
|
|
this.setData({
|
...
|
...
|
|