Authored by 周少峰

Merge branch 'release/5.4.1' into gray

@@ -414,9 +414,8 @@ function getAddress(d, callback) { @@ -414,9 +414,8 @@ function getAddress(d, callback) {
414 data: { 414 data: {
415 id: d.id * 1 415 id: d.id * 1
416 } 416 }
417 - }).then(function(d) {  
418 -  
419 - structureOption($obj, d.data, selectId); 417 + }).then(function(resData) {
  418 + structureOption($obj, resData.data, selectId, d.id);
420 419
421 if (typeof callback === 'function') { 420 if (typeof callback === 'function') {
422 callback(); 421 callback();
@@ -426,18 +425,13 @@ function getAddress(d, callback) { @@ -426,18 +425,13 @@ function getAddress(d, callback) {
426 } 425 }
427 426
428 // 构建select下拉选项 427 // 构建select下拉选项
429 -function structureOption($obj, data, selectId) { 428 +function structureOption($obj, data, selectId, countryId) {
430 var i, 429 var i,
431 optionHtml = '', 430 optionHtml = '',
432 defaultOption, 431 defaultOption,
433 isStar = ''; 432 isStar = '';
434 - var countyId;  
435 433
436 for (i = 0; i < data.length; i++) { 434 for (i = 0; i < data.length; i++) {
437 - if (!countyId) {  
438 - countyId = data[i].id;  
439 - }  
440 -  
441 if (data[i].is_support_express === 'Y') { 435 if (data[i].is_support_express === 'Y') {
442 isStar = '*'; 436 isStar = '*';
443 } else { 437 } else {
@@ -462,10 +456,8 @@ function structureOption($obj, data, selectId) { @@ -462,10 +456,8 @@ function structureOption($obj, data, selectId) {
462 } else if ($obj.attr('name') === 'street') { 456 } else if ($obj.attr('name') === 'street') {
463 defaultOption = '<option value="0">请选择乡镇/街道</option>'; 457 defaultOption = '<option value="0">请选择乡镇/街道</option>';
464 458
465 - if (countyId) {  
466 - countyId += '';  
467 - countyId = countyId.substr(0, 6);  
468 - defaultOption += '<option value="' + countyId + '">全部</option>'; 459 + if (countryId) {
  460 + defaultOption += '<option value="' + countryId + '">全部</option>';
469 } 461 }
470 } 462 }
471 463