huminmin
7 天以前 7529786b5f409ffa7ea0b1d5c3f550c4d0a83d3b
src/pages/inventoryManagement/stockManagement/subtract.vue
@@ -28,7 +28,7 @@
          <text class="form-label">毛重(吨)</text>
          <up-input
            v-model="form.grossWeight"
            type="number"
            type="digit"
            placeholder="请输入毛重"
          />
        </view>
@@ -36,7 +36,7 @@
          <text class="form-label">皮重(吨)</text>
          <up-input
            v-model="form.tareWeight"
            type="number"
            type="digit"
            placeholder="请输入皮重"
          />
        </view>
@@ -44,7 +44,7 @@
          <text class="form-label">净重(吨)</text>
          <up-input
            v-model="form.netWeight"
            type="number"
            type="digit"
            disabled
            placeholder="自动计算"
          />
@@ -92,7 +92,6 @@
import dayjs from 'dayjs'
import PageHeader from '@/components/PageHeader.vue'
import { subtractStockInventory } from '@/api/inventoryManagement/stockInventory.js'
import { subtractStockUnInventory } from '@/api/inventoryManagement/stockUninventory.js'
const form = reactive({
  id: undefined,
@@ -124,20 +123,12 @@
  remark: ''
})
const type = ref('0') // 0 合格库存,1 不合格库存
const type = ref('0') // 固定合格库存
const showWeighingDatePicker = ref(false)
const weighingDateValue = ref(Date.now())
const maxAllowedNetWeight = computed(() => {
  const v = form.unLockedQuantity ?? form.qualitity
  const n = Number(v)
  return !isNaN(n) ? n : 0
})
onLoad((options) => {
  if (options && options.type != null) {
    type.value = options.type
  }
  type.value = '0'
  const cached = uni.getStorageSync('stockSubtractRecord')
  if (cached) {
    try {
@@ -189,14 +180,8 @@
    uni.showToast({ title: '记录信息缺失,无法出库', icon: 'none' })
    return
  }
  const net = Number(form.netWeight)
  if (!isNaN(net) && net > 0 && maxAllowedNetWeight.value > 0 && net > maxAllowedNetWeight.value) {
    uni.showToast({ title: `净重不能大于可用库存 ${maxAllowedNetWeight.value}`, icon: 'none' })
    return
  }
  const payload = { ...form }
  const api = type.value === '0' ? subtractStockInventory : subtractStockUnInventory
  api(payload)
  subtractStockInventory(payload)
    .then(() => {
      uni.showToast({ title: '出库成功', icon: 'success' })
      setTimeout(() => {