<template>
	<view style="position: relative;">
		<!-- 胶囊 -->
		<mvBar :mysNavConfig="mysNavConfig"></mvBar>
		<view :style="{marginTop:navH}"></view>
		<view v-if="projectForm == 1">

			<view class="address">
				<view class="address_icon">
					<image style="width: 50rpx;height: 50rpx;" :src="picture.icon_loc" mode="">
					</image>
				</view>
				<view style="width: 70%;">
					<view style="display: flex;">
						<p class='ipon' style="padding-right: 100rpx;">{{address.receiver_name}}</p>
						<p class='ipon'>{{address.phone_number}}</p>
					</view>
					<p class='ipon'>{{address.full_detail_addr}}</p>
				</view>
			</view>

			<view class="logistics1">
				<view>
					<p style="margin-bottom: 10rpx;">物流公司：{{logistics.company_name}}</p>
					<p>物流单号：{{logistics.logistics_number}}
						<image :src="picture.icon_copy" mode="" class="copy-img"
							@click="handleCopy(logistics.logistics_number)" />
					</p>
				</view>
			</view>
		</view>

		<view v-if="projectForm == 2" class="logistics1" style="margin: 0;">
			<view>
				<p>券码信息：{{logistics.coupon_code_information}}
					<image :src="picture.icon_copy" mode="" class="copy-img"
						@click="handleCopy(logistics.coupon_code_information)" />
				</p>
			</view>
		</view>

		<view v-if="projectForm == 3" class="logistics1" style="margin: 0;">
			<view>
				<p style="margin-bottom: 30rpx;">探店时间</p>
				<p>{{logistics.explorestore_starttime}} &nbsp;&nbsp;至&nbsp;&nbsp;{{logistics.explorestore_endtime}}</p>
			</view>
		</view>
	</view>
</template>

<script>
	import mvBar from "@/components/mys_navBar/mysNavBar";
	export default {
		components: {
			mvBar,
		},
		data() {
			return {
				navH: getApp().globalData.navHeight,
				picture: getApp().globalData.picture,
				address: {},
				taskId: "",
				projectForm: "",
				logistics: {
					company_name: "",
					logistics_number: "",
					coupon_code_information: "",
					explorestore_starttime: "",
					explorestore_endtime: ""
				},
				mysNavConfig: {
					/* 开启单页显示首页图标 */
					isHome: false,
					/* 固定导航  */
					navFixed: true,
					/* 标题 （屏幕中心居中 两边图标中心居中使用slot center1） */
					navTitle: {
						text: "物流信息",
						color: "",
						fontSize: "32rpx", // px upx rpx
						fontWeight: "normal", // 100 - 700
					},
					btnType: "type2",
					onLeftClick: '',
					/* type2 按钮 */
					type2Config: {
						// 左图标
						leftPath: "/static/img/png2.png",
						// 右图标
						rightPath: "/static/img/png4.png",
						// 圆角
						radius: "40rpx",
					},
				},
			}
		},
		onLoad(options) {
			let data = options.textObj.replace(/""/g, "");
			data = JSON.parse(decodeURIComponent(data))
			this.address = data.address
			this.taskId = data.taskId
			this.projectForm = data.projectForm

			uni.showLoading({
				title: '加载中'
			});
			this.getLogisticsInfo()
		},
		methods: {
			handleCopy(content) {
				wx.setClipboardData({
					data: content,
					success: function(res) {
						console.log("复制成功");
					}
				});
			},
			getLogisticsInfo() {
				this.$https.get('/youngee/c/t/g/get-task-logistics-info' +
					"?" +
					"task_id" +
					"=" +
					this.taskId
				).then(res => {
					this.logistics = res.data.data
					this.logistics.explorestore_starttime = this.logistics.explorestore_starttime.slice(0, 16)
					this.logistics.explorestore_endtime = this.logistics.explorestore_endtime.slice(0, 16)
					this.loading = false;
					uni.hideLoading();
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	p {
		font-size: 30rpx;
	}

	.address {
		display: flex;
		margin: 20rpx 0;
		// padding: 20rpx 20rpx;
		background-color: #FFFFFF;
		justify-content: space-around;
		align-items: center;

		.address_icon {
			width: 15%;
			vertical-align: middle;
			display: flex;
			justify-content: center;
		}

		.address_edit {
			width: 15%;
		}

		.address_edit image {
			vertical-align: middle;
			width: 50rpx;
			height: 50rpx;
			display: inline-block;
			padding-right: 14rpx;
		}

		.ipon {
			color: #333333;
			font-size: 30rpx;
			font-weight: 500;
			margin-bottom: 10rpx;
		}
	}

	.logistics1 {
		margin-top: 50rpx;
		display: flex;
		flex-flow: column;
		align-items: center;
		justify-content: center;
	}
</style>
