...
|
...
|
@@ -3,7 +3,7 @@ var format = require('../../../utils/util.js'); |
3
|
3
|
var app = getApp();
|
4
|
4
|
var baseUrl = app.globalData.baseUrl;
|
5
|
5
|
Page({
|
6
|
|
-
|
|
6
|
+
|
7
|
7
|
/**
|
8
|
8
|
* 页面的初始数据
|
9
|
9
|
*/
|
...
|
...
|
@@ -21,7 +21,10 @@ Page({ |
21
|
21
|
name: '',
|
22
|
22
|
mobile: '',
|
23
|
23
|
birthday: '',
|
24
|
|
- id_error:false,
|
|
24
|
+ id_error: false,
|
|
25
|
+ curAddress_haschanged:false,
|
|
26
|
+ birthAddress_haschanged: false,
|
|
27
|
+ contactAddress_haschanged: false,
|
25
|
28
|
card_number: '',
|
26
|
29
|
long_birth_date: 0,
|
27
|
30
|
long_start_date: 0,
|
...
|
...
|
@@ -164,6 +167,7 @@ Page({ |
164
|
167
|
selected: '',
|
165
|
168
|
mode: "date",
|
166
|
169
|
fields: "day",
|
|
170
|
+ start:'1949-01-01',
|
167
|
171
|
onChange: 'birthdayChange',
|
168
|
172
|
},
|
169
|
173
|
startDate: {
|
...
|
...
|
@@ -173,6 +177,7 @@ Page({ |
173
|
177
|
selected: '',
|
174
|
178
|
mode: "date",
|
175
|
179
|
fields: "day",
|
|
180
|
+ start: '1990-01-01',
|
176
|
181
|
onChange: 'startChange',
|
177
|
182
|
},
|
178
|
183
|
endDate: {
|
...
|
...
|
@@ -182,6 +187,7 @@ Page({ |
182
|
187
|
selected: '',
|
183
|
188
|
mode: "date",
|
184
|
189
|
fields: "day",
|
|
190
|
+ start: '2010-01-01',
|
185
|
191
|
onChange: 'endChange',
|
186
|
192
|
},
|
187
|
193
|
// 地址选择器
|
...
|
...
|
@@ -233,6 +239,9 @@ Page({ |
233
|
239
|
|
234
|
240
|
getpersonalTax: function(id) {
|
235
|
241
|
var that = this
|
|
242
|
+ wx.showLoading({
|
|
243
|
+ title: '',
|
|
244
|
+ })
|
236
|
245
|
var Authorization = app.globalData.Authorization;
|
237
|
246
|
wx.request({
|
238
|
247
|
url: baseUrl + 'persontax/v1/personal-taxes/' + id,
|
...
|
...
|
@@ -251,12 +260,19 @@ Page({ |
251
|
260
|
},
|
252
|
261
|
fail(res) {
|
253
|
262
|
console.log(res)
|
|
263
|
+ wx.hideLoading()
|
|
264
|
+ },
|
|
265
|
+ complete() {
|
|
266
|
+ wx.hideLoading()
|
254
|
267
|
}
|
255
|
268
|
})
|
256
|
269
|
},
|
257
|
270
|
|
258
|
271
|
//对各参数初始赋值
|
259
|
272
|
handleDatas: function() {
|
|
273
|
+ //todo
|
|
274
|
+ // var curdate = format.getNowFormatDate()
|
|
275
|
+ console.log('curdate', curdate)
|
260
|
276
|
var tax_info = this.data.taxInfo
|
261
|
277
|
this.data.name = tax_info.name
|
262
|
278
|
this.data.relativeData.selected = tax_info.family_ties
|
...
|
...
|
@@ -292,6 +308,7 @@ Page({ |
292
|
308
|
investInfo: this.data.investInfo,
|
293
|
309
|
specificIndustryInfo: this.data.specificIndustryInfo,
|
294
|
310
|
genderData: this.data.genderData,
|
|
311
|
+ bankInfo: this.data.bankInfo,
|
295
|
312
|
|
296
|
313
|
professionData: this.data.professionData,
|
297
|
314
|
degreeData: this.data.degreeData,
|
...
|
...
|
@@ -310,10 +327,11 @@ Page({ |
310
|
327
|
startDate: this.data.startDate,
|
311
|
328
|
long_end_date: tax_info.separate_date,
|
312
|
329
|
endDate: this.data.endDate,
|
313
|
|
- isIdCard: '居民身份证' == tax_info.id_card_type?true:false,
|
|
330
|
+ isIdCard: '居民身份证' == tax_info.id_card_type ? true : false,
|
314
|
331
|
card_number: this.data.card_number
|
315
|
332
|
|
316
|
333
|
})
|
|
334
|
+
|
317
|
335
|
},
|
318
|
336
|
|
319
|
337
|
getproffessiondata: function() {
|
...
|
...
|
@@ -337,6 +355,9 @@ Page({ |
337
|
355
|
},
|
338
|
356
|
fail(res) {
|
339
|
357
|
console.log(res)
|
|
358
|
+ },
|
|
359
|
+ complete() {
|
|
360
|
+ wx.hideLoading()
|
340
|
361
|
}
|
341
|
362
|
})
|
342
|
363
|
},
|
...
|
...
|
@@ -418,6 +439,9 @@ Page({ |
418
|
439
|
},
|
419
|
440
|
fail(res) {
|
420
|
441
|
console.log(res)
|
|
442
|
+ },
|
|
443
|
+ complete() {
|
|
444
|
+ wx.hideLoading()
|
421
|
445
|
}
|
422
|
446
|
})
|
423
|
447
|
},
|
...
|
...
|
@@ -440,12 +464,12 @@ Page({ |
440
|
464
|
/**
|
441
|
465
|
* 生命周期函数--监听页面显示
|
442
|
466
|
*/
|
443
|
|
- onShow: function () {
|
|
467
|
+ onShow: function() {
|
444
|
468
|
var that = this
|
445
|
469
|
var id_error = this.data.id_error
|
446
|
470
|
wx.getStorage({
|
447
|
471
|
key: 'id_info',
|
448
|
|
- success: function (res) {
|
|
472
|
+ success: function(res) {
|
449
|
473
|
console.log('id_info', res.data)
|
450
|
474
|
if (res.data && res.data.length > 0) {
|
451
|
475
|
var id_info = JSON.parse(res.data)
|
...
|
...
|
@@ -483,7 +507,7 @@ Page({ |
483
|
507
|
})
|
484
|
508
|
wx.removeStorage({
|
485
|
509
|
key: 'id_info',
|
486
|
|
- success: function (res) {
|
|
510
|
+ success: function(res) {
|
487
|
511
|
console.log('remove_idinfo', res)
|
488
|
512
|
},
|
489
|
513
|
})
|
...
|
...
|
@@ -668,18 +692,20 @@ Page({ |
668
|
692
|
contact_address.address_value = e.detail.value
|
669
|
693
|
contact_address.address_code = e.detail.code
|
670
|
694
|
this.setData({
|
|
695
|
+ contactAddress_haschanged:true,
|
671
|
696
|
contactaddressInfo: contact_address
|
672
|
697
|
})
|
673
|
698
|
console.log('contactaddressInfo', this.data.contactaddressInfo)
|
674
|
699
|
},
|
675
|
700
|
|
676
|
701
|
currentAddressSelect: function(e) {
|
677
|
|
- // console.log('currentAddressSelect', e)
|
|
702
|
+ console.log('currentAddressSelect', e)
|
678
|
703
|
var current_address = this.data.currentaddressInfo;
|
679
|
704
|
current_address.selected = e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
|
680
|
705
|
current_address.address_value = e.detail.value
|
681
|
706
|
current_address.address_code = e.detail.code
|
682
|
707
|
this.setData({
|
|
708
|
+ curAddress_haschanged:true,
|
683
|
709
|
currentaddressInfo: current_address
|
684
|
710
|
})
|
685
|
711
|
},
|
...
|
...
|
@@ -691,6 +717,7 @@ Page({ |
691
|
717
|
birth_address.address_value = e.detail.value
|
692
|
718
|
birth_address.address_code = e.detail.code
|
693
|
719
|
this.setData({
|
|
720
|
+ birthAddress_haschanged: true,
|
694
|
721
|
birthaddressInfo: birth_address
|
695
|
722
|
})
|
696
|
723
|
console.log('birthaddressInfo', this.data.birthaddressInfo)
|
...
|
...
|
@@ -714,7 +741,7 @@ Page({ |
714
|
741
|
var formdata = e.detail.value;
|
715
|
742
|
console.log("formdata", formdata)
|
716
|
743
|
console.log("card_number", this.data.card_number)
|
717
|
|
- if (this.data.name&&this.data.name.length < 1 && formdata.name.length < 1) {
|
|
744
|
+ if (this.data.name && this.data.name.length < 1 && formdata.name.length < 1) {
|
718
|
745
|
this.showtoast('请输入姓名');
|
719
|
746
|
return
|
720
|
747
|
} else if (!this.data.isself && this.data.relativeData.selected.length < 1) {
|
...
|
...
|
@@ -760,6 +787,9 @@ Page({ |
760
|
787
|
var formdata = data
|
761
|
788
|
console.log("form_data", formdata);
|
762
|
789
|
var request_profession = that.getProfessionRequest()
|
|
790
|
+ var request_contact_address = that.getContactAddressRequest()
|
|
791
|
+ var request_current_address = that.getCurrentAddressRequest()
|
|
792
|
+ var request_birth_address = that.getBirthAddressRequest()
|
763
|
793
|
var Authorization = app.globalData.Authorization;
|
764
|
794
|
wx.request({
|
765
|
795
|
url: baseUrl + 'persontax/v1/personal-taxes/' + that.data.cur_id,
|
...
|
...
|
@@ -774,7 +804,7 @@ Page({ |
774
|
804
|
"birth_date": that.data.long_birth_date,
|
775
|
805
|
"profession": request_profession,
|
776
|
806
|
"education": that.data.degreeData.selected,
|
777
|
|
- "taxpayer_no": formdata.taxpayer_no ? formdata.taxpayer_no : '',
|
|
807
|
+ "taxpayer_no": formdata.taxpayer_no ? formdata.taxpayer_no : that.data.taxInfo.taxpayer_no,
|
778
|
808
|
"taxpayer_status": that.data.personstatusData.selected,
|
779
|
809
|
"is_martyr_family": that.data.lieshuInfo.selected,
|
780
|
810
|
"martyr_family_no": formdata.martyr_family_no,
|
...
|
...
|
@@ -783,33 +813,12 @@ Page({ |
783
|
813
|
"is_lonely_man": that.data.lonelyolderInfo.selected,
|
784
|
814
|
"is_overseas_personnel": "否",
|
785
|
815
|
"comment": formdata.comment,
|
786
|
|
- "current_address": {
|
787
|
|
- "province_code": that.data.currentaddressInfo.address_code[0],
|
788
|
|
- "province": that.data.currentaddressInfo.address_value[0],
|
789
|
|
- "city_code": that.data.currentaddressInfo.address_code[1],
|
790
|
|
- "city": that.data.currentaddressInfo.address_value[1],
|
791
|
|
- "district_code": that.data.currentaddressInfo.address_code[2],
|
792
|
|
- "district": that.data.currentaddressInfo.address_value[2]
|
793
|
|
- },
|
794
|
|
- "current_address_detail": formdata.current_address_detail,
|
795
|
|
- "huji_address": {
|
796
|
|
- "province_code": that.data.birthaddressInfo.address_code[0],
|
797
|
|
- "province": that.data.birthaddressInfo.address_value[0],
|
798
|
|
- "city_code": that.data.birthaddressInfo.address_code[1],
|
799
|
|
- "city": that.data.birthaddressInfo.address_value[1],
|
800
|
|
- "district_code": that.data.birthaddressInfo.address_code[2],
|
801
|
|
- "district": that.data.birthaddressInfo.address_value[2]
|
802
|
|
- },
|
803
|
|
- "huji_address_detail": formdata.huji_address_detail,
|
|
816
|
+ "current_address": request_current_address,
|
|
817
|
+ "current_address_detail": formdata.current_address_detail ? formdata.current_address_detail : that.data.taxInfo.current_address_detail,
|
|
818
|
+ "huji_address": request_birth_address,
|
|
819
|
+ "huji_address_detail": formdata.huji_address_detail ? formdata.huji_address_detail : that.data.taxInfo.huji_address_detail,
|
804
|
820
|
"mobile": formdata.mobile,
|
805
|
|
- "contact_address": {
|
806
|
|
- "province_code": that.data.contactaddressInfo.address_code[0],
|
807
|
|
- "province": that.data.contactaddressInfo.address_value[0],
|
808
|
|
- "city_code": that.data.contactaddressInfo.address_code[1],
|
809
|
|
- "city": that.data.contactaddressInfo.address_value[1],
|
810
|
|
- "district_code": that.data.contactaddressInfo.address_code[2],
|
811
|
|
- "district": that.data.contactaddressInfo.address_value[2]
|
812
|
|
- },
|
|
821
|
+ "contact_address": request_contact_address ? request_contact_address : that.data.taxInfo.contact_address_detail,
|
813
|
822
|
"contact_address_detail": formdata.contact_address_detail,
|
814
|
823
|
"email": formdata.email,
|
815
|
824
|
"bank": that.data.bankInfo.selected,
|
...
|
...
|
@@ -830,7 +839,7 @@ Page({ |
830
|
839
|
},
|
831
|
840
|
success: function(res) {
|
832
|
841
|
console.log(res)
|
833
|
|
- wx.redirectTo({
|
|
842
|
+ wx.reLaunch({
|
834
|
843
|
url: '../home/home',
|
835
|
844
|
})
|
836
|
845
|
},
|
...
|
...
|
@@ -859,6 +868,54 @@ Page({ |
859
|
868
|
}
|
860
|
869
|
},
|
861
|
870
|
|
|
871
|
+ getContactAddressRequest: function() {
|
|
872
|
+ var that = this
|
|
873
|
+ if (that.data.contactAddress_haschanged) {
|
|
874
|
+ return {
|
|
875
|
+ "province_code": that.data.contactaddressInfo.address_code[0],
|
|
876
|
+ "province": that.data.contactaddressInfo.address_value[0],
|
|
877
|
+ "city_code": that.data.contactaddressInfo.address_code[1],
|
|
878
|
+ "city": that.data.contactaddressInfo.address_value[1],
|
|
879
|
+ "district_code": that.data.contactaddressInfo.address_code[2],
|
|
880
|
+ "district": that.data.contactaddressInfo.address_value[2]
|
|
881
|
+ }
|
|
882
|
+ } else {
|
|
883
|
+ return that.data.taxInfo.contact_address
|
|
884
|
+ }
|
|
885
|
+ },
|
|
886
|
+
|
|
887
|
+ getCurrentAddressRequest: function() {
|
|
888
|
+ var that = this
|
|
889
|
+ if (that.data.curAddress_haschanged) {
|
|
890
|
+ return {
|
|
891
|
+ "province_code": that.data.currentaddressInfo.address_code[0],
|
|
892
|
+ "province": that.data.currentaddressInfo.address_value[0],
|
|
893
|
+ "city_code": that.data.currentaddressInfo.address_code[1],
|
|
894
|
+ "city": that.data.currentaddressInfo.address_value[1],
|
|
895
|
+ "district_code": that.data.currentaddressInfo.address_code[2],
|
|
896
|
+ "district": that.data.currentaddressInfo.address_value[2]
|
|
897
|
+ }
|
|
898
|
+ } else {
|
|
899
|
+ return that.data.taxInfo.current_address
|
|
900
|
+ }
|
|
901
|
+ },
|
|
902
|
+
|
|
903
|
+ getBirthAddressRequest: function() {
|
|
904
|
+ var that = this
|
|
905
|
+ if (that.data.birthAddress_haschanged) {
|
|
906
|
+ return {
|
|
907
|
+ "province_code": that.data.birthaddressInfo.address_code[0],
|
|
908
|
+ "province": that.data.birthaddressInfo.address_value[0],
|
|
909
|
+ "city_code": that.data.birthaddressInfo.address_code[1],
|
|
910
|
+ "city": that.data.birthaddressInfo.address_value[1],
|
|
911
|
+ "district_code": that.data.birthaddressInfo.address_code[2],
|
|
912
|
+ "district": that.data.birthaddressInfo.address_value[2]
|
|
913
|
+ }
|
|
914
|
+ } else {
|
|
915
|
+ return that.data.taxInfo.huji_address
|
|
916
|
+ }
|
|
917
|
+ },
|
|
918
|
+
|
862
|
919
|
showtoast: function(str) {
|
863
|
920
|
wx.showToast({
|
864
|
921
|
title: str,
|
...
|
...
|
|