- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
297 行
5.7 KiB
Vue
297 行
5.7 KiB
Vue
<template>
|
|
<view class="drawer-mask" v-if="visible" @tap="close">
|
|
<view class="drawer-sheet" @tap.stop>
|
|
<view class="drawer-head">
|
|
<text class="dh-title">选择服务地址</text>
|
|
<view class="dh-close clickable-hover" @tap="close">
|
|
<image class="dh-close-img" src="/static/icons/close.svg" mode="aspectFit" />
|
|
</view>
|
|
</view>
|
|
|
|
<scroll-view scroll-y class="addr-scroll">
|
|
<view class="loading-box" v-if="loading">
|
|
<text class="loading-txt">加载地址簿中...</text>
|
|
</view>
|
|
|
|
<view class="empty-box" v-else-if="!list.length">
|
|
<image class="empty-icon" src="/static/icons/empty-address.svg" mode="aspectFit" />
|
|
<text class="empty-txt">暂无保存的服务地址</text>
|
|
</view>
|
|
|
|
<view class="addr-list" v-else>
|
|
<view
|
|
v-for="item in list"
|
|
:key="item.id"
|
|
class="addr-card clickable-hover"
|
|
@tap="handleSelect(item)"
|
|
>
|
|
<view class="ac-main">
|
|
<view class="ac-top">
|
|
<text class="ac-name">{{ item.contact }}</text>
|
|
<text class="ac-mobile">{{ item.mobile }}</text>
|
|
<view class="ac-def-tag" v-if="Number(item.is_default) === 1">默认</view>
|
|
</view>
|
|
<text class="ac-detail">{{ item.province || '' }}{{ item.city || '' }}{{ item.district || '' }}{{ item.address || '' }}</text>
|
|
<view class="ac-meta">
|
|
<text class="ac-floor">楼层 {{ item.floor || 1 }}层 · {{ isElevator(item.has_elevator) ? '有电梯' : '无电梯(步梯)' }}</text>
|
|
</view>
|
|
</view>
|
|
<image class="ac-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
<view class="drawer-foot">
|
|
<view class="manage-btn clickable-hover" @tap="goManageAddress">
|
|
<image class="mb-plus" src="/static/icons/plus-white.svg" mode="aspectFit" />
|
|
<text class="mb-txt">新增 / 管理服务地址</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, watch } from 'vue';
|
|
import api from '@/utils/api.js';
|
|
import { isLogin, toLogin } from '@/utils/request.js';
|
|
|
|
const props = defineProps({
|
|
visible: { type: Boolean, default: false }
|
|
});
|
|
|
|
const emit = defineEmits(['update:visible', 'select']);
|
|
|
|
const loading = ref(false);
|
|
const list = ref([]);
|
|
|
|
function isElevator(val) {
|
|
if (val === undefined || val === null || val === '') return true;
|
|
return Number(val) === 1;
|
|
}
|
|
|
|
async function loadAddresses() {
|
|
if (!isLogin()) {
|
|
list.value = [];
|
|
return;
|
|
}
|
|
loading.value = true;
|
|
try {
|
|
const res = await api.addressList();
|
|
list.value = (res && res.list) ? res.list : [];
|
|
} catch (e) {
|
|
list.value = [];
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
|
|
watch(() => props.visible, (val) => {
|
|
if (val) {
|
|
loadAddresses();
|
|
}
|
|
});
|
|
|
|
function close() {
|
|
emit('update:visible', false);
|
|
}
|
|
|
|
function handleSelect(item) {
|
|
emit('select', item);
|
|
close();
|
|
}
|
|
|
|
function goManageAddress() {
|
|
if (!isLogin()) {
|
|
close();
|
|
toLogin();
|
|
return;
|
|
}
|
|
close();
|
|
uni.navigateTo({ url: '/pages/address/list?select=1' });
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.drawer-mask {
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0, 0, 0, 0.55);
|
|
z-index: 1000;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.drawer-sheet {
|
|
background: #F5F6F8;
|
|
border-top-left-radius: 24rpx;
|
|
border-top-right-radius: 24rpx;
|
|
padding: 30rpx 28rpx calc(30rpx + env(safe-area-inset-bottom));
|
|
max-height: 78vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.drawer-head {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding-bottom: 24rpx;
|
|
}
|
|
|
|
.dh-title {
|
|
font-size: 32rpx;
|
|
font-weight: 700;
|
|
color: #1F1F1F;
|
|
}
|
|
|
|
.dh-close {
|
|
width: 56rpx;
|
|
height: 56rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.dh-close-img {
|
|
width: 30rpx;
|
|
height: 30rpx;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.addr-scroll {
|
|
max-height: 54vh;
|
|
}
|
|
|
|
.loading-box,
|
|
.empty-box {
|
|
padding: 72rpx 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.loading-txt,
|
|
.empty-txt {
|
|
font-size: 26rpx;
|
|
color: #888888;
|
|
margin-top: 16rpx;
|
|
}
|
|
|
|
.empty-icon {
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
}
|
|
|
|
.addr-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 18rpx;
|
|
padding-bottom: 16rpx;
|
|
}
|
|
|
|
.addr-card {
|
|
background: #FFFFFF;
|
|
border-radius: 18rpx;
|
|
padding: 24rpx 26rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 16rpx;
|
|
}
|
|
|
|
.ac-main {
|
|
flex: 1;
|
|
min-width: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8rpx;
|
|
}
|
|
|
|
.ac-top {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 14rpx;
|
|
}
|
|
|
|
.ac-name {
|
|
font-size: 30rpx;
|
|
font-weight: 700;
|
|
color: #1F1F1F;
|
|
}
|
|
|
|
.ac-mobile {
|
|
font-size: 26rpx;
|
|
color: #444444;
|
|
}
|
|
|
|
.ac-def-tag {
|
|
height: 38rpx;
|
|
padding: 0 12rpx;
|
|
border-radius: 6rpx;
|
|
background: #FFF7F0;
|
|
color: #F0710D;
|
|
font-size: 22rpx;
|
|
font-weight: 600;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.ac-detail {
|
|
font-size: 26rpx;
|
|
color: #444444;
|
|
line-height: 1.45;
|
|
}
|
|
|
|
.ac-meta {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.ac-floor {
|
|
font-size: 22rpx;
|
|
color: #888888;
|
|
}
|
|
|
|
.ac-arrow {
|
|
width: 28rpx;
|
|
height: 28rpx;
|
|
opacity: 0.45;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.drawer-foot {
|
|
padding-top: 20rpx;
|
|
}
|
|
|
|
.manage-btn {
|
|
height: 84rpx;
|
|
border-radius: 42rpx;
|
|
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 10rpx;
|
|
box-shadow: 0 8rpx 20rpx rgba(240, 113, 13, 0.25);
|
|
}
|
|
|
|
.mb-plus {
|
|
width: 28rpx;
|
|
height: 28rpx;
|
|
}
|
|
|
|
.mb-txt {
|
|
font-size: 28rpx;
|
|
font-weight: 600;
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.clickable-hover:active {
|
|
opacity: 0.85;
|
|
}
|
|
</style>
|