zn-cloud-wcs/mobile-web/src/page/user/address/list.vue
sin 6d3fe11b17 - 优化 productcard.vue 图片url取得是 array
- 订单url地址选择 未完成
2019-04-10 20:45:44 +08:00

77 lines
1.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<headerNav title="我的地址"/>
<van-address-list
v-model="chosenAddressId"
:class="isSelect?'':'hideselect'"
:list="list"
@add="onAdd"
@edit="onEdit"
@select="onSelect"
/>
</div>
</template>
<script>
import {GetAddressList} from "../../../api/user.js";
import { AddressList } from 'vant';
import eventBus from '../../eventBus';
export default {
components: {
[AddressList.name]: AddressList,
},
data() {
return {
chosenAddressId: '1',
isSelect: false,
list: [],
}
},
methods: {
onAdd() {
this.$router.push('/user/address/edit')
},
onEdit(item, index) {
this.$router.push('/user/address/edit?id=' + item.id);
},
onSelect(item, index) {
if (!this.isSelect) {
return;
}
this.$emit('selectaddress', item);
//传递一个mapchoiceHospital是keyhospital是value
// eventBus.$emit('selectaddress',item);
this.$router.go(-1);
}
},
created: function () {
this.chosenAddressId = this.$route.query.id;
this.isSelect = this.$route.query.id > 0;
GetAddressList().then(response => {
this.list = response.map(item => {
// convert data
return {
...item,
tel: item.mobile,
}
});
})
}
}
</script>
<style lang="less">
.hideselect {
.van-radio__input {
display: none;
}
}
</style>