提交 8f20aacfb307c4c888c72d9f048aff2428f20fdc

作者 wangyu
1 个父辈 6f5f3c4b

优化

... ... @@ -37,69 +37,17 @@ Page({
37 37 //获取上一个页面的所有的方法和data中的数据
38 38 var lastpage = pages[pages.length - 2]
39 39 console.log("lastpage", lastpage.data);
40   - this.handleData(options.datas)
  40 + // this.handleData(options.datas)
41 41 this.setData({
42 42 cur_status: options.status,
43   - house_type: lastpage.data.house_type
  43 + house_type: lastpage.data.house_type,
  44 + datas: options.datas?JSON.parse(options.datas):{}
44 45 })
45 46 wx.setNavigationBarTitle({
46 47 title: that.data.additiontitle[options.status],
47 48 })
48 49 },
49 50
50   - handleData: function (data){
51   - var newdata = JSON.parse(data);
52   - if (newdata ){
53   - this.verifyDate(newdata.children_birthday)
54   - this.verifyDate(newdata.spouse_birthday)
55   - this.verifyDate(newdata.education_start)
56   - this.verifyDate(newdata.education_end)
57   - this.verifyDate(newdata.birthday)
58   - this.verifyDate(newdata.rent_start)
59   - this.verifyDate(newdata.rent_end)
60   -
61   - newdata.children_id_card_no = this.formatIdNum(newdata.children_id_card_no)
62   - newdata.spouse_id_card_no = this.formatIdNum(newdata.spouse_id_card_no)
63   - newdata.id_card_no = this.formatIdNum(newdata.id_card_no)
64   -
65   - if (newdata.house_address) {
66   - if (newdata.house_address.province == newdata.house_address.city) {
67   - newdata.house_address_new = newdata.house_address.city + newdata.house_address.district
68   - } else {
69   - newdata.house_address_new = newdata.house_address.province + newdata.house_address.city + newdata.house_address.district
70   - }
71   - }
72   - if (newdata.work_city) {
73   - newdata.work_city_new = newdata.work_city.province + newdata.work_city.city
74   - }
75   - this.setData({
76   - datas: newdata
77   - })
78   - console.log("handleData", this.data.datas)
79   -
80   - }
81   - },
82   -
83   - verifyDate(date){
84   - if (date && date > 0) {
85   - date = format.formatTime_date(date)
86   - } else {
87   - date = ""
88   - }
89   - },
90   -
91   - formatIdNum: function (idnum) {
92   - if (idnum && idnum.length >= 6 && idnum.length < 10) {
93   - idnum = idnum.substring(0, 2) + '****' + idnum.substring(idnum.length - 2, idnum.length);
94   - }
95   - if (idnum && idnum.length >= 10) {
96   - idnum = idnum.substring(0, 4) + '****' + idnum.substring(idnum.length - 4, idnum.length);
97   - }
98   -
99   - console.log("formatIdNum", idnum)
100   - return idnum
101   - },
102   -
103 51 /**
104 52 * Lifecycle function--Called when page is initially rendered
105 53 */
... ...
... ... @@ -98,7 +98,11 @@
98 98 <view style='padding:30rpx' wx:if="{{cur_status=='support_duty'}}">
99 99 <view style='height:90rpx;width:100%;clear:both;'>
100 100 <text class='text_left'>是否独生子女</text>
101   - <text class='text_right_333'>{{datas.is_single=='y'?"是":"否"}}</text>
  101 + <text class='text_right_333'>{{datas.is_single=='n'?"否":"是"}}</text>
  102 + </view>
  103 + <view wx:if="{{datas.is_single=='y'}}" style='height:90rpx;width:100%;clear:both;'>
  104 + <text class='text_left'>分摊方式</text>
  105 + <text class='text_right_333'>{{datas.share_method}}</text>
102 106 </view>
103 107 <view style='height:90rpx;width:100%;clear:both;'>
104 108 <text class='text_left'>被赡养人姓名</text>
... ...
... ... @@ -88,7 +88,7 @@ Page({
88 88 lefttext: "添加家庭成员并申报",
89 89 righttext: "确定为该选择的人申报",
90 90 },
91   - reduce_amount: 0,
  91 + reduce_amount: -1,
92 92 selected_reduceindex: 0,
93 93 selected_addindex: 0
94 94 },
... ... @@ -172,6 +172,26 @@ Page({
172 172 if (newdata[i].patient_birthday) {
173 173 newdata[i].patient_birthday = this.formatDate(newdata[i].patient_birthday)
174 174 }
  175 + //详情迁移
  176 + if (newdata[i].children_birthday) {
  177 + newdata[i].children_birthday = this.formatDate(newdata[i].children_birthday)
  178 + }
  179 + if (newdata[i].spouse_birthday) {
  180 + newdata[i].spouse_birthday = this.formatDate(newdata[i].spouse_birthday)
  181 + }
  182 + if (newdata[i].birthday) {
  183 + newdata[i].birthday = this.formatDate(newdata[i].birthday)
  184 + }
  185 + if (newdata[i].rent_start) {
  186 + newdata[i].rent_start = this.formatDate(newdata[i].rent_start)
  187 + }
  188 + if (newdata[i].rent_end) {
  189 + newdata[i].rent_end = this.formatDate(newdata[i].rent_end)
  190 + }
  191 +
  192 + newdata[i].children_id_card_no = this.formatIdNum(newdata[i].children_id_card_no)
  193 + newdata[i].spouse_id_card_no = this.formatIdNum(newdata[i].spouse_id_card_no)
  194 + newdata[i].id_card_no = this.formatIdNum(newdata[i].id_card_no)
175 195
176 196 if (newdata[i].house_address) {
177 197 if (newdata[i].house_address.province == newdata[i].house_address.city) {
... ... @@ -180,6 +200,11 @@ Page({
180 200 newdata[i].house_address_new = newdata[i].house_address.province + newdata[i].house_address.city + newdata[i].house_address.district
181 201 }
182 202 }
  203 +
  204 + if (newdata[i].work_city) {
  205 + newdata[i].work_city_new = newdata[i].work_city.province + newdata[i].work_city.city
  206 + }
  207 +
183 208 if (newdata[i].co_supporters && newdata[i].co_supporters.length > 0) {
184 209 for (var j = 0; j < newdata[i].co_supporters.length; j++) {
185 210 if (newdata[i].co_supporters[j].birthday) {
... ... @@ -188,7 +213,6 @@ Page({
188 213 newdata[i].co_supporters[j].id_card_no = this.formatIdNum(newdata[i].co_supporters[j].id_card_no)
189 214 }
190 215 }
191   - newdata[i].id_card_no = this.formatIdNum(newdata[i].id_card_no)
192 216 }
193 217
194 218 var housetype_new = this.data.house_type
... ... @@ -277,7 +301,10 @@ Page({
277 301 this.showToast("请选择分摊方式")
278 302 return
279 303 }
280   - if (this.data.reduce_amount < 1 || this.data.reduce_amount > 1000) {
  304 + if (this.data.reduce_amount == -1){
  305 + this.showToast("请输入扣除金额")
  306 + return
  307 + }else if (this.data.reduce_amount < 1 || this.data.reduce_amount > 1000) {
281 308 this.showToast("本年度月扣除金额不得大于1000")
282 309 return
283 310 }
... ... @@ -506,11 +533,15 @@ Page({
506 533
507 534 bindinput: function(e) {
508 535 console.log("bindinput", e)
  536 + var inputamount
509 537 if (e.detail.value && e.detail.value.replace(/\s+/g, "").length>0){
510   - this.setData({
511   - reduce_amount: parseFloat(e.detail.value)
512   - })
  538 + inputamount = parseFloat(e.detail.value)+0
  539 + }else{
  540 + inputamount = -1
513 541 }
  542 + this.setData({
  543 + reduce_amount: inputamount
  544 + })
514 545 },
515 546
516 547 showToast: function(data) {
... ...
注册登录 后发表评论