- 新增epay v2、v3、v3new版本的支付类库及证书文件 - 新增cos云存储类库文件 - 调整文件上传保存格式为按分类存储 - 修复会员、规则、类目等语言翻译键名 - 新增小程序图标等静态资源文件
278 行
5.6 KiB
Vue
278 行
5.6 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 class="drawer-body" scroll-y="true">
|
||
<view class="addon-card" v-for="(item, idx) in localList" :key="item.key || idx">
|
||
<text class="ac-name">{{ item.name }}</text>
|
||
<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-summary-line" v-if="totalAddonFee > 0">
|
||
<text class="dsl-label">增项费用合计:</text>
|
||
<text class="dsl-price">¥{{ totalAddonFee }}</text>
|
||
</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: () => [] }
|
||
});
|
||
|
||
const emit = defineEmits(['update:visible', 'confirm']);
|
||
|
||
const localList = ref([]);
|
||
|
||
watch(() => props.visible, (v) => {
|
||
if (v) {
|
||
localList.value = JSON.parse(JSON.stringify(props.list || []));
|
||
}
|
||
});
|
||
|
||
const totalAddonFee = computed(() => {
|
||
if (!localList.value || !localList.value.length) return '0.00';
|
||
const sum = localList.value.reduce((acc, cur) => acc + (Number(cur.price) || 0) * (Number(cur.num) || 0), 0);
|
||
return sum.toFixed(2);
|
||
});
|
||
|
||
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.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));
|
||
max-height: 75vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
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 {
|
||
max-height: 540rpx;
|
||
padding: 10rpx 0;
|
||
}
|
||
|
||
.addon-card {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
height: 110rpx;
|
||
padding: 0 24rpx;
|
||
border-radius: 14rpx;
|
||
background: #F8F9FA;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.addon-card:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.ac-name {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: #222222;
|
||
}
|
||
|
||
.ac-stepper {
|
||
display: flex;
|
||
align-items: center;
|
||
border: 1rpx solid #D5D5D5;
|
||
border-radius: 8rpx;
|
||
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: #CCCCCC;
|
||
background: #FAFAFA;
|
||
}
|
||
|
||
.step-num {
|
||
width: 80rpx;
|
||
height: 60rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: #1A1A1A;
|
||
border-left: 1rpx solid #EAEAEA;
|
||
border-right: 1rpx solid #EAEAEA;
|
||
background: #FFFFFF;
|
||
}
|
||
|
||
.empty-tip {
|
||
padding: 60rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.empty-txt {
|
||
font-size: 26rpx;
|
||
color: #999999;
|
||
}
|
||
|
||
.drawer-summary-line {
|
||
display: flex;
|
||
align-items: baseline;
|
||
justify-content: flex-end;
|
||
padding: 24rpx 8rpx 0;
|
||
}
|
||
|
||
.dsl-label {
|
||
font-size: 26rpx;
|
||
color: #666666;
|
||
}
|
||
|
||
.dsl-price {
|
||
font-size: 34rpx;
|
||
font-weight: 700;
|
||
color: #F0710D;
|
||
}
|
||
|
||
.drawer-foot {
|
||
padding-top: 28rpx;
|
||
}
|
||
|
||
.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>
|