index.vue 6.04 KB
Newer Older
程智春 committed
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
<template>
    <div class="popup-wrap">
        
        <van-popup 
            :show="productDialogStatus"
            position="bottom"
            :overlay="true"
            @close="close"
            custom-style="height:399px;border-top-left-radius: 16px;border-top-right-radius: 16px;z-index:100;"
            lock-scoll= "true"
        >
            
                <div class="product-title" v-if="productList.length">商品列表({{productList.length}})</div>
                
                <div class="product-list" v-if="productList.length">
                    <div class="item" v-for="(item,index) in productList" :key="index">
                        <div class="item-index">{{item.number}}</div>
                        <div class="item-img">
                            <image :src="item.productImgUrl" mode="aspectFill" alt=""></image>
                        </div>
                        <div class="item-detail">
                            <div class="product-name text-overflow2">
                                {{item.productName}}
                            </div>
                            <div class="product-bottom">
                                <div class="product-price">{{item.minPrice}}</div>
                                <div 
                                    class="product-do product-up" 
                                    @click="setProductStatus(1,item.productId,item)" 
                                    v-if="item.upperScreenState == 0 || item.upperScreenState == 2"
                                >
                                上屏
                                </div>
                                <div 
                                    class="product-do product-down" 
                                    @click="setProductStatus(0,item.productId,item)" 
                                    v-if="item.upperScreenState == 1"
                                >
                                下屏
                                </div>
                            </div>
                        </div>
程智春 committed
43
                        <van-divider customStyle="height:1px;margin:0"></van-divider>
程智春 committed
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
                    </div>
                </div>

                <div class="product-no-list" v-else >
                    暂无商品
                </div>
        </van-popup>
        
    </div>
</template>

<script>
export default {
    props:{
        productDialogStatus:{
            type:Boolean,
            default:false
        },
        productList:{
            type:Array,
            default:null
        }
    },
    data(){
        return {
            list : [],
        }
    },
    watch:{
        productList(newVal){
            this.productList = newVal
        }
    },
    created(){
        
    },
    methods:{
        close(){
            this.$emit('hideProductPopup',false)
        },
        setProductStatus(type,id,item,index){
            this.$emit('changeProduct',type,id,item)
        }
    }
}
</script>

<style scoped lang="scss">
    .popup-wrap{
        position: relative;
        z-index: 100;
    }

    .product-title{
        width: 100%;
        height: 45px;
        line-height: 45px;
        font-size: 16px;
        color: #333333;
        padding-left: 16.5px;
        box-sizing: border-box;
    }
    .product-list{
        width: 100%;
        height: 350px;
        overflow-y: auto;
        .item{
            display: flex;
            justify-content: space-between;
            padding: 16px 16.5px;
程智春 committed
114
            border-bottom: 1rpx solid #EEEEED;
程智春 committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
            position: relative;
            .item-index{
                position: absolute;
                width: 19px;
                height: 16px;
                color: white;
                text-align: center;
                line-height: 16px;
                background-color: #999;
                border-top-left-radius: 4px;
                border-bottom-right-radius: 4px;
                font-size: 12px;
            }
            .item-img{
                width: 90px;
                height: 90px;
                border-radius:4px;
                background-color: #B1B1B1;
                margin-right: 16.5px;
                overflow: hidden;
                image{
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }
            .item-detail{
                width: 220.5px;
                position: relative;
                .product-name{
                    font-size: 15px;
                    color: #333333;
                }
                .product-bottom{
                    width: 100%;
                    margin-top: 25px;
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    .product-price{
                        font-size: 18px;
                        color: #FF0000;
                        float: left;
                    }  
                    .product-do{
                        width: 64px;
                        height: 24px;
                        text-align: center;
                        line-height: 24px;
                        border-radius: 12px;
                        font-size: 15px;
                        box-sizing: border-box;
                        float: right;
                    } 
                    .product-up{
                        color: white;
                        background-image:-webkit-linear-gradient(to right,#FF877D, #FB566D);
                        background-image:-moz-linear-gradient(to right,#FF877D, #FB566D);
                        background-image:-o-linear-gradient(to right,#FF877D, #FB566D);
                        background-image: linear-gradient(to right,#FF877D, #FB566D);
                    }
                    .product-down{
                        color: #FF4240;
                        border: 1px solid #FF4240;
                    }
                }
            }
        }
    }
    .product-no-list{
        text-align: center;
        padding-top: 40px;
        line-height: 18px;
        color: #999;
    }
</style>