<template>
    <div>
        <el-table :data="pager.lists">
            <el-table-column label="门店" prop="store_name" show-overflow-tooltip />
            <el-table-column label="门店电话" prop="store_phone" show-overflow-tooltip />
            <el-table-column label="商品" prop="number" min-width="200">
                <template #default="{ row }">
                    <div class="flex items-center">
                        <el-image :src="row.image" class="w-8 h-8 mr-2" />
                        <span>{{ row.goods_name }}</span>
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="数量" prop="nums" />
            <el-table-column label="价值" prop="price" />
            <el-table-column label="创建时间" prop="create_time" min-width="120" />
        </el-table>
        <div class="flex mt-4 justify-end">
            <pagination v-model="pager" @change="getLists" />
        </div>
    </div>
</template>

<script lang="ts" setup name="receiveGifts">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiUserGiftList } from '@/api/user'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'

const props = defineProps({
    user_id: {
        type: [Number, String],
        required: true
    }
})

// 查询条件
const queryParams = reactive({
    id: props.user_id,
})


// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: apiUserGiftList,
    params: queryParams
})

const getList = (e: any) => {
    queryParams.id = e.id;
    getLists();
}

defineExpose({
    getLists,
    getList
})
</script>
