<template>
	<view class="detail">
		<view class="title">
			<view class="title-left">
				<image class="header-img" :src="goodsDetail.merchant.image" mode=""></image>
				<text>{{ goodsDetail.merchant.merchant_name }}</text>
				<image class="right-325" src="../../../static/mine/325.png" mode=""></image>
			</view>
			<view class="title-right" @click="tochat">
				<u-icon name="chat" color="#f83224" size="28"></u-icon>
				<text>{{
          goodsDetail.merchant.id == 1
            ? i18n.contatto + i18n.plataforma
            : i18n.contatto + i18n.regimentalCommander
        }}</text>
			</view>
		</view>
		<view class="commodity-information">
			<view class="commodity-1">
				<image class="commodity-img" :src="goodsDetail.goods_image" mode=""></image>
				<view class="">
					<view class="commodity-2">
						<view class="commodity-title" v-if="language == 'zh-CN'">{{ goodsDetail.goods.name_cn }}
						</view>
						<view class="commodity-title" v-if="language == 'en-US'">{{ goodsDetail.goods.name_en }}
						</view>
						<view class="commodity-title" v-if="language == 'es-ES'">{{ goodsDetail.goods.name_es }}
						</view>
						<view class="commodity-title" v-if="language == 'it-IT'">{{ goodsDetail.goods.name_ita }}
						</view>
					</view>

					<view class="commodity-3">
						<view class="specifications">
							{{ goodsDetail.sku_item.item }}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="information">
			<text class="_label">{{ i18n.OrderNumber }}</text>
			<view style="color: #222">
				<text style="color: rgba(34, 34, 34, 0.6)">{{
          goodsDetail.order_no
        }}</text>
				<text @click="cope(goodsDetail.order_no)" style="color: #f83224">{{
          "&nbsp;" + "|" + "&nbsp;" + i18n.cope
        }}</text>
			</view>
		</view>
		<view class="information">
			<text class="_label">{{ i18n.ReasonRefund }}</text>
			<view class="_title-right"> {{ goodsDetail.refund.refund_reason }} </view>
		</view>
		<view class="information">
			<text class="_label">{{ i18n.refundAmount }}</text>
			<view class="_title-right">
				¥{{
          goodsDetail.refund.actual_refund_price ||
          goodsDetail.refund.refund_price
        }}
			</view>
		</view>
		<view class="information">
			<text class="_label">{{ i18n.NumberApplications }}</text>
			<view class="_title-right">{{ goodsDetail.goods_num }} </view>
		</view>
		<view class="information">
			<text class="_label">{{ i18n.applyForTime }}</text>
			<view class="_title-right">{{ goodsDetail.refund.created_at }}</view>
		</view>
	</view>
</template>

<script>
	import textRight from "../../accountSecurity/component/textRight.vue";
	export default {
		components: {
			textRight,
		},
		props: {
			status: {
				typeof: Number,
				default: 0,
			},
			goodsDetail: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			language: {
				typeof: String,
				default: "",
			},
		},
		computed: {
			i18n() {
				return this.$t("index");
			},
		},
		data() {
			return {
				packageId: "",
			};
		},
		onLoad(options) {},
		methods: {
			tochat() {
				var that = this;
				if (that.goodsDetail.merchant.id == 1) {
					uni.navigateTo({
						url: "/pageA/service/service",
					});
				} else {
					uni.navigateTo({
						url: "/pageA/chat/chat?user_other=" +
							encodeURIComponent(JSON.stringify(that.goodsDetail.merchant)) +
							"&user_other_no=" +
							that.goodsDetail.merchant.member.easemob_username,
					});
				}
			},
			application() {
				uni.navigateTo({
					url: "/pageC/applicationRefund/applicationRefund",
				});
			},

			//复制
			cope(e) {
				uni.setClipboardData({
					data: e,
					success() {
						uni.showToast({
							title: this.i18n.replicatingSuccess,
							icon: "none",
						});
					},
				});
			},
			getDetail() {},
		},
	};
</script>

<style scoped lang="scss">
	.detail {
		padding: 28rpx 20rpx;
		background-color: #fff;
		border-radius: 16rpx;
		margin-top: 28rpx;

		.title {
			display: flex;
			justify-content: space-between;
			border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
			padding-bottom: 20rpx;

			.title-left {
				display: flex;
				font-size: 32rpx;
				align-items: center;

				.header-img {
					width: 36rpx;
					height: 36rpx;
					border-radius: 50%;
					margin-right: 20rpx;
				}

				.right-325 {
					width: 32rpx;
					height: 32rpx;
				}
			}

			.title-right {
				color: #333;
				display: flex;
				align-items: center;
				font-size: 28rpx;
			}

			.order-status {
				color: #f83224;
				font-size: 26rpx;
			}
		}

		.commodity-information {
			margin-top: 28rpx;

			.commodity-1 {
				display: flex;

				.commodity-img {
					width: 180rpx;
					height: 180rpx;
					margin-right: 20rpx;
					border-radius: 10rpx;
				}

				.commodity-2 {
					display: flex;
					justify-content: space-between;

					.commodity-title {
						color: #222;
						margin-right: 38rpx;
						font-size: 28rpx;
						width: 442rpx;
						max-height: 80rpx;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						overflow: hidden;
						text-overflow: ellipsis;
					}
				}

				.commodity-3 {
					display: flex;
					justify-content: space-between;
					margin-top: 20rpx;
					color: #777;

					.specifications {
						font-size: 28rpx;
						color: #777;
					}
				}
			}
		}

		.last {
			border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
			padding-bottom: 20rpx;
		}

		.btn-list {
			display: flex;
			justify-content: flex-end;

			button {
				width: 152rpx;
				height: 58rpx;
				border: 2rpx solid #979797;
				color: #444;
				margin: 0;
				padding: 0;
				font-size: 24rpx;
				background-color: #fff;
				border-radius: 34rpx;
				margin-top: 20rpx;
				margin-left: 20rpx;
			}
		}

		.information {
			display: flex;
			justify-content: space-between;
			font-size: 28rpx;
			align-items: flex-end;
			margin: 34rpx 0;

			._label {
				font-size: 28rpx;
				color: #333;
			}

			._title-right {
				font-size: 28rpx;
				color: rgba(34, 34, 34, 0.6);
			}
		}

		._bottom {
			display: flex;
			justify-content: flex-end;
			font-size: 28rpx;
			align-items: flex-end;
			margin-top: 34rpx;
		}
	}
</style>