Authored by 郭成尧

address-ok

@@ -79,7 +79,8 @@ $addressForm.on('submit', function() { @@ -79,7 +79,8 @@ $addressForm.on('submit', function() {
79 tip.show('手机号不能为空'); 79 tip.show('手机号不能为空');
80 return false; 80 return false;
81 } 81 }
82 - if (!$(this).find('[name="area_code"]').val() || !$(this).find('[name="area"]').val()) { 82 + if (!$(this).find('[name="area_code"]').val() || !$(this).find('[name="area"]').val() ||
  83 + $(this).find('[name="area_code"]').val().length < 6) {
83 tip.show('省市区不能为空'); 84 tip.show('省市区不能为空');
84 return false; 85 return false;
85 } 86 }
@@ -161,6 +161,10 @@ @@ -161,6 +161,10 @@
161 <script> 161 <script>
162 require('../../../scss/home/_address.css'); 162 require('../../../scss/home/_address.css');
163 163
  164 + let areaForm = $('.edit-address');
  165 + let areaCode = areaForm.find('input[name=area_code]');
  166 + let area = areaForm.find('input[name=area]');
  167 +
164 module.exports = { 168 module.exports = {
165 data() { 169 data() {
166 return { 170 return {
@@ -249,6 +253,14 @@ @@ -249,6 +253,14 @@
249 $.get('/home/getaddress.json', { 253 $.get('/home/getaddress.json', {
250 id: id 254 id: id
251 }, resultData => { 255 }, resultData => {
  256 + if (resultData.length < 1) {
  257 + areaCode.val(id);
  258 + area.val(this.province.title + ' '
  259 + + this.city.title + ' '
  260 + + this.area.title + ' '
  261 + + this.street.title);
  262 + this.show = false;
  263 + }
252 264
253 /* 数据绑定 */ 265 /* 数据绑定 */
254 switch((id + '').length) { 266 switch((id + '').length) {
@@ -274,6 +286,11 @@ @@ -274,6 +286,11 @@
274 286
275 /* 关闭地址选择组件 */ 287 /* 关闭地址选择组件 */
276 closeAddBox() { 288 closeAddBox() {
  289 + areaCode.val(this.street.id || this.area.id || this.city.id || this.province.id);
  290 + area.val(this.province.title + ' '
  291 + + this.city.title + ' '
  292 + + this.area.title + ' '
  293 + + this.street.title);
277 this.show = false; 294 this.show = false;
278 }, 295 },
279 296