<template>
	<view :class="[AppTheme]" class="subrecord">
		<view>
			<view class="notes-con">
				<view class="total-share">
					<view class="ts-left">
						<view class="ts-h">

							<view class="detail">
								<view class="ts-bg bg-primary">
									<text class="all-p text-primary">农场认养</text>
								</view>
								<view class="detail_ani">
									
									<view class="num">{{ detailInfo.lefttime || 0 }}</view>
									<view class="sam zi">期限(天)</view>
								</view>
								<view class="detail_ani">
									<view>
										{{ detailInfo.goods.bonusway || '' }}
									</view>
									<view class="sam zi">认养收获</view>
								</view>
							</view>
						</view>
						<view class="ts-f">
							<view>
								
								<view class="num">
									{{ detailInfo.goods.copies_price || 0 }}
								</view>
								<view class="sam zi">
									元/{{detailInfo.goods.unit}}
								</view>
							</view>
							<view>
								<view class="num">{{ detailInfo.totalnum || 0 }}</view>
								<view class="sam zi">数量</view>
							</view>
							<view>
								<view class="num">
									{{ detailInfo.payprice || 0 }}
								</view>
								<view class="sam zi">
									金额(元)</view>
							</view>

						</view>
					</view>
					<view class="ts-right">
						<view></view>
						<view class="abso border-primary">
							<image :src="settingFile.root_img+'/static/app/imgs/mine/17.png'" mode="" />
							<view class="now  text-explain" v-if="detailInfo.status == 0">已取消</view>
							<view class="now  text-neutral" v-if="detailInfo.status == 1" @click="goPay(detailInfo.id)">
								去付款</view>
							<view class="now  text-primary" v-if="detailInfo.status ==2 ">认养中</view>
							<view class="now  text-explain" v-if="detailInfo.status ==3 ">已完成</view>
							<view class="now" v-if="detailInfo.status ==4 ">已发货</view>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="detail-c">
			<view class="mb20" style="display: flex;">
				<text class="mr10">认养产品 :</text>
				<text v-if="detailInfo.goods&&detailInfo.goods.name"
					style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">
					{{ detailInfo.goods.name }}
				</text>
			</view>
			<view class="mb20">
				<text class="mr10">订单号 :</text>
				<text>{{ detailInfo.oid }}</text>
			</view>
			<view class="mb20">
				<text class="mr10">开始时间 :</text>
				<text>{{ detailInfo.paytime || 0 }}</text>
			</view>
			<view class="mb20">
				<text class="mr10">现在时间 :</text>
				<text>{{ detailInfo.now || 0 }}</text>
			</view>
			<view class="mb20">
				<text class="mr10">认养周期 :</text>
				<text>{{ detailInfo.lefttime }}天</text>
				<text class="ml10">已过天数 :</text>
				<text>{{ detailInfo.past }}天</text>
				<text class="ml10">剩余天数 :</text>
				<text>{{ detailInfo.lefttime - detailInfo.past }}天</text>
			</view>
			<view class="peisong">
				<view class="mb20 flex">
					<text>预期配送:{{ detailInfo.qinum||0}}次</text>
				</view>
				<view class="mb20 flex">
					<text>
						已配送:
						<text style="color: #f26214;">{{ detailInfo.ypsnum||0 }}</text>
						次
					</text>
				</view>
				<view class="mb20" v-for="(item,index) in log" :key="index"><text class="mr10">订单进度:
						{{ $u.timeFormat(item.ctime,fmt = 'yyyy/mm/dd hh:MM:ss')  || 0 }} {{ item.msg }}</text></view>
			</view>
		</view>
	</view>
</template>

