
<style lang="scss" scoped>
.orderDetail{
    ul,li{
        margin: 0;
        padding: 0;
    }
   
    width: 100%;
    .topBody{
        width: 100%;
        background: #FFFFFF;
        margin-bottom: 12px;
        padding: 20px;
        box-sizing: border-box;
        .breadcrumb{
            height: 22px;
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #000000;
            line-height: 22px;
        }
        .bottom{
            display: flex;
            position: relative;
            justify-content: space-between;
            // padding: 20px;
            .orderIcon{
                width: 28px;
                height: 28px;
                margin-right: 15px;
                img{
                    width: 100%;
                }
            }
            .tip{
                .greet{
                    width: 300px;
                    height: 28px;
                    font-size: 20px;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: rgba(0, 0, 0, 0.85);
                    line-height: 28px;
                    margin-bottom: 5px;
                }
                .descPosition{
                    
                    font-size: 14px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: rgba(0, 0, 0, 0.45);
                    overflow: hidden;
                    margin-bottom: 0;
                    li{
                        height: 22px;
                        line-height: 22px;
                        margin-top:3px ;
                    }
                    span{
                        width: 250px;
                        display: inline-block;
                    }
                }

            }
            .optBody{
                width: 200px;
                flex-shrink:0;
                // justify-content: flex-end;
                text-align: right;
                .btnBody{
                    margin-bottom: 10px;
                }
                .orderInfo{
                    display: flex;
                    justify-content: space-between;
                    text-align: right;
                    p{
                        margin-bottom: 0;
                    }
                    
                    .markName{                        
                        height: 22px;
                        font-size: 14px;
                        font-family: PingFangSC-Regular, PingFang SC;
                        font-weight: 400;
                        color: rgba(0, 0, 0, 0.45);
                        line-height: 22px;
                    }
                    .big{                                               
                        height: 28px;
                        font-size: 20px;
                        font-family: PingFangSC-Regular, PingFang SC;
                        font-weight: 400;
                        color: rgba(0, 0, 0, 0.85);
                        line-height: 28px;
                    }
                }

            }
        }

    }
    .section{
        .sectionBody{
            
            p{
                margin-bottom: 0;
            }
            .section-item{
                background: white;
                margin-bottom: 20px;
            }
            .tabBox{
                padding: 15px 20px 0;
            }
            .sectionHead{
                padding: 15px 20px;
                // height: 24px;
                font-size: 16px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: rgba(0, 0, 0, 0.85);
                line-height: 24px;
                border-bottom: 1px solid  #E9E9E9;;
                .allOrder{
                    float: right;
                }
            }
            .section-box{
                padding: 20px 20px;
                .description{
                    margin-top: 10px;
                    .time{
                        height: 32px;
                        line-height: 32px;
                    }
                }
                ul{
                    display: flex;
                    flex-wrap: wrap;
                    // justify-content: space-around;
                }
                li{
                    
                    width: 30%;
                    height: 22px;
                    font-size: 14px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: rgba(0, 0, 0, 0.85);
                    line-height: 22px;
                    text-align: left;
                    margin-bottom: 15px;
                }
                .top{
                    margin-bottom: 25px;
                }
                .bottom{
                    h4{
                        
                        font-size: 15px;
                        font-family: PingFangSC-Medium, PingFang SC;
                        font-weight: 600;
                        color: rgba(0, 0, 0, 0.85);
                        margin-bottom: 25px;
                    }
                }
                .shenhe{
                    width: 6px;
                    height: 6px;
                    display: inline-block;
                    background: #52C41A;
                    border-radius: 50%;
                    position: relative;
                    top: -2px;

                }
                .wancheng{
                    width: 6px;
                    height: 6px;
                     display: inline-block;
                    background: #1890FF;
                    border-radius: 50%;
                    // margin-right: 3px;
                    position: relative;
                    top: -2px;
                }
                .bohui{
                    width: 6px;
                    height: 6px;
                    display: inline-block;
                    background: #F5222D;
                    border-radius: 50%;
                    position: relative;
                    top: -2px;
                }
            }
            
        }
    }
}
.videoBox{
    width: 320px;
    height: 180px;
}
.imgBox{
    width: 100%;
    height: 180px;
}
.marterialInfo{
    
    p{margin-bottom: 0;}
    ul,li{
        margin: 0;
        padding: 0;
    }
    .info-item{
        margin-bottom: 20px;
        display: flex;
        // justify-content: center;
        align-items: center;
        span{
            display: inline-block;
            width: 70px;
            text-align: left;
        }
        .ant-tag{
            width: auto;
            min-width: 50px;
            text-align: center;
        }
    }
    .info{
        ul{
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
        }
        li{
            width: 33.3%;
            margin-bottom: 20px;
        }
        margin-bottom: 0;
    }
    .bottom-btn{
        width: 100%;
        text-align: center;
        position: absolute;
        bottom: 20px;
        left: 0;

    }
}
</style>

