<template>
    <div style="padding-bottom: 50px">
        <!-- <div class="backbtn" style="margin-bottom:20px">
            <el-button icon="el-icon-arrow-left" @click='backroute'>返回</el-button>
        </div> -->
        <div style="width: 99%">
            <div style="background: #ffffff; box-shadow: 0px 2px 8px 0px rgba(54, 61, 67, 0.1); padding: 15px 0px">
                <div style="padding: 0px 30px">
                    <div style="display: flex; font-size: 35rpx; font-weight: bold; justify-content: space-between">
                        <p v-if="crowdtype == 'myApply'" style="color: #333333; font-size: 20px; margin-top: 10px">
                            {{ task.projectName }}
                        </p>
                        <p v-else style="color: #333333; font-size: 20px; margin-top: 10px">
                            {{ task.project_name }}
                        </p>
                        <p v-if="task.price == 0" style="color: #fd461a">面议</p>
                        <p v-else style="color: #fd461a">¥{{ task.price }}</p>
                    </div>
                    <div style="display: flex">
                        <div v-if="crowdtype == 'myApply'" class="tabone">
                            <span v-if="task.status == 0">待审核</span>
                            <span v-if="task.status == 1">审核通过</span>
                            <span v-if="task.status == 2">审核不通过</span>
                        </div>
                        <div v-else class="tabone">
                            <span v-if="task.task_status == 0">竞标中</span>
                            <span v-if="task.task_status == 1">竞标成功</span>
                            <span v-if="task.task_status == 2">竞标失败</span>
                        </div>

                        <template v-if="crowdtype == 'myApply'">
                            <div
                                v-for="it in findLabelValueByProp(
                                    tasktypelist,
                                    task.testType,
                                    'dictValue',
                                    'dictLabel',
                                ).split(',')"
                                :key="it"
                                class="tabone"
                                style="width: 75px; background: #e8eef5; color: #525b65"
                            >
                                <span>{{ it }}</span>
                            </div>
                        </template>
                        <template v-else>
                            <div
                                v-for="it in findLabelValueByProp(
                                    tasktypelist,
                                    task.test_type,
                                    'dictValue',
                                    'dictLabel',
                                ).split(',')"
                                :key="it"
                                class="tabone"
                                style="width: 75px; background: #e8eef5; color: #525b65"
                            >
                                <span>{{ it }}</span>
                            </div>
                        </template>
                    </div>
                </div>
                <div style="width: 100%; height: 1px; background-color: #ebebeb; margin: 14px 0 19px 0"></div>
                <div style="padding: 0px 30px">
                    <div style="color: #808080; font-size: 24rpx; margin: 36rpx 25rpx 0 25rpx">
                        <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">
                            <span v-if="task && task.createTime">发布日期：{{ task.createTime.slice(0, 10) }}</span>
                        </p>
                        <p v-else style="margin-bottom: 10px">
                            <span v-if="task && task.create_time">发布日期：{{ task.create_time.slice(0, 10) }}</span>
                        </p>
                        <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">
                            需要人数：{{ task.needPerson }}人
                        </p>
                        <p v-else style="margin-bottom: 10px">需要人数：{{ task.need_person }}人</p>
                        <p style="margin-bottom: 10px">项目周期：{{ task.period }}天</p>
                        <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">
                            驻场需求：
                            <span v-if="task.onsiteType == 0"> 无需驻场</span>
                            <span v-if="task.onsiteType == 1"> 偶尔驻场</span>
                            <span v-if="task.onsiteType == 2"> 定期驻场</span>
                        </p>
                        <p v-else style="margin-bottom: 10px">
                            驻场需求：
                            <span v-if="task.onsite_type == 0"> 无需驻场</span>
                            <span v-if="task.onsite_type == 1"> 偶尔驻场</span>
                            <span v-if="task.onsite_type == 2"> 定期驻场</span>
                        </p>
                        <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">技能要求：{{ task.techNeed }}</p>
                        <p v-else style="margin-bottom: 10px">技能要求：{{ task.tech_need }}</p>
                        <p style="margin-bottom: 10px">地域要求：{{ task.area }}</p>
                        <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">有效天数：{{ task.validDays }}天</p>
                        <p v-else style="margin-bottom: 10px">有效天数：{{ task.valid_days }}天</p>
                        <!-- <p v-if="crowdtype=='myApply'" style='margin-bottom:10px'>竞标者要求：
                            <span v-if='task.applicantType==0'>个人测试者</span>
                            <span v-if='task.applicantType==1'>认证测试公司</span>
                            <span v-if='task.applicantType==2'>个人测试者/认证测试公司</span>
                        </p>
                        <p v-else style='margin-bottom:10px'>竞标者要求：
                            <span v-if='task.applicant_type==0'>个人测试者</span>
                            <span v-if='task.applicant_type==1'>认证测试公司</span>
                            <span v-if='task.applicant_type==2'>个人测试者/认证测试公司</span>
                        </p> -->
                    </div>
                    <div style="display: flex; align-items: center; width: 150px; margin-top: 30px">
                        <div class="dvied"></div>
                        <div style="font-weight: bold; color: #333333; font-size: 17px; margin-left: 10px">
                            需求描述
                        </div>
                    </div>
                    <div v-if="crowdtype == 'myApply'">
                        <p
                            v-if="task.projectDesc"
                            v-html="task.projectDesc"
                            style="color: #808080; line-height: 23px; font-size: 24rpx; white-space: pre-line"
                        ></p>
                        <p v-else style="margin-left: 10px">无</p>
                    </div>
                    <div v-else>
                        <p
                            v-if="task.project_desc"
                            v-html="task.project_desc"
                            style="color: #808080; line-height: 23px; font-size: 24rpx; white-space: pre-line"
                        ></p>
                        <p v-else style="margin-left: 10px">无</p>
                    </div>

                    

                     <div v-if="crowdtype != 'competitive'" style="display: flex; align-items: center; width: 150px; margin-top: 30px">
                        <div class="dvied"></div>
                        <div style="font-weight: bold; color: #333333; font-size: 17px; margin-left: 10px">
                            联系方式
                        </div>
                    </div>
                    <div v-if="crowdtype != 'competitive'"  style="display:flex;align-items:center;color: #808080; font-size: 24rpx; margin: 36rpx 25rpx 0 25rpx">
                         <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">
                            <span v-if="task && task.contactName">联系人：{{ task.contactName }}</span>
                        </p>
                        <p v-else style="margin-bottom: 10px">
                            <span v-if="task && task.contact_name">联系人：{{ task.contact_name }}</span>
                        </p>
                        <p style="margin:0 60px">|</p>
                        <p v-if="crowdtype == 'myApply'" style="margin-bottom: 10px">
                            <span v-if="task && task.contactTel">联系方式：{{ task.contactTel }}</span>
                        </p>
                        <p v-else style="margin-bottom: 10px">
                            <span v-if="task && task.contact_tel">联系方式：{{ task.contact_tel }}</span>
                        </p>
                    </div>
                    

                    <div style="display: flex; align-items: center; width: 150px; margin-top: 30px">
                        <div class="dvied"></div>
                        <div style="font-weight: bold; color: #333333; font-size: 17px; margin-left: 10px">附件</div>
                    </div>

                    <template v-if="task.attachment">
                        <div
                            style="display: flex; align-items: center; margin: 12px 0"
                            v-for="(it, index) in task.attachmentArr"
                            :key="it"
                        >
                            <img
                                style="width: 17px; height: 20px; margin-right: 5px"
                                src="/assets/crowd/upload.png"
                                alt=""
                            />
                            <p @click="openurl(it)" style="color: #1578ed; font-size: 12px; cursor: pointer">
                                项目附件{{ index + 1 }}
                            </p>
                        </div>
                    </template>
                    <div v-else style="display: flex; align-items: center; margin: 12px 0">
                        <img
                            style="width: 17px; height: 20px; margin-right: 5px"
                            src="/assets/crowd/upload.png"
                            alt=""
                        />
                        <p style="color: #1578ed; font-size: 12px">无</p>
                    </div>
                </div>
            </div>
            <div
                v-if="crowdtype == 'competitive'"
                style="
                    background: #ffffff;
                    box-shadow: 0px 2px 8px 0px rgba(54, 61, 67, 0.1);
                    padding: 15px 30px;
                    margin: 20px 0;
                "
            >
                <!-- <div class="dvied"></div> -->
                <div style="font-weight: bold; color: #333333; font-size: 18px; margin: 0px">竞标方案</div>
                <div
                    v-if="userprogramme && userprogramme.period"
                    style="font-size: 14px; text-align: left; color: #333333; margin: 20px 0px; line-height: 25px"
                >
                    <p>竞标日期：{{ userprogramme.apply_time.slice(0, 10) }}</p>
                    <p>竞标工期：{{ userprogramme.period ? userprogramme.period + '天' : '无' }}</p>
                    <p>竞标优势：{{ userprogramme.competition_edge ? userprogramme.competition_edge : '无' }}</p>
                    <p>
                        竞标附件：
                        <span
                            @click="openurl(userprogramme.attachment)"
                            v-if="userprogramme.attachment"
                            style="color: #1578ed; cursor: pointer"
                            >项目附件</span
                        >
                        <span v-else style="margin-left: -3px">无</span>
                    </p>
                </div>
            </div>
            <div
                v-if="crowdtype == 'myPublish' || crowdtype == 'competitive'"
                class="crowdnum"
                style="
                    background: #ffffff;
                    box-shadow: 0px 2px 8px 0px rgba(54, 61, 67, 0.1);
                    padding: 15px 30px;
                    margin-top: 25px;
                "
            >
                <el-divider v-if="task.processStatus == 0 || task.processStatus == 1" content-position="left"
                    ><h3>任务提醒</h3></el-divider
                >
                <el-form label-width="150px" class="demo-ruleForm" label-position="left" style="margin-top: 10px">
                    <el-row v-if="task.processStatus == 0">
                        <el-col :span="24">
                            <el-form-item label="发布有效期截止">
                                {{ task.expireTime }}
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row v-if="task.processStatus == 1">
                        <el-col :span="24">
                            <el-form-item label="工期截止">
                                {{ task.deadline }}
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <div style="display: flex; align-items: center; margin: -10px 0; position: relative">
                    <!-- <div class="dvied"></div> -->
                    <div style="font-weight: bold; color: #333333; font-size: 18px">竞标者名单</div>
                    <div class="choseUserBtn" @click="choseUser" v-if="task.process_status == 0 && userinform.companyStatus == 2">选中竞标用户</div>
                </div>
                <el-table v-loading="loading" :data="applicantdataList" border style="width: 100%; margin-top: 30px">
                    <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
                    <el-table-column label="竞标时间" align="center" key="apply_time" prop="apply_time">
                        <template slot-scope="scope">
                            <span>{{ scope.row.apply_time.slice(0, 10) }}</span>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column label="竞标者类型" align="center" key="testerType" prop="testerType">
                        <template slot-scope="scope">
                            <span>{{ scope.row.testerType==2 ? "认证测试公司" : "个人测试者"}}</span>
                        </template>
                    </el-table-column> -->
                    <el-table-column label="名称" align="center" key="nick_name" prop="nick_name">
                        <template slot-scope="scope">
                            <el-button
                                size="mini"
                                type="text"
                                @click="viewTesterDetail(scope.row)"
                            >
                                {{scope.row.nick_name}}
                            </el-button>
                        </template>
                    </el-table-column>
                    <el-table-column label="状态" align="center" key="status" prop="status">
                        <template slot-scope="scope">
                            <!-- <el-tag
                                :type="scope.row.status == 0 ? 'warning' : scope.row.status == 1 ? 'success' : 'danger'"
                                effect="dark"
                                size="small"
                                style="width: 68px; padding-left: 12px; padding-right: 12px; cursor: pointer"
                                >{{
                                    scope.row.status == 0 ? '竞标中' : scope.row.status == 1 ? '竞标成功' : '竞标失败'
                                }}</el-tag
                            > -->
                            <el-tag
                                v-if="scope.row.status == 0"
                                type="warning"
                                effect="dark"
                                size="small"
                                style="padding: 0 12px"
                                >竞标中</el-tag
                            >
                            <el-tag v-else-if="scope.row.status == 1" effect="dark" size="small" style="padding: 0 12px"
                                >实施中</el-tag
                            >
                            <el-tag
                                v-else-if="scope.row.status == 3"
                                effect="dark"
                                size="small"
                                style="padding: 0 12px; background: #11b7ed; border-color: #11b7ed"
                                >待验收</el-tag
                            >
                            <el-tag v-else-if="scope.row.status == 4" effect="dark" size="small" style="padding: 0 12px" type="warning">待付款</el-tag>
                            <el-tag v-else-if="scope.row.status == 5" type="success" effect="dark" size="small" style="padding: 0 12px">已完成</el-tag>
                            <el-tag v-else-if="scope.row.status == 6" type="danger" effect="dark" size="small" style="padding: 0 12px">验收不通过</el-tag>
                            <el-tag v-else type="danger" effect="dark" size="small" style="padding: 0 12px">竞标失败</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="工作成果" v-if="userinform.companyStatus == 2" align="center" prop="">
                        <template slot-scope="scope">
                            <el-button v-if="scope.row.result_attach" type="text" @click="download(scope.row.result_attach)">点击下载</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="260" v-if="userinform.companyStatus == 2">
                        <template slot-scope="scope" >
                            <!-- <el-button
                                v-if="scope.row.user_id == userId || userinform.companyStatus == 2"
                                size="mini"
                                type="text"
                                icon="el-icon-edit"
                                @click="viewTesterDetail(scope.row)"
                            >
                                查看详情
                            </el-button> -->
                            <!-- <el-button
                                v-if="crowdtype == 'myPublish'"
                                :disabled="task.process_status != 0"
                                size="mini"
                                type="text"
                                icon="el-icon-key"
                                @click="assignTester(scope.row.user_id)"
                            >
                                选中
                            </el-button> -->
                            <el-checkbox v-if="scope.row.status == 0" v-model="scope.row.isFlag">选中</el-checkbox>
                            <el-button v-else-if="scope.row.status == 3 || scope.row.status == 1" type="text" @click="goFinnal(scope.row)">任务结项</el-button>
                            <el-button v-else-if="scope.row.status == 4" type="text" @click="goPay(scope.row)">支付佣金</el-button>
                            <span v-else-if="scope.row.status == 5 && scope.row.reward">交易完成({{scope.row.reward}}元)</span>
                            <el-button v-else-if="scope.row.status == 6" style="color: #fe5555" type="text" @click="goNoPass(scope.row)"
                                >验收不通过</el-button
                            >
                            <!-- is_comment    0未评价 1已评价 -->
                            <el-button v-if="scope.row.status == 5 && scope.row.p_comment == 0 "  @click="goreview(scope.row)" type="text" style="margin-left:10px">去评价</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div v-if="total > 10" style="width: 100%; margin-top: 30px; text-align: right">
                    <el-pagination
                        background
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage"
                        :page-size="pageSize"
                        layout="total,  prev, pager, next, jumper"
                        :total="total"
                    >
                    </el-pagination>
                </div>
                <tester-detail
                    ref="testerDetail"
                    :crowdtype="crowdtype"
                    :status="task.processStatus"
                    :taskId="task.taskId"
                    @closeDialog="closeDialog"
                ></tester-detail>
            </div>
            <!-- 审核不通过信息 -->
            <div v-if="crowdtype == 'myApply' && task.status != 0">
                <div
                    style="
                        background: #ffffff;
                        box-shadow: 0px 2px 8px 0px rgba(54, 61, 67, 0.1);
                        padding: 15px 30px;
                        margin-top: 25px;
                    "
                >
                    <div style="display: flex; align-items: center; width: 150px; margin-top: 20px">
                        <div class="dvied"></div>
                        <div style="font-weight: bold; color: #333333; font-size: 18px; margin-left: 10px">
                            审核信息
                        </div>
                    </div>
                    <!-- <el-divider></el-divider> -->
                    <div style="display: flex; margin: 30px 0">
                        <div class="taskd">
                            <p>审核状态</p>
                            <p>
                                <el-tag
                                    v-if="task.status == 0"
                                    type="primary"
                                    effect="dark"
                                    size="small"
                                    style="width: 68px; padding-left: 12px; padding-right: 12px; cursor: pointer"
                                    >待审核</el-tag
                                >
                                <el-tag
                                    v-else-if="task.status == 1"
                                    type="success"
                                    effect="dark"
                                    size="small"
                                    style="cursor: pointer"
                                    >审核通过</el-tag
                                >
                                <el-tag v-else type="danger" effect="dark" size="small" style="cursor: pointer"
                                    >审核不通过</el-tag
                                >
                            </p>
                        </div>
                        <div class="taskd">
                            <p>审核时间</p>
                            <p style="width: 260px">{{ task.auditTime }}</p>
                        </div>
                    </div>
                    <!-- <el-divider></el-divider> -->
                    <div class="taskd">
                        <p>审核意见</p>
                        <p>{{ task.auditOpinion }}</p>
                    </div>
                    <!-- <el-divider></el-divider> -->
                </div>
            </div>
            <div v-if="crowdtype == 'myClaim'">
                <el-divider v-if="task.processStatus == 0 || task.processStatus == 1" content-position="left"
                    ><h3>任务提醒</h3></el-divider
                >
                <el-form label-width="150px" class="demo-ruleForm" label-position="left">
                    <el-row v-if="task.processStatus == 0">
                        <el-col :span="24">
                            <el-form-item label="发布有效期截止">
                                {{ task.expireTime }}
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row v-if="task.processStatus == 1">
                        <el-col :span="24">
                            <el-form-item label="工期截止">
                                {{ task.deadline }}
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <el-divider content-position="left"><h3>发布者信息</h3></el-divider>
                <el-form>
                    <el-form-item label="公司名称" v-if="company.name != null">
                        {{ company.name }}
                    </el-form-item>
                    <el-form-item label="公司简介" v-if="company.companyDesc != null">
                        {{ company.companyDesc }}
                    </el-form-item>
                    <el-form-item label="公司联系人">
                        {{ company.contactName }}
                    </el-form-item>
                    <el-form-item label="联系电话">
                        {{ company.contactTel }}
                    </el-form-item>
                </el-form>
            </div>
            <div style="width: 90%; display: inline-block; text-align: center; margin-top: 30px">
                <el-button
                    type="primary"
                    v-if="crowdtype == 'myApply' && task.status == 2"
                    @click="publishTask"
                    class="btn-yellow"
                    >修改并重新发布</el-button
                >
            </div>
        </div>
        <!-- v-show="task.status ==1" -->
        <crowdsource-task ref="crowdsourceTask"></crowdsource-task>
        <!-- 弹窗 -->
        <!-- 上传实施结果弹窗 -->
        <!-- 评价弹窗 -->
        <reviewDialogVue ref="reviewDialogVuer" @refresh="refreshFn"/>
        <!-- 任务结项弹窗 -->
        <acceptanceVue ref="acceptanceVue" @refresh="refreshFn"/>
        <!-- 支付 -->
        <payDialog ref="payDialog" @refresh="refreshFn"/>
        <!-- 不通过 -->
        <noPassDialog ref="noPassDialog" @refresh="refreshFn"/>
        <!-- 弹窗 -->
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getApply, getApplicant, assignTester, getById } from '@/api/crowdsource/crowdsource'
import { choseUserPost } from '@/api/crowdsource/crowdsourceNew'
import CrowdsourceTask from '../../common/CrowdsourceTask'
import { findByvalue, findLabelValueByProp } from '@/util/util'
import TesterDetail from './TesterDetail'
import { applicantlist, onsiteTypelist, processStatuslist } from '@/const/dict/commondict'
import mixin from '@/mixin/index.js'
import reviewDialogVue from '@/page/common/reviewDialog.vue'
import acceptanceVue from '@/page/common/acceptance.vue'
import payDialog from '@/page/common/payDialog.vue'
import noPassDialog from '@/page/common/noPassDialog.vue'
export default {
    mixins: [mixin],
    data() {
        return {
            resultOpen: false,
            loading: false,
            crowdtype: '', //类型
            id: '', //众包id
            applicantdataList: [], //竞标者名单
            userprogramme: {},
            total: '',
            pageNum: 1,
            pageSize: 10,
            task: {}, //任务详情
            company: {}, //公司信息
            publisher: {}, //
            onsiteTypelist, //驻场需求
            applicantlist, //竞标者要求
            processStatuslist, //任务状态
        }
    },
    components: { CrowdsourceTask, TesterDetail, acceptanceVue, payDialog, noPassDialog, reviewDialogVue },
    computed: {
        ...mapGetters(['testtypelist', 'feescopelist', 'token', 'userinform', 'userId']),
    },
    mounted() {
        this.id = this.$route.query.id
        this.crowdtype = this.$route.query.type
        this.getData()
        //  if(this.id){
        //     this.getmenber()
        //  }
    },
    methods: {
        refreshFn(){
            this.getData()
        },
        // 获取数据
        getData() {
            if (this.crowdtype == 'myApply') {
                getApply(this.id).then((response) => {
                    this.task = response.data
                    // 处理多文件
                    if (response.data.attachment) {
                        this.task.attachmentArr = response.data.attachment.split(',')
                    }
                    this.task.status = this.task.status + ''
                })
            } else {
                // 我发布的/我应征成功的  获取公司信息company
                getById(this.id, this.userId)
                    .then((response) => {
                        console.log(response)
                        if (response.task != null) this.task = response.task
                        // 处理多文件
                        if (response.task) {
                            this.task.attachmentArr = response.task.attachment.split(',')
                        }
                        if (response.company != null) this.company = response.company
                        if (response.publisher != null) this.publisher = response.publisher
                        if (response.user_plan) {
                            this.userprogramme = response.user_plan
                        }
                        if (response.entrants) {
                            this.applicantdataList = response.entrants
                            this.applicantdataList.forEach((it) => {
                                this.$set(it, 'isflag', false)
                            })
                        }
                    })
                    .catch((err) => {})
            }
        },
        // 任务结项
        goFinnal(payload) {
            this.$refs.acceptanceVue.dialogVisible = true
            this.$refs.acceptanceVue.rowInfo = payload
            this.$refs.acceptanceVue.taskId = this.task.task_id
        },
        // 支付
        goPay(payload) {
            this.$refs.payDialog.dialogVisible = true
            this.$refs.payDialog.rowInfo = payload
            this.$refs.payDialog.taskId = this.task.task_id
            this.$refs.payDialog.taskprice = this.task.price

        },
        // 不通过
        goNoPass(payload) {
            this.$refs.noPassDialog.dialogVisible = true
            this.$refs.noPassDialog.info = payload.remark
        },
        // 评价
        goreview(payload) {
             this.$refs.reviewDialogVuer.dialogVisible = true
             this.$refs.reviewDialogVuer.taskId = this.task.task_id
             this.$refs.reviewDialogVuer.appraisee = payload.user_id
        },
        // 多选用户
        choseUser() {
            const choseList = this.applicantdataList.filter((it) => it.isFlag)
            const needp = this.task.needPerson || this.task.need_person
            if (choseList.length < needp) {
                return this.$message.warning('您的选择小于需要人数')
            } else if (choseList.length > needp) {
                 return this.$message.warning('您的选择大于需要人数')
            } else {
                const data = {
                    taskId: this.task.task_id,
                    testerIds: choseList.map((it) => it.user_id),
                }
                choseUserPost(data).then((res) => {
                    this.$message.success('选中成功')
                    this.getData()
                })
            }
        },
        // 下载文件
        download(url) {
            window.location.href = url
        },
        findByvalue,
        findLabelValueByProp,
        // openurl(url){
        //     this.$message.success('下载成功')
        //     window.location.href=url
        // },
        // 竞标者名单
        getmenber() {
            getApplicant(this.id).then((response) => {
                this.applicantdataList = response.data
                this.userprogramme = this.applicantdataList.find((item) => this.userId == item.applicantId)
            })
        },
        backroute() {
            this.$router.go(-1)
        },
        //竞标者名单选中
        assignTester(userId) {
            this.$confirm('确认要将众包任务指定给该测试者吗?').then(() => {
                let param = {}
                param.testerId = userId
                param.taskId = this.task.task_id
                assignTester(param).then((response) => {
                    this.applicantList = response.data
                    this.task.process_status = response.task.processStatus
                    // this.getmenber()
                    this.$message.success('指定成功')
                    getById(this.id, this.userId)
                        .then((response) => {
                            if (response.entrants) {
                                this.applicantdataList = response.entrants
                            }
                        })
                        .catch((err) => {})
                })
            })
        },
        //竞标者名单查看详情
        viewTesterDetail(row) {
            // this.userId = userId;
            this.$refs.testerDetail.viewDetail(row, this.task.task_id)
        },
        // 修改重新发布
        publishTask() {
            this.$router.push(`/console/edittasks?applyId=${this.task.applyId}`)
            // this.$refs.crowdsourceTask.openDialog();
        },
        //关闭测试者详情
        closeDialog(isFresh) {
            if (isFresh) {
                // getApplicant(this.id).then(response => {
                //     this.applicantList = response.data;
                // })
                this.getmenber()
                getById(this.id).then((response) => {
                    this.task = response.task
                    this.$refs.taskInfo.setTask(this.task)
                })
            }
        },
        openurl(url) {
            if (url != '') {
                // var index = url.indexOf('https'); // 字符出现的位置
                // var num = 0; // 这个字符出现的次数
                // while(index !== -1) {
                //     num++; // 每出现一次 次数加一
                //     index = url.indexOf('https',index + 1); // 从字符串出现的位置的下一位置开始继续查找
                // }
                // if(num==1){
                //     this.$message.success('下载成功')
                //     window.location.href=url
                // }else{
                //     this.$message.success('下载成功')
                //     let uelt=url.slice(32*(num-1))
                //     window.location.href=uelt
                // }
                window.location.href = url
            }
        },
        //当前页码
        handleCurrentChange(val) {
            this.pageNum = val
            this.getList()
        },
    },
}
</script>
<style scoped>
.choseUserBtn {
    position: absolute;
    top: 0;
    right: 0;
    width: 105px;
    height: 32px;
    background: #2286fa;
    border-radius: 4px;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}
