<template>
    <view class="content">
		<status-nav navBarTitle="添加报修" returnColor="#c2c2c2"></status-nav>
		<container-subgroup>
			<view slot="content" style="margin: 0 -30rpx;">
				<view class="repairs-nav" style="margin-top: -30rpx;">
					<view class="li" @click="repairsNavFun(index)" :class="item.state?'on':''" v-for="(item,index) in navDataState">
						{{item.title}}
					</view>
				</view>
				<view class="repairs-hint padding">
					<image class="icon" src="../../static/iocn/lp.png" mode="aspectFill"></image>
					<view class="text">
						请务必拍好故障照片或视频上传,便于技术工程师作为判断依据,带齐 相关维保设备。高效为您提供服务。
					</view>
				</view>
				<view class="fault-type-title padding">故障类型：</view>
				<view class="padding fault-type-content">
					<view class="li" :class="item.state?'on':''" v-for="(item,index) in faultTypeData">
						{{item.title}}
					</view>
				</view>

				<view class="padding">
					<view class="devicename" v-if="navDataState[0].state">
					
						<view class="">
							请填写设备名称和型号或扫描二维码
						</view>
						<image class="sm" src="../../static/iocn/sm.png" mode=""></image>
					</view>
					<view class="devicename" v-else>
						请填写设备名称和型号
					</view>
			   
					<view class="fault-pictures">
						<image class="img" src="../../static/iocn/gz.png" mode="aspectFill"></image>
						<view class="text">
							添加故障图片
						</view>
					</view>

					<textarea value="" class="fault-description" placeholder="故障情况描述"
						placeholder-class="fault-description-text" />

					<view class="detailed-address inputCss">

						<input type="text" value="" placeholder="请输入详细的上门服务地址" placeholder-class="inputCss-input" />

						<image @click="mapFun()" src="../../static/iocn/map.png" class="map" mode="aspectFill"></image>
					</view>

					<input type="text" class="inputCss" placeholder="请填写您的姓名" placeholder-class="inputCss-input" value="" />
					<input type="text" class="inputCss" placeholder="请填写联系电话" placeholder-class="inputCss-input" value="" />
					<uni-datetime-picker type="date" class="uni-datetime-pickerCss" :value="single" :border="false"
						@change="change" />

					<button class="submit-button" type="default">提交故障申报</button>
				</view>
			</view>
		</container-subgroup>
		
    </view>
</template>

<script>
    export default {
        data() {
            return {
                single: "2021-04-3",

                navDataState: [{
                        title: "有设备",
                        state: false
                    },
                    {
                        title: "无设备",
                        state: true
                    },
                ],
                faultTypeData: [{
                        title: "供电不足",
                        state: false
                    },
                    {
                        title: "参数错误",
                        state: false
                    },
                    {
                        title: "模组故障",
                        state: false
                    },
                    {
                        title: "网络故障",
                        state: false
                    },
                    {
                        title: "外力损坏",
                        state: false
                    },
                    {
                        title: "软件问题",
                        state: true
                    },
                    {
                        title: "信号故障",
                        state: false
                    },
                    {
                        title: "其他问题",
                        state: false
                    },
                ]
            }
        },
        methods: {
            change(e) {
                this.single = e;
                console.log("-change事件:", e);
            },
            mapFun() {
                uni.getLocation({
                    type: 'wgs84',
                    success: function(res) {
                        console.log('当前位置的经度：' + res.longitude);
                        console.log('当前位置的纬度：' + res.latitude);
                    }
                });
            },
            repairsNavFun(index){
                 for (var i = 0; i < this.navDataState.length; i++) {
                     this.navDataState[i].state=false
                 }
                   this.navDataState[index].state=true
            }
            
        }
    }
</script>

