作者 刘晓艳

添加保单

1 // pages/Suggest/Suggest.js 1 // pages/Suggest/Suggest.js
2 -const app=getApp(); 2 +const app = getApp();
3 Page({ 3 Page({
4 4
5 /** 5 /**
6 * 页面的初始数据 6 * 页面的初始数据
7 */ 7 */
8 data: { 8 data: {
9 - list:[] 9 + list: []
10 }, 10 },
11 - setcontent(e){  
12 - let list =this.data.list; 11 + setcontent(e) {
  12 + let list = this.data.list;
13 list.content = e.detail.value; 13 list.content = e.detail.value;
14 this.setData({ 14 this.setData({
15 - list:list 15 + list: list
16 }) 16 })
17 }, 17 },
18 - setreprt(e){ 18 + setreprt(e) {
19 let list = this.data.list; 19 let list = this.data.list;
20 list.report = e.detail.value; 20 list.report = e.detail.value;
21 this.setData({ 21 this.setData({
22 list: list 22 list: list
23 }) 23 })
24 }, 24 },
  25 +
25 //查看预设建议列表 26 //查看预设建议列表
26 - getAdviseLook(){  
27 - let that=this;  
28 - let url ='counselor/AdviseLook'; 27 + getAdviseLook() {
  28 + let that = this;
  29 + let url = 'counselor/AdviseLook';
29 app.post(url, { 30 app.post(url, {
30 userId: app.globalData.UserId 31 userId: app.globalData.UserId
31 - // userId: 166  
32 - }).then((res)=>{  
33 - if(res.data.code==200){ 32 + }).then((res) => {
  33 + if (res.data.code == 200) {
34 that.setData({ 34 that.setData({
35 - list:res.data.data 35 + list: res.data.data
36 }) 36 })
37 } 37 }
38 - }).catch((err)=>{ 38 + }).catch((err) => {
39 console.log(err) 39 console.log(err)
40 }) 40 })
41 }, 41 },
42 - save_btn(){  
43 - let that=this;  
44 - let url ='counselor/AdviseSave';  
45 - let params={  
46 - userId: app.globalData.UserId,  
47 42
  43 + save_btn() {
  44 + let that = this;
  45 + let url = 'counselor/AdviseSave';
  46 + let params = {
  47 + userId: app.globalData.UserId,
48 report: that.data.list.report, 48 report: that.data.list.report,
49 advise: that.data.list.content 49 advise: that.data.list.content
50 } 50 }
51 - app.post(url,params).then((res)=>{ 51 + app.post(url, params).then((res) => {
52 console.log(res) 52 console.log(res)
53 - if(res.data.code==200){ 53 + if (res.data.code == 200) {
54 wx.showToast({ 54 wx.showToast({
55 title: '保存成功', 55 title: '保存成功',
56 icon: 'none', 56 icon: 'none',
57 - duration:2000, 57 + duration: 2000,
58 }) 58 })
59 - setTimeout(function(){ 59 + setTimeout(function() {
60 wx.navigateBack({ 60 wx.navigateBack({
61 delta: 1, 61 delta: 1,
62 }) 62 })
63 - },1000) 63 + }, 1000)
64 } 64 }
65 - }).catch((err)=>{ 65 + }).catch((err) => {
66 console.log(err) 66 console.log(err)
67 }) 67 })
68 68
@@ -71,22 +71,22 @@ Page({ @@ -71,22 +71,22 @@ Page({
71 /** 71 /**
72 * 生命周期函数--监听页面加载 72 * 生命周期函数--监听页面加载
73 */ 73 */
74 - onLoad: function (options) {  
75 - let that=this; 74 + onLoad: function(options) {
  75 + let that = this;
76 that.getAdviseLook(); 76 that.getAdviseLook();
77 }, 77 },
78 78
79 /** 79 /**
80 * 生命周期函数--监听页面初次渲染完成 80 * 生命周期函数--监听页面初次渲染完成
81 */ 81 */
82 - onReady: function () { 82 + onReady: function() {
83 83
84 }, 84 },
85 85
86 /** 86 /**
87 * 生命周期函数--监听页面显示 87 * 生命周期函数--监听页面显示
88 */ 88 */
89 - onShow: function () { 89 + onShow: function() {
90 let that = this; 90 let that = this;
91 that.getAdviseLook(); 91 that.getAdviseLook();
92 }, 92 },
@@ -94,35 +94,35 @@ Page({ @@ -94,35 +94,35 @@ Page({
94 /** 94 /**
95 * 生命周期函数--监听页面隐藏 95 * 生命周期函数--监听页面隐藏
96 */ 96 */
97 - onHide: function () { 97 + onHide: function() {
98 98
99 }, 99 },
100 100
101 /** 101 /**
102 * 生命周期函数--监听页面卸载 102 * 生命周期函数--监听页面卸载
103 */ 103 */
104 - onUnload: function () { 104 + onUnload: function() {
105 105
106 }, 106 },
107 107
108 /** 108 /**
109 * 页面相关事件处理函数--监听用户下拉动作 109 * 页面相关事件处理函数--监听用户下拉动作
110 */ 110 */
111 - onPullDownRefresh: function () { 111 + onPullDownRefresh: function() {
112 112
113 }, 113 },
114 114
115 /** 115 /**
116 * 页面上拉触底事件的处理函数 116 * 页面上拉触底事件的处理函数
117 */ 117 */
118 - onReachBottom: function () { 118 + onReachBottom: function() {
119 119
120 }, 120 },
121 121
122 /** 122 /**
123 * 用户点击右上角分享 123 * 用户点击右上角分享
124 */ 124 */
125 - onShareAppMessage: function () { 125 + onShareAppMessage: function() {
126 126
127 } 127 }
128 }) 128 })
@@ -8,9 +8,9 @@ @@ -8,9 +8,9 @@
8 </view> 8 </view>
9 <view class='line_box'></view> 9 <view class='line_box'></view>
10 <view class='content_box'> 10 <view class='content_box'>
11 - <view class='list_title'>体检报告预设</view> 11 + <view class='list_title'>建议预设</view>
12 <view class='list_input'> 12 <view class='list_input'>
13 - <textarea placeholder='请输入预设的体检报告' bindinput='setreprt' placeholder-class='pl_style' 13 + <textarea placeholder='请输入预设的建议' bindinput='setreprt' placeholder-class='pl_style'
14 value='{{list.report}}'></textarea> 14 value='{{list.report}}'></textarea>
15 </view> 15 </view>
16 </view> 16 </view>
1 // pages/VipRecharge/VipRecharge.js 1 // pages/VipRecharge/VipRecharge.js
2 -const app=getApp(); 2 +const app = getApp();
3 Page({ 3 Page({
4 4
5 /** 5 /**
6 * 页面的初始数据 6 * 页面的初始数据
7 */ 7 */
8 data: { 8 data: {
9 - viplist:[],  
10 - toplist:[],  
11 - mainlist:[] 9 + viplist: [],
  10 + toplist: [],
  11 + mainlist: []
12 }, 12 },
  13 +
13 //选择支付方式 14 //选择支付方式
14 buyWay(e) { 15 buyWay(e) {
15 console.log(e) 16 console.log(e)
@@ -17,18 +18,19 @@ Page({ @@ -17,18 +18,19 @@ Page({
17 url: '../payWay/payWay?id=' + e.currentTarget.id + '&moneyt=' + e.currentTarget.dataset.moneyt, 18 url: '../payWay/payWay?id=' + e.currentTarget.id + '&moneyt=' + e.currentTarget.dataset.moneyt,
18 }) 19 })
19 }, 20 },
20 - getvip(){  
21 - let that=this;  
22 - let url ='counselor/vip';  
23 - app.post(url,{}).then((res)=>{  
24 - if(res.data.code==200){ 21 +
  22 + getvip() {
  23 + let that = this;
  24 + let url = 'counselor/vip';
  25 + app.post(url, {}).then((res) => {
  26 + if (res.data.code == 200) {
25 let viplist = res.data.data.viplist; 27 let viplist = res.data.data.viplist;
26 - let toplist=[];  
27 - let mainlist=[];  
28 - for (let obj of viplist){  
29 - if (obj.status==1){ 28 + let toplist = [];
  29 + let mainlist = [];
  30 + for (let obj of viplist) {
  31 + if (obj.status == 1) {
30 mainlist.push(obj) 32 mainlist.push(obj)
31 - } else if (obj.status == 2){ 33 + } else if (obj.status == 2) {
32 toplist.push(obj) 34 toplist.push(obj)
33 } 35 }
34 } 36 }
@@ -39,7 +41,7 @@ Page({ @@ -39,7 +41,7 @@ Page({
39 }) 41 })
40 42
41 } 43 }
42 - }).catch((err)=>{ 44 + }).catch((err) => {
43 console.log(err) 45 console.log(err)
44 }) 46 })
45 47
@@ -63,7 +65,7 @@ Page({ @@ -63,7 +65,7 @@ Page({
63 * 生命周期函数--监听页面显示 65 * 生命周期函数--监听页面显示
64 */ 66 */
65 onShow: function() { 67 onShow: function() {
66 - let that=this; 68 + let that = this;
67 that.getvip(); 69 that.getvip();
68 70
69 }, 71 },
@@ -21,7 +21,8 @@ Page({ @@ -21,7 +21,8 @@ Page({
21 name: ['受益人1', '受益人2'], 21 name: ['受益人1', '受益人2'],
22 unit: '' 22 unit: ''
23 }], 23 }],
24 - tempfavoree: [], 24 + tempfavoree: [], // 已选择的受益人
  25 + beneficiaryList: [],
25 beneficiaryindex: -1, 26 beneficiaryindex: -1,
26 beneficiary_name: '', 27 beneficiary_name: '',
27 imgs: [], 28 imgs: [],
@@ -36,7 +37,8 @@ Page({ @@ -36,7 +37,8 @@ Page({
36 risk_list: [{ 37 risk_list: [{
37 name: '', 38 name: '',
38 projectlist: [], 39 projectlist: [],
39 - project_time: '' 40 + project_time: '',
  41 + time: 1
40 }], 42 }],
41 main_array: [], 43 main_array: [],
42 warranty_one: [], 44 warranty_one: [],
@@ -45,6 +47,7 @@ Page({ @@ -45,6 +47,7 @@ Page({
45 long_money: [], 47 long_money: [],
46 time_name: '', 48 time_name: '',
47 type_money: '', 49 type_money: '',
  50 +
48 }, 51 },
49 52
50 //投保人 53 //投保人
@@ -206,6 +209,7 @@ Page({ @@ -206,6 +209,7 @@ Page({
206 var main_array = [] 209 var main_array = []
207 var projectlist = Object.assign(this.data.projectlist, {}) 210 var projectlist = Object.assign(this.data.projectlist, {})
208 for (var i = 0; i < projectlist.length; i++) { 211 for (var i = 0; i < projectlist.length; i++) {
  212 +
209 if (projectlist[i].choose_status) { 213 if (projectlist[i].choose_status) {
210 main_array.push(projectlist[i]) 214 main_array.push(projectlist[i])
211 } 215 }
@@ -216,17 +220,20 @@ Page({ @@ -216,17 +220,20 @@ Page({
216 title: '添加成功', 220 title: '添加成功',
217 icon: 'none' 221 icon: 'none'
218 }) 222 })
  223 +
219 if (type == 'fujiaxian') { 224 if (type == 'fujiaxian') {
220 let tempRist = that.data.risk_list; 225 let tempRist = that.data.risk_list;
221 tempRist[index]['projectlist'] = main_array; 226 tempRist[index]['projectlist'] = main_array;
222 that.setData({ 227 that.setData({
223 risk_list: tempRist, 228 risk_list: tempRist,
224 }) 229 })
  230 +
225 } else { 231 } else {
226 that.setData({ 232 that.setData({
227 main_array: main_array, 233 main_array: main_array,
228 }) 234 })
229 } 235 }
  236 +
230 console.log(this.data.main_array) 237 console.log(this.data.main_array)
231 // var temp = main_array 238 // var temp = main_array
232 // for (var i = 0; i < main_array.length; i++) { 239 // for (var i = 0; i < main_array.length; i++) {
@@ -280,22 +287,42 @@ Page({ @@ -280,22 +287,42 @@ Page({
280 beneficiarySelect(e) { 287 beneficiarySelect(e) {
281 // console.log(e) 288 // console.log(e)
282 var index = e.currentTarget.dataset.mindex 289 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 - } 290 + var beneficiary_list = Object.assign(this.data.beneficiary_list, {});
  291 + // 获取当前已选择的收益人
  292 + let tempBenefice = Object.assign(this.data.beneficiaryList, {})
  293 + // 当前选择的收益人
  294 + let nowPerson = beneficiary_list[index].name[e.detail.value];
  295 + // 判断受益人是否已经添加
  296 + const add = tempBenefice.every((tempBenefice) => {
  297 + return tempBenefice != nowPerson
  298 + })
  299 + console.log()
  300 + if (add) {
  301 + beneficiary_list[index].beneficiary_name = nowPerson;
  302 + tempBenefice.push(nowPerson)
  303 + } else {
  304 + wx.showToast({
  305 + title: '请不要重复添加受益人',
  306 + icon: 'none'
  307 + })
290 } 308 }
  309 + // for (var i = 0; i < beneficiary_list.length; i++) {
  310 + // for (var j = 0; j < beneficiary_list[i].name.length; j++) {
  311 + // var beneficiary_name =
  312 +
  313 + // beneficiary_list[index].beneficiary_name = beneficiary_list[i].name[e.detail.value]
  314 + // // console.log(beneficiary_list)
  315 + // }
  316 + // }
291 317
292 // let tempRangArry = this.data.rang_beneficiary; 318 // let tempRangArry = this.data.rang_beneficiary;
293 // tempRangArry[index] = beneficiary_list[index].name[e.detail.value] 319 // tempRangArry[index] = beneficiary_list[index].name[e.detail.value]
294 // console.log(tempRangArry) 320 // console.log(tempRangArry)
295 321
296 this.setData({ 322 this.setData({
297 - beneficiaryindex: e.detail.value,  
298 - beneficiary_list: beneficiary_list 323 +
  324 + beneficiary_list: beneficiary_list,
  325 + beneficiaryList: tempBenefice
299 }) 326 })
300 327
301 }, 328 },
@@ -303,7 +330,6 @@ Page({ @@ -303,7 +330,6 @@ Page({
303 330
304 //添加收益比例 331 //添加收益比例
305 addUnit(e) { 332 addUnit(e) {
306 - // console.log(e)  
307 var beneficiary_list = this.data.beneficiary_list; 333 var beneficiary_list = this.data.beneficiary_list;
308 beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value; 334 beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;
309 this.setData({ 335 this.setData({
@@ -339,31 +365,48 @@ Page({ @@ -339,31 +365,48 @@ Page({
339 }, 365 },
340 366
341 //重组添加受益人 367 //重组添加受益人
  368 +
342 tempBeneficiary() { 369 tempBeneficiary() {
343 var beneficiary_list = this.data.beneficiary_list 370 var beneficiary_list = this.data.beneficiary_list
344 - var tempfavoree = this.data.tempfavoree  
345 - var temp = {}  
346 - var len = beneficiary_list.length 371 + var len = beneficiary_list.length;
  372 + var tempfavoree1 = [];
347 for (var i = 0; i < beneficiary_list.length; i++) { 373 for (var i = 0; i < beneficiary_list.length; i++) {
  374 + var temp = {}
348 if (beneficiary_list[i].unit != '') { 375 if (beneficiary_list[i].unit != '') {
349 temp.name = beneficiary_list[i].beneficiary_name 376 temp.name = beneficiary_list[i].beneficiary_name
350 - temp.unit = beneficiary_list[i].unit  
351 - tempfavoree.push(temp)  
352 - }  
353 - var hash = {};  
354 - var temrecommend = tempfavoree.reduce(function(item, next) {  
355 - hash[next.name] ? '' : hash[next.name] = true && item.push(next);  
356 - return item  
357 - }, [])  
358 - // console.log(temrecommend) 377 + temp.unit = beneficiary_list[i].unit;
  378 + }
  379 + tempfavoree1.push(temp)
  380 + // var hash = {};
  381 + // var temrecommend = tempfavoree.reduce(function (item, next) {
  382 + // hash[next.name] ? '' : hash[next.name] = true && item.push(next);
  383 + // return item
  384 + // }, [])
  385 +
359 this.setData({ 386 this.setData({
360 - tempfavoree: temrecommend 387 + tempfavoree: tempfavoree1
361 }) 388 })
362 389
363 } 390 }
364 }, 391 },
365 392
366 393
  394 + //删除收益人
  395 + deletebenefict(e) {
  396 + let index = e.currentTarget.dataset.index;
  397 + let tempbenefict = Object.assign(this.data.beneficiary_list, {});
  398 + let beneficiaryList = Object.assign(this.data.beneficiaryList, {});
  399 + // 获取当前选项的受益人
  400 + let person = tempbenefict[index].beneficiary_name;
  401 + tempbenefict.splice(index, 1);
  402 + if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)
  403 +
  404 + this.setData({
  405 + beneficiaryList: beneficiaryList,
  406 + beneficiary_list: tempbenefict
  407 + })
  408 + },
  409 +
367 //添加附加险 410 //添加附加险
368 addRisk() { 411 addRisk() {
369 var risk_list = Object.assign(this.data.risk_list, {}); 412 var risk_list = Object.assign(this.data.risk_list, {});
@@ -371,13 +414,23 @@ Page({ @@ -371,13 +414,23 @@ Page({
371 risk_list[len] = { 414 risk_list[len] = {
372 name: '', 415 name: '',
373 projectlist: [], 416 projectlist: [],
374 - project_time: '' 417 + project_time: '',
  418 + time: ''
375 } 419 }
376 this.setData({ 420 this.setData({
377 risk_list: risk_list 421 risk_list: risk_list
378 }) 422 })
379 }, 423 },
380 424
  425 + //删除附加险
  426 + deleteRisk(e) {
  427 + let index = e.currentTarget.dataset.index;
  428 + let risk_list = Object.assign(this.data.risk_list, {});
  429 + risk_list.splice(index, 1);
  430 + this.setData({
  431 + risk_list: risk_list
  432 + })
  433 + },
381 //上传图片 434 //上传图片
382 uploadImage() { 435 uploadImage() {
383 let that = this; 436 let that = this;
@@ -503,7 +556,7 @@ Page({ @@ -503,7 +556,7 @@ Page({
503 var warranty_two = this.data.warranty_two 556 var warranty_two = this.data.warranty_two
504 warranty_two.num = guarantee_name 557 warranty_two.num = guarantee_name
505 warranty_two.title = unit 558 warranty_two.title = unit
506 - // console.log(warranty_two) 559 +
507 this.setData({ 560 this.setData({
508 warranty_two: warranty_two 561 warranty_two: warranty_two
509 }) 562 })
@@ -533,54 +586,53 @@ Page({ @@ -533,54 +586,53 @@ Page({
533 var long_money = this.data.long_money 586 var long_money = this.data.long_money
534 long_money.num = time_name 587 long_money.num = time_name
535 long_money.title = unit 588 long_money.title = unit
536 - console.log(long_money) 589 + // console.log(long_money)
537 this.setData({ 590 this.setData({
538 long_money: long_money 591 long_money: long_money
539 }) 592 })
540 }, 593 },
541 594
542 595
543 - //计算缴费期满日 596 + //计算缴费期满日,主线保障其
544 countImpletionTime() { 597 countImpletionTime() {
545 var time_name = parseInt(this.data.time_name) 598 var time_name = parseInt(this.data.time_name)
546 var unit = this.data.unit2 599 var unit = this.data.unit2
547 var compact_time = this.data.compact_time 600 var compact_time = this.data.compact_time
548 var year = parseInt(new Date(compact_time).getFullYear()) 601 var year = parseInt(new Date(compact_time).getFullYear())
549 - var month = parseInt(new Date(compact_time).getMonth()) 602 + var month = parseInt(new Date(compact_time).getMonth() + 1)
550 var day = parseInt(new Date(compact_time).getDate()) 603 var day = parseInt(new Date(compact_time).getDate())
551 - var runnian = ''  
552 - var cha='' 604 + var impletion_time = this.data.impletion_time
  605 + var warranty_one = this.data.warranty_one
553 606
554 - var birthday='1995-04-20' 607 + var tempbirth_time = ''
  608 + var birthday = '1995-04-20'
555 var birthday_year = parseInt(new Date(birthday).getFullYear()) 609 var birthday_year = parseInt(new Date(birthday).getFullYear())
556 - var tempbirth_time=''  
557 -  
558 if (unit == '年') { 610 if (unit == '年') {
  611 + var temp_year = (year + time_name)
  612 + var temp_day = day - 1
  613 + if (month < 10) month = "0" + month;
  614 + if (temp_day < 10) temp_day = "0" + temp_day;
  615 + impletion_time = temp_year + '-' + month + '-' + temp_day
  616 + warranty_one = temp_year + '-' + month + '-' + temp_day
  617 + } else if (unit == '岁') {
559 618
560 - var millSeconds = Math.abs(nDate) - (1 * 24 * 60 * 60 * 1000);  
561 -  
562 - // runnian = parseInt(time_name / 4)  
563 - // cha = time_name - runnian  
564 - // var dateTemp = compact_time.split("-");  
565 - // var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);  
566 - // var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);  
567 - // var rDate = new Date(millSeconds);  
568 - // var year = rDate.getFullYear();  
569 - // var month = rDate.getMonth() + 1;  
570 -  
571 - // if (month < 10) month = "0" + month;  
572 - // var date = rDate.getDate();  
573 - // if (date < 10) date = "0" + date;  
574 - // console.log(year + "-" + month + "-" + date);  
575 -  
576 - }else if(unit=='岁'){  
577 var temp_year = (birthday_year + time_name - 1) 619 var temp_year = (birthday_year + time_name - 1)
  620 + var temp_year2 = (birthday_year + time_name)
578 var temp_month = month 621 var temp_month = month
579 - tempbirth_time = temp_year + '-' + temp_month + '-'+day  
580 - console.log(tempbirth_time)  
581 - 622 + if (temp_month < 10) temp_month = "0" + temp_month;
  623 + if (month < 10) month = "0" + month;
  624 + if (day < 10) day = "0" + day;
  625 + impletion_time = temp_year + '-' + temp_month + '-' + day
  626 + warranty_one = temp_year2 + '-' + month + '-' + day
582 627
  628 + } else if (unit == '终身') {
  629 + impletion_time = '终身缴费'
  630 + warranty_one = '终身'
583 } 631 }
  632 + this.setData({
  633 + impletion_time: impletion_time,
  634 + warranty_one: warranty_one
  635 + })
584 }, 636 },
585 637
586 //缴费方式 638 //缴费方式
@@ -593,9 +645,12 @@ Page({ @@ -593,9 +645,12 @@ Page({
593 }, 645 },
594 646
595 selectUnit4(e) { 647 selectUnit4(e) {
596 - var unit = e.currentTarget.dataset.unit 648 + var unit = e.currentTarget.dataset.unit;
  649 + let index = e.currentTarget.dataset.index;
  650 + let risk_list = Object.assign(this.data.risk_list, {});
  651 + risk_list[index].time = unit
597 this.setData({ 652 this.setData({
598 - unit4: unit 653 + risk_list: risk_list
599 }) 654 })
600 }, 655 },
601 656
@@ -604,28 +659,29 @@ Page({ @@ -604,28 +659,29 @@ Page({
604 this.tempBeneficiary() 659 this.tempBeneficiary()
605 this.tempWarranty() 660 this.tempWarranty()
606 this.tempburningTime() 661 this.tempburningTime()
  662 +
  663 +
607 var warn = ""; //弹框时提示的内容 664 var warn = ""; //弹框时提示的内容
608 var flag = true; //判断信息输入是否完整判断弹窗 665 var flag = true; //判断信息输入是否完整判断弹窗
  666 +
609 var in_num = e.detail.value.policy_num 667 var in_num = e.detail.value.policy_num
610 var firm = e.detail.value.company; 668 var firm = e.detail.value.company;
611 var applicant = this.data.applicant_name 669 var applicant = this.data.applicant_name
612 var recognizee = this.data.recognizee_name 670 var recognizee = this.data.recognizee_name
613 var favoree = this.data.tempfavoree 671 var favoree = this.data.tempfavoree
614 - var main_risks = e.detail.value.main_risks  
615 - var year_money = e.detail.value.year_money  
616 var compact_time = this.data.compact_time 672 var compact_time = this.data.compact_time
  673 + var impletion_time = this.data.impletion_time
  674 + var warranty_one = this.data.main_array
617 var warranty_two = this.data.warranty_two 675 var warranty_two = this.data.warranty_two
  676 + var bank = e.detail.value.bank
  677 + var bank_num = e.detail.value.bank_num
618 var type_money = this.data.type_money 678 var type_money = this.data.type_money
  679 + var long_money = this.data.long_money
  680 + var year_money = e.detail.value.year_money
  681 + // var coverage = e.detail.value.base_money
  682 + var main_risks = e.detail.value.main_risks
619 683
620 -  
621 - var warranty_one = this.data.main_array  
622 - var impletion_time = this.data.impletion_time  
623 var warranty = e.detail.value.Guarantee_period 684 var warranty = e.detail.value.Guarantee_period
624 - var bank = e.detail.value.Renew_bank  
625 - var bank_num = e.detail.value.renew_num  
626 -  
627 -  
628 - var coverage = e.detail.value.base_money  
629 var picurl = JSON.stringify(this.data.imgs) 685 var picurl = JSON.stringify(this.data.imgs)
630 var guarantee = JSON.stringify(this.data.selectitem) //保障项目 686 var guarantee = JSON.stringify(this.data.selectitem) //保障项目
631 var more = JSON.stringify(this.data.addlist) 687 var more = JSON.stringify(this.data.addlist)
@@ -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>
@@ -270,12 +271,17 @@ @@ -270,12 +271,17 @@
270 </view> 271 </view>
271 </block> 272 </block>
272 <block wx:else> --> 273 <block wx:else> -->
273 - <view class='list_input'> 274 +
  275 +<view class='list_input'>
  276 + <input type='text' placeholder='自动计算' name='warranty_one' value='{{warranty_one}}'></input>
  277 + </view>
  278 +
  279 + <!-- <view class='list_input'>
274 <picker class='picker' range='{{period_time}}' value='{{period_index}}' bindchange='periodTime'> 280 <picker class='picker' range='{{period_time}}' value='{{period_index}}' bindchange='periodTime'>
275 - <input placeholder='自动计算' value='{{period_time[period_index]}}' disabled='true'></input> 281 + <input placeholder='自动计算' value='{{warranty_one}}' disabled='true'></input>
276 </picker> 282 </picker>
277 - <!-- <text class='iconfont icon-riqi'></text> -->  
278 - </view> 283 + <!-- <text class='iconfont icon-riqi'></text>
  284 + </view> -->
279 <!-- </block> --> 285 <!-- </block> -->
280 </view> 286 </view>
281 </view> 287 </view>
@@ -284,7 +290,7 @@ @@ -284,7 +290,7 @@
284 <!-- wx:for='{{addlist}}' wx:key='' --> 290 <!-- wx:for='{{addlist}}' wx:key='' -->
285 <view class='risk_box'> 291 <view class='risk_box'>
286 <view class='risk_item' wx:for='{{risk_list}}' wx:key=''> 292 <view class='risk_item' wx:for='{{risk_list}}' wx:key=''>
287 - <view class='iconfont icon-guanbi symool_box' bindtap='deleteRisk' data-index='{{index}}'></view> 293 + <view class='iconfont icon-guanbi symool_box' bindtap='deleteRisk' wx:if="{{index>0}}" data-index='{{index}}'></view>
288 <view class='item_list'> 294 <view class='item_list'>
289 <view class='list_title project'>附加险名称</view> 295 <view class='list_title project'>附加险名称</view>
290 <view class='list_input'> 296 <view class='list_input'>
@@ -297,14 +303,6 @@ @@ -297,14 +303,6 @@
297 <view>{{project.name}}</view> 303 <view>{{project.name}}</view>
298 <view class='protec_num'>{{project.num}}<block wx:for='{{project.title}}' wx:for-item='danwei' wx:key=''><text wx:if="{{danwei.label_state}}">{{danwei.name}}</text></block></view> 304 <view class='protec_num'>{{project.num}}<block wx:for='{{project.title}}' wx:for-item='danwei' wx:key=''><text wx:if="{{danwei.label_state}}">{{danwei.name}}</text></block></view>
299 </view> 305 </view>
300 - <!-- <view class='protec_item'>  
301 - <view>轻症重大疾病</view>  
302 - <view class='protec_num'>50万</view>  
303 - </view>  
304 - <view class='protec_item'>  
305 - <view>轻症重大疾病</view>  
306 - <view class='protec_num'>50万</view>  
307 - </view> -->  
308 </view> 306 </view>
309 <view class='protec_bottom_box'> 307 <view class='protec_bottom_box'>
310 <view class='add_risk_btn protec_btn' bindtap='ensureProject' data-type='fujiaxian' data-xulie='{{index}}'> 308 <view class='add_risk_btn protec_btn' bindtap='ensureProject' data-type='fujiaxian' data-xulie='{{index}}'>
@@ -320,9 +318,9 @@ @@ -320,9 +318,9 @@
320 <input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}'></input> 318 <input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}'></input>
321 </view> 319 </view>
322 <view class='list_label_box'> 320 <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> 321 + <view class="list_label_item {{item.time==10?'list_label_active':''}}" bindtap='selectUnit4' data-index="{{index}}" data-unit='10'>年</view>
  322 + <view class="list_label_item {{item.time==11?'list_label_active':''}}" bindtap='selectUnit4' data-index="{{index}}" data-unit='11'>岁 </view>
  323 + <view class="list_label_item {{item.time==12?'list_label_active':''}}" bindtap='selectUnit4' data-index="{{index}}" data-unit='12'>终身</view>
326 </view> 324 </view>
327 </view> 325 </view>
328 </view> 326 </view>
@@ -481,3 +481,11 @@ page { @@ -481,3 +481,11 @@ 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 + margin-top:-10rpx;
  490 +
  491 +}
1 // pages/index/payWay/payWay.js 1 // pages/index/payWay/payWay.js
  2 +const app = getApp();
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
  9 + VipId: '',
  10 + moneyt: '',
  11 + title: '',
  12 + PayType: 1, //1为余额支付2为微信支付
  13 + balance: '',
  14 + Page: 0,
  15 + },
  16 + setpaytype1() {
  17 + this.setData({
  18 + PayType: 1
  19 + })
  20 + },
  21 + setpaytype2() {
  22 + this.setData({
  23 + PayType: 2
  24 + })
  25 + },
  26 + // 立即支付
  27 + gopay() {
  28 + let url = 'counselor/gopay';
  29 + let that = this;
  30 + app.post(url, {
  31 + VipId: that.data.VipId,
  32 + PayType: that.data.PayType,
  33 + UserId: app.globalData.UserId
  34 + }).then((res) => {
  35 + console.log(res)
  36 + if (res.data.code == 200) {
  37 + if (res.data.data.type == 1) { //1订单写入成功,-1订单写入失败,-2余额不足
  38 + if (res.data.data.data != undefined) { //调用微信支付接口
  39 + console.log("微信支付")
  40 + console.log(res.data.data.data)
  41 + wx.requestPayment({
  42 + 'timeStamp': res.data.data.data.timeStamp,
  43 + 'nonceStr': res.data.data.data.nonceStr,
  44 + 'package': res.data.data.data.package,
  45 + 'signType': res.data.data.data.signType,
  46 + 'paySign': res.data.data.data.paySign,
  47 + 'success': (res) => {
  48 + wx.showToast({
  49 + title: '支付成功',
  50 + icon: 'success',
  51 + duration: 2000
  52 + })
  53 + setTimeout(function() {
  54 + //要延时执行的代码
  55 + wx.navigateBack({
  56 + delta: 2
  57 + })
  58 + }, 2000)
  59 + },
  60 + 'fail': function(res) {
  61 + console.log(res)
  62 + }
  63 + })
  64 + } else {
  65 + wx.showToast({
  66 + title: '支付成功',
  67 + icon: 'success',
  68 + duration: 2000
  69 + })
  70 +
  71 + setTimeout(function() {
  72 + //要延时执行的代码
  73 + wx.navigateBack({
  74 + delta: 2
  75 + })
  76 + }, 2000)
8 77
  78 + }
  79 + } else if (res.data.data.type == -2) {
  80 + wx.showToast({
  81 + title: '余额不足,请选择其他支付方式',
  82 + icon: 'none',
  83 + duration: 2000
  84 + })
  85 + } else if (res.data.data.type == -1) {
  86 + wx.showToast({
  87 + title: '购买失败',
  88 + icon: 'none',
  89 + duration: 2000
  90 + })
  91 + }
  92 +
  93 + }
  94 + }).catch((errMsg) => {
  95 + console.log(errMsg)
  96 + })
9 }, 97 },
10 98
  99 +
  100 + // 调取TB接口
  101 + TB() {
  102 + let url = 'counselor/tlist'
  103 + let params = {
  104 + UserId: app.globalData.UserId,
  105 + Page: this.data.Page
  106 + }
  107 + app.post(url, params).then((res) => {
  108 + console.log(res)
  109 + if (res.data.code == 200) {
  110 + this.setData({
  111 + balance: Math.round(res.data.data.balance)
  112 + })
  113 +
  114 + }
  115 + })
  116 + },
  117 +
  118 +
11 /** 119 /**
12 * 生命周期函数--监听页面加载 120 * 生命周期函数--监听页面加载
13 */ 121 */
14 - onLoad: function (options) {  
15 - 122 + onLoad: function(options) {
  123 + let that = this;
  124 + that.setData({
  125 + VipId: options.id,
  126 + moneyt: options.moneyt,
  127 + title: options.title
  128 + })
  129 + this.TB()
16 }, 130 },
17 131
18 /** 132 /**
19 * 生命周期函数--监听页面初次渲染完成 133 * 生命周期函数--监听页面初次渲染完成
20 */ 134 */
21 - onReady: function () { 135 + onReady: function() {
22 136
23 }, 137 },
24 138
25 /** 139 /**
26 * 生命周期函数--监听页面显示 140 * 生命周期函数--监听页面显示
27 */ 141 */
28 - onShow: function () { 142 + onShow: function() {
29 143
30 }, 144 },
31 145
32 /** 146 /**
33 * 生命周期函数--监听页面隐藏 147 * 生命周期函数--监听页面隐藏
34 */ 148 */
35 - onHide: function () { 149 + onHide: function() {
36 150
37 }, 151 },
38 152
39 /** 153 /**
40 * 生命周期函数--监听页面卸载 154 * 生命周期函数--监听页面卸载
41 */ 155 */
42 - onUnload: function () { 156 + onUnload: function() {
43 157
44 }, 158 },
45 159
46 /** 160 /**
47 * 页面相关事件处理函数--监听用户下拉动作 161 * 页面相关事件处理函数--监听用户下拉动作
48 */ 162 */
49 - onPullDownRefresh: function () { 163 + onPullDownRefresh: function() {
50 164
51 }, 165 },
52 166
53 /** 167 /**
54 * 页面上拉触底事件的处理函数 168 * 页面上拉触底事件的处理函数
55 */ 169 */
56 - onReachBottom: function () { 170 + onReachBottom: function() {
57 171
58 }, 172 },
59 173
60 /** 174 /**
61 * 用户点击右上角分享 175 * 用户点击右上角分享
62 */ 176 */
63 - onShareAppMessage: function () { 177 + onShareAppMessage: function() {
64 178
65 } 179 }
66 }) 180 })
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <view class='banner_box' id='{{VipId}}'> 2 <view class='banner_box' id='{{VipId}}'>
3 <view>{{title}}</view> 3 <view>{{title}}</view>
4 <!-- <text class='money'>100</text> 元 </view>--> 4 <!-- <text class='money'>100</text> 元 </view>-->
5 - <view class='banner_hint'>返{{backt}}T币</view> 5 + <view class='banner_hint'>返{{moneyt}}T币</view>
6 </view> 6 </view>
7 <view class='content_item'> 7 <view class='content_item'>
8 <view class='item_list' bindtap='setpaytype1' > 8 <view class='item_list' bindtap='setpaytype1' >
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 "list": [] 36 "list": []
37 }, 37 },
38 "miniprogram": { 38 "miniprogram": {
39 - "current": 1, 39 + "current": 2,
40 "list": [ 40 "list": [
41 { 41 {
42 "id": -1, 42 "id": -1,
@@ -47,7 +47,13 @@ @@ -47,7 +47,13 @@
47 { 47 {
48 "id": -1, 48 "id": -1,
49 "name": "保单添加", 49 "name": "保单添加",
50 - "pathName": "pages/index/addListDetail/addListDetail" 50 + "pathName": "pages/index/addListDetail/addListDetail",
  51 + "query": ""
  52 + },
  53 + {
  54 + "id": -1,
  55 + "name": "a",
  56 + "pathName": "pages/index/Suggest/Suggest"
51 } 57 }
52 ] 58 ]
53 } 59 }