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
c0ee413c
Commit
c0ee413c
authored
Nov 30, 2021
by
季圣华
Browse files
优化商品多单位的价格编辑逻辑
parent
912e5781
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-web/src/views/material/modules/MaterialModal.vue
View file @
c0ee413c
...
@@ -183,6 +183,7 @@
...
@@ -183,6 +183,7 @@
:rowNumber=
"false"
:rowNumber=
"false"
:rowSelection=
"true"
:rowSelection=
"true"
:actionButton=
"true"
:actionButton=
"true"
@
valueChange=
"onValueChange"
@
added=
"onAdded"
>
@
added=
"onAdded"
>
<
template
#buttonAfter
>
<
template
#buttonAfter
>
<a-button
@
click=
"batchSetPrice('purchase')"
>
采购价-批量
</a-button>
<a-button
@
click=
"batchSetPrice('purchase')"
>
采购价-批量
</a-button>
...
@@ -794,6 +795,50 @@
...
@@ -794,6 +795,50 @@
this
.
maxBarCodeInfo
=
this
.
maxBarCodeInfo
+
1
this
.
maxBarCodeInfo
=
this
.
maxBarCodeInfo
+
1
target
.
setValues
([{
rowKey
:
row
.
id
,
values
:
{
barCode
:
this
.
maxBarCodeInfo
,
commodityUnit
:
unit
?
unit
:
''
}}])
target
.
setValues
([{
rowKey
:
row
.
id
,
values
:
{
barCode
:
this
.
maxBarCodeInfo
,
commodityUnit
:
unit
?
unit
:
''
}}])
},
},
//单元值改变一个字符就触发一次
onValueChange
(
event
)
{
const
{
type
,
row
,
column
,
value
,
target
}
=
event
switch
(
column
.
key
)
{
case
"
purchaseDecimal
"
:
case
"
commodityDecimal
"
:
case
"
wholesaleDecimal
"
:
case
"
lowDecimal
"
:
this
.
changeDecimalByValue
(
row
)
break
;
}
},
//修改商品明细中的价格触发计算
changeDecimalByValue
(
row
)
{
let
unitArr
=
this
.
unitList
let
basicUnit
=
''
,
otherUnit
=
''
,
ratio
=
1
for
(
let
i
=
0
;
i
<
unitArr
.
length
;
i
++
)
{
if
(
unitArr
[
i
].
id
===
this
.
form
.
getFieldValue
(
'
unitId
'
))
{
basicUnit
=
unitArr
[
i
].
basicUnit
otherUnit
=
unitArr
[
i
].
otherUnit
ratio
=
unitArr
[
i
].
ratio
}
}
if
(
row
.
commodityUnit
===
basicUnit
)
{
this
.
$refs
.
editableMeTable
.
getValues
((
error
,
values
)
=>
{
let
mArr
=
values
,
basicPurchaseDecimal
=
''
,
basicCommodityDecimal
=
''
,
basicWholesaleDecimal
=
''
,
basicLowDecimal
=
''
for
(
let
i
=
0
;
i
<
mArr
.
length
;
i
++
)
{
let
mInfo
=
mArr
[
i
]
if
(
i
===
0
)
{
basicPurchaseDecimal
=
mInfo
.
purchaseDecimal
basicCommodityDecimal
=
mInfo
.
commodityDecimal
basicWholesaleDecimal
=
mInfo
.
wholesaleDecimal
basicLowDecimal
=
mInfo
.
lowDecimal
}
else
{
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratio
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratio
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratio
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratio
}
}
}
this
.
meTable
.
dataSource
=
mArr
})
}
},
batchSetPrice
(
type
)
{
batchSetPrice
(
type
)
{
if
(
this
.
skuSwitch
||
this
.
model
.
id
){
if
(
this
.
skuSwitch
||
this
.
model
.
id
){
this
.
$refs
.
priceModalForm
.
add
(
type
);
this
.
$refs
.
priceModalForm
.
add
(
type
);
...
@@ -904,21 +949,30 @@
...
@@ -904,21 +949,30 @@
},
},
manyUnitOnChange
(
value
)
{
manyUnitOnChange
(
value
)
{
let
unitArr
=
this
.
unitList
let
unitArr
=
this
.
unitList
let
basicUnit
=
''
,
otherUnit
=
''
let
basicUnit
=
''
,
otherUnit
=
''
,
ratio
=
1
for
(
let
i
=
0
;
i
<
unitArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
unitArr
.
length
;
i
++
)
{
if
(
unitArr
[
i
].
id
===
value
)
{
if
(
unitArr
[
i
].
id
===
value
)
{
basicUnit
=
unitArr
[
i
].
basicUnit
basicUnit
=
unitArr
[
i
].
basicUnit
otherUnit
=
unitArr
[
i
].
otherUnit
otherUnit
=
unitArr
[
i
].
otherUnit
ratio
=
unitArr
[
i
].
ratio
}
}
}
}
this
.
$refs
.
editableMeTable
.
getValues
((
error
,
values
)
=>
{
this
.
$refs
.
editableMeTable
.
getValues
((
error
,
values
)
=>
{
let
mArr
=
values
let
mArr
=
values
,
basicPurchaseDecimal
=
''
,
basicCommodityDecimal
=
''
,
basicWholesaleDecimal
=
''
,
basicLowDecimal
=
''
for
(
let
i
=
0
;
i
<
mArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
mArr
.
length
;
i
++
)
{
let
mInfo
=
mArr
[
i
]
let
mInfo
=
mArr
[
i
]
if
(
i
===
0
)
{
if
(
i
===
0
)
{
mInfo
.
commodityUnit
=
basicUnit
mInfo
.
commodityUnit
=
basicUnit
basicPurchaseDecimal
=
mInfo
.
purchaseDecimal
basicCommodityDecimal
=
mInfo
.
commodityDecimal
basicWholesaleDecimal
=
mInfo
.
wholesaleDecimal
basicLowDecimal
=
mInfo
.
lowDecimal
}
else
{
}
else
{
mInfo
.
commodityUnit
=
otherUnit
mInfo
.
commodityUnit
=
otherUnit
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratio
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratio
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratio
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratio
}
}
}
}
}
this
.
meTable
.
dataSource
=
mArr
this
.
meTable
.
dataSource
=
mArr
...
...
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