| | |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 过磅相关字段 --> |
| | | <view class="form-section"> |
| | | <!-- 成品:只需要数量 --> |
| | | <view v-if="isFinishedProduct" class="form-section"> |
| | | <view class="form-row"> |
| | | <text class="form-label required">数量</text> |
| | | <up-input v-model="form.qualitity" type="number" placeholder="请输入数量" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 原材料:过磅相关字段 --> |
| | | <view v-else class="form-section"> |
| | | <view class="section-title">过磅信息</view> |
| | | <view class="form-row"> |
| | | <text class="form-label">车牌号</text> |
| | |
| | | <text class="form-label">毛重(吨)</text> |
| | | <up-input |
| | | v-model="form.grossWeight" |
| | | type="number" |
| | | type="digit" |
| | | placeholder="请输入毛重" |
| | | /> |
| | | </view> |
| | |
| | | <text class="form-label">皮重(吨)</text> |
| | | <up-input |
| | | v-model="form.tareWeight" |
| | | type="number" |
| | | type="digit" |
| | | placeholder="请输入皮重" |
| | | /> |
| | | </view> |
| | |
| | | <text class="form-label">净重(吨)</text> |
| | | <up-input |
| | | v-model="form.netWeight" |
| | | type="number" |
| | | type="digit" |
| | | disabled |
| | | placeholder="自动计算" |
| | | /> |
| | |
| | | </view> |
| | | |
| | | <view class="form-section"> |
| | | <!-- <view class="form-row"> |
| | | <text class="form-label required">数量</text> |
| | | <up-input v-model="form.qualitity" type="number" placeholder="请输入数量" /> |
| | | </view> --> |
| | | <view class="form-row"> |
| | | <text class="form-label">备注</text> |
| | | <up-input v-model="form.remark" type="textarea" placeholder="选填" /> |
| | |
| | | productModelName: '', |
| | | unit: '', |
| | | productType: undefined, |
| | | parentName: '', |
| | | licensePlateNo: '', |
| | | grossWeight: '', |
| | | tareWeight: '', |
| | |
| | | |
| | | const type = ref('0') // 固定合格库存 |
| | | const isQualified = computed(() => true) |
| | | const isFinishedProduct = computed(() => form.parentName === '成品') |
| | | |
| | | const showProductPopup = ref(false) |
| | | const productQuery = reactive({ |
| | |
| | | form.productModelName = item.model |
| | | form.unit = item.unit |
| | | form.productType = item.productType |
| | | form.parentName = parentName |
| | | |
| | | // 切换产品后,按类型清理无关字段 |
| | | if (parentName === '成品') { |
| | | form.licensePlateNo = '' |
| | | form.grossWeight = '' |
| | | form.tareWeight = '' |
| | | form.netWeight = '' |
| | | form.weighingDate = '' |
| | | form.weighingOperator = '' |
| | | } else { |
| | | form.qualitity = '' |
| | | } |
| | | showProductPopup.value = false |
| | | } |
| | | |
| | |
| | | uni.showToast({ title: '请选择产品', icon: 'none' }) |
| | | return |
| | | } |
| | | // if (!form.qualitity || Number(form.qualitity) <= 0) { |
| | | // uni.showToast({ title: '请输入数量', icon: 'none' }) |
| | | // return |
| | | // } |
| | | const payload = { |
| | | if (isFinishedProduct.value) { |
| | | if (!form.qualitity || Number(form.qualitity) <= 0) { |
| | | uni.showToast({ title: '请输入数量', icon: 'none' }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | const base = { |
| | | productId: form.productId, |
| | | productModelId: form.productModelId, |
| | | productName: form.productName, |
| | | 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, |
| | | remark: form.remark |
| | | } |
| | | const payload = isFinishedProduct.value |
| | | ? { ...base, qualitity: Number(form.qualitity) } |
| | | : { |
| | | ...base, |
| | | licensePlateNo: form.licensePlateNo, |
| | | grossWeight: form.grossWeight, |
| | | tareWeight: form.tareWeight, |
| | | netWeight: form.netWeight, |
| | | weighingDate: form.weighingDate, |
| | | weighingOperator: form.weighingOperator |
| | | } |
| | | createStockInventory(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: '新增成功', icon: 'success' }) |