<template>
	<view class="lists">
		<view class="status_bar" :style="navHeight"></view>
		<view class="header-bg">
			<image class="header-bg-img" src="@/static/image/nav_bg@3x.png" mode="scaleToFill"></image>
		</view>
		<view class="main">
			<view class="middle view">
				<view class="text-block">
					<text class="middle-date">状态</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.statusName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">线索编号</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.id}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">匿名提报</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.submitMethodName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">违约类型</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.viloationTypeName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">细分类型</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.childTypeName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">事发渠道</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.happenChannelName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">取证地</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.supplyTypeName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">省份</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.provinceName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">城市</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.cityName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block" v-if="clueDetail.supplyType==='MARKET'">
					<text class="middle-date">市场名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.marketName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block" v-if="clueDetail.supplyType==='TERMINAL' || clueDetail.supplyType==='MARKET' ">
					<text class="middle-date">终端名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.terminalName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block" v-if="clueDetail.supplyType==='TERMINAL' || clueDetail.supplyType==='MARKET' ">
					<text class="middle-date">终端地址</text>
					<input class="middle-date-des" type="text" v-model="clueDetail.terminalAddress" placeholder="" />
				</view>
				<view class="text-block" v-if="clueDetail.supplyType==='PLATFORM'">
					<text class="middle-date">平台名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.platformName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block" v-if="clueDetail.supplyType==='PLATFORM'">
					<text class="middle-date">商家名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.storeName}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block" v-if="clueDetail.supplyType==='PLATFORM'">
					<text class="middle-date">网址</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.storeAddress}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">银行账户</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.salesAreaAccountPk}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">稽查时间</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<text class="uni-input">{{clueDetail.auditTime}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="text-block text-block-last">
					<text class="middle-date">稽查说明</text>
				</view>
				<view class="remark">
					<textarea class="remark-text" v-model="clueDetail.auditNotes" />
				</view>

			</view>

			<view class="middle view">
				<view class="text-block">
					<text class="middle-date">物流码行项目</text>
					<!-- <view class="middle-date-des middle-date-buttons">
						<button class="diy-entry" type="default" @click="handleScan">
							<image class="diy-icon" src="@/static/image/scan@3x.png" mode="">
							</image>
							<text class="diy-entry-text">扫码</text>
						</button>
						<button class="diy-entry" type="default" @click="addProductByBarcode">
							<image class="diy-icon" src="@/static/image/add@3x.png" mode="">
							</image>
							<text class="diy-entry-text">增加</text>
						</button>
						<button class="diy-entry" type="default" @click="deleteProductByBarcode">
							<image class="diy-icon" src="@/static/image/del@3x.png" mode="">
							</image>
							<text class="diy-entry-text">删除</text>
						</button>
					</view> -->
				</view>
			</view>

			<view class="middle view planout-block-item" v-for="(productByBarcode,index2) in clueDetail.entries"
				:key="index2">
				<view class="text-block">
					<text class="middle-date">产品名称</text>
					<text class="middle-date-des">{{productByBarcode.productName}}</text>
				</view>
				<view class="text-block">
					<text class="middle-date">物流码</text>
					<text class="middle-date-des">{{productByBarcode.barcode}}</text>
				</view>
				<view class="text-block">
					<text class="middle-date">出库时间</text>
					<text class="middle-date-des">{{productByBarcode.outboundTime}}</text>
				</view>
			</view>

			<view class="middle view planout-block-item">
				<view class="text-block">
					<text class="middle-date">收货金额(元)</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="clueDetail.receiveAmount"
									placeholder="请输入收货金额，保留2位小数" />
							</view>
						</view>
					</view>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">事发战区</text>
					<text class="middle-date-des">{{clueDetail.productDisSalesAreaName}}</text>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">事发基地</text>
					<text class="middle-date-des">{{clueDetail.productDisSubSalesAreaName}}</text>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">货源渠道</text>
					<text class="middle-date-des">{{clueDetail.productChannelName}}</text>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">货源经销商战区</text>
					<text class="middle-date-des">{{clueDetail.productDisSalesAreaName}}</text>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">货源经销商基地</text>
					<text class="middle-date-des">{{clueDetail.productDisSubSalesAreaName}}</text>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">货源经销商</text>
					<text class="middle-date-des">{{clueDetail.productDistributerName}}</text>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">货源经销商渠道经理</text>
					<text class="middle-date-des">{{clueDetail.productDisChaManagerName}}</text>
				</view>
			</view>

			<view class="middle view">
				<view class="upload-area view">
					<text class="title">门头照片</text>
					<view class="pic-lists">
						<image class="swiper-item-img" :src="clueDetail.doorPicUrl" mode="widthFix">
						</image>
					</view>
					<text class="des">(只能上传一次图片，多次上传至保留最后上传）</text>
				</view>
				<view class="upload-area view">
					<text class="title">产品照片</text>
					<view class="pic-lists">
						<image class="swiper-item-img" :src="clueDetail.productPicUrl" mode="widthFix">
						</image>
					</view>
					<text class="des">(只能上传一次图片，多次上传至保留最后上传）</text>
				</view>
				<view class="upload-area view">
					<text class="title">发票/收据照片</text>
					<view class="pic-lists">
						<image class="swiper-item-img" :src="clueDetail.receiptPicUrl" mode="widthFix">
						</image>
					</view>
					<text class="des">(只能上传一次图片，多次上传至保留最后上传）</text>
				</view>
			</view>


		</view>
		<view class="bottom-area"></view>
	</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'

	import {
		apiGetClueInfo,
	} from '@/servers/breakwords.js'

	export default {
		data() {
			return {
				condition: {
					id: ''
				},
				clueDetail: {},
			}
		},
		computed: {
			...mapState(['sysinfo']),
			navHeight() {
				return {
					'height': `${this.sysinfo.safeArea.top + 44}px`
				}
			},

		},
		onLoad(option) {
			console.log('breakwords-clue-detail', option)
			if (option && option.id) {
				this.condition.id = option.id
				this.getOrderDetail()
			}
		},
		methods: {
			async getOrderDetail() {
				uni.showLoading({
					title: '加载中'
				});
				setTimeout(function() {
					uni.hideLoading();
				}, 2000);
				const res = await apiGetClueInfo({
					id: this.condition.id
				})
				uni.hideLoading();
				for (let key in res.data) {
					this.$set(this.clueDetail, key, res.data[key])
					// this.clueDetail[key] = res.data[key]
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.view {
		display: flex;
		flex-direction: column;
	}

	.status_bar {
		height: var(--status-bar-height);
	}

	.header-bg {
		height: 284rpx;
		margin-top: -88rpx;
	}

	.header-bg-img {
		width: 100%;
	}

	.lists {
		position: relative;
		flex-direction: column;
		background: #f0f4f5;
	}

	.main {
		position: relative;
		overflow-y: scroll;
		flex-direction: column;
		margin-top: -164rpx;
		border-radius: 16rpx;
		padding: 0 16rpx;
	}

	.middle {
		background-color: #fff;
		border-radius: 16rpx;
		padding: 0 48rpx;
		margin-bottom: 32rpx;
	}

	.text-block {
		display: flex;
		overflow: hidden;
		height: 96rpx;
		border-bottom: 1px solid #f4f5f6;
	}

	.text-block-last {
		margin-bottom: 0;
		border-bottom: 0;
	}

	.no-border {
		border: 0;
	}

	.middle-date {
		flex: 3;
		font-size: 24rpx;
		line-height: 96rpx;
		color: #999;
		margin-bottom: 8rpx;
	}

	.middle-date-des {
		align-items: center;
		flex: 5.5;
		font-size: 24rpx;
		color: $text-base-color;
		height: 96rpx;
		line-height: 96rpx;
	}

	.uni-input-placeholder {
		color: #DBDBDB;
	}

	.picker-year {
		position: relative;
		align-items: center;
		// padding-left: 14rpx;
	}

	.uni-list-cell {
		flex: 1;
		height: 100%;
		padding-right: 52rpx;
	}

	.uni-list-cell-db {
		flex: 1;
		height: 100%;
	}

	.picker-block {
		flex: 1;
		height: 100%;
	}

	.icon-arrow {
		position: absolute;
		right: 22rpx;
		top: 40rpx;
		width: 7px;
		height: 10px;
		z-index: 10;
	}

	.icon-search {
		width: 11px;
		height: 12px;
		top: 36rpx;
	}

	.remark {
		margin-bottom: 24px;
	}

	.remark-text {
		flex: 1;
		height: 180rpx;
		background: #f5f6f7;
		font-size: 24rpx;
		border-radius: 4px;
		padding: 12rpx 18rpx;
	}


	.diy-entry {
		width: 140rpx;
		height: 68rpx;
		background: #f8f8f8;
		border-radius: 8px;
		line-height: 68rpx;
		border: 1px solid #f8f8f8;
		margin-left: 16rpx;
	}

	.diy-icon {
		width: 24rpx;
		height: 20rpx;
		margin-right: 8rpx;
	}

	.diy-entry-text {
		color: #333;
		font-size: 12px;
	}

	.planout-block-item {
		margin-top: 48rpx;
	}

	.upload-area {
		padding-top: 32rpx;
		padding-bottom: 32rpx;

		.title {
			font-size: 28rpx;
			color: #333;
			font-weight: 500;
		}

		.pic-lists {
			margin-top: 24rpx;
			margin-bottom: 20rpx;
		}

		.des {
			color: #1C84FF;
			font-size: 20rpx;
		}
	}



	.bottom-area {
		height: 140rpx;
		margin-top: 12rpx;
	}
</style>
