2024-01-16 01:32:52 +00:00
|
|
|
|
<!-- 订单确认的优惠劵选择弹窗 -->
|
2023-12-13 03:35:02 +00:00
|
|
|
|
<template>
|
2024-09-07 04:06:10 +00:00
|
|
|
|
<su-popup
|
|
|
|
|
:show="show"
|
|
|
|
|
type="bottom"
|
|
|
|
|
round="20"
|
|
|
|
|
@close="emits('close')"
|
|
|
|
|
showClose
|
|
|
|
|
backgroundColor="#f2f2f2"
|
|
|
|
|
>
|
2023-12-13 03:35:02 +00:00
|
|
|
|
<view class="model-box">
|
|
|
|
|
<view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠券</view>
|
2024-09-07 04:06:10 +00:00
|
|
|
|
<scroll-view
|
|
|
|
|
class="model-content"
|
|
|
|
|
scroll-y
|
|
|
|
|
:scroll-with-animation="false"
|
|
|
|
|
:enable-back-to-top="true"
|
|
|
|
|
>
|
2024-08-20 08:38:50 +00:00
|
|
|
|
<!--可使用的优惠券区域-->
|
2023-12-13 03:35:02 +00:00
|
|
|
|
<view class="subtitle ss-m-l-20">可使用优惠券</view>
|
2024-09-07 04:06:10 +00:00
|
|
|
|
<view
|
|
|
|
|
v-for="(item, index) in state.couponInfo.filter((coupon) => coupon.match)"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
2023-12-13 03:35:02 +00:00
|
|
|
|
<s-coupon-list :data="item" type="user" :disabled="false">
|
|
|
|
|
<template #default>
|
|
|
|
|
<label class="ss-flex ss-col-center" @tap="radioChange(item.id)">
|
|
|
|
|
<radio
|
|
|
|
|
color="var(--ui-BG-Main)"
|
|
|
|
|
style="transform: scale(0.8)"
|
2024-01-16 01:32:52 +00:00
|
|
|
|
:checked="state.couponId === item.id"
|
2023-12-13 03:35:02 +00:00
|
|
|
|
@tap.stop="radioChange(item.id)"
|
|
|
|
|
/>
|
|
|
|
|
</label>
|
|
|
|
|
</template>
|
|
|
|
|
</s-coupon-list>
|
|
|
|
|
</view>
|
2024-08-20 08:38:50 +00:00
|
|
|
|
<!--不可使用的优惠券区域-->
|
2023-12-13 03:35:02 +00:00
|
|
|
|
<view class="subtitle ss-m-t-40 ss-m-l-20">不可使用优惠券</view>
|
2024-09-07 04:06:10 +00:00
|
|
|
|
<view v-for="item in state.couponInfo.filter((coupon) => !coupon.match)" :key="item.id">
|
2023-12-13 03:35:02 +00:00
|
|
|
|
<s-coupon-list :data="item" type="user" :disabled="true">
|
|
|
|
|
<template v-slot:reason>
|
|
|
|
|
<view class="ss-flex ss-m-t-24">
|
|
|
|
|
<view class="reason-title"> 不可用原因:</view>
|
2024-09-07 04:06:10 +00:00
|
|
|
|
<view class="reason-desc">{{ item.mismatchReason || '未达到使用门槛' }}</view>
|
2023-12-13 03:35:02 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
</s-coupon-list>
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="modal-footer ss-flex">
|
|
|
|
|
<button class="confirm-btn ss-reset-button" @tap="onConfirm">确认</button>
|
|
|
|
|
</view>
|
|
|
|
|
</su-popup>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
import { computed, reactive } from 'vue';
|
2024-01-16 01:32:52 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
const props = defineProps({
|
2024-09-07 04:06:10 +00:00
|
|
|
|
modelValue: {
|
|
|
|
|
// 优惠劵列表
|
2023-12-13 03:35:02 +00:00
|
|
|
|
type: Object,
|
2024-09-07 04:06:10 +00:00
|
|
|
|
default() {},
|
2023-12-13 03:35:02 +00:00
|
|
|
|
},
|
|
|
|
|
show: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-01-16 01:32:52 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
const emits = defineEmits(['confirm', 'close']);
|
2024-01-16 01:32:52 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
const state = reactive({
|
2024-01-16 01:32:52 +00:00
|
|
|
|
couponInfo: computed(() => props.modelValue), // 优惠劵列表
|
2024-08-22 13:59:07 +00:00
|
|
|
|
couponId: undefined, // 选中的优惠劵编号
|
2023-12-13 03:35:02 +00:00
|
|
|
|
});
|
2024-01-16 01:32:52 +00:00
|
|
|
|
|
|
|
|
|
// 选中优惠劵
|
2023-12-13 03:35:02 +00:00
|
|
|
|
function radioChange(couponId) {
|
2024-01-16 01:32:52 +00:00
|
|
|
|
if (state.couponId === couponId) {
|
2024-08-22 13:59:07 +00:00
|
|
|
|
state.couponId = undefined;
|
2023-12-13 03:35:02 +00:00
|
|
|
|
} else {
|
|
|
|
|
state.couponId = couponId;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-16 01:32:52 +00:00
|
|
|
|
|
|
|
|
|
// 确认优惠劵
|
2023-12-13 03:35:02 +00:00
|
|
|
|
const onConfirm = () => {
|
|
|
|
|
emits('confirm', state.couponId);
|
2024-08-20 08:38:50 +00:00
|
|
|
|
};
|
2023-12-13 03:35:02 +00:00
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
:deep() {
|
|
|
|
|
.uni-checkbox-input {
|
|
|
|
|
background-color: var(--ui-BG-Main);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.model-box {
|
|
|
|
|
height: 60vh;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.title {
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #333333;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.subtitle {
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #333333;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.model-content {
|
|
|
|
|
height: 54vh;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.modal-footer {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 120rpx;
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.confirm-btn {
|
|
|
|
|
width: 710rpx;
|
|
|
|
|
margin-left: 20rpx;
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.reason-title {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
line-height: 26rpx;
|
|
|
|
|
color: #ff0003;
|
|
|
|
|
}
|
2024-08-20 08:38:50 +00:00
|
|
|
|
|
2023-12-13 03:35:02 +00:00
|
|
|
|
.reason-desc {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
line-height: 26rpx;
|
|
|
|
|
color: #434343;
|
|
|
|
|
}
|
|
|
|
|
</style>
|