<template>
    <a-modal
        class="modal_component TaskDetail_modal payOrder_modal"
        v-model:visible="showPayOrder"
        :footer="null"
        width="78%"
        :maskClosable="false"
        :centered="true"
        :closable="false"
        wrapClassName="#app"
        :keyboard="false"
    >
		<div class="payOrder_page ">
			<div class="closeIcon">
				<i class="fi fi-rr-cross-small" @click.stop="cancelDsign()"></i>
			</div>
			<div class="creditsDetail_table_search allOrder_table_search">
				<div class="creditsDetail_state allOrder_state">
					<div class="creditsDetail_state_item allOrder_state_item">
						<span>State:</span>
						<a-select style="width:25rem" v-model:value="currentState.value" size="large" optionFilterProp="label" :options="state" placeholder="Please select" allowClear show-search></a-select>
					</div>
				</div>

				
				<div class="creditsDetail_search allOrder_search">
					<div
						class="creditsDetail_search_item allOrder_search_item"
						@click="searchcreditsDetailList()"
					>
						<span
							class="icon iconfont icon-sousuo"
						></span>
					</div>
				</div>
			</div>
			<div class="TaskDetail_page" 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 class="operate_item">{{ $t('HistoryPage.Delete') }}</div>
						</div>
					</template>
				</a-table>
			</div>
		</div>
      
	
    </a-modal>
	<div class="mark_loading" v-show="loadingShow">
		<a-spin size="large" />
	</div>
</template>
<script lang="ts">
import { defineComponent, ref, createVNode, computed, nextTick } from "vue";
import { Https } from "@/tool/https";
import { formatTime } from "@/tool/util";
import { Modal, message } from "ant-design-vue";
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
import { useI18n } from "vue-i18n";
export default defineComponent({
    components: {
    },
    setup() {
        let presentState: any = ref('paypal');
        let showPayOrder: any = ref(false);
        let loadingShow: any = ref(false);//原因
        let { t } = useI18n();
		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 currentState = ref({
			value:'income',
		})
		let state:any = ref([
			{
				label:'Income',
				value:'income',
			},
			{
				label:'Expend',
				value:'expend',
			},
		])
        let collectionList: any = ref([]);
        return {
            presentState,
            showPayOrder,
			loadingShow,
            t,
			columns,
			currentState,
			state,
			collectionList,
        };
    },
    data() {
        return {
			currentPage: 1,
            pageSize: 10,
            total: 0,
			historyTableHeight: 0,
        };
    },
    mounted() {
		// let historyTable: any = this.$refs.historyTable;
        // this.historyTableHeight = historyTable.clientHeight - 130;
		// console.log(historyTable);
	},
    methods: {
        init() {
            this.showPayOrder = true;
			this.currentPage = 1
			this.pageSize = 10
			this.getTaskDetail()
        },
		 //改变页码
		 changePage(e: any) {
            this.currentPage = e.current
            this.pageSize = e.pageSize
            this.getTaskDetail();
        },
		//查询列表
		searchcreditsDetailList() {
            this.currentPage = 1;
            this.getTaskDetail();
        },
		getTaskDetail() {
			let data = {
				isIncome: this.currentState.value == 'income'?true:false,
				page:this.currentPage,
                size:this.pageSize,
			}
			console.log(data);
			// getCreditsDetail
			// orderInfoList
            Https.axiosPost(Https.httpUrls.getCreditsDetail,data).then((rv: any) => {
                this.total = rv.length;
                this.collectionList = rv
				if(this.currentPage > 1 && rv.content.length == 0){
					this.currentPage = 1
					this.getTaskDetail()
				}else{
					this.collectionList = rv.content
					this.total = rv.total
				}
				
            });
        },
		cancelDsign(){
			this.showPayOrder = false
		}
    },
});
</script>
<style lang="less">
.TaskDetail_modal {
   
}
</style>
<style lang="less">
.payOrder_modal {
    .closeIcon {
        z-index: 2;
    }
    .payOrder_page {
        width: 100%;
        height: 100%;
        padding: 9rem;
        overflow: hidden;
        // min-width: 1440px;
        position: relative;
		.allOrder_table_search {
		display: flex;
		margin-top: 2rem;
		padding: 2rem 3.5rem 5rem 2.8rem;
		background: #fff;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		
		.allOrder_search{
			width: 20%;
			.allOrder_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;
			}
		}
		.allOrder_state {
			position: relative;
			display: flex;
			align-items: center;
			width: 80%;
			.allOrder_state_item{
				display: flex;
				align-items: center;
				margin-right: 5rem;
				>span{
					font-size: 2rem;
					font-weight: 400;
					color: #030303;
					margin-right: 15px;
					flex-shrink: 0;
					display: block;
					min-width: 5rem;
					text-align: left;
				}
				.ant-picker-range{
					height: 5rem;
				}
				.ant-select-lg{
					font-size: 14px;
					.ant-select-selector{
						height: 5rem;
						.ant-select-selection-item{
							line-height: 5rem;
						}
						input{
							line-height: 5rem;
							height: 5rem;
						}
					}
				}
			}
			.allOrder_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;
				}
			}
		}
	}
	}
}
</style>