<script>
	import mineApi from '@/api/mine/index.js';
	export default {
		data() {
			return {
				primary: this.$theme.primary,
				settingFile: getApp().globalData.siteinfo,
				p: 1,
				detailInfo: {},
				name: '上拉加载更多',
				nowTime: 0,
				id: 0,
				log: [],
			};
		},
		onLoad(options) {
			this.id = options.id;

		},
		methods: {
			goPay(index) {
				uni.navigateTo({
					url: `/pagesC/pages/index/farmorder/farmorder?id=${index}`
				});
			},
			goContract(no) {
				this.$u.route('/pagesA/pages/contracts/contract_info', {
					no
				});
			},
			getJiLu() {
				mineApi
					.orderDetail({
						orderid: this.id
					})
					.then(res => {
						this.detailInfo = res.data.cache;
						console.log(this.detailInfo, "this.detailInfo")
						this.log = res.data.log;
					});
			}
		},
		mounted() {
			this.getJiLu();
		}
	};
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100%;
	}

	.subrecord {
		width: 100%;
		min-height: 100%;
		padding-top: 0.1rpx;
		background: #f1f1f1;
		position: relative;

		.notes-con {
			height: 240rpx;
			width: calc(100% - 40rpx);
			margin: 0 auto;
			border-radius: 20rpx;
			background-color: #ffffff;

			.total-share {
				height: 240rpx;
				width: 100%;
				display: flex;
				justify-content: flex-start;
				margin: 20rpx auto;
			}

			.ts-left {
				margin-top: 16rpx;
				margin-left: 20rpx;
				/*float: left;*/
			}

			.total-share .ts-h,
			.ts-f {
				width: 472rpx;
			}

			.ts-f {
				margin-top: -14rpx;
			}

			.total-share .ts-h {
				height: 70rpx;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				margin-bottom: 50rpx;
				margin-top: 10rpx;
				align-items: center;
			}

			.total-share .ts-h .ts-bg {
				width: 74rpx;
				height: 70rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 16rpx;
				background-size: 100%;
				margin-right: 16rpx;
				text-align: center;
			}

			.total-share .ts-h .all-p {
				font-size: 20rpx;
				font-family: PingFang SC;
				font-weight: 800;
				color: rgba(255, 255, 255, 1);
				letter-spacing: 6rpx;
				margin-left: 5rpx;
				margin-top: -8rpx;
				margin-left: 5rpx;
			}

			.total-share .ts-h .expect {
				display: inline-block;
				width: 360rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				-o-text-overflow: ellipsis;
				white-space: nowrap;
				font-size: 31rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(0, 0, 0, 1);
			}

			.detail {
				display: flex;
				flex: 1;
				justify-content: space-between;

				.detail_ani {
					text-align: center;

					.sam {
						text-align: center;
						font-size: 22rpx;
						color: #bababa;
					}

					.zi {
						margin-top: 15rpx;
					}
				}

				.detail_ani.overflowl {
					width: 65%;
					overflow: hidden;
					text-overflow: ellipsis;

					.ellipsis {
						white-space: nowrap;
						/*强制在一行显示*/
						text-overflow: ellipsis;
						/*设置超出内容显示...*/
						overflow: hidden;
					}
				}
			}

			.ts-f {
				display: flex;
				justify-content: space-between;
				align-items: center;
			}

			.ts-f .red-pre {
				text-align: center;
				top: 14rpx;
				font-weight: 800;
				font-size: 30rpx;
			}

			.ts-f .num {
				position: relative;
				top: 14rpx;
				font-size: 30rpx;
				font-weight: 800;
				text-align: center;
			}

			.ts-f .sam {
				text-align: center;
				font-size: 22rpx;
				color: #bababa;
			}

			.ts-f .sam.zi {
				margin-top: 24rpx;
			}

			.ts-right {
				margin-left: 10rpx;
				position: relative;
				margin-top: 40rpx;
			}

			.ts-right .abso {
				width: 140rpx;
				height: 140rpx;
				position: absolute;
				font-size: 24rpx;
				left: 46rpx;
				border-width: 4rpx;
				border-style: solid;
				border-radius: 50%;
				text-align: center;
				padding-top: 26rpx;
				box-sizing: border-box;

				image {
					width: 45rpx;
					height: 51rpx;
				}
			}

			.abso .yet {
				margin-left: 16rpx;
				width: 46rpx;
				height: 52rpx;
			}

			.abso .now {
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 800;
			}
		}

		.peisong {
			border-top: 1px solid #eeeeee;
		}


		.detail-c {
			width: calc(100% - 40rpx);
			margin: 20rpx auto;
			background-color: #ffffff;
			border-radius: 20rpx;
			font-size: 28rpx;
			color: #999;

			.mb20 {
				padding: 27rpx;
				// margin-bottom: 50rpx;
				// border-bottom: 1px solid #E4E7ED;

				.ml10 {
					margin-left: 20rpx;
				}
			}

			.flex {
				display: flex;
				justify-content: space-between;
			}
		}
	}
</style>