<style lang="less">
    .orderDetail{
        .ant-timeline-item-head{
            background: rgb(240,242,245);
        }
    }
</style>
<template>
    <div class="orderDetail ">
        <div class="topBody">
            <p class="breadcrumb">
                <a-breadcrumb style="display:block;width:100%">
                    <a-breadcrumb-item><router-link to="/workBench">工作台</router-link></a-breadcrumb-item>
                    <a-breadcrumb-item>订单详情</a-breadcrumb-item>
                </a-breadcrumb>
            </p>
            <div class="bottom">
                <div class="left" style="display:flex;width:70%">
                     <div class="orderIcon">
                        <img src="@/assets/orderIcon.png" alt="">
                    </div>  
                    <div class='tip'>
                        <p class="greet">订单标题</p>
                        <p class="descPosition">
                        <ul>
                            <li>
                                <span>订单发起人：{{}}</span>
                                <span>关联项目：{{}}</span>
                            </li>
                            <li>
                                <span>创建时间：{{}}</span>
                                <span>设计负责人：{{}}</span>
                            </li>
                            <li>
                                <span>订单周期：{{}}</span>
                            </li>
                        </ul>
                        </p>
                    </div>
                </div>
               
                <div class="optBody">
                    <div class="btnBody">
                        <a-button type='default' style="margin-right:15px" @click="withdrawOrder">撤回订单</a-button>
                        <a-dropdown>
                            <a-menu slot="overlay" @click="handleMenuClick">
                                <a-menu-item key="1">1</a-menu-item>
                                <a-menu-item key="2">2</a-menu-item>
                                <a-menu-item key="3">3</a-menu-item>
                            </a-menu>
                            <a-button> 更多 <a-icon type="down" /> </a-button>
                        </a-dropdown>
                    </div>
                    <div class="orderInfo">
                        <div>
                            <p class="markName">状态</p>
                            <p class="big">{{ orderInfo.status || '待确定'}}</p>
                        </div>
                        <div>
                            <p class="markName">订单进度</p>
                            <p class="big">{{orderInfo.progress|| 0 }}%</p>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
        <div class="section">
            <div class="sectionBody">
                <!-- 订单进度 -->
                <div class="section-item">
                    <div class="sectionHead">订单进度</div>
                    <div class="section-box">
                        <a-steps progress-dot :current="currentStep">
                            <a-step title="创建订单"  >
                                <div class="description" slot="description" v-if="currentStep>=0">
                                    <p class="people">吴永前</p>
                                    <p class="time">2020-10-16 12:20</p>
                                </div>
                                
                            </a-step>
                            <a-step title="设计组长接单"  >
                                <div class="description" slot="description" v-if="currentStep>=1">
                                    <p class="people">王垒</p>
                                    <p class="time" v-if="currentStep==1">
                                        <a-button type='link' @click="hurryUp">催一下</a-button>
                                    </p>
                                    <p class="time" v-else>2020-10-16 12:20</p>
                                </div>
                                
                            </a-step>
                            <a-step title="素材制作"  >
                                <div class="description" slot="description" v-if="currentStep>=2">
                                    <p class="people">王垒</p>
                                    <p class="time" v-if="currentStep==2">
                                        <a-button type='link'  @click="hurryUp">催一下</a-button>
                                    </p>
                                    <p class="time" v-else>2020-10-16 12:20</p>
                                </div>
                                
                            </a-step>
                            <a-step title="订单完成"  >
                                <div class="description" slot="description" v-if="currentStep>=3">
                                    <p class="people">吴永前</p>
                                    <p class="time" v-if="currentStep==3">
                                        <a-button type='link'  @click="checkAccept">待验收</a-button>
                                    </p>
                                    <p class="time" v-else>2020-10-16 12:20</p>
                                </div>
                                
                            </a-step>
                           
                        </a-steps>
                    </div>
                </div>
                <!-- 订单详情 -->
                <div class="section-item">
                    <div class="sectionHead">订单详情</div>
                    <div class="section-box">
                        <div class="top">
                            <ul>
                                <li>
                                    订单发起人：<span>吴永前</span>
                                </li>
                                <li>
                                    订单所含素材总数：<span>20</span>
                                </li>
                                <li>
                                    订单状态：<span>设计中</span>
                                </li>
                                <li>
                                    订单所属项目：<span>北京聚划算</span>
                                </li>
                                <li>
                                    要求日更素材：<span>4</span>
                                </li>
                            </ul>
                        </div>
                        <div class="bottom">
                            <h4>素材负责人</h4>
                            <ul>
                                <li> 设计组长：<span>毕洁泉</span></li>
                                <li> 摄像：<span>王垒</span></li>
                                <li> </li>
                                <li> 编导：<span>毕洁泉</span></li>
                                <li> 剪辑：<span>毕洁泉</span></li>
                                <li> </li>
                            </ul>
                        </div>
                    </div>

                </div>
                <!-- 素材列表 -->
                <div class="section-item">
                    <div class="tabBox">
                        <a-tabs v-model="tabKey" @change="tabChange">
                            <a-tab-pane :key='1' tab="素材"></a-tab-pane>
                            <a-tab-pane :key='2' tab="脚本"></a-tab-pane>
                            <a-button type='primary' slot="tabBarExtraContent">上传素材</a-button>
                        </a-tabs>
                    </div>
                        
                    
                    <div class="section-box">
                         <a-table
                            size="middle"
                            :columns="columns"
                            :dataSource="data"
                            id="outTable"
                            :pagination="ipagination"
                            :loading="loading"
                            @change="sort"
                            style="word-break: break-all;"
                            >
                            <div slot="status" slot-scope="text" >
                                <!-- <a-spin :spinning="record.spin" size="small" >
                                    <div class="spin-content">
                                        <a-switch size="default" :checked=text  @change="switchChange(text,record)"/>
                                    </div>
                                </a-spin>
                                <a-switch size="default" :checked=text  @change="switchChange(text,record)"/> -->
                               
                                <span class="shenhe" v-if="text=='待审核'"> </span>
                                <span class="wancheng" v-else-if="text=='已完成'"> </span>
                                <span class="bohui" v-else> </span>
                                {{text}}
                            </div>
                            <span slot="options" slot-scope="text,record">

                                <a href="javascript:;" @click="viewDetails(record)">详情</a>
                                <a-divider type="vertical" />
                                <a href="javascript:;" @click="hurryUp(record)">催一下</a>
                                <a-divider type="vertical" />
                                <a href="javascript:;" @click="viewDetails(record)">通过</a>
                                <a-divider type="vertical" />
                                <a href="javascript:;" @click="viewDetails(record)">驳回</a>
                                <a-divider type="vertical" />

                                <!-- <a-divider type="vertical" />
                                <a href="javascript:;" @click="recordsRule(record)">计划分析</a>
                                <a-divider type="vertical" />
                                <a-popconfirm
                                    title="确定删除该规则吗？"
                                    @confirm="deleteRule(record)"                            
                                >
                                    <a href="javascript:;" >删除</a>
                                </a-popconfirm> -->                                
                            </span>

                        </a-table>
                    </div>
                    <a-drawer
                    title="素材详情"
                    width="640"
                    :placement="placement"
                    :closable="false"
                    :visible="visible"
                    @close="onClose"
                    >
                        <div class="videoBody">
                            <div class="videoBox">
                                <video :src="currentMaterial.src" ></video>
                            </div>
                            
                            <div class="imgBox">
                                <img src="" alt="">
                                <img src="" alt="">
                            </div>
                        </div>
                        <div class="marterialInfo">
                            <div class="info-item">
                                <span>素材状态：</span>
                                <p>未审核</p>
                            </div>
                            <div class="info-item">
                                <span>生成水印：</span>
                                <a-select :defaultValue="4" v-model="size" style="width:70%;">
                                    <a-select-option :value="item.id" :key="item.id" v-for="item of sizeType">{{
                                        item.name
                                    }}</a-select-option>
                                </a-select>
                                <a-button type="primary" @click="getWater">生成</a-button>
                            </div>
                            <div class="info-item">
                                <span>视频标签：</span>
                                <a-tag>Tag 1</a-tag>
                                <a-tag>Tag 1</a-tag>
                            </div>
                            <div class="info-item info">
                                <ul>
                                    <li><span>视频时长：</span> 17秒 </li>
                                    <li><span>视频尺寸：</span> 1080*1920 </li>
                                    <li><span>视频大小：</span> 31.42M </li>
                                    <li><span>策划：</span> 吴永前 </li>
                                    <li><span>拍摄：</span> 吴永前 </li>
                                    <li><span>剪辑：</span> 吴永前 </li>                                    
                                </ul>
                            </div>
                            <div class="info-item">
                                <span>广告语：</span>
                                <p>14354534324454354水电费水电费方式手动</p>
                            </div>
                            <div class="bottom-btn">
                                <a-button type='primary' @click="approved" style="margin-right:20px">通过审核</a-button>
                                <a-button type='default' @click="reject">驳回</a-button>
                            </div>
                        </div>
                    </a-drawer>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import moment from 'moment';
