From 2637f60b82c1fd343c790ac2f640a887fde183d7 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 15 六月 2026 16:02:17 +0800
Subject: [PATCH] 销售台账修改

---
 src/pages/sales/salesAccount/index.vue |  590 +++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 399 insertions(+), 191 deletions(-)

diff --git a/src/pages/sales/salesAccount/index.vue b/src/pages/sales/salesAccount/index.vue
index 2e1b083..c162dca 100644
--- a/src/pages/sales/salesAccount/index.vue
+++ b/src/pages/sales/salesAccount/index.vue
@@ -3,25 +3,35 @@
     <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
     <PageHeader title="閿�鍞彴璐�"
                 @back="goBack" />
+    <!-- 鐘舵�乀ab椤电瓫閫� -->
+    <view class="sales-ledger-status-bar">
+      <view v-for="tab in salesLedgerStatusTabs"
+            :key="tab.key"
+            class="sales-ledger-status-tab"
+            :class="{ 'is-active': activeStatusTab === tab.key }"
+            @click="handleStatusTabChange(tab.key)">
+        {{ tab.label }}
+      </view>
+    </view>
     <!-- 鎼滅储鍜岀瓫閫夊尯鍩� -->
     <view class="search-section">
       <view class="search-bar">
         <view class="search-input">
           <up-input class="search-text"
                     placeholder="璇疯緭鍏ラ攢鍞悎鍚屽彿鎼滅储"
-                    v-model="salesContractNo"
-                    @change="getList"
+                    v-model="searchForm.salesContractNo"
+                    @change="handleQuery"
                     clearable />
         </view>
         <view class="filter-button"
-              @click="getList">
+              @click="handleQuery">
           <up-icon name="search"
                    size="24"
                    color="#999"></up-icon>
         </view>
       </view>
     </view>
-    <!-- 閿�鍞彴璐︾�戝竷娴� -->
+    <!-- 閿�鍞彴璐﹀垪琛� -->
     <view class="ledger-list"
           v-if="ledgerList.length > 0">
       <view v-for="(item, index) in ledgerList"
@@ -37,9 +47,18 @@
               </view>
               <text class="item-id">{{ item.salesContractNo }}</text>
             </view>
-            <!--							<view class="item-tag">-->
-            <!--								<text class="tag-text">{{ item.recorder }}</text>-->
-            <!--							</view>-->
+            <view class="item-tag"
+                  v-if="item.reviewStatus === 0">
+              <text class="tag-text warning">寰呭鏍�</text>
+            </view>
+            <view class="item-tag"
+                  v-else-if="item.reviewStatus === 1">
+              <text class="tag-text success">宸插鏍�</text>
+            </view>
+            <view class="item-tag"
+                  v-else>
+              <text class="tag-text">宸插弽瀹�</text>
+            </view>
           </view>
           <up-divider></up-divider>
           <view class="item-details">
@@ -48,73 +67,34 @@
               <text class="detail-value">{{ item.customerName }}</text>
             </view>
             <view class="detail-row">
-              <text class="detail-label">涓氬姟鍛�</text>
-              <text class="detail-value">{{ item.salesman }}</text>
-            </view>
-            <view class="detail-row">
-              <text class="detail-label">椤圭洰鍚嶇О</text>
-              <text class="detail-value">{{ item.projectName }}</text>
-            </view>
-            <view class="detail-row">
-              <text class="detail-label">浠樻鏂瑰紡</text>
-              <text class="detail-value">{{ item.paymentMethod }}</text>
+              <text class="detail-label">涓氬姟鍛� / 椤圭洰</text>
+              <text class="detail-value">{{ item.salesman }} / {{ item.projectName }}</text>
             </view>
             <view class="detail-row">
               <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
               <text class="detail-value highlight">{{ item.contractAmount }}</text>
             </view>
             <view class="detail-row">
-              <text class="detail-label">绛捐鏃ユ湡</text>
-              <text class="detail-value">{{ item.executionDate }}</text>
+              <text class="detail-label">闈㈢Н / 鏁伴噺</text>
+              <text class="detail-value">{{ item.productTotalArea }}銕� * {{ item.productTotalQuantity }}</text>
             </view>
             <view class="detail-row">
-              <text class="detail-label">鍙戣揣鐘舵��</text>
-              <u-tag size="mini"
-                     :type="getLedgerShippingTagType(item)">{{
-                getLedgerShippingLabel(item)
-              }}</u-tag>
+              <text class="detail-label">鐘舵��</text>
+              <view class="status-tags">
+                <u-tag size="mini"
+                       :type="getShippingStatusType(item)">{{ getShippingStatusText(item) }}</u-tag>
+                <u-tag size="mini"
+                       :type="getStockStatusTagType(item)">{{ getStockStatusLabel(item) }}</u-tag>
+                <u-tag size="mini"
+                       :type="item.orderStatus === 1 ? 'success' : 'primary'">{{ item.orderStatus === 1 ? '宸插畬鎴�' : '杩涜涓�' }}</u-tag>
+              </view>
             </view>
             <up-divider></up-divider>
             <view class="detail-info">
               <view class="detail-row">
-                <text class="detail-label">褰曞叆浜�</text>
-                <text class="detail-value">{{ item.entryPersonName }}</text>
+                <text class="detail-label">褰曞叆浜� / 鏃ユ湡</text>
+                <text class="detail-value">{{ item.entryPersonName }} / {{ item.entryDate }}</text>
               </view>
-              <view class="detail-row">
-                <text class="detail-label">褰曞叆鏃ユ湡</text>
-                <text class="detail-value">{{ item.entryDate }}</text>
-              </view>
-            </view>
-            <up-divider></up-divider>
-            <view class="detail-buttons">
-              <u-button class="detail-button"
-                        size="small"
-                        type="primary"
-                        plain
-                        :disabled="!canLedgerShip(item)"
-                        @click.stop="handleShip(item)">
-                鍙戣揣
-              </u-button>
-              <!-- <u-button class="detail-button"
-                        size="small"
-                        type="primary"
-                        @click.stop="handleInfo('edit', item)">
-                缂栬緫
-              </u-button>
-              <u-button class="detail-button"
-                        size="small"
-                        type="primary"
-                        plain
-                        @click.stop="openOut(item)">
-                鍙戣揣鐘舵��
-              </u-button> -->
-              <!-- <u-button class="detail-button"
-                        size="small"
-                        type="error"
-                        plain
-                        @click.stop="handleDelete(item)">
-                鍒犻櫎
-              </u-button> -->
             </view>
           </view>
         </view>
@@ -124,69 +104,163 @@
           class="no-data">
       <text>鏆傛棤閿�鍞彴璐︽暟鎹�</text>
     </view>
-    <!-- 娴姩鎿嶄綔鎸夐挳 -->
-    <!-- <view class="fab-button"
-          @click="handleInfo('add')">
-      <up-icon name="plus"
-               size="24"
-               color="#ffffff"></up-icon>
-    </view> -->
   </view>
 </template>
 
 <script setup>
-  import { ref } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
-  import { ledgerListPage, delLedger, productList } from "@/api/salesManagement/salesLedger";
-  import {
-    hasShippedProducts,
-    getLedgerShippingLabel,
-    getLedgerShippingTagType,
-    canLedgerShip,
-    executeSalesLedgerShip,
-  } from "@/utils/salesLedgerShip";
-  import useUserStore from "@/store/modules/user";
+  import { ref, onMounted } from "vue";
+  import { ledgerListPage } from "@/api/salesManagement/salesLedger";
   import PageHeader from "@/components/PageHeader.vue";
-  const userStore = useUserStore();
+
+  // 鐘舵�乀ab椤�
+  const activeStatusTab = ref("all");
+  const salesLedgerStatusTabs = [
+    { key: "all", label: "鍏ㄩ儴" },
+    { key: "pendingReview", label: "鏈鏍�" },
+    { key: "reviewed", label: "宸插鏍�" },
+    { key: "reverseReviewed", label: "鍙嶅鏍�" },
+    { key: "stocked", label: "宸插叆搴�" },
+    { key: "delivered", label: "宸插彂璐�" },
+    { key: "completed", label: "宸插畬鎴�" },
+  ];
+
+  // 鎼滅储琛ㄥ崟
+  const searchForm = ref({
+    salesContractNo: "",
+    reviewStatus: undefined,
+    stockStatus: undefined,
+    deliveryStatus: undefined,
+    orderStatus: undefined,
+  });
+
+  // 閿�鍞彴璐︽暟鎹�
+  const ledgerList = ref([]);
+
+  // 鍒嗛〉
+  const page = ref({
+    current: 1,
+    size: 10,
+  });
+
+  // 閲嶇疆鐘舵�佺瓫閫�
+  const resetStatusFilters = () => {
+    searchForm.value.reviewStatus = undefined;
+    searchForm.value.stockStatus = undefined;
+    searchForm.value.deliveryStatus = undefined;
+    searchForm.value.orderStatus = undefined;
+  };
+
+  // Tab椤靛垏鎹�
+  const handleStatusTabChange = tabKey => {
+    activeStatusTab.value = tabKey;
+    resetStatusFilters();
+    switch (tabKey) {
+      case "all":
+        break;
+      case "pendingReview":
+        searchForm.value.reviewStatus = 0;
+        break;
+      case "reviewed":
+        searchForm.value.reviewStatus = 1;
+        break;
+      case "reverseReviewed":
+        searchForm.value.reviewStatus = 2;
+        break;
+      case "stocked":
+        searchForm.value.stockStatus = 2;
+        break;
+      case "delivered":
+        searchForm.value.deliveryStatus = 5;
+        break;
+      case "completed":
+        searchForm.value.orderStatus = 1;
+        break;
+      default:
+        break;
+    }
+    handleQuery();
+  };
+
+  // 鏄剧ず鍔犺浇鎻愮ず
   const showLoadingToast = message => {
     uni.showLoading({
       title: message,
       mask: true,
     });
   };
+
+  // 鍏抽棴鎻愮ず
   const closeToast = () => {
     uni.hideLoading();
   };
-
-  // 鎼滅储鍏抽敭璇�
-  const salesContractNo = ref("");
-
-  // 閿�鍞彴璐︽暟鎹�
-  const ledgerList = ref([]);
-
-  const handleShip = item => executeSalesLedgerShip(item);
 
   // 杩斿洖涓婁竴椤�
   const goBack = () => {
     uni.navigateBack();
   };
+
+  // 閲嶇疆鎼滅储
+  const resetSearch = () => {
+    searchForm.value = {
+      salesContractNo: "",
+      reviewStatus: undefined,
+      stockStatus: undefined,
+      deliveryStatus: undefined,
+      orderStatus: undefined,
+    };
+    activeStatusTab.value = "all";
+    page.value.current = 1;
+    getList();
+  };
+
   // 鏌ヨ鍒楄〃
