| | |
| | | <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.stockOutNum }}</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 class="row"><text class="l">毛重(吨)</text><text class="r">{{ item.grossWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">皮重(吨)</text><text class="r">{{ item.tareWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">净重(吨)</text><text class="r">{{ item.netWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">过磅日期</text><text class="r">{{ item.weighingDate || '-' }}</text></view> |
| | | <view class="row"><text class="l">过磅员</text><text class="r">{{ item.weighingOperator || '-' }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="card-actions"> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">出库信息</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">车牌号</text> |
| | | <text class="value">{{ detail.licensePlateNo || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">毛重(吨)</text> |
| | | <text class="value">{{ detail.grossWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">皮重(吨)</text> |
| | | <text class="value">{{ detail.tareWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">净重(吨)</text> |
| | | <text class="value">{{ detail.netWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">过磅日期</text> |
| | | <text class="value">{{ detail.weighingDate || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">过磅员</text> |
| | | <text class="value">{{ detail.weighingOperator || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="empty"> |
| | | <text class="empty-text">暂无详情数据</text> |
| | |
| | | stockOutNum: d.stockOutNum, |
| | | createBy: d.createBy, |
| | | recordType: d.recordType, |
| | | licensePlateNo: d.licensePlateNo, |
| | | grossWeight: d.grossWeight, |
| | | tareWeight: d.tareWeight, |
| | | netWeight: d.netWeight, |
| | | weighingDate: d.weighingDate, |
| | | weighingOperator: d.weighingOperator, |
| | | purchaser: d.purchaser, |
| | | }; |
| | | } |
| | | |
| | |
| | | <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">{{ 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="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">车牌号</text> |
| | | <text class="value">{{ detail.licensePlateNo || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">毛重(吨)</text> |
| | | <text class="value">{{ detail.grossWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">皮重(吨)</text> |
| | | <text class="value">{{ detail.tareWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">净重(吨)</text> |
| | | <text class="value">{{ detail.netWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">过磅日期</text> |
| | | <text class="value">{{ detail.weighingDate || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">过磅员</text> |
| | | <text class="value">{{ detail.weighingOperator || '-' }}</text> |
| | | <text class="label">采购员</text> |
| | | <text class="value">{{ detail.purchaser || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | stockInNum: d.stockInNum, |
| | | createBy: d.createBy, |
| | | recordType: d.recordType, |
| | | licensePlateNo: d.licensePlateNo, |
| | | grossWeight: d.grossWeight, |
| | | tareWeight: d.tareWeight, |
| | | netWeight: d.netWeight, |
| | | weighingDate: d.weighingDate, |
| | | weighingOperator: d.weighingOperator, |
| | | purchaser: d.purchaser, |
| | | }; |
| | | } |
| | | |
| | |
| | | </view> |
| | | |
| | | <view class="form-section"> |
| | | <view class="section-title">过磅信息</view> |
| | | <view class="section-title">入库信息</view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">车牌号</text> |
| | | <up-input v-model="form.licensePlateNo" placeholder="请输入车牌号" /> |
| | | <text class="form-label required">数量</text> |
| | | <up-input v-model="form.qualitity" type="number" placeholder="请输入数量" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">毛重(吨)</text> |
| | | <up-input v-model="form.grossWeight" type="digit" placeholder="请输入毛重" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">皮重(吨)</text> |
| | | <up-input v-model="form.tareWeight" type="digit" placeholder="请输入皮重" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">净重(吨)</text> |
| | | <up-input v-model="form.netWeight" type="digit" disabled placeholder="自动计算" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">过磅日期</text> |
| | | <view class="selector-trigger" @click="openWeighingDatePicker"> |
| | | <text class="selector-text" :class="{ placeholder: !form.weighingDate }"> |
| | | {{ form.weighingDate || "请选择过磅日期" }} |
| | | </text> |
| | | <up-icon name="calendar" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">过磅员</text> |
| | | <up-input v-model="form.weighingOperator" placeholder="请输入过磅员" /> |
| | | <text class="form-label required">采购员</text> |
| | | <up-input v-model="form.purchaser" placeholder="请输入采购员" /> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | </view> |
| | | </up-popup> |
| | | |
| | | <up-popup :show="showWeighingDatePicker" mode="bottom" @close="showWeighingDatePicker = false"> |
| | | <up-datetime-picker |
| | | :show="true" |
| | | v-model="weighingDateValue" |
| | | mode="datetime" |
| | | @confirm="onWeighingDateConfirm" |
| | | @cancel="showWeighingDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, reactive, ref, watch } from "vue"; |
| | | import { computed, reactive, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { createConsumablesIn } from "@/api/consumablesLogistics/consumablesIn.js"; |
| | | import { productModelList } from "@/api/basicData/productModel.js"; |
| | |
| | | productModelName: "", |
| | | unit: "", |
| | | productType: undefined, |
| | | licensePlateNo: "", |
| | | grossWeight: "", |
| | | tareWeight: "", |
| | | netWeight: "", |
| | | weighingDate: "", |
| | | weighingOperator: "", |
| | | qualitity: "", |
| | | purchaser: "", |
| | | remark: "", |
| | | }); |
| | | |
| | |
| | | }); |
| | | const productList = ref([]); |
| | | const productLoading = ref(false); |
| | | |
| | | const showWeighingDatePicker = ref(false); |
| | | const weighingDateValue = ref(Date.now()); |
| | | |
| | | onLoad((options) => { |
| | | type.value = "0"; |
| | |
| | | showProductPopup.value = false; |
| | | }; |
| | | |
| | | const computeNetWeight = () => { |
| | | const gross = Number(form.grossWeight); |
| | | const tare = Number(form.tareWeight); |
| | | if (!isNaN(gross) && !isNaN(tare)) { |
| | | const net = Number((gross - tare).toFixed(2)); |
| | | form.netWeight = net > 0 ? net : 0; |
| | | } else { |
| | | form.netWeight = ""; |
| | | } |
| | | }; |
| | | |
| | | watch( |
| | | () => [form.grossWeight, form.tareWeight], |
| | | () => { |
| | | computeNetWeight(); |
| | | } |
| | | ); |
| | | |
| | | const openWeighingDatePicker = () => { |
| | | weighingDateValue.value = form.weighingDate |
| | | ? dayjs(form.weighingDate, "YYYY-MM-DD HH:mm:ss").valueOf() |
| | | : Date.now(); |
| | | showWeighingDatePicker.value = true; |
| | | }; |
| | | |
| | | const onWeighingDateConfirm = (e) => { |
| | | const ts = e?.value ?? weighingDateValue.value; |
| | | form.weighingDate = dayjs(ts).format("YYYY-MM-DD HH:mm:ss"); |
| | | showWeighingDatePicker.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | if (!form.productName || !form.productModelId) { |
| | | uni.showToast({ title: "请选择产品", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.licensePlateNo) { |
| | | uni.showToast({ title: "请输入车牌号", icon: "none" }); |
| | | if (!form.qualitity || Number(form.qualitity) <= 0) { |
| | | uni.showToast({ title: "请输入数量", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.grossWeight || Number(form.grossWeight) <= 0) { |
| | | uni.showToast({ title: "请输入毛重", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.tareWeight || Number(form.tareWeight) <= 0) { |
| | | uni.showToast({ title: "请输入皮重", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.weighingDate) { |
| | | uni.showToast({ title: "请选择过磅日期", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.weighingOperator) { |
| | | uni.showToast({ title: "请输入过磅员", icon: "none" }); |
| | | if (!form.purchaser) { |
| | | uni.showToast({ title: "请输入采购员", icon: "none" }); |
| | | return; |
| | | } |
| | | const payload = { |
| | |
| | | productModelName: form.productModelName, |
| | | unit: form.unit, |
| | | productType: form.productType, |
| | | licensePlateNo: form.licensePlateNo, |
| | | grossWeight: form.grossWeight, |
| | | tareWeight: form.tareWeight, |
| | | netWeight: form.netWeight, |
| | | weighingDate: form.weighingDate, |
| | | weighingOperator: form.weighingOperator, |
| | | qualitity: Number(form.qualitity), |
| | | purchaser: form.purchaser, |
| | | remark: form.remark, |
| | | }; |
| | | createConsumablesIn(payload) |
| | |
| | | <up-input v-model="form.stockOutNum" type="number" :placeholder="'最大' + stockRecord.unLockedQuantity" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">车牌号</text> |
| | | <up-input v-model="form.licensePlateNo" placeholder="请输入车牌号" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">毛重(吨)</text> |
| | | <up-input v-model="form.grossWeight" type="digit" placeholder="请输入毛重" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">皮重(吨)</text> |
| | | <up-input v-model="form.tareWeight" type="digit" placeholder="请输入皮重" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">净重(吨)</text> |
| | | <up-input v-model="form.netWeight" type="digit" disabled placeholder="自动计算" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">过磅日期</text> |
| | | <view class="selector-trigger" @click="openWeighingDatePicker"> |
| | | <text class="selector-text" :class="{ placeholder: !form.weighingDate }"> |
| | | {{ form.weighingDate || "请选择过磅日期" }} |
| | | </text> |
| | | <up-icon name="calendar" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">过磅员</text> |
| | | <up-input v-model="form.weighingOperator" placeholder="请输入过磅员" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">备注</text> |
| | | <up-input v-model="form.remark" type="textarea" placeholder="选填" /> |
| | | </view> |
| | |
| | | <view class="bottom-bar"> |
| | | <view class="btn-submit" @click="handleSubmit">提交</view> |
| | | </view> |
| | | |
| | | <up-popup :show="showWeighingDatePicker" mode="bottom" @close="showWeighingDatePicker = false"> |
| | | <up-datetime-picker |
| | | :show="true" |
| | | v-model="weighingDateValue" |
| | | mode="datetime" |
| | | @confirm="onWeighingDateConfirm" |
| | | @cancel="showWeighingDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, reactive, ref, watch } from "vue"; |
| | | import { computed, reactive, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { subtractConsumablesIn } from "@/api/consumablesLogistics/consumablesIn.js"; |
| | | |
| | |
| | | |
| | | const form = reactive({ |
| | | stockOutNum: "", |
| | | licensePlateNo: "", |
| | | grossWeight: "", |
| | | tareWeight: "", |
| | | netWeight: "", |
| | | weighingDate: "", |
| | | weighingOperator: "", |
| | | remark: "", |
| | | }); |
| | | |
| | | const showWeighingDatePicker = ref(false); |
| | | const weighingDateValue = ref(Date.now()); |
| | | |
| | | onLoad((options) => { |
| | | type.value = "0"; |
| | |
| | | } |
| | | }); |
| | | |
| | | const computeNetWeight = () => { |
| | | const gross = Number(form.grossWeight); |
| | | const tare = Number(form.tareWeight); |
| | | if (!isNaN(gross) && !isNaN(tare)) { |
| | | const net = Number((gross - tare).toFixed(2)); |
| | | form.netWeight = net > 0 ? net : 0; |
| | | } else { |
| | | form.netWeight = ""; |
| | | } |
| | | }; |
| | | |
| | | watch( |
| | | () => [form.grossWeight, form.tareWeight], |
| | | () => computeNetWeight() |
| | | ); |
| | | |
| | | const openWeighingDatePicker = () => { |
| | | weighingDateValue.value = form.weighingDate |
| | | ? dayjs(form.weighingDate, "YYYY-MM-DD HH:mm:ss").valueOf() |
| | | : Date.now(); |
| | | showWeighingDatePicker.value = true; |
| | | }; |
| | | |
| | | const onWeighingDateConfirm = (e) => { |
| | | const ts = e?.value ?? weighingDateValue.value; |
| | | form.weighingDate = dayjs(ts).format("YYYY-MM-DD HH:mm:ss"); |
| | | showWeighingDatePicker.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | const outNum = Number(form.stockOutNum); |
| | | if (!outNum || outNum <= 0 || outNum > Number(stockRecord.unLockedQuantity)) { |
| | |
| | | subtractConsumablesIn({ |
| | | id: stockRecord.id, |
| | | stockOutNum: outNum, |
| | | licensePlateNo: form.licensePlateNo, |
| | | grossWeight: form.grossWeight, |
| | | tareWeight: form.tareWeight, |
| | | netWeight: form.netWeight, |
| | | weighingDate: form.weighingDate, |
| | | weighingOperator: form.weighingOperator, |
| | | remark: form.remark, |
| | | }) |
| | | .then(() => { |
| | |
| | | <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.stockOutNum }}</text></view> |
| | | <view class="row"><text class="l">出库人</text><text class="r">{{ item.createBy }}</text></view> |
| | | <view class="row"><text class="l">采购员</text><text class="r">{{ item.purchaser || 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 class="row"><text class="l">毛重(吨)</text><text class="r">{{ item.grossWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">皮重(吨)</text><text class="r">{{ item.tareWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">净重(吨)</text><text class="r">{{ item.netWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">过磅日期</text><text class="r">{{ item.weighingDate || '-' }}</text></view> |
| | | <view class="row"><text class="l">过磅员</text><text class="r">{{ item.weighingOperator || '-' }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="card-actions"> |
| | |
| | | <text class="value value-num">{{ detail.stockOutNum ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">出库人</text> |
| | | <text class="value">{{ detail.createBy || '-' }}</text> |
| | | <text class="label">采购员</text> |
| | | <text class="value">{{ detail.purchaser || detail.createBy || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">来源</text> |
| | | <text class="value">{{ getRecordType(detail.recordType) || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 出库信息 --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">出库信息</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">车牌号</text> |
| | | <text class="value">{{ detail.licensePlateNo || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">毛重(吨)</text> |
| | | <text class="value">{{ detail.grossWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">皮重(吨)</text> |
| | | <text class="value">{{ detail.tareWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">净重(吨)</text> |
| | | <text class="value">{{ detail.netWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">过磅日期</text> |
| | | <text class="value">{{ detail.weighingDate || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">过磅员</text> |
| | | <text class="value">{{ detail.weighingOperator || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | stockOutNum: d.stockOutNum, |
| | | createBy: d.createBy, |
| | | recordType: d.recordType, |
| | | licensePlateNo: d.licensePlateNo, |
| | | grossWeight: d.grossWeight, |
| | | tareWeight: d.tareWeight, |
| | | netWeight: d.netWeight, |
| | | weighingDate: d.weighingDate, |
| | | weighingOperator: d.weighingOperator |
| | | purchaser: d.purchaser |
| | | } |
| | | } |
| | | |
| | |
| | | <template> |
| | | <template> |
| | | <up-popup :show="dialogFormVisible" mode="bottom" :round="10" closeable @close="closeDia"> |
| | | <view class="form-popup"> |
| | | <view class="popup-header"> |
| | |
| | | supplierName: form.value.supplierName || '', |
| | | itemType: '', |
| | | inboundNum: 0, |
| | | inboundDate: '', |
| | | inboundDate: getCurrentDate(), |
| | | taxRate: null, |
| | | taxInclusiveUnitPrice: 0, |
| | | taxInclusiveTotalPrice: 0, |
| | |
| | | |
| | | const openDatePicker = (index) => { |
| | | currentEditIndex.value = index |
| | | const currentDate = productList.value[index]?.inboundDate |
| | | dateValue.value = currentDate ? new Date(currentDate).getTime() : Date.now() |
| | | showDatePicker.value = true |
| | | } |
| | | |
| | |
| | | v-model="form.inboundDate" |
| | | readonly |
| | | placeholder="请选择入库日期" |
| | | @click="showDatePicker = true" |
| | | @click="openInboundDatePicker" |
| | | /> |
| | | <template #right> |
| | | <up-icon name="calendar" @click="showDatePicker = true"></up-icon> |
| | | <up-icon name="calendar" @click="openInboundDatePicker"></up-icon> |
| | | </template> |
| | | </u-form-item> |
| | | </view> |
| | |
| | | showDatePicker.value = false |
| | | } |
| | | |
| | | const openInboundDatePicker = () => { |
| | | dateValue.value = form.value.inboundDate ? new Date(form.value.inboundDate).getTime() : Date.now() |
| | | showDatePicker.value = true |
| | | } |
| | | |
| | | // 计算含税总价 |
| | | const calculateTotalPrice = () => { |
| | | const num = parseFloat(form.value.inboundNum) || 0 |
| | |
| | | grossWeight: '', |
| | | tareWeight: '', |
| | | netWeight: '', |
| | | weighingDate: '', |
| | | weighingDate: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
| | | weighingOperator: '', |
| | | qualitity: '', |
| | | remark: '' |
| | |
| | | </view> |
| | | |
| | | <view class="form-section"> |
| | | <view class="section-title">出库/过磅信息</view> |
| | | <view class="section-title">出库信息</view> |
| | | <view class="form-row"> |
| | | <text class="form-label">车牌号</text> |
| | | <up-input v-model="form.licensePlateNo" placeholder="请输入车牌号" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">毛重(吨)</text> |
| | | <up-input |
| | | v-model="form.grossWeight" |
| | | type="digit" |
| | | placeholder="请输入毛重" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">皮重(吨)</text> |
| | | <up-input |
| | | v-model="form.tareWeight" |
| | | type="digit" |
| | | placeholder="请输入皮重" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">净重(吨)</text> |
| | | <up-input |
| | | v-model="form.netWeight" |
| | | type="digit" |
| | | disabled |
| | | placeholder="自动计算" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">过磅日期</text> |
| | | <view class="selector-trigger" @click="openWeighingDatePicker"> |
| | | <text class="selector-text" :class="{ placeholder: !form.weighingDate }"> |
| | | {{ form.weighingDate || '请选择过磅日期' }} |
| | | </text> |
| | | <up-icon name="calendar" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">过磅员</text> |
| | | <up-input v-model="form.weighingOperator" placeholder="请输入过磅员" /> |
| | | <text class="form-label">出库数量</text> |
| | | <up-input v-model="form.stockOutNum" type="number" :placeholder="'最大' + (form.unLockedQuantity ?? 0)" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">备注</text> |
| | |
| | | <view class="bottom-bar"> |
| | | <view class="btn-submit" @click="handleSubmit">出库</view> |
| | | </view> |
| | | |
| | | <!-- 过磅日期选择器 --> |
| | | <up-popup :show="showWeighingDatePicker" mode="bottom" @close="showWeighingDatePicker = false"> |
| | | <up-datetime-picker |
| | | :show="true" |
| | | v-model="weighingDateValue" |
| | | mode="datetime" |
| | | @confirm="onWeighingDateConfirm" |
| | | @cancel="showWeighingDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, watch, computed } from 'vue' |
| | | import { ref, reactive, computed } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import dayjs from 'dayjs' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { subtractStockInventory } from '@/api/inventoryManagement/stockInventory.js' |
| | | |
| | |
| | | createTime: '', |
| | | updateTime: '', |
| | | version: undefined, |
| | | // 出库/过磅信息 |
| | | licensePlateNo: '', |
| | | grossWeight: '', |
| | | tareWeight: '', |
| | | netWeight: '', |
| | | weighingDate: '', |
| | | weighingOperator: '', |
| | | // 出库信息 |
| | | stockOutNum: '', |
| | | remark: '' |
| | | }) |
| | | |
| | | const type = ref('0') // 固定合格库存 |
| | | const showWeighingDatePicker = ref(false) |
| | | const weighingDateValue = ref(Date.now()) |
| | | |
| | | onLoad((options) => { |
| | | type.value = '0' |
| | |
| | | } |
| | | }) |
| | | |
| | | // 净重 = 毛重 - 皮重 |
| | | const computeNetWeight = () => { |
| | | const gross = Number(form.grossWeight) |
| | | const tare = Number(form.tareWeight) |
| | | if (!isNaN(gross) && !isNaN(tare)) { |
| | | const net = Number((gross - tare).toFixed(2)) |
| | | form.netWeight = net > 0 ? net : 0 |
| | | } else { |
| | | form.netWeight = '' |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => [form.grossWeight, form.tareWeight], |
| | | () => { |
| | | computeNetWeight() |
| | | } |
| | | ) |
| | | |
| | | const openWeighingDatePicker = () => { |
| | | weighingDateValue.value = form.weighingDate |
| | | ? dayjs(form.weighingDate, 'YYYY-MM-DD HH:mm:ss').valueOf() |
| | | : Date.now() |
| | | showWeighingDatePicker.value = true |
| | | } |
| | | |
| | | const onWeighingDateConfirm = (e) => { |
| | | const ts = e?.value ?? weighingDateValue.value |
| | | form.weighingDate = dayjs(ts).format('YYYY-MM-DD HH:mm:ss') |
| | | showWeighingDatePicker.value = false |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | if (!form.id) { |
| | | uni.showToast({ title: '记录信息缺失,无法出库', icon: 'none' }) |
| | | return |
| | | } |
| | | const payload = { ...form } |
| | | const outNum = Number(form.stockOutNum) |
| | | const max = Number(form.unLockedQuantity ?? 0) |
| | | if (!outNum || outNum <= 0 || outNum > max) { |
| | | uni.showToast({ title: `请输入 1~${max} 之间的数量`, icon: 'none' }) |
| | | return |
| | | } |
| | | const payload = { |
| | | id: form.id, |
| | | stockOutNum: outNum, |
| | | remark: form.remark |
| | | } |
| | | subtractStockInventory(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: '出库成功', icon: 'success' }) |
| | |
| | | checkType: '', |
| | | checkResult: '', |
| | | checkUserName: userStore?.nickName || '', |
| | | checkTime: '' |
| | | checkTime: dayjs().format('YYYY-MM-DD') |
| | | }) |
| | | |
| | | const inspectItems = ref([]) // qualityInspectItem |