<template>
	<view class="invoice">
		<view class="invoice_tip">
			<view style="display: flex; align-items: center">
				<up-icon name="error-circle-fill" color="#3c9cff"></up-icon>
				发票须知：
			</view>
			<view>1.开票金额为用户实际支付金额(不含返利返佣)</view>
			<view>2.未寄出的纸质发票会在开票确认后的20个工作日内寄出</view>
			<view>3.单笔订单只支持开具一种发票类型</view>
			<view>4.云快充仅为平台方，实际开票主体以申请开票时展示的开票运营商公司为准</view>
			<view>5.发票由各家电站运营商提供，一起申请可能会生成多张发票</view>
			<view>6.若超过20个工作日仍未收到发票，您可以通过(区号)+12366向开票公司所在区域的主管税务机关进行反馈处理</view>
		</view>
		<view style="height: 20rpx"></view>

		<view>
			<view class="invoice_list" style="margin-bottom: 20rpx" v-for="(item, index) in dataList" :key="index">
				<view style="display: flex; align-items: center; font-weight: bold; font-size: 30rpx; margin-bottom: 30rpx">
					<!-- <up-checkbox shape="circle" :customStyle="{ margin: '0' }" :name="item.transactionNo"></up-checkbox> -->
					开票运营商：{{ item.merchantName }}
				</view>
				<view style="display: flex; align-items: center; justify-content: space-between; background-color: #f6f6f6; border-radius: 15rpx; padding: 20rpx">
					<view style="font-size: 28rpx">
						<view style="margin-bottom: 15rpx">{{ item.electricityAmount }}电费</view>
						<view>{{ item.serviceAmount }}服务费</view>
					</view>
					<view style="text-align: right">
						<view style="margin-bottom: 25rpx; font-size: 36rpx; font-weight: bold; color: #4879e6">
							{{ item.invoiceAmount }}
							<text style="font-size: 30rpx">元</text>
						</view>
						<view style="font-size: 28rpx">个人支付</view>
					</view>
				</view>
			</view>
		</view>
		<view
			style="
				position: fixed;
				bottom: 0;
				left: 0;
				width: 750rpx;
				padding: 20rpx 50rpx;
				background-color: #fff;
				display: flex;
				align-items: center;
				justify-content: space-between;
			"
		>
			<view></view>
			<!-- 			<view style="display: flex; align-items: center">
				<up-checkbox label="本页全选" v-model:checked="allCel" shape="circle" usedAlone @change="allCheck" :customStyle="{ margin: '0 10rpx 0 0' }"></up-checkbox>
			</view> -->
			<view style="width: 230rpx">
				<up-button
					@click="navTo(`/pageMake/invoice/makeInvoice?list=${encodeURIComponent(JSON.stringify(checkboxValue1))}`)"
					:customStyle="{ height: '80rpx', width: '230rpx' }"
					color="#4879e6"
					text="下一步"
					shape="circle"
				></up-button>
			</view>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { useNav } from '@/hooks/useNav.js';
const { nav, navTo } = useNav();
import { preApply } from '@/api/api.js';

const dataList = ref([]);
let checkboxValue1 = ref([]);

onLoad(async (options) => {
	checkboxValue1.value = JSON.parse(decodeURIComponent(options.list));
	console.log(checkboxValue1.value);
	let _res = await preApply({ ordersIds: JSON.parse(decodeURIComponent(options.list)) });
	dataList.value = _res;
});
</script>

<style scoped lang="scss">
.invoice {
	&_tip {
		padding: 20rpx;
		font-size: 24rpx;
		color: #3c9cff;
		background-color: rgba(60, 156, 255, 0.2);
		view {
			line-height: 40rpx;
		}
	}
	&_list {
		padding: 15rpx 30rpx;
		background-color: #fff;
		&_view {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			margin-bottom: 25rpx;
			&_left {
				color: #646368;
			}
			&_right {
				color: #262626;
			}
		}
	}
}
</style>
