purchase-let/pagesOrder/addressList/addressList.vue

148 lines
3.6 KiB
Vue
Raw Normal View History

2024-04-27 18:02:43 +08:00
<template>
<view class="list">
<view class="address-card" v-for="(item, index) in 3" :key="index">
<view class="address-info">
<view class="top">
<view class="name">收货人小李</view>
<view class="phone">14566666666</view>
</view>
<view class="bottom">
四川泸州市龙马潭区莲花池街道商业街1号
</view>
</view>
<view class="btn-box">
<view class="left">
<image v-if="false" src="@/static/icon/check.png"></image>
<image v-else src="@/static/icon/n-check.png"></image>
<view>设为默认</view>
</view>
<view class="right">
<view class="btn" @click="showDelete(item)">
<up-icon name="trash"></up-icon>
删除
</view>
<view class="btn" @click="navTo('/pagesOrder/addressEdit/addressEdit?mode=edit')">
<up-icon name="edit-pen"></up-icon>
编辑
</view>
</view>
</view>
</view>
<view style="width: 100%;height: 150rpx;"></view>
<view class="bottom-fixed">
<up-button color="#20B128" shape="circle" @click="navTo('/pagesOrder/addressEdit/addressEdit')">新增地址</up-button>
</view>
<modal :show="show" title="确认删除吗" content="删除后不可恢复" @close="show=false" @change="deleteAddress"></modal>
</view>
</template>
<script setup>
import { ref } from "vue"
import modal from "@/components/modal.vue";
const navTo = (url)=>{
uni.navigateTo({
url: url
})
}
const show = ref(false);
const deleteInfo = ref({});
const showDelete = (item)=>{
deleteInfo.value = item;
show.value = true;
}
const deleteAddress = ()=>{
console.log(deleteInfo.value);
show.value = false;
}
</script>
<style lang="scss">
.address-card {
margin: 20rpx;
background-color: #fff;
border-radius: 14rpx;
box-sizing: border-box;
padding: 20rpx;
color: #444;
.address-info {
padding-bottom: 20rpx;
border-bottom: 1rpx solid #eee;
margin-bottom: 20rpx;
.top {
display: flex;
justify-content: space-between;
font-size: 28rpx;
.name {
color: #000;
}
}
.bottom {
font-size: 26rpx;
margin-top: 10rpx;
}
}
.btn-box {
display: flex;
justify-content: space-between;
font-size: 26rpx;
.left{
display: flex;
align-items: center;
image{
width: 40rpx;
height: 40rpx;
margin-right: 6rpx;
}
}
.right {
display: flex;
color: #7a7a7a;
align-items: center;
.btn {
display: flex;
margin-left: 20rpx;
&:active {
color: rgba(#7a7a7a, 0.8);
transition: background-color 0.5s;
animation: disappear 0.5s 0.5s forwards;
}
}
}
}
}
.bottom-fixed{
position: fixed;
bottom: 0;
left: 0;
height: 120rpx;
height: calc(constant(safe-area-inset-bottom) + 120rpx); /* 适用于iOS设备 */
height: calc(env(safe-area-inset-bottom) + 120rpx); /* 适用于Android设备 */
width: 100%;
box-sizing: border-box;
background-color: #fff;
padding: 20rpx;
padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx); /* 适用于iOS设备 */
padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx); /* 适用于Android设备 */
}
@keyframes disappear {
to {
opacity: 0;
/* 渐隐 */
transform: scale(0);
/* 缩小 */
}
}
</style>