Authored by 郭成尧

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

四级地址相关



See merge request !632
<div class="my-address-page yoho-page">
<div class="tip">为提高配送时效,请您尽量准确填写四级地址。</div>
<div class="my-edit-address-page page-wrap">
<form class="edit-address">
<input type="hidden" name="id" value="{{address.addressId}}">
... ...
... ... @@ -11,6 +11,7 @@
</div>
</div>
{{/ address}}
<div class="tip">为提高配送时效,请您尽量准确填写四级地址。</div>
<a class="add-address" data-href="/home/addressAct">
添加新地址
</a>
... ...
<div class="address-modify">
{{#unless changeProvince}}
<div class="tip">由于需要仓库调拨,目前暂不支持省地址修改,请您谅解!</div>
<div class="tip red">由于需要仓库调拨,目前暂不支持省地址修改,请您谅解!</div>
{{/unless}}
<div class="tip">为提高配送时效,请您尽量准确填写四级地址。</div>
<form class="form edit-address" id="areaForm">
<div class="form-group">
<label for="username">收货人:</label>
... ...
... ... @@ -2,6 +2,12 @@
width: 100%;
background: #f0f0f0;
.tip {
padding: 20px;
text-align: center;
color: #aeaeae;
}
.address-item {
display: block;
padding: 20px 30px;
... ... @@ -60,7 +66,6 @@
.add-address {
display: block;
margin-top: 30px;
margin-bottom: 30px;
font-size: 32px;
line-height: 88px;
... ...
... ... @@ -10,13 +10,17 @@
color: #aeaeae;
font-size: 22px;
line-height: 60px;
padding-left: 30px;
text-align: center;
.icon-info {
margin-right: 5px;
}
}
.red {
color: #d62927;
}
.form {
border-top: 1px solid #e7e7e7;
border-bottom: 1px solid #e7e7e7;
... ...
... ... @@ -27,7 +27,7 @@
</ul>
<ul v-if="street.showList" class="address-ul">
<li v-for="pstreet in streets"
@click="switchAddress(pstreet.id, pstreet.caption, true)">{{pstreet.caption}}
@click="switchAddress(pstreet.id, pstreet.caption)">{{pstreet.caption}}
<span v-if="pstreet.id === street.id" class="iconfont icon-v"></span></li>
</ul>
</div>
... ... @@ -166,11 +166,8 @@
}
</style>
<script>
const $ = require('yoho-jquery');
// const tip = require('../../../js/plugin/tip');
require('home/address/address-index.page.css');
const $ = require('yoho-jquery');
let areaForm = $('.edit-address');
let areaCode = areaForm.find('input[name=area_code]');
... ... @@ -222,18 +219,17 @@
/* 返回标题处理 */
returnTitle() {
let getTitle = '';
let streetTitle = this.street.allTitle !== '全部' ? this.street.allTitle : '';
let returnTitle = '';
if (this.supportChangeProvince) {
getTitle = this.province.allTitle +
this.city.allTitle +
this.area.allTitle +
streetTitle;
this.street.allTitle;
} else {
getTitle = this.city.allTitle +
this.area.allTitle +
streetTitle;
this.street.allTitle;
}
if (getTitle.length > 11) {
... ... @@ -277,15 +273,13 @@
this.province.titleActive = this.area.titleActive = this.street.titleActive = false;
break;
case 6:
if (caption !== '全部') {
this.area.id = id;
this.area.allTitle = caption;
this.area.title = this.titleHandle(caption);
this.street.title = '请选择';
this.street.showList = this.area.titleActive = true;
this.province.showList = this.city.showList = this.area.showList = false;
this.province.titleActive = this.city.titleActive = this.street.titleActive = false;
}
this.area.id = id;
this.area.allTitle = caption;
this.area.title = this.titleHandle(caption);
this.street.title = '请选择';
this.street.showList = this.area.titleActive = true;
this.province.showList = this.city.showList = this.area.showList = false;
this.province.titleActive = this.city.titleActive = this.street.titleActive = false;
break;
case 9:
this.street.id = id;
... ... @@ -305,24 +299,13 @@
},
/* 获取地址数据绑定 */
switchAddress(id, caption, isStreet) {
switchAddress(id, caption) {
if (!id) {
id = 0;
}
this.changeShow(id, caption);
/* 选择全部的控制 */
if (isStreet && (id + '').length === 6) {
this.street.allTitle = this.street.title = '全部';
this.street.id = id;
areaCode.val(id);
let returnTitle = this.returnTitle();
area.val(returnTitle);
this.show = false;
}
$.get('/home/getaddress.json', {
id: id
}, resultData => {
... ... @@ -345,12 +328,7 @@
this.areas = resultData;
break;
case 6:
this.streets = [];
this.streets.push({
caption: '全部',
id: this.area.id
});
$.merge(this.streets, resultData);
this.streets = resultData;
break;
default:
this.provinces = resultData;
... ... @@ -376,7 +354,6 @@
switch (type) {
case 'province':
if (!this.supportChangeProvince) {
// tip.show('不允许修改省地址!');
return false;
}
if (this.provinces.length < 1) {
... ...