<template>
	<view v-if="crowddata" style="padding-bottom:70px;">
		<view class="schedule" style="padding:25rpx 0">
			<view style="margin:0 25rpx 36rpx 25rpx">
				<view style="display:flex;font-size:35rpx;font-weight:bold;justify-content: space-between;">
					<p style='color: #333333;'>{{crowddata.task.project_name}} </p>
					<p v-if="crowddata.task.price == 0" style="color:#FD461A;">面议</p>
					<p v-else style="color:#FD461A;">¥{{crowddata.task.price}}</p>
				</view>
				<view style="display:flex;margin-top:15px;flex-wrap: wrap;">
					<view class='tabone' style="width:50px;margin-right:8rpx">
						<span v-if="crowddata.task.task_status==0">竞标中</span>
						<span v-if="crowddata.task.task_status==1">竞标成功</span>
						<span v-if="crowddata.task.task_status==2">竞标失败</span>
					</view>
					<view class='tabone' style="min-width:60px;background: #E8EEF5;color:#525B65;margin-right: 8rpx;"
						v-for="itema in findLabelValueByPropnew(tasktypelist, crowddata.task.test_type, 'dictValue', 'dictLabel').split(',')">
						<span>
							{{itema}}
						</span>

						<!-- <span v-if="crowddata.task.test_type=='static'">静态测试</span>
						<span v-if="crowddata.task.test_type=='function'">功能测试</span>
						<span v-if="crowddata.task.test_type=='performance'">性能测试</span>
						<span v-if="crowddata.task.test_type=='security'">安全测试</span>
						<span v-if="crowddata.task.test_type=='configuration'">配置项测试</span>
						<span v-if="crowddata.task.test_type=='reliability'">可靠性测试</span>
						<span v-if="crowddata.task.test_type=='development'">研发任务</span>
						<span v-if="crowddata.task.test_type=='outsource'">用人任务</span>
						<span v-if="crowddata.task.test_type=='other'">其他</span> -->
					</view>
				</view>
			</view>
			<u-line></u-line>
			<view style="color:#808080;font-size: 24rpx;margin:36rpx 25rpx 0 25rpx">
				<p style='margin-bottom:10px'>发布日期：{{crowddata.task.create_time.slice(0,10)}}</p>
				<p style='margin-bottom:10px'>需要人数：{{crowddata.task.need_person}}人</p>
				<p style='margin-bottom:10px'>项目周期：{{crowddata.task.period}}天</p>
				<p style='margin-bottom:10px'>驻场需求：
					<span v-if="crowddata.task.onsite_type==0"> 无需驻场</span>
					<span v-if="crowddata.task.onsite_type==1"> 偶尔驻场</span>
					<span v-if="crowddata.task.onsite_type==2"> 定期驻场</span>
				</p>
				<p style='margin-bottom:10px'>技能要求：{{crowddata.task.tech_need}}</p>
				<p style='margin-bottom:10px'>地域要求：{{crowddata.task.area}}</p>
				<p style='margin-bottom:10px'>有效天数：{{crowddata.task.valid_days}}天</p>
				<!-- <p style='margin-bottom:10px'>竞标者要求：
					<span v-if='crowddata.task.applicant_type==0'>个人测试者</span>
					<span v-if='crowddata.task.applicant_type==1'>认证测试公司</span>
					<span v-if='crowddata.task.applicant_type==2'>个人测试者/认证测试公司</span>
				 </p> -->
				<!-- <p style='margin-bottom:10px'>需支持/适配的客户端：网站</p>
				 <p>合作倾向：希望与关键科技合作</p> -->
			</view>
		</view>
		<view class="schedule">
			<view style='display:flex;align-items: center;margin-bottom: 10px;'>
				<view class='vertical'></view>
				<view style="font-size: 15px;font-weight: bold;">需求描述</view>
			</view>
			<view v-if="crowddata.task.project_desc">
				<!-- <div class="article-body"  v-html='industryinform.content'></div>  -->
				<rich-text class="article-body"
					:nodes="crowddata.task&&crowddata.task.project_desc | filtersRichText"></rich-text>
			</view>
			<p v-else style="color:#808080;line-height:23px;font-size: 24rpx;white-space:pre-line;">无</p>
		</view>

		<view class="schedule">
			<view style='display:flex;align-items: center;margin-bottom: 10px;'>
				<view class='vertical'></view>
				<view style="font-size: 15px;font-weight: bold;">联系方式</view>
			</view>
			<view style="color:#808080;font-size: 24rpx; ">
				<p style='margin-bottom:10px'>联系人：{{crowddata.task.contact_name}}</p>
				<p style='margin-bottom:10px'>联系人：{{crowddata.task.contact_tel}}</p>
			</view>

		</view>

		<view class="schedule">
			<view style='display:flex;align-items: center;margin-bottom: 10px;'>
				<view class='vertical'></view>
				<view style="font-size: 15px;font-weight: bold;">附件</view>
			</view>
			<view style='margin-bottom: 10px;'>

				<!-- <div style='display:flex;align-items: center;margin-bottom: 10px;' v-if="crowddata.task.attachment&&crowddata.task.attachment.indexOf('/upload')>0">
					<img style="width:17px;height:20px;margin-right:5px;" src="/static/crowd/upload.png" alt="" />
					<p  @click="openurl(crowddata.task.attachment)" style="color:#1578ED;font-size: 12px;cursor: pointer;">项目附件</p>
				</div> -->
				<template v-if="crowddata.task.attachment">
					<div style='display:flex;align-items: center;margin-bottom: 10px;'
						v-for="(it,index) in crowddata.task.attachment.split(',')">
						<img style="width:17px;height:20px;margin-right:5px;" src="/static/crowd/upload.png" alt="" />
						<p @click="openurl(it)" style="color:#1578ED;font-size: 12px;cursor: pointer;">项目附件{{index+1}}
						</p>
					</div>
				</template>

				<!--  -->
				<p v-else style="color:#808080;font-size: 12px;">无</p>
				<!-- <p style="color:#1578ED;font-size: 12px;">项目附件.zip</p> -->
			</view>
		</view>
		<view class="schedule">
			<view style='display:flex;align-items: center;margin-bottom: 10px;'>
				<view class='vertical'></view>
				<view style="font-size: 15px;font-weight: bold;">报名列表</view>
			</view>
			<view v-if="crowddata.entrants.length>0" style="display: flex;flex-wrap: wrap;">
				<view v-for="(item,key) of crowddata.entrants" class="signst">
					<view v-if="item.avatar">
						<img v-if="item.avatar.indexOf('http')==0" :src="item.avatar" alt="">
						<img v-else :src="base+item.avatar" alt="" />
					</view>
					<!-- <img v-else src="https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132" alt="" /> -->
					<img style="margin-bottom: 4px;" v-else src="../../../static/crowd/defaultAva.jpg" alt="" />
					<p>{{item.nick_name.slice(0,1)}}**</p>
					<view class="success" v-if="item.status != 0 && item.status != 2">
						<image src="/static/index/success.png" mode=""></image>
						竞标成功
					</view>
					<view class="success1" v-else>
					</view>
				</view>
			</view>
			<view v-else style="color: #808080;font-size: 12px;">
				无
			</view>
			<!-- <img style="width:280px;height:50px;" src="/static/crowd/signlist.png" alt="" /> -->
		</view>
		<view class="schedule">
			<view style='display:flex;align-items: center;margin-bottom: 10px;'>
				<view class='vertical'></view>
				<view style="font-size: 15px;font-weight: bold;">发布者信息</view>
			</view>
			<view style='display:flex;align-items: center;margin-bottom:15px;'>
				<!-- <img style="width:50px;height:50px;margin-right:5px" src="/static/crowd/crowdlogo.png" alt="" /> -->
				<img style="width:50px;height:50px;margin-right:5px;border-radius: 50%;" :src="crowddata.task.avatar"
					alt="" @click="goCompanyInfo" />
				<view>
					<view style="display: flex;margin:5px 0;align-items: center;">
						<p style="color:#4D4D4D ; font-size:13px ;font-weight: bold;">{{crowddata.task.company_name}}
						</p>
						<!-- <img v-if="crowddata.task.email" style="width:15px;height:15px;margin:0 5px;" src="/static/crowd/email.png" alt="" />
						<img v-else style="width:15px;height:15px;margin:0 5px;" src="/static/crowd/noemail.png" alt="" /> -->
						<!-- <img @click="callingphone(crowddata.task.contact_tel)" v-if="crowddata.task.contact_tel" style="width:15px;height:15px;margin-left: 20rpx;" src="/static/crowd/phone.png" alt="" />
						<img v-else style="width:15px;height:15px;margin-left: 20rpx;" src="/static/crowd/nophone.png" alt="" /> -->
					</view>
					<p class="ratebox" style="color:#808080;font-size:12px;align-items: center;">
						<span>发包总数：</span>
						<span style="color:#1578ED;">{{crowddata.task.publish_task_count}}</span>
						<!-- <span style="color:#1578ED;">{{(crowddata.task.company_app_count + crowddata.task.personal_app_count) == 20 ? "已满":(crowddata.task.company_app_count + crowddata.task.personal_app_count)}}</span> -->
						<span style="margin:0 6px"> l </span>
						<block v-if="crowddata.task.commentsStar && crowddata.task.commentsStar != 0">
							<span> 评分：</span>
							<span style="color: #FA9C22;margin-right: 5rpx;">{{crowddata.task.commentsStar}}</span>
							<u-rate :current="crowddata.task.commentsStar" :disabled="true" active-color="#fa9c22"
								inactive-color="#CDCECE"></u-rate>
						</block>
						<span v-else>暂无评价</span>

					</p>
				</view>
			</view>
			<view style='margin-bottom:10px;font-size: 24rpx;'>
				<span style="color:#4D4D4D">公司简介：</span>
				<span style="color:#808080;line-height:23px;">{{crowddata.task.company_desc}}</span>
			</view>
		</view>
		<view v-if='type==1' class="schedule" style="margin: 12px 3vw 25px 3vw;">
			<view style='display:flex;align-items: center;margin-bottom: 10px;'>
				<view class='vertical'></view>
				<view style="font-size: 15px;font-weight: bold;">竞标方案</view>
			</view>
			<div v-if="userprogramme && userprogramme.period"
				style="font-size: 14px;text-align:left;color: #333333;margin:10px 0px;line-height:25px;">
				<p>竞标日期：{{userprogramme.apply_time?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>
		</view>
		<view class="submitt" v-if="crowddata.task.task_status == 0">
			<!-- style="letter-spacing：0.5rem" -->

			<view v-if='type==1' class="button-g"
				style="width:100%;margin-left:0;border-radius: 10px;background: #909399;">
				<p>已竞标</p>
			</view>
			<view v-else class="button-g" style="width:100%;margin-left:0;border-radius: 10px;" @click="application">
				<p>竞标报名</p>
			</view>
		</view>
		<view class="submitt" v-else>
			<!-- style="letter-spacing：0.5rem" -->

			<view class="button-g" style="width:100%;margin-left:0;border-radius: 10px;background: #A8Aeb6;">
				<p>报名结束</p>
			</view>
		</view>
		<u-popup v-model="isPopupShow" @close="close" @open="open" mode="bottom" length="80%" height='350px'
			border-radius="15" :closeable='true' :mask-close-able="false">
			<!-- <view class='peodi'>
		       <u-icon name="error-circle-fill" color="#FE5517" size="35"></u-icon>
			   <span class="poptext">确定要竞标此众包任务吗？</span>
		    </view> -->
			<view style="background:#66666;padding:20px 0px 30px 10px; ">
				<view class='peodi'>提交竞标方案</view>
				<u-line></u-line>
				<view class="sinput">
					<p style="color:#fa3534;margin-right:3px">* </p>
					<img src="/static/crowd/commny.png" alt="">
					<view style="display: flex;align-items: center;">
						<u-input v-model="biddingobj.period" placeholder='请输入预算周期' borrder="true" />
						<span style="margin-left:5px;">天</span>
					</view>

				</view>
				<view class="sinputrt">
					<p style="color:#fa3534;margin-right:3px">* </p>
					<img src="/static/crowd/like.png" alt="">
					<u-input v-model="biddingobj.competitionEdge" placeholder='请输入竞标优势...' type="textarea"
						auto-height="true" />
				</view>
				<!-- <view  class="sinput" style="align-items: baseline;margin:20px 0 50px 0;">
					<img  src="/static/crowd/fjupload.png" alt="">
					<u-upload ref="upload" width='100px' height='100px'
						 max-count="1"
						:action="action"
						:header="headers"
						:auto-upload="true"
						:custom-btn="true"
						:show-progress="false"
						:limitType='typeupload'
						:deletable="true"
						:file-list="biddingobj.attachment"
						@on-success="(data,index,lists) => {fielUploadSuc(data,index,lists) }"
						@on-remove="(index, lists, name)=>{deleteUpfile(index)}"
						@on-error="(data,index, lists)=>{errorUpfile(data,index, lists)}"
					>
						
						<view  slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							
							<view >
								<u-icon name="arrow-upward" color="#B3B3B3" size='40'></u-icon>
							</view>
						</view>
					</u-upload>
				</view> 
				<p style="margin:-83px 0 0 40px;color: #1578ED;" v-if="biddingobj.attachment">已上传</p>
				<p v-if="biddingobj.attachment==''" style="margin-left: 30px;">上传文件最大限 <span style="color: #F0AA2F;">20M</span> </p>
			-->
			</view>
			<!-- <u-line ></u-line> -->
			<view class="submitt" style="display: flex;justify-content: space-between;">
				<view class="button-g"
					style="width:43vw;background:#FFFFFF;border: 1px solid #D9D9D9;color: #666666;margin-left:0"
					@click="popcilk('cancel')">取消</view>
				<view @click="popcilk('determine')" class="button-g"
					style="width:43vw;background:linear-gradient(90deg, #5EA6FD, #1A81F9);color: #FFFFFF;margin-left:0">
					确定</view>
			</view>
		</u-popup>
		<u-toast ref="uToast" />
		<u-modal title='温馨提示' v-model="tokenshow" content="您还没有登录" confirm-text='现在就去' cancel-text='稍等一下'
			show-cancel-button='true' cancel-color='#1578ED' confirm-color='#1578ED' @confirm="confirmtt"
			@cancel='tokenshow=false'></u-modal>
		<u-modal v-model="totalshow" @confirm="taskconfirm" content='恭喜您竞标成功，请等待竞标结果通知。' ref="uModal" confirm-text='确定'
			:show-title='false'></u-modal>
		<u-modal title='提示' v-model="certifshow" @confirm="certifconfirm" content='未实名认证的用户无法报名,请先去个人中心做实名认证'
			ref="ucertif" confirm-text='去实名认证' :show-title='false'></u-modal>
		<!-- :async-close="true" -->

	</view>
</template>

<script>
	import {
		findLabelValueByPropnew
	} from '@/utils/util.js'
	import mixin from '@/utils/mixin/index.js'
	export default {
		mixins: [mixin],
		data() {
			return {
				base: this.http.baseUrl,
				certifshow: false,
				isPopupShow: false,
				crowddata: null,
				totalshow: false,
				tokenshow: false,
				biddingobj: {
					taskId: '',
					applicantId: '',
					period: '',
					competitionEdge: '',
					attachment: ''
				},
				typeupload: ['pdf', 'doc', 'docx', ],
				headers: {
					Authorization: 'Bearer ' + uni.getStorageSync('accessToken'),
				},
				action: 'https://www.keyitest.cn/prod-api/upload',


				//竞标者要求
				applicantlist: [{
						label: '个人测试者',
						value: '0'
					},
					{
						label: '认证测试公司',
						value: '1'
					},
					{
						label: '个人测试者/认证测试公司',
						value: '2'
					},
				],
				//驻场要求
				onsiteTypelist: [{
						label: '无需驻场',
						value: '0'
					},
					{
						label: '偶尔驻场',
						value: '1'
					},
					{
						label: '定期驻场',
						value: '2'
					},
				],
				//任务状态
				processStatuslist: [{
						label: '竞标中',
						value: 0
					},
					{
						label: '竞标成功',
						value: 1
					},
					{
						label: '待验收',
						value: 3
					},
					{
						label: '确认完成',
						value: 4
					},
					// {label: '没有竞标者，过期下架', value:4},
					// {label: '未指定测试者，过期下架', value:5},
					// {label: '未上传结果，过期下架', value:6},
					// {label: '未确认测试结果，过期下架', value:7},
					// {label: '测试结果不合格', value:8},
				],
				userinform: null,
				type: '',
				testerdata: {}, //实名认证信息
				userprogramme: {}, //当前用户竞标方案
			}
		},
		filters: {
			filtersRichText(html) { //控制小程序中图片大小
				if (html) {
					let newContent = html.replace(/<img[^>]*>/gi, (match, capture) => {
						match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
						match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
						match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
						return match;
					});
					newContent = newContent.replace(/style="[^"]+"/gi, (match, capture) => {
						match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
							'max-width:100%;');
						return match;
					});
					// let newContentsss = html.replace(/<span[^>]*>/gi, (match, capture)=>{
					// 	console.log('sss---',match, capture)
					// 	if(capture==12428 || capture==12693){
					// 		match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
					// 		match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
					// 		match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
					// 	}
					// 	return match;
					// });
					newContent = newContent.replace(/<br[^>]*\/>/gi, '');
					newContent = newContent.replace(/\<img/gi,
						'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
					// newContentsss = newContentsss.replace(/\<span/gi,
					// 	'<span style="word-wrap:break-word;width:90vw;display:block;margin:10rpx auto;"');newContentsss;
					return newContent;
				}
			}
		},
		onShow() {
			let Token = uni.getStorageSync('accessToken');
			this.userinform = uni.getStorageSync('wxUserInfo');
			if (Token && this.userinform) {
				console.log('this.userinform---', this.userinform)
				this.http.quickGet(`/tester/cert/apply/${this.userinform.userId}`, true).then(res => {
					console.log('实名认证信息onShow---', res)
					if (res.data.code == 200) {
						this.testerdata = res.data.data
					}
				})
			}
		},
		onLoad(options) {
			this.type = options.type;
			if (this.type && this.type == 1) {
				uni.setNavigationBarTitle({
					title: '我的众包'
				});

			} else {
				uni.setNavigationBarTitle({
					title: '任务详情'
				});
			}
			this.userinform = uni.getStorageSync('wxUserInfo');
			// if(this.userinform){				
			// 	this.http.quickGet(`/crowdsource/applicant/${options.id}`,true).then(res=>{
			// 		console.log('当前任务的竞标列表---',res)
			// 		if(res.data.data.length>0){
			// 			let testerdata=res.data.data
			// 			console.log('testerdata---',testerdata)
			// 			this.userprogramme=testerdata.find(item=>this.userinform.userId==item.applicantId)
			// 			console.log('当前用户竞标方案---',this.userprogramme)
			// 		}
			// 	})
			// }
			const url = this.userinform && this.userinform.userId ? `?userId=${this.userinform.userId}` : ''
			this.http.quickGet(`/crowdsource/detail/${options.id}${url}`, false).then(res => {
				this.crowddata = res.data;
				this.userprogramme = res.data.user_plan ? res.data.user_plan : {}
				let currentis = null
				if (this.crowddata.entrants.length > 0) {
					this.crowddata.entrants.forEach(item => {
						if (this.userinform.userId == item.user_id) {
							currentis = item
						}
					})
				}
				console.log('众包详情', res.data)
				if (currentis) {
					// console.log('currentis---',currentis)
					this.type = 1
				}


			})
			this.userinform = uni.getStorageSync('wxUserInfo');
			if (this.userinform) {
				this.http.quickGet(`/tester/cert/apply/${this.userinform.userId}`, true).then(res => {
					if (res.data.code == 200) {
						this.testerdata = res.data.data
					}
				})
			}
		},
		methods: {
			findLabelValueByPropnew,
			// 公司主页
			goCompanyInfo() {
				uni.navigateTo({
					url: `/pages/index/testcrowdsourc/companyInfo?taskInfo=${encodeURIComponent(JSON.stringify(this.crowddata.task))}`
				})
			},
			//文件上传成功回调
			fielUploadSuc(data, index, lists) {
				console.log('-', data, '*', index, lists)
				if (data.code === 200) {
					this.biddingobj.attachment = data.filePath
					console.log('竞标附件', this.biddingobj.attachment)
				}
			},
			//移除
			deleteUpfile(index, lists) {
				console.log('del头像', this.biddingobj.attachment)
				this.biddingobj.attachment = ''

			},
			errorUpfile(data, index) {

			},
			application() {
				this.userinform = uni.getStorageSync('wxUserInfo');
				let accessToken = uni.getStorageSync('accessToken');
				console.log('open', this.userinform, this.crowddata.task);
				if (!accessToken) {
					this.tokenshow = true
				} else {
					this.http.quickGet(`/tester/cert/apply/${this.userinform.userId}`, true).then(res => {
						// console.log('竞标实名认证信息---',res)
						if (res.data.code == 200) {
							if (res.data.data.applyId) {
								if (res.data.data.status == 1) {
									this.isPopupShow = true
									this.biddingobj = {
										taskId: '',
										applicantId: '',
										period: '',
										competitionEdge: '',
										attachment: ''
									}
								} else {
									this.certifshow = true;
								}
							} else {
								this.certifshow = true;
							}
							if (res.data.data.companyApplyId) {
								uni.showToast({
									title: '仅支持个人用户竞标报名',
									icon: 'none',
									duration: 2000
								});
							}


							// this.testerdata = res.data.data
							// if (parseInt(this.userinform.userId) == this.crowddata.task.publisher_id) {
							// 	uni.showToast({
							// 		title: '您是发布者，无法竞标自己发布的任务。',
							// 		icon: 'warning',
							// 		duration: 2000
							// 	});
							// 	return;
							// }
							// console.log('testerdata.status---', this.testerdata)
							// if (this.testerdata) {
							// 	if (this.testerdata.status != 1) { //不是测试者或认证尚未成功
							// 		this.certifshow = true;
							// 	} else {
							// 		if (this.crowddata.task.applicant_type != 2) { //2是个人测试者或企业测试都都可以
							// 			if (this.crowddata.task.applicant_type == 0) { //要求个人测试者
							// 				if (this.userinform.companyStatus != 0) {
							// 					uni.showToast({
							// 						title: '您是认证测试公司或正在申请成为认证测试公司，无法认证该任务，该任务只允许个人测试者竞标。',
							// 						icon: 'none',
							// 						duration: 1000
							// 					});
							// 					return;
							// 				}
							// 			} else { //要求企业测试者
							// 				if (this.userinform.companyStatus != 2) {
							// 					uni.showToast({
							// 						title: '对不起，您是个人测试者，该任务只允许认证测试公司竞标。',
							// 						icon: 'none',
							// 						duration: 3000
							// 					});
							// 					return;
							// 				}
							// 			}
							// 		}
							// 		this.isPopupShow = true
							// 		this.biddingobj = {
							// 			taskId: '',
							// 			applicantId: '',
							// 			period: '',
							// 			competitionEdge: '',
							// 			attachment: ''
							// 		}
							// 	}
							// } else {
							// 	this.certifshow = true;
							// }

						}
					})

				}
			},
			open() {
				// console.log('open');
			},
			close() {
				this.isPopupShow = false
				// console.log('close');
			},
			confirmtt() {
				uni.navigateTo({
					url: '/pages/personal/login'
				})
			},
			taskconfirm() {
				// setTimeout(() => {
				// 3秒后自动关闭
				// this.totalshow = false;
				// 如果不想关闭，而单是清除loading状态，需要通过ref手动调用方法
				// this.$refs.uModal.clearLoading();
				uni.navigateTo({
					url: '/pages/personal/mycrowdtest/mycrowdtest'
				})
				// }, 1000)
			},
			//竞标时没有认证的让跳去认证
			certifconfirm() {
				this.certifshow = false;
				uni.navigateTo({
					url: '/pages/personal/setup/certification'
				})
			},
			popcilk(type) {
				if (type == 'cancel') {
					this.isPopupShow = false
				} else if (type == 'determine') {
					let attachment = '';
					console.log('附件', this.biddingobj.attachment)
					if (this.biddingobj.attachment.indexOf('https') == 0) {
						attachment = this.biddingobj.attachment
					} else {
						if (this.biddingobj.attachment == '') {
							attachment = ''
						} else {
							attachment = 'https://www.keyitest.cn/prod-api' + this.biddingobj.attachment
						}
					}
					if (!this.biddingobj.period) {
						this.$refs.uToast.show({
							title: '请输入预算周期',
							type: 'info'
						})
						return;
					}
					if (!/^[1-9]\d*$/.test(this.biddingobj.period)) {
						this.$refs.uToast.show({
							title: '周期需填写正整数',
							type: 'info'
						})
						return;
					}
					if (this.biddingobj.period > 1000) {
						this.$refs.uToast.show({
							title: '周期最多为1000天',
							type: 'info'
						})
						return;
					}
					if (!this.biddingobj.competitionEdge) {
						this.$refs.uToast.show({
							title: '请输入竞标优势',
							type: 'info'
						})
						return;
					}
					if (this.biddingobj.competitionEdge.length > 2800) {
						this.$refs.uToast.show({
							title: '最多输入2800字',
							type: 'info'
						})
						return;
					}
					let data = {
						taskId: this.crowddata.task.task_id,
						applicantId: this.userinform.userId,
						period: parseInt(this.biddingobj.period),
						competitionEdge: this.biddingobj.competitionEdge,
						attachment,
					}
					console.log('竞标数据', data)
					// return;
					this.http.quickPost(`/crowdsource/bidding`, data, true).then(res => {
						console.log('竞标结果', res)
						// return;
						this.isPopupShow = false
						if (res.data.data.code == 200) {
							this.totalshow = true
							// this.$refs.uToast.show({ title: '竞标成功', type: 'success'})
						} else {
							this.$refs.uToast.show({
								title: res.data.msg,
								type: 'info'
							})
						}

						// let reuse=parseInt(res.data.data)
						// console.log('竞标结果',res.data.data,typeof(res.data.data),typeof(reuse))
						// if(reuse){
						// 	if(reuse==1){
						// 		this.$refs.uToast.show({
						// 			title: "该任务竞标者人数已满。",
						// 			type: 'warning',
						// 			duration: 2000,
						// 		})
						// 	}else{
						// 		this.totalshow=true
						// 	}
						// }else{
						// 	if(reuse==0){
						// 		this.totalshow=true
						// 	}
						// }
					})
				}
			},
			// 拨打电话
			callingphone(phone) {
				uni.makePhoneCall({
					// 手机号
					phoneNumber: phone,
					// 成功回调
					success: (res) => {
						console.log('调用成功!')
						// uni.showToast({
						//     title: '拨打成功'
						// })
					},

					// 失败回调
					fail: (res) => {
						console.log('调用失败!')
					}
				});
			},
			openurl(url) {
				// uni.downloadFile({
				// 	url:url, //仅为示例，并非真实的资源
				// 	success: (res) => {
				// 		if (res.statusCode === 200) {
				// 			console.log('下载成功');
				// 		}
				// 	}
				// });
				// return;
				if (url != '') {
					// console.log('999---',url,url.lastIndexOf('https'),url.slice(32))
					var index = url.indexOf('https'); // 字符出现的位置
					var num = 0; // 这个字符出现的次数
					while (index !== -1) {
						// console.log(index); // 打印字符串出现的位置
						num++; // 每出现一次 次数加一
						index = url.indexOf('https', index + 1); // 从字符串出现的位置的下一位置开始继续查找
					}
					if (num == 1) {
						// this.$message.success('下载成功')
						// var wxFile = uni.getFileSystemManager()
						uni.downloadFile({
							url, //仅为示例，并非真实的资源
							success: (res) => {
								if (res.statusCode === 200) {
									// wxFile.saveFile({
									// 	tempFilePath:filePaths,
									// 	//将该文件从临时路径tempFilePath转移到本地文件filePath中，并重新给他起一个文件名
									// 	filePath:`${wx.env.USER_DATA_PATH}/a.docx`,
									// })

									uni.openDocument({
										showMenu: true,
										filePath: res.tempFilePath,
										success: function(res) {
											console.log('打开文档成功');
										}
									});
								}
							}
						});
					} else {
						console.log('num2---', url.slice(32 * (num - 1)))
						// this.$message.success('下载成功')
						let uelt = url.slice(32 * (num - 1))
						// window.location.href=uelt
						uni.downloadFile({
							url: url, //仅为示例，并非真实的资源
							success: (res) => {

								if (res.statusCode === 200) {
									// console.log('下载成功');
									uni.openDocument({
										showMenu: true,
										filePath: res.tempFilePath,
										success: function(res) {
											console.log('打开文档成功');
										}
									});
								}
							}
						});
					}



				}
			},
		}
	}
