spring
17 小时以前 ce92cb3a3645ca473798698522f477c8c2eb2e7f
src/pages/consumablesLogistics/receiptManagement/index.vue
@@ -28,13 +28,15 @@
            <view class="card-body">
              <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.stockInNum }}</text></view>
              <view class="row"><text class="l">入库数量</text><text class="r highlight">{{ item.qualitity ?? item.stockInNum }}</text></view>
              <view class="row"><text class="l">采购员</text><text class="r">{{ item.purchaser || '-' }}</text></view>
              <view class="row"><text class="l">入库人</text><text class="r">{{ item.createBy }}</text></view>
              <view class="row" v-if="item.recordType !== undefined"><text class="l">来源</text><text class="r">{{ getRecordType(item.recordType) || item.recordType }}</text></view>
            </view>
          </view>
          <view class="card-actions">
            <view class="btn-delete" @click.stop="handleDeleteSingle(item)">删除</view>
            <view v-if="hasCReceiptEdit" class="btn-edit" @click.stop="handleEdit(item)">编辑</view>
            <view v-if="hasCReceiptCancel" class="btn-delete" @click.stop="handleDeleteSingle(item)">删除</view>
          </view>
        </view>
      </view>
@@ -43,15 +45,43 @@
    <view class="load-more-wrap" v-if="tableData.length > 0">
      <u-loadmore :status="loadStatus" @loadmore="loadMore" />
    </view>
    <!-- 编辑弹窗 -->
    <up-popup :show="showEditModal" mode="bottom" @close="showEditModal = false">
      <view class="edit-popup">
        <view class="popup-header">
          <text class="popup-title">编辑入库</text>
        </view>
        <scroll-view class="popup-body" scroll-y>
          <view class="form-row">
            <text class="form-label required">数量</text>
            <up-input v-model="editForm.qualitity" type="number" placeholder="请输入数量" />
          </view>
          <view class="form-row">
            <text class="form-label required">采购员</text>
            <up-input v-model="editForm.purchaser" placeholder="请输入采购员" />
          </view>
        </scroll-view>
        <view class="popup-footer">
          <view class="btn-cancel" @click="showEditModal = false">取消</view>
          <view class="btn-ok" @click="handleEditSubmit">确认</view>
        </view>
      </view>
    </up-popup>
  </view>
</template>
<script setup>
import { reactive, ref, toRefs } from "vue";
import { computed, reactive, ref, toRefs } from "vue";
import { onReachBottom, onShow } from "@dcloudio/uni-app";
import PageHeader from "@/components/PageHeader.vue";
import request from "@/utils/request";
import { findAllQualifiedStockInRecordTypeOptions } from "@/api/basicData/enum.js";
import { checkPermi } from "@/utils/permission";
import { editStockInStock } from "@/api/consumablesLogistics/consumablesInRecord.js";
const hasCReceiptEdit = computed(() => checkPermi(['c_receipt_edit']))
const hasCReceiptCancel = computed(() => checkPermi(['c_receipt_cancel']))
const stockRecordTypeOptions = ref([]);
const tableData = ref([]);
@@ -145,6 +175,7 @@
const handleDeleteSingle = (item) => {
  if (!item?.id) return;
  if (!hasCReceiptCancel.value) return
  uni.showModal({
    title: "删除",
    content: "确认删除该条入库记录?",
@@ -165,6 +196,53 @@
    },
  });
};
// ---------------- 编辑入库 ----------------
const showEditModal = ref(false)
const editForm = reactive({
  id: null,
  qualitity: '',
  purchaser: ''
})
const handleEdit = (row) => {
  if (!hasCReceiptEdit.value) return
  editForm.id = row?.id ?? null
  editForm.qualitity = row?.qualitity ?? row?.stockInNum ?? ''
  editForm.purchaser = row?.purchaser ?? ''
  showEditModal.value = true
}
const handleEditSubmit = () => {
  if (!hasCReceiptEdit.value) return
  const q = Number(editForm.qualitity)
  if (!Number.isFinite(q) || q <= 0) {
    uni.showToast({ title: "请输入正确数量", icon: "none" })
    return
  }
  if (!editForm.purchaser) {
    uni.showToast({ title: "请输入采购员", icon: "none" })
    return
  }
  uni.showLoading({ title: "保存中...", mask: true })
  editStockInStock({
    id: editForm.id,
    qualitity: q,
    purchaser: editForm.purchaser
  })
    .then(() => {
      uni.showToast({ title: "编辑成功", icon: "success" })
      showEditModal.value = false
      getList()
    })
    .catch(() => {
      uni.showToast({ title: "编辑失败", icon: "none" })
    })
    .finally(() => {
      uni.hideLoading()
    })
}
const goBack = () => uni.navigateBack();
@@ -200,14 +278,91 @@
  margin-top: 16rpx;
  padding-top: 16rpx;
  border-top: 1rpx solid #eee;
  width: 100%;
  text-align: center;
}
.btn-edit {
  color: #2979ff;
  font-size: 28rpx;
  padding: 12rpx 32rpx;
  border-radius: 999rpx;
  border: 1rpx solid rgba(41, 121, 255, 0.25);
  background: rgba(41, 121, 255, 0.06);
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-delete {
  color: #f56c6c;
  font-size: 28rpx;
  padding: 12rpx 36rpx;
  padding: 12rpx 32rpx;
  border-radius: 999rpx;
  border: 1rpx solid rgba(245, 108, 108, 0.55);
  background: rgba(245, 108, 108, 0.08);
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* 编辑弹窗样式 */
.edit-popup {
  background: #fff;
  border-radius: 24rpx 24rpx 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.popup-header {
  padding: 24rpx;
  border-bottom: 1rpx solid #eee;
  text-align: center;
}
.popup-title {
  font-size: 30rpx;
  font-weight: 500;
  color: #333;
}
.popup-body {
  padding: 24rpx 24rpx 0;
  max-height: 60vh;
}
.form-row {
  margin-bottom: 24rpx;
}
.form-label {
  display: block;
  font-size: 26rpx;
  color: #666;
  margin-bottom: 12rpx;
}
.form-label.required:before {
  content: '*';
  color: #f56c6c;
  margin-right: 6rpx;
}
.popup-footer {
  display: flex;
  gap: 24rpx;
  padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
  border-top: 1rpx solid #eee;
}
.btn-cancel,
.btn-ok {
  flex: 1;
  height: 88rpx;
  border-radius: 999rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30rpx;
}
.btn-cancel {
  background: #f0f0f0;
  color: #666;
}
.btn-ok {
  background: #2979ff;
  color: #fff;
}
.no-data { text-align: center; padding: 60rpx 0; color: #999; font-size: 28rpx; }
.load-more-wrap { padding: 24rpx 24rpx 8rpx; }