<template>
    <div class="creditsDetail_page">
		<div class="creditsDetail_table_search">
			<!-- <a-range-picker
					class="range_picker"
					v-model:value="rangePickerValue"
					:placeholder="[
						$t('HistoryPage.StartDate'),
						$t('HistoryPage.EndDate'),
					]"
					valueFormat="YYYY-MM-DD"
				>
					<template #suffixIcon>
						<span
							class="icon iconfont range_picker_icon icon-rili"
						></span>
					</template>
				</a-range-picker> -->
				<!-- <div class="content_search_block">
					<input
						class="search_input"
						:placeholder="
							$t('HistoryPage.inputContent1')
						"
						v-model="searchCollectionName"
						@keydown.enter="searchCreditDetailList()"
					/>
					<div
						class="search_icon_block"
						@click="searchCreditDetailList()"
					>
						<span
							class="icon iconfont icon-sousuo"
						></span>
					</div>
				</div> -->
		</div>
		<div class="creditsDetail_table_content" ref="historyTable">
			<a-table
				:columns="columns"
				:data-source="collectionList"
				:scroll="{ y: historyTableHeight }"
				@change="changePage"
				:pagination="{
					showSizeChanger: true,
					current: currentPage,
					pageSize: pageSize,
					total: total,
					showQuickJumper: true,
					bordered: false,
				}"
			>
				<template
					#bodyCell="{ column, text, record, index }"
				>
					<div
						class="operate_list"
						v-if="column?.Operations"
					>
						<!-- <div
							v-if="record.orderStatus == '支付成功'"
							class="operate_item"
							@click="refund(record)"
						>
							refund
						</div> -->
						<div class="operate_item">{{ $t('HistoryPage.Delete') }}</div>
					</div>
				</template>
			</a-table>
		</div>
    </div>
