| | |
| | | placeholder="请选择采购订单号" |
| | | clearable |
| | | filterable |
| | | remote |
| | | :remote-method="loadPurchaseOptions" |
| | | :loading="loadingPurchaseOptions" |
| | | @change="handlePurchaseChange" |
| | | :disabled="operationType === 'edit'" |
| | |
| | | <el-table-column label="待入库数量" prop="quantity0" width="100" /> |
| | | <el-table-column label="本次入库数量" prop="quantityStock" width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" /> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" @change="() => calculateTotalPrice(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="税率(%)" prop="taxRate" width="120" />--> |
| | | <!-- <el-table-column--> |
| | | <!-- label="含税单价(元)"--> |
| | | <!-- prop="taxInclusiveUnitPrice"--> |
| | | <!-- :formatter="formattedNumber"--> |
| | | <!-- width="150"--> |
| | | <!-- />--> |
| | | <!-- <el-table-column--> |
| | | <!-- label="含税总价(元)"--> |
| | | <!-- prop="taxInclusiveTotalPrice"--> |
| | | <!-- :formatter="formattedNumber"--> |
| | | <!-- width="150"--> |
| | | <!-- />--> |
| | | <!-- <el-table-column--> |
| | | <!-- label="不含税总价(元)"--> |
| | | <!-- prop="taxExclusiveTotalPrice"--> |
| | | <!-- :formatter="formattedNumber"--> |
| | | <!-- width="150"--> |
| | | <!-- />--> |
| | | <el-table-column label="税率(%)" prop="taxRate" width="120" /> |
| | | <el-table-column label="单价(元)" prop="taxInclusiveUnitPrice" width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" :disabled="operationType === 'edit'"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="总价(元)" |
| | | :formatter="formattedNumber" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="150" |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | |
| | | // 计算总价 |
| | | const calculateTotalPrice = (row) => { |
| | | const quantityStock = Number(row?.quantityStock ?? 0); |
| | | const taxInclusiveUnitPrice = Number(row?.taxInclusiveUnitPrice ?? 0); |
| | | |
| | | if (Number.isFinite(quantityStock) && Number.isFinite(taxInclusiveUnitPrice)) { |
| | | row.taxInclusiveTotalPrice = quantityStock * taxInclusiveUnitPrice; |
| | | } else { |
| | | row.taxInclusiveTotalPrice = 0; |
| | | } |
| | | }; |
| | | |
| | | const fetchProductsByContract = async () => { |
| | | if (!form.value.purchaseContractNumber) { |
| | | proxy.$modal.msgWarning('请选择合同号') |
| | |
| | | productList.value = productRes.data.map(item => ({ |
| | | ...item, |
| | | quantityStock: 0, |
| | | taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0), |
| | | taxInclusiveTotalPrice: 0, |
| | | originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? 0), |
| | | })) |
| | | } catch (error) { |
| | |
| | | nickName: userStore.nickName, |
| | | details: selectedRows.value.map(product => ({ |
| | | id: product.id, |
| | | inboundQuantity: Number(product.quantityStock) |
| | | inboundQuantity: Number(product.quantityStock), |
| | | taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice), |
| | | taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice) |
| | | })), |
| | | }; |
| | | loading.value = true |
| | |
| | | productList.value = res.data.map(item => ({ |
| | | ...item, |
| | | quantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0), |
| | | taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0), |
| | | taxInclusiveTotalPrice: Number(item?.quantityStock ?? 0) * Number(item?.taxInclusiveUnitPrice ?? 0), |
| | | originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0), |
| | | })) |
| | | selectedRows.value = productList.value |
| | |
| | | |
| | | <style scoped lang="scss"></style> |
| | | |
| | | |
| | | |