<template>
  <div class="contentList">
    <!-- <Input v-model="typesearchFilter.name" placeholder="请输入标题名称" style="width: 480px"></Input>

    <el-button type="primary" @click="changePage(1)">查询</el-button> -->

    <el-table v-loading="loading" :data="tabData.data" style="width: 100%; margin-top: 2em" border>
      <el-table-column label="序号" type="index" width="70" align="center"></el-table-column>
      <el-table-column label="时间" width="160" align="center">
        <template #default="scope">
          {{ moment(scope.row.addTime).format('yyyy-MM-DD hh:mm:ss') || '暂无' }}
        </template>
      </el-table-column>
      <el-table-column label="买方" prop="buyerOrgName" align="center"></el-table-column>
      <el-table-column label="卖方" prop="salerOrgName" align="center"></el-table-column>
      <el-table-column label="服务费" align="center" prop="shopFee" width="120"> </el-table-column>
      <el-table-column label="公斤数" prop="confirmOrderWeight" width="120"></el-table-column>
      <el-table-column label="每公斤服务费" align="center" prop="shopFeePerKg" width="120"> </el-table-column>

      <!-- <el-table-column label="操作" fixed="right" width="120">
        <template #default="scope">
          <el-button type="danger" size="small" @click="delContent(scope.row.id)">删除</el-button>
        </template>
      </el-table-column> -->
    </el-table>

    <div class="page_style">
      <Page :total="tabData.total" :model-value="currentPage" show-elevator show-total @on-change="changePage" />
    </div>
  </div>
</template>

<script setup>
import { defineComponent, ref, reactive, onMounted } from 'vue'
import moment from 'moment'
import { cow } from '@/request/api'
let typesearchFilter = reactive({ limit: 10, offset: 0 })

let tabData = ref({})
const loading = ref(false)
//获取列表内容
async function getData() {
  loading.value = true
  await cow.shopFeeList(typesearchFilter).then(res => {
    if (res.code == 101) {
      tabData.value = res || {}
    }
  })
  loading.value = false
}

let currentPage = ref(1)
//更改页码
function changePage(page) {
  if (tabData.value.limit) {
    typesearchFilter.offset = (page - 1) * tabData.value.limit //更新偏移量
    currentPage.value = page //切换当前页码
    getData() //获取广告数据
  }
}

onMounted(() => {
  getData()
})
</script>

<style lang="scss" scoped>
.contentList {
  padding: 1em;
  .page_style {
    text-align: right;
    margin-top: 1em;
    background-color: var(--system-container-background);
  }
}
</style>
