<script lang="ts" setup>
/**
 * 订单商品价格调整日志
 */
import { Page, useVbenModal } from '@vben/common-ui';

import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';

import DetailModal from './components/detail-modal.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';

defineOptions({ name: 'ProductOrderPriceAdjustLog' });

const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
const [DetailModalComp, detailModalApi] = useVbenModal({
  connectedComponent: DetailModal,
});

function openDetail(row: any) {
  detailModalApi.setData({ id: Number(row?.id || 0), values: row });
  detailModalApi.open();
}
</script>

<template>
  <Page auto-content-height title="订单调价日志">
    <DetailModalComp />
    <Grid>
      <template #action="{ row }">
        <TableAction
          :actions="[
            { label: '详情', type: 'link', size: 'small', onClick: () => openDetail(row) },
          ]"
        />
      </template>
    </Grid>
  </Page>
</template>
