<template>
    <global-popup v-model="show" background="#F7F8FA" title="接收历史" :round="32" closeable>
        <up-cell-group v-if="historyList.length">
            <template v-for="(item, index) in historyList" :key="index">
                <up-cell :title="'接收人:' + item.name" :value="'接收时间:' + (timeStampFormat(item.time) || '-')" />
            </template>
        </up-cell-group>
        <view class="global-empty" v-else>
            <global-empty></global-empty>
        </view>
    </global-popup>
</template>

<script setup>
import { getPwdReceiveHistoryListApi } from 'mocp/api/windDamageManagement'
import { timeStampFormat } from 'mocp/utils/tool'
import { ref } from 'vue'

const show = ref(false)
const historyList = ref([])
const open = (params) => {
    historyList.value = []
    getPwdReceiveHistoryList(params)
}
const getPwdReceiveHistoryList = async (params) => {
    const res = await getPwdReceiveHistoryListApi(params, { loading: true })
    if (res.code == 200) {
        show.value = true
        historyList.value = res.data
    } else {
        uni.$mocpMessage.error(res.message)
    }
}
defineExpose({
    open
})
</script>
<style lang="scss" scoped>
.global-empty {
    padding-bottom: 24rpx;
}
</style>
