提交 820031e5235c6a7fb42489a7687507c099075105

作者 pangy
1 个父辈 3dd39174

调整工资条, 解决bug

... ... @@ -37,9 +37,13 @@ Page({
37 37 },
38 38 data: { 'declare_month': timestamp },
39 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 49 fail: function (res) {
... ... @@ -83,6 +87,7 @@ Page({
83 87
84 88 },
85 89 handleTaxData: function (items) {
  90 + if (!items) return
86 91 for (var i = 0; i < items.length; ++i) {
87 92 var item = items[i]
88 93 var method
... ... @@ -189,8 +194,9 @@ Page({
189 194
190 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 200 var details = []
195 201 for (var i = 0; i < titles.length; ++i) {
196 202 var titleData = titles[i]
... ... @@ -200,9 +206,13 @@ Page({
200 206 title = titleData['original_column']
201 207 }
202 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 216 details.push({
207 217 title: title,
208 218 value: value
... ...
... ... @@ -1258,22 +1258,23 @@ Page({
1258 1258 // this.showtoast('请选择涉税事由');
1259 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 1265 this.showtoast('请选择其他证照类型');
1263 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 1269 this.showtoast('请输入其他证照号码');
1267 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 1273 this.showtoast('其他证照号码有误');
1270 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 1276 this.showtoast('其他证照号码有误');
1273 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 1279 if (this.data.hasOtherCard && !this.data.birthCountryData.selected) {
1279 1280 this.showtoast('请选择出生国家');
... ... @@ -1421,7 +1422,7 @@ Page({
1421 1422 "id_card_type": that.data.cardtypeData.selected, //selected_code,
1422 1423 "id_card_no": that.data.card_number,
1423 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 1426 "gender": that.data.genderData.selected,
1426 1427 "birth_date": that.data.long_birth_date,
1427 1428 "first_entry_date": that.data.hasOtherCard ? that.data.firstEntryDate.datelong : null,
... ...
注册登录 后发表评论