|
|
@@ -5,21 +5,27 @@
|
|
|
<text>选择红包</text>
|
|
|
<u-icon name="close" size="28" color="#999" class="close-icon" @click="close"></u-icon>
|
|
|
</view>
|
|
|
-
|
|
|
- <scroll-view scroll-y class="packet-list">
|
|
|
+
|
|
|
+ <scroll-view scroll-y class="packet-list" v-if="list && list.length > 0">
|
|
|
<view class="packet-item" v-for="(item, index) in list" :key="index" @click="selectPacket(index)">
|
|
|
<view class="packet-info">
|
|
|
- <view class="packet-name">{{ item.name }}</view>
|
|
|
- <view class="packet-desc">{{ item.desc }}</view>
|
|
|
- <view class="packet-time">{{ item.time }}</view>
|
|
|
+ <view class="packet-name">{{ item.couponName }} ¥{{ item.faceMoney }}</view>
|
|
|
+ <view class="packet-desc">满{{ item.thresholdMoney }}元可用</view>
|
|
|
+ <view class="packet-time">{{ item.effectStartTime }}至{{ item.effectEndTime }}</view>
|
|
|
</view>
|
|
|
<view class="packet-check">
|
|
|
- <u-icon name="checkmark-circle-fill" size="40" :color="selectedIndex === index ? '#ff4500' : '#ccc'"></u-icon>
|
|
|
+ <u-icon name="checkmark-circle-fill" size="40"
|
|
|
+ :color="selectedIndex === index ? '#ff4500' : '#ccc'"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
-
|
|
|
- <view class="popup-footer">
|
|
|
+ <view class="empty-state" v-else>
|
|
|
+ <image src="https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/no-data.png"
|
|
|
+ style="width: 260rpx; height: 260rpx" mode="aspectFit"></image>
|
|
|
+ <view class="empty-text">暂无可用红包</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="popup-footer" v-if="list && list.length > 0">
|
|
|
<u-button type="primary" shape="circle" @click="confirm">确认</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -27,117 +33,129 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-export default {
|
|
|
- props: {
|
|
|
- value: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- show: false,
|
|
|
- selectedIndex: 0,
|
|
|
- list: [
|
|
|
- {
|
|
|
- name: '惊喜红包(满15减5)',
|
|
|
- desc: '书嗨所有商品(不包含邮费)',
|
|
|
- time: '2024-01-01 00:00:00至2024-12-31 23:59:59'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '惊喜红包(满15减5)',
|
|
|
- desc: '书嗨所有商品(不包含邮费)',
|
|
|
- time: '2024-01-01 00:00:00至2024-12-31 23:59:59'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- value(val) {
|
|
|
- this.show = val;
|
|
|
+ export default {
|
|
|
+ props: {
|
|
|
+ value: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ list: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ }
|
|
|
},
|
|
|
- show(val) {
|
|
|
- this.$emit('input', val);
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- close() {
|
|
|
- this.show = false;
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ show: false,
|
|
|
+ selectedIndex: -1,
|
|
|
+ }
|
|
|
},
|
|
|
- selectPacket(index) {
|
|
|
- this.selectedIndex = index;
|
|
|
+ watch: {
|
|
|
+ value(val) {
|
|
|
+ this.show = val;
|
|
|
+ },
|
|
|
+ show(val) {
|
|
|
+ this.$emit('input', val);
|
|
|
+ }
|
|
|
},
|
|
|
- confirm() {
|
|
|
- this.$emit('confirm', this.list[this.selectedIndex]);
|
|
|
- this.close();
|
|
|
+ methods: {
|
|
|
+ close() {
|
|
|
+ this.show = false;
|
|
|
+ },
|
|
|
+ selectPacket(index) {
|
|
|
+ this.selectedIndex = index;
|
|
|
+ },
|
|
|
+ confirm() {
|
|
|
+ if (this.list && this.list.length > 0 && this.selectedIndex !== -1) {
|
|
|
+ this.$emit('confirm', this.list[this.selectedIndex]);
|
|
|
+ } else {
|
|
|
+ this.$emit('confirm', null);
|
|
|
+ }
|
|
|
+ this.close();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.red-packet-popup {
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- overflow: hidden;
|
|
|
-
|
|
|
- .popup-header {
|
|
|
- padding: 30rpx;
|
|
|
- text-align: center;
|
|
|
- font-size: 32rpx;
|
|
|
- font-weight: bold;
|
|
|
- position: sticky;
|
|
|
- top: 0;
|
|
|
- background-color: #fff;
|
|
|
- border-bottom: 1rpx solid #eee;
|
|
|
-
|
|
|
- .close-icon {
|
|
|
- position: absolute;
|
|
|
- right: 30rpx;
|
|
|
- top: 40rpx;
|
|
|
+ .red-packet-popup {
|
|
|
+ height: 100%;
|
|
|
+ max-height: 80vh;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .popup-header {
|
|
|
+ padding: 30rpx;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ position: sticky;
|
|
|
+ top: 0;
|
|
|
+ background-color: #fff;
|
|
|
+ border-bottom: 1rpx solid #eee;
|
|
|
+
|
|
|
+ .close-icon {
|
|
|
+ position: absolute;
|
|
|
+ right: 30rpx;
|
|
|
+ top: 40rpx;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- .packet-list {
|
|
|
- flex: 1;
|
|
|
- padding: 20rpx;
|
|
|
- box-sizing: border-box;
|
|
|
- max-height: 400px;
|
|
|
- overflow-y: auto;
|
|
|
-
|
|
|
- .packet-item {
|
|
|
+
|
|
|
+ .packet-list {
|
|
|
+ flex: 1;
|
|
|
+ padding: 20rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: 600rpx; // Give it a fixed height for scroll
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
+ .packet-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
+ border-bottom: 1rpx solid #f5f5f5;
|
|
|
+
|
|
|
+ .packet-info {
|
|
|
+ flex: 1;
|
|
|
+
|
|
|
+ .packet-name {
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: #ff4500;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .packet-desc {
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #333;
|
|
|
+ margin-bottom: 6rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .packet-time {
|
|
|
+ font-size: 22rpx;
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .empty-state {
|
|
|
display: flex;
|
|
|
+ flex-direction: column;
|
|
|
align-items: center;
|
|
|
- padding: 20rpx 30rpx;
|
|
|
-
|
|
|
- .packet-info {
|
|
|
- flex: 1;
|
|
|
-
|
|
|
- .packet-name {
|
|
|
- font-size: 30rpx;
|
|
|
- color: #ff4500;
|
|
|
- font-weight: bold;
|
|
|
- margin-bottom: 10rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .packet-desc {
|
|
|
- font-size: 26rpx;
|
|
|
- color: #333;
|
|
|
- margin-bottom: 6rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .packet-time {
|
|
|
- font-size: 22rpx;
|
|
|
- color: #999;
|
|
|
- }
|
|
|
+ justify-content: center;
|
|
|
+ padding: 60rpx 0;
|
|
|
+
|
|
|
+ .empty-text {
|
|
|
+ color: #999;
|
|
|
+ font-size: 28rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .popup-footer {
|
|
|
+ padding: 20rpx 40rpx;
|
|
|
+ padding-bottom: env(safe-area-inset-bottom);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- .popup-footer {
|
|
|
- padding: 20rpx 40rpx;
|
|
|
- padding-bottom: env(safe-area-inset-bottom);
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|