|
|
@ -5,7 +5,7 @@
|
|
|
|
<div class="address__msg-line flex flex-middle">
|
|
|
|
<div class="address__msg-line flex flex-middle">
|
|
|
|
<img src="@/assets/img/goods/point.png" alt="收货地址" />
|
|
|
|
<img src="@/assets/img/goods/point.png" alt="收货地址" />
|
|
|
|
<span class="address__msg-line--txt">默认地址</span>
|
|
|
|
<span class="address__msg-line--txt">默认地址</span>
|
|
|
|
<UiButton type="yellow_panel">修改</UiButton>
|
|
|
|
<UiButton type="yellow_panel" @click="onEdit()">修改</UiButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="address__msg-line flex flex-middle">
|
|
|
|
<div class="address__msg-line flex flex-middle">
|
|
|
|
<span class="address__msg-line--type">收货地址:</span>
|
|
|
|
<span class="address__msg-line--type">收货地址:</span>
|
|
|
@ -73,6 +73,7 @@
|
|
|
|
type="textarea"
|
|
|
|
type="textarea"
|
|
|
|
:rows="3"
|
|
|
|
:rows="3"
|
|
|
|
class="max-ipt"
|
|
|
|
class="max-ipt"
|
|
|
|
|
|
|
|
maxlength="60"
|
|
|
|
></el-input>
|
|
|
|
></el-input>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="address__msg-line flex flex-middle">
|
|
|
|
<div class="address__msg-line flex flex-middle">
|
|
|
@ -88,11 +89,11 @@
|
|
|
|
</article>
|
|
|
|
</article>
|
|
|
|
<div class="hr" v-if="!isAccount"></div>
|
|
|
|
<div class="hr" v-if="!isAccount"></div>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
class="address__operation flex flex-middle"
|
|
|
|
class="address__edit flex flex-middle"
|
|
|
|
:class="!isAccount ? 'flex-column' : ''"
|
|
|
|
:class="!isAccount ? 'flex-column' : ''"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-checkbox v-model="defaultAddress">设为默认地址</el-checkbox>
|
|
|
|
<el-checkbox v-model="defaultAddress">设为默认地址</el-checkbox>
|
|
|
|
<div>
|
|
|
|
<div class="address__edit--btns flex flex-middle">
|
|
|
|
<UiButton
|
|
|
|
<UiButton
|
|
|
|
v-if="addressList && addressList.length && !isAccount"
|
|
|
|
v-if="addressList && addressList.length && !isAccount"
|
|
|
|
type="grey"
|
|
|
|
type="grey"
|
|
|
@ -100,7 +101,7 @@
|
|
|
|
>取消</UiButton
|
|
|
|
>取消</UiButton
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<UiButton type="yellow_panel" @click="onAddAddress"
|
|
|
|
<UiButton type="yellow_panel" @click="onAddAddress"
|
|
|
|
>保存地址</UiButton
|
|
|
|
>{{ getEditState ? "保存" : "新增" }}地址</UiButton
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -115,13 +116,25 @@
|
|
|
|
<div class="address__list">
|
|
|
|
<div class="address__list">
|
|
|
|
<section
|
|
|
|
<section
|
|
|
|
@click="onAddressItem(item)"
|
|
|
|
@click="onAddressItem(item)"
|
|
|
|
class="address__list--item"
|
|
|
|
class="address__list-item"
|
|
|
|
|
|
|
|
:class="
|
|
|
|
|
|
|
|
item.id == curAddressListItem.id ? 'address__list-active' : ''
|
|
|
|
|
|
|
|
"
|
|
|
|
v-for="item in addressList"
|
|
|
|
v-for="item in addressList"
|
|
|
|
:key="item.id"
|
|
|
|
:key="item.id"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div>收货人:{{ item.name }}</div>
|
|
|
|
<div class="address__list-item--name">
|
|
|
|
<div>手机号码:{{ item.phone }}</div>
|
|
|
|
<span class="address__list-item--label">收 货 人 :</span
|
|
|
|
<div>收货地址:{{ item.detailAddress }}</div>
|
|
|
|
>{{ item.name }}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="address__list-item--phone">
|
|
|
|
|
|
|
|
<span class="address__list-item--label">手机号码:</span
|
|
|
|
|
|
|
|
>{{ item.phone }}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="address__list-item--detail">
|
|
|
|
|
|
|
|
<span class="address__list-item--label">收货地址:</span>
|
|
|
|
|
|
|
|
{{ item.province + item.city + item.area + item.detailAddress }}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<span slot="footer" class="dialog-footer flex flex-between">
|
|
|
|
<span slot="footer" class="dialog-footer flex flex-between">
|
|
|
@ -150,7 +163,7 @@ export default {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
isEdit: {
|
|
|
|
isParentEdit: {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -159,14 +172,20 @@ export default {
|
|
|
|
prop: "addressData",
|
|
|
|
prop: "addressData",
|
|
|
|
event: "emitAddress",
|
|
|
|
event: "emitAddress",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
getEditState() {
|
|
|
|
|
|
|
|
return this.isEdit || this.isParentEdit;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
isEdit: false,
|
|
|
|
isOperation: false,
|
|
|
|
isOperation: false,
|
|
|
|
dialogVisible: false,
|
|
|
|
dialogVisible: false,
|
|
|
|
detailAddress: "",
|
|
|
|
detailAddress: "",
|
|
|
|
addressUser: "",
|
|
|
|
addressUser: "",
|
|
|
|
addressPhone: "",
|
|
|
|
addressPhone: "",
|
|
|
|
defaultAddress: true,
|
|
|
|
defaultAddress: false,
|
|
|
|
selectData: {
|
|
|
|
selectData: {
|
|
|
|
area: {
|
|
|
|
area: {
|
|
|
|
value: "",
|
|
|
|
value: "",
|
|
|
@ -187,12 +206,24 @@ export default {
|
|
|
|
this.getAddressData();
|
|
|
|
this.getAddressData();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
onEdit() {
|
|
|
|
|
|
|
|
let vm = this;
|
|
|
|
|
|
|
|
let curIndex = vm.addressList.findIndex(
|
|
|
|
|
|
|
|
(item) => item.id == vm.curAddressListItem.id
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
vm.isOperation = true;
|
|
|
|
|
|
|
|
vm.isEdit = true;
|
|
|
|
|
|
|
|
vm.setAddressData(curIndex);
|
|
|
|
|
|
|
|
},
|
|
|
|
async getAddressData() {
|
|
|
|
async getAddressData() {
|
|
|
|
let vm = this;
|
|
|
|
let vm = this;
|
|
|
|
let res = await ApiGetAddress();
|
|
|
|
let res = await ApiGetAddress();
|
|
|
|
if (res.result && res.result.length) {
|
|
|
|
if (res.result && res.result.length) {
|
|
|
|
vm.isOperation = false;
|
|
|
|
vm.isOperation = false;
|
|
|
|
vm.addressList = res.result;
|
|
|
|
vm.addressList = res.result;
|
|
|
|
|
|
|
|
if (!vm.addressList.length) {
|
|
|
|
|
|
|
|
vm.defaultAddress = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
let curIndex = vm.addressList.findIndex((item) => item.isDefault);
|
|
|
|
let curIndex = vm.addressList.findIndex((item) => item.isDefault);
|
|
|
|
vm.curAddressListItem =
|
|
|
|
vm.curAddressListItem =
|
|
|
|
curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0];
|
|
|
|
curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0];
|
|
|
@ -257,7 +288,7 @@ export default {
|
|
|
|
provinceCode: vm.selectData.province.code,
|
|
|
|
provinceCode: vm.selectData.province.code,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let res;
|
|
|
|
let res;
|
|
|
|
if (vm.isEdit) {
|
|
|
|
if (vm.getEditState) {
|
|
|
|
let editParams = Object.assign(vm.addressList[vm.editIndex], params);
|
|
|
|
let editParams = Object.assign(vm.addressList[vm.editIndex], params);
|
|
|
|
res = await ApiPutAddress(editParams);
|
|
|
|
res = await ApiPutAddress(editParams);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -265,6 +296,15 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!res.error) {
|
|
|
|
if (!res.error) {
|
|
|
|
vm.$message.success("添加成功!");
|
|
|
|
vm.$message.success("添加成功!");
|
|
|
|
|
|
|
|
vm.$set(vm.selectData.area, "value", "");
|
|
|
|
|
|
|
|
vm.$set(vm.selectData.city, "value", "");
|
|
|
|
|
|
|
|
vm.$set(vm.selectData.province, "value", "");
|
|
|
|
|
|
|
|
vm.$set(vm, "detailAddress", "");
|
|
|
|
|
|
|
|
vm.$set(vm, "defaultAddress", "");
|
|
|
|
|
|
|
|
vm.$set(vm, "addressUser", "");
|
|
|
|
|
|
|
|
vm.$set(vm, "addressPhone", "");
|
|
|
|
|
|
|
|
vm.$emit("onSaveSuccess");
|
|
|
|
|
|
|
|
vm.isEdit = false;
|
|
|
|
vm.getAddressData();
|
|
|
|
vm.getAddressData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(res);
|
|
|
|
console.log(res);
|
|
|
@ -355,6 +395,22 @@ export default {
|
|
|
|
margin-right: 10px;
|
|
|
|
margin-right: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&__edit {
|
|
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
&--btns {
|
|
|
|
|
|
|
|
margin-top: 30px;
|
|
|
|
|
|
|
|
/deep/.ui-button__grey {
|
|
|
|
|
|
|
|
width: 90px;
|
|
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
|
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
|
|
color: #666666;
|
|
|
|
|
|
|
|
margin-right: 38px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.address__list {
|
|
|
|
.address__list {
|
|
|
@ -376,11 +432,41 @@ export default {
|
|
|
|
border-radius: 10px;
|
|
|
|
border-radius: 10px;
|
|
|
|
background-color: #eeeeee;
|
|
|
|
background-color: #eeeeee;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&--item {
|
|
|
|
&-item {
|
|
|
|
width: 320px;
|
|
|
|
width: 320px;
|
|
|
|
height: 120px;
|
|
|
|
height: 120px;
|
|
|
|
border: 1px solid #dddddd;
|
|
|
|
border: 1px solid #dddddd;
|
|
|
|
margin-bottom: 24px;
|
|
|
|
margin-bottom: 24px;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
padding: 16px 20px;
|
|
|
|
|
|
|
|
> div {
|
|
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&--detail {
|
|
|
|
|
|
|
|
@include ellipses(2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&--label {
|
|
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
|
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
|
|
color: #999999;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&-active {
|
|
|
|
|
|
|
|
border: 1px solid #ff875b;
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
|
|
|
content: "";
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
|
|
width: 24px;
|
|
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
|
|
background: url(@/assets/img/goods/active.png);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|