<template>
  <div style="margin-top: 10px;">
    <el-table :data="props.list" border style="width: 100%">
      <el-table-column prop="name" label="供应商" />
      <el-table-column prop="telephone" label="联系电话" />
      <el-table-column prop="address" label="地址" />
      <el-table-column prop="remark" label="备注" />

      <el-table-column prop="date" label="剩余付款金额" />
      <el-table-column prop="date" label="待付款笔数" />
      <el-table-column prop="date" label="状态" />

      <el-table-column prop="lastTransactTime" label="上笔进货日期" />
      <el-table-column label="操作" width="250">

        <template #default="scope">
          <el-button size="small" type="primary" link icon="Edit" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="small" type="danger" link icon="Delete" style="color: #f89797;"
            @click="handleDelete(scope.$index, scope.row)"> 删除 </el-button>
          <el-button size="small" type="primary" link @click="PaymentRecord()">结款记录</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router';
const router = useRouter()
const emit = defineEmits(['handleDelete'])
const props = defineProps({
  list: {
    type: Array,
    default: () => []
  }
})

function handleEdit(row) {
  emit('handleEdit', row)
}
async function handleDelete(index, row) {
  emit('handleDelete', row.id)
}
function PaymentRecord() {
  router.push({ name: 'paymentRecord' });

}
</script>
