作者 朱振飞

保险新增修改接口

... ... @@ -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,58 +187,60 @@ 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
})
})
},
//确认选择的推荐方案
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])
}
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,
})
}
that.setData({
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({
... ...
... ... @@ -130,14 +130,13 @@
</view>
<view class='protec_item_box'>
<view>
<view class='protec_item' wx:for='{{main_array}}' wx:key='' if='{{item.choose_status}}'>
<view class='protec_item' wx:for='{{main_array}}' wx:key=''>
<view>{{item.name}}</view>
<view class='protec_num'>{{item.num}}{{item.title}}
</view>
<view class='protec_num'>{{item.num}}<block wx:for='{{item.title}}' wx:for-item='danwei' wx:key=''><text wx:if="{{danwei.label_state}}">{{danwei.name}}</text></block></view>
</view>
</view>
<view class='protec_bottom_box'>
<view class='add_risk_btn protec_btn' bindtap='ensureProject'>
<view class='add_risk_btn protec_btn' bindtap='ensureProject' data-type='zhuxian' data-xulie='0'>
<text class='iconfont icon-shezhi'></text>
<text>管理保障项目</text>
</view>
... ... @@ -291,21 +290,21 @@
</view>
<view class='protec_item_box'>
<view>
<view class='protec_item'>
<view>轻症重大疾病</view>
<view class='protec_num'>50万</view>
<view class='protec_item' wx:for='{{item.projectlist}}' wx:for-item='project' wx:key=''>
<view>{{project.name}}</view>
<view class='protec_num'>{{project.num}}<block wx:for='{{project.title}}' wx:for-item='danwei' wx:key=''><text wx:if="{{danwei.label_state}}">{{danwei.name}}</text></block></view>
</view>
<view class='protec_item'>
<!-- <view class='protec_item'>
<view>轻症重大疾病</view>
<view class='protec_num'>50万</view>
</view>
<view class='protec_item'>
<view>轻症重大疾病</view>
<view class='protec_num'>50万</view>
</view>
</view> -->
</view>
<view class='protec_bottom_box'>
<view class='add_risk_btn protec_btn' bindtap='ensureProject'>
<view class='add_risk_btn protec_btn' bindtap='ensureProject' data-type='fujiaxian' data-xulie='{{index}}'>
<text class='iconfont icon-shezhi'></text>
<text>管理保障项目</text>
</view>
... ...
... ... @@ -36,13 +36,18 @@
"list": []
},
"miniprogram": {
"current": -1,
"current": 1,
"list": [
{
"id": -1,
"name": "list",
"pathName": "pages/index/addListDetail/addListDetail",
"query": ""
},
{
"id": -1,
"name": "保单添加",
"pathName": "pages/index/addListDetail/addListDetail"
}
]
}
... ...