<template>
    <view class="content">
        <statusNav navBarTitle="配件列表"></statusNav>
        <view class="mountingsList-input">
            <input type="text" class="int" value="" placeholder="请输入关键字" />
            <image class="search" src="../../static/iocn/ss.png" mode=""></image>
        </view>

        <view class="mountings-list">
            <view class="li" v-for="(item,index) in dataList">
                <view class="textCon">
                    <view class="imgCon">
                        <image src="../../static/del/接收卡-图片.png" class="img" mode="aspectFill"></image>
                    </view>

                    <view class="text">
                        <view class="title">
                            <view class="">
                                {{item.title}}
                            </view>
                            <view class="ispitchOn" @click="ispitchOnFun(item)">
                                <image v-if="item.isJob" src="../../static/iocn/pxz.png" class="icon1" mode=""></image>
                                <view v-else class="icon">

                                </view>
                            </view>
                        </view>
                        <view class="brand p">
                            配件品牌：卡莱特
                        </view>
                        <view class="model p">
                            规格型号：5A-75E
                        </view>
                        <view class="num p">

                            <view class="">
                                已用数量：109张
                            </view>
                            <view class="numBtn">
                                <view class="subtract" @click="subtractFun(item)">
                                    -
                                </view>
                                <view class="sum">
                                    {{item.num}}
                                </view>
                                <view class="add" @click="addFun(item)">
                                    +
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="bottom">
                    <view class="p">
                        *请注意规格型号的选择，不同型号不同价格。
                    </view>
                    <view class="sum">
                        费用合计：¥{{item.sum}}
                    </view>
                </view>
            </view>
        </view>

        <button class="submit-button" type="default">确认提交</button>
    </view>
</template>

<script>
    import statusNav from '../../components/status-nav.vue';
    export default {
        components: {
            statusNav,

        },
        data() {
            return {
                dataList: [{
                        title: "全彩LED显示屏接收卡",
                        state: true,
                        isJob: true,
                        num: 1,
                        price: 2500,
                        sum: 2500,
                    },
                    {
                        title: "全彩LED显示屏接收卡",
                        state: false,
                        isJob: true,
                        num: 1,
                        price: 2500,
                        sum: 2500,
                    },
                    {
                        title: "全彩LED显示屏接收卡",
                        state: true,
                        num: 1,
                        price: 2500,
                        sum: 2500,
                        isJob: false,
                    },
                    {
                        title: "全彩LED显示屏接收卡",
                        state: true,
                        num: 1,
                        price: 2500,
                        sum: 2500,
                        isJob: false,

                    },
                ]
            }
        },
        methods: {
            ispitchOnFun(item) {
                item.isJob = !item.isJob
            },
            subtractFun(item) {
                if (item.num >= 1) {
                    item.num--
                    item.sum = item.price * item.num
                }

            },
            addFun(item) {
                item.num++
                item.sum = item.price * item.num
            }
        }
    }
</script>

<style>
    .content {
        padding-top: 80rpx;
    }

    .submit-button {
        width: 686rpx;
        border-radius: 50rpx;
        height: 90rpx;
        background-color: #02A2ea;
        line-height: 90rpx;
        color: #FFFFFF;
        margin-top: 60rpx;
        text-align: center;
        font-size: 30rpx;
    }

    .mountingsList-input {
        width: 100%;
        position: relative;
        padding: 40rpx 16rpx;
        box-sizing: border-box;
        background-color: #FFFFFF
    }

    .mountingsList-input .int {
        width: 100%;
        background-color: #F7F7F7;
        padding: 0 25rpx;
        height: 67rpx;
        box-sizing: border-box;
        border-radius: 36rpx;
    }

    .mountingsList-input .search {
        width: 28rpx;
        height: 28rpx;
        position: absolute;
        right: 43rpx;
        top: 50%;
        margin-top: -14rpx;
    }

    .mountings-list .li {
        width: 680rpx;
        margin: auto;

        margin-top: 20rpx;
        background-color: #FFFFFF;
        padding: 30rpx 20rpx 0rpx;
    }

    .mountings-list .li .textCon {
        display: flex;
        border-bottom: 2rpx solid #F5F5F5;
    }

    .mountings-list .li .imgCon {
        width: 217rpx;
        height: 137rpx;
        background-color: #CCCCCC;
        border-radius: 5rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 18rpx;
    }

    .mountings-list .li .text {
        flex: 1;
    }

    .mountings-list .li .imgCon .img {
        width: 169rpx;
        height: 104rpx;
    }

    .mountings-list .li .title {
        font-weight: bold;
        font-size: 24rpx;
        display: flex;
        justify-content: space-between;
    }

    .mountings-list .li .title .ispitchOn .icon {
        width: 26rpx;
        height: 26rpx;
        border: 2rpx solid #CCCCCC;
        box-sizing: border-box;
        border-radius: 50%;
    }

    .mountings-list .li .title .ispitchOn .icon1 {
        width: 26rpx;
        height: 26rpx;
        border-radius: 50%;
    }

    .mountings-list .li .text .p {
        color: #999999;
        font-size: 24rpx;
    }

    .mountings-list .li .text .num {
        display: flex;
        justify-content: space-between;
    }

    .mountings-list .li .text {
        padding-bottom: 22rpx;
    }

    .numBtn {
        display: flex;

    }

    .numBtn .subtract {
        border: 2rpx solid #F5F5F5;
        width: 36rpx;
        height: 36rpx;
        border-radius: 50%;
        text-align: center;
        line-height: 35rpx;
        font-size: 36rpx
    }

    .numBtn .sum {
        color: #333333;
        padding: 0 15rpx;
    }

    .numBtn .add {
        width: 36rpx;
        height: 36rpx;
        border-radius: 50%;
        text-align: center;
        line-height: 35rpx;
        font-size: 35rpx;
        background-color: #f82a34;
        color: #FFFFFF;
    }

    .mountings-list .li .bottom {
        padding: 14rpx;
        display: flex;
        justify-content: space-between;
        font-size: 24rpx;
    }

    .mountings-list .li .bottom .p {
        width: 60%;
    }

    .mountings-list .li .bottom .sum {
        color: #ff0000;
    }
 
</style>
