- 新增多个功能图标(箭头、盾牌、位置等) - 优化全局按钮、标签、输入框等组件样式 - 修复导航栏高度计算逻辑,适配微信小程序 - 优化消息页、订单页、个人中心等页面布局 - 修复微信支付配置及通知接口问题
199 行
4.0 KiB
Vue
199 行
4.0 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>
|
||
|
||
<!-- 选项列表(清爽白底分割线风格,与 AddonServiceDrawer 统一) -->
|
||
<view class="drawer-body">
|
||
<view
|
||
class="type-row clickable-hover"
|
||
v-for="item in displayList"
|
||
:key="item.code"
|
||
@tap="selectItem(item)"
|
||
>
|
||
<text class="tr-name" :class="{ active: selectedCode === item.code }">{{ item.name }}</text>
|
||
<view class="tr-radio" :class="{ on: selectedCode === item.code }">
|
||
<image class="check-icon" v-if="selectedCode === item.code" src="/static/icons/check-white.svg" mode="aspectFit" />
|
||
</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, 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 defaultTypes = [
|
||
{ code: 'install', name: '安装', price: 60, unit: '件' },
|
||
{ code: 'repair', name: '维修', price: 40, unit: '次' },
|
||
{ code: 'remove', name: '拆旧', price: 30, unit: '件' }
|
||
];
|
||
|
||
const displayList = computed(() => {
|
||
return props.list && props.list.length ? props.list : defaultTypes;
|
||
});
|
||
|
||
const selectedCode = ref(props.currentCode);
|
||
|
||
watch(() => props.currentCode, (v) => {
|
||
selectedCode.value = v;
|
||
});
|
||
|
||
watch(() => props.visible, (v) => {
|
||
if (v) selectedCode.value = props.currentCode;
|
||
});
|
||
|
||
function selectItem(item) {
|
||
selectedCode.value = item.code;
|
||
}
|
||
|
||
function close() {
|
||
emit('update:visible', false);
|
||
}
|
||
|
||
function handleConfirm() {
|
||
const hit = displayList.value.find(item => item.code === selectedCode.value) || displayList.value[0];
|
||
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: 24rpx;
|
||
border-top-right-radius: 24rpx;
|
||
padding: 32rpx 32rpx calc(28rpx + env(safe-area-inset-bottom));
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.drawer-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding-bottom: 16rpx;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.drawer-body {
|
||
padding: 8rpx 0 20rpx;
|
||
}
|
||
|
||
.type-row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 28rpx 0;
|
||
border-bottom: 1rpx solid #F0F0F2;
|
||
}
|
||
|
||
.type-row:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.tr-name {
|
||
font-size: 30rpx;
|
||
color: #1F1F1F;
|
||
}
|
||
|
||
.tr-name.active {
|
||
color: #F0710D;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.tr-radio {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
border-radius: 50%;
|
||
border: 2rpx solid #CCCCCC;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: #FFFFFF;
|
||
}
|
||
|
||
.tr-radio.on {
|
||
background: #F0710D;
|
||
border-color: #F0710D;
|
||
}
|
||
|
||
.check-icon {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
}
|
||
|
||
.drawer-foot {
|
||
padding-top: 24rpx;
|
||
}
|
||
|
||
.confirm-btn {
|
||
height: 88rpx;
|
||
background: #F0710D;
|
||
border-radius: 12rpx;
|
||
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>
|