Authored by 郭成尧

Merge branch 'feature/address4' into 'release/5.8'

四级地址相关



See merge request !632
1 <div class="my-address-page yoho-page"> 1 <div class="my-address-page yoho-page">
  2 + <div class="tip">为提高配送时效,请您尽量准确填写四级地址。</div>
2 <div class="my-edit-address-page page-wrap"> 3 <div class="my-edit-address-page page-wrap">
3 <form class="edit-address"> 4 <form class="edit-address">
4 <input type="hidden" name="id" value="{{address.addressId}}"> 5 <input type="hidden" name="id" value="{{address.addressId}}">
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 </div> 11 </div>
12 </div> 12 </div>
13 {{/ address}} 13 {{/ address}}
  14 + <div class="tip">为提高配送时效,请您尽量准确填写四级地址。</div>
14 <a class="add-address" data-href="/home/addressAct"> 15 <a class="add-address" data-href="/home/addressAct">
15 添加新地址 16 添加新地址
16 </a> 17 </a>
1 <div class="address-modify"> 1 <div class="address-modify">
2 {{#unless changeProvince}} 2 {{#unless changeProvince}}
3 - <div class="tip">由于需要仓库调拨,目前暂不支持省地址修改,请您谅解!</div> 3 + <div class="tip red">由于需要仓库调拨,目前暂不支持省地址修改,请您谅解!</div>
4 {{/unless}} 4 {{/unless}}
  5 + <div class="tip">为提高配送时效,请您尽量准确填写四级地址。</div>
5 <form class="form edit-address" id="areaForm"> 6 <form class="form edit-address" id="areaForm">
6 <div class="form-group"> 7 <div class="form-group">
7 <label for="username">收货人:</label> 8 <label for="username">收货人:</label>
@@ -2,6 +2,12 @@ @@ -2,6 +2,12 @@
2 width: 100%; 2 width: 100%;
3 background: #f0f0f0; 3 background: #f0f0f0;
4 4
  5 + .tip {
  6 + padding: 20px;
  7 + text-align: center;
  8 + color: #aeaeae;
  9 + }
  10 +
5 .address-item { 11 .address-item {
6 display: block; 12 display: block;
7 padding: 20px 30px; 13 padding: 20px 30px;
@@ -60,7 +66,6 @@ @@ -60,7 +66,6 @@
60 66
61 .add-address { 67 .add-address {
62 display: block; 68 display: block;
63 - margin-top: 30px;  
64 margin-bottom: 30px; 69 margin-bottom: 30px;
65 font-size: 32px; 70 font-size: 32px;
66 line-height: 88px; 71 line-height: 88px;
@@ -10,13 +10,17 @@ @@ -10,13 +10,17 @@
10 color: #aeaeae; 10 color: #aeaeae;
11 font-size: 22px; 11 font-size: 22px;
12 line-height: 60px; 12 line-height: 60px;
13 - padding-left: 30px; 13 + text-align: center;
14 14
15 .icon-info { 15 .icon-info {
16 margin-right: 5px; 16 margin-right: 5px;
17 } 17 }
18 } 18 }
19 19
  20 + .red {
  21 + color: #d62927;
  22 + }
  23 +
20 .form { 24 .form {
21 border-top: 1px solid #e7e7e7; 25 border-top: 1px solid #e7e7e7;
22 border-bottom: 1px solid #e7e7e7; 26 border-bottom: 1px solid #e7e7e7;
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 </ul> 27 </ul>
28 <ul v-if="street.showList" class="address-ul"> 28 <ul v-if="street.showList" class="address-ul">
29 <li v-for="pstreet in streets" 29 <li v-for="pstreet in streets"
30 - @click="switchAddress(pstreet.id, pstreet.caption, true)">{{pstreet.caption}} 30 + @click="switchAddress(pstreet.id, pstreet.caption)">{{pstreet.caption}}
31 <span v-if="pstreet.id === street.id" class="iconfont icon-v"></span></li> 31 <span v-if="pstreet.id === street.id" class="iconfont icon-v"></span></li>
32 </ul> 32 </ul>
33 </div> 33 </div>
@@ -166,11 +166,8 @@ @@ -166,11 +166,8 @@
166 } 166 }
167 </style> 167 </style>
168 <script> 168 <script>
169 - const $ = require('yoho-jquery');  
170 -  
171 - // const tip = require('../../../js/plugin/tip');  
172 -  
173 require('home/address/address-index.page.css'); 169 require('home/address/address-index.page.css');
  170 + const $ = require('yoho-jquery');
174 171
175 let areaForm = $('.edit-address'); 172 let areaForm = $('.edit-address');
176 let areaCode = areaForm.find('input[name=area_code]'); 173 let areaCode = areaForm.find('input[name=area_code]');
@@ -222,18 +219,17 @@ @@ -222,18 +219,17 @@
222 /* 返回标题处理 */ 219 /* 返回标题处理 */
223 returnTitle() { 220 returnTitle() {
224 let getTitle = ''; 221 let getTitle = '';
225 - let streetTitle = this.street.allTitle !== '全部' ? this.street.allTitle : '';  
226 let returnTitle = ''; 222 let returnTitle = '';
227 223
228 if (this.supportChangeProvince) { 224 if (this.supportChangeProvince) {
229 getTitle = this.province.allTitle + 225 getTitle = this.province.allTitle +
230 this.city.allTitle + 226 this.city.allTitle +
231 this.area.allTitle + 227 this.area.allTitle +
232 - streetTitle; 228 + this.street.allTitle;
233 } else { 229 } else {
234 getTitle = this.city.allTitle + 230 getTitle = this.city.allTitle +
235 this.area.allTitle + 231 this.area.allTitle +
236 - streetTitle; 232 + this.street.allTitle;
237 } 233 }
238 234
239 if (getTitle.length > 11) { 235 if (getTitle.length > 11) {
@@ -277,15 +273,13 @@ @@ -277,15 +273,13 @@
277 this.province.titleActive = this.area.titleActive = this.street.titleActive = false; 273 this.province.titleActive = this.area.titleActive = this.street.titleActive = false;
278 break; 274 break;
279 case 6: 275 case 6:
280 - if (caption !== '全部') {  
281 - this.area.id = id;  
282 - this.area.allTitle = caption;  
283 - this.area.title = this.titleHandle(caption);  
284 - this.street.title = '请选择';  
285 - this.street.showList = this.area.titleActive = true;  
286 - this.province.showList = this.city.showList = this.area.showList = false;  
287 - this.province.titleActive = this.city.titleActive = this.street.titleActive = false;  
288 - } 276 + this.area.id = id;
  277 + this.area.allTitle = caption;
  278 + this.area.title = this.titleHandle(caption);
  279 + this.street.title = '请选择';
  280 + this.street.showList = this.area.titleActive = true;
  281 + this.province.showList = this.city.showList = this.area.showList = false;
  282 + this.province.titleActive = this.city.titleActive = this.street.titleActive = false;
289 break; 283 break;
290 case 9: 284 case 9:
291 this.street.id = id; 285 this.street.id = id;
@@ -305,24 +299,13 @@ @@ -305,24 +299,13 @@
305 }, 299 },
306 300
307 /* 获取地址数据绑定 */ 301 /* 获取地址数据绑定 */
308 - switchAddress(id, caption, isStreet) { 302 + switchAddress(id, caption) {
309 if (!id) { 303 if (!id) {
310 id = 0; 304 id = 0;
311 } 305 }
312 306
313 this.changeShow(id, caption); 307 this.changeShow(id, caption);
314 308
315 - /* 选择全部的控制 */  
316 - if (isStreet && (id + '').length === 6) {  
317 - this.street.allTitle = this.street.title = '全部';  
318 - this.street.id = id;  
319 - areaCode.val(id);  
320 - let returnTitle = this.returnTitle();  
321 -  
322 - area.val(returnTitle);  
323 - this.show = false;  
324 - }  
325 -  
326 $.get('/home/getaddress.json', { 309 $.get('/home/getaddress.json', {
327 id: id 310 id: id
328 }, resultData => { 311 }, resultData => {
@@ -345,12 +328,7 @@ @@ -345,12 +328,7 @@
345 this.areas = resultData; 328 this.areas = resultData;
346 break; 329 break;
347 case 6: 330 case 6:
348 - this.streets = [];  
349 - this.streets.push({  
350 - caption: '全部',  
351 - id: this.area.id  
352 - });  
353 - $.merge(this.streets, resultData); 331 + this.streets = resultData;
354 break; 332 break;
355 default: 333 default:
356 this.provinces = resultData; 334 this.provinces = resultData;
@@ -376,7 +354,6 @@ @@ -376,7 +354,6 @@
376 switch (type) { 354 switch (type) {
377 case 'province': 355 case 'province':
378 if (!this.supportChangeProvince) { 356 if (!this.supportChangeProvince) {
379 - // tip.show('不允许修改省地址!');  
380 return false; 357 return false;
381 } 358 }
382 if (this.provinces.length < 1) { 359 if (this.provinces.length < 1) {