提交 f854be17edf8a8a39cf7d83bcd66e161fb4a2181

作者 wangyu
1 个父辈 aa535ebd

优化

@@ -15,11 +15,12 @@ Page({ @@ -15,11 +15,12 @@ Page({
15 id_card_no: "", 15 id_card_no: "",
16 birthday: "", 16 birthday: "",
17 datas: "", 17 datas: "",
18 - cardTypeArray : ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'],  
19 - countryArray:[],  
20 - countryAbleChoosed:false,  
21 - cardtype:"",  
22 - nation:"", 18 + cardTypeArray: ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'],
  19 + countryArray: [],
  20 + oricountryArray: [],
  21 + countryAbleChoosed: false,
  22 + cardtype: "",
  23 + nation: "",
23 birthday_datelong: -1, 24 birthday_datelong: -1,
24 }, 25 },
25 26
@@ -43,6 +44,7 @@ Page({ @@ -43,6 +44,7 @@ Page({
43 cardtype: curdata.id_card_type, 44 cardtype: curdata.id_card_type,
44 nation: curdata.nation, 45 nation: curdata.nation,
45 id_card_no: curdata.id_card_no, 46 id_card_no: curdata.id_card_no,
  47 + countryAbleChoosed: '居民身份证' == curdata.id_card_type || '中国护照' == curdata.id_card_type ? true : false,
46 birthday: curdata.birthday ? this.formatDate(curdata.birthday) : "", 48 birthday: curdata.birthday ? this.formatDate(curdata.birthday) : "",
47 birthday_datelong: curdata.birthday 49 birthday_datelong: curdata.birthday
48 }) 50 })
@@ -97,7 +99,7 @@ Page({ @@ -97,7 +99,7 @@ Page({
97 }, 99 },
98 100
99 //****************获取国籍数据************/ 101 //****************获取国籍数据************/
100 - getCountry: function () { 102 + getCountry: function() {
101 var that = this 103 var that = this
102 wx.showLoading({ 104 wx.showLoading({
103 title: '', 105 title: '',
@@ -110,9 +112,9 @@ Page({ @@ -110,9 +112,9 @@ Page({
110 'content-type': 'application/json', // 默认值 112 'content-type': 'application/json', // 默认值
111 "Authorization": Authorization 113 "Authorization": Authorization
112 }, 114 },
113 - success: function (res) { 115 + success: function(res) {
114 var countrys = res.data.concat() 116 var countrys = res.data.concat()
115 - that.data.countryArray = res.data 117 + that.data.oricountryArray = res.data
116 if (countrys.indexOf('中国') > -1) { 118 if (countrys.indexOf('中国') > -1) {
117 countrys.splice(countrys.indexOf('中国'), 1); 119 countrys.splice(countrys.indexOf('中国'), 1);
118 } 120 }
@@ -126,7 +128,7 @@ Page({ @@ -126,7 +128,7 @@ Page({
126 countrys.splice(countrys.indexOf('澳门'), 1); 128 countrys.splice(countrys.indexOf('澳门'), 1);
127 } 129 }
128 that.setData({ 130 that.setData({
129 - countryArray: countrys, 131 + oricountryArray: countrys,
130 }) 132 })
131 }, 133 },
132 fail(res) { 134 fail(res) {
@@ -151,14 +153,14 @@ Page({ @@ -151,14 +153,14 @@ Page({
151 if (!formdata.name || formdata.name.length < 1) { 153 if (!formdata.name || formdata.name.length < 1) {
152 this.showToast("请输入姓名") 154 this.showToast("请输入姓名")
153 return; 155 return;
154 - }  
155 - if (this.data.cardtype.length<1){ 156 + }
  157 + if (this.data.cardtype.length < 1) {
156 this.showToast("请选择证照类型") 158 this.showToast("请选择证照类型")
157 return; 159 return;
158 - }else if (!formdata.id_card_no || formdata.id_card_no.length < 1) { 160 + } else if (!formdata.id_card_no || formdata.id_card_no.length < 1) {
159 this.showToast("请输入证件号码") 161 this.showToast("请输入证件号码")
160 return; 162 return;
161 - } else if (this.data.cardtype=='居民身份证'&&!format.isIDCardNum(formdata.id_card_no)) { 163 + } else if (this.data.cardtype == '居民身份证' && !format.isIDCardNum(formdata.id_card_no)) {
162 this.showToast("证件号码有误") 164 this.showToast("证件号码有误")
163 return; 165 return;
164 } 166 }
@@ -182,11 +184,7 @@ Page({ @@ -182,11 +184,7 @@ Page({
182 "id": that.data.supporter_id, 184 "id": that.data.supporter_id,
183 "legal_entity_id": that.data.legal_entity_id, 185 "legal_entity_id": that.data.legal_entity_id,
184 "co_supporter": formdata.name, 186 "co_supporter": formdata.name,
185 -<<<<<<< HEAD  
186 - "id_card_type": "居民身份证",  
187 -=======  
188 "id_card_type": that.data.cardtype, 187 "id_card_type": that.data.cardtype,
189 ->>>>>>> dev_wy  
190 "id_card_no": formdata.id_card_no, 188 "id_card_no": formdata.id_card_no,
191 "birthday": that.data.birthday_datelong, 189 "birthday": that.data.birthday_datelong,
192 "nation": that.data.nation, 190 "nation": that.data.nation,
@@ -224,17 +222,36 @@ Page({ @@ -224,17 +222,36 @@ Page({
224 }) 222 })
225 }, 223 },
226 224
227 - bindCardtypeChange:function(e){ 225 + bindCardtypeChange: function(e) {
228 console.log('bindCardtypeChange', e) 226 console.log('bindCardtypeChange', e)
229 var card_type = this.data.cardTypeArray[e.detail.value] 227 var card_type = this.data.cardTypeArray[e.detail.value]
  228 + var nation = this.data.nation
  229 + var countryAbleChoosed = this.data.countryAbleChoosed
  230 + var countryArray = this.data.oricountryArray
  231 +
  232 + if ('居民身份证' == card_type || '中国护照' == card_type) {
  233 + nation = '中国'
  234 + countryAbleChoosed = true
  235 + } else if (card_type.indexOf("港澳") != -1) {
  236 + nation = ''
  237 + countryArray = ['中国香港', '中国澳门']
  238 + countryAbleChoosed = false
  239 + } else if (card_type.indexOf("台湾") != -1) {
  240 + nation = '中国台湾'
  241 + countryAbleChoosed = true
  242 + } else {
  243 + nation = ''
  244 + countryAbleChoosed = false
  245 + }
230 this.setData({ 246 this.setData({
231 cardtype: card_type, 247 cardtype: card_type,
232 - nation: card_type == "居民身份证" || card_type == "中国护照" ? "中国" : (this.data.nation == "中国" ? "" : this.data.nation),  
233 - countryAbleChoosed: card_type == "居民身份证" || card_type == "中国护照" ? true : false 248 + nation: nation,
  249 + countryArray: countryArray,
  250 + countryAbleChoosed: countryAbleChoosed
234 }) 251 })
235 }, 252 },
236 253
237 - bindnationChange: function (e) { 254 + bindnationChange: function(e) {
238 console.log('bindnationChange', e) 255 console.log('bindnationChange', e)
239 this.setData({ 256 this.setData({
240 nation: this.data.countryArray[e.detail.value] 257 nation: this.data.countryArray[e.detail.value]
@@ -253,7 +270,7 @@ Page({ @@ -253,7 +270,7 @@ Page({
253 bindinput: function(e) { 270 bindinput: function(e) {
254 console.log("bindinput", e.detail.value) 271 console.log("bindinput", e.detail.value)
255 var idCardNo = e.detail.value 272 var idCardNo = e.detail.value
256 - if (this.data.cardtype=='居民身份证'&&idCardNo.length == 18) { 273 + if (this.data.cardtype == '居民身份证' && idCardNo.length == 18) {
257 if (!format.isIDCardNum(idCardNo)) { 274 if (!format.isIDCardNum(idCardNo)) {
258 wx.showToast({ 275 wx.showToast({
259 image: "../../../../images/warn.png", 276 image: "../../../../images/warn.png",
注册登录 后发表评论