Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷月半明
Skyeye
提交
dd52c393
S
Skyeye
项目概览
冷月半明
/
Skyeye
与 Fork 源项目一致
Fork自
doc_wei / Skyeye
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Skyeye
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dd52c393
编写于
8月 13, 2022
作者:
doc_wei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【ERP】零售出库选择商品整改
上级
a6bd0797
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
221 addition
and
442 deletion
+221
-442
erp/src/main/resources/template/js/erpcommon/calculatePrice.js
...rc/main/resources/template/js/erpcommon/calculatePrice.js
+7
-19
erp/src/main/resources/template/js/erpcommon/loadStock.js
erp/src/main/resources/template/js/erpcommon/loadStock.js
+37
-13
erp/src/main/resources/template/js/purchaseorder/purchaseorderadd.js
...n/resources/template/js/purchaseorder/purchaseorderadd.js
+1
-1
erp/src/main/resources/template/js/purchaseorder/purchaseorderedit.js
.../resources/template/js/purchaseorder/purchaseorderedit.js
+2
-1
erp/src/main/resources/template/js/purchaseput/purchaseputadd.js
.../main/resources/template/js/purchaseput/purchaseputadd.js
+1
-1
erp/src/main/resources/template/js/purchaseput/purchaseputedit.js
...main/resources/template/js/purchaseput/purchaseputedit.js
+2
-1
erp/src/main/resources/template/js/purchasereturns/purchasereturnsadd.js
...sources/template/js/purchasereturns/purchasereturnsadd.js
+1
-1
erp/src/main/resources/template/js/purchasereturns/purchasereturnsedit.js
...ources/template/js/purchasereturns/purchasereturnsedit.js
+2
-1
erp/src/main/resources/template/js/retailoutlet/retailoutletadd.js
...ain/resources/template/js/retailoutlet/retailoutletadd.js
+68
-154
erp/src/main/resources/template/js/retailoutlet/retailoutletedit.js
...in/resources/template/js/retailoutlet/retailoutletedit.js
+96
-170
erp/src/main/resources/template/tpl/retailoutlet/retailoutletadd.html
.../resources/template/tpl/retailoutlet/retailoutletadd.html
+2
-40
erp/src/main/resources/template/tpl/retailoutlet/retailoutletedit.html
...resources/template/tpl/retailoutlet/retailoutletedit.html
+2
-40
未找到文件。
erp/src/main/resources/template/js/erpcommon/calculatePrice.js
浏览文件 @
dd52c393
...
...
@@ -11,7 +11,6 @@ function calculatedTotalPrice() {
var
unitPrice
=
parseFloat
(
isNull
(
$
(
"
#unitPrice
"
+
thisRowKey
).
val
())
?
0
:
$
(
"
#unitPrice
"
+
thisRowKey
).
val
());
// 获取税率
var
taxRate
=
parseFloat
(
isNull
(
$
(
"
#taxRate
"
+
thisRowKey
).
val
())
?
0
:
$
(
"
#taxRate
"
+
thisRowKey
).
val
())
/
100
;
if
(
'
rkNum
'
===
showTdByEdit
)
{
//数量
//输出金额
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
...
...
@@ -149,16 +148,16 @@ function calculatedTotalPrice() {
$
(
"
#allPrice
"
).
html
(
allPrice
.
toFixed
(
2
));
$
(
"
#taxLastMoneyPrice
"
).
html
(
taxLastMoneyPrice
.
toFixed
(
2
));
//优惠率计算
//
优惠率计算
var
discount
=
parseFloat
(
isNull
(
$
(
"
#discount
"
).
val
())
?
0
:
$
(
"
#discount
"
).
val
());
//输出优惠金额
//
输出优惠金额
var
discountMoney
=
(
taxLastMoneyPrice
*
discount
/
100
).
toFixed
(
2
);
$
(
"
#discountMoney
"
).
val
(
discountMoney
);
//输出优惠后的金额
//
输出优惠后的金额
$
(
"
#discountLastMoney
"
).
html
((
taxLastMoneyPrice
-
discountMoney
).
toFixed
(
2
));
//输出本次付款
//
输出本次付款
$
(
"
#changeAmount
"
).
val
((
taxLastMoneyPrice
-
discountMoney
).
toFixed
(
2
));
//输出欠款金额
//
输出欠款金额
$
(
"
#arrears
"
).
html
(
'
0.00
'
);
}
...
...
@@ -258,25 +257,14 @@ layui.define(["jquery"], function(exports) {
})(
jQuery
);
});
// 判断选中的商品是否也在数组中
function
inTableDataArrayByAssetarId
(
materialId
,
unitId
,
array
)
{
var
isIn
=
false
;
$
.
each
(
array
,
function
(
i
,
item
)
{
if
(
item
.
mUnitId
===
unitId
&&
item
.
materialId
===
materialId
)
{
isIn
=
true
;
return
false
;
}
});
return
isIn
;
}
// 计算其他费用总价格
function
calculationPrice
(){
var
allPrice
=
0
;
$
.
each
(
initTableChooseUtil
.
getDataRowIndex
(
'
otherPriceTableList
'
),
function
(
i
,
item
)
{
// 获取行坐标
var
thisRowKey
=
item
;
allPrice
+=
parseFloat
(
isNull
(
$
(
"
#otherPrice
"
+
thisRowKey
).
val
())
?
0
:
$
(
"
#otherPrice
"
+
thisRowKey
).
val
());
var
otherPrice
=
$
(
"
#otherPrice
"
+
thisRowKey
).
val
();
allPrice
+=
parseFloat
(
isNull
(
otherPrice
)
?
0
:
otherPrice
);
});
$
(
"
#otherPriceTotal
"
).
html
(
"
费用合计:
"
+
allPrice
.
toFixed
(
2
));
}
erp/src/main/resources/template/js/erpcommon/loadStock.js
浏览文件 @
dd52c393
...
...
@@ -29,16 +29,15 @@ function loadTockByDepotAndMUnit(rowNum, depotId) {
* @param depotId 仓库id
*/
function
loadMaterialDepotStockByDepotId
(
depotId
)
{
var
rowTr
=
$
(
"
#useTable tr
"
);
var
normsIds
=
new
Array
();
var
normsIdsNum
=
new
Array
();
$
.
each
(
rowTr
,
function
(
i
,
item
)
{
$
.
each
(
initTableChooseUtil
.
getDataRowIndex
(
'
productList
'
)
,
function
(
i
,
item
)
{
// 获取行坐标
var
rowNum
=
$
(
item
).
attr
(
"
trcusid
"
).
replace
(
"
tr
"
,
""
)
;
var
unitId
=
$
(
"
#
unitId
"
+
rowNum
).
val
();
var
thisRowKey
=
item
;
var
unitId
=
$
(
"
#
mUnitId
"
+
thisRowKey
).
val
();
if
(
!
isNull
(
unitId
))
{
normsIds
.
push
(
unitId
);
normsIdsNum
.
push
(
rowNum
);
normsIdsNum
.
push
(
thisRowKey
);
}
});
if
(
normsIds
.
length
==
0
)
{
...
...
@@ -74,12 +73,27 @@ function getStockAjaxByDepotAndNormsId(normsIds, depotId, callBack) {
}});
}
// 判断选中的商品是否也在数组中
function
inTableDataArrayByAssetarId
(
materialId
,
unitId
,
array
)
{
var
isIn
=
false
;
$
.
each
(
array
,
function
(
i
,
item
)
{
if
(
item
.
mUnitId
===
unitId
&&
item
.
materialId
===
materialId
)
{
isIn
=
true
;
return
false
;
}
});
return
isIn
;
}
/**
* 商品规格加载变化事件
*
* @param form 表单对象
* @param allChooseProduct 商品对象
* @param unitPriceKey 单价显示的key,不用的单据类型展示不同的商品价格类型(零售价,最低售价,销售价等)
* @param calcPriceCallback 计算价格回调的函数
*/
function
mUnitChangeEvent
(
form
,
allChooseProduct
)
{
function
mUnitChangeEvent
(
form
,
allChooseProduct
,
unitPriceKey
,
calcPriceCallback
)
{
// 商品规格加载变化事件
form
.
on
(
'
select(selectUnitProperty)
'
,
function
(
data
)
{
var
thisRowValue
=
data
.
value
;
...
...
@@ -91,8 +105,9 @@ function mUnitChangeEvent(form, allChooseProduct) {
if
(
thisRowValue
==
bean
.
id
)
{
var
rkNum
=
parseInt
(
$
(
"
#rkNum
"
+
thisRowKey
).
val
());
// 设置单价和金额
$
(
"
#unitPrice
"
+
thisRowKey
).
val
(
bean
.
estimatePurchasePrice
.
toFixed
(
2
));
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
parseFloat
(
bean
.
estimatePurchasePrice
)).
toFixed
(
2
));
var
unitPrice
=
bean
[
unitPriceKey
].
toFixed
(
2
);
$
(
"
#unitPrice
"
+
thisRowKey
).
val
(
unitPrice
);
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
parseFloat
(
unitPrice
)).
toFixed
(
2
));
return
false
;
}
});
...
...
@@ -104,8 +119,12 @@ function mUnitChangeEvent(form, allChooseProduct) {
var
depotId
=
isNull
(
$
(
"
#depotId
"
).
val
())
?
""
:
$
(
"
#depotId
"
).
val
();
// 加载库存
loadTockByDepotAndMUnit
(
thisRowKey
,
depotId
);
// 计算价格
calculatedTotalPrice
();
if
(
typeof
calcPriceCallback
==
"
function
"
)
{
calcPriceCallback
();
}
else
{
// 计算价格
calculatedTotalPrice
();
}
});
}
...
...
@@ -114,8 +133,9 @@ function mUnitChangeEvent(form, allChooseProduct) {
*
* @param form 表单对象
* @param callback 回调函数
* @param calcPriceCallback 计算价格回调的函数
*/
function
initChooseProductBtnEnent
(
form
,
callback
)
{
function
initChooseProductBtnEnent
(
form
,
callback
,
calcPriceCallback
)
{
var
selOptionHtml
=
getFileContent
(
'
tpl/template/select-option.tpl
'
);
$
(
"
body
"
).
on
(
"
click
"
,
"
.chooseProductBtn
"
,
function
(
e
)
{
var
trId
=
$
(
this
).
parent
().
parent
().
attr
(
"
trcusid
"
);
...
...
@@ -130,8 +150,12 @@ function initChooseProductBtnEnent (form, callback) {
if
(
typeof
callback
==
"
function
"
)
{
callback
(
trId
,
chooseProductMation
);
}
// 计算价格
calculatedTotalPrice
();
if
(
typeof
calcPriceCallback
==
"
function
"
)
{
calcPriceCallback
();
}
else
{
// 计算价格
calculatedTotalPrice
();
}
});
});
}
...
...
erp/src/main/resources/template/js/purchaseorder/purchaseorderadd.js
浏览文件 @
dd52c393
...
...
@@ -78,7 +78,7 @@ layui.config({
matchingLanguage
();
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
);
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
estimatePurchasePrice
"
);
// 保存为草稿
form
.
on
(
'
submit(formAddBean)
'
,
function
(
data
)
{
...
...
erp/src/main/resources/template/js/purchaseorder/purchaseorderedit.js
浏览文件 @
dd52c393
...
...
@@ -135,6 +135,7 @@ layui.config({
addRowCallback
:
function
(
trcusid
)
{
// 设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
calculatedTotalPrice
();
},
form
:
form
,
minData
:
1
...
...
@@ -142,7 +143,7 @@ layui.config({
}
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
);
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
estimatePurchasePrice
"
);
// 保存为草稿
form
.
on
(
'
submit(formEditBean)
'
,
function
(
data
)
{
...
...
erp/src/main/resources/template/js/purchaseput/purchaseputadd.js
浏览文件 @
dd52c393
...
...
@@ -103,7 +103,7 @@ layui.config({
matchingLanguage
();
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
);
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
estimatePurchasePrice
"
);
// 仓库变化事件
form
.
on
(
'
select(depotId)
'
,
function
(
data
)
{
...
...
erp/src/main/resources/template/js/purchaseput/purchaseputedit.js
浏览文件 @
dd52c393
...
...
@@ -154,6 +154,7 @@ layui.config({
addRowCallback
:
function
(
trcusid
)
{
// 设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
calculatedTotalPrice
();
},
form
:
form
,
minData
:
1
...
...
@@ -177,7 +178,7 @@ layui.config({
}
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
);
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
estimatePurchasePrice
"
);
// 仓库变化事件
form
.
on
(
'
select(depotId)
'
,
function
(
data
)
{
...
...
erp/src/main/resources/template/js/purchasereturns/purchasereturnsadd.js
浏览文件 @
dd52c393
...
...
@@ -104,7 +104,7 @@ layui.config({
matchingLanguage
();
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
);
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
estimatePurchasePrice
"
);
// 仓库变化事件
form
.
on
(
'
select(depotId)
'
,
function
(
data
)
{
...
...
erp/src/main/resources/template/js/purchasereturns/purchasereturnsedit.js
浏览文件 @
dd52c393
...
...
@@ -156,6 +156,7 @@ layui.config({
addRowCallback
:
function
(
trcusid
)
{
// 设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
calculatedTotalPrice
();
},
form
:
form
,
minData
:
1
...
...
@@ -179,7 +180,7 @@ layui.config({
}
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
);
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
estimatePurchasePrice
"
);
// 仓库变化事件
form
.
on
(
'
select(depotId)
'
,
function
(
data
)
{
...
...
erp/src/main/resources/template/js/retailoutlet/retailoutletadd.js
浏览文件 @
dd52c393
...
...
@@ -18,11 +18,8 @@ layui.config({
layedit
=
layui
.
layedit
,
form
=
layui
.
form
;
var
rowNum
=
1
;
//表格的序号
var
usetableTemplate
=
$
(
"
#usetableTemplate
"
).
html
();
var
selOption
=
getFileContent
(
'
tpl/template/select-option.tpl
'
);
//已经选择的商品集合key:表格的行trId,value:商品信息
//
已经选择的商品集合key:表格的行trId,value:商品信息
var
allChooseProduct
=
{};
// 获取单据提交类型
...
...
@@ -43,40 +40,40 @@ layui.config({
erpOrderUtil
.
getDepotList
(
function
(
json
){
// 加载仓库数据
$
(
"
#depotId
"
).
html
(
getDataUseHandlebars
(
selOption
,
json
));
// 初始化一行数据
addRow
();
});
// 商品
initTableChooseUtil
.
initTable
({
id
:
"
productList
"
,
cols
:
[
{
id
:
'
materialId
'
,
title
:
'
商品(型号)
'
,
formType
:
'
chooseInput
'
,
width
:
'
150
'
,
iconClassName
:
'
chooseProductBtn
'
,
verify
:
'
required
'
},
{
id
:
'
mUnitId
'
,
title
:
'
单位
'
,
formType
:
'
select
'
,
width
:
'
50
'
,
verify
:
'
required
'
,
layFilter
:
'
selectUnitProperty
'
},
{
id
:
'
currentTock
'
,
title
:
'
库存
'
,
formType
:
'
detail
'
,
width
:
'
80
'
},
{
id
:
'
rkNum
'
,
title
:
'
数量
'
,
formType
:
'
input
'
,
width
:
'
80
'
,
className
:
'
change-input rkNum
'
,
verify
:
'
required|number
'
,
value
:
'
1
'
},
{
id
:
'
unitPrice
'
,
title
:
'
单价
'
,
formType
:
'
input
'
,
width
:
'
80
'
,
className
:
'
change-input unitPrice
'
,
verify
:
'
required|money
'
},
{
id
:
'
amountOfMoney
'
,
title
:
'
金额
'
,
formType
:
'
input
'
,
width
:
'
80
'
,
className
:
'
change-input amountOfMoney
'
,
verify
:
'
required|money
'
},
{
id
:
'
remark
'
,
title
:
'
备注
'
,
formType
:
'
input
'
,
width
:
'
100
'
}
],
deleteRowCallback
:
function
(
trcusid
)
{
delete
allChooseProduct
[
trcusid
];
// 计算价格
calculatedTotalPrice
();
},
addRowCallback
:
function
(
trcusid
)
{
// 设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
},
form
:
form
,
minData
:
1
});
// 加载动态表单
dsFormUtil
.
loadPageByCode
(
"
dsFormShow
"
,
sysDsFormWithCodeType
[
"
outIsRetail
"
][
"
code
"
],
null
);
matchingLanguage
();
//商品规格加载变化事件
form
.
on
(
'
select(selectUnitProperty)
'
,
function
(
data
)
{
var
thisRowValue
=
data
.
value
;
var
thisRowNum
=
data
.
elem
.
id
.
replace
(
"
unitId
"
,
""
);
//获取当前行
//当前当前行选中的商品信息
if
(
!
isNull
(
thisRowValue
)
&&
thisRowValue
!=
'
请选择
'
)
{
var
product
=
allChooseProduct
[
"
tr
"
+
thisRowNum
.
toString
()];
$
.
each
(
product
.
unitList
,
function
(
j
,
bean
)
{
if
(
thisRowValue
==
bean
.
id
){
//获取规格
//获取当前行数量
var
rkNum
=
parseInt
(
$
(
"
#rkNum
"
+
thisRowNum
).
val
());
$
(
"
#unitPrice
"
+
thisRowNum
).
val
(
bean
.
retailPrice
.
toFixed
(
2
));
//单价
$
(
"
#amountOfMoney
"
+
thisRowNum
).
val
((
rkNum
*
parseFloat
(
bean
.
retailPrice
)).
toFixed
(
2
));
//金额
return
false
;
}
});
}
else
{
$
(
"
#unitPrice
"
+
thisRowNum
).
val
(
"
0.00
"
);
//重置单价为空
$
(
"
#amountOfMoney
"
+
thisRowNum
).
val
(
"
0.00
"
);
//重置金额为空
}
//加载库存
loadTockByDepotAndMUnit
(
thisRowNum
,
$
(
"
#depotId
"
).
val
());
//计算价格
calculatedTotalPrice
();
});
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
retailPrice
"
,
calculatedTotalPrice
);
// 仓库变化事件
form
.
on
(
'
select(depotId)
'
,
function
(
data
)
{
...
...
@@ -84,7 +81,7 @@ layui.config({
});
var
showTdByEdit
=
'
rkNum
'
;
//根据那一列的值进行变化,默认根据数量
//数量变化
//
数量变化
$
(
"
body
"
).
on
(
"
input
"
,
"
.rkNum, .unitPrice, .amountOfMoney
"
,
function
()
{
if
(
$
(
this
).
attr
(
"
class
"
).
replace
(
"
layui-input change-input
"
,
""
)
!=
showTdByEdit
){
showTdByEdit
=
$
(
this
).
attr
(
"
class
"
).
replace
(
"
layui-input change-input
"
,
""
);
...
...
@@ -102,7 +99,7 @@ layui.config({
calculatedTotalPrice
();
});
//收款金额变化
//
收款金额变化
$
(
"
body
"
).
on
(
"
input
"
,
"
#changeAmount
"
,
function
()
{
calculatedTotalPrice
();
});
...
...
@@ -110,32 +107,31 @@ layui.config({
calculatedTotalPrice
();
});
//计算总价
//
计算总价
function
calculatedTotalPrice
(){
var
rowTr
=
$
(
"
#useTable tr
"
);
var
allPrice
=
0
;
$
.
each
(
rowTr
,
function
(
i
,
item
)
{
//获取行坐标
var
rowNum
=
$
(
item
).
attr
(
"
trcusid
"
).
replace
(
"
tr
"
,
""
)
;
//获取数量
var
rkNum
=
parseInt
(
isNull
(
$
(
"
#rkNum
"
+
rowNum
).
val
())
?
"
0
"
:
$
(
"
#rkNum
"
+
rowNum
).
val
());
//获取单价
var
unitPrice
=
parseFloat
(
isNull
(
$
(
"
#unitPrice
"
+
rowNum
).
val
())
?
"
0
"
:
$
(
"
#unitPrice
"
+
rowNum
).
val
());
//
获取单价
var
amountOfMoney
=
parseFloat
(
isNull
(
$
(
"
#amountOfMoney
"
+
rowNum
).
val
())
?
"
0
"
:
$
(
"
#amountOfMoney
"
+
rowNum
).
val
());
$
.
each
(
initTableChooseUtil
.
getDataRowIndex
(
'
productList
'
)
,
function
(
i
,
item
)
{
//
获取行坐标
var
thisRowKey
=
item
;
//
获取数量
var
rkNum
=
parseInt
(
isNull
(
$
(
"
#rkNum
"
+
thisRowKey
).
val
())
?
"
0
"
:
$
(
"
#rkNum
"
+
thisRowKey
).
val
());
//
获取单价
var
unitPrice
=
parseFloat
(
isNull
(
$
(
"
#unitPrice
"
+
thisRowKey
).
val
())
?
"
0
"
:
$
(
"
#unitPrice
"
+
thisRowKey
).
val
());
//
获取金额
var
amountOfMoney
=
parseFloat
(
isNull
(
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
())
?
"
0
"
:
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
());
if
(
"
rkNum
"
===
showTdByEdit
){
//数量
//输出金额
$
(
"
#amountOfMoney
"
+
rowNum
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
//
输出金额
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
}
else
if
(
"
unitPrice
"
===
showTdByEdit
){
//单价
//输出金额
$
(
"
#amountOfMoney
"
+
rowNum
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
//
输出金额
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
}
else
if
(
"
amountOfMoney
"
===
showTdByEdit
){
//金额
//输出单价
$
(
"
#unitPrice
"
+
rowNum
).
val
((
amountOfMoney
/
rkNum
).
toFixed
(
2
));
//
输出单价
$
(
"
#unitPrice
"
+
thisRowKey
).
val
((
amountOfMoney
/
rkNum
).
toFixed
(
2
));
}
allPrice
+=
parseFloat
(
$
(
"
#amountOfMoney
"
+
rowNum
).
val
());
allPrice
+=
parseFloat
(
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
());
});
//获取收款金额
//
获取收款金额
var
changeAmount
=
parseFloat
(
isNull
(
$
(
"
#changeAmount
"
).
val
())
?
"
0
"
:
$
(
"
#changeAmount
"
).
val
());
$
(
"
#allPrice
"
).
html
(
allPrice
.
toFixed
(
2
));
$
(
"
#giveChange
"
).
html
((
changeAmount
-
allPrice
).
toFixed
(
2
));
...
...
@@ -168,44 +164,34 @@ layui.config({
});
function
saveData
(
subType
,
approvalId
)
{
// 获取已选商品数据
var
rowTr
=
$
(
"
#useTable tr
"
);
if
(
rowTr
.
length
==
0
)
{
winui
.
window
.
msg
(
'
请选择商品.
'
,
{
icon
:
2
,
time
:
2000
});
var
result
=
initTableChooseUtil
.
getDataList
(
'
productList
'
);
if
(
!
result
.
checkResult
)
{
return
false
;
}
var
tableData
=
new
Array
()
;
var
noError
=
false
;
//循环遍历表格数据时,是否有其他错误信息
$
.
each
(
r
owTr
,
function
(
i
,
item
)
{
var
noError
=
false
;
var
tableData
=
[];
$
.
each
(
r
esult
.
dataList
,
function
(
i
,
item
)
{
//获取行编号
var
rowNum
=
$
(
item
).
attr
(
"
trcusid
"
).
replace
(
"
tr
"
,
""
);
//表格数量对象
var
rkNum
=
$
(
"
#rkNum
"
+
rowNum
);
if
(
parseInt
(
rkNum
.
val
())
==
0
)
{
rkNum
.
addClass
(
"
layui-form-danger
"
);
rkNum
.
focus
();
var
thisRowKey
=
item
[
"
trcusid
"
].
replace
(
"
tr
"
,
""
);
if
(
parseInt
(
item
.
rkNum
)
==
0
)
{
$
(
"
#rkNum
"
+
thisRowKey
).
addClass
(
"
layui-form-danger
"
);
$
(
"
#rkNum
"
+
thisRowKey
).
focus
();
winui
.
window
.
msg
(
'
数量不能为0
'
,
{
icon
:
2
,
time
:
2000
});
noError
=
true
;
return
false
;
}
//商品对象
var
product
=
allChooseProduct
[
"
tr
"
+
rowNum
.
toString
()
];
if
(
inTableDataArrayByAssetarId
(
product
.
productId
,
$
(
"
#unitId
"
+
rowNum
).
val
()
,
tableData
))
{
var
product
=
allChooseProduct
[
"
tr
"
+
thisRowKey
];
if
(
inTableDataArrayByAssetarId
(
product
.
productId
,
item
.
mUnitId
,
tableData
))
{
winui
.
window
.
msg
(
'
一张单中不允许出现相同单位的商品信息.
'
,
{
icon
:
2
,
time
:
2000
});
noError
=
true
;
return
false
;
}
var
row
=
{
depotId
:
$
(
"
#depotId
"
).
val
(),
materialId
:
$
(
"
#materialId
"
+
rowNum
).
val
(),
mUnitId
:
$
(
"
#unitId
"
+
rowNum
).
val
(),
rkNum
:
rkNum
.
val
(),
unitPrice
:
$
(
"
#unitPrice
"
+
rowNum
).
val
(),
remark
:
$
(
"
#remark
"
+
rowNum
).
val
()
};
tableData
.
push
(
row
);
item
[
"
materialId
"
]
=
product
.
productId
;
item
[
"
depotId
"
]
=
$
(
"
#depotId
"
).
val
();
tableData
.
push
(
item
);
});
if
(
noError
)
{
if
(
noError
)
{
return
false
;
}
...
...
@@ -229,83 +215,11 @@ layui.config({
}});
}
//判断选中的商品是否也在数组中
function
inTableDataArrayByAssetarId
(
materialId
,
unitId
,
array
)
{
var
isIn
=
false
;
$
.
each
(
array
,
function
(
i
,
item
)
{
if
(
item
.
mUnitId
===
unitId
&&
item
.
materialId
===
materialId
)
{
isIn
=
true
;
return
false
;
}
});
return
isIn
;
}
//新增行
$
(
"
body
"
).
on
(
"
click
"
,
"
#addRow
"
,
function
()
{
addRow
();
});
//删除行
$
(
"
body
"
).
on
(
"
click
"
,
"
#deleteRow
"
,
function
()
{
deleteRow
();
//计算价格
calculatedTotalPrice
();
});
//新增行
function
addRow
()
{
var
par
=
{
id
:
"
row
"
+
rowNum
.
toString
(),
//checkbox的id
trId
:
"
tr
"
+
rowNum
.
toString
(),
//行的id
materialId
:
"
materialId
"
+
rowNum
.
toString
(),
//商品id
unitId
:
"
unitId
"
+
rowNum
.
toString
(),
//规格id
currentTock
:
"
currentTock
"
+
rowNum
.
toString
(),
//库存id
rkNum
:
"
rkNum
"
+
rowNum
.
toString
(),
//数量id
unitPrice
:
"
unitPrice
"
+
rowNum
.
toString
(),
//单价id
amountOfMoney
:
"
amountOfMoney
"
+
rowNum
.
toString
(),
//金额id
remark
:
"
remark
"
+
rowNum
.
toString
()
//备注id
};
$
(
"
#useTable
"
).
append
(
getDataUseHandlebars
(
usetableTemplate
,
par
));
form
.
render
();
rowNum
++
;
//设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
}
//删除行
function
deleteRow
()
{
var
checkRow
=
$
(
"
#useTable input[type='checkbox'][name='tableCheckRow']:checked
"
);
if
(
checkRow
.
length
>
0
)
{
$
.
each
(
checkRow
,
function
(
i
,
item
)
{
//删除allChooseProduct已选择的商品信息
var
trId
=
$
(
item
).
parent
().
parent
().
attr
(
"
trcusid
"
);
allChooseProduct
[
trId
]
=
undefined
;
//移除界面上的信息
$
(
item
).
parent
().
parent
().
remove
();
});
}
else
{
winui
.
window
.
msg
(
'
请选择要删除的行
'
,
{
icon
:
2
,
time
:
2000
});
}
}
// 商品选择
$
(
"
body
"
).
on
(
"
click
"
,
"
.chooseProductBtn
"
,
function
(
e
)
{
var
trId
=
$
(
this
).
parent
().
parent
().
attr
(
"
trcusid
"
);
erpOrderUtil
.
openMaterialChooseChoosePage
(
function
(
chooseProductMation
)
{
//获取表格行号
var
thisRowNum
=
trId
.
replace
(
"
tr
"
,
""
);
//商品赋值
allChooseProduct
[
trId
]
=
chooseProductMation
;
//表格商品名称赋值
$
(
"
#materialId
"
+
thisRowNum
.
toString
()).
val
(
allChooseProduct
[
trId
].
productName
+
"
(
"
+
allChooseProduct
[
trId
].
productModel
+
"
)
"
);
//表格单位赋值
$
(
"
#unitId
"
+
thisRowNum
.
toString
()).
html
(
getDataUseHandlebars
(
selOption
,
{
rows
:
allChooseProduct
[
trId
].
unitList
}));
form
.
render
(
'
select
'
);
//计算价格
calculatedTotalPrice
();
});
});
// 加载选品选择事件
initChooseProductBtnEnent
(
form
,
function
(
trId
,
chooseProductMation
)
{
// 商品赋值
allChooseProduct
[
trId
]
=
chooseProductMation
;
},
calculatedTotalPrice
);
// 会员选择
$
(
"
body
"
).
on
(
"
click
"
,
"
.chooseMemberBtn
"
,
function
(
e
)
{
...
...
erp/src/main/resources/template/js/retailoutlet/retailoutletedit.js
浏览文件 @
dd52c393
...
...
@@ -17,9 +17,7 @@ layui.config({
layedit
=
layui
.
layedit
,
form
=
layui
.
form
;
var
rowNum
=
1
;
//表格的序号
var
usetableTemplate
=
$
(
"
#usetableTemplate
"
).
html
();
var
showTdByEdit
=
'
rkNum
'
;
//根据那一列的值进行变化,默认根据数量
var
beanTemplate
=
$
(
"
#beanTemplate
"
).
html
();
var
selOption
=
getFileContent
(
'
tpl/template/select-option.tpl
'
);
//已经选择的商品集合key:表格的行trId,value:商品信息
...
...
@@ -67,29 +65,38 @@ layui.config({
id
:
orderObject
.
bean
.
organId
,
contacts
:
orderObject
.
bean
.
supplierName
};
$
(
"
#memberId
"
).
val
(
sysMemberUtil
.
memberMation
.
contacts
);
//会员
$
(
"
#accountId
"
).
val
(
orderObject
.
bean
.
accountId
);
//账户
$
(
"
#payType
"
).
val
(
orderObject
.
bean
.
payType
);
//付款类型
//渲染列表项
$
.
each
(
orderObject
.
bean
.
norms
,
function
(
i
,
item
){
addRow
();
if
(
i
==
0
){
initTable
();
// 回显商品列表
initTableChooseUtil
.
deleteAllRow
(
'
productList
'
);
$
.
each
(
orderObject
.
bean
.
norms
,
function
(
i
,
item
)
{
if
(
i
==
0
)
{
$
(
"
#depotId
"
).
val
(
item
.
depotId
);
}
//将规格所属的商品信息加入到对象中存储
allChooseProduct
[
"
tr
"
+
(
rowNum
-
1
)]
=
item
.
product
;
//单位回显
$
(
"
#unitId
"
+
(
rowNum
-
1
)).
html
(
getDataUseHandlebars
(
selOption
,
{
rows
:
item
.
product
.
unitList
}));
$
(
"
#unitId
"
+
(
rowNum
-
1
)).
val
(
item
.
mUnitId
);
//商品回显
$
(
"
#materialId
"
+
(
rowNum
-
1
)).
val
(
item
.
product
.
productName
+
"
(
"
+
item
.
product
.
productModel
+
"
)
"
);
$
(
"
#currentTock
"
+
(
rowNum
-
1
)).
html
(
item
.
currentTock
);
//库存回显
$
(
"
#rkNum
"
+
(
rowNum
-
1
)).
val
(
item
.
operNum
);
//数量回显
$
(
"
#unitPrice
"
+
(
rowNum
-
1
)).
val
(
item
.
unitPrice
.
toFixed
(
2
));
//单价回显
$
(
"
#amountOfMoney
"
+
(
rowNum
-
1
)).
val
(
item
.
allPrice
.
toFixed
(
2
));
//金额回显
$
(
"
#remark
"
+
(
rowNum
-
1
)).
val
(
item
.
remark
);
//备注回显
//设置标识
$
(
"
tr[trcusid='tr
"
+
(
rowNum
-
1
)
+
"
']
"
).
attr
(
"
thisid
"
,
item
.
id
);
var
params
=
{
"
materialId
"
:
item
.
product
.
productName
+
"
(
"
+
item
.
product
.
productModel
+
"
)
"
,
"
mUnitId
"
:
{
"
html
"
:
getDataUseHandlebars
(
selOption
,
{
rows
:
item
.
product
.
unitList
}),
"
value
"
:
item
.
mUnitId
},
"
currentTock
"
:
item
.
currentTock
,
"
rkNum
"
:
item
.
operNum
,
"
unitPrice
"
:
item
.
unitPrice
.
toFixed
(
2
),
"
amountOfMoney
"
:
item
.
allPrice
.
toFixed
(
2
),
"
taxRate
"
:
item
.
taxRate
.
toFixed
(
2
),
"
taxMoney
"
:
item
.
taxMoney
.
toFixed
(
2
),
"
taxUnitPrice
"
:
item
.
taxUnitPrice
.
toFixed
(
2
),
"
taxLastMoney
"
:
item
.
taxLastMoney
.
toFixed
(
2
),
"
remark
"
:
item
.
remark
};
var
trcusid
=
initTableChooseUtil
.
resetData
(
'
productList
'
,
params
);
// 将规格所属的商品信息加入到对象中存储
allChooseProduct
[
trcusid
]
=
item
.
product
;
});
erpOrderUtil
.
orderEditPageSetBtnBySubmitType
(
submitType
,
orderObject
.
bean
.
state
);
...
...
@@ -103,40 +110,43 @@ layui.config({
form
.
render
();
}
//商品规格加载变化事件
form
.
on
(
'
select(selectUnitProperty)
'
,
function
(
data
)
{
var
thisRowValue
=
data
.
value
;
var
thisRowNum
=
data
.
elem
.
id
.
replace
(
"
unitId
"
,
""
);
//获取当前行
//当前当前行选中的商品信息
if
(
!
isNull
(
thisRowValue
)
&&
thisRowValue
!=
'
请选择
'
)
{
var
product
=
allChooseProduct
[
"
tr
"
+
thisRowNum
.
toString
()];
$
.
each
(
product
.
unitList
,
function
(
j
,
bean
)
{
if
(
thisRowValue
==
bean
.
id
){
//获取规格
//获取当前行数量
var
rkNum
=
parseInt
(
$
(
"
#rkNum
"
+
thisRowNum
).
val
());
$
(
"
#unitPrice
"
+
thisRowNum
).
val
(
bean
.
retailPrice
.
toFixed
(
2
));
//单价
$
(
"
#amountOfMoney
"
+
thisRowNum
).
val
((
rkNum
*
parseFloat
(
bean
.
retailPrice
)).
toFixed
(
2
));
//金额
return
false
;
}
});
}
else
{
$
(
"
#unitPrice
"
+
thisRowNum
).
val
(
"
0.00
"
);
//重置单价为空
$
(
"
#amountOfMoney
"
+
thisRowNum
).
val
(
"
0.00
"
);
//重置金额为空
}
function
initTable
()
{
// 商品
initTableChooseUtil
.
initTable
({
id
:
"
productList
"
,
cols
:
[
{
id
:
'
materialId
'
,
title
:
'
商品(型号)
'
,
formType
:
'
chooseInput
'
,
width
:
'
150
'
,
iconClassName
:
'
chooseProductBtn
'
,
verify
:
'
required
'
},
{
id
:
'
mUnitId
'
,
title
:
'
单位
'
,
formType
:
'
select
'
,
width
:
'
50
'
,
verify
:
'
required
'
,
layFilter
:
'
selectUnitProperty
'
},
{
id
:
'
currentTock
'
,
title
:
'
库存
'
,
formType
:
'
detail
'
,
width
:
'
80
'
},
{
id
:
'
rkNum
'
,
title
:
'
数量
'
,
formType
:
'
input
'
,
width
:
'
80
'
,
className
:
'
change-input rkNum
'
,
verify
:
'
required|number
'
,
value
:
'
1
'
},
{
id
:
'
unitPrice
'
,
title
:
'
单价
'
,
formType
:
'
input
'
,
width
:
'
80
'
,
className
:
'
change-input unitPrice
'
,
verify
:
'
required|money
'
},
{
id
:
'
amountOfMoney
'
,
title
:
'
金额
'
,
formType
:
'
input
'
,
width
:
'
80
'
,
className
:
'
change-input amountOfMoney
'
,
verify
:
'
required|money
'
},
{
id
:
'
remark
'
,
title
:
'
备注
'
,
formType
:
'
input
'
,
width
:
'
100
'
}
],
deleteRowCallback
:
function
(
trcusid
)
{
delete
allChooseProduct
[
trcusid
];
// 计算价格
calculatedTotalPrice
();
},
addRowCallback
:
function
(
trcusid
)
{
// 设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
calculatedTotalPrice
();
},
form
:
form
,
minData
:
1
});
}
//加载库存
loadTockByDepotAndMUnit
(
thisRowNum
,
$
(
"
#depotId
"
).
val
());
//计算价格
calculatedTotalPrice
();
});
// 商品规格加载变化事件
mUnitChangeEvent
(
form
,
allChooseProduct
,
"
retailPrice
"
);
// 仓库变化事件
form
.
on
(
'
select(depotId)
'
,
function
(
data
)
{
loadMaterialDepotStockByDepotId
(
data
.
value
);
});
var
showTdByEdit
=
'
rkNum
'
;
//根据那一列的值进行变化,默认根据数量
//数量变化
// 数量变化
$
(
"
body
"
).
on
(
"
input
"
,
"
.rkNum, .unitPrice, .amountOfMoney
"
,
function
()
{
if
(
$
(
this
).
attr
(
"
class
"
).
replace
(
"
layui-input change-input
"
,
""
)
!=
showTdByEdit
){
showTdByEdit
=
$
(
this
).
attr
(
"
class
"
).
replace
(
"
layui-input change-input
"
,
""
);
...
...
@@ -154,7 +164,7 @@ layui.config({
calculatedTotalPrice
();
});
//收款金额变化
//
收款金额变化
$
(
"
body
"
).
on
(
"
input
"
,
"
#changeAmount
"
,
function
()
{
calculatedTotalPrice
();
});
...
...
@@ -162,32 +172,31 @@ layui.config({
calculatedTotalPrice
();
});
//计算总价
//
计算总价
function
calculatedTotalPrice
(){
var
rowTr
=
$
(
"
#useTable tr
"
);
var
allPrice
=
0
;
$
.
each
(
rowTr
,
function
(
i
,
item
)
{
//获取行坐标
var
rowNum
=
$
(
item
).
attr
(
"
trcusid
"
).
replace
(
"
tr
"
,
""
)
;
//获取数量
var
rkNum
=
parseInt
(
isNull
(
$
(
"
#rkNum
"
+
rowNum
).
val
())
?
"
0
"
:
$
(
"
#rkNum
"
+
rowNum
).
val
());
//获取单价
var
unitPrice
=
parseFloat
(
isNull
(
$
(
"
#unitPrice
"
+
rowNum
).
val
())
?
"
0
"
:
$
(
"
#unitPrice
"
+
rowNum
).
val
());
//
获取单价
var
amountOfMoney
=
parseFloat
(
isNull
(
$
(
"
#amountOfMoney
"
+
rowNum
).
val
())
?
"
0
"
:
$
(
"
#amountOfMoney
"
+
rowNum
).
val
());
$
.
each
(
initTableChooseUtil
.
getDataRowIndex
(
'
productList
'
)
,
function
(
i
,
item
)
{
//
获取行坐标
var
thisRowKey
=
item
;
//
获取数量
var
rkNum
=
parseInt
(
isNull
(
$
(
"
#rkNum
"
+
thisRowKey
).
val
())
?
"
0
"
:
$
(
"
#rkNum
"
+
thisRowKey
).
val
());
//
获取单价
var
unitPrice
=
parseFloat
(
isNull
(
$
(
"
#unitPrice
"
+
thisRowKey
).
val
())
?
"
0
"
:
$
(
"
#unitPrice
"
+
thisRowKey
).
val
());
//
获取金额
var
amountOfMoney
=
parseFloat
(
isNull
(
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
())
?
"
0
"
:
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
());
if
(
"
rkNum
"
===
showTdByEdit
){
//数量
//输出金额
$
(
"
#amountOfMoney
"
+
rowNum
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
//
输出金额
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
}
else
if
(
"
unitPrice
"
===
showTdByEdit
){
//单价
//输出金额
$
(
"
#amountOfMoney
"
+
rowNum
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
//
输出金额
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
((
rkNum
*
unitPrice
).
toFixed
(
2
));
}
else
if
(
"
amountOfMoney
"
===
showTdByEdit
){
//金额
//输出单价
$
(
"
#unitPrice
"
+
rowNum
).
val
((
amountOfMoney
/
rkNum
).
toFixed
(
2
));
//
输出单价
$
(
"
#unitPrice
"
+
thisRowKey
).
val
((
amountOfMoney
/
rkNum
).
toFixed
(
2
));
}
allPrice
+=
parseFloat
(
$
(
"
#amountOfMoney
"
+
rowNum
).
val
());
allPrice
+=
parseFloat
(
$
(
"
#amountOfMoney
"
+
thisRowKey
).
val
());
});
//获取收款金额
//
获取收款金额
var
changeAmount
=
parseFloat
(
isNull
(
$
(
"
#changeAmount
"
).
val
())
?
"
0
"
:
$
(
"
#changeAmount
"
).
val
());
$
(
"
#allPrice
"
).
html
(
allPrice
.
toFixed
(
2
));
$
(
"
#giveChange
"
).
html
((
changeAmount
-
allPrice
).
toFixed
(
2
));
...
...
@@ -228,45 +237,34 @@ layui.config({
});
function
saveData
(
subType
,
approvalId
)
{
//获取已选商品数据
var
rowTr
=
$
(
"
#useTable tr
"
);
if
(
rowTr
.
length
==
0
)
{
winui
.
window
.
msg
(
'
请选择商品.
'
,
{
icon
:
2
,
time
:
2000
});
var
result
=
initTableChooseUtil
.
getDataList
(
'
productList
'
);
if
(
!
result
.
checkResult
)
{
return
false
;
}
var
tableData
=
new
Array
()
;
var
noError
=
false
;
//循环遍历表格数据时,是否有其他错误信息
$
.
each
(
r
owTr
,
function
(
i
,
item
)
{
var
noError
=
false
;
var
tableData
=
[];
$
.
each
(
r
esult
.
dataList
,
function
(
i
,
item
)
{
//获取行编号
var
rowNum
=
$
(
item
).
attr
(
"
trcusid
"
).
replace
(
"
tr
"
,
""
);
//表格数量对象
var
rkNum
=
$
(
"
#rkNum
"
+
rowNum
);
if
(
parseInt
(
rkNum
.
val
())
==
0
)
{
rkNum
.
addClass
(
"
layui-form-danger
"
);
rkNum
.
focus
();
var
thisRowKey
=
item
[
"
trcusid
"
].
replace
(
"
tr
"
,
""
);
if
(
parseInt
(
item
.
rkNum
)
==
0
)
{
$
(
"
#rkNum
"
+
thisRowKey
).
addClass
(
"
layui-form-danger
"
);
$
(
"
#rkNum
"
+
thisRowKey
).
focus
();
winui
.
window
.
msg
(
'
数量不能为0
'
,
{
icon
:
2
,
time
:
2000
});
noError
=
true
;
return
false
;
}
//商品对象
var
product
=
allChooseProduct
[
"
tr
"
+
rowNum
.
toString
()
];
if
(
inTableDataArrayByAssetarId
(
product
.
productId
,
$
(
"
#unitId
"
+
rowNum
).
val
()
,
tableData
))
{
var
product
=
allChooseProduct
[
"
tr
"
+
thisRowKey
];
if
(
inTableDataArrayByAssetarId
(
product
.
productId
,
item
.
mUnitId
,
tableData
))
{
winui
.
window
.
msg
(
'
一张单中不允许出现相同单位的商品信息.
'
,
{
icon
:
2
,
time
:
2000
});
noError
=
true
;
return
false
;
}
var
row
=
{
depotId
:
$
(
"
#depotId
"
).
val
(),
materialId
:
$
(
"
#materialId
"
+
rowNum
).
val
(),
mUnitId
:
$
(
"
#unitId
"
+
rowNum
).
val
(),
rkNum
:
rkNum
.
val
(),
unitPrice
:
$
(
"
#unitPrice
"
+
rowNum
).
val
(),
thisId
:
isNull
(
$
(
item
).
attr
(
"
thisid
"
))
?
""
:
$
(
item
).
attr
(
"
thisid
"
),
remark
:
$
(
"
#remark
"
+
rowNum
).
val
()
};
tableData
.
push
(
row
);
item
[
"
materialId
"
]
=
product
.
productId
;
item
[
"
depotId
"
]
=
$
(
"
#depotId
"
).
val
();
tableData
.
push
(
item
);
});
if
(
noError
)
{
if
(
noError
)
{
return
false
;
}
...
...
@@ -291,82 +289,10 @@ layui.config({
}});
}
//判断选中的商品是否也在数组中
function
inTableDataArrayByAssetarId
(
materialId
,
unitId
,
array
)
{
var
isIn
=
false
;
$
.
each
(
array
,
function
(
i
,
item
)
{
if
(
item
.
mUnitId
===
unitId
&&
item
.
materialId
===
materialId
)
{
isIn
=
true
;
return
false
;
}
});
return
isIn
;
}
//新增行
$
(
"
body
"
).
on
(
"
click
"
,
"
#addRow
"
,
function
()
{
addRow
();
});
//删除行
$
(
"
body
"
).
on
(
"
click
"
,
"
#deleteRow
"
,
function
()
{
deleteRow
();
//计算价格
calculatedTotalPrice
();
});
//新增行
function
addRow
()
{
var
par
=
{
id
:
"
row
"
+
rowNum
.
toString
(),
//checkbox的id
trId
:
"
tr
"
+
rowNum
.
toString
(),
//行的id
materialId
:
"
materialId
"
+
rowNum
.
toString
(),
//商品id
unitId
:
"
unitId
"
+
rowNum
.
toString
(),
//规格id
currentTock
:
"
currentTock
"
+
rowNum
.
toString
(),
//库存id
rkNum
:
"
rkNum
"
+
rowNum
.
toString
(),
//数量id
unitPrice
:
"
unitPrice
"
+
rowNum
.
toString
(),
//单价id
amountOfMoney
:
"
amountOfMoney
"
+
rowNum
.
toString
(),
//金额id
remark
:
"
remark
"
+
rowNum
.
toString
()
//备注id
};
$
(
"
#useTable
"
).
append
(
getDataUseHandlebars
(
usetableTemplate
,
par
));
form
.
render
();
rowNum
++
;
//设置根据某列变化的颜色
$
(
"
.
"
+
showTdByEdit
).
parent
().
css
({
'
background-color
'
:
'
#e6e6e6
'
});
}
//删除行
function
deleteRow
()
{
var
checkRow
=
$
(
"
#useTable input[type='checkbox'][name='tableCheckRow']:checked
"
);
if
(
checkRow
.
length
>
0
)
{
$
.
each
(
checkRow
,
function
(
i
,
item
)
{
//删除allChooseProduct已选择的商品信息
var
trId
=
$
(
item
).
parent
().
parent
().
attr
(
"
trcusid
"
);
allChooseProduct
[
trId
]
=
undefined
;
//移除界面上的信息
$
(
item
).
parent
().
parent
().
remove
();
});
}
else
{
winui
.
window
.
msg
(
'
请选择要删除的行
'
,
{
icon
:
2
,
time
:
2000
});
}
}
// 商品选择
$
(
"
body
"
).
on
(
"
click
"
,
"
.chooseProductBtn
"
,
function
(
e
)
{
var
trId
=
$
(
this
).
parent
().
parent
().
attr
(
"
trcusid
"
);
erpOrderUtil
.
openMaterialChooseChoosePage
(
function
(
chooseProductMation
)
{
//获取表格行号
var
thisRowNum
=
trId
.
replace
(
"
tr
"
,
""
);
//商品赋值
allChooseProduct
[
trId
]
=
chooseProductMation
;
//表格商品名称赋值
$
(
"
#materialId
"
+
thisRowNum
.
toString
()).
val
(
allChooseProduct
[
trId
].
productName
+
"
(
"
+
allChooseProduct
[
trId
].
productModel
+
"
)
"
);
//表格单位赋值
$
(
"
#unitId
"
+
thisRowNum
.
toString
()).
html
(
getDataUseHandlebars
(
selOption
,
{
rows
:
allChooseProduct
[
trId
].
unitList
}));
form
.
render
(
'
select
'
);
//计算价格
calculatedTotalPrice
();
});
// 加载选品选择事件
initChooseProductBtnEnent
(
form
,
function
(
trId
,
chooseProductMation
)
{
// 商品赋值
allChooseProduct
[
trId
]
=
chooseProductMation
;
});
// 会员选择
...
...
erp/src/main/resources/template/tpl/retailoutlet/retailoutletadd.html
浏览文件 @
dd52c393
...
...
@@ -51,29 +51,8 @@
</div>
<div
class=
"layui-form-item layui-col-xs12"
>
<label
class=
"layui-form-label"
>
列表项
<i
class=
"red"
>
*
</i></label>
<div
class=
"layui-input-block"
>
<div
class=
"winui-toolbar"
>
<div
class=
"winui-tool"
style=
"text-align: left;"
>
<button
id=
"addRow"
class=
"winui-toolbtn"
type=
"button"
><i
class=
"fa fa-plus"
aria-hidden=
"true"
></i>
新增行
</button>
<button
id=
"deleteRow"
class=
"winui-toolbtn"
type=
"button"
><i
class=
"fa fa-trash-o"
aria-hidden=
"true"
></i>
删除行
</button>
</div>
</div>
<table
class=
"layui-table"
>
<thead>
<tr>
<th
style=
"width: 30px;"
></th>
<th
style=
"width: 150px;"
>
商品(型号)
</th>
<th
style=
"width: 50px;"
>
单位
</th>
<th
style=
"width: 80px;"
>
库存
</th>
<th
style=
"width: 80px;"
>
数量
</th>
<th
style=
"width: 80px;"
>
单价
</th>
<th
style=
"width: 80px;"
>
金额
</th>
<th
style=
"min-width: 100px;"
>
备注
</th>
</tr>
</thead>
<tbody
id=
"useTable"
class=
"insurance-table"
>
</tbody>
</table>
<div
class=
"layui-input-block"
id=
"productList"
>
</div>
</div>
<div
class=
"layui-form-item layui-col-xs4"
>
...
...
@@ -114,23 +93,6 @@
</form>
</div>
<!-- usetableTemplate -->
<script
type=
"text/x-handlebars-template"
id=
"usetableTemplate"
>
<
tr
trcusid
=
"
{{trId}}
"
>
<
td
><
input
type
=
"
checkbox
"
rowId
=
"
{{id}}
"
lay
-
filter
=
"
checkboxProperty
"
name
=
"
tableCheckRow
"
/><
/td
>
<
td
>
<
input
type
=
"
text
"
id
=
"
{{materialId}}
"
name
=
"
{{materialId}}
"
placeholder
=
"
请选择商品
"
class
=
"
layui-input
"
readonly
=
"
readonly
"
/>
<
i
class
=
"
fa fa-plus-circle input-icon chooseProductBtn
"
style
=
"
top: 12px;
"
><
/i
>
<
/td
>
<
td
><
select
id
=
"
{{unitId}}
"
lay
-
filter
=
"
selectUnitProperty
"
lay
-
search
win
-
verify
=
"
required
"
><
/select></
td
>
<
td
id
=
"
{{currentTock}}
"
><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input change-input rkNum
"
value
=
"
1
"
id
=
"
{{rkNum}}
"
win
-
verify
=
"
required|number
"
/><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input change-input unitPrice
"
id
=
"
{{unitPrice}}
"
win
-
verify
=
"
required|money
"
/><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input change-input amountOfMoney
"
id
=
"
{{amountOfMoney}}
"
win
-
verify
=
"
required|money
"
/><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input
"
id
=
"
{{remark}}
"
/><
/td
>
<
/tr
>
</script>
<script
src=
"../../assets/lib/layui/layui.js"
></script>
<script
src=
"../../assets/lib/layui/custom.js"
></script>
<script
src=
"../../js/erpcommon/loadStock.js"
></script>
...
...
erp/src/main/resources/template/tpl/retailoutlet/retailoutletedit.html
浏览文件 @
dd52c393
...
...
@@ -13,23 +13,6 @@
</form>
</div>
<!-- usetableTemplate -->
<script
type=
"text/x-handlebars-template"
id=
"usetableTemplate"
>
<
tr
trcusid
=
"
{{trId}}
"
>
<
td
><
input
type
=
"
checkbox
"
rowId
=
"
{{id}}
"
lay
-
filter
=
"
checkboxProperty
"
name
=
"
tableCheckRow
"
/><
/td
>
<
td
>
<
input
type
=
"
text
"
id
=
"
{{materialId}}
"
name
=
"
{{materialId}}
"
placeholder
=
"
请选择商品
"
class
=
"
layui-input
"
readonly
=
"
readonly
"
/>
<
i
class
=
"
fa fa-plus-circle input-icon chooseProductBtn
"
style
=
"
top: 12px;
"
><
/i
>
<
/td
>
<
td
><
select
id
=
"
{{unitId}}
"
lay
-
filter
=
"
selectUnitProperty
"
lay
-
search
win
-
verify
=
"
required
"
><
/select></
td
>
<
td
id
=
"
{{currentTock}}
"
><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input change-input rkNum
"
value
=
"
1
"
id
=
"
{{rkNum}}
"
win
-
verify
=
"
required|number
"
/><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input change-input unitPrice
"
id
=
"
{{unitPrice}}
"
win
-
verify
=
"
required|money
"
/><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input change-input amountOfMoney
"
id
=
"
{{amountOfMoney}}
"
win
-
verify
=
"
required|money
"
/><
/td
>
<
td
><
input
type
=
"
text
"
class
=
"
layui-input
"
id
=
"
{{remark}}
"
/><
/td
>
<
/tr
>
</script>
<!-- beanTemplate -->
<script
type=
"text/x-handlebars-template"
id=
"beanTemplate"
>
{{
#
bean
}}
...
...
@@ -75,29 +58,8 @@
<
/div
>
<
div
class
=
"
layui-form-item layui-col-xs12
"
>
<
label
class
=
"
layui-form-label
"
>
列表项
<
i
class
=
"
red
"
>*<
/i></
label
>
<
div
class
=
"
layui-input-block
"
>
<
div
class
=
"
winui-toolbar
"
>
<
div
class
=
"
winui-tool
"
style
=
"
text-align: left;
"
>
<
button
id
=
"
addRow
"
class
=
"
winui-toolbtn
"
type
=
"
button
"
><
i
class
=
"
fa fa-plus
"
aria
-
hidden
=
"
true
"
><
/i>新增行</
button
>
<
button
id
=
"
deleteRow
"
class
=
"
winui-toolbtn
"
type
=
"
button
"
><
i
class
=
"
fa fa-trash-o
"
aria
-
hidden
=
"
true
"
><
/i>删除行</
button
>
<
/div
>
<
/div
>
<
table
class
=
"
layui-table
"
>
<
thead
>
<
tr
>
<
th
style
=
"
width: 30px;
"
><
/th
>
<
th
style
=
"
width: 150px;
"
>
商品
(
型号
)
<
/th
>
<
th
style
=
"
width: 50px;
"
>
单位
<
/th
>
<
th
style
=
"
width: 80px;
"
>
库存
<
/th
>
<
th
style
=
"
width: 80px;
"
>
数量
<
/th
>
<
th
style
=
"
width: 80px;
"
>
单价
<
/th
>
<
th
style
=
"
width: 80px;
"
>
金额
<
/th
>
<
th
style
=
"
min-width: 100px;
"
>
备注
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
id
=
"
useTable
"
class
=
"
insurance-table
"
>
<
/tbody
>
<
/table
>
<
div
class
=
"
layui-input-block
"
id
=
"
productList
"
>
<
/div
>
<
/div
>
<
div
class
=
"
layui-form-item layui-col-xs4
"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录