提交 0b52017374f0c9925b8ac23aef887af02a9fd5e1

作者 wangyu
1 个父辈 291e2f45

优化

... ... @@ -7,18 +7,32 @@ Page({
7 7 * Page initial data
8 8 */
9 9 data: {
10   - support_duty_id:"",
11   - name:"",
12   - id_card_no:""
  10 + support_duty_id: "",
  11 + name: "",
  12 + nation: "",
  13 + id_card_no: "",
  14 + commonbirthDate: {
  15 + label: '共同赡养人出生日期',
  16 + isrequre: true,
  17 + bindtype: 'birthday',
  18 + selected: '',
  19 + isblack: 'true',
  20 + placeholder: '请选择出生日期',
  21 + mode: "date",
  22 + fields: "day",
  23 + start: '1970-01-01',
  24 + end: '2018-01-01',
  25 + onChange: 'onBirthdaySelect',
  26 + },
13 27 },
14 28
15 29 /**
16 30 * Lifecycle function--Called when page load
17 31 */
18 32 onLoad: function(options) {
19   - console.log("onLoad",options)
  33 + console.log("onLoad", options)
20 34 this.setData({
21   - support_duty_id:options.id
  35 + support_duty_id: options.id
22 36 })
23 37 },
24 38
... ... @@ -33,24 +47,27 @@ Page({
33 47 * Lifecycle function--Called when page show
34 48 */
35 49 onShow: function() {
36   - var that = this
37   - wx.getStorage({
38   - key: 'id_info',
39   - success: function(res) {
40   - console.log('id_info', res.data)
41   - if (res.data && res.data.length > 0) {
42   - var id_info = JSON.parse(res.data)
43   - if (that.data.name.length > 0 && id_info.name != that.data.name) {
44   - that.showtoast("姓名冲突")
45   - return
46   - }
47   - that.setData({
48   - name: id_info.name,
49   - id_card_no: id_info.id_card_number
50   - })
  50 + var that = this
  51 + wx.getStorage({
  52 + key: 'id_info',
  53 + success: function(res) {
  54 + console.log('id_info', res.data)
  55 + if (res.data && res.data.length > 0) {
  56 + var id_info = JSON.parse(res.data)
  57 + if (that.data.name.length > 0 && id_info.name != that.data.name) {
  58 + that.showtoast("姓名冲突")
  59 + return
51 60 }
52   - },
53   - })
  61 + var commonbirthDate = that.data.commonbirthDate
  62 + commonbirthDate.selected = id_info.birthday.year + '-' + id_info.birthday.month + '-' + id_info.birthday.day
  63 + commonbirthDate.datelong = Date.parse(new Date(commonbirthDate.selected)) / 1000
  64 + that.setData({
  65 + name: id_info.name,
  66 + id_card_no: id_info.id_card_number
  67 + })
  68 + }
  69 + },
  70 + })
54 71 wx.removeStorage({
55 72 key: 'id_info',
56 73 success(res) {
... ... @@ -66,10 +83,10 @@ Page({
66 83 },
67 84
68 85
69   - formSubmit: function (e) {
  86 + formSubmit: function(e) {
70 87 console.log("formSubmit", e);
71 88 var formdata = e.detail.value
72   - if (!formdata.name || formdata.name.length<1){
  89 + if (!formdata.name || formdata.name.length < 1) {
73 90 this.showToast("请输入姓名")
74 91 return;
75 92 } else if (!formdata.id_card_no || formdata.id_card_no.length < 1) {
... ... @@ -79,23 +96,26 @@ Page({
79 96 this.goAdd(formdata)
80 97 },
81 98
82   - goAdd: function (formdata){
  99 + goAdd: function(formdata) {
83 100 var that = this;
84 101 var Authorization = getApp().globalData.Authorization;
85 102 wx.request({
86 103 url: baseUrl + 'persontax/v1/co-supporters',
87 104 data: {
88 105 "support_duty_id": that.data.support_duty_id,
89   - "co_supporter": formdata.name ,
  106 + "co_supporter": formdata.name,
90 107 "id_card_type": "1",
91 108 "id_card_no": formdata.id_card_no,
  109 + "birthday": that.data.commonbirthDate.datelong,
  110 + "nation": "中国",
  111 + "relation_ship": "兄、弟、姐、妹"
92 112 },
93 113 header: {
94 114 'content-type': 'application/json',
95 115 "Authorization": Authorization
96 116 },
97   - method:"POST",
98   - success: function (res) {
  117 + method: "POST",
  118 + success: function(res) {
99 119 if (res && res.data) {
100 120 console.log("res", res)
101 121 if (res && res.statusCode == 200) {
... ... @@ -108,7 +128,17 @@ Page({
108 128 })
109 129 },
110 130
111   - showToast: function (data) {
  131 + onBirthdaySelect: function(e) {
  132 + console.log('picker发送选择改变,携带值为', e)
  133 + var commonbirthDate = this.data.commonbirthDate
  134 + commonbirthDate.selected = e.detail.value
  135 + commonbirthDate.datelong = Date.parse(new Date(e.detail.value)) / 1000
  136 + this.setData({
  137 + commonbirthDate: commonbirthDate
  138 + })
  139 + },
  140 +
  141 + showToast: function(data) {
112 142 if (data && data.length > 0) {
113 143 wx.showToast({
114 144 title: data,
... ...
1 1 <!--pages/main/addtionalreduce/adddupporters/adddupporters.wxml-->
  2 +<import src="../../../common/picker_cell" />
  3 +
2 4 <view class='page'>
3 5 <form bindsubmit='formSubmit'>
4 6 <view style='height:90rpx;padding:0 30rpx'>
... ... @@ -23,11 +25,12 @@
23 25 </view>
24 26 </view>
25 27 <view class="divide_line"></view>
26   - <view style='height:90rpx;padding:0 30rpx'>
  28 + <template is="picker_cell_normal" data="{{...commonbirthDate}}" />
  29 + <!-- <view style='height:90rpx;padding:0 30rpx'>
27 30 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
28 31 <text style='color:#777;font-size: 30rpx;line-height: 90rpx; float:left'>被赡养人出生日期</text>
29 32 <text style='color:#333;font-size: 30rpx;line-height: 90rpx; float:right'>1949-09-19</text>
30   - </view>
  33 + </view> -->
31 34 <view class="divide_line"></view>
32 35 <view style='height:90rpx;padding:0 30rpx'>
33 36 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
... ...
... ... @@ -36,6 +36,9 @@ Page({
36 36 lable: 0,
37 37 title: '',
38 38 isIdCard: true,
  39 + workAddress_haschanged: false,
  40 + loanAddress_haschanged: false,
  41 + rentAddress_haschanged: false,
39 42 extrainfo_arr: ["请上传子女出生证明、学籍信息凭证、学费凭证、本人结婚证和分摊协议", "请上传学历学籍凭证", "请上传出生证明或关系证明、独生子女证、分摊协议、其他法定赡养人赡养证明", "请上传诊断书和医疗费用收据", "请上传首套房证明、还款证明、不动产登记证、结婚证和夫妻约定抵扣协议"],
40 43 cur_index: 'support_duty',
41 44 lovercardtypeData: {
... ... @@ -318,6 +321,7 @@ Page({
318 321 address_value: ['', ''],
319 322 selected: '',
320 323 placeholder: '请选择城市',
  324 + requestdata: {},
321 325 onChange: 'onPickerSelect'
322 326 },
323 327 houseLocateInfo: {
... ... @@ -330,6 +334,7 @@ Page({
330 334 address_code: ['', '', ''],
331 335 address_value: ['', '', ''],
332 336 selected: '',
  337 + requestdata: {},
333 338 placeholder: '请选择地址',
334 339 onChange: 'onPickerSelect'
335 340 },
... ... @@ -343,6 +348,7 @@ Page({
343 348 address_code: ['', '', ''],
344 349 address_value: ['', '', ''],
345 350 selected: '',
  351 + requestdata: {},
346 352 placeholder: '请选择地址',
347 353 onChange: 'onPickerSelect'
348 354 },
... ... @@ -577,13 +583,13 @@ Page({
577 583 case 'continuing_education':
578 584 var setData = {}
579 585 if (data.education_type && data.education_type.length) {
580   - if ('title' == data.education_type){
  586 + if ('title' == data.education_type) {
581 587 var edutypeData = this.data.edutypeData
582 588 edutypeData.selected = "学历继续教育"
583 589 setData.edutypeData = edutypeData
584   - }else{
  590 + } else {
585 591 var edutypeData = this.data.edutypeData
586   - edutypeData.selected = data.education_type =='major'?"专业技术人员职业资格":"技能人员职业资格"
  592 + edutypeData.selected = data.education_type == 'major' ? "专业技术人员职业资格" : "技能人员职业资格"
587 593 setData.edutypeData = edutypeData
588 594 }
589 595 }
... ... @@ -618,7 +624,7 @@ Page({
618 624 }
619 625 if (data.certification_autority && data.certification_autority.length) {
620 626 setData.certification_autority = data.certification_autority
621   - }
  627 + }
622 628 this.setData(setData)
623 629 break;
624 630 case 'support_duty':
... ... @@ -687,17 +693,12 @@ Page({
687 693 loverbirthDate.selected = format.formatTime_date(data.spouse_birthday)
688 694 loverbirthDate.datelong = data.spouse_birthday
689 695 setData.loverbirthDate = loverbirthDate
690   - }
  696 + }
691 697 if (data.loan_type && data.loan_type.length) {
692 698 var loantypeData = this.data.loantypeData
693 699 loantypeData.selected = data.loan_type
694 700 setData.loantypeData = loantypeData
695 701 }
696   - if (data.house_address && data.house_address.length) {
697   - var houseLocateInfo = this.data.houseLocateInfo
698   - houseLocateInfo.selected = data.house_address
699   - setData.houseLocateInfo = houseLocateInfo
700   - }
701 702 if (data.house_detail_address && data.house_detail_address.length) {
702 703 setData.house_detail_address = data.house_detail_address
703 704 }
... ... @@ -737,11 +738,25 @@ Page({
737 738 leaseendDate.datelong = data.rent_end
738 739 setData.leaseendDate = leaseendDate
739 740 }
740   - if (data.work_city && data.work_city.length) {
  741 + if (data.work_city && data.work_city.province) {
741 742 var workingcityInfo = this.data.workingcityInfo
742   - workingcityInfo.selected = data.work_city
  743 + workingcityInfo.requestdata = data.work_city
  744 + workingcityInfo.selected = data.work_city.province + data.work_city.city
743 745 setData.workingcityInfo = workingcityInfo
744 746 }
  747 + if (house_type == 'house_fund_loan' && data.house_address && data.house_address.province) {
  748 + var houseLocateInfo = this.data.houseLocateInfo
  749 + houseLocateInfo.requestdata = data.house_address
  750 + houseLocateInfo.selected = data.work_city.province + data.work_city.city + data.work_city.district
  751 + setData.houseLocateInfo = houseLocateInfo
  752 + }
  753 + if (house_type == 'house_fund_rent' && data.house_address && data.house_address.province) {
  754 + var rentLocateInfo = this.data.rentLocateInfo
  755 + rentLocateInfo.requestdata = data.house_address
  756 + rentLocateInfo.selected = data.work_city.province + data.work_city.city + data.work_city.district
  757 + setData.rentLocateInfo = rentLocateInfo
  758 + }
  759 +
745 760 this.setData(setData)
746 761 break;
747 762 }
... ... @@ -1043,10 +1058,10 @@ Page({
1043 1058 } else {
1044 1059 newdata.percentage = parseFloat(formdata.percentage)
1045 1060 }
1046   - newdata.older_birthday = this.data.olderbirthDate.datelong
1047   - newdata.older_relative = this.data.older_relativeData.selected
  1061 + newdata.birthday = this.data.olderbirthDate.datelong
  1062 + newdata.relationship = this.data.older_relativeData.selected
1048 1063 newdata.support_type = this.data.supporttypeData.selected
1049   - newdata.older_cardtype = this.data.oldercardtypeData.selected
  1064 + newdata.id_card_type = this.data.oldercardtypeData.selected
1050 1065 break;
1051 1066 case 'medical_fund':
1052 1067 subUrl = 'persontax/v1/medical-funds'
... ... @@ -1091,7 +1106,7 @@ Page({
1091 1106 } else if (this.data.identifytypeData.selected.length < 1) {
1092 1107 this.showToast('请选择证书类型')
1093 1108 return
1094   - } else if (!formdata.certification_no || formdata.certification_no.length < 1) {
  1109 + } else if (!formdata.certification_no || formdata.certification_no.length < 1) {
1095 1110 this.showToast('请填写证书号码')
1096 1111 return
1097 1112 } else if (this.data.beforemarryData.selected.length < 1) {
... ... @@ -1116,7 +1131,6 @@ Page({
1116 1131 this.showToast('请选择贷款期限')
1117 1132 return
1118 1133 }
1119   - newdata.house_location = this.data.houseLocateInfo.address_value[0] + this.data.houseLocateInfo.address_value[1] + this.data.houseLocateInfo.address_value[2]
1120 1134 newdata.loan_before_marry = this.data.beforemarryData.selected == "是" ? 'y' : 'n'
1121 1135 newdata.loan_by_self = this.data.isselfData.selected == "是" ? 'y' : 'n'
1122 1136 newdata.identify_type = this.data.identifytypeData.selected
... ... @@ -1125,6 +1139,9 @@ Page({
1125 1139 newdata.loan_bank = this.data.bankInfo.selected
1126 1140 newdata.payback_date = this.data.firstpaybackDate.selected
1127 1141 newdata.loan_datelong = this.data.loandatelongData.selected
  1142 + var request_loan_address = that.getLoanAddressRequest()
  1143 + newdata.house_location = request_loan_address
  1144 +
1128 1145 } else if (this.data.house_type == "house_fund_rent") {
1129 1146 if (this.data.workingcityInfo.address_value.length < 1) {
1130 1147 this.showToast('请选择工作城市')
... ... @@ -1138,35 +1155,42 @@ Page({
1138 1155 } else if (!formdata.lease_idno || formdata.lease_idno.length < 1) {
1139 1156 this.showToast('请填写纳税人识别号')
1140 1157 return
1141   - } else if (!formdata.identify_no || formdata.identify_no.length < 1) {
1142   - this.showToast('请填写出租方号码')
1143   - return
1144   - } else if (this.data.identifytypeData.selected.length < 1) {
  1158 + }
  1159 + // else if (!formdata.identify_no || formdata.identify_no.length < 1) {
  1160 + // this.showToast('请填写出租方号码')
  1161 + // return
  1162 + // }
  1163 + else if (this.data.identifytypeData.selected.length < 1) {
1145 1164 this.showToast('请选择证件类型')
1146 1165 return
1147   - } else if (this.data.rentLocateInfo.address_value.length < 1) {
1148   - this.showToast('请选择房屋地址')
1149   - return
1150 1166 } else if (!formdata.owner_id_cartd_no || formdata.owner_id_cartd_no.length < 1) {
1151 1167 this.showToast('请填写证件号码')
1152 1168 return
1153   - } else if (!formdata.rent_contract_no || formdata.rent_contract_no.length < 1) {
  1169 + } else if (this.data.rentLocateInfo.address_value.length < 1) {
  1170 + this.showToast('请选择房屋地址')
  1171 + return
  1172 + }
  1173 + else if (!formdata.rent_contract_no || formdata.rent_contract_no.length < 1) {
1154 1174 this.showToast('请填写租赁合同编号')
1155 1175 return
1156   - }else if (this.data.leasestartDate.selected.length < 1) {
  1176 + } else if (this.data.leasestartDate.selected.length < 1) {
1157 1177 this.showToast('请选择日期')
1158 1178 return
1159 1179 } else if (this.data.leaseendDate.selected.length < 1) {
1160 1180 this.showToast('请选择日期')
1161 1181 return
1162 1182 }
1163   - newdata.house_address = this.data.rentLocateInfo.address_value[0] + this.data.rentLocateInfo.address_value[1] + this.data.rentLocateInfo.address_value[2]
1164   - newdata.work_city = this.data.workingcityInfo.address_value[0] + this.data.workingcityInfo.address_value[1] + this.data.workingcityInfo.address_value[2]
1165 1183 newdata.lease_type = this.data.leasetypeData.selected
1166 1184 newdata.certification_type = this.data.identifytypeData.selected
1167 1185 newdata.rent_start = this.data.leasestartDate.selected
1168 1186 newdata.rent_end = this.data.leaseendDate.selected
1169   - console.log('houseLocateInfo', this.data.houseLocateInfo)
  1187 +
  1188 + var request_working_address = that.getWorkingAddressRequest()
  1189 + newdata.work_city = request_working_address
  1190 + var request_rent_address = that.getRentAddressRequest()
  1191 + newdata.house_address = request_rent_address
  1192 + console.log('request_working_address', this.data.request_working_address)
  1193 +
1170 1194 }
1171 1195 if (formdata.spouse_name || formdata.spouse_id_card_no || this.data.loverbirthDate.selected) {
1172 1196 if (!formdata.spouse_name || formdata.spouse_name.length < 1) {
... ... @@ -1488,7 +1512,10 @@ Page({
1488 1512 house_address.selected = e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
1489 1513
1490 1514 }
  1515 + house_address.address_value = e.detail.value
  1516 + house_address.address_code = e.detail.code
1491 1517 this.setData({
  1518 + loanAddress_haschanged: true,
1492 1519 houseLocateInfo: house_address
1493 1520 })
1494 1521 break;
... ... @@ -1499,10 +1526,12 @@ Page({
1499 1526 if (e.detail.value[0] == e.detail.value[1]) {
1500 1527 work_address.selected = e.detail.value[1] + e.detail.value[2]
1501 1528 } else {
1502   - work_address.selected = e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
1503   -
  1529 + work_address.selected = e.detail.value[0] + e.detail.value[1]
1504 1530 }
  1531 + work_address.address_value = e.detail.value
  1532 + work_address.address_code = e.detail.code
1505 1533 this.setData({
  1534 + workAddress_haschanged: true,
1506 1535 workingcityInfo: work_address
1507 1536 })
1508 1537 break;
... ... @@ -1514,9 +1543,11 @@ Page({
1514 1543 rent_address.selected = e.detail.value[1] + e.detail.value[2]
1515 1544 } else {
1516 1545 rent_address.selected = e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
1517   -
1518 1546 }
  1547 + rent_address.address_value = e.detail.value
  1548 + rent_address.address_code = e.detail.code
1519 1549 this.setData({
  1550 + rentAddress_haschanged: true,
1520 1551 rentLocateInfo: rent_address
1521 1552 })
1522 1553 break;
... ... @@ -1601,6 +1632,52 @@ Page({
1601 1632 // })
1602 1633 // },
1603 1634
  1635 + getWorkingAddressRequest: function() {
  1636 + var that = this
  1637 + if (that.data.workAddress_haschanged) {
  1638 + return {
  1639 + "province_code": that.data.workingcityInfo.address_code[0],
  1640 + "province": that.data.workingcityInfo.address_value[0],
  1641 + "city_code": that.data.workingcityInfo.address_code[1],
  1642 + "city": that.data.workingcityInfo.address_value[1]
  1643 + }
  1644 + } else {
  1645 + return that.data.workingcityInfo.requestdata
  1646 + }
  1647 + },
  1648 +
  1649 + getRentAddressRequest: function() {
  1650 + var that = this
  1651 + if (that.data.rentAddress_haschanged) {
  1652 + return {
  1653 + "province_code": that.data.rentLocateInfo.address_code[0],
  1654 + "province": that.data.rentLocateInfo.address_value[0],
  1655 + "city_code": that.data.rentLocateInfo.address_code[1],
  1656 + "city": that.data.rentLocateInfo.address_value[1],
  1657 + "district_code": that.data.rentLocateInfo.address_code[2],
  1658 + "district": that.data.rentLocateInfo.address_value[2]
  1659 + }
  1660 + } else {
  1661 + return that.data.rentLocateInfo.requestdata
  1662 + }
  1663 + },
  1664 +
  1665 + getLoanAddressRequest: function() {
  1666 + var that = this
  1667 + if (that.data.loanAddress_haschanged) {
  1668 + return {
  1669 + "province_code": that.data.houseLocateInfo.address_code[0],
  1670 + "province": that.data.houseLocateInfo.address_value[0],
  1671 + "city_code": that.data.houseLocateInfo.address_code[1],
  1672 + "city": that.data.houseLocateInfo.address_value[1],
  1673 + "district_code": that.data.houseLocateInfo.address_code[2],
  1674 + "district": that.data.houseLocateInfo.address_value[2]
  1675 + }
  1676 + } else {
  1677 + return that.data.houseLocateInfo.requestdata
  1678 + }
  1679 + },
  1680 +
1604 1681 showToast: function(data) {
1605 1682 if (data && data.length > 0) {
1606 1683 wx.showToast({
... ...
... ... @@ -120,7 +120,7 @@
120 120 <view style='height:90rpx'>
121 121 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
122 122 <text class='text_black_30 float_left'>被赡养人姓名</text>
123   - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入被赡养人姓名' name='supported_name'></input>
  123 + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入被赡养人姓名' name='supported_name' value='{{supported_name}}'></input>
124 124 </view>
125 125 <view class='divide_line_f5f5f5'></view>
126 126 <template is="picker_cell_normal" data="{{...oldercardtypeData}}" />
... ... @@ -258,7 +258,7 @@
258 258 <view style='height:90rpx'>
259 259 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
260 260 <text class='text_black_30 float_left'>证件号码</text>
261   - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证号码' name='owner_id_cartd_no'></input>
  261 + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证号码' name='owner_id_cartd_no'></input>
262 262 </view>
263 263 </view>
264 264 <view style='height:20rpx;width:100%;background:#F8F8F8;'></view>
... ...
注册登录 后发表评论