spring
8 小时以前 3ea1ff641e1c680a5a1727fb4034797bfe65d93e
src/pages/consumablesLogistics/stockManagement/subtract.vue
@@ -25,23 +25,23 @@
          <text class="form-label required">出库数量</text>
          <up-input v-model="form.stockOutNum" type="number" :placeholder="'最大' + stockRecord.unLockedQuantity" />
        </view>
        <view class="form-row" v-if="isQualified">
        <view class="form-row">
          <text class="form-label">车牌号</text>
          <up-input v-model="form.licensePlateNo" placeholder="请输入车牌号" />
        </view>
        <view class="form-row" v-if="isQualified">
        <view class="form-row">
          <text class="form-label">毛重(吨)</text>
          <up-input v-model="form.grossWeight" type="number" placeholder="请输入毛重" />
        </view>
        <view class="form-row" v-if="isQualified">
        <view class="form-row">
          <text class="form-label">皮重(吨)</text>
          <up-input v-model="form.tareWeight" type="number" placeholder="请输入皮重" />
        </view>
        <view class="form-row" v-if="isQualified">
        <view class="form-row">
          <text class="form-label">净重(吨)</text>
          <up-input v-model="form.netWeight" type="number" disabled placeholder="自动计算" />
        </view>
        <view class="form-row" v-if="isQualified">
        <view class="form-row">
          <text class="form-label">过磅日期</text>
          <view class="selector-trigger" @click="openWeighingDatePicker">
            <text class="selector-text" :class="{ placeholder: !form.weighingDate }">
@@ -50,7 +50,7 @@
            <up-icon name="calendar" size="16" color="#999"></up-icon>
          </view>
        </view>
        <view class="form-row" v-if="isQualified">
        <view class="form-row">
          <text class="form-label">过磅员</text>
          <up-input v-model="form.weighingOperator" placeholder="请输入过磅员" />
        </view>
@@ -83,10 +83,9 @@
import dayjs from "dayjs";
import PageHeader from "@/components/PageHeader.vue";
import { subtractConsumablesIn } from "@/api/consumablesLogistics/consumablesIn.js";
import { subtractConsumablesUnInventory } from "@/api/consumablesLogistics/consumablesUninventory.js";
const type = ref("0");
const isQualified = computed(() => type.value === "0");
const isQualified = computed(() => true);
const stockRecord = reactive({
  id: "",
@@ -110,9 +109,7 @@
const weighingDateValue = ref(Date.now());
onLoad((options) => {
  if (options && options.type != null) {
    type.value = options.type;
  }
  type.value = "0";
  const cached = uni.getStorageSync("stockSubtractRecord");
  if (cached) {
    try {
@@ -164,8 +161,19 @@
    uni.showToast({ title: `请输入 1~${stockRecord.unLockedQuantity} 之间的数量`, icon: "none" });
    return;
  }
  const api = isQualified.value ? subtractConsumablesIn : subtractConsumablesUnInventory;
  api({
  const net = Number(form.netWeight);
  if (!isNaN(net) && net > 0) {
    const max = Number(stockRecord.unLockedQuantity) || 0;
    if (max > 0 && net > max) {
      uni.showToast({ title: `净重不能大于可用库存 ${max}`, icon: "none" });
      return;
    }
    if (net > outNum) {
      uni.showToast({ title: `净重不能大于出库数量 ${outNum}`, icon: "none" });
      return;
    }
  }
  subtractConsumablesIn({
    id: stockRecord.id,
    stockOutNum: outNum,
    licensePlateNo: form.licensePlateNo,