spring
昨天 3ea1ff641e1c680a5a1727fb4034797bfe65d93e
src/pages/inventoryManagement/stockManagement/index.vue
@@ -2,19 +2,6 @@
  <view class="stock-mgmt-page">
    <PageHeader title="库存管理" @back="goBack" />
    <!-- 标签:合格库存 / 不合格库存 -->
    <view class="tabs-wrap">
      <view
        v-for="tab in tabs"
        :key="tab.name"
        class="tab-item"
        :class="{ active: activeTab === tab.name }"
        @click="activeTab = tab.name"
      >
        <text>{{ tab.label }}</text>
      </view>
    </view>
    <!-- 搜索区域 -->
    <view class="search-section">
      <view class="search-row">
@@ -107,7 +94,7 @@
</template>
<script setup>
import { ref, reactive, toRefs, watch, computed } from 'vue'
import { ref, reactive, toRefs, computed } from 'vue'
import { onShow, onReachBottom } from '@dcloudio/uni-app'
import PageHeader from '@/components/PageHeader.vue'
import {
@@ -117,19 +104,7 @@
  frozenStockInventory,
  thawStockInventory
} from '@/api/inventoryManagement/stockInventory.js'
import {
  getStockUninventoryListPage,
  createStockUnInventory,
  subtractStockUnInventory,
  frozenStockUninventory,
  thawStockUninventory
} from '@/api/inventoryManagement/stockUninventory.js'
const activeTab = ref('qualified')
const tabs = [
  { label: '合格库存', name: 'qualified' },
  { label: '不合格库存', name: 'unqualified' }
]
const tableData = ref([])
const total = ref(0)
const loadStatus = ref('loadmore') // loadmore | loading | nomore | error
@@ -143,15 +118,13 @@
})
const { searchForm, quantityForm } = toRefs(data)
const isQualified = () => activeTab.value === 'qualified'
const getList = () => {
  const isFirstPage = page.current === 1
  if (isFirstPage) {
    uni.showLoading({ title: '加载中...', mask: true })
  }
  const params = { ...page, productName: searchForm.value.productName }
  const api = isQualified() ? getStockInventoryListPage : getStockUninventoryListPage
  api(params)
  getStockInventoryListPage(params)
    .then(res => {
      uni.hideLoading()
      const records = res.data?.records || []
@@ -184,12 +157,6 @@
  getList()
}
watch(activeTab, () => {
  page.current = 1
  loadStatus.value = 'loadmore'
  getList()
})
const handleQuery = () => {
  page.current = 1
  loadStatus.value = 'loadmore'
@@ -197,9 +164,8 @@
}
const goAdd = () => {
  const type = isQualified() ? '0' : '1'
  uni.navigateTo({
    url: `/pages/inventoryManagement/stockManagement/add?type=${type}`
    url: `/pages/inventoryManagement/stockManagement/add?type=0`
  })
}
@@ -220,12 +186,11 @@
  try {
    uni.setStorageSync('stockSubtractRecord', JSON.stringify({
      item: row,
      type: isQualified() ? '0' : '1'
      type: '0'
    }))
  } catch (e) {}
  const typeParam = isQualified() ? '0' : '1'
  uni.navigateTo({
    url: `/pages/inventoryManagement/stockManagement/subtract?type=${typeParam}&id=${row.id}`
    url: `/pages/inventoryManagement/stockManagement/subtract?type=0&id=${row.id}`
  })
}
const openFrozen = (row) => {
@@ -256,9 +221,9 @@
  const base = { id, lockedQuantity: num }
  let promise
  if (quantityOp.value === 'frozen') {
    promise = isQualified() ? frozenStockInventory(base) : frozenStockUninventory(base)
    promise = frozenStockInventory(base)
  } else {
    promise = isQualified() ? thawStockInventory(base) : thawStockUninventory(base)
    promise = thawStockInventory(base)
  }
  promise.then(() => {
    uni.showToast({ title: '操作成功', icon: 'success' })
@@ -272,7 +237,7 @@
  try {
    uni.setStorageSync('stockDetailItem', JSON.stringify({
      item,
      type: isQualified() ? '0' : '1'
      type: '0'
    }))
  } catch (e) {}
  if (!item.id) {
@@ -294,25 +259,6 @@
  min-height: 100vh;
  background: #f5f5f5;
  padding-bottom: 120rpx;
}
.tabs-wrap {
  display: flex;
  background: #fff;
  padding: 24rpx;
  gap: 24rpx;
}
.tab-item {
  flex: 1;
  text-align: center;
  padding: 20rpx;
  border-radius: 12rpx;
  background: #f0f0f0;
  font-size: 28rpx;
  color: #666;
}
.tab-item.active {
  background: #2979ff;
  color: #fff;
}
.search-section {
  background: #fff;