- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
281 行
6.2 KiB
Vue
281 行
6.2 KiB
Vue
<template>
|
||
<view class="drawer-mask" v-if="visible" @tap="close">
|
||
<view class="drawer-sheet" @tap.stop>
|
||
<!-- 标题栏(1:1 复刻奇兵到家图2 & 图3:左标题 + 橙色问号图标 + 右侧关闭叉) -->
|
||
<view class="drawer-head">
|
||
<view class="dh-left">
|
||
<text class="dh-title">选择服务项目</text>
|
||
<view class="dh-help clickable-hover" @tap.stop="showHelp">
|
||
<image class="dh-help-img" src="/static/icons/info-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
<view class="dh-close clickable-hover" @tap="close">
|
||
<image class="dh-close-img" src="/static/icons/close.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 流式方框标签列表(1:1 复刻图2 & 图3:横向自适应折行 + 选中橙框 + 右下角橙色三角勾) -->
|
||
<view class="drawer-body">
|
||
<view class="tag-grid" v-if="displayList.length > 0">
|
||
<view
|
||
class="type-tag clickable-hover"
|
||
v-for="item in displayList"
|
||
:key="item.code || item.name"
|
||
:class="{ active: isSelected(item) }"
|
||
@tap="selectItem(item)"
|
||
>
|
||
<text class="tt-name">{{ item.name }}</text>
|
||
<!-- 右下角橙色直角三角勾(1:1 对标图2) -->
|
||
<view class="tt-corner-badge" v-if="isSelected(item)">
|
||
<image class="tt-corner-check" src="/static/icons/check-white.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="empty-state" v-else>
|
||
<image class="empty-ico" src="/static/icons/empty-service.svg" mode="aspectFit" />
|
||
<text class="empty-txt">暂无可选服务项目</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部确定按钮 -->
|
||
<view class="drawer-foot">
|
||
<view class="confirm-btn clickable-hover" @tap="handleConfirm">
|
||
<text class="cb-txt">确定</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed, watch } from 'vue';
|
||
|
||
const props = defineProps({
|
||
visible: { type: Boolean, default: false },
|
||
list: { type: Array, default: () => [] },
|
||
currentCode: { type: String, default: 'install' }
|
||
});
|
||
|
||
const emit = defineEmits(['update:visible', 'confirm']);
|
||
|
||
const displayList = computed(() => {
|
||
return Array.isArray(props.list) ? props.list : [];
|
||
});
|
||
|
||
const selectedCode = ref(props.currentCode);
|
||
|
||
watch(() => props.currentCode, (v) => {
|
||
selectedCode.value = v;
|
||
});
|
||
|
||
watch(() => props.visible, (v) => {
|
||
if (v) {
|
||
const exists = displayList.value.some(item => item.code === props.currentCode || item.name === props.currentCode);
|
||
selectedCode.value = exists ? props.currentCode : (displayList.value[0]?.code || displayList.value[0]?.name || '');
|
||
}
|
||
});
|
||
|
||
function isSelected(item) {
|
||
return selectedCode.value === item.code || selectedCode.value === item.name;
|
||
}
|
||
|
||
function selectItem(item) {
|
||
selectedCode.value = item.code || item.name;
|
||
}
|
||
|
||
function showHelp() {
|
||
uni.showModal({
|
||
title: '服务项目说明',
|
||
content: '• 安装:货物已到客户家,师傅直接上门安装;\n• 维修:对已有商品进行故障排查与修复;\n• 送货到家并安装:师傅前往物流点提货送至客户家并完成安装;\n• 送货到家:提货并搬运上楼送达客户家中;\n• 送货到楼下(不含上楼):仅从物流点提货送至小区楼下。',
|
||
showCancel: false,
|
||
confirmText: '我知道了',
|
||
confirmColor: '#F0710D'
|
||
});
|
||
}
|
||
|
||
function close() {
|
||
emit('update:visible', false);
|
||
}
|
||
|
||
function handleConfirm() {
|
||
if (!displayList.value.length) {
|
||
close();
|
||
return;
|
||
}
|
||
const hit = displayList.value.find(item => item.code === selectedCode.value || item.name === selectedCode.value) || displayList.value[0];
|
||
if (hit) emit('confirm', hit);
|
||
close();
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.drawer-mask {
|
||
position: fixed;
|
||
inset: 0;
|
||
background: rgba(0, 0, 0, 0.55);
|
||
z-index: 999;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.drawer-sheet {
|
||
background: #FFFFFF;
|
||
border-top-left-radius: 20rpx;
|
||
border-top-right-radius: 20rpx;
|
||
padding: 32rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.drawer-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding-bottom: 28rpx;
|
||
}
|
||
|
||
.dh-left {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12rpx;
|
||
}
|
||
|
||
.dh-title {
|
||
font-size: 34rpx;
|
||
font-weight: 500;
|
||
color: #1F1F1F;
|
||
}
|
||
|
||
.dh-help {
|
||
width: 44rpx;
|
||
height: 44rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.dh-help-img {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
}
|
||
|
||
.dh-close {
|
||
width: 56rpx;
|
||
height: 56rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.dh-close-img {
|
||
width: 34rpx;
|
||
height: 34rpx;
|
||
opacity: 0.75;
|
||
}
|
||
|
||
.drawer-body {
|
||
min-height: 280rpx;
|
||
max-height: 56vh;
|
||
overflow-y: auto;
|
||
padding: 8rpx 0 32rpx;
|
||
}
|
||
|
||
.tag-grid {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 22rpx;
|
||
}
|
||
|
||
.type-tag {
|
||
position: relative;
|
||
height: 76rpx;
|
||
padding: 0 32rpx;
|
||
border-radius: 8rpx;
|
||
border: 2rpx solid #DCDCDC;
|
||
background: #FFFFFF;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
overflow: hidden;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.type-tag.active {
|
||
border-color: #F0710D;
|
||
background: #FFFFFF;
|
||
}
|
||
|
||
.tt-name {
|
||
font-size: 28rpx;
|
||
color: #1F1F1F;
|
||
line-height: 1;
|
||
}
|
||
|
||
.type-tag.active .tt-name {
|
||
color: #F0710D;
|
||
font-weight: 500;
|
||
}
|
||
|
||
/* 右下角橙色三角勾(1:1 复刻图2选中态) */
|
||
.tt-corner-badge {
|
||
position: absolute;
|
||
right: 0;
|
||
bottom: 0;
|
||
width: 34rpx;
|
||
height: 34rpx;
|
||
background: linear-gradient(135deg, transparent 50%, #F0710D 50%);
|
||
display: flex;
|
||
align-items: flex-end;
|
||
justify-content: flex-end;
|
||
padding: 2rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.tt-corner-check {
|
||
width: 16rpx;
|
||
height: 16rpx;
|
||
}
|
||
|
||
.empty-state {
|
||
padding: 56rpx 0 24rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.empty-ico {
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.empty-txt {
|
||
font-size: 26rpx;
|
||
color: #888888;
|
||
}
|
||
|
||
.drawer-foot {
|
||
padding-top: 16rpx;
|
||
}
|
||
|
||
.confirm-btn {
|
||
height: 88rpx;
|
||
background: #F0710D;
|
||
border-radius: 10rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.cb-txt {
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
.clickable-hover:active {
|
||
opacity: 0.85;
|
||
}
|
||
</style>
|