作者 朱振飞

合并分支 'Branch_zhu' 到 'master'

Branch zhu

冲突修改

查看合并请求 !1
@@ -21,8 +21,8 @@ Page({ @@ -21,8 +21,8 @@ Page({
21 name: ['受益人1', '受益人2'], 21 name: ['受益人1', '受益人2'],
22 unit: '' 22 unit: ''
23 }], 23 }],
24 - tempfavoree: [],  
25 - beneficiaryindex: -1, 24 + tempfavoree: [],// 已选择的受益人
  25 + beneficiaryList:[], beneficiaryindex: -1,
26 beneficiary_name: '', 26 beneficiary_name: '',
27 imgs: [], 27 imgs: [],
28 main_risk: [], 28 main_risk: [],
@@ -33,10 +33,11 @@ Page({ @@ -33,10 +33,11 @@ Page({
33 applicant_name: '', 33 applicant_name: '',
34 recognizee_name: '', 34 recognizee_name: '',
35 rang_beneficiary: [], 35 rang_beneficiary: [],
36 - risk_list: [{  
37 - name: '',  
38 - projectlist: [],  
39 - project_time: '' 36 + risk_list:[{
  37 + name:'',
  38 + projectlist:[],
  39 + project_time:'',
  40 + time: 1
40 }], 41 }],
41 main_array: [], 42 main_array: [],
42 warranty_one: [], 43 warranty_one: [],
@@ -206,6 +207,7 @@ Page({ @@ -206,6 +207,7 @@ Page({
206 var main_array = [] 207 var main_array = []
207 var projectlist = Object.assign(this.data.projectlist, {}) 208 var projectlist = Object.assign(this.data.projectlist, {})
208 for (var i = 0; i < projectlist.length; i++) { 209 for (var i = 0; i < projectlist.length; i++) {
  210 +
209 if (projectlist[i].choose_status) { 211 if (projectlist[i].choose_status) {
210 main_array.push(projectlist[i]) 212 main_array.push(projectlist[i])
211 } 213 }
@@ -216,17 +218,20 @@ Page({ @@ -216,17 +218,20 @@ Page({
216 title: '添加成功', 218 title: '添加成功',
217 icon: 'none' 219 icon: 'none'
218 }) 220 })
  221 +
219 if (type == 'fujiaxian') { 222 if (type == 'fujiaxian') {
220 let tempRist = that.data.risk_list; 223 let tempRist = that.data.risk_list;
221 tempRist[index]['projectlist'] = main_array; 224 tempRist[index]['projectlist'] = main_array;
222 that.setData({ 225 that.setData({
223 risk_list: tempRist, 226 risk_list: tempRist,
224 }) 227 })
  228 +
225 } else { 229 } else {
226 that.setData({ 230 that.setData({
227 main_array: main_array, 231 main_array: main_array,
228 }) 232 })
229 } 233 }
  234 +
230 console.log(this.data.main_array) 235 console.log(this.data.main_array)
231 // var temp = main_array 236 // var temp = main_array
232 // for (var i = 0; i < main_array.length; i++) { 237 // for (var i = 0; i < main_array.length; i++) {
@@ -280,22 +285,43 @@ Page({ @@ -280,22 +285,43 @@ Page({
280 beneficiarySelect(e) { 285 beneficiarySelect(e) {
281 // console.log(e) 286 // console.log(e)
282 var index = e.currentTarget.dataset.mindex 287 var index = e.currentTarget.dataset.mindex
283 - var beneficiary_list = this.data.beneficiary_list;  
284 - for (var i = 0; i < beneficiary_list.length; i++) {  
285 - for (var j = 0; j < beneficiary_list[i].name.length; j++) {  
286 - var beneficiary_name = beneficiary_list[i].name[e.detail.value]  
287 - beneficiary_list[index].beneficiary_name = beneficiary_name  
288 - // console.log(beneficiary_list)  
289 - } 288 +
  289 + var beneficiary_list = Object.assign(this.data.beneficiary_list,{});
  290 + // 获取当前已选择的收益人
  291 + let tempBenefice = Object.assign(this.data.beneficiaryList,{})
  292 + // 当前选择的收益人
  293 + let nowPerson = beneficiary_list[index].name[e.detail.value];
  294 + // 判断受益人是否已经添加
  295 + const add = tempBenefice.every((tempBenefice)=>{
  296 + return tempBenefice != nowPerson
  297 + })
  298 + console.log()
  299 + if(add){
  300 + beneficiary_list[index].beneficiary_name = nowPerson;
  301 + tempBenefice.push(nowPerson)
  302 + }else{
  303 + wx.showToast({
  304 + title: '请不要重复添加受益人',
  305 + icon: 'none'
  306 + })
290 } 307 }
  308 + // for (var i = 0; i < beneficiary_list.length; i++) {
  309 + // for (var j = 0; j < beneficiary_list[i].name.length; j++) {
  310 + // var beneficiary_name =
  311 +
  312 + // beneficiary_list[index].beneficiary_name = beneficiary_list[i].name[e.detail.value]
  313 + // // console.log(beneficiary_list)
  314 + // }
  315 + // }
291 316
292 // let tempRangArry = this.data.rang_beneficiary; 317 // let tempRangArry = this.data.rang_beneficiary;
293 // tempRangArry[index] = beneficiary_list[index].name[e.detail.value] 318 // tempRangArry[index] = beneficiary_list[index].name[e.detail.value]
294 // console.log(tempRangArry) 319 // console.log(tempRangArry)
295 320
296 this.setData({ 321 this.setData({
297 - beneficiaryindex: e.detail.value,  
298 - beneficiary_list: beneficiary_list 322 +
  323 + beneficiary_list: beneficiary_list,
  324 + beneficiaryList: tempBenefice
299 }) 325 })
300 326
301 }, 327 },
@@ -337,7 +363,6 @@ Page({ @@ -337,7 +363,6 @@ Page({
337 }) 363 })
338 console.log(this.data.beneficiary_list) 364 console.log(this.data.beneficiary_list)
339 }, 365 },
340 -  
341 //重组添加受益人 366 //重组添加受益人
342 tempBeneficiary() { 367 tempBeneficiary() {
343 var beneficiary_list = this.data.beneficiary_list 368 var beneficiary_list = this.data.beneficiary_list
@@ -364,6 +389,21 @@ Page({ @@ -364,6 +389,21 @@ Page({
364 }, 389 },
365 390
366 391
  392 +//删除收益人
  393 + deletebenefict(e){
  394 + let index = e.currentTarget.dataset.index;
  395 + let tempbenefict = Object.assign(this.data.beneficiary_list, {});
  396 + let beneficiaryList = Object.assign(this.data.beneficiaryList,{});
  397 + // 获取当前选项的受益人
  398 + let person = tempbenefict[index].beneficiary_name;
  399 + tempbenefict.splice(index, 1);
  400 + if (person) beneficiaryList.splice(beneficiaryList.indexOf(person),1)
  401 +
  402 + this.setData({
  403 + beneficiaryList: beneficiaryList,
  404 + beneficiary_list: tempbenefict
  405 + })
  406 + },
367 //添加附加险 407 //添加附加险
368 addRisk() { 408 addRisk() {
369 var risk_list = Object.assign(this.data.risk_list, {}); 409 var risk_list = Object.assign(this.data.risk_list, {});
@@ -371,20 +411,29 @@ Page({ @@ -371,20 +411,29 @@ Page({
371 risk_list[len] = { 411 risk_list[len] = {
372 name: '', 412 name: '',
373 projectlist: [], 413 projectlist: [],
374 - project_time: '' 414 + project_time: '',
  415 + time:''
375 } 416 }
376 this.setData({ 417 this.setData({
377 risk_list: risk_list 418 risk_list: risk_list
378 }) 419 })
379 }, 420 },
380 - 421 + //删除附加险
  422 + deleteRisk(e) {
  423 + let index = e.currentTarget.dataset.index;
  424 + let risk_list = Object.assign(this.data.risk_list, {});
  425 + risk_list.splice(index, 1);
  426 + this.setData({
  427 + risk_list: risk_list
  428 + })
  429 + },
381 //上传图片 430 //上传图片
382 uploadImage() { 431 uploadImage() {
383 let that = this; 432 let that = this;
384 wx.chooseImage({ 433 wx.chooseImage({
385 count: 6, 434 count: 6,
386 sizeType: ['original', 'compressed'], 435 sizeType: ['original', 'compressed'],
387 - success: function(res) { 436 + success: function (res) {
388 let successUp = 0; //成功个数 437 let successUp = 0; //成功个数
389 let failUp = 0; //失败个数 438 let failUp = 0; //失败个数
390 let i = 0; //第几个 439 let i = 0; //第几个
@@ -396,7 +445,7 @@ Page({ @@ -396,7 +445,7 @@ Page({
396 }) 445 })
397 that.uploadAllfile(tempFilePaths, successUp, failUp, i, length) 446 that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)
398 }, 447 },
399 - fail: function(res) {} 448 + fail: function (res) { }
400 }) 449 })
401 }, 450 },
402 451
@@ -412,7 +461,7 @@ Page({ @@ -412,7 +461,7 @@ Page({
412 'strtime': strtime, 461 'strtime': strtime,
413 'token': app.strTime(strtime) 462 'token': app.strTime(strtime)
414 }, 463 },
415 - success: function(res) { 464 + success: function (res) {
416 wx.hideNavigationBarLoading() 465 wx.hideNavigationBarLoading()
417 wx.hideLoading() 466 wx.hideLoading()
418 if (res.statusCode == '200') { 467 if (res.statusCode == '200') {
@@ -443,7 +492,7 @@ Page({ @@ -443,7 +492,7 @@ Page({
443 }) 492 })
444 } 493 }
445 }, 494 },
446 - fail: function(res) { 495 + fail: function (res) {
447 wx.hideNavigationBarLoading() 496 wx.hideNavigationBarLoading()
448 wx.hideLoading() 497 wx.hideLoading()
449 }, 498 },
@@ -480,14 +529,6 @@ Page({ @@ -480,14 +529,6 @@ Page({
480 }); 529 });
481 }, 530 },
482 531
483 - //保障期  
484 - warrantyTwo(e) {  
485 - var guarantee_name = e.detail.value  
486 - this.setData({  
487 - guarantee_name: guarantee_name  
488 - })  
489 - },  
490 -  
491 //选择各项单位 532 //选择各项单位
492 selectUnit(e) { 533 selectUnit(e) {
493 var unit = e.currentTarget.dataset.unit 534 var unit = e.currentTarget.dataset.unit
@@ -496,124 +537,61 @@ Page({ @@ -496,124 +537,61 @@ Page({
496 }) 537 })
497 }, 538 },
498 539
499 - //重组保障期数据格式  
500 - tempWarranty() {  
501 - var guarantee_name = this.data.guarantee_name  
502 - var unit = this.data.unit  
503 - var warranty_two = this.data.warranty_two  
504 - warranty_two.num = guarantee_name  
505 - warranty_two.title = unit  
506 - // console.log(warranty_two)  
507 - this.setData({  
508 - warranty_two: warranty_two  
509 - })  
510 - },  
511 -  
512 - //缴费时长  
513 - burningTime(e) {  
514 - var time_name = e.detail.value  
515 - this.setData({  
516 - time_name: time_name  
517 - })  
518 - this.countImpletionTime()  
519 - },  
520 -  
521 selectUnit2(e) { 540 selectUnit2(e) {
522 var unit = e.currentTarget.dataset.unit 541 var unit = e.currentTarget.dataset.unit
523 this.setData({ 542 this.setData({
524 unit2: unit 543 unit2: unit
525 }) 544 })
526 - this.countImpletionTime()  
527 }, 545 },
528 546
529 - //重组缴费时长数据格式  
530 - tempburningTime() {  
531 - var time_name = this.data.time_name  
532 - var unit = this.data.unit2  
533 - var long_money = this.data.long_money  
534 - long_money.num = time_name  
535 - long_money.title = unit  
536 - console.log(long_money)  
537 - this.setData({  
538 - long_money: long_money  
539 - })  
540 - },  
541 -  
542 -  
543 - //计算缴费期满日  
544 - countImpletionTime() {  
545 - var time_name = parseInt(this.data.time_name)  
546 - var unit = this.data.unit2  
547 - var compact_time = this.data.compact_time  
548 - var year = parseInt(new Date(compact_time).getFullYear())  
549 - var month = parseInt(new Date(compact_time).getMonth())  
550 - var day = parseInt(new Date(compact_time).getDate())  
551 - var runnian = ''  
552 - var cha=''  
553 -  
554 - var birthday='1995-04-20'  
555 - var birthday_year = parseInt(new Date(birthday).getFullYear())  
556 -  
557 - if (unit == '年') {  
558 - runnian = parseInt(time_name / 4)  
559 - cha = time_name - runnian  
560 - var dateTemp = compact_time.split("-");  
561 - var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);  
562 - var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);  
563 - var rDate = new Date(millSeconds);  
564 - var year = rDate.getFullYear();  
565 - var month = rDate.getMonth() + 1;  
566 - if (month < 10) month = "0" + month;  
567 - var date = rDate.getDate();  
568 - if (date < 10) date = "0" + date;  
569 - console.log(year + "-" + month + "-" + date);  
570 - }else if(unit=='岁'){  
571 -  
572 - }  
573 - },  
574 -  
575 - //缴费方式  
576 selectUnit3(e) { 547 selectUnit3(e) {
577 var unit = e.currentTarget.dataset.unit 548 var unit = e.currentTarget.dataset.unit
578 this.setData({ 549 this.setData({
579 - unit3: unit,  
580 - type_money: unit 550 + unit3: unit
581 }) 551 })
582 }, 552 },
583 553
584 selectUnit4(e) { 554 selectUnit4(e) {
585 - var unit = e.currentTarget.dataset.unit 555 + var unit = e.currentTarget.dataset.unit;
  556 + let index = e.currentTarget.dataset.index;
  557 + let risk_list = Object.assign(this.data.risk_list, {});
  558 + risk_list[index].time = unit
586 this.setData({ 559 this.setData({
587 - unit4: unit 560 + risk_list: risk_list
588 }) 561 })
589 }, 562 },
590 563
591 // 保单验证&&上传保单 564 // 保单验证&&上传保单
592 listVerify(e) { 565 listVerify(e) {
593 - this.tempBeneficiary()  
594 - this.tempWarranty()  
595 - this.tempburningTime() 566 + // this.insureItem()
  567 + // var addlist = this.data.addlist
  568 + // if (addlist[0].name != '') {
  569 + // var name = addlist[addlist.length - 1].name
  570 + // var num = addlist[addlist.length - 1].num
  571 + // var title = addlist[addlist.length - 1].title
  572 + // if (name == '' || num == '' || title == '') {
  573 + // addlist.pop()
  574 + // this.setData({
  575 + // addlist: addlist
  576 + // })
  577 + // }
  578 + // }
596 var warn = ""; //弹框时提示的内容 579 var warn = ""; //弹框时提示的内容
597 var flag = true; //判断信息输入是否完整判断弹窗 580 var flag = true; //判断信息输入是否完整判断弹窗
598 var in_num = e.detail.value.policy_num 581 var in_num = e.detail.value.policy_num
599 var firm = e.detail.value.company; 582 var firm = e.detail.value.company;
600 var applicant = this.data.applicant_name 583 var applicant = this.data.applicant_name
601 var recognizee = this.data.recognizee_name 584 var recognizee = this.data.recognizee_name
602 - var favoree = this.data.tempfavoree  
603 - var main_risks = e.detail.value.main_risks  
604 - var year_money = e.detail.value.year_money  
605 - var compact_time = this.data.compact_time  
606 - var warranty_two = this.data.warranty_two  
607 - var type_money = this.data.type_money  
608 585
  586 + var favoree = this.data.favoreename
609 587
610 - var warranty_one = this.data.main_array 588 + var compact_time = this.data.compact_time
611 var impletion_time = this.data.impletion_time 589 var impletion_time = this.data.impletion_time
612 var warranty = e.detail.value.Guarantee_period 590 var warranty = e.detail.value.Guarantee_period
613 var bank = e.detail.value.Renew_bank 591 var bank = e.detail.value.Renew_bank
614 var bank_num = e.detail.value.renew_num 592 var bank_num = e.detail.value.renew_num
615 -  
616 - 593 + var year_money = e.detail.value.year_money
  594 + var main_risks = e.detail.value.main_risks
617 var coverage = e.detail.value.base_money 595 var coverage = e.detail.value.base_money
618 var picurl = JSON.stringify(this.data.imgs) 596 var picurl = JSON.stringify(this.data.imgs)
619 var guarantee = JSON.stringify(this.data.selectitem) //保障项目 597 var guarantee = JSON.stringify(this.data.selectitem) //保障项目
@@ -798,56 +776,56 @@ Page({ @@ -798,56 +776,56 @@ Page({
798 /** 776 /**
799 * 生命周期函数--监听页面加载 777 * 生命周期函数--监听页面加载
800 */ 778 */
801 - onLoad: function(options) { 779 + onLoad: function (options) {
802 this.ensureProjectList() 780 this.ensureProjectList()
803 }, 781 },
804 782
805 /** 783 /**
806 * 生命周期函数--监听页面初次渲染完成 784 * 生命周期函数--监听页面初次渲染完成
807 */ 785 */
808 - onReady: function() { 786 + onReady: function () {
809 787
810 }, 788 },
811 789
812 /** 790 /**
813 * 生命周期函数--监听页面显示 791 * 生命周期函数--监听页面显示
814 */ 792 */
815 - onShow: function() { 793 + onShow: function () {
816 794
817 }, 795 },
818 796
819 /** 797 /**
820 * 生命周期函数--监听页面隐藏 798 * 生命周期函数--监听页面隐藏
821 */ 799 */
822 - onHide: function() { 800 + onHide: function () {
823 801
824 }, 802 },
825 803
826 /** 804 /**
827 * 生命周期函数--监听页面卸载 805 * 生命周期函数--监听页面卸载
828 */ 806 */
829 - onUnload: function() { 807 + onUnload: function () {
830 808
831 }, 809 },
832 810
833 /** 811 /**
834 * 页面相关事件处理函数--监听用户下拉动作 812 * 页面相关事件处理函数--监听用户下拉动作
835 */ 813 */
836 - onPullDownRefresh: function() { 814 + onPullDownRefresh: function () {
837 815
838 }, 816 },
839 817
840 /** 818 /**
841 * 页面上拉触底事件的处理函数 819 * 页面上拉触底事件的处理函数
842 */ 820 */
843 - onReachBottom: function() { 821 + onReachBottom: function () {
844 822
845 }, 823 },
846 824
847 /** 825 /**
848 * 用户点击右上角分享 826 * 用户点击右上角分享
849 */ 827 */
850 - onShareAppMessage: function() { 828 + onShareAppMessage: function () {
851 829
852 } 830 }
853 }) 831 })
@@ -105,8 +105,9 @@ @@ -105,8 +105,9 @@
105 <input class='income_input' type='text' placeholder='受益比例%' name='beneficiary' value='{{item.unit}}' bindinput='addUnit'></input> 105 <input class='income_input' type='text' placeholder='受益比例%' name='beneficiary' value='{{item.unit}}' bindinput='addUnit'></input>
106 </view> 106 </view>
107 </view> 107 </view>
  108 + <view class='iconfont icon-guanbi shouyi' bindtap='deletebenefict' wx:if="{{its>0}}" data-index='{{its}}'></view>
108 </view> 109 </view>
109 - <view class='iconfont icon-wuuiconxiangjifangda add_person' data-mindex='{{its}}' data-sindex='{{index}}' bindtap='addPersons'> 110 + <view class='iconfont icon-wuuiconxiangjifangda add_person' wx:if="{{beneficiary_list.length<beneficiary_list[0].name.length}}" data-mindex='{{its}}' data-sindex='{{index}}' bindtap='addPersons'>
110 <text>添加受益人</text> 111 <text>添加受益人</text>
111 </view> 112 </view>
112 </view> 113 </view>
@@ -284,7 +285,7 @@ @@ -284,7 +285,7 @@
284 <!-- wx:for='{{addlist}}' wx:key='' --> 285 <!-- wx:for='{{addlist}}' wx:key='' -->
285 <view class='risk_box'> 286 <view class='risk_box'>
286 <view class='risk_item' wx:for='{{risk_list}}' wx:key=''> 287 <view class='risk_item' wx:for='{{risk_list}}' wx:key=''>
287 - <view class='iconfont icon-guanbi symool_box' bindtap='deleteRisk' data-index='{{index}}'></view> 288 + <view class='iconfont icon-guanbi symool_box' bindtap='deleteRisk' wx:if="{{index>0}}" data-index='{{index}}'></view>
288 <view class='item_list'> 289 <view class='item_list'>
289 <view class='list_title project'>附加险名称</view> 290 <view class='list_title project'>附加险名称</view>
290 <view class='list_input'> 291 <view class='list_input'>
@@ -320,9 +321,9 @@ @@ -320,9 +321,9 @@
320 <input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}'></input> 321 <input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}'></input>
321 </view> 322 </view>
322 <view class='list_label_box'> 323 <view class='list_label_box'>
323 - <view class="list_label_item {{unit4==10?'list_label_active':''}}" bindtap='selectUnit4' data-unit='10'>年</view>  
324 - <view class="list_label_item {{unit4==11?'list_label_active':''}}" bindtap='selectUnit4' data-unit='11'>岁 </view>  
325 - <view class="list_label_item {{unit4==12?'list_label_active':''}}" bindtap='selectUnit4' data-unit='12'>终身</view> 324 + <view class="list_label_item {{item.time==10?'list_label_active':''}}" bindtap='selectUnit4' data-index="{{index}}" data-unit='10'>年</view>
  325 + <view class="list_label_item {{item.time==11?'list_label_active':''}}" bindtap='selectUnit4' data-index="{{index}}" data-unit='11'>岁 </view>
  326 + <view class="list_label_item {{item.time==12?'list_label_active':''}}" bindtap='selectUnit4' data-index="{{index}}" data-unit='12'>终身</view>
326 </view> 327 </view>
327 </view> 328 </view>
328 </view> 329 </view>
@@ -481,3 +481,9 @@ page { @@ -481,3 +481,9 @@ page {
481 color: #999; 481 color: #999;
482 margin-left: 15rpx; 482 margin-left: 15rpx;
483 } 483 }
  484 +.icon-guanbi.shouyi{
  485 + position: unset;
  486 + margin-left: 22rpx;
  487 + font-size: 22rpx;
  488 + align-self: flex-start;
  489 +}