From f6427b5dea54bbb8761fade351e9f86404b2fb61 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 30 三月 2026 10:22:59 +0800
Subject: [PATCH] fix: 规格型号搜索
---
src/pages/inventoryManagement/stockManagement/index.vue | 81 +++++++---------------------------------
1 files changed, 14 insertions(+), 67 deletions(-)
diff --git a/src/pages/inventoryManagement/stockManagement/index.vue b/src/pages/inventoryManagement/stockManagement/index.vue
index e36fac0..0a787da 100644
--- a/src/pages/inventoryManagement/stockManagement/index.vue
+++ b/src/pages/inventoryManagement/stockManagement/index.vue
@@ -2,26 +2,14 @@
<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">
<view class="search-input-wrap">
<up-input
- v-model="searchForm.productName"
- placeholder="浜у搧澶х被"
+ v-model="searchForm.model"
+
+ placeholder="瑙勬牸鍨嬪彿"
clearable
/>
</view>
@@ -54,7 +42,7 @@
<view class="row"><text class="l">瑙勬牸鍨嬪彿</text><text class="r">{{ item.model }}</text></view>
<view class="row"><text class="l">鍗曚綅</text><text class="r">{{ item.unit }}</text></view>
<view class="row"><text class="l">鎬诲簱瀛樻暟</text><text class="r highlight">{{ item.qualitity }}</text></view>
- <view class="row"><text class="l">鍐荤粨鏁伴噺</text><text class="r">{{ item.lockedQuantity || 0 }}</text></view>
+ <!-- <view class="row"><text class="l">鍐荤粨鏁伴噺</text><text class="r">{{ item.lockedQuantity || 0 }}</text></view> -->
<view class="row"><text class="l">鍙敤搴撳瓨</text><text class="r">{{ item.unLockedQuantity ?? (item.qualitity - (item.lockedQuantity || 0)) }}</text></view>
<view class="row"><text class="l">鏈�杩戞洿鏂版椂闂�</text><text class="r">{{ item.updateTime }}</text></view>
</view>
@@ -65,11 +53,11 @@
:class="{ disabled: !(item.unLockedQuantity > 0) }"
@click="openSubtract(item)"
>鍑哄簱</view>
- <view
+ <!-- <view
class="btn-link btn-link-warn"
v-if="item.unLockedQuantity > 0"
@click="openFrozen(item)"
- >鍐荤粨</view>
+ >鍐荤粨</view> -->
<view
class="btn-link btn-link-plain"
v-if="(item.lockedQuantity || 0) > 0"
@@ -107,7 +95,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 +105,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 +119,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 +158,6 @@
getList()
}
-watch(activeTab, () => {
- page.current = 1
- loadStatus.value = 'loadmore'
- getList()
-})
-
const handleQuery = () => {
page.current = 1
loadStatus.value = 'loadmore'
@@ -197,9 +165,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 +187,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 +222,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 +238,7 @@
try {
uni.setStorageSync('stockDetailItem', JSON.stringify({
item,
- type: isQualified() ? '0' : '1'
+ type: '0'
}))
} catch (e) {}
if (!item.id) {
@@ -294,25 +260,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;
--
Gitblit v1.9.3