<style>
    .repairs-nav {
        display: flex;
        background-color: #FFFFFF;
        justify-content: space-between;
    }

    .repairs-nav .li {
        width: 50%;
        padding: 30rpx 0rpx;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28rpx;
        color: #343536;
             border-bottom: 2rpx solid rgba(0,0,0,0);
    }

    .repairs-nav .on {
        color: #00a2ea;

        border-bottom: 2rpx solid #00a2ea;
    }

    .content {
        background-color: #F7F7F7;
        min-height: 100vh;
    }

    .repairs-hint {
        width: 100%;
        height: 123rpx;
        background-color: #FFFFFF;
        display: flex;
        padding-top: 20rpx;
        box-sizing: border-box;
        margin-top: 23rpx;
        border-top: 2rpx solid #e7e7e7;
        border-bottom: 2rpx solid #e7e7e7;
    }

    .repairs-hint .icon {
        width: 30rpx;
        height: 27rpx;
        margin-right: 15rpx;
        margin-top: 8rpx;
    }

    .repairs-hint .text {
        flex: 1;
        color: #5e5e5e;
        font-size: 22rpx;
        line-height: 40rpx;
    }

    .fault-type-title {
        margin-top: 14rpx;
        width: 100%;
        line-height: 80rpx;
        margin-bottom: 13rpx;
        border-top: 2rpx solid #e7e7e7;
        border-bottom: 2rpx solid #e7e7e7;
        height: 80rpx;
        background-color: #FFFFFF;
        color: #434242;
    }

    .fault-type-content {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .fault-type-content .li {
        width: 160rpx;
        height: 59rpx;
        background-color: #FFFFFF;
        font-size: 26rpx;
        color: #5e5e5e;
        text-align: center;
        line-height: 59rpx;
        border-radius: 22rpx;
        border: 2rpx solid #eeeeee;
        margin-bottom: 15rpx;

    }

    .fault-type-content .on {
        color: #FFFFFF;
        border: none;
        background-color: #00a2ea;
    }

    .information {}

    .devicename {
        width: 100%;
        height: 78rpx;
        border-radius: 10rpx;
        background-color: #FFFFFF;
        padding: 0 16rpx;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: #9f9898;
        font-size: 26rpx;
        line-height: 78rpx;
    }

    .fault-pictures {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 18rpx;
        height: 320rpx;
        box-sizing: border-box;
        width: 100%;
        background-color: #FFFFFF;
        flex-direction: column;
    }

    .fault-pictures .img {
        width: 87rpx;
        margin-bottom: 27rpx;
        height: 87rpx;
    }

    .fault-pictures .text {
        font-size: 30rpx;

        color: #9f9898;

    }

    .fault-description {
        height: 193rpx;
        width: 100%;
        box-sizing: border-box;
        margin-top: 23rpx;
        padding: 23rpx 19rpx;
        background-color: #FFFFFF;
    }

    .fault-description-text {
        color: #9f9898;
        font-size: 26rpx
    }

    .inputCss {
        height: 78rpx;
        width: 100%;
        box-sizing: border-box;
        padding: 0rpx 17rpx;
        font-size: 30rpx;
        border-radius: 10rpx;
        background-color: #FFFFFF;
        color: #9f9898;
        display: flex;
        margin-top: 20rpx;
        align-items: center;
    }

    .detailed-address {
        justify-content: space-between;
    }

    .inputCss-input-input {
        font-size: 30rpx;
        color: #9f9898;
    }

    .detailed-address .map {
        width: 151rpx;
        height: 59rpx;
        background-color: #F7F7F7;


    }

    .uni-datetime-pickerCss {
        margin-top: 20rpx;
    }

    .submit-button {
        width: 100%;
        margin-top: 44rpx;
        border-radius: 50rpx;
        height: 90rpx;
        background-color: #02A2ea;
        line-height: 90rpx;
        color: #FFFFFF;
        text-align: center;
        font-size: 30rpx;
    }
    .devicename .sm{
        width: 42rpx;
        height: 36rpx;
    }
</style>
