From 02819b49b56f30baf54ab047d3da30a020522fc6 Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Tue, 19 Nov 2024 13:25:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E5=BC=80=E7=A5=A8=E7=94=B3?= =?UTF-8?q?=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/customerSaleInvoiceMain/index.ts | 21 ++++-- .../customerSaleInvoiceRequestMain/index.vue | 64 ++++++++++++++----- 2 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/api/wms/customerSaleInvoiceMain/index.ts b/src/api/wms/customerSaleInvoiceMain/index.ts index 991113b7d..32ce70ad8 100644 --- a/src/api/wms/customerSaleInvoiceMain/index.ts +++ b/src/api/wms/customerSaleInvoiceMain/index.ts @@ -48,11 +48,15 @@ export const deleteCustomerSaleInvoiceMain = async (id: number) => { return await request.delete({ url: `/wms/customer-sale-invoice-main/delete?id=` + id }) } -// 导出客户销售开票主信息表(WMS) Excel +// 导出设备制造商 Excel export const exportCustomerSaleInvoiceMain = async (params) => { - return await request.download({ url: `/wms/customer-sale-invoice-main/export-excel`, params }) + if (params.isSearch) { + const data = { ...params } + return await request.downloadPost({ url: `/wms/customer-sale-invoice-main/export-excel-senior`, data }) + } else { + return await request.download({ url: `/wms/customer-sale-invoice-main/export-excel`, params }) + } } - // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/wms/customer-sale-invoice-main/get-import-template' }) @@ -67,4 +71,13 @@ export const getCustomerSaleInvoiceRecodeMainPage = async (params) => { } else { return await request.get({ url: `/wms/customer-sale-invoice-record-main/page`, params }) } -} \ No newline at end of file +} +// 销售开票申请 发布功能 +export const publish = async (id: number) => { + return await request.get({ url: `/wms/customer-sale-invoice-main/publish?id=` + id}) +} + +// 销售开票申请 作废功能 +export const nodeAbrogate = async (id: number) => { + return await request.get({ url: `/wms/customer-sale-invoice-main/nodeAbrogate?id=` + id}) +} diff --git a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue index a0b6bbad7..9a5c93b3d 100644 --- a/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue +++ b/src/views/wms/deliversettlementManage/customerSaleInvoiceRequestMain/index.vue @@ -61,12 +61,26 @@ @onChange="onChange" :sumFormDataByTableCustom=" (formRef, formModel, tableData) => { - tableData.forEach(item=>{ - - }) + const { taxRate = 0 } = formModel + // 1、主数据未税金额 mainBeforeTaxAmount : 所有明细行未税金额的和 + let mainBeforeTaxAmount = tableData.reduce( + (prev, item) => + prev + Number(item['beforeTaxAmount']), + 0 + ) + // 2.主数据税额 mainTaxAmount = 未税金额*税率/100 保留两位小数 + let mainTaxAmount = Number(Number(mainBeforeTaxAmount*taxRate*0.01).toFixed(2)) + const sumObject = { + // 主数据未税金额 + mainBeforeTaxAmount, + // 主数据税额 + mainTaxAmount, + // 主数据价税合计金额:mainAdTaxAmount =未税金额+税额 + mainAdTaxAmount:mainBeforeTaxAmount+mainTaxAmount + } + formRef.value.setValues(sumObject) } " - /> @@ -157,7 +171,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => const setV = {} if(formField == 'customerStatementNumber') { //客户对账单 - setV['customer'] = val[0]['customerCode'] + setV['customerCode'] = val[0]['customerCode'] setV['customerName'] = val[0]['customerName'] CustomerStatementDetailApi.getCustomerStatementDetailPage({ pageNo:1, @@ -170,6 +184,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => item['sumPrice'] = item['price'] + item['allocationPrice'] // 未税金额 默认等于数量*合计单价,可修改,必填,最多可输入2位小数 item['beforeTaxAmount'] = item['sumPrice']*item['qty'] + // 含税金额 未税价格+税额,四舍五入保留2位小数 item['afterTaxAmount'] = item['beforeTaxAmount'] + item['taxAmount'] //含税金额 // 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 @@ -210,9 +225,9 @@ const Echo = [] const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:`wms:customer-sale-invoice-main:create` }), // 新增 - defaultButtons.defaultImportBtn({hasPermi:`wms:customer-sale-invoice-main:import` }), // 导入 - defaultButtons.defaultExportBtn({hasPermi:`wms:customer-sale-invoice-main:export` }), // 导出 + defaultButtons.defaultAddBtn({hasPermi:`wms:customer-sale-invoice-request-main:create` }), // 新增 + defaultButtons.defaultImportBtn({hasPermi:`wms:customer-sale-invoice-request-main:import` }), // 导入 + defaultButtons.defaultExportBtn({hasPermi:`wms:customer-sale-invoice-request-main:export` }), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 @@ -264,14 +279,16 @@ const butttondata = (row,$index) => { return [] } return [ - defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5']),hasPermi:`wms:${routeName.value}:open`}), // 打开 - defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:`wms:${routeName.value}:close`}), // 关闭 - defaultButtons.mainListPlanSubBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:submit`}), // 提交审批 - defaultButtons.mainListPlanTurBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:reject`}), // 驳回 - defaultButtons.mainListPlanAppBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:agree`}), // 审批通过 - defaultButtons.mainListPlanPubBtn({hide:isShowMainButton(row,['3']),hasPermi:`wms:${routeName.value}:publish`}), // 发布 - defaultButtons.mainListPlanResBtn({hide:isShowMainButton(row,['4']),hasPermi:`wms:${routeName.value}:resetting`}), // 重置 - defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:update`}), // 编辑 + // defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5']),hasPermi:`wms:customer-sale-invoice-request-main:open`}), // 打开 + // defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:`wms:customer-sale-invoice-request-main:close`}), // 关闭 + // defaultButtons.mainListPlanSubBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:customer-sale-invoice-request-main:submit`}), // 提交审批 + // defaultButtons.mainListPlanTurBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:customer-sale-invoice-request-main:reject`}), // 驳回 + // defaultButtons.mainListPlanAppBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:customer-sale-invoice-request-main:agree`}), // 审批通过 + defaultButtons.mainListPlanPubBtn({hide:isShowMainButton(row,['3']),hasPermi:`wms:customer-sale-invoice-request-main:publish`}), // 发布 + // defaultButtons.mainListPlanResBtn({hide:isShowMainButton(row,['4']),hasPermi:`wms:customer-sale-invoice-request-main:resetting`}), // 重置 + defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:customer-sale-invoice-request-main:update`}), // 编辑 + defaultButtons.mainListCancelBtn({hide: isShowMainButton(row,['5']),hasPermi:'wms:customer-sale-invoice-request-main:cancel'}), //作废 + ] } @@ -334,7 +351,7 @@ const buttonTableClick = async (val, row) => { } else if (val == 'mainPlanPub') { // 发布 await message.confirm('确认要发布吗?') tableObject.loading = true - CustomerSaleInvoiceMainApi.publish(row.masterId).then(() => { + CustomerSaleInvoiceMainApi.publish(row.id).then(() => { message.success(t('common.updateSuccess')) tableObject.loading = false buttonBaseClick('refresh',null) @@ -342,6 +359,19 @@ const buttonTableClick = async (val, row) => { tableObject.loading = false console.log(err) }) + } else if (val == 'cancel') { // 作废 + tableObject.loading = true + try { + await message.confirm('确认要作废吗?') + await CustomerSaleInvoiceMainApi.nodeAbrogate(row.id) + await message.success(t('ts.作废成功')) + // 发起导出 + //exportLoading.value = true + } catch { + } finally { + // 刷新列表 + buttonBaseClick('refresh',null) + } } else if (val == 'mainPlanRes') { // 重置 await message.confirm('确认要重置吗?') tableObject.loading = true