import { getAction, postAction, downFile, downFilePost } from '@/api/manage';

let materialColumns=[
    {
        title: '素材名称',
        dataIndex: 'name',
        align: 'center',        
        key: 'name',
        scopedSlots: { customRender: 'name' }
    },
    {
        title: '素材类型',
        dataIndex: 'type',
        align: 'center',        
        key: 'type',
        scopedSlots: { customRender: 'type' }
    },
    {
        title: '素材状态',
        dataIndex: 'status',
        align: 'center',        
        key: 'status',
        scopedSlots: { customRender: 'status' }
    },
    {
        title: '完结时间',
        dataIndex: 'time',
        align: 'center',        
        key: 'time',
        scopedSlots: { customRender: 'time' }
    },
    {
        title: '备注',
        dataIndex: 'remarks',
        align: 'center',        
        key: 'remarks',
        scopedSlots: { customRender: 'remarks' }
    },
    {
        title: '操作',
        dataIndex: 'options',
        align: 'center',        
        key: 'options',
        width:250,
        scopedSlots: { customRender: 'options' }
    },
]
let scriptColumns=[
    {
        title: '素材名称',
        dataIndex: 'name',
        align: 'center',        
        key: 'name',
        scopedSlots: { customRender: 'name' }
    },
    {
        title: '素材标签',
        dataIndex: 'tag',
        align: 'center',        
        key: 'tag',
        scopedSlots: { customRender: 'tag' }
    },
    {
        title: '素材状态',
        dataIndex: 'status',
        align: 'center',        
        key: 'status',
        scopedSlots: { customRender: 'status' }
    },
    {
        title: '完结时间',
        dataIndex: 'time',
        align: 'center',        
        key: 'time',
        scopedSlots: { customRender: 'time' }
    },
    {
        title: '备注',
        dataIndex: 'remarks',
        align: 'center',        
        key: 'remarks',
        scopedSlots: { customRender: 'remarks' }
    },
    {
        title: '操作',
        dataIndex: 'options',
        align: 'center',        
        key: 'options',
        scopedSlots: { customRender: 'options' }
    },
]

