| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label=" "> |
| | | <el-button type="warning" :disabled="!(productForm.productId && productForm.productModelId && productForm.taxRate)" @click="showPriceReference" icon="Search">查看历史采购价格参考</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | |
| | | <el-button type="primary" @click="submitProduct">确认</el-button> |
| | | <el-button @click="closeProductDia">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 历史采购价格参考弹窗 --> |
| | | <el-dialog |
| | | v-model="priceReferenceVisible" |
| | | title="历史采购价格参考" |
| | | width="1000px" |
| | | append-to-body |
| | | > |
| | | <el-table |
| | | v-loading="priceReferenceLoading" |
| | | :data="priceReferenceData" |
| | | border |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column label="商品名称" prop="productName" min-width="150" show-overflow-tooltip /> |
| | | <el-table-column label="规格型号" prop="specification" width="150" show-overflow-tooltip /> |
| | | <el-table-column label="供应商" prop="supplierName" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="基础价格" width="120" align="right"> |
| | | <template #default="{ row }"> |
| | | <span style="color: #f56c6c; font-weight: bold;">¥{{ row.basePrice }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="折扣信息" width="120" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-tag v-if="row.discountType === 'percentage'" type="success"> |
| | | {{ row.discountValue }}% |
| | | </el-tag> |
| | | <el-tag v-else-if="row.discountType === 'fixed'" type="warning"> |
| | | -¥{{ row.discountValue }} |
| | | </el-tag> |
| | | <span v-else>无折扣</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="生效时间" prop="effectiveTime" width="180" align="center" /> |
| | | <el-table-column label="操作" width="100" align="center" fixed="right"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link @click="selectPriceReference(row)">选择</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div class="pagination-container" style="margin-top: 20px; display: flex; justify-content: flex-end;"> |
| | | <el-pagination |
| | | v-model:current-page="priceReferencePagination.current" |
| | | v-model:page-size="priceReferencePagination.size" |
| | | :page-sizes="[10, 20, 50]" |
| | | :total="priceReferenceTotal" |
| | | layout="total, sizes, prev, pager, next" |
| | | @size-change="handlePriceReferenceSizeChange" |
| | | @current-change="handlePriceReferenceCurrentChange" |
| | | /> |
| | | </div> |
| | | <template #footer> |
| | | <el-button @click="priceReferenceVisible = false">关闭</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | |
| | | let nextApproverId = 2; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { listPage as listAdvancedPrice } from "@/api/procurementManagement/advancedPriceManagement.js"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | const userStore = useUserStore(); |
| | |
| | | }, |
| | | }); |
| | | const { productForm, productRules } = toRefs(productFormData); |
| | | |
| | | // 采购价格管理参考弹窗 |
| | | const priceReferenceVisible = ref(false); |
| | | const priceReferenceLoading = ref(false); |
| | | const priceReferenceData = ref([]); |
| | | const priceReferenceTotal = ref(0); |
| | | const priceReferencePagination = reactive({ |
| | | current: 1, |
| | | size: 10 |
| | | }); |
| | | |
| | | const showPriceReference = () => { |
| | | priceReferenceVisible.value = true; |
| | | handlePriceReferenceSearch(); |
| | | }; |
| | | |
| | | const handlePriceReferenceSearch = () => { |
| | | priceReferenceLoading.value = true; |
| | | // 模拟搜索参数:productId 映射为 productName 或 ID,这里根据 advancedPriceManagement 的 API 确定参数 |
| | | // 假设高级价格管理的 listPage 接收 productId |
| | | const query = { |
| | | productId: productForm.value.productId, |
| | | specificationId: productForm.value.productModelId, |
| | | current: priceReferencePagination.current, |
| | | size: priceReferencePagination.size |
| | | }; |
| | | listAdvancedPrice(query).then(res => { |
| | | priceReferenceData.value = res.data.records; |
| | | priceReferenceTotal.value = res.data.total; |
| | | priceReferenceLoading.value = false; |
| | | }).catch(() => { |
| | | priceReferenceLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const handlePriceReferenceSizeChange = (size) => { |
| | | priceReferencePagination.size = size; |
| | | handlePriceReferenceSearch(); |
| | | }; |
| | | |
| | | const handlePriceReferenceCurrentChange = (page) => { |
| | | priceReferencePagination.current = page; |
| | | handlePriceReferenceSearch(); |
| | | }; |
| | | |
| | | const selectPriceReference = (row) => { |
| | | // 计算实际价格:基础价格 - 折扣 |
| | | let actualPrice = row.basePrice; |
| | | if (row.discountType === 'percentage') { |
| | | actualPrice = row.basePrice * (1 - row.discountValue / 100); |
| | | } else if (row.discountType === 'fixed') { |
| | | actualPrice = row.basePrice - row.discountValue; |
| | | } |
| | | |
| | | // 填充含税单价,保留两位小数 |
| | | productForm.value.taxInclusiveUnitPrice = Number(Math.max(actualPrice, 0)).toFixed(2); |
| | | |
| | | // 如果已经输入了数量,则自动计算总价 |
| | | if (productForm.value.quantity) { |
| | | mathNum(); |
| | | } |
| | | |
| | | priceReferenceVisible.value = false; |
| | | proxy.$modal.msgSuccess("已引用历史价格"); |
| | | }; |
| | | |
| | | const upload = reactive({ |
| | | // 上传的地址 |
| | | url: import.meta.env.VITE_APP_BASE_API + "/file/upload", |
| | |
| | | }; |
| | | // 打开产品弹框 |
| | | const openProductForm = (type, row, index) => { |
| | | if(!form.value.supplierId){ |
| | | proxy.$modal.msgWarning("请选择供应商"); |
| | | return; |
| | | } |
| | | productOperationType.value = type; |
| | | productOperationIndex.value = index; |
| | | productForm.value = {}; |