作者 LXY

保险二开

@@ -54,7 +54,9 @@ page { @@ -54,7 +54,9 @@ page {
54 font-size: 30rpx; 54 font-size: 30rpx;
55 color: #000; 55 color: #000;
56 } 56 }
57 - 57 +.list_input textarea{
  58 + height: 120rpx;
  59 +}
58 .list_input input { 60 .list_input input {
59 border: 0; 61 border: 0;
60 outline: none; 62 outline: none;
@@ -226,7 +228,8 @@ page { @@ -226,7 +228,8 @@ page {
226 background: none; 228 background: none;
227 border: 1rpx solid #0286ff; 229 border: 1rpx solid #0286ff;
228 color: #0286ff; 230 color: #0286ff;
229 - font-size: 32rpx; 231 + font-size: 34rpx;
  232 + font-weight: bold;
230 border-radius: 40rpx; 233 border-radius: 40rpx;
231 display: flex; 234 display: flex;
232 align-items: center; 235 align-items: center;
1 // pages/addListDetail/addListDetail.js 1 // pages/addListDetail/addListDetail.js
2 const app = getApp() 2 const app = getApp()
3 Page({ 3 Page({
4 - /**  
5 - * 页面的初始数据  
6 - */  
7 - data: {  
8 - recognizee: ['被保人', '被保人2'],  
9 - recognizee_index: 0,  
10 - period_time: ['10年', '20年'],  
11 - period_index: -1,  
12 - compact_time: '',  
13 - impletion_time: '',  
14 - popup_state: false,  
15 - projectlist: [],  
16 - label_state: false,  
17 - insure: ['投保人', '投保人2'],  
18 - insureindex: -1,  
19 - beneficiary_list: [{  
20 - name_array: ['受益人1', '受益人2'],  
21 - unit: ''  
22 - }],  
23 - beneficiaryindex: -1,  
24 - tempfavoree: [], // 已选择的受益人  
25 - beneficiaryList: [],  
26 - name: '', //受益人的名字,  
27 - beneficiary_name: '',  
28 - imgs: [],  
29 - main_risk: [],  
30 - unit: '',  
31 - unit2: '',  
32 - unit3: '',  
33 - unit4: '',  
34 - applicant_name: '',  
35 - recognizee_name: '',  
36 - rang_beneficiary: [],  
37 - risk_list: [{  
38 - name: '',  
39 - mo: [],  
40 - project_time: '',  
41 - title: '',  
42 - num: ''  
43 - }],  
44 - main_array: [],  
45 - warranty_one: '',  
46 - warranty_two: {},  
47 - guarantee_name: '',  
48 - long_money: {},  
49 - time_name: '',  
50 - type_money: '',  
51 - more: [],  
52 - guarantee: [],  
53 - InfoId: 0,  
54 - def_id: '',  
55 - edit_state: false,  
56 - risk_listitm: '',  
57 - storge_state: false,  
58 - warranty_info:'请输入',  
59 - warranty_state:false  
60 - }, 4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + recognizee: ['被保人', '被保人2'],
  9 + recognizee_index: 0,
  10 + period_time: ['10年', '20年'],
  11 + period_index: -1,
  12 + compact_time: '',
  13 + impletion_time: '',
  14 + popup_state: false,
  15 + projectlist: [],
  16 + label_state: false,
  17 + insure: ['投保人', '投保人2'],
  18 + insureindex: -1,
  19 + beneficiary_list: [{
  20 + name_array: ['受益人1', '受益人2'],
  21 + unit: ''
  22 + }],
  23 + beneficiaryindex: -1,
  24 + tempfavoree: [], // 已选择的受益人
  25 + beneficiaryList: [],
  26 + name: '', //受益人的名字,
  27 + beneficiary_name: '',
  28 + imgs: [],
  29 + main_risk: [],
  30 + unit: '',
  31 + unit2: '',
  32 + unit3: '',
  33 + unit4: '',
  34 + applicant_name: '',
  35 + recognizee_name: '',
  36 + rang_beneficiary: [],
  37 + risk_list: [{
  38 + name: '',
  39 + mo: [],
  40 + project_time: '',
  41 + title: '',
  42 + num: ''
  43 + }],
  44 + main_array: [],
  45 + warranty_one: '',
  46 + warranty_two: {},
  47 + guarantee_name: '',
  48 + long_money: {},
  49 + time_name: '',
  50 + type_money: '',
  51 + more: [],
  52 + guarantee: [],
  53 + InfoId: 0,
  54 + def_id: '',
  55 + edit_state: false,
  56 + risk_listitm: '',
  57 + storge_state: false,
  58 + warranty_info: '请输入',
  59 + warranty_state: false,
  60 + warranty_info1: '请输入',
  61 + warranty_state1: false,
  62 + coverage:'',
  63 + },
  64 +
  65 + //保单号
  66 + policyNum(e) {
  67 + this.setData({
  68 + in_num: e.detail.value,
  69 + })
  70 + },
  71 +
  72 + //保单号
  73 + setFirm(e) {
  74 + this.setData({
  75 + firm: e.detail.value,
  76 + })
  77 + },
  78 +
  79 + //投保人
  80 + insureSelect(e) {
  81 + var insure = this.data.insure
  82 + this.setData({
  83 + insureindex: e.detail.value,
  84 + applicant_name: insure[e.detail.value],
  85 + })
  86 + },
  87 +
  88 + //选择被保险人
  89 + recognizeeSelect(e) {
  90 + var recognizee = this.data.recognizee
  91 + this.setData({
  92 + recognizeeindex: e.detail.value,
  93 + recognizee_name: recognizee[e.detail.value]
  94 + })
  95 + },
  96 +
  97 + //主险名称
  98 + setRiskName(e) {
  99 + // console.log(e)
  100 + this.setData({
  101 + main_risks: e.detail.value,
  102 + })
  103 + // console.log(this.data.main_risks)
  104 + },
  105 +
  106 + //主险名称
  107 + setRiskMoney(e) {
  108 + // console.log(e)
  109 + this.setData({
  110 + coverage: e.detail.value,
  111 + })
  112 + // console.log(this.data.main_risks)
  113 + },
  114 +
  115 +
  116 + //保费
  117 + yearMoney(e) {
  118 + this.setData({
  119 + year_money: e.detail.value,
  120 + })
  121 + },
  122 +
  123 + //设置银行
  124 + setBank(e) {
  125 + this.setData({
  126 + bank: e.detail.value,
  127 + })
  128 + },
  129 +
  130 + //设置账号
  131 + setBankNum(e) {
  132 + this.setData({
  133 + bank_num: e.detail.value,
  134 + })
  135 + },
  136 +
  137 + //合同生效日
  138 + compactTime(e) {
  139 + this.setData({
  140 + compact_time: e.detail.value,
  141 + })
  142 + this.countImpletionTime()
  143 + this.countImpletionTime2()
  144 + },
  145 +
  146 + //缴费期满日
  147 + impletionTime(e) {
  148 + this.setData({
  149 + impletion_time: e.detail.value,
  150 + })
  151 + },
  152 +
  153 + //主险保障期
  154 + periodTime(e) {
  155 + this.setData({
  156 + period_index: e.detail.value,
  157 + })
  158 + },
  159 +
  160 + //保障项目弹窗
  161 + ensureProject(e) {
  162 + this.setData({
  163 + edit_state: false
  164 + })
  165 +
  166 + let that = this;
  167 + let type = e.currentTarget.dataset.type;
  168 + let index = e.currentTarget.dataset.xulie;
  169 + let tempProjectlist = Object.assign(this.data.projectlist, {});
  170 + // 已经添加的附加险
  171 + let risk_list = Object.assign(this.data.risk_list, {});
  172 + console.log(risk_list)
  173 + let tempRist = risk_list[index].mo;
  174 + console.log(tempRist)
  175 + // 已经添加的主险
  176 + let tempMain_list = Object.assign(this.data.main_array, {})
  177 + if (type == 'zhuxian') {
  178 + if (tempMain_list.length > 0) {
  179 + for (let i in tempProjectlist) {
  180 + for (let j in tempMain_list) {
  181 + if (tempProjectlist[i].id == tempMain_list[j].id) {
  182 + tempProjectlist[i].choose_status = true
  183 + for (let g in tempProjectlist[i].title) {
  184 + tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''
61 185
62 - //保单号  
63 - policyNum(e) { 186 + }
  187 + }
  188 + }
  189 + }
  190 + }
  191 + } else {
  192 + if (tempRist.length) {
  193 + for (let i in tempProjectlist) {
  194 + for (let j in tempRist) {
  195 + if (tempProjectlist[i].id == tempRist[j].id) {
  196 + tempProjectlist[i].choose_status = true
  197 + for (let g in tempProjectlist[i].title) {
  198 + console.log(tempProjectlist[i].title[g])
  199 + tempProjectlist[i].title[g].t_id == tempRist[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''
  200 + }
  201 + }
  202 + }
  203 + }
  204 + }
  205 + }
  206 +
  207 + wx.setNavigationBarTitle({
  208 + title: '选择保障项目',
  209 + })
  210 +
  211 + this.setData({
  212 + popup_state: true,
  213 + addType: type,
  214 + xulie: index,
  215 + projectlist: tempProjectlist
  216 + })
  217 + },
  218 +
  219 + // 调取保障项目接口
  220 + ensureProjectList() {
  221 + var main_risk = this.data.main_risk
  222 + let url = 'counselor/sageguard'
  223 + let params = {}
  224 + app.post(url, params).then((res) => {
  225 + if (res.data.code == 200) {
  226 + var projectlist = res.data.data.def;
  227 + for (var i = 0; i < projectlist.length; i++) {
  228 + projectlist[i].choose_status = false
  229 + for (var j = 0; j < projectlist[i].title.length; j++) {
  230 + projectlist[i].title[j].label_state = false
  231 + }
  232 + projectlist[i].title[0].current = 0
  233 + projectlist[i].title[0].label_state = true
  234 + }
64 this.setData({ 235 this.setData({
65 - in_num: e.detail.value, 236 + projectlist: res.data.data.def
66 }) 237 })
67 - },  
68 -  
69 - //保单号  
70 - setFirm(e) {  
71 - this.setData({  
72 - firm: e.detail.value, 238 + // console.log(this.data.projectlist)
  239 + }
  240 + })
  241 + },
  242 +
  243 + //保障项目单位
  244 + getUnit(e) {
  245 + var main_risk = this.data.main_risk
  246 + var index = e.currentTarget.dataset.index;
  247 + var sindex = e.currentTarget.dataset.sindex;
  248 + var projectlist = this.data.projectlist;
  249 + var title = projectlist[index].title
  250 + for (var i = 0; i < title.length; i++) {
  251 + title[i].current = ''
  252 + if (title[i].current == '') {
  253 + title[i].label_state = false
  254 + }
  255 + }
  256 + projectlist[index].title[sindex].current = sindex
  257 + if (projectlist[index].title[sindex].current == sindex) {
  258 + projectlist[index].title[sindex].label_state = true
  259 + }
  260 + this.setData({
  261 + projectlist: projectlist,
  262 + })
  263 + },
  264 +
  265 + //保障项目金额
  266 + popupNum(e) {
  267 + var index = e.currentTarget.dataset.index;
  268 + var projectlist = this.data.projectlist;
  269 + if (projectlist[index].choose_status) {
  270 + projectlist[index].num = e.detail.value
  271 + }
  272 + this.setData({
  273 + projectlist: projectlist
  274 + })
  275 + },
  276 +
  277 + //选择保障项目
  278 + popupState(e) {
  279 + var index = e.currentTarget.dataset.index;
  280 + var projectlist = this.data.projectlist;
  281 + projectlist[index].choose_status = !projectlist[index].choose_status;
  282 + // console.log(projectlist)
  283 + this.setData({
  284 + projectlist: projectlist,
  285 + })
  286 + if (this.data.inforid != 0) {
  287 + edit_state: false
  288 + }
  289 + },
  290 +
  291 + //确认选择的推荐方案
  292 + confirmCase() {
  293 + let index = this.data.xulie;
  294 + let type = this.data.addType;
  295 + var that = this
  296 + var main_array = []
  297 +
  298 + var projectlist = Object.assign(this.data.projectlist, {})
  299 + for (var i = 0; i < projectlist.length; i++) {
  300 + if (projectlist[i].choose_status) {
  301 + main_array.push(projectlist[i])
  302 + console.log(main_array)
  303 + }
  304 + }
  305 +
  306 + if (main_array != '') {
  307 + wx.showToast({
  308 + title: '添加成功',
  309 + icon: 'none'
  310 + })
  311 +
  312 + if (type == 'fujiaxian') {
  313 + let tempRist = that.data.risk_list;
  314 + console.log(tempRist)
  315 + tempRist[index]['mo'] = main_array;
  316 + that.setData({
  317 + risk_list: tempRist,
  318 + risk_listitm: tempRist
73 }) 319 })
74 - },  
75 -  
76 - //投保人  
77 - insureSelect(e) {  
78 - var insure = this.data.insure  
79 - this.setData({  
80 - insureindex: e.detail.value,  
81 - applicant_name: insure[e.detail.value], 320 + console.log(this.data.risk_list)
  321 + } else {
  322 + that.setData({
  323 + main_array: main_array,
82 }) 324 })
83 - },  
84 -  
85 - //选择被保险人  
86 - recognizeeSelect(e) {  
87 - var recognizee = this.data.recognizee  
88 - this.setData({  
89 - recognizeeindex: e.detail.value,  
90 - recognizee_name: recognizee[e.detail.value] 325 + }
  326 + console.log(this.data.main_array)
  327 + }
  328 + setTimeout(function() {
  329 + that.ensureProjectList()
  330 + that.setData({
  331 + popup_state: false
  332 + })
  333 + wx.setNavigationBarTitle({
  334 + title: '添加保单',
  335 + })
  336 + }, 800)
  337 +
  338 +
  339 + console.log(this.data.risk_list)
  340 + },
  341 +
  342 + //重组主险的保障项目
  343 + tempMain() {
  344 + var main_array = this.data.main_array
  345 + var warranty_one1 = []
  346 + // console.log(main_array)
  347 + for (var i = 0; i < main_array.length; i++) {
  348 + var temp = {}
  349 + for (var j = 0; j < main_array[i].title.length; j++) {
  350 + if (main_array[i].choose_status) {
  351 + if (main_array[i].title[j].label_state) {
  352 + temp.id = main_array[i].id
  353 + temp.name = main_array[i].name
  354 + temp.num = main_array[i].num
  355 + temp.title = main_array[i].title[j].name
  356 + temp.t_id = main_array[i].title[j].t_id
  357 + }
  358 + }
  359 + }
  360 + warranty_one1.push(temp)
  361 + this.setData({
  362 + guarantee: warranty_one1
  363 + })
  364 + }
  365 +
  366 + },
  367 +
  368 + //主险名称
  369 + addRiskName(e) {
  370 + var risk_list = this.data.risk_list
  371 + var index = e.currentTarget.dataset.index
  372 + risk_list[index].name = e.detail.value
  373 + this.setData({
  374 + risk_list: risk_list
  375 + })
  376 + },
  377 +
  378 + //主险保障其
  379 + addRiskUnit(e) {
  380 + var risk_list = this.data.risk_list
  381 + var index = e.currentTarget.dataset.index
  382 + risk_list[index].num = e.detail.value
  383 + this.setData({
  384 + risk_list: risk_list
  385 + })
  386 + },
  387 +
  388 + //重组附加险整体数据结构
  389 + tempAddRisk() {
  390 + var risk_list = this.data.risk_list
  391 +
  392 + var sub_array = []
  393 + var temp_risk = this.data.risk_listitm;
  394 + var temp = this.data.risk_listitm;
  395 +
  396 + for (var i = 0; i < temp.length; i++) {
  397 + for (var j = 0; j < temp[i].mo.length; j++) {
  398 + for (var k = 0; k < temp[i].mo[j].title.length; k++) {
  399 + if (temp[i].name != '') {
  400 + // var temp = {}
  401 + // var subtemp = {}
  402 + if (temp[i].mo[j].choose_status) {
  403 + if (temp[i].mo[j].title[k].label_state) {
  404 + temp_risk[i].name = temp[i].name
  405 + temp_risk[i].num = temp[i].num
  406 + temp_risk[i].title = temp[i].title
  407 + temp_risk[i].mo[j].t_id = temp[i].mo[j].title[k].t_id
  408 + temp_risk[i].mo[j].id = temp[i].mo[j].id
  409 + temp_risk[i].mo[j].name = temp[i].mo[j].name
  410 + temp_risk[i].mo[j].num = temp[i].mo[j].num
  411 + temp_risk[i].mo[j].title = temp[i].mo[j].title[k].name
  412 + console.log(temp_risk)
  413 + }
  414 + }
  415 + }
  416 + }
  417 + }
  418 +
  419 + this.setData({
  420 + more: temp_risk
  421 + })
  422 + }
  423 +
  424 + },
  425 +
  426 + //选择受益人姓名
  427 + beneficiarySelect(e) {
  428 + if (this.data.inforid != 0) {
  429 + this.setData({
  430 + edit_state: false
  431 + })
  432 + }
  433 + var index = e.currentTarget.dataset.mindex
  434 + var beneficiary_list = Object.assign(this.data.beneficiary_list, {});
  435 + // 获取当前已选择的收益人
  436 + let tempBenefice = Object.assign(this.data.beneficiaryList, {})
  437 + // 当前选择的收益人
  438 + let nowPerson = beneficiary_list[index].name_array[e.detail.value];
  439 + // 判断受益人是否已经添加
  440 + const add = tempBenefice.every((tempBenefice) => {
  441 + return tempBenefice != nowPerson
  442 + })
  443 + if (add) {
  444 + beneficiary_list[index].beneficiary_name = nowPerson;
  445 + tempBenefice.push(nowPerson)
  446 + } else {
  447 + wx.showToast({
  448 + title: '请不要重复添加受益人',
  449 + icon: 'none'
  450 + })
  451 + }
  452 +
  453 + this.setData({
  454 + beneficiary_list: beneficiary_list,
  455 + beneficiaryList: tempBenefice
  456 + })
  457 +
  458 + },
  459 +
  460 + //添加收益比例
  461 + addUnit(e) {
  462 + var beneficiary_list = this.data.beneficiary_list;
  463 + beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;
  464 + this.setData({
  465 + beneficiary_list: beneficiary_list,
  466 + })
  467 + },
  468 +
  469 + //添加受益人
  470 + addPersons(e) {
  471 + var list = this.data.beneficiary_list;
  472 + var len = list.length
  473 + if (list[len - 1].beneficiary_name == undefined) {
  474 + wx.showToast({
  475 + title: '请选择受益人',
  476 + icon: 'none'
  477 + })
  478 + } else if (list[len - 1].unit == '') {
  479 + console.log('unit')
  480 + wx.showToast({
  481 + title: '请输入收益比',
  482 + icon: 'none'
  483 + })
  484 + } else {
  485 + list[len] = {
  486 + name_array: this.data.insure,
  487 + unit: ''
  488 + }
  489 + }
  490 + this.setData({
  491 + beneficiary_list: list
  492 + })
  493 + console.log(this.data.beneficiary_list)
  494 + },
  495 +
  496 + //重组添加受益人
  497 + tempBeneficiary() {
  498 + var beneficiary_list = this.data.beneficiary_list
  499 + var len = beneficiary_list.length;
  500 + var tempfavoree1 = [];
  501 + for (var i = 0; i < beneficiary_list.length; i++) {
  502 + var temp = {}
  503 + if (beneficiary_list[i].unit != '') {
  504 + temp.name = beneficiary_list[i].beneficiary_name
  505 + temp.unit = beneficiary_list[i].unit;
  506 + }
  507 + tempfavoree1.push(temp)
  508 + this.setData({
  509 + tempfavoree: tempfavoree1
  510 + })
  511 +
  512 + }
  513 + },
  514 +
  515 + //删除收益人
  516 + deletebenefict(e) {
  517 + let index = e.currentTarget.dataset.index;
  518 + let tempbenefict = Object.assign(this.data.beneficiary_list, {});
  519 + let beneficiaryList = Object.assign(this.data.beneficiaryList, {});
  520 + // 获取当前选项的受益人
  521 + let person = tempbenefict[index].beneficiary_name;
  522 + tempbenefict.splice(index, 1);
  523 + if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)
  524 +
  525 + this.setData({
  526 + beneficiaryList: beneficiaryList,
  527 + beneficiary_list: tempbenefict
  528 + })
  529 + },
  530 +
  531 + //添加附加险
  532 + addRisk() {
  533 + if (this.data.inforid != 0) {
  534 + this.setData({
  535 + edit_state: false
  536 + })
  537 + }
  538 + var risk_list = Object.assign(this.data.risk_list, {});
  539 + var len = risk_list.length
  540 + risk_list[len] = {
  541 + name: '',
  542 + mo: [],
  543 + project_time: '',
  544 + title: '',
  545 + num: ''
  546 + }
  547 + this.setData({
  548 + risk_list: risk_list
  549 + })
  550 + },
  551 +
  552 + //删除附加险
  553 + deleteRisk(e) {
  554 + let index = e.currentTarget.dataset.index;
  555 + let risk_list = Object.assign(this.data.risk_list, {});
  556 + risk_list.splice(index, 1);
  557 + this.setData({
  558 + risk_list: risk_list
  559 + })
  560 + },
  561 +
  562 + //上传图片
  563 + uploadImage() {
  564 + let that = this;
  565 + wx.chooseImage({
  566 + count: 6,
  567 + sizeType: ['original', 'compressed'],
  568 + success: function(res) {
  569 + let successUp = 0; //成功个数
  570 + let failUp = 0; //失败个数
  571 + let i = 0; //第几个
  572 + let tempFilePaths = res.tempFilePaths //总文件
  573 + let length = res.tempFilePaths.length //总共个数
  574 + wx.showNavigationBarLoading()
  575 + wx.showLoading({
  576 + title: '上传中',
91 }) 577 })
  578 + that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)
92 }, 579 },
93 -  
94 - //主险名称  
95 - setRiskName(e) {  
96 - // console.log(e)  
97 - this.setData({  
98 - main_risks: e.detail.value,  
99 - })  
100 - // console.log(this.data.main_risks) 580 + fail: function(res) {}
  581 + })
  582 + },
  583 +
  584 + //上传图片接口调取
  585 + uploadAllfile(filePaths, successUp, failUp, i, length) {
  586 + let that = this
  587 + let strtime = +new Date()
  588 + wx.uploadFile({
  589 + url: 'https://insurance.w.broteam.cn/pubilc/upload', //仅为示例,非真实的接口地址
  590 + filePath: filePaths[i],
  591 + name: 'picurl',
  592 + formData: {
  593 + 'strtime': strtime,
  594 + 'token': app.strTime(strtime)
101 }, 595 },
102 -  
103 - //保费  
104 - yearMoney(e) {  
105 - this.setData({  
106 - year_money: e.detail.value,  
107 - }) 596 + success: function(res) {
  597 + wx.hideNavigationBarLoading()
  598 + wx.hideLoading()
  599 + if (res.statusCode == '200') {
  600 + let imgTemp = that.data.imgs;
  601 + let curImg = JSON.parse(res.data).data.picurl;
  602 + if (imgTemp.length < 6) {
  603 + imgTemp.push("http://" + curImg)
  604 + that.setData({
  605 + imgs: imgTemp
  606 + })
  607 + wx.showToast({
  608 + title: '上传成功',
  609 + icon: 'none',
  610 + duration: 2000,
  611 + })
  612 + } else {
  613 + wx.showToast({
  614 + title: '图片上限6张',
  615 + icon: 'none',
  616 + duration: 2000,
  617 + })
  618 + }
  619 + } else {
  620 + wx.showModal({
  621 + title: '提示',
  622 + content: res.msg,
  623 + showCancel: false
  624 + })
  625 + }
108 }, 626 },
109 -  
110 - //设置银行  
111 - setBank(e) {  
112 - this.setData({  
113 - bank: e.detail.value,  
114 - }) 627 + fail: function(res) {
  628 + wx.hideNavigationBarLoading()
  629 + wx.hideLoading()
115 }, 630 },
116 -  
117 - //设置账号  
118 - setBankNum(e) {  
119 - this.setData({  
120 - bank_num: e.detail.value,  
121 - }) 631 + complete: () => {
  632 + i++;
  633 + if (i == length) {
  634 + // console.log('总共' + successUp + '张上传成功,' + failUp + '张上传失败!');
  635 + } else { //递归调用uploadDIY函数
  636 + this.uploadAllfile(filePaths, successUp, failUp, i, length);
  637 + }
122 }, 638 },
123 -  
124 - //合同生效日  
125 - compactTime(e) { 639 + })
  640 + },
  641 +
  642 + //预览图片
  643 + viewImg(e) {
  644 + var imgs = this.data.imgs
  645 + var current = e.currentTarget.dataset.index
  646 + wx.previewImage({
  647 + //当前显示图片
  648 + current: imgs[current],
  649 + //所有图片
  650 + urls: imgs
  651 + })
  652 + },
  653 +
  654 + //删除图片
  655 + deleteImg(e) {
  656 + var imgs = this.data.imgs;
  657 + var index = e.currentTarget.dataset.index;
  658 + imgs.splice(index, 1);
  659 + this.setData({
  660 + imgs: imgs
  661 + });
  662 + },
  663 +
  664 + //保障期
  665 + warrantyTwo(e) {
  666 + if (this.data.inforid != 0) {
  667 + this.setData({
  668 + edit_state: false
  669 + })
  670 + }
  671 + var guarantee_name = e.detail.value
  672 + this.setData({
  673 + guarantee_name: e.detail.value
  674 + })
  675 + this.countImpletionTime2()
  676 + },
  677 +
  678 + //选择各项单位
  679 + selectUnit(e) {
  680 + var unit = e.currentTarget.dataset.unit
  681 + this.setData({
  682 + unit: unit,
  683 + })
  684 + if (unit == '终身') {
  685 + this.setData({
  686 + warranty_info: '',
  687 + warranty_state: true
  688 + })
  689 + }
  690 + this.countImpletionTime2()
  691 + },
  692 +
  693 + //重组保障期数据格式
  694 + tempWarranty() {
  695 + var guarantee_name = this.data.guarantee_name
  696 + var unit = this.data.unit
  697 + var warranty_two = this.data.warranty_two
  698 + warranty_two.num = guarantee_name
  699 + warranty_two.title = unit
  700 + this.setData({
  701 + warranty_two: warranty_two
  702 + })
  703 + },
  704 +
  705 +
  706 + //计算缴费期满日,主线保障其
  707 + countImpletionTime2() {
  708 + var guarantee_name = parseInt(this.data.guarantee_name)
  709 + var unit = this.data.unit
  710 + var compact_time = this.data.compact_time
  711 + var year = parseInt(new Date(compact_time).getFullYear())
  712 + console.log(year)
  713 + var month = parseInt(new Date(compact_time).getMonth() + 1)
  714 + var day = parseInt(new Date(compact_time).getDate())
  715 + // var impletion_time = this.data.impletion_time
  716 + var warranty_one = this.data.warranty_one
  717 +
  718 + var tempbirth_time = ''
  719 + var birthday = '1995-04-20'
  720 + var birthday_year = parseInt(new Date(birthday).getFullYear())
  721 +
  722 + if (compact_time == '') {
  723 + wx.showToast({
  724 + title: '请选择合同生效日',
  725 + icon: 'none'
  726 + })
  727 + } else {
  728 + if (unit == '年') {
  729 + var temp_year = (year + guarantee_name)
  730 + var temp_day = day - 1
  731 + if (month < 10) month = "0" + month;
  732 + if (temp_day < 10) temp_day = "0" + temp_day;
  733 + // impletion_time = temp_year + '-' + month + '-' + temp_day
  734 + warranty_one = temp_year + '-' + month + '-' + temp_day
  735 + } else if (unit == '岁') {
  736 + var temp_year = (birthday_year + guarantee_name - 1)
  737 + var temp_year2 = (birthday_year + guarantee_name)
  738 + var temp_month = month
  739 + if (temp_month < 10) temp_month = "0" + temp_month;
  740 + if (month < 10) month = "0" + month;
  741 + if (day < 10) day = "0" + day;
  742 + // impletion_time = temp_year + '-' + temp_month + '-' + day
  743 + warranty_one = temp_year2 + '-' + month + '-' + day
  744 + } else if (unit == '终身') {
  745 + // impletion_time = '终身缴费'
  746 + warranty_one = '终身'
  747 + }
  748 + this.setData({
  749 + // impletion_time: impletion_time,
  750 + warranty_one: warranty_one
  751 + })
  752 + }
  753 + },
  754 +
  755 + //缴费时长
  756 + burningTime(e) {
  757 + if (this.data.inforid != 0) {
  758 + this.setData({
  759 + edit_state: false
  760 + })
  761 + }
  762 + var time_name = e.detail.value
  763 + this.setData({
  764 + time_name: time_name
  765 + })
  766 + this.countImpletionTime()
  767 + },
  768 +
  769 + selectUnit2(e) {
  770 + var unit = e.currentTarget.dataset.unit
  771 + this.setData({
  772 + unit2: unit
  773 + })
  774 + if (unit == '终身') {
  775 + this.setData({
  776 + warranty_info1: '',
  777 + warranty_state1: true
  778 + })
  779 + }
  780 + this.countImpletionTime()
  781 + },
  782 +
  783 + //重组缴费时长数据格式
  784 + tempburningTime() {
  785 + var time_name = this.data.time_name
  786 + var unit = this.data.unit2
  787 + var long_money = this.data.long_money
  788 + long_money.num = time_name
  789 + long_money.title = unit
  790 + this.setData({
  791 + long_money: long_money
  792 + })
  793 + },
  794 +
  795 +
  796 + //计算缴费期满日,主线保障其
  797 + countImpletionTime() {
  798 + var time_name = parseInt(this.data.time_name)
  799 + var unit = this.data.unit2
  800 + var compact_time = this.data.compact_time
  801 + var year = parseInt(new Date(compact_time).getFullYear())
  802 + var month = parseInt(new Date(compact_time).getMonth() + 1)
  803 + var day = parseInt(new Date(compact_time).getDate())
  804 + var impletion_time = this.data.impletion_time
  805 + // var warranty_one = this.data.warranty_one
  806 +
  807 + var tempbirth_time = ''
  808 + var birthday = '1995-04-20'
  809 + var birthday_year = parseInt(new Date(birthday).getFullYear())
  810 +
  811 + if (compact_time == '') {
  812 + wx.showToast({
  813 + title: '请选择合同生效日',
  814 + icon: 'none'
  815 + })
  816 + } else {
  817 + if (unit == '年') {
  818 + var temp_year = (year + time_name)
  819 + var temp_day = day - 1
  820 + if (month < 10) month = "0" + month;
  821 + if (temp_day < 10) temp_day = "0" + temp_day;
  822 + impletion_time = temp_year + '-' + month + '-' + temp_day
  823 + // warranty_one = temp_year + '-' + month + '-' + temp_day
  824 + } else if (unit == '岁') {
  825 + var temp_year = (birthday_year + time_name - 1)
  826 + var temp_year2 = (birthday_year + time_name)
  827 + var temp_month = month
  828 + if (temp_month < 10) temp_month = "0" + temp_month;
  829 + if (month < 10) month = "0" + month;
  830 + if (day < 10) day = "0" + day;
  831 + impletion_time = temp_year + '-' + temp_month + '-' + day
  832 + // warranty_one = temp_year2 + '-' + month + '-' + day
  833 + } else if (unit == '终身') {
  834 + impletion_time = '终身缴费'
  835 + // warranty_one = '终身'
  836 + }
  837 + this.setData({
  838 + impletion_time: impletion_time,
  839 + // warranty_one: warranty_one
  840 + })
  841 + }
  842 + },
  843 +
  844 + //缴费方式
  845 + selectUnit3(e) {
  846 + var unit = e.currentTarget.dataset.unit
  847 + this.setData({
  848 + unit3: unit,
  849 + type_money: unit
  850 + })
  851 + },
  852 +
  853 + //附加险保障其
  854 + selectUnit4(e) {
  855 + var unit = e.currentTarget.dataset.unit;
  856 + let index = e.currentTarget.dataset.index;
  857 + let risk_list = Object.assign(this.data.risk_list, {});
  858 + risk_list[index].title = unit
  859 + this.setData({
  860 + risk_list: risk_list
  861 + })
  862 + },
  863 +
  864 + //家庭成员
  865 + familyMember(id) {
  866 + var FamilyId = this.data.FamilyId
  867 + let url = 'counselor/familyname'
  868 + let params = {
  869 + FamilyId: FamilyId || id,
  870 + }
  871 + app.post(url, params).then((res) => {
  872 + // console.log(res)
  873 + var beneficiary_list = this.data.beneficiary_list
  874 + for (var i in beneficiary_list) {
  875 + beneficiary_list[i].name_array = res.data.data.list
  876 + }
  877 + // console.log(beneficiary_list)
  878 +
  879 + if (res.data.code == 200) {
126 this.setData({ 880 this.setData({
127 - compact_time: e.detail.value, 881 + insure: res.data.data.list,
  882 + recognizee: res.data.data.list,
  883 + beneficiary_list: beneficiary_list,
128 }) 884 })
129 - this.countImpletionTime()  
130 - this.countImpletionTime2()  
131 - },  
132 -  
133 - //缴费期满日  
134 - impletionTime(e) {  
135 - this.setData({  
136 - impletion_time: e.detail.value, 885 + }
  886 + })
  887 + },
  888 +
  889 + //设置缓存
  890 + setStorge(e) {
  891 + this.tempBeneficiary()
  892 + this.tempWarranty()
  893 + this.tempburningTime()
  894 + this.tempMain()
  895 + this.tempAddRisk()
  896 + var favoree = JSON.stringify(this.data.tempfavoree)
  897 + var warranty_two = JSON.stringify(this.data.warranty_two)
  898 + var long_money = JSON.stringify(this.data.long_money)
  899 + var more = JSON.stringify(this.data.more)
  900 + var guarantee = JSON.stringify(this.data.guarantee)
  901 + var warn = ""; //弹框时提示的内容
  902 + var in_num = this.data.in_num
  903 + var firm = this.data.firm
  904 + var applicant = this.data.applicant_name
  905 + var recognizee = this.data.recognizee_name
  906 + var main_risks = this.data.main_risks
  907 + var coverage = this.data.coverage
  908 +
  909 + var year_money = this.data.year_money
  910 + var compact_time = this.data.compact_time
  911 + var impletion_time = this.data.impletion_time
  912 + var warranty_one = JSON.stringify(this.data.warranty_one)
  913 + var type_money = this.data.type_money
  914 + var bank = this.data.bank
  915 + var bank_num = this.data.bank_num
  916 + var picurl = JSON.stringify(this.data.imgs)
  917 + let url = 'counselor/inforsave'
  918 + let params = {
  919 + // InfoId: this.data.inforid,
  920 + def_id: this.data.def_id,
  921 + in_num: in_num,
  922 + firm: firm,
  923 + applicant: applicant,
  924 + recognizee: recognizee,
  925 + favoree: favoree,
  926 + main_risks: main_risks,
  927 + coverage: coverage,
  928 + guarantee: guarantee,
  929 + year_money: year_money,
  930 + warranty_two: warranty_two,
  931 + compact_time: compact_time,
  932 + impletion_time: impletion_time,
  933 + warranty_one: warranty_one,
  934 + long_money: long_money,
  935 + type_money: type_money,
  936 + bank: bank,
  937 + bank_num: bank_num,
  938 + more: more,
  939 + picurl: picurl,
  940 + }
  941 + app.post(url, params).then((res) => {
  942 + if (res.data.code == 200) {
  943 + wx.navigateBack({
  944 + delta: 1,
137 }) 945 })
138 - },  
139 -  
140 - //主险保障期  
141 - periodTime(e) {  
142 this.setData({ 946 this.setData({
143 - period_index: e.detail.value, 947 + storge_state: true
144 }) 948 })
145 - }, 949 + var storge_state = true
  950 + wx.setStorageSync('storge_state', storge_state)
  951 + }
  952 + })
  953 + },
  954 +
  955 + //获取缓存内容
  956 + getStorage() {
  957 + let url = 'counselor/inforCopy'
  958 + let params = {
  959 + def_id: this.data.def_id,
  960 + }
  961 + app.post(url, params).then((res) => {
  962 + console.log(res)
  963 + if (res.data.code == 200) {
  964 + var warranty_two = res.data.data.def.warranty_two
  965 + var unit = this.data.unit
  966 + unit = warranty_two.title
  967 + var long_money = res.data.data.def.long_money
  968 + var unit2 = this.data.unit2
  969 + unit2 = long_money.title
  970 + var type_money = res.data.data.def.type_money
  971 + var unit3 = this.data.unit3
  972 + unit3 = type_money
  973 + var beneficiary_list = res.data.data.def.favoree
  974 + for (var obj in beneficiary_list) {
  975 + beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
  976 + beneficiary_list[obj].name_array = this.data.insure
  977 + }
146 978
147 - //保障项目弹窗  
148 - ensureProject(e) {  
149 this.setData({ 979 this.setData({
150 - edit_state: false 980 + imgs: res.data.data.def.picurl,
  981 + type_money: res.data.data.def.type_money,
  982 + unit3: unit3,
  983 + year_money: res.data.data.def.year_money,
  984 + long_money: res.data.data.def.long_money,
  985 + unit2: unit2,
  986 + in_num: res.data.data.def.in_num,
  987 + firm: res.data.data.def.firm,
  988 + main_risks: res.data.data.def.main_risks,
  989 + coverage: res.data.data.def.coverage,
  990 + main_array: res.data.data.def.guarantee,
  991 + applicant_name: res.data.data.def.applicant,
  992 + recognizee_name: res.data.data.def.recognizee,
  993 + warranty_one: res.data.data.def.warranty_one,
  994 + warranty_two: res.data.data.def.warranty_two,
  995 + unit: unit,
  996 + compact_time: res.data.data.def.compact_time,
  997 + impletion_time: res.data.data.def.impletion_time,
  998 + bank: res.data.data.def.bank,
  999 + bank_num: res.data.data.def.bank_num,
  1000 + risk_list: res.data.data.def.more,
  1001 + beneficiary_list: beneficiary_list,
  1002 + edit_state: true,
151 }) 1003 })
152 -  
153 - let that = this;  
154 - let type = e.currentTarget.dataset.type;  
155 - let index = e.currentTarget.dataset.xulie;  
156 - let tempProjectlist = Object.assign(this.data.projectlist, {});  
157 - // 已经添加的附加险  
158 - let risk_list = Object.assign(this.data.risk_list, {});  
159 - console.log(risk_list)  
160 - let tempRist = risk_list[index].mo;  
161 - console.log(tempRist)  
162 - // 已经添加的主险  
163 - let tempMain_list = Object.assign(this.data.main_array, {})  
164 - if (type == 'zhuxian') {  
165 - if (tempMain_list.length > 0) {  
166 - for (let i in tempProjectlist) {  
167 - for (let j in tempMain_list) {  
168 - if (tempProjectlist[i].id == tempMain_list[j].id) {  
169 - tempProjectlist[i].choose_status = true  
170 - for (let g in tempProjectlist[i].title) {  
171 - tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''  
172 -  
173 - }  
174 - }  
175 - }  
176 - }  
177 - }  
178 - } else {  
179 - if (tempRist.length) {  
180 - for (let i in tempProjectlist) {  
181 - for (let j in tempRist) {  
182 - if (tempProjectlist[i].id == tempRist[j].id) {  
183 - tempProjectlist[i].choose_status = true  
184 - for (let g in tempProjectlist[i].title) {  
185 - console.log(tempProjectlist[i].title[g])  
186 - tempProjectlist[i].title[g].t_id == tempRist[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''  
187 - }  
188 - }  
189 - }  
190 - }  
191 - }  
192 - }  
193 -  
194 - wx.setNavigationBarTitle({  
195 - title: '选择保障项目',  
196 - })  
197 -  
198 - this.setData({  
199 - popup_state: true,  
200 - addType: type,  
201 - xulie: index,  
202 - projectlist: tempProjectlist  
203 - })  
204 - },  
205 -  
206 - // 调取保障项目接口  
207 - ensureProjectList() {  
208 - var main_risk = this.data.main_risk  
209 - let url = 'counselor/sageguard'  
210 - let params = {}  
211 - app.post(url, params).then((res) => {  
212 - if (res.data.code == 200) {  
213 - var projectlist = res.data.data.def;  
214 - for (var i = 0; i < projectlist.length; i++) {  
215 - projectlist[i].choose_status = false  
216 - for (var j = 0; j < projectlist[i].title.length; j++) {  
217 - projectlist[i].title[j].label_state = false  
218 - }  
219 - projectlist[i].title[0].current = 0  
220 - projectlist[i].title[0].label_state = true  
221 - }  
222 - this.setData({  
223 - projectlist: res.data.data.def  
224 - })  
225 - // console.log(this.data.projectlist)  
226 - } 1004 + }
  1005 + })
  1006 + },
  1007 +
  1008 + //完成保单添加
  1009 + listVerify(e) {
  1010 + if (this.data.inforid == 0 || this.data.inforid == undefined) {
  1011 + this.tempBeneficiary()
  1012 + this.tempWarranty()
  1013 + this.tempburningTime()
  1014 + this.tempMain()
  1015 + this.tempAddRisk()
  1016 + var favoree = JSON.stringify(this.data.tempfavoree)
  1017 + var warranty_two = JSON.stringify(this.data.warranty_two)
  1018 + var long_money = JSON.stringify(this.data.long_money)
  1019 + var more = JSON.stringify(this.data.more)
  1020 + var guarantee = JSON.stringify(this.data.guarantee)
  1021 + } else if (this.data.edit_state) {
  1022 + var favoree = JSON.stringify(this.data.beneficiary_list)
  1023 + var warranty_two = JSON.stringify(this.data.warranty_two)
  1024 + var long_money = JSON.stringify(this.data.long_money)
  1025 + var more = JSON.stringify(this.data.risk_list)
  1026 + var guarantee = JSON.stringify(this.data.main_array)
  1027 + } else {
  1028 + this.tempBeneficiary()
  1029 + this.tempWarranty()
  1030 + this.tempburningTime()
  1031 + this.tempMain()
  1032 + this.tempAddRisk()
  1033 + var favoree = JSON.stringify(this.data.tempfavoree)
  1034 + var warranty_two = JSON.stringify(this.data.warranty_two)
  1035 + var long_money = JSON.stringify(this.data.long_money)
  1036 + var more = JSON.stringify(this.data.more)
  1037 + var guarantee = JSON.stringify(this.data.guarantee)
  1038 + }
  1039 +
  1040 + var warn = ""; //弹框时提示的内容
  1041 + var flag = true; //判断信息输入是否完整判断弹窗
  1042 + var in_num = e.detail.value.policy_num
  1043 + var firm = e.detail.value.company;
  1044 + var applicant = this.data.applicant_name
  1045 + var recognizee = this.data.recognizee_name
  1046 + var main_risks = e.detail.value.main_risks
  1047 + var coverage = e.detail.value.coverage
  1048 + var year_money = e.detail.value.year_money
  1049 + var compact_time = this.data.compact_time
  1050 + var impletion_time = this.data.impletion_time
  1051 + var warranty_one = JSON.stringify(this.data.warranty_one)
  1052 + var type_money = this.data.type_money
  1053 + var bank = e.detail.value.bank
  1054 + var bank_num = e.detail.value.bank_num
  1055 + var picurl = JSON.stringify(this.data.imgs)
  1056 +
  1057 + var continue1 = e.detail.target.dataset.type
  1058 + var complete = e.detail.target.dataset.type
  1059 +
  1060 + if (in_num == '') {
  1061 + warn = '请输入保单号!'
  1062 + } else if (firm == '') {
  1063 + warn = '请输入所属公司!'
  1064 + } else if (applicant == '') {
  1065 + warn = '请输入投保人!'
  1066 + } else if (recognizee == '') {
  1067 + warn = '请输入被保险人!'
  1068 + } else if (favoree == '') {
  1069 + warn = '请输入受益人!'
  1070 + } else if (main_risks == '') {
  1071 + warn = '请输入主险名称!'
  1072 + } else if (year_money == '') {
  1073 + warn = '请输入年交保费!'
  1074 + } else if (compact_time == '') {
  1075 + warn = '请输入合同生效日!'
  1076 + } else if (warranty_two.num == '') {
  1077 + warn = '请输入保障期!'
  1078 + } else if (long_money.num == '') {
  1079 + warn = '请输入缴费时长!'
  1080 + } else if (type_money == '') {
  1081 + warn = '请输入缴费方式!'
  1082 + } else if (bank == '') {
  1083 + warn = '请输入续费银行!'
  1084 + } else if (bank_num == '') {
  1085 + warn = '请输入续费账号!'
  1086 + } else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {
  1087 + warn = '请输入正确续费账号!'
  1088 + } else if (impletion_time == '') {
  1089 + warn = '请输入缴费期满日!'
  1090 + } else if (warranty_one == '') {
  1091 + warn = '请输入主险保障期!'
  1092 + } else if (more == '') {
  1093 + warn = '请输入附加险!'
  1094 + // else if (picurl.length == 2) {
  1095 + // warn = '请选择图片!'
  1096 + // }
  1097 +
  1098 + } else {
  1099 + flag = false
  1100 + // 添加、修改保单接口调取
  1101 + let url = 'counselor/inforuodate'
  1102 + let params = {
  1103 + InfoId: this.data.inforid,
  1104 + def_id: this.data.def_id,
  1105 + in_num: in_num,
  1106 + firm: firm,
  1107 + applicant: applicant,
  1108 + recognizee: recognizee,
  1109 + favoree: favoree,
  1110 + main_risks: main_risks,
  1111 + coverage: coverage,
  1112 + guarantee: guarantee,
  1113 + year_money: year_money,
  1114 + warranty_two: warranty_two,
  1115 + compact_time: compact_time,
  1116 + impletion_time: impletion_time,
  1117 + warranty_one: warranty_one,
  1118 + long_money: long_money,
  1119 + type_money: type_money,
  1120 + bank: bank,
  1121 + bank_num: bank_num,
  1122 + more: more,
  1123 + picurl: picurl,
  1124 + }
  1125 + app.post(url, params).then((res) => {
  1126 + if (res.data.code == 200) {
  1127 + if (continue1 == 'continue1') {
  1128 + wx.showToast({
  1129 + title: '添加成功',
  1130 + icon: 'none',
  1131 + duration: 2000,
227 }) 1132 })
228 - },  
229 -  
230 - //保障项目单位  
231 - getUnit(e) {  
232 - var main_risk = this.data.main_risk  
233 - var index = e.currentTarget.dataset.index;  
234 - var sindex = e.currentTarget.dataset.sindex;  
235 - var projectlist = this.data.projectlist;  
236 - var title = projectlist[index].title  
237 - for (var i = 0; i < title.length; i++) {  
238 - title[i].current = ''  
239 - if (title[i].current == '') {  
240 - title[i].label_state = false  
241 - }  
242 - }  
243 - projectlist[index].title[sindex].current = sindex  
244 - if (projectlist[index].title[sindex].current == sindex) {  
245 - projectlist[index].title[sindex].label_state = true  
246 - }  
247 this.setData({ 1133 this.setData({
248 - projectlist: projectlist, 1134 + in_num: '',
  1135 + firm: '',
  1136 + applicant_name: '',
  1137 + recognizee_name: '',
  1138 + // beneficiary_list: [{
  1139 + // name_array: [],
  1140 + // unit: ''
  1141 + // }],
  1142 + main_risks: '',
  1143 + main_array: '',
  1144 + year_money: '',
  1145 + compact_time: '',
  1146 + warranty_two: '',
  1147 + long_money: '',
  1148 + bank: '',
  1149 + bank_num: '',
  1150 + impletion_time: '',
  1151 + warranty_one: '',
  1152 + // risk_list:'',
  1153 + imgs: '',
  1154 + unit: '',
  1155 + unit2: '',
  1156 + unit3: '',
  1157 + unit4: '',
249 }) 1158 })
250 - },  
251 -  
252 - //保障项目金额  
253 - popupNum(e) {  
254 - var index = e.currentTarget.dataset.index;  
255 - var projectlist = this.data.projectlist;  
256 - if (projectlist[index].choose_status) {  
257 - projectlist[index].num = e.detail.value  
258 - }  
259 - this.setData({  
260 - projectlist: projectlist 1159 + } else if (complete == 'complete') {
  1160 + wx.showToast({
  1161 + title: '添加成功',
  1162 + icon: 'none',
  1163 + duration: 2000,
261 }) 1164 })
262 - },  
263 -  
264 - //选择保障项目  
265 - popupState(e) {  
266 - var index = e.currentTarget.dataset.index;  
267 - var projectlist = this.data.projectlist;  
268 - projectlist[index].choose_status = !projectlist[index].choose_status;  
269 - // console.log(projectlist)  
270 - this.setData({  
271 - projectlist: projectlist, 1165 + wx.navigateBack({
  1166 + delta: 1,
272 }) 1167 })
273 - if (this.data.inforid != 0) {  
274 - edit_state: false  
275 - }  
276 - },  
277 -  
278 - //确认选择的推荐方案  
279 - confirmCase() {  
280 - let index = this.data.xulie;  
281 - let type = this.data.addType;  
282 - var that = this  
283 - var main_array = []  
284 -  
285 - var projectlist = Object.assign(this.data.projectlist, {})  
286 - for (var i = 0; i < projectlist.length; i++) {  
287 - if (projectlist[i].choose_status) {  
288 - main_array.push(projectlist[i])  
289 - console.log(main_array)  
290 - }  
291 - }  
292 -  
293 - if (main_array != '') {  
294 - wx.showToast({  
295 - title: '添加成功',  
296 - icon: 'none'  
297 - })  
298 -  
299 - if (type == 'fujiaxian') {  
300 - let tempRist = that.data.risk_list;  
301 - console.log(tempRist)  
302 - tempRist[index]['mo'] = main_array;  
303 - that.setData({  
304 - risk_list: tempRist,  
305 - risk_listitm: tempRist  
306 - })  
307 - console.log(this.data.risk_list)  
308 - } else {  
309 - that.setData({  
310 - main_array: main_array,  
311 - })  
312 - }  
313 - console.log(this.data.main_array)  
314 - }  
315 - setTimeout(function() {  
316 - that.ensureProjectList()  
317 - that.setData({  
318 - popup_state: false  
319 - })  
320 - wx.setNavigationBarTitle({  
321 - title: '添加保单',  
322 - })  
323 - }, 800)  
324 -  
325 -  
326 - console.log(this.data.risk_list)  
327 - },  
328 -  
329 - //重组主险的保障项目  
330 - tempMain() {  
331 - var main_array = this.data.main_array  
332 - var warranty_one1 = []  
333 - // console.log(main_array)  
334 - for (var i = 0; i < main_array.length; i++) {  
335 - var temp = {}  
336 - for (var j = 0; j < main_array[i].title.length; j++) {  
337 - if (main_array[i].choose_status) {  
338 - if (main_array[i].title[j].label_state) {  
339 - temp.id = main_array[i].id  
340 - temp.name = main_array[i].name  
341 - temp.num = main_array[i].num  
342 - temp.title = main_array[i].title[j].name  
343 - temp.t_id = main_array[i].title[j].t_id  
344 - }  
345 - }  
346 - }  
347 - warranty_one1.push(temp)  
348 - this.setData({  
349 - guarantee: warranty_one1  
350 - })  
351 - }  
352 -  
353 - },  
354 -  
355 - //主险名称  
356 - addRiskName(e) {  
357 - var risk_list = this.data.risk_list  
358 - var index = e.currentTarget.dataset.index  
359 - risk_list[index].name = e.detail.value  
360 - this.setData({  
361 - risk_list: risk_list  
362 - })  
363 - },  
364 -  
365 - //主险保障其  
366 - addRiskUnit(e) {  
367 - var risk_list = this.data.risk_list  
368 - var index = e.currentTarget.dataset.index  
369 - risk_list[index].num = e.detail.value  
370 - this.setData({  
371 - risk_list: risk_list  
372 - })  
373 - },  
374 -  
375 - //重组附加险整体数据结构  
376 - tempAddRisk() {  
377 - var risk_list = this.data.risk_list  
378 -  
379 - var sub_array = []  
380 - var temp_risk = this.data.risk_listitm;  
381 - var temp = this.data.risk_listitm;  
382 -  
383 - for (var i = 0; i < temp.length; i++) {  
384 - for (var j = 0; j < temp[i].mo.length; j++) {  
385 - for (var k = 0; k < temp[i].mo[j].title.length; k++) {  
386 - if (temp[i].name != '') {  
387 - // var temp = {}  
388 - // var subtemp = {}  
389 - if (temp[i].mo[j].choose_status) {  
390 - if (temp[i].mo[j].title[k].label_state) {  
391 - temp_risk[i].name = temp[i].name  
392 - temp_risk[i].num = temp[i].num  
393 - temp_risk[i].title = temp[i].title  
394 - temp_risk[i].mo[j].t_id = temp[i].mo[j].title[k].t_id  
395 - temp_risk[i].mo[j].id = temp[i].mo[j].id  
396 - temp_risk[i].mo[j].name = temp[i].mo[j].name  
397 - temp_risk[i].mo[j].num = temp[i].mo[j].num  
398 - temp_risk[i].mo[j].title = temp[i].mo[j].title[k].name  
399 - console.log(temp_risk)  
400 - }  
401 - }  
402 - }  
403 - }  
404 - }  
405 -  
406 - this.setData({  
407 - more: temp_risk  
408 - })  
409 - }  
410 -  
411 - },  
412 -  
413 - //选择受益人姓名  
414 - beneficiarySelect(e) {  
415 - if (this.data.inforid != 0) {  
416 - this.setData({  
417 - edit_state: false  
418 - })  
419 - }  
420 - var index = e.currentTarget.dataset.mindex  
421 - var beneficiary_list = Object.assign(this.data.beneficiary_list, {});  
422 - // 获取当前已选择的收益人  
423 - let tempBenefice = Object.assign(this.data.beneficiaryList, {})  
424 - // 当前选择的收益人  
425 - let nowPerson = beneficiary_list[index].name_array[e.detail.value];  
426 - // 判断受益人是否已经添加  
427 - const add = tempBenefice.every((tempBenefice) => {  
428 - return tempBenefice != nowPerson  
429 - })  
430 - if (add) {  
431 - beneficiary_list[index].beneficiary_name = nowPerson;  
432 - tempBenefice.push(nowPerson)  
433 - } else {  
434 - wx.showToast({  
435 - title: '请不要重复添加受益人',  
436 - icon: 'none'  
437 - })  
438 - }  
439 -  
440 - this.setData({  
441 - beneficiary_list: beneficiary_list,  
442 - beneficiaryList: tempBenefice  
443 - })  
444 -  
445 - },  
446 -  
447 - //添加收益比例  
448 - addUnit(e) {  
449 - var beneficiary_list = this.data.beneficiary_list;  
450 - beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;  
451 - this.setData({  
452 - beneficiary_list: beneficiary_list,  
453 - })  
454 - },  
455 -  
456 - //添加受益人  
457 - addPersons(e) {  
458 - var list = this.data.beneficiary_list;  
459 - var len = list.length  
460 - if (list[len - 1].beneficiary_name == undefined) {  
461 - wx.showToast({  
462 - title: '请选择受益人',  
463 - icon: 'none'  
464 - })  
465 - } else if (list[len - 1].unit == '') {  
466 - console.log('unit')  
467 - wx.showToast({  
468 - title: '请输入收益比',  
469 - icon: 'none'  
470 - })  
471 - } else {  
472 - list[len] = {  
473 - name_array: this.data.insure,  
474 - unit: ''  
475 - }  
476 - }  
477 - this.setData({  
478 - beneficiary_list: list  
479 - })  
480 - console.log(this.data.beneficiary_list)  
481 - },  
482 -  
483 - //重组添加受益人  
484 - tempBeneficiary() {  
485 - var beneficiary_list = this.data.beneficiary_list  
486 - var len = beneficiary_list.length;  
487 - var tempfavoree1 = [];  
488 - for (var i = 0; i < beneficiary_list.length; i++) {  
489 - var temp = {}  
490 - if (beneficiary_list[i].unit != '') {  
491 - temp.name = beneficiary_list[i].beneficiary_name  
492 - temp.unit = beneficiary_list[i].unit;  
493 - }  
494 - tempfavoree1.push(temp)  
495 - this.setData({  
496 - tempfavoree: tempfavoree1  
497 - })  
498 -  
499 - }  
500 - },  
501 -  
502 - //删除收益人  
503 - deletebenefict(e) {  
504 - let index = e.currentTarget.dataset.index;  
505 - let tempbenefict = Object.assign(this.data.beneficiary_list, {});  
506 - let beneficiaryList = Object.assign(this.data.beneficiaryList, {});  
507 - // 获取当前选项的受益人  
508 - let person = tempbenefict[index].beneficiary_name;  
509 - tempbenefict.splice(index, 1);  
510 - if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)  
511 -  
512 - this.setData({  
513 - beneficiaryList: beneficiaryList,  
514 - beneficiary_list: tempbenefict  
515 - })  
516 - },  
517 -  
518 - //添加附加险  
519 - addRisk() {  
520 - if (this.data.inforid != 0) {  
521 - this.setData({  
522 - edit_state: false  
523 - })  
524 - }  
525 - var risk_list = Object.assign(this.data.risk_list, {});  
526 - var len = risk_list.length  
527 - risk_list[len] = {  
528 - name: '',  
529 - mo: [],  
530 - project_time: '',  
531 - title: '',  
532 - num: ''  
533 - }  
534 - this.setData({  
535 - risk_list: risk_list  
536 - })  
537 - },  
538 -  
539 - //删除附加险  
540 - deleteRisk(e) {  
541 - let index = e.currentTarget.dataset.index;  
542 - let risk_list = Object.assign(this.data.risk_list, {});  
543 - risk_list.splice(index, 1);  
544 - this.setData({  
545 - risk_list: risk_list  
546 - })  
547 - },  
548 -  
549 - //上传图片  
550 - uploadImage() {  
551 - let that = this;  
552 - wx.chooseImage({  
553 - count: 6,  
554 - sizeType: ['original', 'compressed'],  
555 - success: function(res) {  
556 - let successUp = 0; //成功个数  
557 - let failUp = 0; //失败个数  
558 - let i = 0; //第几个  
559 - let tempFilePaths = res.tempFilePaths //总文件  
560 - let length = res.tempFilePaths.length //总共个数  
561 - wx.showNavigationBarLoading()  
562 - wx.showLoading({  
563 - title: '上传中',  
564 - })  
565 - that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)  
566 - },  
567 - fail: function(res) {}  
568 - })  
569 - },  
570 -  
571 - //上传图片接口调取  
572 - uploadAllfile(filePaths, successUp, failUp, i, length) {  
573 - let that = this  
574 - let strtime = +new Date()  
575 - wx.uploadFile({  
576 - url: 'https://insurance.w.broteam.cn/pubilc/upload', //仅为示例,非真实的接口地址  
577 - filePath: filePaths[i],  
578 - name: 'picurl',  
579 - formData: {  
580 - 'strtime': strtime,  
581 - 'token': app.strTime(strtime)  
582 - },  
583 - success: function(res) {  
584 - wx.hideNavigationBarLoading()  
585 - wx.hideLoading()  
586 - if (res.statusCode == '200') {  
587 - let imgTemp = that.data.imgs;  
588 - let curImg = JSON.parse(res.data).data.picurl;  
589 - if (imgTemp.length < 6) {  
590 - imgTemp.push("http://" + curImg)  
591 - that.setData({  
592 - imgs: imgTemp  
593 - })  
594 - wx.showToast({  
595 - title: '上传成功',  
596 - icon: 'none',  
597 - duration: 2000,  
598 - })  
599 - } else {  
600 - wx.showToast({  
601 - title: '图片上限6张',  
602 - icon: 'none',  
603 - duration: 2000,  
604 - })  
605 - }  
606 - } else {  
607 - wx.showModal({  
608 - title: '提示',  
609 - content: res.msg,  
610 - showCancel: false  
611 - })  
612 - }  
613 - },  
614 - fail: function(res) {  
615 - wx.hideNavigationBarLoading()  
616 - wx.hideLoading()  
617 - },  
618 - complete: () => {  
619 - i++;  
620 - if (i == length) {  
621 - // console.log('总共' + successUp + '张上传成功,' + failUp + '张上传失败!');  
622 - } else { //递归调用uploadDIY函数  
623 - this.uploadAllfile(filePaths, successUp, failUp, i, length);  
624 - }  
625 - },  
626 - })  
627 - },  
628 -  
629 - //预览图片  
630 - viewImg(e) {  
631 - var imgs = this.data.imgs  
632 - var current = e.currentTarget.dataset.index  
633 - wx.previewImage({  
634 - //当前显示图片  
635 - current: imgs[current],  
636 - //所有图片  
637 - urls: imgs  
638 - })  
639 - },  
640 -  
641 - //删除图片  
642 - deleteImg(e) {  
643 - var imgs = this.data.imgs;  
644 - var index = e.currentTarget.dataset.index;  
645 - imgs.splice(index, 1);  
646 - this.setData({  
647 - imgs: imgs  
648 - });  
649 - },  
650 -  
651 - //保障期  
652 - warrantyTwo(e) {  
653 - if (this.data.inforid != 0) {  
654 - this.setData({  
655 - edit_state: false  
656 - })  
657 - }  
658 - var guarantee_name = e.detail.value  
659 - this.setData({  
660 - guarantee_name: e.detail.value  
661 - })  
662 - this.countImpletionTime2()  
663 - },  
664 -  
665 - //选择各项单位  
666 - selectUnit(e) {  
667 - var unit = e.currentTarget.dataset.unit  
668 - this.setData({  
669 - unit: unit,  
670 - })  
671 - if(unit=='终身'){  
672 - this.setData({  
673 - warranty_info:'',  
674 - warranty_state:true  
675 - })  
676 - }  
677 - this.countImpletionTime2()  
678 - },  
679 -  
680 - //重组保障期数据格式  
681 - tempWarranty() {  
682 - var guarantee_name = this.data.guarantee_name  
683 - var unit = this.data.unit  
684 - var warranty_two = this.data.warranty_two  
685 - warranty_two.num = guarantee_name  
686 - warranty_two.title = unit  
687 - this.setData({  
688 - warranty_two: warranty_two  
689 - })  
690 - },  
691 -  
692 -  
693 - //计算缴费期满日,主线保障其  
694 - countImpletionTime2() {  
695 - var guarantee_name = parseInt(this.data.guarantee_name)  
696 - var unit = this.data.unit  
697 - var compact_time = this.data.compact_time  
698 - var year = parseInt(new Date(compact_time).getFullYear())  
699 - console.log(year)  
700 - var month = parseInt(new Date(compact_time).getMonth() + 1)  
701 - var day = parseInt(new Date(compact_time).getDate())  
702 - // var impletion_time = this.data.impletion_time  
703 - var warranty_one = this.data.warranty_one  
704 -  
705 - var tempbirth_time = ''  
706 - var birthday = '1995-04-20'  
707 - var birthday_year = parseInt(new Date(birthday).getFullYear())  
708 -  
709 - if (compact_time == '') {  
710 - wx.showToast({  
711 - title: '请选择合同生效日',  
712 - icon: 'none'  
713 - })  
714 - } else {  
715 - if (unit == '年') {  
716 - var temp_year = (year + guarantee_name)  
717 - var temp_day = day - 1  
718 - if (month < 10) month = "0" + month;  
719 - if (temp_day < 10) temp_day = "0" + temp_day;  
720 - // impletion_time = temp_year + '-' + month + '-' + temp_day  
721 - warranty_one = temp_year + '-' + month + '-' + temp_day  
722 - } else if (unit == '岁') {  
723 - var temp_year = (birthday_year + guarantee_name - 1)  
724 - var temp_year2 = (birthday_year + guarantee_name)  
725 - var temp_month = month  
726 - if (temp_month < 10) temp_month = "0" + temp_month;  
727 - if (month < 10) month = "0" + month;  
728 - if (day < 10) day = "0" + day;  
729 - // impletion_time = temp_year + '-' + temp_month + '-' + day  
730 - warranty_one = temp_year2 + '-' + month + '-' + day  
731 - } else if (unit == '终身') {  
732 - // impletion_time = '终身缴费'  
733 - warranty_one = '终身'  
734 - }  
735 - this.setData({  
736 - // impletion_time: impletion_time,  
737 - warranty_one: warranty_one  
738 - })  
739 - }  
740 - },  
741 -  
742 - //缴费时长  
743 - burningTime(e) {  
744 - if (this.data.inforid != 0) {  
745 - this.setData({  
746 - edit_state: false  
747 - })  
748 - }  
749 - var time_name = e.detail.value  
750 - this.setData({  
751 - time_name: time_name  
752 - })  
753 - this.countImpletionTime()  
754 - },  
755 -  
756 - selectUnit2(e) {  
757 - var unit = e.currentTarget.dataset.unit  
758 - this.setData({  
759 - unit2: unit  
760 - })  
761 - this.countImpletionTime()  
762 - },  
763 -  
764 - //重组缴费时长数据格式  
765 - tempburningTime() {  
766 - var time_name = this.data.time_name  
767 - var unit = this.data.unit2  
768 - var long_money = this.data.long_money  
769 - long_money.num = time_name  
770 - long_money.title = unit  
771 - this.setData({  
772 - long_money: long_money  
773 - })  
774 - },  
775 -  
776 -  
777 - //计算缴费期满日,主线保障其  
778 - countImpletionTime() {  
779 - var time_name = parseInt(this.data.time_name)  
780 - var unit = this.data.unit2  
781 - var compact_time = this.data.compact_time  
782 - var year = parseInt(new Date(compact_time).getFullYear())  
783 - var month = parseInt(new Date(compact_time).getMonth() + 1)  
784 - var day = parseInt(new Date(compact_time).getDate())  
785 - var impletion_time = this.data.impletion_time  
786 - // var warranty_one = this.data.warranty_one  
787 -  
788 - var tempbirth_time = ''  
789 - var birthday = '1995-04-20'  
790 - var birthday_year = parseInt(new Date(birthday).getFullYear())  
791 -  
792 - if (compact_time == '') {  
793 - wx.showToast({  
794 - title: '请选择合同生效日',  
795 - icon: 'none'  
796 - })  
797 - } else {  
798 - if (unit == '年') {  
799 - var temp_year = (year + time_name)  
800 - var temp_day = day - 1  
801 - if (month < 10) month = "0" + month;  
802 - if (temp_day < 10) temp_day = "0" + temp_day;  
803 - impletion_time = temp_year + '-' + month + '-' + temp_day  
804 - // warranty_one = temp_year + '-' + month + '-' + temp_day  
805 - } else if (unit == '岁') {  
806 - var temp_year = (birthday_year + time_name - 1)  
807 - var temp_year2 = (birthday_year + time_name)  
808 - var temp_month = month  
809 - if (temp_month < 10) temp_month = "0" + temp_month;  
810 - if (month < 10) month = "0" + month;  
811 - if (day < 10) day = "0" + day;  
812 - impletion_time = temp_year + '-' + temp_month + '-' + day  
813 - // warranty_one = temp_year2 + '-' + month + '-' + day  
814 - } else if (unit == '终身') {  
815 - impletion_time = '终身缴费'  
816 - // warranty_one = '终身'  
817 - }  
818 - this.setData({  
819 - impletion_time: impletion_time,  
820 - // warranty_one: warranty_one  
821 - })  
822 - }  
823 - },  
824 -  
825 - //缴费方式  
826 - selectUnit3(e) {  
827 - var unit = e.currentTarget.dataset.unit  
828 - this.setData({  
829 - unit3: unit,  
830 - type_money: unit  
831 - })  
832 - },  
833 -  
834 - //附加险保障其  
835 - selectUnit4(e) {  
836 - var unit = e.currentTarget.dataset.unit;  
837 - let index = e.currentTarget.dataset.index;  
838 - let risk_list = Object.assign(this.data.risk_list, {});  
839 - risk_list[index].title = unit  
840 - this.setData({  
841 - risk_list: risk_list  
842 - })  
843 - },  
844 -  
845 - //家庭成员  
846 - familyMember(id) {  
847 - var FamilyId = this.data.FamilyId  
848 - let url = 'counselor/familyname'  
849 - let params = {  
850 - FamilyId: FamilyId||id,  
851 - }  
852 - app.post(url, params).then((res) => {  
853 - // console.log(res)  
854 - var beneficiary_list = this.data.beneficiary_list  
855 - for (var i in beneficiary_list) {  
856 - beneficiary_list[i].name_array = res.data.data.list  
857 - }  
858 - // console.log(beneficiary_list)  
859 -  
860 - if (res.data.code == 200) {  
861 - this.setData({  
862 - insure: res.data.data.list,  
863 - recognizee: res.data.data.list,  
864 - beneficiary_list: beneficiary_list,  
865 - })  
866 - }  
867 - })  
868 - },  
869 -  
870 - //设置缓存  
871 - setStorge(e) {  
872 - this.tempBeneficiary()  
873 - this.tempWarranty()  
874 - this.tempburningTime()  
875 - this.tempMain()  
876 - this.tempAddRisk()  
877 - var favoree = JSON.stringify(this.data.tempfavoree)  
878 - var warranty_two = JSON.stringify(this.data.warranty_two)  
879 - var long_money = JSON.stringify(this.data.long_money)  
880 - var more = JSON.stringify(this.data.more)  
881 - var guarantee = JSON.stringify(this.data.guarantee)  
882 - var warn = ""; //弹框时提示的内容  
883 - var in_num = this.data.in_num  
884 - var firm = this.data.firm  
885 - var applicant = this.data.applicant_name  
886 - var recognizee = this.data.recognizee_name  
887 - var main_risks = this.data.main_risks  
888 - var year_money = this.data.year_money  
889 - var compact_time = this.data.compact_time  
890 - var impletion_time = this.data.impletion_time  
891 - var warranty_one = JSON.stringify(this.data.warranty_one)  
892 - var type_money = this.data.type_money  
893 - var bank = this.data.bank  
894 - var bank_num = this.data.bank_num  
895 - var picurl = JSON.stringify(this.data.imgs)  
896 - let url = 'counselor/inforsave'  
897 - let params = {  
898 - // InfoId: this.data.inforid,  
899 - def_id: this.data.def_id,  
900 - in_num: in_num,  
901 - firm: firm,  
902 - applicant: applicant,  
903 - recognizee: recognizee,  
904 - favoree: favoree,  
905 - main_risks: main_risks,  
906 - guarantee: guarantee,  
907 - year_money: year_money,  
908 - warranty_two: warranty_two,  
909 - compact_time: compact_time,  
910 - impletion_time: impletion_time,  
911 - warranty_one: warranty_one,  
912 - long_money: long_money,  
913 - type_money: type_money,  
914 - bank: bank,  
915 - bank_num: bank_num,  
916 - more: more,  
917 - picurl: picurl,  
918 - }  
919 - app.post(url, params).then((res) => {  
920 - if (res.data.code == 200) {  
921 - wx.navigateBack({  
922 - delta: 1,  
923 - })  
924 - this.setData({  
925 - storge_state: true  
926 - })  
927 - var storge_state = true  
928 - wx.setStorageSync('storge_state', storge_state)  
929 - }  
930 - })  
931 - },  
932 -  
933 - //获取缓存内容  
934 - getStorage() {  
935 - let url = 'counselor/inforCopy'  
936 - let params = {  
937 - def_id: this.data.def_id,  
938 - }  
939 - app.post(url, params).then((res) => {  
940 - console.log(res)  
941 - if (res.data.code == 200) {  
942 - var warranty_two = res.data.data.def.warranty_two  
943 - var unit = this.data.unit  
944 - unit = warranty_two.title  
945 - var long_money = res.data.data.def.long_money  
946 - var unit2 = this.data.unit2  
947 - unit2 = long_money.title  
948 - var type_money = res.data.data.def.type_money  
949 - var unit3 = this.data.unit3  
950 - unit3 = type_money  
951 - var beneficiary_list = res.data.data.def.favoree  
952 - for (var obj in beneficiary_list) {  
953 - beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name  
954 - beneficiary_list[obj].name_array = this.data.insure  
955 - }  
956 -  
957 - this.setData({  
958 - imgs: res.data.data.def.picurl,  
959 - type_money: res.data.data.def.type_money,  
960 - unit3: unit3,  
961 - year_money: res.data.data.def.year_money,  
962 - long_money: res.data.data.def.long_money,  
963 - unit2: unit2,  
964 - in_num: res.data.data.def.in_num,  
965 - firm: res.data.data.def.firm,  
966 - main_risks: res.data.data.def.main_risks,  
967 - main_array: res.data.data.def.guarantee,  
968 - applicant_name: res.data.data.def.applicant,  
969 - recognizee_name: res.data.data.def.recognizee,  
970 - warranty_one: res.data.data.def.warranty_one,  
971 - warranty_two: res.data.data.def.warranty_two,  
972 - unit: unit,  
973 - compact_time: res.data.data.def.compact_time,  
974 - impletion_time: res.data.data.def.impletion_time,  
975 - bank: res.data.data.def.bank,  
976 - bank_num: res.data.data.def.bank_num,  
977 - risk_list: res.data.data.def.more,  
978 - beneficiary_list: beneficiary_list,  
979 - edit_state: true,  
980 - })  
981 - }  
982 - })  
983 - },  
984 -  
985 - //完成保单添加  
986 - listVerify(e) {  
987 - if (this.data.inforid == 0 || this.data.inforid == undefined) {  
988 - this.tempBeneficiary()  
989 - this.tempWarranty()  
990 - this.tempburningTime()  
991 - this.tempMain()  
992 - this.tempAddRisk()  
993 - var favoree = JSON.stringify(this.data.tempfavoree)  
994 - var warranty_two = JSON.stringify(this.data.warranty_two)  
995 - var long_money = JSON.stringify(this.data.long_money)  
996 - var more = JSON.stringify(this.data.more)  
997 - var guarantee = JSON.stringify(this.data.guarantee)  
998 - } else if (this.data.edit_state) {  
999 - var favoree = JSON.stringify(this.data.beneficiary_list)  
1000 - var warranty_two = JSON.stringify(this.data.warranty_two)  
1001 - var long_money = JSON.stringify(this.data.long_money)  
1002 - var more = JSON.stringify(this.data.risk_list)  
1003 - var guarantee = JSON.stringify(this.data.main_array)  
1004 - } else {  
1005 - this.tempBeneficiary()  
1006 - this.tempWarranty()  
1007 - this.tempburningTime()  
1008 - this.tempMain()  
1009 - this.tempAddRisk()  
1010 - var favoree = JSON.stringify(this.data.tempfavoree)  
1011 - var warranty_two = JSON.stringify(this.data.warranty_two)  
1012 - var long_money = JSON.stringify(this.data.long_money)  
1013 - var more = JSON.stringify(this.data.more)  
1014 - var guarantee = JSON.stringify(this.data.guarantee)  
1015 - }  
1016 -  
1017 - var warn = ""; //弹框时提示的内容  
1018 - var flag = true; //判断信息输入是否完整判断弹窗  
1019 - var in_num = e.detail.value.policy_num  
1020 - var firm = e.detail.value.company;  
1021 - var applicant = this.data.applicant_name  
1022 - var recognizee = this.data.recognizee_name  
1023 - var main_risks = e.detail.value.main_risks  
1024 -  
1025 - var year_money = e.detail.value.year_money  
1026 - var compact_time = this.data.compact_time  
1027 - var impletion_time = this.data.impletion_time  
1028 - var warranty_one = JSON.stringify(this.data.warranty_one)  
1029 - var type_money = this.data.type_money  
1030 - var bank = e.detail.value.bank  
1031 - var bank_num = e.detail.value.bank_num  
1032 - var picurl = JSON.stringify(this.data.imgs)  
1033 -  
1034 - var continue1 = e.detail.target.dataset.type  
1035 - var complete = e.detail.target.dataset.type  
1036 -  
1037 - if (in_num == '') {  
1038 - warn = '请输入保单号!'  
1039 - } else if (firm == '') {  
1040 - warn = '请输入所属公司!'  
1041 - } else if (applicant == '') {  
1042 - warn = '请输入投保人!'  
1043 - } else if (recognizee == '') {  
1044 - warn = '请输入被保险人!'  
1045 - } else if (favoree == '') {  
1046 - warn = '请输入受益人!'  
1047 - } else if (main_risks == '') {  
1048 - warn = '请输入主险名称!'  
1049 - } else if (year_money == '') {  
1050 - warn = '请输入年交保费!'  
1051 - } else if (compact_time == '') {  
1052 - warn = '请输入合同生效日!'  
1053 - } else if (warranty_two.num == '') {  
1054 - warn = '请输入保障期!'  
1055 - } else if (long_money.num == '') {  
1056 - warn = '请输入缴费时长!'  
1057 - } else if (type_money == '') {  
1058 - warn = '请输入缴费方式!'  
1059 - } else if (bank == '') {  
1060 - warn = '请输入续费银行!'  
1061 - } else if (bank_num == '') {  
1062 - warn = '请输入续费账号!'  
1063 - } else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {  
1064 - warn = '请输入正确续费账号!'  
1065 - } else if (impletion_time == '') {  
1066 - warn = '请输入缴费期满日!'  
1067 - } else if (warranty_one == '') {  
1068 - warn = '请输入主险保障期!'  
1069 - } else if (more == '') {  
1070 - warn = '请输入附加险!'  
1071 - } else if (picurl.length == 2) {  
1072 - warn = '请选择图片!'  
1073 - } else {  
1074 - flag = false  
1075 - // 添加、修改保单接口调取  
1076 - let url = 'counselor/inforuodate'  
1077 - let params = {  
1078 - InfoId: this.data.inforid,  
1079 - def_id: this.data.def_id,  
1080 - in_num: in_num,  
1081 - firm: firm,  
1082 - applicant: applicant,  
1083 - recognizee: recognizee,  
1084 - favoree: favoree,  
1085 - main_risks: main_risks,  
1086 - guarantee: guarantee,  
1087 - year_money: year_money,  
1088 - warranty_two: warranty_two,  
1089 - compact_time: compact_time,  
1090 - impletion_time: impletion_time,  
1091 - warranty_one: warranty_one,  
1092 - long_money: long_money,  
1093 - type_money: type_money,  
1094 - bank: bank,  
1095 - bank_num: bank_num,  
1096 - more: more,  
1097 - picurl: picurl,  
1098 - }  
1099 - app.post(url, params).then((res) => {  
1100 - if (res.data.code == 200) {  
1101 - if (continue1 == 'continue1') {  
1102 - wx.showToast({  
1103 - title: '添加成功',  
1104 - icon: 'none',  
1105 - duration: 2000,  
1106 - })  
1107 - this.setData({  
1108 - in_num: '',  
1109 - firm: '',  
1110 - applicant_name: '',  
1111 - recognizee_name: '',  
1112 - // beneficiary_list: [{  
1113 - // name_array: [],  
1114 - // unit: ''  
1115 - // }],  
1116 - main_risks: '',  
1117 - main_array: '',  
1118 - year_money: '',  
1119 - compact_time: '',  
1120 - warranty_two: '',  
1121 - long_money: '',  
1122 - bank: '',  
1123 - bank_num: '',  
1124 - impletion_time: '',  
1125 - warranty_one: '',  
1126 - // risk_list:'',  
1127 - imgs: '',  
1128 - unit: '',  
1129 - unit2: '',  
1130 - unit3: '',  
1131 - unit4: '',  
1132 - })  
1133 - } else if (complete == 'complete') {  
1134 - wx.showToast({  
1135 - title: '添加成功',  
1136 - icon: 'none',  
1137 - duration: 2000,  
1138 - })  
1139 - wx.navigateBack({  
1140 - delta: 1,  
1141 - })  
1142 - }  
1143 - }  
1144 - })  
1145 - }  
1146 -  
1147 - if (flag == true) {  
1148 - wx.showToast({  
1149 - title: warn,  
1150 - icon: 'none'  
1151 - })  
1152 - }  
1153 -  
1154 - },  
1155 -  
1156 -  
1157 -  
1158 - //获取编辑保单接口  
1159 - getlistVerify(id) {  
1160 - let url = 'counselor/infordef'  
1161 - let params = {  
1162 - InfoId: this.data.inforid||id,  
1163 - }  
1164 - app.post(url, params).then((res) => {  
1165 - if (res.data.code == 200) {  
1166 - var warranty_two = res.data.data.def.warranty_two  
1167 - var unit = this.data.unit  
1168 - unit = warranty_two.title  
1169 - var long_money = res.data.data.def.long_money  
1170 - var unit2 = this.data.unit2  
1171 - unit2 = long_money.title  
1172 - var type_money = res.data.data.def.type_money  
1173 - var unit3 = this.data.unit3  
1174 - unit3 = type_money  
1175 - var beneficiary_list = res.data.data.def.favoree  
1176 - for (var obj in beneficiary_list) {  
1177 - beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name  
1178 - beneficiary_list[obj].name_array = this.data.insure  
1179 - }  
1180 -  
1181 - var risk_list = res.data.data.def.more  
1182 - var projectlist = this.data.projectlist  
1183 -  
1184 - for (var i = 0; i < risk_list.length; i++) {  
1185 - for (var j = 0; j < projectlist.length; j++) {  
1186 - for (var k = 0; k < projectlist[j].title.length; k++) {  
1187 - if (risk_list[i].id == projectlist[j].id) {  
1188 - if (risk_list[i].title == projectlist[j].title[k].name) {  
1189 - var title = {}  
1190 - title.name = projectlist[j].title[k]  
1191 - }  
1192 - }  
1193 - }  
1194 - } 1168 + }
  1169 + }
  1170 + })
  1171 + }
  1172 +
  1173 + if (flag == true) {
  1174 + wx.showToast({
  1175 + title: warn,
  1176 + icon: 'none'
  1177 + })
  1178 + }
  1179 +
  1180 + },
  1181 +
  1182 +
  1183 +
  1184 + //获取编辑保单接口
  1185 + getlistVerify(id) {
  1186 + let url = 'counselor/infordef'
  1187 + let params = {
  1188 + InfoId: this.data.inforid || id,
  1189 + }
  1190 + app.post(url, params).then((res) => {
  1191 + if (res.data.code == 200) {
  1192 + var warranty_two = res.data.data.def.warranty_two
  1193 + var unit = this.data.unit
  1194 + unit = warranty_two.title
  1195 + var long_money = res.data.data.def.long_money
  1196 + var unit2 = this.data.unit2
  1197 + unit2 = long_money.title
  1198 + var type_money = res.data.data.def.type_money
  1199 + var unit3 = this.data.unit3
  1200 + unit3 = type_money
  1201 + var beneficiary_list = res.data.data.def.favoree
  1202 + for (var obj in beneficiary_list) {
  1203 + beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
  1204 + beneficiary_list[obj].name_array = this.data.insure
  1205 + }
  1206 +
  1207 + var risk_list = res.data.data.def.more
  1208 + var projectlist = this.data.projectlist
  1209 +
  1210 + for (var i = 0; i < risk_list.length; i++) {
  1211 + for (var j = 0; j < projectlist.length; j++) {
  1212 + for (var k = 0; k < projectlist[j].title.length; k++) {
  1213 + if (risk_list[i].id == projectlist[j].id) {
  1214 + if (risk_list[i].title == projectlist[j].title[k].name) {
  1215 + var title = {}
  1216 + title.name = projectlist[j].title[k]
1195 } 1217 }
1196 -  
1197 - var warranty_two = res.data.data.def.warranty_two  
1198 - var guarantee_name = warranty_two.num  
1199 -  
1200 - var long_money = res.data.data.def.long_money  
1201 - var time_name = long_money.num  
1202 -  
1203 - this.setData({  
1204 - imgs: res.data.data.def.picurl,  
1205 - type_money: res.data.data.def.type_money,  
1206 - unit3: unit3,  
1207 - year_money: res.data.data.def.year_money,  
1208 - long_money: res.data.data.def.long_money,  
1209 - unit2: unit2,  
1210 - in_num: res.data.data.def.in_num,  
1211 - firm: res.data.data.def.firm,  
1212 - main_risks: res.data.data.def.main_risks,  
1213 - main_array: res.data.data.def.guarantee,  
1214 - applicant_name: res.data.data.def.applicant,  
1215 - recognizee_name: res.data.data.def.recognizee,  
1216 - warranty_one: res.data.data.def.warranty_one,  
1217 - warranty_two: res.data.data.def.warranty_two,  
1218 - unit: unit,  
1219 - compact_time: res.data.data.def.compact_time,  
1220 - impletion_time: res.data.data.def.impletion_time,  
1221 - bank: res.data.data.def.bank,  
1222 - bank_num: res.data.data.def.bank_num,  
1223 - risk_list: risk_list,  
1224 - beneficiary_list: beneficiary_list,  
1225 - edit_state: true,  
1226 - guarantee_name: guarantee_name,  
1227 - time_name: time_name,  
1228 - })  
1229 } 1218 }
1230 - })  
1231 - },  
1232 -  
1233 - /**  
1234 - * 生命周期函数--监听页面加载  
1235 - */  
1236 - onLoad: function(options) {  
1237 -  
1238 - this.ensureProjectList()  
1239 - let that = this;  
1240 - options.inforid ? (that.getlistVerify(options.inforid),that.setData({  
1241 - inforid: options.inforid,  
1242 - edit_state: true  
1243 - }),wx.setNavigationBarTitle({  
1244 - title: '编辑保单',  
1245 - })): ""  
1246 - options.def_id ? that.setData({  
1247 - def_id: options.def_id,  
1248 - }) : ""  
1249 - options.FamilyId ? (that.familyMember(options.FamilyId),that.setData({  
1250 - FamilyId: options.FamilyId  
1251 - })):'';  
1252 - if (wx.getStorageSync('storge_state') && options.inforid == undefined) {  
1253 - this.getStorage()  
1254 } 1219 }
1255 - },  
1256 -  
1257 - /**  
1258 - * 生命周期函数--监听页面初次渲染完成  
1259 - */  
1260 - onReady: function() {  
1261 -  
1262 - },  
1263 -  
1264 - /**  
1265 - * 生命周期函数--监听页面显示  
1266 - */  
1267 - onShow: function() {  
1268 -  
1269 - },  
1270 -  
1271 - /**  
1272 - * 生命周期函数--监听页面隐藏  
1273 - */  
1274 - onHide: function() {  
1275 -  
1276 - },  
1277 -  
1278 - /**  
1279 - * 生命周期函数--监听页面卸载  
1280 - */  
1281 - onUnload: function() {  
1282 -  
1283 - },  
1284 -  
1285 - /**  
1286 - * 页面相关事件处理函数--监听用户下拉动作  
1287 - */  
1288 - onPullDownRefresh: function() {  
1289 -  
1290 - },  
1291 -  
1292 - /**  
1293 - * 页面上拉触底事件的处理函数  
1294 - */  
1295 - onReachBottom: function() { 1220 + }
  1221 + }
1296 1222
1297 - }, 1223 + var warranty_two = res.data.data.def.warranty_two
  1224 + var guarantee_name = warranty_two.num
1298 1225
1299 - /**  
1300 - * 用户点击右上角分享  
1301 - */  
1302 - onShareAppMessage: function() { 1226 + var long_money = res.data.data.def.long_money
  1227 + var time_name = long_money.num
1303 1228
1304 - }  
1305 - })  
  1229 + this.setData({
  1230 + imgs: res.data.data.def.picurl,
  1231 + type_money: res.data.data.def.type_money,
  1232 + unit3: unit3,
  1233 + year_money: res.data.data.def.year_money,
  1234 + long_money: res.data.data.def.long_money,
  1235 + unit2: unit2,
  1236 + in_num: res.data.data.def.in_num,
  1237 + firm: res.data.data.def.firm,
  1238 + main_risks: res.data.data.def.main_risks,
  1239 + coverage: res.data.data.def.coverage,
  1240 + main_array: res.data.data.def.guarantee,
  1241 + applicant_name: res.data.data.def.applicant,
  1242 + recognizee_name: res.data.data.def.recognizee,
  1243 + warranty_one: res.data.data.def.warranty_one,
  1244 + warranty_two: res.data.data.def.warranty_two,
  1245 + unit: unit,
  1246 + compact_time: res.data.data.def.compact_time,
  1247 + impletion_time: res.data.data.def.impletion_time,
  1248 + bank: res.data.data.def.bank,
  1249 + bank_num: res.data.data.def.bank_num,
  1250 + risk_list: risk_list,
  1251 + beneficiary_list: beneficiary_list,
  1252 + edit_state: true,
  1253 + guarantee_name: guarantee_name,
  1254 + time_name: time_name,
  1255 + })
  1256 + }
  1257 + })
  1258 + },
  1259 +
  1260 + /**
  1261 + * 生命周期函数--监听页面加载
  1262 + */
  1263 + onLoad: function(options) {
  1264 +
  1265 + this.ensureProjectList()
  1266 + let that = this;
  1267 + options.inforid ? (that.getlistVerify(options.inforid), that.setData({
  1268 + inforid: options.inforid,
  1269 + edit_state: true
  1270 + }), wx.setNavigationBarTitle({
  1271 + title: '编辑保单',
  1272 + })) : ""
  1273 + options.def_id ? that.setData({
  1274 + def_id: options.def_id,
  1275 + }) : ""
  1276 + options.FamilyId ? (that.familyMember(options.FamilyId), that.setData({
  1277 + FamilyId: options.FamilyId
  1278 + })) : '';
  1279 + if (wx.getStorageSync('storge_state') && options.inforid == undefined) {
  1280 + this.getStorage()
  1281 + }
  1282 + },
  1283 +
  1284 + /**
  1285 + * 生命周期函数--监听页面初次渲染完成
  1286 + */
  1287 + onReady: function() {
  1288 +
  1289 + },
  1290 +
  1291 + /**
  1292 + * 生命周期函数--监听页面显示
  1293 + */
  1294 + onShow: function() {
  1295 +
  1296 + },
  1297 +
  1298 + /**
  1299 + * 生命周期函数--监听页面隐藏
  1300 + */
  1301 + onHide: function() {
  1302 +
  1303 + },
  1304 +
  1305 + /**
  1306 + * 生命周期函数--监听页面卸载
  1307 + */
  1308 + onUnload: function() {
  1309 +
  1310 + },
  1311 +
  1312 + /**
  1313 + * 页面相关事件处理函数--监听用户下拉动作
  1314 + */
  1315 + onPullDownRefresh: function() {
  1316 +
  1317 + },
  1318 +
  1319 + /**
  1320 + * 页面上拉触底事件的处理函数
  1321 + */
  1322 + onReachBottom: function() {
  1323 +
  1324 + },
  1325 +
  1326 + /**
  1327 + * 用户点击右上角分享
  1328 + */
  1329 + onShareAppMessage: function() {
  1330 +
  1331 + }
  1332 +})
@@ -90,6 +90,15 @@ @@ -90,6 +90,15 @@
90 <input type='text' placeholder='请填写' name='main_risks' value='{{main_risks}}' bindinput='setRiskName'></input> 90 <input type='text' placeholder='请填写' name='main_risks' value='{{main_risks}}' bindinput='setRiskName'></input>
91 </view> 91 </view>
92 </view> 92 </view>
  93 + <view class='item_list'>
  94 + <view class='list_title'>
  95 + <!-- <text class='symbol_icon'>*</text> -->
  96 + <text>主险基本保额</text>
  97 + </view>
  98 + <view class='list_input'>
  99 + <input type='number' placeholder='请填写' name='coverage' value='{{coverage}}' bindinput='setRiskMoney'></input>
  100 + </view>
  101 + </view>
93 <view class='protec_item_box'> 102 <view class='protec_item_box'>
94 <view> 103 <view>
95 <view class='protec_item' wx:for='{{main_array}}' wx:key=''> 104 <view class='protec_item' wx:for='{{main_array}}' wx:key=''>
@@ -153,7 +162,7 @@ @@ -153,7 +162,7 @@
153 <view class='list_title'>缴费时长</view> 162 <view class='list_title'>缴费时长</view>
154 <view class='list_input_box'> 163 <view class='list_input_box'>
155 <view class='list_input'> 164 <view class='list_input'>
156 - <input type='text' placeholder='请输入' name='beneficiary' value='{{long_money.num}}' bindinput='burningTime'></input> 165 + <input type='text' placeholder='{{warranty_info1}}' name='beneficiary' value='{{long_money.num}}' bindinput='burningTime' disabled='{{warranty_state1}}'></input>
157 </view> 166 </view>
158 <view class='list_label_box'> 167 <view class='list_label_box'>
159 <view class="list_label_item {{unit2=='年'?'list_label_active':''}}" bindtap='selectUnit2' data-unit='年'>年</view> 168 <view class="list_label_item {{unit2=='年'?'list_label_active':''}}" bindtap='selectUnit2' data-unit='年'>年</view>
@@ -201,10 +210,10 @@ @@ -201,10 +210,10 @@
201 <view class='risk_box'> 210 <view class='risk_box'>
202 <view class='risk_item' wx:for='{{risk_list}}' wx:key=''> 211 <view class='risk_item' wx:for='{{risk_list}}' wx:key=''>
203 <view class='iconfont icon-guanbi symool_box' bindtap='deleteRisk' wx:if="{{index>0}}" data-index='{{index}}'></view> 212 <view class='iconfont icon-guanbi symool_box' bindtap='deleteRisk' wx:if="{{index>0}}" data-index='{{index}}'></view>
204 - <view class='item_list'> 213 + <view class='item_list' style=' align-items: flex-start;'>
205 <view class='list_title project'>附加险名称</view> 214 <view class='list_title project'>附加险名称</view>
206 <view class='list_input'> 215 <view class='list_input'>
207 - <input type='text' placeholder='请填写' bindinput='addRiskName' value='{{item.name}}' data-index='{{index}}'></input> 216 + <textarea type='text' placeholder='请填写' bindinput='addRiskName' value='{{item.name}}' data-index='{{index}}'></textarea>
208 </view> 217 </view>
209 </view> 218 </view>
210 <view class='protec_item_box'> 219 <view class='protec_item_box'>
@@ -96,8 +96,8 @@ page { @@ -96,8 +96,8 @@ page {
96 align-items: center; 96 align-items: center;
97 font-size: 29rpx; 97 font-size: 29rpx;
98 } 98 }
99 -.list_input text{  
100 - /* margin-left: 10rpx; */ 99 +.list_input textarea{
  100 + height: 100rpx;
101 } 101 }
102 .icon-riqi { 102 .icon-riqi {
103 font-size: 48rpx; 103 font-size: 48rpx;
@@ -378,8 +378,10 @@ page { @@ -378,8 +378,10 @@ page {
378 } 378 }
379 379
380 .popup_label_box { 380 .popup_label_box {
  381 + width: 45%;
381 display: flex; 382 display: flex;
382 align-items: center; 383 align-items: center;
  384 + justify-content: flex-start;
383 } 385 }
384 386
385 .popup_label_item { 387 .popup_label_item {
@@ -436,7 +438,7 @@ page { @@ -436,7 +438,7 @@ page {
436 } 438 }
437 439
438 .icon-xuanzhongkuang, .icon-fangkuang { 440 .icon-xuanzhongkuang, .icon-fangkuang {
439 - font-size: 38rpx; 441 + font-size: 40rpx;
440 color: #e0e0e0; 442 color: #e0e0e0;
441 } 443 }
442 444
@@ -45,7 +45,7 @@ page { @@ -45,7 +45,7 @@ page {
45 .currentWordNumber { 45 .currentWordNumber {
46 position: absolute; 46 position: absolute;
47 bottom: 30rpx; 47 bottom: 30rpx;
48 - right: 0; 48 + right: 100rpx;
49 color: #999; 49 color: #999;
50 } 50 }
51 51
@@ -35,6 +35,10 @@ @@ -35,6 +35,10 @@
35 <view class='list_title'>主险名称</view> 35 <view class='list_title'>主险名称</view>
36 <view class='list_input'>{{listdetail.main_risks}}</view> 36 <view class='list_input'>{{listdetail.main_risks}}</view>
37 </view> 37 </view>
  38 + <view class='item_list' style=' align-items: flex-start;'>
  39 + <view class='list_title'>主险基本保额</view>
  40 + <view class='list_input'>{{listdetail.coverage}}</view>
  41 + </view>
38 <!-- <view class='item_list' style=' align-items: flex-start;'> 42 <!-- <view class='item_list' style=' align-items: flex-start;'>
39 <view class='list_title'>主险保障项</view> 43 <view class='list_title'>主险保障项</view>
40 <view class='list_input' wx:for='{{listdetail.guarantee}}' wx:key wx:for-item='its'>{{its.name}} {{its.num}}{{its.title}} </view> 44 <view class='list_input' wx:for='{{listdetail.guarantee}}' wx:key wx:for-item='its'>{{its.name}} {{its.num}}{{its.title}} </view>
@@ -314,7 +314,7 @@ Page({ @@ -314,7 +314,7 @@ Page({
314 cid: options.cid, 314 cid: options.cid,
315 })):'' 315 })):''
316 options.mainid?this.setData({ 316 options.mainid?this.setData({
317 - mainid: options.id 317 + mainid: options.mainid
318 }):'' 318 }):''
319 this.getData() 319 this.getData()
320 320