文件
yjyf/yjyf-app/components/MasterDemandDrawer.vue
YuanWen 78d45eea74 chore: 新增epay和cos插件相关类库及配置文件
- 新增epay v2、v3、v3new版本的支付类库及证书文件
- 新增cos云存储类库文件
- 调整文件上传保存格式为按分类存储
- 修复会员、规则、类目等语言翻译键名
- 新增小程序图标等静态资源文件
2026-11-04 09:33:57 +08:00

294 行
6.2 KiB
Vue

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

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

<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>
<!-- 选项内容(纯净精致卡片,无冗余文字说明) -->
<view class="drawer-body">
<!-- 选项 1:完工过相同的商品 -->
<view class="demand-card clickable-hover" :class="{ active: reqSameGoods }" @tap="toggleSameGoods">
<text class="demand-label">完工过相同的商品</text>
<view class="custom-checkbox" :class="{ on: reqSameGoods }">
<image class="check-img" v-if="reqSameGoods" src="/static/icons/check-white.svg" mode="aspectFit" />
</view>
</view>
<!-- 选项 2:师傅评分不低于4.5分 -->
<view class="demand-card clickable-hover" :class="{ active: reqHighRating }" @tap="reqHighRating = !reqHighRating">
<text class="demand-label">师傅评分不低于4.5分</text>
<view class="custom-checkbox" :class="{ on: reqHighRating }">
<image class="check-img" v-if="reqHighRating" src="/static/icons/check-white.svg" mode="aspectFit" />
</view>
</view>
<!-- 联动展开:自动匹配时长药丸 -->
<view class="expand-box" v-if="reqSameGoods">
<text class="expand-title">超时自动匹配时长</text>
<view class="timeout-grid">
<view
class="timeout-pill clickable-hover"
v-for="t in timeoutOptions"
:key="t"
:class="{ active: selectedTimeout === t }"
@tap="selectedTimeout = t"
>
<text class="tp-txt">{{ t }}小时</text>
</view>
</view>
</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, watch } from 'vue';
const props = defineProps({
visible: { type: Boolean, default: false },
sameGoods: { type: Boolean, default: false },
highRating: { type: Boolean, default: false },
timeoutHours: { type: [Number, String], default: 1 }
});
const emit = defineEmits(['update:visible', 'confirm']);
const reqSameGoods = ref(false);
const reqHighRating = ref(false);
const selectedTimeout = ref(1);
const timeoutOptions = [1, 3, 6, 12, 24, 48];
watch(() => props.visible, (v) => {
if (v) {
reqSameGoods.value = props.sameGoods;
reqHighRating.value = props.highRating;
selectedTimeout.value = Number(props.timeoutHours) || 1;
}
}, { immediate: true });
function toggleSameGoods() {
reqSameGoods.value = !reqSameGoods.value;
}
function close() {
emit('update:visible', false);
}
function handleConfirm() {
emit('confirm', {
sameGoods: reqSameGoods.value,
highRating: reqHighRating.value,
timeoutHours: selectedTimeout.value
});
close();
}
</script>
<style scoped>
.drawer-mask {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(2px);
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;
border-top-left-radius: 28rpx;
border-top-right-radius: 28rpx;
padding: 36rpx 36rpx calc(30rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
animation: drawerSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
box-shadow: 0 -8rpx 32rpx rgba(0, 0, 0, 0.08);
}
@keyframes drawerSlideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
}
.drawer-head {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 24rpx;
}
.dh-title {
font-size: 34rpx;
font-weight: 700;
color: #1A1A1A;
}
.dh-close {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.dh-close-img {
width: 32rpx;
height: 32rpx;
opacity: 0.75;
}
.drawer-body {
padding: 10rpx 0;
display: flex;
flex-direction: column;
gap: 16rpx;
}
.demand-card {
display: flex;
align-items: center;
justify-content: space-between;
height: 110rpx;
padding: 0 28rpx;
border-radius: 16rpx;
background: #F8F9FA;
border: 2rpx solid transparent;
transition: all 0.18s ease;
}
.demand-card.active {
background: #FFF9F5;
border-color: #F0710D;
}
.demand-label {
font-size: 30rpx;
color: #222222;
font-weight: 600;
}
.demand-card.active .demand-label {
color: #F0710D;
}
.custom-checkbox {
width: 40rpx;
height: 40rpx;
border-radius: 8rpx;
border: 2rpx solid #D1D5DB;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.18s ease;
box-sizing: border-box;
}
.custom-checkbox.on {
background: #F0710D;
border-color: #F0710D;
}
.check-img {
width: 24rpx;
height: 24rpx;
}
.expand-box {
margin-top: 10rpx;
padding: 20rpx 0;
}
.expand-title {
display: block;
font-size: 26rpx;
font-weight: 600;
color: #666666;
margin-bottom: 16rpx;
}
.timeout-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16rpx;
}
.timeout-pill {
height: 76rpx;
border-radius: 12rpx;
background: #F8F9FA;
border: 2rpx solid transparent;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.18s ease;
}
.timeout-pill.active {
background: #FFF9F5;
border-color: #F0710D;
}
.tp-txt {
font-size: 28rpx;
color: #333333;
font-weight: 500;
}
.timeout-pill.active .tp-txt {
color: #F0710D;
font-weight: 700;
}
.drawer-foot {
padding-top: 36rpx;
}
.confirm-btn {
height: 88rpx;
background: #F0710D;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.15s ease, transform 0.1s ease;
}
.confirm-btn:active {
background: #E06305;
transform: scale(0.99);
}
.cb-txt {
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
letter-spacing: 2rpx;
}
.clickable-hover:active {
opacity: 0.85;
}
</style>