From e9769f8c754ce77e4d1252827122dfd356ce9b20 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 05 十二月 2023 15:13:34 +0800
Subject: [PATCH] 销售订单:选择物料页面数据加载太慢
---
WebTM/views/销售管理/销售订单/Add_Edit_Xs_SeOrderBillList.html | 205 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 189 insertions(+), 16 deletions(-)
diff --git "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html" "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
index c1b36ff..94cfd97 100644
--- "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
+++ "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
@@ -192,7 +192,7 @@
</div>
<div class="layui-row">
<div class="layui-inline">
- <label class="layui-form-label">瀹㈡埛浣欓</label>
+ <label class="layui-form-label">瀹㈡埛浣欓<i class="layui-icon layui-icon-tips" id="tips-HCusBalance"></i></label>
<div class="layui-input-inline">
<input class="layui-input" name="HCusBalance" id="HCusBalance" autocomplete="off" readonly>
</div>
@@ -204,9 +204,15 @@
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label">鍙敤棰濆害</label>
+ <label class="layui-form-label">鍙敤棰濆害<i class="layui-icon layui-icon-tips" id="tips-HAvailableBalance"></i></label>
<div class="layui-input-inline">
<input class="layui-input" name="HAvailableBalance" id="HAvailableBalance" autocomplete="off" readonly>
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label">闇�姹傞噾棰�<i class="layui-icon layui-icon-tips" id="tips-HBillMoney"></i></label>
+ <div class="layui-input-inline">
+ <input class="layui-input" name="HBillMoney" id="HBillMoney" autocomplete="off" readonly>
</div>
</div>
</div>
@@ -643,7 +649,13 @@
var HTaxMoney = HMoney * HTaxRate; //绋庨=閲戦*绋庣巼
var HlineTotal = HMoney + HTaxMoney; //浠风◣鍚堣=閲戦+绋庨
-
+ //璁剧疆鏁版嵁灏忔暟浣嶆暟
+ HQty = dealDoubleToFixed(HQty, 1);
+ HPrice = dealDoubleToFixed(HPrice, 3);
+ HTaxRate = HTaxRate;
+ HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+ HMoney = dealDoubleToFixed(HMoney, 2);
+ HlineTotal = dealDoubleToFixed(HlineTotal, 2);
//鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
obj.update({
@@ -655,6 +667,8 @@
, HlineTotal: HlineTotal
});
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
break;
case "HPrice": //鍗曚环
//鏁版嵁鏍煎紡鏍¢獙
@@ -683,7 +697,13 @@
var HTaxMoney = HMoney * HTaxRate; //绋庨=閲戦*绋庣巼
var HlineTotal = HMoney + HTaxMoney; //浠风◣鍚堣=閲戦+绋庨
-
+ //璁剧疆鏁版嵁灏忔暟浣嶆暟
+ HQty = dealDoubleToFixed(HQty, 1);
+ HPrice = dealDoubleToFixed(HPrice, 3);
+ HTaxRate = HTaxRate;
+ HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+ HMoney = dealDoubleToFixed(HMoney, 2);
+ HlineTotal = dealDoubleToFixed(HlineTotal, 2);
//鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
obj.update({
@@ -695,6 +715,8 @@
, HlineTotal: HlineTotal
});
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
break;
case "HTaxRate": //鏁伴噺
//鏁版嵁鏍煎紡鏍¢獙
@@ -723,7 +745,13 @@
var HTaxMoney = HMoney * HTaxRate; //绋庨=閲戦*绋庣巼
var HlineTotal = HMoney + HTaxMoney; //浠风◣鍚堣=閲戦+绋庨
-
+ //璁剧疆鏁版嵁灏忔暟浣嶆暟
+ HQty = dealDoubleToFixed(HQty, 1);
+ HPrice = dealDoubleToFixed(HPrice, 3);
+ HTaxRate = HTaxRate;
+ HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+ HMoney = dealDoubleToFixed(HMoney, 2);
+ HlineTotal = dealDoubleToFixed(HlineTotal, 2);
//鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
obj.update({
@@ -735,6 +763,8 @@
, HlineTotal: HlineTotal
});
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
break;
case "HTaxPrice": //鏁伴噺
//鏁版嵁鏍煎紡鏍¢獙
@@ -763,7 +793,13 @@
var HTaxMoney = HMoney * HTaxRate; //绋庨=閲戦*绋庣巼
var HlineTotal = HMoney + HTaxMoney; //浠风◣鍚堣=閲戦+绋庨
-
+ //璁剧疆鏁版嵁灏忔暟浣嶆暟
+ HQty = dealDoubleToFixed(HQty, 1);
+ HPrice = dealDoubleToFixed(HPrice, 3);
+ HTaxRate = HTaxRate;
+ HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+ HMoney = dealDoubleToFixed(HMoney, 2);
+ HlineTotal = dealDoubleToFixed(HlineTotal, 2);
//鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
obj.update({
@@ -775,11 +811,38 @@
, HlineTotal: HlineTotal
});
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
break;
default:
}
});
//#endregion
+ //#endregion
+
+ //#region 鏂囨湰妗嗙洃鍚�
+ $(document).ready(function () {
+ //#region 瀹㈡埛浣欓鎻愮ず淇℃伅
+ $("#tips-HCusBalance").on('click', function (data) {
+ var tips_Message = "瀹㈡埛浣欓 = 鏈熷垵+鏈湡鏀舵锛堝凡瀹℃牳锛�-鏈湡閫�娆撅紙宸插鏍革級-鏈湡鍑哄簱锛堝凡瀹℃牳锛�+鏈湡閫�璐э紙宸插鏍革級";
+ layer.alert(tips_Message, { icon: 0, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+ });
+ //#endregion
+
+ //#region 鍙敤浣欓鎻愮ず淇℃伅
+ $("#tips-HAvailableBalance").on('click', function (data) {
+ var tips_Message = "鍙敤棰濆害 = 瀹㈡埛浣欓 + 淇$敤棰濆害 - 锛堟湰鏈熼攢鍞鍗曟�婚噾棰� * 0.5锛�";
+ layer.alert(tips_Message, { icon: 0, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+ });
+ //#endregion
+
+ //#region 闇�姹傞噾棰�
+ $("#tips-HBillMoney").on('click', function (data) {
+ var tips_Message = "闇�姹傞噾棰� = 浠风◣鍚堣 * 0.5";
+ layer.alert(tips_Message, { icon: 0, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+ });
+ //#endregion
+ });
//#endregion
//#endregion
@@ -889,24 +952,25 @@
option = {
elem: '#mainTable'
, toolbar: '#toolbarDemo'
+ , totalRow: true
, limit: 500
, height: 500
, loading: false
, cols: [[ //瀛愯〃
{ type: 'checkbox', totalRowText: '鍚堣琛�', style: 'background-color:#efefef4d;' }
- , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
+ , { type: 'numbers', title: '搴忓彿', width: 100, style: 'background-color:#efefef4d;' }
, { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
, { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, edit: 'text', event: "HMaterID" }//f7
, { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, style: 'background-color:#efefef4d;' }
, { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;' }
, { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
, { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, style: 'background-color:#efefef4d;' }//f7
- , { field: 'HQty', title: '鏁伴噺', width: 100, edit: 'text' }
+ , { field: 'HQty', title: '鏁伴噺', width: 100, totalRow: true, edit: 'text' }
, { field: 'HPrice', title: '鍗曚环', width: 100, edit: 'text' }
, { field: 'HTaxRate', title: '绋庣巼', width: 100, edit: 'text' }
, { field: 'HTaxPrice', title: '鍚◣鍗曚环', width: 100, edit: 'text' }
- , { field: 'HMoney', title: '閲戦', width: 100, style: 'background-color:#efefef4d;' }
- , { field: 'HlineTotal', title: '浠风◣鍚堣', width: 100, style: 'background-color:#efefef4d;' }
+ , { field: 'HMoney', title: '閲戦', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
+ , { field: 'HlineTotal', title: '浠风◣鍚堣', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
, { field: 'HDate', title: '浜よ揣鏃ユ湡', event: "HDate", width: 120 }
, { field: 'HRemark', title: '澶囨敞', width: 100, edit: 'text' }
@@ -946,6 +1010,9 @@
option.data = rowdata;
table.render(option);
+
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
}
//#endregion
@@ -1045,15 +1112,15 @@
"瑙勬牸鍨嬪彿": result.data[i]["瑙勬牸鍨嬪彿"],
"HUnitID": result.data[i]["HUnitID"],
"璁¢噺鍗曚綅": result.data[i]["璁¢噺鍗曚綅"],
- "HQty": result.data[i]["鏁伴噺"],
- "HPrice": result.data[i]["鍗曚环"],
- "HTaxPrice": result.data[i]["鍚◣鍗曚环"],
- "HMoney": result.data[i]["閲戦"],
+ "HQty": dealDoubleToFixed(result.data[i]["鏁伴噺"], 1),
+ "HPrice": dealDoubleToFixed(result.data[i]["鍗曚环"], 3),
+ "HTaxPrice": dealDoubleToFixed(result.data[i]["鍚◣鍗曚环"], 3),
+ "HMoney": dealDoubleToFixed(result.data[i]["閲戦"],2),
"HDiscountRate": result.data[i]["鎶樻墸鐜�"],
"HRelTaxPrice": result.data[i]["瀹為檯鍚◣鍗曚环"],
"HTaxRate": result.data[i]["绋庣巼"],
"HTaxMoney": result.data[i]["绋庨"],
- "HlineTotal": result.data[i]["浠风◣鍚堣"],
+ "HlineTotal": dealDoubleToFixed(result.data[i]["浠风◣鍚堣"],2),
"HlineTotalBB": result.data[i]["鏈綅甯佷环绋庡悎璁�"],
"HDate": formatDate(result.data[i]["浜よ揣鏃ユ湡"]),
"HOutStockQty": result.data[i]["鍑哄簱鏁伴噺"],
@@ -1069,6 +1136,9 @@
option.cols[0][20].edit = null;
table.render(option);
+
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
layer.close(ajaxLoad);
} else {
layer.close(ajaxLoad);
@@ -1573,6 +1643,8 @@
table.cache["mainTable"].push(NewRow);
option.data = table.cache["mainTable"];
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
//rows++;
layer.msg('澧炲姞涓�琛屾寜閽紒')
}
@@ -1594,6 +1666,8 @@
}
option.data = tables;
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
} else {
layer.msg('璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒');
}
@@ -1618,6 +1692,8 @@
option.data[option.data.length - 1].HWeight = "0";
table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
}
}
//#endregion
@@ -1642,6 +1718,8 @@
option.data[i - 1] = data[0];
option.data[i] = tables[0];
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
break;
}
}
@@ -1673,6 +1751,8 @@
option.data[i + 1] = data[0];
option.data[i] = tables[0];
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
break;
}
}
@@ -1698,6 +1778,8 @@
oldData.splice(obj.tr.data('index'), 1);
option.data = oldData;
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
layer.close(index);
}
});
@@ -1711,6 +1793,8 @@
if (event.key == "F7") {
//鐗╂枡
if (obj.event == "HMaterID") {
+ var HOrgID = $("#HOrgID").val();
+
layer.open({
type: 2
, skin: "layui-layer-rim" //鍔犱笂杈规
@@ -1719,7 +1803,7 @@
, shift: 2 //寮瑰嚭鍔ㄧ敾
, area: ["90%", "90%"] //绐椾綋澶у皬
, maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
- , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html', 'yes']
+ , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
, btn: ["纭畾", "鍙栨秷"]
, btn1: function (index, laero) {
//鎸夐挳涓� 鐨勫洖璋�
@@ -1788,6 +1872,8 @@
}
table.render(option);
+ //璁剧疆琛ㄥご鎵�闇�閲戦
+ set_HBillMoney();
layer.close(index);//鍏抽棴寮圭獥
}
@@ -1986,6 +2072,24 @@
//#region 鎵撳嵃
function get_PrintReport() {
+ //#region 鍒ゆ柇婧愬崟鐘舵��
+ var HSourceBillData = "";
+ var HSourceBillData = getSourceBillStatus_SeOrderBill(); //鑾峰彇婧愬崟鏁版嵁
+ if (HSourceBillData != "none") {
+ if (HSourceBillData.length == 0) {
+ layer.alert("鎵撳嵃澶辫触!鏈煡璇㈠埌鍗曟嵁淇℃伅!", { icon: 5 });
+ return;
+ } else if (HSourceBillData[0]["鐘舵��"] != "宸插鏍�") {
+ layer.alert("鎵撳嵃澶辫触!鍗曟嵁鐘舵�佹湭涓�'宸插鏍�'鐘舵��!", { icon: 5 });
+ return;
+ }
+ } else {
+ return;
+ }
+ //#endregion
+
+
+
var InterID = $("#HInterID").val();
$.ajax({
type: "GET",
@@ -2010,6 +2114,39 @@
layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
}
});
+ }
+ //#endregion
+
+ //#region 璁剧疆琛ㄥご鎵�闇�閲戦
+ function set_HBillMoney() {
+ var HBillMoney = 0;
+ for (var i = 0; i < option.data.length; i++) {
+ HBillMoney += option.data[i]["HlineTotal"] * 1;
+ }
+ $("#HBillMoney").val(HBillMoney * 0.5);
+ }
+ //#endregion
+
+ //#region 鑾峰彇婧愬崟-閿�鍞鍗曞崟鎹姸鎬�
+ function getSourceBillStatus_SeOrderBill() {
+ var HSourceBillData = "none";
+ var sWhere = " and hmainid = " + $("#HInterID").val();
+ $.ajax({
+ url: GetWEBURL() + '/Xs_SeOrderBill/list',
+ async: false,
+ type: "GET",
+ data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
+ success: function (data1) {
+ if (data1.count == 1) {
+ HSourceBillData = data1.data;
+ } else {
+ layer.alert(data1.code + "鍗曟嵁鐘舵�佸垽鏂け璐ワ紒", { icon: 5 });
+ }
+ }, error: function () {
+ layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+ }
+ });
+ return HSourceBillData;
}
//#endregion
//#endregion
@@ -2146,6 +2283,42 @@
});
}
//#endregion
+
+ //#region 澶勭悊灏忔暟鏄剧ず浣嶆暟锛坉ata锛氶渶瑕佸鐞嗙殑鏁版嵁锛沶um锛氭暟鎹殑绫诲瀷(濡�1:鏁伴噺锛�2:閲戦锛�3:鍗曚环)锛�
+ function dealDoubleToFixed(data, num) {
+ //鐢ㄤ簬璁剧疆灏忔暟浣嶆暟
+ var dotLength = 0;
+
+ if (num == 1) { //褰撴暟鎹负鏁伴噺鏃讹紝鏈�澶氫繚鐣�6浣嶅皬鏁�
+ //璁剧疆鏈�澶氫繚鐣�6浣嶅皬鏁�
+ dotLength = 6;
+ } else if (num == 2) { //褰撴暟鎹负閲戦鏃讹紝鏈�澶氫繚鐣�2浣嶅皬鏁�
+ //璁剧疆鏈�澶氫繚鐣�2浣嶅皬鏁�
+ dotLength = 2;
+ } else if (num == 3) { //褰撴暟鎹负鍗曚环鏃讹紝鏈�澶氫繚鐣�4浣嶅皬鏁�
+ //璁剧疆鏈�澶氫繚鐣�4浣嶅皬鏁�
+ dotLength = 4;
+ }
+
+ //鍒ゆ柇鏄惁瀛樺湪灏忔暟鐐瑰強鍏剁储寮曚綅缃�
+ data = data + "";
+ var index = data.indexOf(".");
+
+ //澶勭悊鏁版嵁骞惰繑鍥�
+ if (index < 0) {
+ return data * 1;
+ } else {
+ //鑾峰彇灏忔暟浣嶆暟
+ var length = data.length - index - 1;
+ if (length <= dotLength) {
+ return data * 1;
+ } else {
+ data = data * 1;
+ return data.toFixed(dotLength);
+ }
+ }
+ }
+ //#endregion
</script>
</body>
</html>
\ No newline at end of file
--
Gitblit v1.9.1