正在显示
2 个修改的文件
包含
26 行增加
和
15 行删除
@@ -37,9 +37,13 @@ Page({ | @@ -37,9 +37,13 @@ Page({ | ||
37 | }, | 37 | }, |
38 | data: { 'declare_month': timestamp }, | 38 | data: { 'declare_month': timestamp }, |
39 | success: function (result) { | 39 | success: function (result) { |
40 | - that.setData({ | ||
41 | - taxDatas: that.handleTaxData(result.data.items) | ||
42 | - }) | 40 | + let taxDatas = that.handleTaxData(result.data.items) |
41 | + if (taxDatas) { | ||
42 | + that.setData({ | ||
43 | + taxDatas: taxDatas | ||
44 | + }) | ||
45 | + } | ||
46 | + | ||
43 | 47 | ||
44 | }, | 48 | }, |
45 | fail: function (res) { | 49 | fail: function (res) { |
@@ -83,6 +87,7 @@ Page({ | @@ -83,6 +87,7 @@ Page({ | ||
83 | 87 | ||
84 | }, | 88 | }, |
85 | handleTaxData: function (items) { | 89 | handleTaxData: function (items) { |
90 | + if (!items) return | ||
86 | for (var i = 0; i < items.length; ++i) { | 91 | for (var i = 0; i < items.length; ++i) { |
87 | var item = items[i] | 92 | var item = items[i] |
88 | var method | 93 | var method |
@@ -189,8 +194,9 @@ Page({ | @@ -189,8 +194,9 @@ Page({ | ||
189 | 194 | ||
190 | handleDetailsData: function (data) { | 195 | handleDetailsData: function (data) { |
191 | 196 | ||
192 | - var titles = JSON.parse(data['slip_titles']) | ||
193 | - var detail = JSON.parse(data['detail']) | 197 | + let titles = JSON.parse(data['slip_titles']) |
198 | + let detail = JSON.parse(data['detail']) | ||
199 | + let mapping_keys = data["mapping_keys"] ? data["mapping_keys"]:[] | ||
194 | var details = [] | 200 | var details = [] |
195 | for (var i = 0; i < titles.length; ++i) { | 201 | for (var i = 0; i < titles.length; ++i) { |
196 | var titleData = titles[i] | 202 | var titleData = titles[i] |
@@ -200,9 +206,13 @@ Page({ | @@ -200,9 +206,13 @@ Page({ | ||
200 | title = titleData['original_column'] | 206 | title = titleData['original_column'] |
201 | } | 207 | } |
202 | if (!value) { | 208 | if (!value) { |
203 | - value = data[titleData['key']] + ('tax_rate' == titleData['key'] ? '%' : '') | 209 | + value = data[titleData['key']] |
210 | + if(value != undefined){ | ||
211 | + value += 'tax_rate' == titleData['key'] ? '%' : '' | ||
212 | + } | ||
204 | } | 213 | } |
205 | - if (!title || value == '0') continue; | 214 | + if (!title || !value) continue; |
215 | + if (mapping_keys.indexOf(title) == -1 && value == '0') continue; | ||
206 | details.push({ | 216 | details.push({ |
207 | title: title, | 217 | title: title, |
208 | value: value | 218 | value: value |
@@ -1258,22 +1258,23 @@ Page({ | @@ -1258,22 +1258,23 @@ Page({ | ||
1258 | // this.showtoast('请选择涉税事由'); | 1258 | // this.showtoast('请选择涉税事由'); |
1259 | // return | 1259 | // return |
1260 | // } | 1260 | // } |
1261 | - if (this.data.hasOtherCard && !this.data.otherCardtypeData.selected && this.data.otherCardtypeData.isrequre) { | 1261 | + let otherTypeSel = this.data.otherCardtypeData.selected |
1262 | + let otherHasInput = formdata.other_card_number && formdata.other_card_number.length | ||
1263 | + | ||
1264 | + if (this.data.hasOtherCard && !otherTypeSel && this.data.otherCardtypeData.isrequre) { | ||
1262 | this.showtoast('请选择其他证照类型'); | 1265 | this.showtoast('请选择其他证照类型'); |
1263 | return | 1266 | return |
1264 | } | 1267 | } |
1265 | - if (this.data.hasOtherCard && !(formdata.other_card_number && formdata.other_card_number.length) && this.data.otherCardtypeData.isrequre) { | 1268 | + if (this.data.hasOtherCard && !otherHasInput && this.data.otherCardtypeData.isrequre) { |
1266 | this.showtoast('请输入其他证照号码'); | 1269 | this.showtoast('请输入其他证照号码'); |
1267 | return | 1270 | return |
1268 | - } else if (this.data.otherCardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(formdata.other_card_number)) { | 1271 | + } |
1272 | + if (otherTypeSel.indexOf('居住证') > -1 && otherHasInput && !reg_18_Number.test(formdata.other_card_number)) { | ||
1269 | this.showtoast('其他证照号码有误'); | 1273 | this.showtoast('其他证照号码有误'); |
1270 | return | 1274 | return |
1271 | - } else if (this.data.otherCardtypeData.selected.indexOf('护照') > -1 && !reg_9_n_a.test(formdata.other_card_number)) { | 1275 | + }else if (otherTypeSel.indexOf('永久居留') > -1 && otherHasInput && !reg_15_n_a.test(formdata.other_card_number)) { |
1272 | this.showtoast('其他证照号码有误'); | 1276 | this.showtoast('其他证照号码有误'); |
1273 | return | 1277 | return |
1274 | - } else if (this.data.otherCardtypeData.selected.indexOf('永久居留') > -1 && !reg_15_n_a.test(formdata.other_card_number)) { | ||
1275 | - this.showtoast('证照号码有误'); | ||
1276 | - return | ||
1277 | } | 1278 | } |
1278 | if (this.data.hasOtherCard && !this.data.birthCountryData.selected) { | 1279 | if (this.data.hasOtherCard && !this.data.birthCountryData.selected) { |
1279 | this.showtoast('请选择出生国家'); | 1280 | this.showtoast('请选择出生国家'); |
@@ -1421,7 +1422,7 @@ Page({ | @@ -1421,7 +1422,7 @@ Page({ | ||
1421 | "id_card_type": that.data.cardtypeData.selected, //selected_code, | 1422 | "id_card_type": that.data.cardtypeData.selected, //selected_code, |
1422 | "id_card_no": that.data.card_number, | 1423 | "id_card_no": that.data.card_number, |
1423 | "other_id_card_type": that.data.hasOtherCard ? that.data.otherCardtypeData.selected : '', //selected_code, | 1424 | "other_id_card_type": that.data.hasOtherCard ? that.data.otherCardtypeData.selected : '', //selected_code, |
1424 | - "other_id_card_no": that.data.hasOtherCard ? formdata.other_card_number : '', | 1425 | + "other_id_card_no": that.data.hasOtherCard ? (formdata.other_card_number ? formdata.other_card_number : '') : '', |
1425 | "gender": that.data.genderData.selected, | 1426 | "gender": that.data.genderData.selected, |
1426 | "birth_date": that.data.long_birth_date, | 1427 | "birth_date": that.data.long_birth_date, |
1427 | "first_entry_date": that.data.hasOtherCard ? that.data.firstEntryDate.datelong : null, | 1428 | "first_entry_date": that.data.hasOtherCard ? that.data.firstEntryDate.datelong : null, |
请
注册
或
登录
后发表评论