<script setup>
import {ref} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {getPlayerInfo} from "#/api/player/player_list.js";
import {Descriptions, DescriptionsItem, Spin} from 'ant-design-vue';

const uname = ref();
const data = ref();
const loading = ref(false);
const [Modal, modalApi] = useVbenModal({
	draggable: true,
	async onOpenChange(isOpen) {
		loading.value = false;
		if (isOpen) {
			uname.value = modalApi.getData().uname;
			loading.value = true;
			data.value = await getPlayerInfo(uname.value);
			loading.value = false;
		}
	},
});

const dataKeys = ref([
	{'label': '平台昵称', 'key': 'nickname'},
	{'label': '平台ID', 'key': 'uname'},
	{'label': '所属商户', 'key': ''},
	{'label': '商户ID', 'key': 'merchant_id'},
	{'label': '当前余额', 'key': 'balance'},
	{'label': '创建时间', 'key': 'create_time'},
	{'label': '最后登录时间', 'key': 'login_time'},
	{'label': '当天押注', 'key': ''},
	{'label': '历史押注', 'key': ''},
	{'label': '今日RTP', 'key': ''},
	{'label': '历史RTP', 'key': ''},
	{'label': '三日登录次数', 'key': ''},
	{'label': '今日输赢', 'key': ''},
	{'label': '历史输赢', 'key': ''},
	{'label': '今日局数', 'key': ''},
	{'label': '历史局数', 'key': ''},
	{'label': '历史胜率', 'key': ''},
	{'label': '今日流水倍数', 'key': ''},
	{'label': '三日流水倍数', 'key': ''},
	{'label': '留存天数', 'key': ''},
	{'label': '注册IP地址', 'key': 'reg_ip'},
	{'label': '登录设备码', 'key': ''},
	{'label': '登录IP地址', 'key': 'login_ip'},
]);


</script>

<template>
	<Modal :loading="loading" v-if="data && data.user_id" :title="'用户详情【'+data.user_id+'】'">
		<Descriptions bordered :contentStyle="{'width':'20%'}" :labelStyle="{'width':'13%'}">
			<DescriptionsItem v-for="item in dataKeys" :label="item.label">
				{{data[item.key] || ""}}
			</DescriptionsItem>
		</Descriptions>
	</Modal>
</template>

<style scoped>

</style>