<template>
	<view class="content">
		<view class="content-matter" v-for="(v,index) in 20" @click="jump" :key="index">
			<view class="content-matter-lampwick">
				<view class="content-matter-lampwick-lampw">
					<view :class="subscript == '1' ? 'only-bg-red' : 'common-bg'" class=""></view>
					<view class="">灯泡灯芯坏了</view>
				</view>
				<view class="content-matter-lampwick-wick">
					维修时间：2023-02-23
				</view>
			</view>

			<view class="content-matter-substance">
				<image src="../../../static/logo.png" mode=""></image>
				<view class="">
					<view class="">
						说明：有一个字不是特别亮，希望换一盏灯希望换一盏灯希望换一盏灯
					</view>
					<!-- // 已发布 -->
					<view class="buttoncolor" v-if="subscript == '0'">
						<button class="buttoncl" @click.stop="modify">修改</button>
						<button class="buttonclde" @click.stop="abolish(1)">取消订单</button>
					</view>
					<!-- // 已驳回 -->
					<view class="d-flex a-end j-sb" v-if="subscript == '1'">
						<view class="reject flex-1 hiddenMore" >
							驳回理由：没有明确问题描述没有明确问题描述没有明确问题描述没有明确问题描述
						</view>
						<button @click.stop="handleAgainAdd" class="buttoncl" style="margin-left: 20rpx;">重新发布</button>
					</view>
					
					<!-- // 待支付 -->
					<view class="unpaid" v-if="subscript == '2'">
						<view class="unpaid-paid">
							<view class="">
								已沟通审核通过，待支付<text>300元</text>
							</view>
							<view class="">
								截止1小时内支付完成<text>00:59:42</text>
							</view>
						</view>
						<view class="" @click.stop="payment">
							<button class="buttoncl">支付</button>
						</view>
					</view>
					<!-- // 已接单 -->
					<view class="buttoncolor" v-if="subscript == '3'">
						<button class="buttoncl" @click.stop="abolish(2)">退款</button>
						<button class="buttonclde" @click.stop="abolish(3)">详情</button>
						<button class="buttonclde" @click.stop="abolish(4)">已退款</button>
					</view>
				</view>
			</view>
		</view>
		<compopover :show="show" :title="title" :titbut="titbut" @aindex="aindex" @aindexst="aindexst"></compopover>
	</view>
</template>

<script>
	import apiBaseConfig from '@/config/index.js';
	import compopover from '@/components/popover/aIndex.vue'
	export default {
		props: {
			subscript: {
				type: String,
			}
		},
		components: {
			compopover
		},
		data() {
			return {
				imgBgUrl: apiBaseConfig.imgBgUrl,
				globalData: getApp().globalData,
				show: false,
				title: '确认取消订单吗',
				titbut: '取消订单'

			}
		},
		onLoad() {

		},
		methods: {
			// 跳转详情页
			jump() {
				this.$uniGo.navigateTo({
					url: `/demand/index/index?subscript=${this.subscript}`
				});
			},
			// 跳转支付界面
			payment() {
				this.$uniGo.navigateTo({
					url: `/demand/payment/index`
				});
			},
			// 取消订单1 立即退款2
			abolish(val) {
				if (val == 1) {
					this.title = '确认取消订单吗'
					this.titbut = '1'
					this.show = true
				} else if(val == 2){
					this.title = '确认提交退款申请吗'
					this.titbut = '2'
					this.show = true
				}else if(val == 3){
					this.$uniGo.navigateTo({
						url: `/demand/index/index?subscript=${this.subscript}&subs=${'1'}`
					});
				}else if(val == 4){
					this.$uniGo.navigateTo({
						url: `/demand/index/index?subscript=${this.subscript}&subs=${'2'}`
					});
				}
			},
			//重新发布按钮事件
			handleAgainAdd(){
				let that = this
				that.$uniGo.navigateTo({
					url:`/demand/updateForm/updateForm`
				})
			},
			// 再看看
			aindex(){
				this.show = false
			},
			// 取消订单2 立即退款3
			aindexst(val){
				// console.log(val)
				this.show = false
			}
		}
	}
</script>
<style>
	page {
		background-color: #f3f4f6;
	}
</style>
<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		justify-content: center;

		&-matter {
			margin: 28rpx 20rpx 50rpx;
			margin-top: 20rpx;
			background: #fff;
			padding: 20rpx;
			border-radius: 8rpx;

			&-lampwick {
				display: flex;
				justify-content: space-between;

				&-lampw {
					display: flex;

					>view:nth-child(1) {
						width: 6rpx;
						height: 36rpx;
						border-radius: 3rpx;
						margin-right: 10rpx;
					}
					.common-bg{
						background: #2C66FF;
					}
					.only-bg-red{
						background: #FD0000;
					}

					>view:nth-child(2) {
						font-size: 28rpx;
						color: #333333;
					}
				}

				&-wick {
					font-size: 20rpx;
					color: #333333;
				}
			}

			&-substance {
				margin-top: 16rpx;
				display: flex;

				>image {
					width: 170rpx;
					height: 170rpx;
					margin-right: 20rpx;
				}

				>view {
					width: 480rpx;
					margin-top: 14rpx;

					>view:nth-child(1) {
						font-size: 24rpx;
						color: #444444;
					}


				}
			}
		}

	}

	.buttoncolor {
		display: flex;
		margin-top: 40rpx;
		justify-content: flex-end;
	}

	.buttoncl {
		padding: 0rpx;
		margin: 0rpx;
		width: 120rpx;
		height: 44rpx;
		background: #5281FF;
		border-radius: 10rpx;
		line-height: 44rpx;
		font-size: 20rpx;
		font-weight: 400;
		color: #FFFFFF;
		margin-right: 20rpx;
	}

	.buttonclde {
		padding: 0rpx;
		margin: 0rpx;
		width: 120rpx;
		height: 44rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		border: 1rpx solid #FD0100;
		font-size: 20rpx;
		font-weight: 400;
		color: #FD0100;
		line-height: 44rpx;
	}

	.reject {
		margin-top: 20rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #FD0000;
		line-height: 33rpx;
		letter-spacing: 3rpx;
	}

	.unpaid {
		display: flex;
		align-items: center;
		margin-top: 24rpx;
		justify-content: space-between;

		&-paid {

			>view:nth-child(1) {
				font-size: 20rpx;
				font-weight: 400;
				color: #444444;
				margin-bottom: 8rpx;

				>text {
					margin-left: 8rpx;
					font-size: 24rpx;
					font-weight: 700;
					color: #333333;
				}
			}

			>view:nth-child(2) {
				font-size: 18rpx;
				font-weight: 400;
				color: #333333;

				>text {
					margin-left: 8rpx;
					font-size: 18rpx;
					font-weight: 400;
					color: #FD0100;
				}
			}
		}
	}
</style>
