276 lines
7.8 KiB
Vue
276 lines
7.8 KiB
Vue
<template>
|
|
<view class="address-empty-container">
|
|
<view class="empty-card">
|
|
<!-- 标题栏 -->
|
|
<view class="header">
|
|
<text class="address-count">共 0 个地址</text>
|
|
</view>
|
|
|
|
<!-- 图标区域 -->
|
|
<view class="icon-wrapper">
|
|
<view class="warning-icon">
|
|
<view class="circle-bg"></view>
|
|
<!-- <view class="exclamation-mark"></view>-->
|
|
<wd-icon classPrefix="xiaozizi" name="1890ff-copy" color="#f28b54" :size="30"
|
|
custom-class="exclamation-mark"/>
|
|
<view class="red-circle"></view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 提示信息 -->
|
|
<view class="text-content">
|
|
<text class="title">暂无收货地址</text>
|
|
<text class="subtitle">请添加地址以便我们为您服务</text>
|
|
</view>
|
|
|
|
<wd-button type="primary" icon="1890ff-copy" :block="true" classPrefix="xiaozizi"
|
|
@click="添加新地址" custom-class="custom-shadow">
|
|
添加新地址
|
|
</wd-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import {useMainXiaoStore} from "@/stores/piniaPro/miniChatStore";
|
|
import {useRequest} from "@uni-helper/uni-use";
|
|
import {地址_首次添加新地址} from "@/hooks/接口API";
|
|
import type {ApiAxiosResponse} from "@/types/通用类型";
|
|
import type {typeAddressData} from "@/hooks/商城类型文件";
|
|
|
|
defineOptions({options: {styleIsolation: "shared"}, name: "address-com-empty"}); // 组件使用
|
|
|
|
let xiaoMain = useMainXiaoStore();
|
|
|
|
async function 添加新地址(): Promise<void> {
|
|
try {
|
|
await wx.vibrateShort({type: "heavy"});
|
|
let chooseAddressSuccessCallbackResult = await wx.chooseAddress({});
|
|
let addressData = Object.assign(chooseAddressSuccessCallbackResult, {
|
|
self_mini_openid: xiaoMain.mini_openid,
|
|
self_user_unionid: xiaoMain.mini_unionid,
|
|
});
|
|
let data = await useRequest<ApiAxiosResponse<Array<typeAddressData>>>(地址_首次添加新地址, {
|
|
method: "POST",
|
|
data: {
|
|
addressData: addressData,
|
|
self_mini_openid: xiaoMain.mini_openid,
|
|
self_mini_unionid: xiaoMain.mini_unionid,
|
|
}
|
|
});
|
|
console.log("🍎 🍏 🍎 🍏 🍎 🍏 🍎 🍏 打印地址结果 ", data.data.value?.resData.listData);
|
|
xiaoMain.addressDataList = data.data.value?.resData.listData ?? [];
|
|
} catch (e) {
|
|
console.log("捕获错误❌🙅🙅❌🙅🙅❌🙅🙅❌🙅🙅❌🙅🙅❌🙅🙅❌🙅🙅♀️", e);
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.address-empty-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 500rpx;
|
|
//padding: 40rpx;
|
|
padding-top: 30%;
|
|
}
|
|
|
|
.empty-card {
|
|
width: 100%;
|
|
max-width: 600rpx;
|
|
padding: 40rpx 30rpx 50rpx;
|
|
border-radius: 16rpx;
|
|
//background: linear-gradient(145deg, #1a2332, #0f1622);
|
|
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.5),
|
|
0 2rpx 6rpx rgba(0, 0, 0, 0.3);
|
|
text-align: center;
|
|
position: relative;
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 2rpx;
|
|
background: linear-gradient(90deg,
|
|
transparent 0%,
|
|
rgba(0, 122, 255, 0.3) 50%,
|
|
transparent 100%);
|
|
}
|
|
}
|
|
|
|
// 标题栏样式
|
|
.header {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
margin-bottom: 40rpx;
|
|
padding-bottom: 20rpx;
|
|
border-bottom: 1rpx solid rgba(255, 255, 255, 0.1);
|
|
|
|
.address-count {
|
|
font-size: 28rpx;
|
|
color: #b0b0b0;
|
|
font-weight: 500;
|
|
}
|
|
}
|
|
|
|
// 警告图标样式 - 根据图片描述修改为红色感叹号
|
|
.icon-wrapper {
|
|
margin-bottom: 40rpx;
|
|
position: relative;
|
|
}
|
|
|
|
.warning-icon {
|
|
position: relative;
|
|
display: inline-flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 100rpx;
|
|
height: 100rpx;
|
|
margin: 0 auto;
|
|
|
|
.circle-bg {
|
|
position: absolute;
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
//background: linear-gradient(135deg, #007AFF, #0056CC);
|
|
border-radius: 50%;
|
|
box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.3),
|
|
inset 0 1rpx 1rpx rgba(255, 255, 255, 0.1);
|
|
//animation: pulse 2s ease-in-out infinite;
|
|
}
|
|
|
|
:deep(.exclamation-mark) {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%); /* 关键:自身偏移回中心 */
|
|
z-index: 999;
|
|
}
|
|
|
|
.red-circle {
|
|
position: absolute;
|
|
width: 90rpx;
|
|
height: 90rpx;
|
|
border: 3rpx solid #FF3B30;
|
|
border-radius: 50%;
|
|
opacity: 0.6;
|
|
animation: scalePulse 2s ease-out infinite;
|
|
animation-delay: 0.5s;
|
|
}
|
|
}
|
|
|
|
// 文字样式
|
|
.text-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16rpx;
|
|
margin-bottom: 50rpx;
|
|
|
|
.title {
|
|
font-size: 36rpx;
|
|
font-weight: 700;
|
|
color: #FFFFFF;
|
|
letter-spacing: 1rpx;
|
|
}
|
|
|
|
.subtitle {
|
|
font-size: 28rpx;
|
|
color: #8E8E93;
|
|
line-height: 1.5;
|
|
}
|
|
}
|
|
|
|
// 按钮样式 - 微信小程序适配
|
|
.add-btn {
|
|
width: 100%;
|
|
height: 88rpx;
|
|
background: linear-gradient(135deg, #007AFF, #0056CC);
|
|
border: none;
|
|
border-radius: 44rpx;
|
|
color: white;
|
|
font-size: 32rpx;
|
|
font-weight: 500;
|
|
position: relative;
|
|
overflow: hidden;
|
|
transition: all 0.2s ease;
|
|
box-shadow: 0 8rpx 20rpx rgba(0, 122, 255, 0.3),
|
|
0 2rpx 4rpx rgba(0, 122, 255, 0.2);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin: 0;
|
|
padding: 0;
|
|
|
|
/* 移除默认按钮样式 */
|
|
&::after {
|
|
border: none;
|
|
}
|
|
|
|
/* 按钮点击效果 */
|
|
&:active {
|
|
transform: scale(0.98);
|
|
box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.4),
|
|
0 1rpx 2rpx rgba(0, 122, 255, 0.3);
|
|
opacity: 0.9;
|
|
}
|
|
|
|
/* 按钮流光效果 */
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(
|
|
90deg,
|
|
transparent,
|
|
rgba(255, 255, 255, 0.1),
|
|
transparent
|
|
);
|
|
transition: left 0.6s ease;
|
|
}
|
|
|
|
&:active::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.btn-text {
|
|
display: inline-block;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
}
|
|
|
|
// 动画定义
|
|
@keyframes pulse {
|
|
0%, 100% {
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
50% {
|
|
transform: scale(1.05);
|
|
opacity: 0.8;
|
|
}
|
|
}
|
|
|
|
@keyframes scalePulse {
|
|
0% {
|
|
transform: scale(1);
|
|
opacity: 0.6;
|
|
}
|
|
50% {
|
|
transform: scale(1.1);
|
|
opacity: 0.3;
|
|
}
|
|
100% {
|
|
transform: scale(1);
|
|
opacity: 0;
|
|
}
|
|
}
|
|
</style>
|