| | |
| | | <el-table-column label="产品大类" prop="productCategory" /> |
| | | <el-table-column label="规格型号" prop="specificationModel" /> |
| | | <el-table-column label="单位" prop="unit" /> |
| | | <el-table-column label="产品状态" width="100px" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag v-if="scope.row.approveStatus === 0" type="info">未出库</el-tag> |
| | | <el-tag v-if="scope.row.approveStatus === 1" type="success">已出库</el-tag> |
| | | <el-tag v-if="scope.row.approveStatus === 2" type="warning">审核中</el-tag> |
| | | <el-tag v-if="scope.row.approveStatus === 3" type="success">审核成功</el-tag> |
| | | <el-tag v-if="scope.row.approveStatus === 4" type="danger">审核失败</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="发货车牌" minWidth="100px" align="center"> |
| | | <template #default="scope"> |
| | | <div> |
| | | <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag> |
| | | <el-tag v-else type="info">未发货</el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="发货日期" minWidth="100px" align="center"> |
| | | <template #default="scope"> |
| | | <div> |
| | | <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div> |
| | | <el-tag v-else type="info">未发货</el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="数量" prop="quantity" /> |
| | | <el-table-column label="税率(%)" prop="taxRate" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <!--操作--> |
| | | <el-table-column Width="60px" label="操作" align="center"> |
| | | <template #default="scope"> |
| | | <el-button :disabled="scope.row.approveStatus!==2 || scope.row.approveStatus!==5" link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="录入人" prop="entryPersonName" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="录入日期" prop="entryDate" width="120" show-overflow-tooltip /> |
| | | <el-table-column label="签订日期" prop="executionDate" width="120" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="操作" min-width="100" align="center"> |
| | | <el-table-column label="发货状态" prop="shippingStatus" width="140" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="发货日期" prop="shippingDate" width="140" align="center" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="操作" min-width="140" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">编辑</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详情</el-button>--> |
| | | <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button> |
| | | <!-- <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button>--> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="openDeliveryForm(scope.row)" |
| | | :disabled="scope.row.shippingStatus === '已发货'" |
| | | > |
| | | 发货 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="发货类型:" prop="type"> |
| | | <el-select |
| | | v-model="deliveryForm.type" |
| | | placeholder="请选择发货类型" |
| | | style="width: 100%" |
| | | @change="handleShippingTypeChange" |
| | | > |
| | | <el-option label="货车" value="货车" /> |
| | | <el-option label="快递" value="快递" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="发货日期:" prop="shippingDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-col :span="24" v-if="deliveryForm.type === '货车'"> |
| | | <el-form-item label="发货车牌号:" prop="shippingCarNumber"> |
| | | <el-input |
| | | v-model="deliveryForm.shippingCarNumber" |
| | |
| | | /> |
| | | </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="发货图片:"> |
| | | <el-upload |
| | | v-model:file-list="deliveryFileList" |
| | | :action="upload.url" |
| | | multiple |
| | | ref="deliveryFileUpload" |
| | | auto-upload |
| | | :headers="upload.headers" |
| | | :data="{ type: 9 }" |
| | | :before-upload="handleDeliveryBeforeUpload" |
| | | :on-error="handleDeliveryUploadError" |
| | | :on-success="handleDeliveryUploadSuccess" |
| | | :on-remove="handleDeliveryRemove" |
| | | list-type="picture-card" |
| | | :limit="9" |
| | | accept="image/png,image/jpeg,image/jpg" |
| | | > |
| | | <el-icon class="avatar-uploader-icon"><Plus /></el-icon> |
| | | <template #tip> |
| | | <div class="el-upload__tip"> |
| | | 支持 jpg、jpeg、png 格式,最多上传 9 张,单张大小不超过 10MB |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | |
| | | import {onMounted, ref, getCurrentInstance} from "vue"; |
| | | import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { UploadFilled } from "@element-plus/icons-vue"; |
| | | import { UploadFilled, Plus } from "@element-plus/icons-vue"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import FileListDialog from '@/components/Dialog/FileListDialog.vue'; |
| | | import FileList from '@/views/salesManagement/salesLedger/fileList.vue'; |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { getQuotationList } from "@/api/salesManagement/salesQuotation.js"; |
| | | import { |
| | |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | const deliveryFileList = ref([]); |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | |
| | | const currentDeliveryRow = ref(null); |
| | | const deliveryFormData = reactive({ |
| | | deliveryForm: { |
| | | type: "货车", // 货车, 快递 |
| | | shippingDate: "", |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | expressNumber: "", // 快递单号 |
| | | shippingImages: "", // 发货图片,多个用逗号分隔 |
| | | }, |
| | | deliveryRules: { |
| | | type: [ |
| | | { required: true, message: "请选择发货类型", trigger: "change" } |
| | | ], |
| | | shippingDate: [ |
| | | { required: true, message: "请选择发货日期", trigger: "change" } |
| | | ], |
| | | shippingCarNumber: [ |
| | | { required: true, message: "请输入发货车牌号", trigger: "blur" } |
| | | { validator: (_, value, callback) => validateShippingCarNumber(value, callback), trigger: "blur" } |
| | | ], |
| | | expressCompany: [ |
| | | { validator: (_, value, callback) => validateExpressCompany(value, callback), trigger: "blur" } |
| | | ], |
| | | }, |
| | | }); |
| | |
| | | delLedgerFile(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | }); |
| | | } |
| | | } |
| | | // 发货图片上传前校检 |
| | | function handleDeliveryBeforeUpload(file) { |
| | | // 校检文件类型 |
| | | const isImage = file.type === 'image/png' || file.type === 'image/jpeg' || file.type === 'image/jpg'; |
| | | if (!isImage) { |
| | | proxy.$modal.msgError("只能上传 jpg、jpeg、png 格式的图片!"); |
| | | return false; |
| | | } |
| | | // 校检文件大小 |
| | | const isLt10M = file.size / 1024 / 1024 < 10; |
| | | if (!isLt10M) { |
| | | proxy.$modal.msgError("上传图片大小不能超过 10MB!"); |
| | | return false; |
| | | } |
| | | proxy.$modal.loading("正在上传图片,请稍候..."); |
| | | return true; |
| | | } |
| | | // 发货图片上传失败 |
| | | function handleDeliveryUploadError(err) { |
| | | proxy.$modal.msgError("上传图片失败"); |
| | | proxy.$modal.closeLoading(); |
| | | } |
| | | // 发货图片上传成功回调 |
| | | function handleDeliveryUploadSuccess(res, file, uploadFiles) { |
| | | proxy.$modal.closeLoading(); |
| | | if (res.code === 200) { |
| | | file.tempId = res.data.tempId; |
| | | proxy.$modal.msgSuccess("上传成功"); |
| | | } else { |
| | | proxy.$modal.msgError(res.msg); |
| | | proxy.$refs.deliveryFileUpload.handleRemove(file); |
| | | } |
| | | } |
| | | // 移除发货图片 |
| | | function handleDeliveryRemove(file) { |
| | | // 从文件列表中移除 |
| | | const index = deliveryFileList.value.findIndex(item => item.uid === file.uid); |
| | | if (index > -1) { |
| | | deliveryFileList.value.splice(index, 1); |
| | | } |
| | | } |
| | | // 提交表单 |
| | |
| | | return total.toFixed(2); |
| | | }; |
| | | |
| | | // 发货类型校验:货车时要求车牌,快递时要求快递公司 |
| | | const validateShippingCarNumber = (value, callback) => { |
| | | if (deliveryForm.value.type === "货车") { |
| | | if (!value) return callback(new Error("请输入发货车牌号")); |
| | | } |
| | | callback(); |
| | | }; |
| | | const validateExpressCompany = (value, callback) => { |
| | | if (deliveryForm.value.type === "快递") { |
| | | if (!value) return callback(new Error("请输入快递公司")); |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | const mathNum = () => { |
| | | console.log("productForm.value", productForm.value); |
| | | if (!productForm.value.taxInclusiveUnitPrice) { |
| | |
| | | |
| | | // 打开发货弹框 |
| | | const openDeliveryForm = (row) => { |
| | | getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => { |
| | | currentDeliveryRow.value = row; |
| | | deliveryForm.value = { |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | }; |
| | | deliveryFormVisible.value = true; |
| | | }).catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }); |
| | | currentDeliveryRow.value = row; |
| | | deliveryForm.value = { |
| | | type: "货车", |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | expressNumber: "", // 初始化快递单号为空 |
| | | shippingImages: "", // 初始化图片为空 |
| | | }; |
| | | deliveryFileList.value = []; // 初始化文件列表为空 |
| | | deliveryFormVisible.value = true; |
| | | }; |
| | | |
| | | // 提交发货表单 |
| | | const submitDelivery = () => { |
| | | proxy.$refs["deliveryFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | let tempFileIds = []; |
| | | if (deliveryFileList.value !== null && deliveryFileList.value.length > 0) { |
| | | tempFileIds = deliveryFileList.value.map((item) => item.tempId); |
| | | } |
| | | addShippingInfo({ |
| | | salesLedgerId: currentDeliveryRow.value.id, |
| | | type: deliveryForm.value.type, |
| | | shippingDate: deliveryForm.value.shippingDate, |
| | | shippingCarNumber: deliveryForm.value.shippingCarNumber, |
| | | shippingCarNumber: deliveryForm.value.type === "货车" ? deliveryForm.value.shippingCarNumber : "", |
| | | expressCompany: deliveryForm.value.type === "快递" ? deliveryForm.value.expressCompany : "", |
| | | expressNumber: deliveryForm.value.type === "快递" ? deliveryForm.value.expressNumber : "", |
| | | tempFileIds: tempFileIds, |
| | | }) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("发货成功"); |
| | |
| | | // 关闭发货弹框 |
| | | const closeDeliveryDia = () => { |
| | | proxy.resetForm("deliveryFormRef"); |
| | | deliveryFileList.value = []; // 清空文件列表 |
| | | deliveryForm.value.shippingImages = ""; // 清空图片 |
| | | deliveryForm.value.expressNumber = ""; // 清空快递单号 |
| | | deliveryFormVisible.value = false; |
| | | currentDeliveryRow.value = null; |
| | | }; |
| | | |
| | | // 发货类型切换时清空对应字段 |
| | | const handleShippingTypeChange = (val) => { |
| | | if (val === "货车") { |
| | | deliveryForm.value.expressCompany = ""; |
| | | deliveryForm.value.expressNumber = ""; |
| | | } else { |
| | | deliveryForm.value.shippingCarNumber = ""; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |