第一次上传
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<view class="address-manager">
|
||||
<!-- 提示信息 -->
|
||||
<view class="tip-bar">
|
||||
<u-icon name="info-circle" size="24rpx" color="#ff9c07" class="info-icon"></u-icon>
|
||||
<text class="tip-text">最多可添加10个收货地址</text>
|
||||
</view>
|
||||
|
||||
<!-- 地址列表 -->
|
||||
<view class="address-list">
|
||||
<!-- 地址项1 - 默认地址 -->
|
||||
<view v-for="(address,index) in addressList " :key="index" class="address-item">
|
||||
<view class="address-content">
|
||||
<view class="name-phone">
|
||||
<text class="name">{{ address.name }}</text>
|
||||
<text class="phone">{{ address.phone }}</text>
|
||||
<view v-if="address.isDefault==1" class="default-tag">默认</view>
|
||||
</view>
|
||||
<text class="address">{{address.address}}</text>
|
||||
</view>
|
||||
<up-icon @click="Service.GoPage('/pages/userFunc/addAddress?addressId='+address.addressId)"
|
||||
name="edit-pen" color="#1890FF" size="22"></up-icon>
|
||||
<up-icon @click="deleAddress(address.addressId)" name="trash" color="#FF4D4F" size="22"></up-icon>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 新增地址按钮 -->
|
||||
<view class=""
|
||||
style=" border-top: 1rpx solid #e2e2e2; position: fixed; bottom: 0; width: 100%; padding: 30rpx 20rpx; background-color: #fff; ">
|
||||
<up-button @click="Service.GoPage('/pages/userFunc/addAddress')" color='var(--nav-mian)' shape='circle'
|
||||
style="width: 90%; margin: 15rpx auto 0; " text="新增地址"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Service } from "@/Service/Service"
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { vpAddressService } from '@/Service/vp/vpAddressService'
|
||||
|
||||
// 地址数据
|
||||
const addressList = ref<Array<any>>([
|
||||
]);
|
||||
|
||||
onLoad(() => {
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
getData()
|
||||
});
|
||||
|
||||
const getData = () => {
|
||||
vpAddressService.GetUserAddressList().then(res => {
|
||||
if (res.code == 0) {
|
||||
addressList.value = res.data.list
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleAddress = (id:any) => {
|
||||
uni.showModal({
|
||||
title: '提示', // 对话框标题
|
||||
content: '是否删除该地址', // 显示的内容
|
||||
showCancel: true, // 是否显示取消按钮
|
||||
cancelText: '取消', // 取消按钮的文字
|
||||
cancelColor: '#000000', // 取消按钮的文字颜色
|
||||
confirmText: '确定', // 确认按钮的文字
|
||||
confirmColor: '#3c76ff', // 确认按钮的文字颜色
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
vpAddressService.DelUserAddress(id).then(content=>{
|
||||
if(content.code==0){
|
||||
Service.Msg('删除成功!')
|
||||
getData()
|
||||
}else{
|
||||
Service.Msg(content.msg)
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.address-manager {
|
||||
background-color: #f6f6f6;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* 提示信息样式 */
|
||||
.tip-bar {
|
||||
background-color: #fff8e6;
|
||||
padding: 20rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info-icon {
|
||||
color: #ff9c07;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
font-size: 26rpx;
|
||||
color: #ff9c07;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 地址列表样式 */
|
||||
.address-list {
|
||||
|
||||
background-color: #fff;
|
||||
padding: 0 30rpx;
|
||||
border-top: 1rpx solid #e2e2e2;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
|
||||
.address-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 30rpx 0;
|
||||
border-bottom: 1rpx solid #fff;
|
||||
gap: 10rpx;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.address-content {
|
||||
flex: 1;
|
||||
|
||||
.name-phone {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.name {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.phone {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.default-tag {
|
||||
background-color: #ff6b00;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 15rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.address {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
color: #999;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 新增地址按钮样式 */
|
||||
.add-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
background-color: #ff6b00;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user