Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
97190eed
Commit
97190eed
authored
Nov 12, 2017
by
季圣华
Browse files
修复'单位'为空的bug
parent
bb03e84f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/js/pages/materials/in_out.js
View file @
97190eed
...
@@ -915,67 +915,69 @@
...
@@ -915,67 +915,69 @@
body.find("[field='Unit']").find(input).val(unitSetInput).attr("data-ratio", loadRatio); //设置-首选单位
body.find("[field='Unit']").find(input).val(unitSetInput).attr("data-ratio", loadRatio); //设置-首选单位
body.find("[field='Unit']").find(input).off("click").on("click",function(){
body.find("[field='Unit']").find(input).off("click").on("click",function(){
var
self
=
this
;
if(basicUnit && otherUnit) {
//定义模版
var self = this;
var
temp
=
"
<div class='unit-list'>
"
;
//定义模版
temp
+=
"
<ul>
"
;
var temp = "<div class='unit-list'>";
temp
+=
"
<li data-type='basic' data-ratio='1'>
"
+
basicUnit
+
"
</li>
"
;
temp +="<ul>";
temp
+=
"
<li data-type='other' data-ratio='
"
+
ratio
+
"
'>
"
+
otherUnit
+
"
</li>
"
;
temp +="<li data-type='basic' data-ratio='1'>" + basicUnit + "</li>";
temp
+=
"
</ul>
"
;
temp +="<li data-type='other' data-ratio='" + ratio + "'>" + otherUnit + "</li>";
temp
+=
"
</div>
"
;
temp +="</ul>";
if
(
$
(
'
.unit-list
'
).
length
){
temp +="</div>";
$
(
'
.unit-list
'
).
remove
();
//如果存在计量单位列表先移除
if($('.unit-list').length){
}
$('.unit-list').remove(); //如果存在计量单位列表先移除
else
{
$
(
self
).
after
(
temp
);
//加载列表信息
}
//计量单位列表的单击事件
$
(
'
.unit-list ul li
'
).
off
(
"
click
"
).
on
(
"
click
"
,
function
(){
var
unit
=
$
(
this
).
text
();
var
thisRatio
=
$
(
this
).
attr
(
"
data-ratio
"
);
//获取比例
$
(
self
).
val
(
unit
).
attr
(
"
data-ratio
"
,
thisRatio
);
$
(
self
).
keyup
();
//模拟键盘操作
$
(
'
.unit-list
'
).
remove
();
//移除计量单位列表
var
stock
=
body
.
find
(
"
[field='Stock']
"
).
find
(
input
).
attr
(
"
data-stock
"
);
//从缓存中取值
var
type
=
$
(
this
).
attr
(
"
data-type
"
);
var
UnitPrice
=
0
;
if
(
type
===
"
basic
"
){
if
(
listTitle
==
"
采购入库列表
"
||
listTitle
==
"
销售退货列表
"
||
listTitle
==
"
其它入库列表
"
)
{
UnitPrice
=
basicPresetPriceOne
;
}
else
if
(
listTitle
==
"
销售出库列表
"
||
listTitle
==
"
采购退货列表
"
||
listTitle
==
"
其它出库列表
"
||
listTitle
==
"
调拨出库列表
"
||
listTitle
==
"
礼品充值列表
"
||
listTitle
==
"
礼品销售列表
"
)
{
UnitPrice
=
basicPresetPriceTwo
;
}
else
if
(
listTitle
==
"
零售出库列表
"
||
listTitle
==
"
零售退货列表
"
){
UnitPrice
=
retailPriceOne
;
}
body
.
find
(
"
[field='Stock']
"
).
find
(
input
).
val
(
stock
);
//修改库存
}
}
else
if
(
type
===
"
other
"
){
else {
if
(
listTitle
==
"
采购入库列表
"
||
listTitle
==
"
销售退货列表
"
||
listTitle
==
"
其它入库列表
"
)
{
$(self).after(temp); //加载列表信息
UnitPrice
=
otherPresetPriceOne
;
}
}
//计量单位列表的单击事件
else
if
(
listTitle
==
"
销售出库列表
"
||
listTitle
==
"
采购退货列表
"
||
listTitle
==
"
其它出库列表
"
||
listTitle
==
"
调拨出库列表
"
||
listTitle
==
"
礼品充值列表
"
||
listTitle
==
"
礼品销售列表
"
)
{
$('.unit-list ul li').off("click").on("click",function(){
UnitPrice
=
otherPresetPriceTwo
;
var unit = $(this).text();
var thisRatio = $(this).attr("data-ratio"); //获取比例
$(self).val(unit).attr("data-ratio", thisRatio);
$(self).keyup(); //模拟键盘操作
$('.unit-list').remove(); //移除计量单位列表
var stock = body.find("[field='Stock']").find(input).attr("data-stock"); //从缓存中取值
var type = $(this).attr("data-type");
var UnitPrice = 0;
if(type === "basic"){
if(listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") {
UnitPrice = basicPresetPriceOne;
}
else if(listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表" || listTitle == "礼品充值列表" || listTitle == "礼品销售列表") {
UnitPrice = basicPresetPriceTwo;
}
else if(listTitle == "零售出库列表" || listTitle == "零售退货列表"){
UnitPrice = retailPriceOne;
}
body.find("[field='Stock']").find(input).val(stock); //修改库存
}
}
else
if
(
listTitle
==
"
零售出库列表
"
||
listTitle
==
"
零售退货列表
"
){
else if(type === "other"){
UnitPrice
=
retailPriceTwo
;
if(listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") {
UnitPrice = otherPresetPriceOne;
}
else if(listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表" || listTitle == "礼品充值列表" || listTitle == "礼品销售列表") {
UnitPrice = otherPresetPriceTwo;
}
else if(listTitle == "零售出库列表" || listTitle == "零售退货列表"){
UnitPrice = retailPriceTwo;
}
body.find("[field='Stock']").find(input).val((stock/ratio).toFixed(2)); //修改库存
}
}
body
.
find
(
"
[field='Stock']
"
).
find
(
input
).
val
((
stock
/
ratio
).
toFixed
(
2
));
//修改库存
body.find("[field='UnitPrice']").find(input).val(UnitPrice); //单价
}
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //获取数量
body
.
find
(
"
[field='UnitPrice']
"
).
find
(
input
).
val
(
UnitPrice
);
//单价
var taxRate = body.find("[field='TaxRate']").find(input).val(); //获取税率
var
OperNumber
=
body
.
find
(
"
[field='OperNumber']
"
).
find
(
input
).
val
();
//获取数量
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
var
taxRate
=
body
.
find
(
"
[field='TaxRate']
"
).
find
(
input
).
val
();
//获取税率
body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
body
.
find
(
"
[field='TaxUnitPrice']
"
).
find
(
input
).
val
((
UnitPrice
*
(
1
+
taxRate
/
100
)).
toFixed
(
2
));
//含税单价
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
body
.
find
(
"
[field='AllPrice']
"
).
find
(
input
).
val
((
UnitPrice
*
OperNumber
).
toFixed
(
2
));
//金额
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
body
.
find
(
"
[field='TaxMoney']
"
).
find
(
input
).
val
((
UnitPrice
*
OperNumber
*
(
taxRate
/
100
)).
toFixed
(
2
));
//税额
statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
body
.
find
(
"
[field='TaxLastMoney']
"
).
find
(
input
).
val
((
UnitPrice
*
OperNumber
*
(
1
+
taxRate
/
100
)).
toFixed
(
2
));
//价税合计
});
statisticsFun
(
body
,
UnitPrice
,
OperNumber
,
footer
,
taxRate
);
//点击空白处移除计量单位列表
});
$(".datagrid-body").off("click").on("click",function(){
//点击空白处移除计量单位列表
$('.unit-list').remove(); //移除计量单位列表
$
(
"
.datagrid-body
"
).
off
(
"
click
"
).
on
(
"
click
"
,
function
(){
});
$
(
'
.unit-list
'
).
remove
();
//移除计量单位列表
}
});
});
});
}
}
var detailPrice = 0; //明细列表-单价
var detailPrice = 0; //明细列表-单价
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment