| | |
| | | @click="openForm('add')"> |
| | | 新增台账 |
| | | </el-button> |
| | | <el-button type="primary" plain :disabled="selectedRows.length === 0" @click="handleBatchExportContract"> |
| | | 导出合同 |
| | | </el-button> |
| | | <el-button type="primary" |
| | | plain |
| | | @click="handleImport">导入 |
| | |
| | | prop="type"> |
| | | <el-select v-model="deliveryForm.type" |
| | | placeholder="请选择发货类型" |
| | | style="width: 100%"> |
| | | style="width: 100%" |
| | | @change="handleDeliveryTypeChange"> |
| | | <el-option label="货车" |
| | | value="货车" /> |
| | | <el-option label="快递" |
| | |
| | | <el-form-item label="待发货数量:"> |
| | | <el-input :model-value="currentDeliveryRow?.noQuantity" |
| | | disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24" v-if="deliveryForm.type === '货车'"> |
| | | <el-form-item label="发货车牌号:" |
| | | prop="shippingCarNumber"> |
| | | <el-input v-model="deliveryForm.shippingCarNumber" |
| | | placeholder="请输入发货车牌号" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24" v-else> |
| | | <el-form-item label="快递公司:" |
| | | prop="expressCompany"> |
| | | <el-input v-model="deliveryForm.expressCompany" |
| | | placeholder="请输入快递公司" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30" v-if="deliveryForm.type === '快递'"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="快递单号:" |
| | | prop="expressNumber"> |
| | | <el-input v-model="deliveryForm.expressNumber" |
| | | placeholder="请输入快递单号" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="发货图片:"> |
| | | <ImageUpload v-model:file-list="deliveryFileList" :limit="9" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | | import dayjs from "dayjs"; |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | | import ImageUpload from "@/components/AttachmentUpload/image/index.vue"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { listCustomer } from "@/api/basicData/customer.js"; |
| | | |
| | |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | const deliveryFileList = ref([]); |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | |
| | | deliveryQuantity: 0, |
| | | })); |
| | | }; |
| | | const validateDeliveryShippingCarNumber = (_rule, value, callback) => { |
| | | if (deliveryForm.value.type === "货车" && !value) { |
| | | return callback(new Error("请输入发货车牌号")); |
| | | } |
| | | callback(); |
| | | }; |
| | | const validateDeliveryExpressCompany = (_rule, value, callback) => { |
| | | if (deliveryForm.value.type === "快递" && !value) { |
| | | return callback(new Error("请输入快递公司")); |
| | | } |
| | | callback(); |
| | | }; |
| | | const deliveryFormData = reactive({ |
| | | deliveryForm: { |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | expressNumber: "", |
| | | type: "货车", // 货车, 快递 |
| | | }, |
| | | deliveryRules: { |
| | | shippingCarNumber: [ |
| | | { validator: validateDeliveryShippingCarNumber, trigger: "blur" }, |
| | | ], |
| | | expressCompany: [{ validator: validateDeliveryExpressCompany, trigger: "blur" }], |
| | | type: [{ required: true, message: "请选择发货类型", trigger: "change" }], |
| | | }, |
| | | }); |
| | |
| | | selectedQuotation.value = null; |
| | | let userLists = await userListNoPage(); |
| | | userList.value = userLists.data; |
| | | listCustomer({ current: -1, size: -1 }).then(res => { |
| | | listCustomer({ current: -1, size: -1, type: 0 }).then(res => { |
| | | customerOption.value = res.data.records; |
| | | }); |
| | | form.value.entryPerson = userStore.id; |
| | |
| | | 审核拒绝: "审核拒绝", |
| | | 审核通过: "审核通过", |
| | | 已发货: "已发货", |
| | | 部分发货: "部分发货", |
| | | }; |
| | | return statusTextMap[statusStr] || "待发货"; |
| | | }; |
| | |
| | | 审核拒绝: "danger", |
| | | 审核通过: "success", |
| | | 已发货: "success", |
| | | 部分发货: "warning", |
| | | }; |
| | | return typeTextMap[statusStr] || "info"; |
| | | }; |
| | |
| | | |
| | | // 发货状态必须是"待发货"或"审核拒绝" |
| | | const statusStr = shippingStatus ? String(shippingStatus).trim() : ""; |
| | | return statusStr === "待发货" || statusStr === "审核拒绝"; |
| | | return statusStr === "待发货" || statusStr === "审核拒绝" || statusStr === "部分发货"; |
| | | }; |
| | | |
| | | // 打开附件弹窗 |
| | |
| | | recordId.value = row.id; |
| | | fileDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleBatchExportContract = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择要导出的台账"); |
| | | return; |
| | | } |
| | | const firstCustomerKey = |
| | | selectedRows.value[0].customerId ?? selectedRows.value[0].customerName ?? ""; |
| | | const hasDifferentCustomer = selectedRows.value.some((row) => { |
| | | const customerKey = row.customerId ?? row.customerName ?? ""; |
| | | return String(customerKey) !== String(firstCustomerKey); |
| | | }); |
| | | if (hasDifferentCustomer) { |
| | | proxy.$modal.msgWarning("仅支持同一客户同时导出合同"); |
| | | return; |
| | | } |
| | | const ids = selectedRows.value |
| | | .map((row) => row.id) |
| | | .filter((id) => id !== null && id !== undefined); |
| | | if (ids.length === 0) { |
| | | proxy.$modal.msgWarning("未获取到合同ID"); |
| | | return; |
| | | } |
| | | proxy.download( |
| | | "/sales/ledger/exportContract", |
| | | ids, |
| | | `销售合同_批量_${dayjs().format("YYYYMMDDHHmmss")}.docx`, |
| | | { |
| | | method: "post", |
| | | filename: `销售合同_批量_${dayjs().format("YYYYMMDDHHmmss")}.docx`, |
| | | headers: { "Content-Type": "application/json;charset=utf-8" }, |
| | | transformRequest: [(data) => JSON.stringify(data)], |
| | | } |
| | | ); |
| | | } |
| | | // 打开发货弹框 |
| | | const openDeliveryForm = async row => { |
| | | // 检查是否可以发货 |
| | |
| | | row.productModelId || row.modelId |
| | | ); |
| | | deliveryForm.value = { |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | expressNumber: "", |
| | | type: "货车", |
| | | batchNo: [], |
| | | batchNoList, |
| | | }; |
| | | deliveryFileList.value = []; |
| | | deliveryFormVisible.value = true; |
| | | }; |
| | | |
| | |
| | | salesLedgerId: salesLedgerId, |
| | | salesLedgerProductId: currentDeliveryRow.value.id, |
| | | type: deliveryForm.value.type, |
| | | shippingCarNumber: |
| | | deliveryForm.value.type === "货车" |
| | | ? deliveryForm.value.shippingCarNumber |
| | | : "", |
| | | expressCompany: |
| | | deliveryForm.value.type === "快递" |
| | | ? deliveryForm.value.expressCompany |
| | | : "", |
| | | expressNumber: |
| | | deliveryForm.value.type === "快递" |
| | | ? deliveryForm.value.expressNumber |
| | | : "", |
| | | storageBlobDTOs: deliveryFileList.value || [], |
| | | batchNo: deliveryForm.value.batchNo, |
| | | batchNoDetailList: selectedBatchRows.map(item => ({ |
| | | stockInventoryId: item.id, |
| | |
| | | }; |
| | | |
| | | // 关闭发货弹框 |
| | | const handleDeliveryTypeChange = val => { |
| | | if (val === "货车") { |
| | | deliveryForm.value.expressCompany = ""; |
| | | deliveryForm.value.expressNumber = ""; |
| | | } else { |
| | | deliveryForm.value.shippingCarNumber = ""; |
| | | } |
| | | }; |
| | | |
| | | const closeDeliveryDia = () => { |
| | | proxy.resetForm("deliveryFormRef"); |
| | | deliveryFileList.value = []; |
| | | deliveryFormVisible.value = false; |
| | | currentDeliveryRow.value = null; |
| | | }; |