Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-mall
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit da8838c0
authored
Dec 14, 2023
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复BUG
1 parent
c45537b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
45 deletions
src/views/gasoline/components/list/index.vue
src/views/gasoline/components/list/index.vue
View file @
da8838c
...
...
@@ -25,33 +25,33 @@
slot=
"IMG"
slot-scope=
"scope"
>
<el-popover
placement=
"top"
trigger=
"hover"
<el-popover
placement=
"top"
trigger=
"hover"
>
<img
class=
"img-plus"
:src=
"scope.scope.aliasUrl"
/>
<div
slot=
"reference"
class=
"img"
>
<img
class=
"img-plus"
:src=
"scope.scope.aliasUrl"
/>
<div
slot=
"reference"
class=
"img"
>
<img
:src=
"scope.scope.aliasUrl"
>
<div
class=
"mask"
>
<img
src=
"@/assets/images/icon-edit.png"
class=
"icon"
>
<input
type=
"file"
:ref=
"`file-$
{scope.scope.id}`"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="uploadImg($event, scope.scope)"
/>
</div>
<img
:src=
"scope.scope.aliasUrl"
>
<div
class=
"mask"
>
<img
src=
"@/assets/images/icon-edit.png"
class=
"icon"
>
<input
type=
"file"
:ref=
"`file-$
{scope.scope.id}`"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="uploadImg($event, scope.scope)"
/>
</div>
</el-popover>
</div>
</el-popover>
</
template
>
<
template
...
...
@@ -59,9 +59,10 @@
slot-scope=
"scope"
>
<el-input
v-model=
"scope.scope.
sales
Price"
v-model=
"scope.scope.
Input
Price"
size=
"small"
@
blur=
"handleBlur(scope.scope)"
maxlength=
"6"
></el-input>
</
template
>
<
template
...
...
@@ -136,8 +137,10 @@ export default {
},
{
label
:
'库存'
,
prop
:
'stock'
,
minWidth
:
100
minWidth
:
100
,
formatter
:
cellValue
=>
{
return
cellValue
.
stock
-
cellValue
.
usedStock
}
},
{
label
:
'销售量'
,
...
...
@@ -173,7 +176,9 @@ export default {
...
searchForm
})
||
{}
list
&&
list
.
map
(
e
=>
{
e
.
salesPrice
=
e
.
salesPrice
?
NP
.
divide
(
e
.
salesPrice
,
100
).
toFixed
(
2
)
:
''
let
price
=
e
.
salesPrice
?
NP
.
divide
(
e
.
salesPrice
,
100
).
toFixed
(
2
)
:
''
e
.
InputPrice
=
price
e
.
salesPrice
=
price
})
this
.
tableData
=
list
||
[]
this
.
tableTotal
=
total
||
0
...
...
@@ -188,6 +193,10 @@ export default {
},
handleReset
()
{
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
$refs
.
listRef
.
page
=
{
pageNum
:
1
,
pageSize
:
10
}
this
.
handleSearch
()
},
async
change
(
e
,
row
)
{
...
...
@@ -202,22 +211,25 @@ export default {
})
},
handleBlur
(
row
)
{
let
val
=
row
.
salesPrice
?.
trim
().
replace
(
/^0+/
,
''
)
if
(
val
)
{
if
(
!
/^
\d
+
(\.\d
+
)?
$/
.
test
(
val
))
val
=
''
val
=
`
${
Math
.
abs
(
val
)}
`
if
(
val
.
startsWith
(
'.'
))
row
.
salesPrice
=
'0'
+
val
if
(
val
<
Number
(
row
.
sellPrice
))
val
=
`
${
row
.
sellPrice
}
`
if
(
val
>
1000
)
val
=
'999.99'
const
[
integerPart
,
decimalPart
]
=
val
.
split
(
'.'
)
if
(
decimalPart
&&
decimalPart
.
length
>
2
)
row
.
salesPrice
=
`
${
integerPart
||
'0'
}
.
${
decimalPart
.
slice
(
0
,
2
)}
`
else
row
.
salesPrice
=
val
}
else
row
.
salesPrice
=
''
if
(
row
.
salesPrice
)
this
.
update
({
type
:
1
,
id
:
row
.
id
,
salesPrice
:
NP
.
times
(
row
.
salesPrice
,
100
)
})
let
{
salesPrice
,
InputPrice
,
sellPrice
}
=
row
if
(
!
InputPrice
)
return
try
{
if
(
InputPrice
)
{
if
(
InputPrice
.
startsWith
(
'.'
))
InputPrice
=
'0'
+
InputPrice
if
(
Number
(
InputPrice
)
<
Number
(
sellPrice
))
throw
'销售价需大于等于成本价'
if
(
InputPrice
>
1000
)
InputPrice
=
999.99
InputPrice
=
Number
(
InputPrice
).
toFixed
(
2
)
}
else
throw
'销售价需大于等于成本价'
if
(
!
/^
\d
+
(\.\d
+
)?
$/
.
test
(
InputPrice
))
throw
'请输入数字'
if
(
InputPrice
!=
Number
(
salesPrice
))
this
.
update
({
type
:
1
,
id
:
row
.
id
,
salesPrice
:
NP
.
times
(
InputPrice
,
100
)
})
}
catch
(
error
)
{
row
.
InputPrice
=
salesPrice
?
salesPrice
:
''
if
(
error
)
this
.
$message
.
error
(
error
)
}
},
async
uploadImg
(
e
,
target
)
{
const
{
url
}
=
await
uploadImg
(
e
,
this
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment