<template> 
 | 
    <view class="hz"> 
 | 
        <view style="width: 100%; height: 100rpx;"></view> 
 | 
        <view class="search"> 
 | 
            <view class="search_sou"> 
 | 
                <view class="search_sou_input"> 
 | 
                    <image src="@/static/icon/ic_search@2x.png" mode="widthFix"></image> 
 | 
                    <input type="text" v-model="name" placeholder="搜索保险方案名称" @confirm="sou" /> 
 | 
                </view> 
 | 
                <view class="search_sou_sha" @click="open()"> 
 | 
                    <image src="@/static/icon/ic_shaixuan@2x.png" mode="widthFix"></image> 
 | 
                    <text>筛选</text> 
 | 
                </view> 
 | 
            </view> 
 | 
        </view> 
 | 
        <view class="search_nr" :style="{top: top}"> 
 | 
            <view class="search_list"> 
 | 
                <view class="search_list_item"> 
 | 
                    <view class="search_list_item_label">{{label}}:</view> 
 | 
                    <view class="search_list_item_val"> 
 | 
                        <view class="time" @click="seleTime(1)" :style="{color: startTime ? '#000' : ''}">{{startTime ? startTime : '开始日期'}}</view> 
 | 
                        <text>-</text> 
 | 
                        <view class="time" @click="seleTime(2)" :style="{color: endTime ? '#000' : ''}">{{endTime ? endTime : '结束日期'}}</view> 
 | 
                    </view> 
 | 
                </view> 
 | 
                <view class="search_list_item"> 
 | 
                    <view class="search_list_item_label">状态:</view> 
 | 
                    <scroll-view scroll-y class="search_list_item_cate"> 
 | 
                        <view class="search_list_item_cate_data"> 
 | 
                            <view :class="index === i ? 'cate_active cate_item' : 'cate_item'" v-for="(item, index) in list" :key="index" @click="i = index">{{item.name}}</view> 
 | 
                        </view> 
 | 
                    </scroll-view> 
 | 
                </view> 
 | 
            </view> 
 | 
            <view class="search_footer"> 
 | 
                <u-button type="primary" shape="circle" color="#437CB3" :plain="true" @click="resetting" text="重置"></u-button> 
 | 
                <view class="search_footer_center"></view> 
 | 
                <u-button text="确定" shape="circle" color="#437CB3" @click="sebmit"></u-button> 
 | 
            </view> 
 | 
        </view> 
 | 
        <u-datetime-picker :show="show" v-model="time" mode="date" @cancel="show = false" @confirm="confirm"></u-datetime-picker> 
 | 
        <view class="search_z" :style="{display: display}" @click="open"></view> 
 | 
    </view> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
    export default { 
 | 
        name: "search", 
 | 
        data() { 
 | 
            return { 
 | 
                show: false, 
 | 
                top: '-724rpx', 
 | 
                display: 'none', 
 | 
                i: 0, 
 | 
                name: '', 
 | 
                startTime: '', 
 | 
                endTime: '', 
 | 
                time: Number(new Date()), 
 | 
                type: '' 
 | 
            }; 
 | 
        }, 
 | 
        props: { 
 | 
            label: String, 
 | 
            list: Array 
 | 
        }, 
 | 
        methods: { 
 | 
            sou() { 
 | 
                this.$emit('search', { name: this.name, startTime: this.startTime, endTime: this.endTime, status: this.list[this.i].id }) 
 | 
            }, 
 | 
            sebmit() { 
 | 
                if (this.startTime || this.endTime) { 
 | 
                    if (!this.startTime || !this.endTime) return uni.showToast({ 
 | 
                        title: '请选择完整的生效起期', 
 | 
                        icon: 'none' 
 | 
                    }) 
 | 
                } 
 | 
                this.$emit('search', { name: this.name, startTime: this.startTime, endTime: this.endTime, status: this.list[this.i].id }) 
 | 
                this.open() 
 | 
            }, 
 | 
            resetting() { 
 | 
                this.name = '' 
 | 
                this.startTime = '' 
 | 
                this.endTime = '' 
 | 
                this.i = 0 
 | 
                this.$emit('search', { name: '', startTime: '', endTime: '', status: '' }) 
 | 
                this.open() 
 | 
            }, 
 | 
            confirm(e) { 
 | 
                if (this.type == 1) { 
 | 
                    this.startTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd') 
 | 
                } else { 
 | 
                    this.endTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd') 
 | 
                } 
 | 
                this.show = false 
 | 
            }, 
 | 
            seleTime(type) { 
 | 
                this.type = type 
 | 
                this.show = true 
 | 
            }, 
 | 
            open() { 
 | 
                if (this.top === '-724rpx') { 
 | 
                    this.top = '100rpx' 
 | 
                    this.display = 'black' 
 | 
                } else { 
 | 
                    this.top = '-724rpx' 
 | 
                    this.display = 'none' 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
    .hz { 
 | 
        width: 100%; 
 | 
        display: flex; 
 | 
        flex-direction: column; 
 | 
        .search_z { 
 | 
            width: 100vw; 
 | 
            height: 100vh; 
 | 
            position: fixed; 
 | 
            top: 0; 
 | 
            left: 0; 
 | 
            z-index: 7; 
 | 
            transition: .3s; 
 | 
            background: rgba(0,0,0,0.5); 
 | 
        } 
 | 
        .search { 
 | 
            width: 100%; 
 | 
            height: 100rpx; 
 | 
            padding: 12rpx 30rpx; 
 | 
            box-sizing: border-box; 
 | 
            background: #FFFFFF; 
 | 
            position: fixed; 
 | 
            top: 0; 
 | 
            z-index: 9; 
 | 
            .search_sou { 
 | 
                width: 100%; 
 | 
                display: flex; 
 | 
                align-items: center; 
 | 
                justify-content: space-between; 
 | 
                background-color: #ffffff; 
 | 
                .search_sou_input { 
 | 
                    flex: 1; 
 | 
                    padding: 0 30rpx; 
 | 
                    box-sizing: border-box; 
 | 
                    height: 76rpx; 
 | 
                    background: #F7F7F7; 
 | 
                    border-radius: 38rpx; 
 | 
                    margin-right: 30rpx; 
 | 
                    display: flex; 
 | 
                    align-items: center; 
 | 
                    image { 
 | 
                        width: 28rpx; 
 | 
                        height: 28rpx; 
 | 
                        margin-right: 16rpx; 
 | 
                    } 
 | 
                    input { 
 | 
                        flex: 1; 
 | 
                        height: 100%; 
 | 
                        font-weight: 400; 
 | 
                        font-size: 26rpx; 
 | 
                        color: #222222; 
 | 
                        font-style: normal; 
 | 
                    } 
 | 
                } 
 | 
                .search_sou_sha { 
 | 
                    flex-shrink: 0; 
 | 
                    display: flex; 
 | 
                    align-items: center; 
 | 
                    image { 
 | 
                        width: 28rpx; 
 | 
                        height: 28rpx; 
 | 
                    } 
 | 
                    text { 
 | 
                        font-weight: 400; 
 | 
                        font-size: 26rpx; 
 | 
                        color: #333333; 
 | 
                        font-style: normal; 
 | 
                        margin-left: 8rpx; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
        .search_nr { 
 | 
            width: 100%; 
 | 
            max-height: 724rpx; 
 | 
            padding: 0 30rpx; 
 | 
            border-radius: 0rpx 0rpx 32rpx 32rpx; 
 | 
            box-sizing: border-box; 
 | 
            display: flex; 
 | 
            flex-direction: column; 
 | 
            position: fixed; 
 | 
            z-index: 8; 
 | 
            transition: .3s; 
 | 
            left: 0; 
 | 
            background-color: #FFFFFF; 
 | 
            .search_list { 
 | 
                width: 100%; 
 | 
                display: flex; 
 | 
                flex-direction: column; 
 | 
                margin-top: 52rpx; 
 | 
                background-color: #ffffff; 
 | 
                .search_list_item { 
 | 
                    width: 100%; 
 | 
                    display: flex; 
 | 
                    flex-direction: column; 
 | 
                    margin-bottom: 30rpx; 
 | 
                    &:last-child { 
 | 
                        margin: 0 !important; 
 | 
                    } 
 | 
                    .search_list_item_label { 
 | 
                        font-weight: 400; 
 | 
                        font-size: 30rpx; 
 | 
                        color: #222222; 
 | 
                        font-style: normal; 
 | 
                    } 
 | 
                    .search_list_item_cate { 
 | 
                        width: 100%; 
 | 
                        max-height: 260rpx; 
 | 
                        margin-top: 24rpx; 
 | 
                        .search_list_item_cate_data { 
 | 
                            width: 100%; 
 | 
                            display: flex; 
 | 
                            align-items: center; 
 | 
                            flex-wrap: wrap; 
 | 
                            justify-content: space-between; 
 | 
                            .cate_active { 
 | 
                                background: rgba(67,124,179,0.12) !important; 
 | 
                                color: #437CB3 !important; 
 | 
                            } 
 | 
                            .cate_item { 
 | 
                                width: 216rpx; 
 | 
                                height: 68rpx; 
 | 
                                line-height: 68rpx; 
 | 
                                text-align: center; 
 | 
                                background: #F2F2F2; 
 | 
                                border-radius: 36rpx; 
 | 
                                font-weight: 400; 
 | 
                                font-size: 26rpx; 
 | 
                                color: #222222; 
 | 
                                font-style: normal; 
 | 
                                margin-top: 30rpx; 
 | 
                                &:nth-child(1) { 
 | 
                                    margin-top: 0 !important; 
 | 
                                } 
 | 
                                &:nth-child(2) { 
 | 
                                    margin-top: 0 !important; 
 | 
                                } 
 | 
                                &:nth-child(3) { 
 | 
                                    margin-top: 0 !important; 
 | 
                                } 
 | 
                            } 
 | 
                        } 
 | 
                    } 
 | 
                    .search_list_item_val { 
 | 
                        width: 100%; 
 | 
                        margin-top: 24rpx; 
 | 
                        display: flex; 
 | 
                        align-items: center; 
 | 
                        justify-content: space-between; 
 | 
                        text { 
 | 
                            font-weight: 400; 
 | 
                            font-size: 26rpx; 
 | 
                            color: #333333; 
 | 
                            font-style: normal; 
 | 
                            margin: 0 16rpx; 
 | 
                        } 
 | 
                        .time { 
 | 
                            width: 320rpx; 
 | 
                            height: 64rpx; 
 | 
                            line-height: 64rpx; 
 | 
                            text-align: center; 
 | 
                            background: #FFFFFF; 
 | 
                            border-radius: 32rpx; 
 | 
                            border: 2rpx solid #E5E5E5; 
 | 
                            font-weight: 400; 
 | 
                            font-size: 26rpx; 
 | 
                            color: #999999; 
 | 
                            font-style: normal; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            .search_footer { 
 | 
                width: 100%; 
 | 
                margin-top: 60rpx; 
 | 
                display: flex; 
 | 
                align-items: center; 
 | 
                justify-content: space-between; 
 | 
                margin-bottom: 30rpx; 
 | 
                .search_footer_center { 
 | 
                    width: 22rpx; 
 | 
                    height: 30rpx; 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</style> 
 |