.crowdnum >>> .el-checkbox__label {
    padding-left: 3px;
}
.dvied {
    width: 4px;
    height: 18px;
    background: #0066eb;
}
.backbtn >>> .el-button {
    width: 80px;
    height: 36px;
    background: #0066eb;
    color: #ffffff;
    line-height: 35px;
    padding: 0 15px;
}
.crowdnum >>> .el-divider--horizontal {
    margin: 13px 0;
}
.taskd {
    color: #4d4d4d;
    display: flex;
    align-items: center;
}
.taskd p {
    margin: 0;
    text-align: left;
    font-size: 14px;
}
.taskd p:nth-child(1) {
    font-weight: bold;
    width: 100px;
}
.taskd p:nth-child(2) {
    width: 220px;
}
.crowdnum >>> .el-table th {
    background-color: #f7f7f7;
    color: #0e0c0c;
    text-align: center;
    border: none;
}
.crowdnum >>> .el-table td {
    /* text-align:center; */
    background-color: #ffffff;
    height: 60px;
    color: #666666;
    border: none;
}
.crowdnum >>> .el-table--border th {
    border-right: #f7f7f7;
}
.crowdnum >>> .el-table--border,
.el-table--group {
    border: none;
}
.crowdnum >>> .el-table th.el-table__cell.is-leaf {
    border-bottom: none;
}
.tabone {
    /* padding:3px; */
    color: #ffffff;
    background: #2286fa;
    border-radius: 3px;
    text-align: center;
    width: 75px;
    margin-right: 8px;
    line-height: 28px;
    height: 28px;
    font-size: 14px;
}
</style>