diff --git a/src/api/ecss/ecss.js b/src/api/ecss/ecss.js index 74a8b24..f420e78 100644 --- a/src/api/ecss/ecss.js +++ b/src/api/ecss/ecss.js @@ -11,6 +11,8 @@ export const searchEcssCoDelNotifyDetail = data => createAPI(`/ecss/coDel/search export const updateEcssDelHeader = data => createAPI(`/ecss/coDel/updateEcssDelHeader`,'post',data) +export const updateCustomerInfo = data => createAPI(`/ecss/coDel/updateCustomerInfo`,'post',data) + export const deleteEcssDelHeader = data => createAPI(`/ecss/coDel/deleteEcssDelHeader`,'post',data) export const cancelEcssDelHeader = data => createAPI(`/ecss/coDel/cancelEcssDelHeader`,'post',data) @@ -162,4 +164,13 @@ export const importPartPackageProperties = data => createAPI(`/ecss/coDel/import // 合箱接口 export const mergeBox = data => createAPI(`/ecss/coDel/mergeBox`,'post',data) +// UPC导入接口 +export const importUpcData = data => createAPI(`/ecss/coDel/importUpcData`,'post',data) + +// 查询UPC数据列表 +export const searchUpcImportData = data => createAPI(`/ecss/coDel/searchUpcImportData`,'post',data) + +// 删除UPC数据 +export const deleteUpcImportData = data => createAPI(`/ecss/coDel/deleteUpcImportData`,'post',data) + diff --git a/src/views/modules/ecss/codelnotify.vue b/src/views/modules/ecss/codelnotify.vue index 33d6eb6..243cdc3 100644 --- a/src/views/modules/ecss/codelnotify.vue +++ b/src/views/modules/ecss/codelnotify.vue @@ -73,6 +73,9 @@ {{'导出出口货物委托书'}} + + {{'客户信息'}} + {{'新增'}} {{'改单导入'}} + {{'UPC导入'}} {{'TTL Amount修正'}} + + + 一键删除 + + + + + + + + + + + + + + + + + + @@ -704,6 +768,77 @@ 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 另存为 + + + + + + + + + 保存 + 关闭 + + @@ -711,6 +846,7 @@ import Chooselist from '@/views/modules/common/Chooselist_eam' import delUploadExcel from "./del_upload_excel.vue"; import delDetailUploadExcel from "./del_detail_upload_excel.vue"; + import upcUploadExcel from "./upc_upload_excel.vue"; import PackingDetailTab from "./components/PackingDetailTab.vue"; import {} from "@/api/sysLanguage.js" import { getTableUserListLanguage} from "@/api/table.js" @@ -720,6 +856,7 @@ searchEcssCoDelNotifyHeader, searchEcssCoDelNotifyDetail, updateEcssDelHeader, + updateCustomerInfo, deleteEcssDelHeader, cancelEcssDelHeader, recoverEcssDelHeader, @@ -729,10 +866,14 @@ searchCoDelPalletDataNew, queryPartListAll, searchTemplateList, + getCustomerList, getCustomers, getCustomerAdd, getNotifyPartDetail, - fixTtlAmount + fixTtlAmount, + searchUpcImportData, + deleteUpcImportData, + updateCustomerTemplate }from "@/api/ecss/ecss.js" import {getBuList}from '@/api/factory/site.js' import ExportUtil from "@/utils/export"; @@ -743,6 +884,7 @@ OssComponents, delUploadExcel, delDetailUploadExcel, + upcUploadExcel, Chooselist, PackingDetailTab, }, @@ -811,6 +953,7 @@ buList:[], dataList:[], dataList2:[], + dataList3:[], // UPC数据列表 dataListLoading: false, xiadaLoading: false, // 下达按钮加载状态 updateDetailLoading: false, // 明细保存/取消按钮加载状态 @@ -1814,6 +1957,25 @@ templateList:[], customerData:{}, customerAddData:{}, + // 客户信息编辑相关 + customerInfoDialogFlag: false, + customerInfoModel: { + customerName: '', + localShipAddress: '', + overseasShipper: '', + overseasAddress: '', + salesArea: '', + cnative: '', + templateName: '' + }, + // 客户选择相关 + customerSelectFlag: false, + addressSelectFlag: false, + shipperSelectFlag: false, + overseasAddressSelectFlag: false, + customerListForEdit: [], + customerAddrsForEdit: [], + customSearchData: {}, } }, mounted() { @@ -1988,6 +2150,9 @@ this.saveSelectedRowToStorage(); } + // 预先查询UPC数据,用于判断是否显示UPC tab + this.getUpcDataList(); + this.refreshCurrentTabTable (); }, importModel(){ @@ -2000,6 +2165,18 @@ this.$refs.delDetailUploadExcel.init(this.currentRow) }) }, + /** + * UPC导入 + */ + importUpcModel(){ + if (!this.currentRow || !this.currentRow.cmcInvoice) { + this.$message.warning('请先选择一个发货通知单') + return + } + this.$nextTick(() => { + this.$refs.upcUploadExcel.init(this.currentRow) + }) + }, // TTL Amount修正方法 fixTtlAmountHandle(){ if (!this.currentRow || !this.currentRow.delNo) { @@ -2055,6 +2232,126 @@ this.$refs.packingDetailTab.refresh(); } } + if(this.activeName==='upcDetail'){ + // 查询UPC数据 + this.getUpcDataList() + } + }, + /** + * 获取UPC数据列表 + */ + getUpcDataList(){ + if(!this.currentRow || !this.currentRow.cmcInvoice){ + this.dataList3 = [] + return + } + + const params = { + site: this.currentRow.site, + cmcInvoice: this.currentRow.cmcInvoice + } + + searchUpcImportData(params).then(({data}) => { + if (data && data.code === 0) { + this.dataList3 = data.rows || [] + } else { + this.dataList3 = [] + } + }).catch((error) => { + console.error('查询UPC数据失败:', error) + this.dataList3 = [] + }) + }, + /** + * 删除发货通知单的全部UPC数据 + */ + deleteAllUpcData(){ + if (!this.currentRow || !this.currentRow.cmcInvoice) { + this.$message.warning('请先选择一个发货通知单') + return + } + + // 确认删除 + this.$confirm(`确定要删除发票号 ${this.currentRow.cmcInvoice} 的全部UPC数据吗?`, '删除确认', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const params = { + site: this.currentRow.site, + cmcInvoice: this.currentRow.cmcInvoice + } + + deleteUpcImportData(params).then(({data}) => { + if (data && data.code === 0) { + this.$message.success('UPC数据删除成功') + // 清空当前数据列表 + this.dataList3 = [] + // 切换回明细tab + this.activeName = 'detail' + } else { + this.$alert(data.msg || 'UPC数据删除失败', '错误', { + confirmButtonText: '确定' + }) + } + }).catch((error) => { + console.error('删除UPC数据失败:', error) + this.$alert('删除UPC数据失败: ' + error, '错误', { + confirmButtonText: '确定' + }) + }) + }).catch(() => { + // 用户取消删除 + }) + }, + /** + * 合并表格单元格方法 + * 用于合并相同cartonNo的行 + */ + arraySpanMethod({ row, column, rowIndex, columnIndex }) { + // 只对第一列(箱号列)进行合并 + if (columnIndex === 0) { + // 如果数据为空,不合并 + if (!this.dataList3 || this.dataList3.length === 0) { + return { + rowspan: 1, + colspan: 1 + } + } + + // 获取当前行的箱号 + const currentCartonNo = row.cartonNo + + // 如果是第一行,或者与上一行的箱号不同 + if (rowIndex === 0 || this.dataList3[rowIndex - 1].cartonNo !== currentCartonNo) { + // 计算相同箱号的行数 + let rowspan = 1 + for (let i = rowIndex + 1; i < this.dataList3.length; i++) { + if (this.dataList3[i].cartonNo === currentCartonNo) { + rowspan++ + } else { + break + } + } + + return { + rowspan: rowspan, + colspan: 1 + } + } else { + // 如果与上一行的箱号相同,则隐藏该单元格 + return { + rowspan: 0, + colspan: 0 + } + } + } + + // 其他列不合并 + return { + rowspan: 1, + colspan: 1 + } }, tabClick (tab, event) { // 刷新列表数据 @@ -2699,6 +2996,114 @@ this.exportGoods.shippingDate = '' this.exportGoodsFlag = true }, + + /** + * 打开客户信息编辑对话框 + */ + openCustomerInfoDialog() { + if (!this.currentRow || !this.currentRow.cmcInvoice) { + this.$message.warning('请选择发货通知单!') + return + } + if (this.currentRow.notifyStatus === '订单取消') { + this.$message.warning('该发货通知单已取消!') + return + } + + // 初始化客户信息数据 + this.customerInfoModel = { + customerName: this.currentRow.customerName || '', + localShipAddress: this.currentRow.localShipAddress || '', + overseasShipper: this.currentRow.overseasShipper || '', + overseasAddress: this.currentRow.overseasAddress || '', + salesArea: this.currentRow.salesArea || '', + cnative: this.currentRow.cnative || '', + templateName: '' + } + + this.customerInfoDialogFlag = true + }, + + /** + * 更新客户信息 + */ + updateCustomerInfo() { + // 验证必填字段 + if (!this.customerInfoModel.customerName) { + this.$message.warning('请填写客户名称') + return + } + + // 准备更新数据 + const updateData = { + site: this.currentRow.site, + delNo: this.currentRow.delNo, + customerName: this.customerInfoModel.customerName, + localShipAddress: this.customerInfoModel.localShipAddress, + overseasShipper: this.customerInfoModel.overseasShipper, + overseasAddress: this.customerInfoModel.overseasAddress, + salesArea: this.customerInfoModel.salesArea, + cnative: this.customerInfoModel.cnative + } + + // 调用专门的客户信息更新接口 + updateCustomerInfo(updateData).then(({data}) => { + if (data && data.code === 0) { + this.$message.success('客户信息更新成功') + this.customerInfoDialogFlag = false + // 刷新列表 + this.searchTable() + } else { + this.$message.error(data.msg || '更新失败') + } + }).catch(error => { + this.$message.error('更新失败:' + (error.message || '网络异常')) + }) + }, + + /** + * 另存为模板 + */ + async saveAsTemplate() { + // 验证必填字段 + if (!this.customerInfoModel.templateName) { + this.$message.warning('请输入模板名称') + return + } + + if (!this.customerInfoModel.customerName) { + this.$message.warning('请填写客户名称') + return + } + + // 准备模板数据 + const templateData = { + templateName: this.customerInfoModel.templateName, + originalTemplateName: '', // 空字符串表示新增模板 + ccuscode: '', // 客户编码,可以为空 + ccusname: this.customerInfoModel.customerName, + localShipAddress: this.customerInfoModel.localShipAddress || '', + overseasShipper: this.customerInfoModel.overseasShipper || '', + overseasAddress: this.customerInfoModel.overseasAddress || '', + cnative: this.customerInfoModel.cnative || '', + salesArea: this.customerInfoModel.salesArea || '' + } + + try { + const {data} = await updateCustomerTemplate(templateData) + + if (data && data.code === 0) { + this.$message.success(`模板"${this.customerInfoModel.templateName}"保存成功!`) + // 清空模板名称 + this.customerInfoModel.templateName = '' + } else { + this.$message.error(data.msg || '保存模板失败') + } + } catch (error) { + console.error('保存模板失败:', error) + this.$message.error('保存模板失败:' + (error.message || '网络异常')) + } + }, // 导出 downloadInvoice() { if (!this.currentRow || !this.currentRow.buNo) { @@ -2907,4 +3312,9 @@ .clickable-pn:hover { opacity: 0.8; } +.fake-disabled { + opacity: 0.5; + cursor: not-allowed; +} + diff --git a/src/views/modules/ecss/upc_upload_excel.vue b/src/views/modules/ecss/upc_upload_excel.vue new file mode 100644 index 0000000..a359059 --- /dev/null +++ b/src/views/modules/ecss/upc_upload_excel.vue @@ -0,0 +1,221 @@ + + + + +