Files
frontend-app/components/address.vue
T

97 lines
2.3 KiB
Vue
Raw Normal View History

2025-08-06 20:25:41 +08:00
<template>
<view class="mine_address_warp">
<view v-for="item in addressList" :key="item.id"
:class="selectAddress && selectAddress.id === item.id ? 'address_item address_item_sel' : 'address_item'"
v-if="addressList && addressList.length !== 0" @click="checkAddress(item)">
2025-08-05 15:25:23 +08:00
<view class="address_item_country_name">
2025-08-06 20:25:41 +08:00
{{ item.countryName }} {{ item.provinceName }} {{ item.cityName }} {{ item.areaName }}
2025-08-05 15:25:23 +08:00
</view>
<view class="address_item_address">
2025-08-06 20:25:41 +08:00
{{ item.address }}
2025-08-05 15:25:23 +08:00
</view>
<view class="address_item_info">
2025-08-06 20:25:41 +08:00
<view>{{ item.name }}</view>
<view style="margin-left: 20rpx;">{{ item.phone }}</view>
2025-08-05 15:25:23 +08:00
</view>
</view>
<view v-else class="not_order_warp">
2025-08-06 20:25:41 +08:00
<view class="not_order_warp_img"><up-image src="/static/common/not_search.png" width="100" height="100"
bgColor="#f1f6ff00"></up-image></view>
2025-08-05 15:25:23 +08:00
<view class="not_order_msg_warp">暂时地址,快去地址管理添加吧~</view>
</view>
2025-08-06 20:25:41 +08:00
</view>
</template>
2025-08-05 15:25:23 +08:00
<script>
2025-08-06 20:25:41 +08:00
import { getAddress, setAddressDefault, deleteAddress } from '@/api/address.js';
export default {
data() {
return {
addressList: [],
selectAddress: {},
}
},
mounted() {
this.getAddressList();
},
2025-10-27 22:54:10 +08:00
activated () {
this.getAddressList();
},
2025-08-06 20:25:41 +08:00
methods: {
// 添加地址
jumpAddAddress() {
uni.navigateTo({
2025-08-07 22:26:22 +08:00
url: '/pages/mine_package/mine_address_add/mine_address_add',
2025-08-06 20:25:41 +08:00
})
2025-08-05 15:25:23 +08:00
},
2025-08-06 20:25:41 +08:00
// 查询地址
async getAddressList() {
const res = await getAddress();
if (res && res.bizcode === 100) {
this.addressList = res.data;
2026-06-14 22:23:14 +08:00
console.log("我是秦星星addressList", this.addressList);
2025-08-06 20:25:41 +08:00
}
},
checkAddress(item) {
2026-06-14 22:23:14 +08:00
console.log("我是秦星星", item);
2025-08-06 20:25:41 +08:00
this.selectAddress = item;
this.$emit("valueFunc", item);
},
}
}
</script>
2025-08-05 15:25:23 +08:00
<style lang="scss" scoped>
2025-08-06 20:25:41 +08:00
.mine_address_warp {}
.address_item {
background: #FFFFFF;
padding: 30rpx;
border-bottom: 1rpx solid #9e9e9e26;
}
.address_item_sel {
color: $app-bt-bj !important;
background-color: #ff57220d;
}
.address_item_info {
font-size: 26rpx;
color: #868383;
display: flex;
}
.address_item_address {
font-weight: bold;
font-size: 32rpx;
color: #666666;
margin: 10rpx 0;
}
.address_item_country_name {
color: #9E9E9E;
font-size: 22rpx;
}
</style>