<template>
	<view class="as-layout-horizontal as-gravity-center-start" v-if="!hide">
		<text class="label">{{label}}</text>
		<text class="value" @click="copy(value,label)">{{value}}</text>
		<image :src="`${$imgUrl}order/copy-template.png`" mode="" v-if="label == '物流单号：'" @click="copy(value,label)">
		</image>
	</view>
</template>

<script setup lang="ts">
	import { msg } from "@/utils/utils";
	defineProps({
		label: {
			type: String,
			default: ''
		},

		value: {
			type: String,
			default: ''
		},
		hide: {
			type: Boolean,
			default: false
		}
	})
	const copy = (value, lable) => {
		console.log(value, lable)
		if (lable == "物流单号：") {
			uni.setClipboardData({
				data: value,
				showToast: false,
				success(res) {
					uni.getClipboardData({
						success(res) {
							uni.hideToast()
							msg('复制物流单号成功');
							console.log(res.data) // data
						}
					})
				}
			})
		}
	}
</script>

<style lang="scss" scoped>
	.label {
		font-size: 26rpx;
		color: #999999;
		min-width: 130rpx;
	}

	.value {
		font-size: 26rpx;
		color: #333333;
		padding: 0 30rpx
	}

	image {
		width: 36rpx;
		height: 36rpx;
		position: relative;
		left: -22rpx;
		top: -4rpx;
	}
</style>