From 94843d2d9d8312545510c30319c4d5b58915d30c Mon Sep 17 00:00:00 2001 From: wangjiuyun <1595161655@qq.com> Date: Mon, 19 May 2025 17:27:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=9C=9F=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/manage/order/add.html | 100 ++++++++----- .../templates/manage/order/edit.html | 136 +++++++++--------- .../resources/templates/system/agent/add.html | 39 +++-- .../templates/system/agent/edit.html | 37 +++-- .../templates/system/customer/add.html | 89 +++++++----- .../templates/system/customer/edit.html | 92 +++++++----- .../templates/system/partner/add.html | 2 +- .../templates/system/partner/edit.html | 18 ++- 8 files changed, 312 insertions(+), 201 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/manage/order/add.html b/ruoyi-admin/src/main/resources/templates/manage/order/add.html index e23720cb..26adc5b4 100644 --- a/ruoyi-admin/src/main/resources/templates/manage/order/add.html +++ b/ruoyi-admin/src/main/resources/templates/manage/order/add.html @@ -142,8 +142,6 @@
%s
", value); + return html; + } + }, { field: 'quantity', align: 'center', title: '数量', formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); + var html = $.common.sprintf("", index, value); return html; } }, @@ -216,25 +223,26 @@ align: 'center', title: '单价', formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); + var html = $.common.sprintf("", index, value); return html; } }, { - field: 'discount', - align: 'center', - title: '折扣', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); + field: 'discount', + align: 'center', + title: '折扣', + width:60, + formatter: function(value, row, index) { + var html = $.common.sprintf("", index, value); return html; - } + } }, { field: 'amount', align: 'center', title: '总价', formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); + var html = $.common.sprintf("", index, value); return html; } }, @@ -258,21 +266,23 @@ }; $.table.init(options); }); - function addRow() { + function addRow(row) { var count = $("#" + table.options.id).bootstrapTable('getData').length; var row = { index: $.table.serialNumber(count), - productId: "", - productCode: "", - quantity: "", - price: "", - amount: "", - remark: "", - createdAt: "", - updatedAt: "", - deletedAt: "", + productId: row.productId, + productCode: row.productCode, + quantity: row.quantity, + price: row.price, + amount: row.amount, + remark: row.remark, + createdAt: row.createdAt, + updatedAt: row.updatedAt, + deletedAt: row.deletedAt, + discount: row.discount, } sub.addRow(row); + } function selectCustomer(){ var url = prefix+"/customer"; @@ -294,6 +304,16 @@ }; $.modal.openOptions(options); } + function selectPartner() { + var url = prefix+"/partner"; + var options = { + title: '选择代理商', + width: "680", + url: url, + callBack: doSubmitPartner + }; + $.modal.openOptions(options); + } function doSubmitCustomer(index, layero){ var rows = layero.find("iframe")[0].contentWindow.getSelections(); if (rows.length == 0) { @@ -316,16 +336,6 @@ $('[name="orderAgentCode"]').val(rows[0].agentCode); $.modal.close(index); } - function selectPartner() { - var url = prefix+"/partner"; - var options = { - title: '选择代理商', - width: "680", - url: url, - callBack: doSubmitPartner - }; - $.modal.openOptions(options); - } function doSubmitPartner(index, layero){ var rows = layero.find("iframe")[0].contentWindow.getSelections(); if (rows.length == 0) { @@ -351,21 +361,29 @@ $.modal.closeLoading(); }) - } document.getElementById('uploadInput').addEventListener('change', function(event) { + } + document.getElementById('uploadInput').addEventListener('change', function(event) { const file = event.target.files[0]; let data=new FormData() data.append('file',file) - data.append('orderId',$('#bootstrap-table').attr('deliveryid')) - var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象 - xhr.open('POST',prefix+'/list/importData', true); // 设置请求类型和URL + xhr.open('POST',prefix+'/list/readData', true); // 设置请求类型和URL // 当请求完成时执行的回调函数 xhr.onload = function (res) { let data=JSON.parse(res.currentTarget.response) if (data.code === 0) { $.modal.msgSuccess('导入成功'); - $.table.refresh(); + data.data.forEach((row)=>{ + addRow(row) + }) + $('.discount').on('change',function (){ + + changeTotal($(this)) + }) + $('.discount').on('focus',function(){ + $(this).blur() + }) } else { $.modal.msgError(data.msg||'导入失败'); } @@ -383,6 +401,14 @@ }); + + function changeTotal(ele){ + let price= Number($(ele).parent().parent().find('.price').val())||0 + let quantity=Number($(ele).parent().parent().find('.quantity').val())||0 + let discount=$(ele).val()||0 + let res= Number((price*quantity*discount).toFixed(2)) + $(ele).parent().parent().find('.amount').val(res) + }