</script>

<style>
	.ratebox ::v-deep .u-icon {
		font-size: 13px !important;
	}

	.logobg {
		width: 100vw;
		object-fit: contain;
	}

	.schedule {
		width: 94vw;
		margin: 12px 3vw;
		background: #FFFFFF;
		padding: 25rpx;
		border-radius: 10rpx;
	}

	.tabone {
		padding: 6rpx;
		color: #FFFFFF;
		background: #2286FA;
		border-radius: 5rpx;
		font-size: 20rpx;
		text-align: center;
		margin-bottom: 10rpx;
	}

	.vertical {
		width: 6rpx;
		height: 26rpx;
		background: #1578ED;
		border-radius: 10rpx;
		margin-right: 5px;
	}


	.submitt {
		height: 70px;
		font-size: 20px;
		background: #FFFFFF;
		box-shadow: -4px 7px 18px 0px rgba(248, 164, 54, 0.33);
		position: fixed;
		bottom: 0;
		width: 100vw;
		padding: 10px 20px;

	}

	.success {
		width: 130rpx;
		height: 40rpx;
		background: #21B96C;
		border-radius: 22rpx;
		font-weight: 500;
		font-size: 22rpx;
		color: #FFFFFF;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.success image {
		width: 20rpx;
		height: 20rpx;
	}

	.success1 {
		width: 130rpx;
		height: 40rpx;
	}

	.button-g {
		width: 280rpx;
		height: 80rpx;
		background: linear-gradient(90deg, #5EA6FD, #1A81F9);
		border-radius: 43rpx;
		text-align: center;
		line-height: 80rpx;
		color: #FFFFFF;
		font-size: 33rpx;
		margin-left: 13px;
	}

	/* line-height: 15%; */
	.peodi {
		/* line-height: 15%; */
		margin: 5px auto 15px;
		width: 260px;
		text-align: center;
		color: #1A1A1A;
		font-size: 36rpx;
		font-weight: bold;
	}

	.poptext {
		font-size: 33rpx;
		font-weight: 500;
		color: #333333;
		line-height: 24rpx;
		margin-left: 5px;
	}

	.signst {
		display: flex;
		flex-direction: column;
		align-items: center;
		margin: 5px;
	}

	.signst img {
		width: 40px;
		height: 40px;
		border-radius: 50%;
	}

	.signst p {
		font-size: 11px;
		margin-top: 5px;
	}

	.article-body {
		line-height: 26px !important;
		/* width: 100%; */
		/* color:rgb(17, 16, 16)!important; */
	}

	.article-body p {
		font-size: 34rpx !important;
		color: #666666 !important;
		line-height: 35rpx !important;
		background-color: transparent !important;
	}

	.article-body>>>span {
		font-size: 34rpx !important;
		color: #666666 !important;
		line-height: 35rpx !important;
		background-color: transparent !important;
	}

	.sinput {
		display: flex;
		align-items: center;
		height: 50px;
		padding: 10px 0;
		margin: 10px 0 0 0;
	}

	.sinput img {
		width: 20px;
		height: 20px;
		margin-right: 10px;
	}

	.sinput .u-input {
		width: 75vw;
		height: 35px;
		border: 1px solid #E6E6E6;
		background: #FFFFFF;
		border-radius: 10rpx 10rpx 0rpx 0rpx;
		padding: 0 10px !important;

	}

	.sinputrt {
		display: flex;
		/* align-items: center; */
		height: 50px;
		padding: 10px 0;
		margin: 0px 0 70px 0;
	}

	.sinputrt img {
		width: 20px;
		height: 20px;
		margin-right: 10px;
	}

	.sinputrt .u-input {
		width: 75vw;
		height: 100px;
		border: 1px solid #E6E6E6;
		background: #FFFFFF;
		border-radius: 10rpx 10rpx 0rpx 0rpx;
		padding-left: 10px !important;
	}

	.slot-btn {
		/* width:75vw;
		height: 45px;
		display: flex;
		justify-content: center;
		align-items: center;
		background: rgb(244, 245, 246);
		border-radius: 10rpx;
		border: 1px solid #C2C2C2;
		zIndex:99; */
		width: 80px;
		height: 80px;
		background: #FFFFFF;
		border-radius: 4rpx;
		border: 1px solid #E6E6E6;
		line-height: 80px;
		text-align: center;
	}

	.slot-btn__hover {
		background-color: rgb(235, 236, 238);
	}

	.u-list-item {
		margin: 0 !important;
		background: transparent !important;
		color: #000000 !important;
		width: 100px !important;
		height: 28px !important;
		zIndex: 0 !important;
		border-radius: 0 !important;
		border: none !important;
	}


	/* .u-list-item :before {
	  content: "已上传";
	  position: absolute;
	  left: 7px;
	} */
</style>