let marterialData=[
    {
        name:'1111',
        type:'真人',
        status:'待审核',
        time:'2020-10-20 19:23:12',
        id:0,
        remarks:'xx'
    },
    {
        name:'2211',
        type:'vlog',
        status:'已完成',
        time:'2020-10-20 19:23:12',
        id:1
    },
    {
        name:'3331',
        type:'真人',
        status:'已驳回',
        time:'2020-10-20 19:23:12',
        id:2
    },
    {
        name:'4444',
        type:'真人',
        status:'待审核',
        time:'2020-10-20 19:23:12',
        id:3
    },
]
export default {
    data() {
        return {
            tabKey:1,

            columns:[...materialColumns],
            data:[...marterialData],
            loading:false,
            ipagination: {
                current: 1,
                pageSize: 10,
                //   pageSizeOptions: ['10', '20', '30'],
                showTotal: (total, range) => {
                    return range[0] + "-" + range[1] + " 共" + total + "条"
                },
                showQuickJumper: true,
                showSizeChanger:true,
                pageSizeOptions: ['10', '30', '50'],
                total: 0,
                onChange: (current, pageSize) => {
                    // 切换分页时的回调，
                    // 当在页面定义change事件时，切记要把此处的事件清除，因为这两个事件重叠了，可能到时候会导致一些莫名的bug
                    this.ipagination.current = current;
                    this.ipagination.pageSize= pageSize;
                }
            },
            // 订单进度
            orderInfo:{
                status:undefined,
                progress:0,
            },
            currentStep:1,

            visible: false,
            placement: 'right',
            currentMaterial:{},


            sizeType:[],
            size: "4",
        }
    },
    methods: {
        // 查看详情
        viewDetails(record){
            console.log(record)
            this.visible = true;
        },
        
        onClose() {
            this.visible = false;
        },
        // 撤回订单
        withdrawOrder(){

        },
        // 更多操作
        handleMenuClick(e) {
            console.log('click', e);
        },

        // 催一下
        hurryUp(){

        },

        // 验收
        checkAccept(){

        },

        // 上传素材
        uploadMaterial(){

        },

        sort(pagination, filters, sorter, { currentDataSource }){
        
            this.ipagination.current=pagination.current;

            this.ipagination.pageSize=pagination.pageSize;
            this.materialHttp()
        },
        // 请求素材
        materialHttp(){
            // this.loading=true;           
            this.data=[];
        },

        

        // tabqiehuan
        tabChange(key){
            console.log(key);
            if(key==1){
                this.columns=[...materialColumns]
            }else{
                this.columns=[...scriptColumns]
            }
        },

        // 素材通过审核
        approved(){

        },
        // 素材驳回
        reject(){

        },
        // 生成水印
        getWater() {
        var params = qs.stringify({
          id: this.id,
          watermarkTemplateId: this.size
        })
        postAction('/ctop/materialInfo/watermark', params).then(res => {
          if (res.success) {
            // getAction("/ctop/videoWatermarkTask/list").then(res=>{
            //     console.log(res)
            // })
            this.$message.success('水印素材生成中,请一分钟后刷新')
            this.visibleDetail = false
            this.refuseFile = []
            this.refuseReason = ''
            closeAllVideoFun()
            this.loadData()
          }
        })
      },
    },
    created(){
        getAction('/ctop/videoWatermarkTemplate/list').then(res => {
            if (res.success) {
            this.sizeType = res.result.records
            }
        })
    }
}
</script>