</template>
<script lang="ts">
import { defineComponent, ref, createVNode, computed } from "vue";
import { Https } from "@/tool/https";
import { formatTime } from "@/tool/util";
import { useI18n } from "vue-i18n";
export default defineComponent({
    components: {
    },
    setup() {
        let renameData: any = ref({}); //修改名字选中的数据
        const columns: any = computed(() => {
            return [
                {
                    title: "Serial",
                    align: "center",
                    ellipsis: true,
                    dataIndex: "orderNo",
                    key: "orderNo",
                },
                {
                    title: "Title",
                    align: "center",
                    ellipsis: true,
                    dataIndex: "title",
                    key: "title",
                },
                {
                    title: "Money",
                    align: "center",
                    ellipsis: true,
                    dataIndex: "totalFee",
                    key: "totalFee",
                },
                {
                    title: "Payment",
                    align: "center",
                    ellipsis: true,
                    dataIndex: "paymentType",
                    key: "paymentType",
                },
                {
                    title: "State",
                    align: "center",
                    ellipsis: true,
                    dataIndex: "orderStatus",
                    key: "orderStatus",
                },

                // {
                //     title: useI18n().t("HistoryPage.Operations"),
                //     key: "operation",
                //     align: "center",
                //     // slots:{customRender:'action'}
                //     Operations: true,
                // },
            ];
        });
        let dataList: any = ref([]);
        let rangePickerValue: any = ref([]);
        let allDataList: any = ref([]);
        let collectionList: any = ref([]);
        let userInfo: any = {};
        return {
            columns,
            dataList,
            renameData,
			rangePickerValue,
			allDataList,
			collectionList,
            userInfo,
        };
    },
    data() {
        return {
            currentPage: 1,
            pageSize: 10,
            total: 0,
            historyTableHeight: 0,
            searchCollectionName: "",
        };
    },
    mounted() {
        let historyTable: any = this.$refs.historyTable;
        this.historyTableHeight = historyTable.clientHeight - 130;
    },
    methods: {
		init(){
			this.currentPage = 1
			this.pageSize = 10
			this.getCreditDetailList()
		},
        //改变页码
		changePage(e: any) {
            this.currentPage = e.current;
            this.pageSize = e.pageSize;
			this.collectionList = this.allDataList.slice(
				(this.currentPage - 1) * this.pageSize,
				(this.currentPage - 1) * this.pageSize + this.pageSize
			);
        },
		//查询列表
		searchCreditDetailList() {
            this.currentPage = 1;
            this.getCreditDetailList();
        },
		//获取列表
        getCreditDetailList() {
            let startDate: any = this.rangePickerValue
                ? new Date(this.rangePickerValue[0]).getTime()
                : "";
            let endDate: any = this.rangePickerValue
                ? new Date(this.rangePickerValue[1]).getTime()
                : "";
        

            Https.axiosGet(Https.httpUrls.orderInfoList).then((rv: any) => {
                this.total = rv.length;
                this.allDataList = rv
				this.collectionList = this.allDataList.slice(
					(this.currentPage - 1) * this.pageSize,
					(this.currentPage - 1) * this.pageSize + this.pageSize
				);
				
            });
        },
    },
});
</script>
<style lang="less">
.creditsDetail_page {
    width: 100%;
    height: 100%;
    overflow: hidden;
    // min-width: 1440px;
    position: relative;
	display: flex;
	flex-direction: column;
	.creditsDetail_table_search {
		display: flex;
		margin-top: 2rem;
		padding: 2rem 3.5rem 5rem 2.8rem;
		background: #fff;
		display: flex;
		justify-content: space-between;
		.creditsDetail_search{
			width: 40%;
			.creditsDetail_search_item{
				background: #343579;
				border-color: #343579;
				height: 4rem;
				padding: .64rem 1.5rem;
				font-size: 1.6rem;
				border-radius: 2px;
				display: inline-block;
				color: #fff;
				cursor: pointer;
			}
		}
		.creditsDetail_state {
			position: relative;
			cursor: pointer;
			width: 60%;
			.creditsDetail_state_item{
				margin-right: 2rem;
				margin-bottom: 2rem;
				display: flex;
				align-items: center;
				>span{
					font-size: 1.6rem;
					font-weight: 400;
					color: #030303;
					margin-right: 15px;
					flex-shrink: 0;
					display: block;
					min-width: 13rem;
					text-align: right;
				}
			}
			.creditsDetail_current{
				background: #fff;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
			}
			.header_user_content {
				position: absolute;
				border: 2px solid;
				border-radius: 1rem;
				overflow: hidden;
				top: 0;
				transform: translateY(6rem);
				z-index: 2;
				display: none;
				margin-left: -2rem;
				.username{
					padding: 0 2rem;
					color: #000;
				}
				.username:hover{
					background: #e1e1e1;
				}
				&.active{
					display: block;
				}
			}
		}
	}

	.creditsDetail_table_content {
		width: 100%;
		// height: 100%;
		flex: 1;
		padding-bottom: 3rem;
		background: #fff;
		border-radius: 2rem;
		overflow: hidden;
		.ant-table {
			background: transparent;
		}

		.ant-table-body {
			overflow-y: auto !important;
			-ms-overflow-style: none;
			overflow: -moz-scrollbars-none;

			&::-webkit-scrollbar {
				width: 0 !important;
			}
		}
		.ant-table-thead > tr > th {
			background: #ffffff00;
			border-bottom: none;
			backdrop-filter: blur(1rem);
		}

		.ant-table-tbody > tr > td {
			border: none;
			background: transparent;
			// color: #fff;
		}
		.ant-table-tbody > tr {
			&:hover > td {
				background: #ffffff3a;
			}
		}
		.ant-table-pagination-right {
			padding-right: 3.5rem;
		}
		.operate_list {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 1rem;

			.operate_item {
				font-size: 1.4rem;
				font-family: Roboto;
				font-weight: 400;
				color: #343579;
				cursor: pointer;
			}
		}
	}
}
</style>