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 @@
...
@@ -25,33 +25,33 @@
slot=
"IMG"
slot=
"IMG"
slot-scope=
"scope"
slot-scope=
"scope"
>
>
<el-popover
<el-popover
placement=
"top"
placement=
"top"
trigger=
"hover"
trigger=
"hover"
>
<img
class=
"img-plus"
:src=
"scope.scope.aliasUrl"
/>
<div
slot=
"reference"
class=
"img"
>
>
<img
<img
:src=
"scope.scope.aliasUrl"
>
class=
"img-plus"
<div
class=
"mask"
>
:src=
"scope.scope.aliasUrl"
<img
/>
src=
"@/assets/images/icon-edit.png"
<div
class=
"icon"
slot=
"reference"
>
class=
"img"
<input
>
type=
"file"
<img
:src=
"scope.scope.aliasUrl"
>
:ref=
"`file-$
{scope.scope.id}`"
<div
class=
"mask"
>
accept="image/png, image/jpeg, image/gif, image/jpg"
<img
@change="uploadImg($event, scope.scope)"
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>
</div>
</div>
</el-popover>
</div>
</el-popover>
</
template
>
</
template
>
<
template
<
template
...
@@ -59,9 +59,10 @@
...
@@ -59,9 +59,10 @@
slot-scope=
"scope"
slot-scope=
"scope"
>
>
<el-input
<el-input
v-model=
"scope.scope.
sales
Price"
v-model=
"scope.scope.
Input
Price"
size=
"small"
size=
"small"
@
blur=
"handleBlur(scope.scope)"
@
blur=
"handleBlur(scope.scope)"
maxlength=
"6"
></el-input>
></el-input>
</
template
>
</
template
>
<
template
<
template
...
@@ -136,8 +137,10 @@ export default {
...
@@ -136,8 +137,10 @@ export default {
},
},
{
{
label
:
'库存'
,
label
:
'库存'
,
prop
:
'stock'
,
minWidth
:
100
,
minWidth
:
100
formatter
:
cellValue
=>
{
return
cellValue
.
stock
-
cellValue
.
usedStock
}
},
},
{
{
label
:
'销售量'
,
label
:
'销售量'
,
...
@@ -173,7 +176,9 @@ export default {
...
@@ -173,7 +176,9 @@ export default {
...
searchForm
...
searchForm
})
||
{}
})
||
{}
list
&&
list
.
map
(
e
=>
{
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
.
tableData
=
list
||
[]
this
.
tableTotal
=
total
||
0
this
.
tableTotal
=
total
||
0
...
@@ -188,6 +193,10 @@ export default {
...
@@ -188,6 +193,10 @@ export default {
},
},
handleReset
()
{
handleReset
()
{
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
$refs
.
listRef
.
page
=
{
pageNum
:
1
,
pageSize
:
10
}
this
.
handleSearch
()
this
.
handleSearch
()
},
},
async
change
(
e
,
row
)
{
async
change
(
e
,
row
)
{
...
@@ -202,22 +211,25 @@ export default {
...
@@ -202,22 +211,25 @@ export default {
})
})
},
},
handleBlur
(
row
)
{
handleBlur
(
row
)
{
let
val
=
row
.
salesPrice
?.
trim
().
replace
(
/^0+/
,
''
)
let
{
salesPrice
,
InputPrice
,
sellPrice
}
=
row
if
(
val
)
{
if
(
!
InputPrice
)
return
if
(
!
/^
\d
+
(\.\d
+
)?
$/
.
test
(
val
))
val
=
''
try
{
val
=
`
${
Math
.
abs
(
val
)}
`
if
(
InputPrice
)
{
if
(
val
.
startsWith
(
'.'
))
row
.
salesPrice
=
'0'
+
val
if
(
InputPrice
.
startsWith
(
'.'
))
InputPrice
=
'0'
+
InputPrice
if
(
val
<
Number
(
row
.
sellPrice
))
val
=
`
${
row
.
sellPrice
}
`
if
(
Number
(
InputPrice
)
<
Number
(
sellPrice
))
throw
'销售价需大于等于成本价'
if
(
val
>
1000
)
val
=
'999.99'
if
(
InputPrice
>
1000
)
InputPrice
=
999.99
const
[
integerPart
,
decimalPart
]
=
val
.
split
(
'.'
)
InputPrice
=
Number
(
InputPrice
).
toFixed
(
2
)
if
(
decimalPart
&&
decimalPart
.
length
>
2
)
row
.
salesPrice
=
`
${
integerPart
||
'0'
}
.
${
decimalPart
.
slice
(
0
,
2
)}
`
}
else
throw
'销售价需大于等于成本价'
else
row
.
salesPrice
=
val
if
(
!
/^
\d
+
(\.\d
+
)?
$/
.
test
(
InputPrice
))
throw
'请输入数字'
}
else
row
.
salesPrice
=
''
if
(
InputPrice
!=
Number
(
salesPrice
))
this
.
update
({
if
(
row
.
salesPrice
)
this
.
update
({
type
:
1
,
type
:
1
,
id
:
row
.
id
,
id
:
row
.
id
,
salesPrice
:
NP
.
times
(
InputPrice
,
100
)
salesPrice
:
NP
.
times
(
row
.
salesPrice
,
100
)
})
})
}
catch
(
error
)
{
row
.
InputPrice
=
salesPrice
?
salesPrice
:
''
if
(
error
)
this
.
$message
.
error
(
error
)
}
},
},
async
uploadImg
(
e
,
target
)
{
async
uploadImg
(
e
,
target
)
{
const
{
url
}
=
await
uploadImg
(
e
,
this
)
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