文件
yjyf/yjyf-app/components/AddonServiceDrawer.vue
MiAn 3ebd795cbb feat(ui): 新增/优化界面样式、图标及交互组件
- 新增多个功能图标(箭头、盾牌、位置等)
- 优化全局按钮、标签、输入框等组件样式
- 修复导航栏高度计算逻辑,适配微信小程序
- 优化消息页、订单页、个人中心等页面布局
- 修复微信支付配置及通知接口问题
2026-11-09 09:57:22 +08:00

259 行
5.1 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="drawer-mask" v-if="visible" @tap="close">
<view class="drawer-sheet" @tap.stop>
<!-- 标题栏(对标 frame_005:左标题 + 右侧叉 + 底部分割线) -->
<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>
<!-- 增项列表(1:1 复刻 frame_005:左侧工序名+浅灰单价小签,右侧方形步进器) -->
<scroll-view class="drawer-body" scroll-y="true">
<view class="addon-row" v-for="(item, idx) in localList" :key="item.key || idx">
<view class="ac-left">
<text class="ac-name">{{ item.name }}</text>
<view class="ac-price-tag" v-if="Number(item.price) > 0">
<text class="apt-txt">{{ item.price }}元/{{ item.unit || '份' }}</text>
</view>
</view>
<view class="ac-stepper">
<view
class="step-btn step-btn-minus clickable-hover"
:class="{ disabled: (item.num || 0) <= 0 }"
@tap="stepNum(idx, -1)"
>-</view>
<view class="step-num">{{ item.num || 0 }}</view>
<view
class="step-btn step-btn-plus clickable-hover"
@tap="stepNum(idx, 1)"
>+</view>
</view>
</view>
<view class="empty-tip" v-if="!localList || localList.length === 0">
<text class="empty-txt">暂无可配置的增项服务</text>
</view>
</scroll-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, watch } from 'vue';
const props = defineProps({
visible: { type: Boolean, default: false },
list: { type: Array, default: () => [] }
});
const emit = defineEmits(['update:visible', 'confirm']);
const localList = ref([]);
watch(() => props.visible, (v) => {
if (v) {
localList.value = JSON.parse(JSON.stringify(props.list || []));
}
});
function stepNum(idx, d) {
const target = localList.value[idx];
if (!target) return;
const next = Math.max(0, (target.num || 0) + d);
target.num = next;
}
function close() {
emit('update:visible', false);
}
function handleConfirm() {
emit('confirm', localList.value);
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;
animation: drawerFadeIn 0.2s ease-out;
}
@keyframes drawerFadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.drawer-sheet {
background: #FFFFFF;
padding: 0 0 calc(28rpx + env(safe-area-inset-bottom));
max-height: 75vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
animation: drawerSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes drawerSlideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
}
.drawer-head {
display: flex;
align-items: center;
justify-content: space-between;
height: 96rpx;
padding: 0 28rpx;
border-bottom: 1rpx solid #F0F0F2;
}
.dh-title {
font-size: 32rpx;
font-weight: 500;
color: #1F1F1F;
}
.dh-close {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.dh-close-img {
width: 34rpx;
height: 34rpx;
opacity: 0.85;
}
.drawer-body {
max-height: 560rpx;
min-height: 360rpx;
padding: 16rpx 36rpx;
box-sizing: border-box;
}
.addon-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 22rpx 0;
}
.ac-left {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8rpx;
}
.ac-name {
font-size: 30rpx;
font-weight: 500;
color: #1F1F1F;
}
.ac-price-tag {
background: #F5F5F5;
padding: 4rpx 12rpx;
border-radius: 4rpx;
display: inline-flex;
align-items: center;
justify-content: center;
}
.apt-txt {
font-size: 24rpx;
color: #666666;
line-height: 1;
}
.ac-stepper {
display: flex;
align-items: center;
border: 1rpx solid #CCCCCC;
border-radius: 4rpx;
background: #FFFFFF;
overflow: hidden;
}
.step-btn {
width: 68rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
color: #333333;
background: #FFFFFF;
user-select: none;
}
.step-btn.disabled {
color: #BBBBBB;
}
.step-num {
width: 96rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: #1F1F1F;
border-left: 1rpx solid #CCCCCC;
border-right: 1rpx solid #CCCCCC;
background: #FFFFFF;
}
.empty-tip {
padding: 60rpx 0;
text-align: center;
}
.empty-txt {
font-size: 26rpx;
color: #999999;
}
.drawer-foot {
padding: 20rpx 24rpx 0;
}
.confirm-btn {
height: 88rpx;
background: #F0710D;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cb-txt {
font-size: 30rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 1;
}
.clickable-hover:active {
opacity: 0.85;
}
</style>