+  const handleQuery = () => {
+    page.value.current = 1;
+    getList();
+  };
+
+  // 鑾峰彇鍒楄〃
   const getList = () => {
     showLoadingToast("鍔犺浇涓�...");
-    const page = {
-      current: -1,
-      size: -1,
+
+    // 鏋勫缓鏌ヨ鍙傛暟
+    const params = {
+      ...page.value,
+      reviewStatusList: [0, 1, 2],
     };
-    ledgerListPage({ ...page, salesContractNo: salesContractNo.value })
+
+    // 娣诲姞鎼滅储鏉′欢
+    if (searchForm.value.salesContractNo) {
+      params.salesContractNo = searchForm.value.salesContractNo;
+    }
+    if (searchForm.value.reviewStatus !== undefined) {
+      params.reviewStatus = searchForm.value.reviewStatus;
+    }
+    if (searchForm.value.stockStatus !== undefined) {
+      params.stockStatus = searchForm.value.stockStatus;
+    }
+    if (searchForm.value.deliveryStatus !== undefined) {
+      params.deliveryStatus = searchForm.value.deliveryStatus;
+    }
+    if (searchForm.value.orderStatus !== undefined) {
+      params.orderStatus = searchForm.value.orderStatus;
+    }
+
+    ledgerListPage(params)
       .then(res => {
-        console.log("閿�鍞彴璐�----", res);
-        ledgerList.value = res.records;
+        ledgerList.value = res.records || res.data || [];
         closeToast();
       })
       .catch(() => {
         closeToast();
+        uni.showToast({
+          title: "鏌ヨ澶辫触",
+          icon: "none",
+        });
       });
   };
+
+  // 鎵撳紑璇︽儏椤�
   const openOut = item => {
     uni.setStorageSync("outData", JSON.stringify(item));
     uni.navigateTo({
@@ -194,114 +268,248 @@
     });
   };
 
-  // 鍒犻櫎鍗曟潯閿�鍞彴璐�
-  const handleDelete = async row => {
-    if (!row || !row.id) return;
-
-    // 鑾峰彇浜у搧鍒楄〃锛岀敤浜庡垽鏂槸鍚﹀凡鍙戣揣
-    let products = row.children && row.children.length > 0 ? row.children : null;
-    if (!products) {
-      try {
-        const res = await productList({ salesLedgerId: row.id, type: 1 });
-        products = res.data || res.records || [];
-      } catch (e) {
-        products = [];
-      }
+  // 鑾峰彇鍙戣揣鐘舵�佹爣绛剧被鍨�
+  const getShippingStatusType = item => {
+    if (item.shippingDate || item.shippingCarNumber) {
+      return "success";
     }
-
-    if (hasShippedProducts(products)) {
-      uni.showToast({
-        title: "宸插彂璐с�侀儴鍒嗗彂璐ф垨宸叉湁鍙戣揣璁板綍鐨勯攢鍞鍗曚笉鑳藉垹闄�",
-        icon: "none",
-      });
-      return;
+    const status = item.shippingStatus;
+    if (status === null || status === undefined || status === "") {
+      return "info";
     }
-
-    uni.showModal({
-      title: "鍒犻櫎纭",
-      content: "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
-      success: async res => {
-        if (res.confirm) {
-          try {
-            showLoadingToast("澶勭悊涓�...");
-            await delLedger([row.id]);
-            closeToast();
-            uni.showToast({
-              title: "鍒犻櫎鎴愬姛",
-              icon: "success",
-            });
-            getList();
-          } catch (e) {
-            closeToast();
-            uni.showToast({
-              title: "鍒犻櫎澶辫触锛岃閲嶈瘯",
-              icon: "none",
-            });
-          }
-        }
-      },
-    });
-  };
-  // 澶勭悊鍙拌处淇℃伅鎿嶄綔锛堟煡鐪�/缂栬緫/鏂板锛�
-  const handleInfo = (type, row) => {
-    try {
-      // 璁剧疆鎿嶄綔绫诲瀷
-      uni.setStorageSync("operationType", type);
-      uni.removeStorageSync("editData");
-
-      // 濡傛灉鏄煡鐪嬫垨缂栬緫鎿嶄綔
-      if (type !== "add") {
-        // 楠岃瘉琛屾暟鎹槸鍚﹀瓨鍦�
-        if (!row) {
-          uni.showToast({
-            title: "鏁版嵁涓嶅瓨鍦�",
-            icon: "error",
-          });
-          return;
-        }
-
-        // 妫�鏌ユ潈闄愶細鍙湁褰曞叆浜烘墠鑳界紪杈�
-        if (row.entryPerson != userStore.id) {
-          // 闈炲綍鍏ヤ汉璺宠浆鍒板彧璇昏鎯呴〉闈�
-          uni.setStorageSync("editData", JSON.stringify(row));
-          uni.navigateTo({
-            url: "/pages/sales/salesAccount/view",
-          });
-          return;
-        }
-
-        // 褰曞叆浜虹紪杈戯細瀛樺偍鏁版嵁骞惰烦杞埌缂栬緫椤甸潰
-        uni.setStorageSync("editData", JSON.stringify(row));
-        uni.navigateTo({
-          url: "/pages/sales/salesAccount/detail",
-        });
-        return;
-      }
-
-      // 鏂板鎿嶄綔锛氱洿鎺ヨ烦杞埌缂栬緫椤甸潰
-      uni.navigateTo({
-        url: "/pages/sales/salesAccount/detail",
-      });
-    } catch (error) {
-      console.error("澶勭悊鍙拌处淇℃伅鎿嶄綔澶辫触:", error);
-      uni.showToast({
-        title: "鎿嶄綔澶辫触锛岃閲嶈瘯",
-        icon: "error",
-      });
-    }
+    const statusStr = String(status).trim();
+    const typeMap = {
+      寰呭彂璐�: "info",
+      寰呭鏍�: "info",
+      瀹℃牳涓�: "warning",
+      瀹℃牳鎷掔粷: "danger",
+      瀹℃牳閫氳繃: "success",
+      宸插彂璐�: "success",
+    };
+    return typeMap[statusStr] || "info";
   };
 
-  onShow(() => {
-    // 椤甸潰鏄剧ず鏃跺埛鏂板垪琛�
+  // 鑾峰彇鍙戣揣鐘舵�佹枃鏈�
+  const getShippingStatusText = item => {
+    if (item.shippingDate || item.shippingCarNumber) {
+      return "宸插彂璐�";
+    }
+    const status = item.shippingStatus;
+    if (status === null || status === undefined || status === "") {
+      return "寰呭彂璐�";
+    }
+    const statusStr = String(status).trim();
+    const textMap = {
+      寰呭彂璐�: "寰呭彂璐�",
+      寰呭鏍�: "寰呭鏍�",
+      瀹℃牳涓�: "瀹℃牳涓�",
+      瀹℃牳鎷掔粷: "瀹℃牳鎷掔粷",
+      瀹℃牳閫氳繃: "瀹℃牳閫氳繃",
+      宸插彂璐�: "宸插彂璐�",
+    };
+    return textMap[statusStr] || "寰呭彂璐�";
+  };
+
+  // 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
+  const getStockStatusTagType = item => {
+    if (item.stockStatus === 2) {
+      return "success";
+    } else if (item.stockStatus === 1) {
+      return "warning";
+    }
+    return "info";
+  };
+
+  // 鑾峰彇鍏ュ簱鐘舵�佹爣绛�
+  const getStockStatusLabel = item => {
+    if (item.stockStatus === 2) {
+      return "宸插叆搴�";
+    } else if (item.stockStatus === 1) {
+      return "閮ㄥ垎鍏ュ簱";
+    }
+    return "鏈叆搴�";
+  };
+
+  onMounted(() => {
     getList();
   });
 </script>
 
 <style scoped lang="scss">
   @import "@/styles/sales-common.scss";
-  .detail-buttons {
+
+  .sales-account {
+    min-height: 100vh;
+    background: #f8f9fa;
+  }
+
+  .sales-ledger-status-bar {
     display: flex;
-    gap: 10px;
+    background: #fff;
+    padding: 12px 16px;
+    overflow-x: auto;
+    white-space: nowrap;
+    gap: 12px;
+    border-bottom: 1px solid #eee;
+  }
+
+  .sales-ledger-status-tab {
+    padding: 8px 16px;
+    border-radius: 20px;
+    font-size: 14px;
+    color: #666;
+    background: #f5f7fa;
+    transition: all 0.3s;
+    flex-shrink: 0;
+  }
+
+  .sales-ledger-status-tab.is-active {
+    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+    color: #fff;
+  }
+
+  .search-section {
+    background: #fff;
+    margin: 16px;
+    padding: 12px 16px;
+    border-radius: 12px;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+  }
+
+  .search-bar {
+    display: flex;
+    align-items: center;
+    gap: 12px;
+  }
+
+  .search-input {
+    flex: 1;
+  }
+
+  .search-text {
+    width: 100%;
+  }
+
+  .filter-button {
+    width: 40px;
+    height: 40px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    cursor: pointer;
+  }
+
+  .ledger-list {
+    padding: 0 16px 16px;
+  }
+
+  .ledger-item {
+    background: #ffffff;
+    border-radius: 12px;
+    margin-bottom: 16px;
+    overflow: hidden;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+    padding: 0 16px;
+  }
+
+  .item-header {
+    padding: 16px 0;
+    display: flex;
+    align-items: center;
     justify-content: space-between;
   }
+
+  .item-left {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+  }
+
+  .document-icon {
+    width: 24px;
+    height: 24px;
+    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+    border-radius: 4px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .item-id {
+    font-size: 15px;
+    color: #333;
+    font-weight: 600;
+  }
+
+  .item-tag {
+    .tag-text {
+      font-size: 12px;
+      padding: 4px 8px;
+      border-radius: 4px;
+      background: #f0f2f5;
+      color: #666;
+
+      &.warning {
+        background: #fff3cd;
+        color: #856404;
+      }
+
+      &.success {
+        background: #d4edda;
+        color: #155724;
+      }
+    }
+  }
+
+  .item-details {
+    padding-bottom: 16px;
+  }
+
+  .detail-row {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    margin-bottom: 12px;
+
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+
+  .detail-label {
+    font-size: 13px;
+    color: #777777;
+    min-width: 100px;
+  }
+
+  .detail-value {
+    font-size: 13px;
+    color: #000000;
+    text-align: right;
+    flex: 1;
+    margin-left: 16px;
+    word-break: break-all;
+  }
+
+  .detail-value.highlight {
+    color: #667eea;
+    font-weight: 600;
+  }
+
+  .status-tags {
+    display: flex;
+    gap: 6px;
+    flex-wrap: wrap;
+    justify-content: flex-end;
+  }
+
+  .detail-info {
+    padding: 8px 0;
+  }
+
+  .no-data {
+    padding: 60px 0;
+    text-align: center;
+    color: #999;
+  }
 </style>

--
Gitblit v1.9.3