提交 824a8f7938bc3ed58eb19538d3093e48cc762393

作者 wangyu
2 个父辈 85c8f070 608d3d3e

Merge branch 'dev_wy' into dev2.0

@@ -12,9 +12,9 @@ Page({ @@ -12,9 +12,9 @@ Page({
12 legal_entity_id: "", 12 legal_entity_id: "",
13 legal_entity: "", 13 legal_entity: "",
14 house_type: "", 14 house_type: "",
15 - person_total_amount:0, 15 + person_total_amount: 0,
16 remaining_amount: 0, 16 remaining_amount: 0,
17 - input_disable:false, 17 + input_disable: false,
18 declareStatus: { 18 declareStatus: {
19 "to_declare": "待申报", 19 "to_declare": "待申报",
20 "declaring": "申报中", 20 "declaring": "申报中",
@@ -166,20 +166,20 @@ Page({ @@ -166,20 +166,20 @@ Page({
166 handleAddition: function(data) { 166 handleAddition: function(data) {
167 var that = this 167 var that = this
168 var newdata = data.items 168 var newdata = data.items
169 - if (newdata && newdata.length>0){ 169 + if (newdata && newdata.length > 0) {
170 var issinglechild_Data = this.data.issinglechildData; 170 var issinglechild_Data = this.data.issinglechildData;
171 issinglechild_Data.disabled = true; 171 issinglechild_Data.disabled = true;
172 - issinglechild_Data.selected = data.is_single=='y'?"是":"否"; 172 + issinglechild_Data.selected = data.is_single == 'y' ? "是" : "否";
173 173
174 var shareMethod_Data = this.data.shareMethodData; 174 var shareMethod_Data = this.data.shareMethodData;
175 shareMethod_Data.disabled = true; 175 shareMethod_Data.disabled = true;
176 - shareMethod_Data.selected = data.share_method ? data.share_method:""; 176 + shareMethod_Data.selected = data.share_method ? data.share_method : "";
177 177
178 this.setData({ 178 this.setData({
179 issinglechildData: issinglechild_Data, 179 issinglechildData: issinglechild_Data,
180 shareMethodData: shareMethod_Data, 180 shareMethodData: shareMethod_Data,
181 reduce_amount: data.month_deduction_amount ? data.month_deduction_amount : that.data.reduce_amount, 181 reduce_amount: data.month_deduction_amount ? data.month_deduction_amount : that.data.reduce_amount,
182 - input_disable:true 182 + input_disable: true
183 }) 183 })
184 } 184 }
185 for (var i = 0; i < newdata.length; i++) { 185 for (var i = 0; i < newdata.length; i++) {
@@ -210,18 +210,18 @@ Page({ @@ -210,18 +210,18 @@ Page({
210 } 210 }
211 if (newdata[i].rent_end) { 211 if (newdata[i].rent_end) {
212 newdata[i].rent_end = this.formatDate(newdata[i].rent_end) 212 newdata[i].rent_end = this.formatDate(newdata[i].rent_end)
213 - }  
214 - if (newdata[i].loan_start) {//公积金 213 + }
  214 + if (newdata[i].loan_start) { //公积金
215 newdata[i].loan_start = this.formatDate(newdata[i].loan_start) 215 newdata[i].loan_start = this.formatDate(newdata[i].loan_start)
216 - }  
217 - if (newdata[i].sec_loan_start) {//商业 216 + }
  217 + if (newdata[i].sec_loan_start) { //商业
218 newdata[i].sec_loan_start = this.formatDate(newdata[i].sec_loan_start) 218 newdata[i].sec_loan_start = this.formatDate(newdata[i].sec_loan_start)
219 - } 219 + }
220 220
221 newdata[i].children_id_card_no = this.formatIdNum(newdata[i].children_id_card_no) 221 newdata[i].children_id_card_no = this.formatIdNum(newdata[i].children_id_card_no)
222 newdata[i].spouse_id_card_no = this.formatIdNum(newdata[i].spouse_id_card_no) 222 newdata[i].spouse_id_card_no = this.formatIdNum(newdata[i].spouse_id_card_no)
223 newdata[i].id_card_no = this.formatIdNum(newdata[i].id_card_no) 223 newdata[i].id_card_no = this.formatIdNum(newdata[i].id_card_no)
224 - 224 +
225 if (newdata[i].house_address) { 225 if (newdata[i].house_address) {
226 if (newdata[i].house_address.province == newdata[i].house_address.city) { 226 if (newdata[i].house_address.province == newdata[i].house_address.city) {
227 newdata[i].house_address_new = newdata[i].house_address.city + newdata[i].house_address.district 227 newdata[i].house_address_new = newdata[i].house_address.city + newdata[i].house_address.district
@@ -251,7 +251,7 @@ Page({ @@ -251,7 +251,7 @@ Page({
251 console.log("housetype_new", housetype_new) 251 console.log("housetype_new", housetype_new)
252 this.setData({ 252 this.setData({
253 house_type: housetype_new, 253 house_type: housetype_new,
254 - person_total_amount: data.person_total_amount ? data.person_total_amount:0, 254 + person_total_amount: data.person_total_amount ? data.person_total_amount : 0,
255 remaining_amount: data.remaining_amount ? data.remaining_amount : 0, 255 remaining_amount: data.remaining_amount ? data.remaining_amount : 0,
256 additionInfo: newdata 256 additionInfo: newdata
257 }) 257 })
@@ -332,10 +332,15 @@ Page({ @@ -332,10 +332,15 @@ Page({
332 this.showToast("请选择分摊方式") 332 this.showToast("请选择分摊方式")
333 return 333 return
334 } 334 }
335 - if (this.data.reduce_amount == -1){ 335 + if (this.data.reduce_amount == -1) {
336 this.showToast("请输入扣除金额") 336 this.showToast("请输入扣除金额")
337 return 337 return
338 - }else if (this.data.reduce_amount < 0 || this.data.reduce_amount > 1000) { 338 + }
  339 + if (format.checkNumber(this.data.reduce_amount)){
  340 + this.showToast("请输入正确格式")
  341 + return
  342 + }
  343 + if (this.data.reduce_amount < 0 || this.data.reduce_amount > 1000) {
339 this.showToast("本年度月扣除金额不得大于1000") 344 this.showToast("本年度月扣除金额不得大于1000")
340 return 345 return
341 } 346 }
@@ -344,6 +349,7 @@ Page({ @@ -344,6 +349,7 @@ Page({
344 reduce_amount: 2000 349 reduce_amount: 2000
345 }) 350 })
346 } 351 }
  352 + console.log("reduce_amount", this.data.reduce_amount)
347 } 353 }
348 var modalinfo, senddata 354 var modalinfo, senddata
349 if (this.data.cur_status == 'continuing_education' || this.data.cur_status == 'house_fund') { 355 if (this.data.cur_status == 'continuing_education' || this.data.cur_status == 'house_fund') {
@@ -543,7 +549,7 @@ Page({ @@ -543,7 +549,7 @@ Page({
543 formatDate(date) { 549 formatDate(date) {
544 if (date == 0 || date == -62135596800) { 550 if (date == 0 || date == -62135596800) {
545 date = "" 551 date = ""
546 - }else{ 552 + } else {
547 date = format.formatTime_date(date) 553 date = format.formatTime_date(date)
548 } 554 }
549 console.log("formatDate", date) 555 console.log("formatDate", date)
@@ -564,16 +570,20 @@ Page({ @@ -564,16 +570,20 @@ Page({
564 570
565 bindinput: function(e) { 571 bindinput: function(e) {
566 console.log("bindinput", e) 572 console.log("bindinput", e)
567 - var inputamount  
568 - if (e.detail.value && e.detail.value.replace(/\s|\xA0/g, "").length>0){  
569 - inputamount = parseFloat(e.detail.value)+0  
570 - }else{  
571 - inputamount = -1 573 + var inputamount
  574 + if (!e.detail.value || e.detail.value.length < 1 || parseFloat(e.detail.value).toString() == "NaN") {
  575 + this.showToast("请输入正确格式");
  576 + return;
572 } 577 }
  578 +
  579 + if (e.detail.value.length < 1 || !format.checkNumber(e.detail.value)) {
  580 + this.showToast("请输入正确格式");
  581 + return;
  582 + }
  583 +
573 this.setData({ 584 this.setData({
574 reduce_amount: inputamount 585 reduce_amount: inputamount
575 }) 586 })
576 - console.log("reduce_amount", inputamount)  
577 }, 587 },
578 588
579 showToast: function(data) { 589 showToast: function(data) {
@@ -33,14 +33,14 @@ @@ -33,14 +33,14 @@
33 </view> 33 </view>
34 <view wx:else style='height:90rpx'> 34 <view wx:else style='height:90rpx'>
35 <text style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #333;margin-left:26rpx'>本年度月扣除金额</text> 35 <text style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #333;margin-left:26rpx'>本年度月扣除金额</text>
36 - <text class='float_right' style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #ff9f00;' name='country'>{{reduce_amount}}/月</text> 36 + <text class='float_right' style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #ff9f00;' name='country'>¥{{reduce_amount}}/月</text>
37 </view> 37 </view>
38 </view> 38 </view>
39 <view wx:elif="{{issinglechildData.selected=='是'}}"> 39 <view wx:elif="{{issinglechildData.selected=='是'}}">
40 <view class='divide_line_f5f5f5'></view> 40 <view class='divide_line_f5f5f5'></view>
41 <view style='height:90rpx'> 41 <view style='height:90rpx'>
42 <text style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #333;margin-left:26rpx'>本年度月扣除金额</text> 42 <text style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #333;margin-left:26rpx'>本年度月扣除金额</text>
43 - <text class='float_right' style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #ff9f00;' name='country'>2000/月</text> 43 + <text class='float_right' style='line-height: 90rpx;text-align:right;font-size: 30rpx;color: #ff9f00;' name='country'>¥2000/月</text>
44 </view> 44 </view>
45 </view> 45 </view>
46 </view> 46 </view>
@@ -140,6 +140,15 @@ function isMobile(mobile) { @@ -140,6 +140,15 @@ function isMobile(mobile) {
140 return regMobile.test(mobile) 140 return regMobile.test(mobile)
141 } 141 }
142 142
  143 +//验证字符串是否是数字
  144 +function checkNumber(theObj) {
  145 + var reg = /^[0-9]+.?[0-9]*$/;
  146 + if (reg.test(theObj)) {
  147 + return true;
  148 + }
  149 + return false;
  150 +}
  151 +
143 module.exports = { 152 module.exports = {
144 formatTime: formatTime, 153 formatTime: formatTime,
145 formatTime_date: formatTime_date, 154 formatTime_date: formatTime_date,
@@ -151,5 +160,6 @@ module.exports = { @@ -151,5 +160,6 @@ module.exports = {
151 isIDCardNum: isIDCardNum, 160 isIDCardNum: isIDCardNum,
152 curDateTime: curDateTime, 161 curDateTime: curDateTime,
153 analyzeIDCard: analyzeIDCard, 162 analyzeIDCard: analyzeIDCard,
  163 + checkNumber: checkNumber,
154 isMobile: isMobile 164 isMobile: isMobile
155 } 165 }
注册登录 后发表评论