RiderEvaluateList.vue 1.77 KB
<template>
  <div>
    <a-card title="骑手评价" :bordered="false">
      <template #extra>
        <a-space>
          <a-input-number v-model:value="filterRiderId" placeholder="骑手ID" style="width:130px" />
          <a-select v-model:value="filterType" placeholder="评价类型" allowClear style="width:120px">
            <a-select-option :value="0">全部</a-select-option>
            <a-select-option :value="1">好评(4-5星)</a-select-option>
            <a-select-option :value="2">中评(3星)</a-select-option>
            <a-select-option :value="3">差评(1-2星)</a-select-option>
          </a-select>
          <a-button type="primary" @click="loadList">查询</a-button>
        </a-space>
      </template>
      <a-table :dataSource="list" :columns="columns" :loading="loading" rowKey="id" :pagination="false">
        <template #bodyCell="{ column, record }">
          <template v-if="column.key === 'star'">
            <a-rate :value="record.star" disabled />
          </template>
        </template>
      </a-table>
    </a-card>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { riderApi } from '@/api'

const loading = ref(false)
const list = ref<any[]>([])
const filterRiderId = ref<number | undefined>()
const filterType = ref(0)

const columns = [
  { title: 'ID', dataIndex: 'id', width: 80 },
  { title: '骑手ID', dataIndex: 'rid' },
  { title: '评分', key: 'star' },
  { title: '内容', dataIndex: 'content', ellipsis: true },
  { title: '租户', dataIndex: 'cityId' },
]

async function loadList() {
  if (!filterRiderId.value) return
  loading.value = true
  try {
    const res: any = await riderApi.evaluateList(filterRiderId.value, filterType.value)
    list.value = res.data || []
  } finally { loading.value = false }
}
</script>