Authored by hongweigao

修改address

@@ -155,9 +155,6 @@ @@ -155,9 +155,6 @@
155 zip_code: _.trim(params.zipCode || '') 155 zip_code: _.trim(params.zipCode || '')
156 }; 156 };
157 157
158 - let streets = _.trim(params.streets || '');  
159 - query.area_code = streets === 'all' ? _.trim(params.areaCode || '') : streets;  
160 -  
161 if (query.uid === '' || query.address === '' || 158 if (query.uid === '' || query.address === '' ||
162 query.area_code.length < 6 || query.consignee === '' || 159 query.area_code.length < 6 || query.consignee === '' ||
163 query.email === '' || query.zip_code === '') { 160 query.email === '' || query.zip_code === '') {
@@ -40,7 +40,7 @@ var address = { @@ -40,7 +40,7 @@ var address = {
40 }, 40 },
41 41
42 // 初始化地址数据 42 // 初始化地址数据
43 - loadAreaData: function(pCode, toDomId, defaultValue, allCode, isAll) { 43 + loadAreaData: function(pCode, toDomId, defaultValue, allCode) {
44 var the = this, 44 var the = this,
45 $toDom = $('#' + toDomId), 45 $toDom = $('#' + toDomId),
46 i = 0, 46 i = 0,
@@ -74,10 +74,9 @@ var address = { @@ -74,10 +74,9 @@ var address = {
74 } 74 }
75 75
76 $toDom.append('<option value="0">' + defaultValue + '</option>'); 76 $toDom.append('<option value="0">' + defaultValue + '</option>');
77 -  
78 if (toDomId === the.streetsDomId) { 77 if (toDomId === the.streetsDomId) {
79 - allCode.length === 6 && isAll ? selectAll = 'selected' : selectAll = '';  
80 - $toDom.append('<option value="all"' + selectAll +'>*全部</option>'); 78 + allCode === pCode ? selectAll = 'selected' : selectAll = '';
  79 + $toDom.append('<option value="' + pCode + '" ' + selectAll +'>*全部</option>');
81 } 80 }
82 for (i in jsonData.options) { 81 for (i in jsonData.options) {
83 if (jsonData.options[i]) { 82 if (jsonData.options[i]) {
@@ -111,7 +110,7 @@ var address = { @@ -111,7 +110,7 @@ var address = {
111 return; 110 return;
112 } 111 }
113 112
114 - the.loadAreaData(pCode, the.cityDomId, '请选择城市', pCode); 113 + the.loadAreaData(pCode, the.cityDomId, '请选择城市');
115 $('#' + the.areaDomId).hide(); 114 $('#' + the.areaDomId).hide();
116 $('#' + the.streetsDomId).hide().empty(); 115 $('#' + the.streetsDomId).hide().empty();
117 the.showAreaSel(domOptions.dispDomId); 116 the.showAreaSel(domOptions.dispDomId);
@@ -124,7 +123,7 @@ var address = { @@ -124,7 +123,7 @@ var address = {
124 return; 123 return;
125 } 124 }
126 125
127 - the.loadAreaData(pCode, the.areaDomId, '请选择区县', pCode); 126 + the.loadAreaData(pCode, the.areaDomId, '请选择区县');
128 $('#' + the.areaDomId).show(); 127 $('#' + the.areaDomId).show();
129 $('#' + the.streetsDomId).hide().empty(); 128 $('#' + the.streetsDomId).hide().empty();
130 the.showAreaSel(domOptions.dispDomId); 129 the.showAreaSel(domOptions.dispDomId);
@@ -137,7 +136,7 @@ var address = { @@ -137,7 +136,7 @@ var address = {
137 return; 136 return;
138 } 137 }
139 138
140 - the.loadAreaData(pCode, the.streetsDomId, '请选择乡镇/街道', pCode); 139 + the.loadAreaData(pCode, the.streetsDomId, '请选择乡镇/街道');
141 $('#' + the.streetsDomId).show(); 140 $('#' + the.streetsDomId).show();
142 the.showAreaSel(domOptions.dispDomId); 141 the.showAreaSel(domOptions.dispDomId);
143 }); 142 });
@@ -172,8 +171,7 @@ var address = { @@ -172,8 +171,7 @@ var address = {
172 }, 171 },
173 172
174 loadAllData: function(areaCode, domOptions, isInit) { 173 loadAllData: function(areaCode, domOptions, isInit) {
175 - var the = this,  
176 - isAll = isInit ? false : true; 174 + var the = this;
177 175
178 the.initDomIds(domOptions); 176 the.initDomIds(domOptions);
179 areaCode += ''; 177 areaCode += '';
@@ -190,7 +188,7 @@ var address = { @@ -190,7 +188,7 @@ var address = {
190 the.loadAreaData(0, the.provinceDomId, '请选择省份', areaCode); 188 the.loadAreaData(0, the.provinceDomId, '请选择省份', areaCode);
191 the.loadAreaData(areaCode.substr(0, 2), the.cityDomId, '请选择城市', areaCode); 189 the.loadAreaData(areaCode.substr(0, 2), the.cityDomId, '请选择城市', areaCode);
192 the.loadAreaData(areaCode.substr(0, 4), the.areaDomId, '请选择区县', areaCode); 190 the.loadAreaData(areaCode.substr(0, 4), the.areaDomId, '请选择区县', areaCode);
193 - the.loadAreaData(areaCode.substr(0, 6), the.streetsDomId, '请选择乡镇/街道', areaCode, isAll); 191 + the.loadAreaData(areaCode.substr(0, 6), the.streetsDomId, '请选择乡镇/街道', areaCode);
194 $('#' + this.areaDomId).show(); 192 $('#' + this.areaDomId).show();
195 $('#' + this.streetsDomId).show(); 193 $('#' + this.streetsDomId).show();
196 } else if (areaCode.length === 9) { 194 } else if (areaCode.length === 9) {