<template>
	<view class="pages-box">
		<uv-navbar autoBack title="经营明细" placeholder bgColor="#fff" />

		<template v-for="item in RowsList">
			<view class="details-placeholder" />
			<view class="details-item">
				<view class="headline-box">
					<text class="headline-text one-row">订单号：{{ item.orderNo }}</text>
					<view class="headline-copy" @click.stop="copyData(item.orderNo)">
						<text class="iconfont copy-icon">&#xe64f;</text>
						<text class=" copy-text">复制</text>
					</view>
				</view>
				<view class="details-content">
					<view class="content-row">
						<text class="row-label" v-if="item.orderType === OrderTypeEnum.PUTONGDINGDAN">商城订单：</text>
						<text class="row-label" v-else-if="item.orderType === OrderTypeEnum.XIANSHANGDINGDAN">服务商品订单：</text>
						<text class="row-label" v-else-if="item.orderType === OrderTypeEnum.ZAIXIANDINGDAN">在线买单：</text>
						<text class="row-label" v-else></text>
						<text class="row-value" style="color: #DA4F4F;">+ {{ item.businessIncome || 0 }}</text>
					</view>
					<view class="content-row">
						<text class="row-label">订单金额：</text>
						<text class="row-value">￥{{ item.orderAmount || 0 }}</text>
					</view>
					<view class="content-row">
						<text class="row-label">时间 ：</text>
						<text class="row-value">{{ item.paymentTime }}</text>
					</view>
				</view>
			</view>
		</template>

		<template v-if="LoadStatus && LoadStatus!=='loading' && !RowsList.length">
			<noData />
		</template>

		<template v-else-if="LoadStatus">
			<uv-load-more :status="LoadStatus" line />
		</template>
	</view>
</template>

<script lang="ts" setup>
	import { getSalesPageApi } from "@/api/ShopContent.ts";
	import { usePageData } from "@/hooks/usePageData.ts";
	import { OrderTypeEnum } from "@/util/Enum.ts";
	import { copyData } from "@/util/tools.ts";
	const { RowsList, LoadStatus, initData } = usePageData(getSalesPageApi);

	initData()
</script>

<style lang="scss" scoped>
	$pad_lr: 30rpx;

	.details-placeholder {
		width: 100%;
		height: 30rpx;
	}

	.details-item {
		width: 100%;
		background: #ffffff;
		border-radius: 24rpx;

		.headline-box {
			width: 100%;
			height: 100rpx;
			padding: 0 $pad_lr;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border: 1rpx solid #f0f0f0;

			.headline-text {
				font-size: 32rpx;
				font-family: PingFang SC, PingFang SC-Bold;
				font-weight: 700;
				color: #1a1a1a;
				padding-right: 10rpx;
			}

			.headline-copy {
				flex-shrink: 0;
				color: #3775F6;
				display: flex;
				align-items: center;

				.copy-icon {}

				.copy-text {
					padding-left: 5rpx;
					font-size: 26rpx;
					font-family: PingFang SC, PingFang SC-Regular;
					font-weight: 400;
				}
			}
		}

		.details-content {
			padding: 20rpx $pad_lr;

			// <view class="content-row">
			// 	<text class="row-label">在线买单：</text>
			// 	<text class="row-value">+ 75.00</text>
			// </view>
			.content-row {
				padding: 10rpx 0;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 28rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				line-height: 36rpx;

				.row-label {
					color: #1a1a1a;
				}

				.row-value {
					color: #808080;
				}
			}
		}
	}
</style>