<template>
    <div class="yygl_container">
        <p class="now_page_title">
            我的服务 / 111 /
            <span>服务详情</span>
        </p>
        <div class="select_box">
            <p class="box_title">
                <span></span>
                推荐位管理
            </p>
            <screen-type :data="filtdata" @getselect="getselect"></screen-type>
            <div class="select_box_contain">
                <recommen-box :data="item" v-for="(item,index) in select_able_arr" :key="index+50000" class="select_box_in"></recommen-box>
            </div>
        </div>

        <div class="selected_box">
            <p class="box_title">
                <span></span>
                已选择列表
            </p>
        </div>
    </div>
</template>

<script>
import screenType from '@/components/recommen/screen-type'
import recommenBox from '@/components/recommen/recommen-box'
export default {
    props: [],
    components: {
        screenType,
        recommenBox,
    },
    data() {
        return {
            filtdata:[],
            filter_name_arr:{
                organizations:'数据来源机构',
                serviceDomain:'数据领域',
                serviceTypeInfo:'数据服务类型'
            },
            select_able_arr:[],
        };
    },
    watch: {

    },
    computed: {

    },
    created() {
        this.get_select_data()
        this.get_select_list()
    },
    mounted() {

    },
    methods: {
        get_select_data(){
            this.$http
            .get(`/apaas/serviceapp/v3/servicemarket/profileInfo?serviceType=5`)
            .then((response) => {
                this.filtdata = []
                for (const key in response.data.data) {
                    if(response.data.data[key].childDomains){
                        response.data.data[key].flag = false
                    }
                    this.filtdata.push(
                        {
                            name:this.filter_name_arr[key],
                            arr:response.data.data[key],
                            key:key
                        }
                    )
                }
            })
        },
        getselect(val){
            console.log(val);
            this.get_select_list(val.word,val.serviceTypeInfo.join(),val.serviceDomain.join(),val.organizations.join())
        },
        get_select_list(word='',data_type='',sectors='',org=''){
            this.$http
            .get(`/apaas/service/v3/recommend/manage/featured/service/fliter?ad_type=hotdata&keyword=${word}&data_type=${data_type}&sectors=${sectors}&org=${org}`)
            .then((response) => {
                if(response.data.success){
                    this.select_able_arr = response.data.data
                }
            })
        },
    },
};
</script>

<style scoped>
.yygl_container {
  height: calc(100vh - 84px);
  overflow: hidden;
  background-color: #f6f7fb;
  padding: 20px;
}
.now_page_title {
  margin: 15px 0;
  color: #898d9e;
}
.now_page_title span {
  color: #242c43;
}
.select_box{
    float: left;
    width: calc(100% - 400px); 
    margin-right: 20px;
    background-color: #ffffff;
	box-shadow: 0px 3px 6px 0px 
		#f4f7fc;
	border-radius: 12px;
}
.selected_box{
    float: left;
    width: 380px; 
    background-color: #ffffff;
	box-shadow: 0px 3px 6px 0px 
		#f4f7fc;
	border-radius: 12px;
}
.box_title{
    height:60px;
    line-height: 60px;
    border-bottom: 1px solid #e3e5ef;
    font-size: 16px;
    color: #58617a;
    font-weight: 600;
}
.box_title span{
    width: 4px;
	height: 16px;
	background-color: #515fe7;
	border-radius: 2px;
    display: inline-block;
    vertical-align: -2px;
    margin-left: 30px;
    margin-right: 10px;
}
.select_box_contain{
    padding: 30px;
    width: 100%;
    overflow: hidden;
}
.select_box_in{
    width: calc((100% - 40px)/3);
    height: 100px;
    float: left;
    background-color: #ccc;
    margin-right: 20px;
}
.select_box_contain .select_box_in:nth-of-type(3n){
    margin-right: 0px;
}
</style>
