<template>
  <view class="product-reply-page">
    <!-- 1. 搜索筛选 -->
    <view class="search-card">
      <view class="search-row">
        <view class="search-item">
          <text class="label">评价时间：</text>
          <view class="mock-date-range">
            <text class="emoji">📅</text>
            <text class="txt">开始日期 - 结束日期</text>
          </view>
        </view>
        <view class="search-item">
          <text class="label">评价状态：</text>
          <view class="mock-select"><text>请选择</text><text class="arrow">▼</text></view>
        </view>
        <view class="search-item">
          <text class="label">审核状态：</text>
          <view class="mock-select"><text>请选择</text><text class="arrow">▼</text></view>
        </view>
      </view>
      <view class="search-row mt-16">
        <view class="search-item">
          <text class="label">商品信息：</text>
          <input class="mock-input" placeholder="请输入商品信息" />
        </view>
        <view class="search-item">
          <text class="label">用户名称：</text>
          <input class="mock-input" placeholder="请输入" />
        </view>
        <button class="btn-primary">查询</button>
      </view>
    </view>

    <!-- 2. 操作行 -->
    <view class="action-bar">
      <button class="btn-primary">添加自评</button>
      <button class="btn-white">批量审核</button>
    </view>

    <!-- 3. 数据表格 -->
    <view class="list-card">
      <view class="table-v5">
        <view class="th-row">
          <view class="th col-check"><text>□</text></view>
          <view class="th col-id"><text>评论ID</text></view>
          <view class="th col-product"><text>商品信息</text></view>
          <view class="th col-spec"><text>规格</text></view>
          <view class="th col-user"><text>用户名称</text></view>
          <view class="th col-score"><text>评分</text></view>
          <view class="th col-content"><text>评价内容</text></view>
          <view class="th col-reply"><text>回复内容</text></view>
          <view class="th col-status"><text>审核状态</text></view>
          <view class="th col-time"><text>评价时间</text></view>
          <view class="th col-op"><text>操作</text></view>
        </view>

        <view v-for="item in replyList" :key="item.id" class="tr-row">
          <view class="td col-check"><text>□</text></view>
          <view class="td col-id"><text>{{ item.id }}</text></view>
          <view class="td col-product">
            <image class="p-img" :src="item.image" mode="aspectFill" />
            <text class="p-name-txt">{{ item.productName }}</text>
          </view>
          <view class="td col-spec"><text>{{ item.spec }}</text></view>
          <view class="td col-user"><text>{{ item.username }}</text></view>
          <view class="td col-score"><text>{{ item.score }}</text></view>
          <view class="td col-content"><text class="blue-link">{{ item.content }}</text></view>
          <view class="td col-reply"><text>{{ item.reply || '无' }}</text></view>
          <view class="td col-status">
            <text class="status-tag" :class="item.status === 1 ? 'pass' : 'wait'">
              {{ item.status === 1 ? '通过' : '待审核' }}
            </text>
          </view>
          <view class="td col-time"><text>{{ item.time }}</text></view>
          <view class="td col-op">
            <text class="op-link">通过</text>
            <text class="op-link">驳回</text>
            <text class="op-link">回复</text>
            <text class="op-link red">删除</text>
          </view>
        </view>
      </view>

      <!-- 分页 -->
      <view class="pagination-row">
        <text class="total">共 {{ replyList.length }} 条</text>
        <view class="page-ctrl">
          <text class="page-btn disabled">{"<"}</text>
          <text class="page-num active">1</text>
          <text class="page-btn">{">"}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="uts">
import { ref } from 'vue'

const replyList = ref([
  {
    id: 1069,
    image: 'https://img1.baidu.com/it/u=254065646,3100346083&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
    productName: 'UR2024夏季新款女装复古纯欲氛围感一字肩短款T恤衫UWG440060',
    spec: 'XL,卡其',
    username: 'demo998',
    score: 3.5,
    content: '22',
    reply: '',
    status: 0,
    time: '2025-02-19 14:56:43'
  },
  {
    id: 1059,
    image: 'https://img1.baidu.com/it/u=254065646,3100346083&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
    productName: 'UR2024夏季新款女装复古纯欲氛围感一字肩短款T恤衫UWG440060',
    spec: 'XL,卡其',
    username: '你好呀',
    score: 3.5,
    content: '的',
    reply: '',
    status: 0,
    time: '2025-01-07 15:35:36'
  },
  {
    id: 980,
    image: 'https://img1.baidu.com/it/u=254065646,3100346083&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
    productName: 'UR2024夏季新款女装复古纯欲氛围感一字肩短款T恤衫UWG440060',
    spec: 'XL,卡其',
    username: 'wx209638',
    score: 5,
    content: '好',
    reply: '',
    status: 1,
    time: '2024-09-12 14:20:12'
  }
])
</script>

<style scoped lang="scss">
.product-reply-page {
  padding: 20px;
  background-color: #f5f7f9;
  min-height: 100vh;
}

.search-card {
  background: #fff;
  padding: 24px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.search-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
}
.mt-16 { margin-top: 16px; }

.search-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  .label { font-size: 14px; color: #606266; width: 80px; text-align: right; }
}

.mock-date-range {
  width: 280px; height: 32px; border: 1px solid #dcdfe6; border-radius: 4px;
  display: flex; flex-direction: row; align-items: center; padding: 0 12px; gap: 8px;
  .emoji { font-size: 14px; }
  .txt { font-size: 13px; color: #c0c4cc; }
}

.mock-select {
  width: 160px; height: 32px; border: 1px solid #dcdfe6; border-radius: 4px;
  display: flex; flex-direction: row; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 13px; color: #606266;
  .arrow { font-size: 10px; color: #c0c4cc; }
}

.mock-input {
  width: 200px; height: 32px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 12px; font-size: 13px;
}

.btn-primary { background: #1890ff; color: #fff; height: 32px; padding: 0 16px; border-radius: 4px; font-size: 14px; border: none; }
.btn-white { background: #fff; color: #606266; height: 32px; padding: 0 16px; border-radius: 4px; font-size: 14px; border: 1px solid #dcdfe6; }

.action-bar {
  margin-bottom: 16px;
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.list-card {
  background: #fff;
  border-radius: 4px;
}

.table-v5 { width: 100%; }

.th-row {
  display: flex;
  flex-direction: row;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e8e8e8;
}

.th {
  padding: 12px 8px; font-size: 13px; font-weight: 500; color: #333;
  display: flex; align-items: center; justify-content: center;
}

.tr-row {
  display: flex; flex-direction: row; border-bottom: 1px solid #f0f0f0;
  &:hover { background-color: #fafafa; }
}

.td {
  padding: 12px 8px; font-size: 13px; color: #606266;
  display: flex; align-items: center; justify-content: center;
}

.col-check { width: 50px; }
.col-id { width: 80px; }
.col-product { flex: 1.5; justify-content: flex-start; gap: 12px; }
.col-spec { width: 100px; }
.col-user { width: 120px; }
.col-score { width: 80px; }
.col-content { flex: 1; }
.col-reply { flex: 1; }
.col-status { width: 100px; }
.col-time { width: 160px; }
.col-op { width: 180px; }

.p-img { width: 40px; height: 40px; border-radius: 4px; }
.p-name-txt { font-size: 13px; line-height: 1.4; color: #1890ff; }

.blue-link { color: #1890ff; }

.status-tag {
  padding: 2px 8px; border-radius: 2px; font-size: 12px;
  &.pass { background: rgba(82, 196, 26, 0.1); color: #52c41a; }
  &.wait { background: rgba(250, 173, 20, 0.1); color: #faad14; }
}

.op-link { font-size: 13px; color: #1890ff; margin: 0 4px; cursor: pointer; &.red { color: #f5222d; } }

.pagination-row {
  padding: 24px; display: flex; flex-direction: row; justify-content: flex-end; align-items: center; gap: 16px;
  .total { font-size: 13px; color: #606266; }
}

.page-ctrl {
  display: flex; flex-direction: row; gap: 8px;
  .page-num, .page-btn {
    width: 32px; height: 32px; border: 1px solid #dcdfe6; border-radius: 4px;
    display: flex; align-items: center; justify-content: center; font-size: 13px;
    &.active { background: #1890ff; color: #fff; }
    &.disabled { background: #f5f5f5; color: #ccc; }
  }
}
</style>
