From 0299e8928340b844552c33751df1ffd2cc34b208 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 29 一月 2026 17:00:44 +0800
Subject: [PATCH] 增加碳立方-磅单页面

---
 src/api/carboncubes/index.js    |   10 +++
 src/views/carboncubes/index.vue |  126 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+), 0 deletions(-)

diff --git a/src/api/carboncubes/index.js b/src/api/carboncubes/index.js
new file mode 100644
index 0000000..02b111f
--- /dev/null
+++ b/src/api/carboncubes/index.js
@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+// 鑾峰彇纰崇珛鏂�-姒滃崟
+export function getCarboncubeList(query) {
+    return request({
+        url: '/carboncubes/page',
+        method: 'get',
+        params: query
+    })
+}
diff --git a/src/views/carboncubes/index.vue b/src/views/carboncubes/index.vue
new file mode 100644
index 0000000..07cda63
--- /dev/null
+++ b/src/views/carboncubes/index.vue
@@ -0,0 +1,126 @@
+<template>
+  <div class="app-container">
+    <el-card>
+      <!-- 鏍囩椤� -->
+      <el-tabs
+        v-model="activeTab"
+        class="info-tabs"
+      >
+        <el-tab-pane
+          v-for="tab in tabs"
+          :key="tab.name"
+          :label="tab.label"
+          :name="tab.name"
+        />
+      </el-tabs>
+
+      <div>
+        <data-table
+            :border="true"
+            :columns="columns"
+            :loading="loading"
+            style="width: 100%; height: calc(100vh - 29em)"
+            :show-selection="true"
+            :table-data="tableData"
+            :operationsWidth="200"
+            :showOperations="false"
+        />
+      </div>
+      <pagination
+          v-if="total > 0"
+          :layout="'total, prev, pager, next, jumper'"
+          :limit="pageSizes"
+          :page="pageNum"
+          :total="total"
+          @pagination="handPagination"
+      />
+    </el-card>
+  </div>
+</template>
+
+<script setup>
+import {
+  onMounted,
+  reactive,
+  ref,
+} from "vue";
+import { ElMessage } from "element-plus";
+import { getCarboncubeList } from "@/api/carboncubes/index.js";
+import DataTable from "@/components/Table/ETable.vue";
+import Pagination from "@/components/Pagination/index.vue";
+
+// 椤甸潰鐘舵�佹帶鍒�
+const loading = ref(false);
+const activeTab = ref("PURCHASE");
+
+// 鏍囩椤甸厤缃�
+const tabs = reactive([
+  { name: "PURCHASE", label: "鍒拌揣纾呭崟" },
+  { name: "SELL", label: "鍙戣揣纾呭崟" },
+]);
+
+// 鍒嗛〉鐘舵�佺鐞�
+const pageNum = ref(1);
+const pageSizes = ref(10);
+const total = ref(0);
+
+// 琛ㄦ牸鐘舵�佺鐞�
+const tableData = ref([]);
+const columns = computed(() => {
+  const baseColumns = [
+    { prop: "coal", label: "鐓ょ绫诲瀷", minWidth: 170 },
+    { prop: "billNumber", label: "纾呭崟缂栧彿", minWidth: 100 },
+    { prop: "number", label: "鏁伴噺", minWidth: 150 },
+    { prop: "priceIncludingTax", label: "鍚◣鍗曚环", minWidth: 120 },
+    { prop: "createUser", label: "鐧昏浜�", minWidth: 120 },
+    { prop: "createTime", label: "鐧昏鏃ユ湡", minWidth: 120 },
+  ];
+
+  // 鏍规嵁绫诲瀷娣诲姞涓嶅悓鐨勭涓�鍒�
+  if (activeTab.value === "SELL") {
+    return [
+      { prop: "customerName", label: "瀹㈡埛鍚嶇О", minWidth: 100 },
+      ...baseColumns
+    ];
+  } else {
+    return [
+      { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 100 },
+      ...baseColumns
+    ];
+  }
+});
+
+watch(() => [pageNum.value, pageSizes.value, activeTab.value], () => getList());
+
+const handPagination = (val) => {
+  pageNum.value = val.page;
+  pageSizes.value = val.limit;
+  getList();
+};
+
+const getList = () => {
+  loading.value = true;
+  const apiParams = {
+    current: pageNum.value,
+    pageSize: pageSizes.value,
+    orderType: activeTab.value,
+  };
+  getCarboncubeList(apiParams).then((res) => {
+    if (res.code !== 200) {
+      ElMessage.error("鑾峰彇鏁版嵁澶辫触锛�" + (res?.msg || "鏈煡閿欒"));
+      return;
+    }
+
+    tableData.value = res.data.records || [];
+    total.value = res.total || 0;
+  }).catch((err) => {
+    console.log(err);
+  }).finally(() => {
+    loading.value = false;
+  })
+}
+
+onMounted(() => {
+  getList();
+});
+</script>

--
Gitblit v1.9.3