parent
e414d3f979
commit
c26af54829
@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="item" v-for="(res, index) in siteList.list" :key="res.id">
|
||||
<view class="top">
|
||||
<view class="name">{{ res.userName }}</view>
|
||||
<view class="phone">{{ res.phone }}</view>
|
||||
<view class="tag">
|
||||
<text v-if="res.status == '1'" style="background-color: #F3AF28;">默认</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
{{res.area}},{{res.address}}
|
||||
<u-icon @click="update(res)" name="edit-pen" :size="40" color="#999999"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="addSite" @tap="toAddSite">
|
||||
<view class="add">
|
||||
<u-icon name="plus" color="#ffffff" class="icon" :size="30"></u-icon>新建收货地址
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
addressListApi
|
||||
} from '../../api/user.js'
|
||||
//地址数据
|
||||
const siteList = reactive({
|
||||
list: []
|
||||
})
|
||||
//查询地址数据
|
||||
const getList = async () => {
|
||||
let res = await addressListApi({
|
||||
openid: uni.getStorageSync('openid')
|
||||
})
|
||||
console.log(res)
|
||||
if (res && res.code == 200) {
|
||||
siteList.list = res.data
|
||||
}
|
||||
}
|
||||
//跳转新增地址
|
||||
const toAddSite = () => {
|
||||
uni.navigateTo({
|
||||
url: '../address/address'
|
||||
});
|
||||
}
|
||||
//修改
|
||||
const update = (item) => {
|
||||
console.log(item)
|
||||
uni.navigateTo({
|
||||
url: '../address/address'
|
||||
});
|
||||
}
|
||||
onShow(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item {
|
||||
padding: 40rpx 20rpx;
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
font-weight: bold;
|
||||
font-size: 34rpx;
|
||||
|
||||
.phone {
|
||||
margin-left: 60rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
font-weight: normal;
|
||||
align-items: center;
|
||||
|
||||
text {
|
||||
display: block;
|
||||
width: 60rpx;
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
color: #ffffff;
|
||||
font-size: 20rpx;
|
||||
border-radius: 6rpx;
|
||||
text-align: center;
|
||||
margin-left: 30rpx;
|
||||
background-color: rgb(49, 145, 253);
|
||||
}
|
||||
|
||||
.red {
|
||||
background-color: red
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
display: flex;
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
justify-content: space-between;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.addSite {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
width: 600rpx;
|
||||
line-height: 100rpx;
|
||||
position: absolute;
|
||||
bottom: 30rpx;
|
||||
left: 80rpx;
|
||||
background-color: #F3AF28;
|
||||
border-radius: 60rpx;
|
||||
font-size: 30rpx;
|
||||
|
||||
.add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #ffffff;
|
||||
|
||||
.icon {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue