<!--
 * @Author: Fly
 * @Date: 2025-12-10 10:06:13
 * @LastEditTime: 2025-12-24 09:40:05
 * @Description: 
-->
<template>
  <div class="app-container">
    <el-form :model="search" ref="queryForm" :inline="true" v-show="showSearch" :size="ELsize" label-width="auto">
      <el-form-item label="商品名称" prop="productTitle">
        <el-input v-model="search.productTitle" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button type="primary" plain  :size="ELsize" @click="handleExport"
          >导出库存</el-button
        >
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="dataList" :border="TableBorder" :size="ELTableSize">
      <el-table-column type="index" width="55" label="序号" align="center">
        <template slot-scope="{$index}">
          {{ $getTableIndex(queryParams, $index + 1) }}
        </template>
      </el-table-column>
      <el-table-column label="商品名称" align="center" prop="productTitle" show-overflow-tooltip></el-table-column>
      <el-table-column label="商品封面" align="center" prop="cover">
        <template slot-scope="{ row }">
          <imagePreview v-if="row.cover" :src="row.cover" width="50px" height="50px" />
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column label="商品编号" align="center" prop="code"></el-table-column>
      <el-table-column label="规格名" align="center" prop="skuSetName" show-overflow-tooltip></el-table-column>
      <el-table-column label="销售价" align="center" prop="salePrice"></el-table-column>
      <el-table-column label="体积(m³)" align="center" prop="volume"></el-table-column>
      <el-table-column label="重量(KG)" align="center" prop="weight"></el-table-column>
      <el-table-column label="库存" align="center" prop="stock"></el-table-column>
      <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button :size="ELTableSize" type="text" @click="handleView(scope.row)">流水</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <productStockFlowWater ref="productStockFlowWaterRef" />
  </div>
</template>
<script>
import getListApi from "@/mixins/getListApi";
import { productSkuSetStockPage } from "@/api/productInventory";
import productStockFlowWater from "./components/productStockFlowWater.vue";
export default {
  mixins: [getListApi],
  components: { productStockFlowWater },
  data() {
    return {
      listURL: productSkuSetStockPage,
      exportObj: {
        url: "/shop/productSkuSetStock/export", // 导出接口地址
        name: "商品库存", // 导出文件名前缀
      },
    };
  },
  methods: {
    handleView(row) {
      this.$refs.productStockFlowWaterRef.open(row.id);
    },
  },
};
</script>
<style scoped lang="scss"></style>
