doum
3 天以前 7c626e30b790489978150e57a2c7359934df32c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
    <uni-popup ref="date" background-color="#fff">
        <view class="date">
            <view class="title">
                <text>店铺标签</text>
                <view class="title_icon" @click="closeDate">
                    <uni-icons color="#CCCCCB" type="closeempty" size="20"></uni-icons>
                </view>
            </view>
            <view class="content">
                <view
                    v-for="(item, index) in labels"
                    :key="index"
                    class="label-item"
                    :class="selectLabel.includes(index)?'label-sel':''"
                    @click="selectLabelAcation(index)"
                >{{ item }}</view>
            </view>
            <view class="submit" @click="updata">确定</view>
        </view>
    </uni-popup>
</template>
 
<script>
export default {
    props: {
        labels: {
            type: Array,
            default: () => []
        }
    },
    data() {
        return {
            selectLabel: [],
            indicatorStyle: `height: 50px;`
        }
    },
    methods: {
        open() {
            this.$refs.date.open('bottom')
        },
        updata() {
            this.$emit('updata', this.selectLabel)
            this.$refs.date.close()
        },
        closeDate() {
            this.$refs.date.close()
        },
        selectLabelAcation(index) {
            if (this.selectLabel.includes(index)) {
                this.selectLabel.splice(this.selectLabel.findIndex(item => item == index), 1)
            } else {
                this.selectLabel.push(index)
            }
        }
    }
}
</script>
 
<style lang="scss" scoped>
    .date {
        padding: 44rpx 32rpx;
        background-color: #FFFFFF;
        box-sizing: border-box;
        .title {
            width: 100%;
            text-align: center;
            position: relative;
            text {
                font-size: 32rpx;
                font-family: PingFang SC-Semibold, PingFang SC;
                font-weight: 600;
                color: #333333;
            }
            .title_icon {
                position: absolute;
                right: 0;
                top: 0;
            }
        }
        .content {
            width: 100%;
            margin-top: 80rpx;
            max-height: 600rpx;
            overflow-y: scroll;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            .label-item {
                height: 70rpx;
                background: #F2F2F2;
                border-radius: 36rpx;
                width: calc(33.33% - 12rpx);
                text-align: center;
                font-size: 26rpx;
                font-weight: 400;
                color: #333333;
                line-height: 70rpx;
                margin-bottom: 24rpx;
            }
            .label-sel {
                background: #D20A0A;
                color: #fff;
            }
        }
        .submit {
            width: 100%;
            height: 72rpx;
            line-height: 72rpx;
            text-align: center;
            background: linear-gradient(270deg, #D20A0A 0%, #D95A5A 100%);
            border-radius: 36rpx;
            font-size: 32rpx;
            font-family: PingFang SC-Medium, PingFang SC;
            font-weight: 500;
            color: #FFFFFF;
            margin-top: 50rpx;
        }
    }
    
    
</style>