Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李俊赕
self-support
Commits
d724210a
Commit
d724210a
authored
Aug 17, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed: 材料工艺不可以小数
parent
4743fa60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
81 deletions
+81
-81
material.vue
src/pages/order/material.vue
+81
-81
No files found.
src/pages/order/material.vue
View file @
d724210a
...
...
@@ -37,7 +37,7 @@
:border=
"true"
border-color=
"#2979FF"
@
focus=
"handleFocus(item)"
type=
"
digit
"
type=
"
number
"
placeholder=
"请输入"
v-model=
"item[key]"
placeholder-style=
"color: #999999;font-size:26rpx"
...
...
@@ -124,116 +124,116 @@
export
default
{
data
()
{
return
{
orderId
:
""
,
fieldName
:
"materialList"
,
orderId
:
''
,
fieldName
:
'materialList'
,
list
:
[],
// 材料列表
other
:
[],
// 其他列表
}
;
}
},
computed
:
{
buttonStyle
()
{
return
{
width
:
"600rpx"
,
height
:
"104rpx"
,
"font-size"
:
"32rpx"
,
"font-weight"
:
"bold"
,
}
;
width
:
'600rpx'
,
height
:
'104rpx'
,
'font-size'
:
'32rpx'
,
'font-weight'
:
'bold'
,
}
},
titles
()
{
return
{
matName
:
this
.
isMaterial
?
"材料名称"
:
"工艺名称"
,
matUnit
:
"单位"
,
freeLength
:
"免费量"
,
unitAmt
:
"单价/元"
,
useLength
:
"用量"
,
}
;
matName
:
this
.
isMaterial
?
'材料名称'
:
'工艺名称'
,
matUnit
:
'单位'
,
freeLength
:
'免费量'
,
unitAmt
:
'单价/元'
,
useLength
:
'用量'
,
}
},
widths
()
{
return
{
matName
:
200
,
matUnit
:
"auto"
,
freeLength
:
"auto"
,
unitAmt
:
"auto"
,
useLength
:
"auto"
,
}
;
matUnit
:
'auto'
,
freeLength
:
'auto'
,
unitAmt
:
'auto'
,
useLength
:
'auto'
,
}
},
thStyle
()
{
return
{
"font-weight"
:
"bold"
,
}
;
'font-weight'
:
'bold'
,
}
},
firstKey
()
{
return
Object
.
keys
(
this
.
titles
)[
0
]
;
return
Object
.
keys
(
this
.
titles
)[
0
]
},
subtractImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
"qxiao.png"
;
return
process
.
uniEnv
.
qn_base_url
+
'qxiao.png'
},
addImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
"tianjia.png"
;
return
process
.
uniEnv
.
qn_base_url
+
'tianjia.png'
},
money
()
{
// 总额
var
amount
=
0
;
var
amount
=
0
for
(
var
item
of
this
.
list
)
{
let
useLength
=
Number
(
item
.
useLength
)
||
0
;
let
freeLength
=
Number
(
item
.
freeLength
)
||
0
;
let
unitAmt
=
Number
(
item
.
unitAmt
)
||
0
;
amount
+=
Math
.
max
(
useLength
-
freeLength
,
0
)
*
unitAmt
;
let
useLength
=
Number
(
item
.
useLength
)
||
0
let
freeLength
=
Number
(
item
.
freeLength
)
||
0
let
unitAmt
=
Number
(
item
.
unitAmt
)
||
0
amount
+=
Math
.
max
(
useLength
-
freeLength
,
0
)
*
unitAmt
}
for
(
var
item
of
this
.
other
)
{
if
(
item
.
extraAmt
&&
Number
(
item
.
extraAmt
))
{
amount
+=
Number
(
item
.
extraAmt
)
;
amount
+=
Number
(
item
.
extraAmt
)
}
}
return
amount
;
return
amount
},
isMaterial
()
{
return
this
.
fieldName
===
"materialList"
;
return
this
.
fieldName
===
'materialList'
},
isCraft
()
{
return
this
.
fieldName
===
"craftList"
;
return
this
.
fieldName
===
'craftList'
},
priceType
()
{
return
this
.
isMaterial
?
"01"
:
"02"
;
return
this
.
isMaterial
?
'01'
:
'02'
},
},
onLoad
(
option
)
{
getApp
().
trackPage
(
"订单材料列表页"
);
this
.
orderId
=
option
.
orderId
;
this
.
fieldName
=
option
.
fieldName
;
const
eventChannel
=
this
.
getOpenerEventChannel
()
;
let
self
=
this
;
eventChannel
.
on
(
"showMaterialData"
,
function
(
data
)
{
getApp
().
trackPage
(
'订单材料列表页'
)
this
.
orderId
=
option
.
orderId
this
.
fieldName
=
option
.
fieldName
const
eventChannel
=
this
.
getOpenerEventChannel
()
let
self
=
this
eventChannel
.
on
(
'showMaterialData'
,
function
(
data
)
{
if
(
!
data
||
data
.
length
===
0
)
{
self
.
getMaterialData
()
;
self
.
getMaterialData
()
}
else
{
self
.
formatServiceMoreList
(
data
)
;
self
.
formatServiceMoreList
(
data
)
}
})
;
})
if
(
this
.
$u
.
test
.
isEmpty
(
this
.
other
))
{
this
.
handleAdd
()
;
this
.
handleAdd
()
}
},
created
()
{},
mounted
()
{},
methods
:
{
getMaterialData
()
{
let
self
=
this
;
let
self
=
this
self
.
$u
.
api
.
getOrderMaterial
(
self
.
orderId
).
then
((
res
)
=>
{
if
(
res
.
code
!==
200
)
{
console
.
log
(
res
.
data
.
message
)
;
return
;
console
.
log
(
res
.
data
.
message
)
return
}
self
.
formatServiceMoreList
(
res
.
data
)
;
})
;
self
.
formatServiceMoreList
(
res
.
data
)
})
},
formatServiceMoreList
(
materialCraftsData
)
{
let
self
=
this
;
let
self
=
this
materialCraftsData
.
map
((
item
)
=>
{
if
(
item
.
priceType
===
self
.
priceType
)
{
item
.
matType
===
"04"
?
self
.
other
.
push
(
item
)
:
self
.
list
.
push
(
item
);
item
.
matType
===
'04'
?
self
.
other
.
push
(
item
)
:
self
.
list
.
push
(
item
)
}
})
;
})
},
handleBlur
(
item
)
{
// 失去焦点如果没输入用原先的值
...
...
@@ -241,69 +241,69 @@ export default {
this
.
$u
.
test
.
isEmpty
(
item
.
useLength
)
||
!
this
.
$u
.
test
.
number
(
item
.
useLength
)
)
{
item
.
useLength
=
0
;
item
.
useLength
=
0
}
},
handleFocus
(
item
)
{
// 点击清空
if
(
this
.
$u
.
test
.
isEmpty
(
item
.
useLength
))
{
item
.
useLength
=
null
;
item
.
useLength
=
null
}
},
/* 其他添加新的 */
handleAdd
()
{
this
.
other
.
push
({
//orderNo:this.formInfo.orderNo,
isDel
:
"N"
,
isDel
:
'N'
,
isWebAdd
:
true
,
matName
:
"其他"
,
matName
:
'其他'
,
extraAmt
:
null
,
priceType
:
this
.
priceType
,
matType
:
"04"
,
otherExplain
:
""
,
})
;
matType
:
'04'
,
otherExplain
:
''
,
})
},
/* 其他删除某个 */
handleSubtract
(
index
)
{
this
.
other
.
splice
(
index
,
1
)
;
this
.
other
.
splice
(
index
,
1
)
},
validateForm
()
{
if
(
this
.
isMaterial
)
{
let
row
=
this
.
list
.
find
((
item
)
=>
{
return
!
this
.
$u
.
test
.
isEmpty
(
item
.
useLength
)
&&
item
.
useLength
!=
'0'
;
})
;
return
!
this
.
$u
.
test
.
isEmpty
(
item
.
useLength
)
&&
item
.
useLength
!=
'0'
})
if
(
!
this
.
$u
.
test
.
isEmpty
(
this
.
list
)
&&
this
.
$u
.
test
.
isEmpty
(
row
))
{
this
.
$refs
.
uToast
.
show
({
title
:
"请填写电缆、漏保、空开等用量"
,
type
:
"error"
,
title
:
'请填写电缆、漏保、空开等用量'
,
type
:
'error'
,
icon
:
false
,
position
:
"bottom"
,
})
;
return
false
;
position
:
'bottom'
,
})
return
false
}
}
return
true
;
return
true
},
handleSure
()
{
if
(
!
this
.
validateForm
())
{
return
false
;
return
false
}
let
pages
=
getCurrentPages
()
;
let
prevPage
=
pages
[
pages
.
length
-
2
]
;
//上一个页面
let
data
=
{}
;
let
tmps
=
[]
;
let
pages
=
getCurrentPages
()
let
prevPage
=
pages
[
pages
.
length
-
2
]
//上一个页面
let
data
=
{}
let
tmps
=
[]
this
.
other
.
map
((
item
)
=>
{
if
(
!
this
.
$u
.
test
.
isEmpty
(
item
.
otherExplain
))
{
item
.
extraAmt
=
item
.
extraAmt
||
0
;
tmps
.
push
(
item
)
;
item
.
extraAmt
=
item
.
extraAmt
||
0
tmps
.
push
(
item
)
}
})
;
data
[
this
.
fieldName
]
=
this
.
list
.
concat
(
tmps
)
;
// 将list合并给上以页面
prevPage
.
$vm
.
setData
(
data
)
;
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
uni
.
navigateBack
()
;
})
data
[
this
.
fieldName
]
=
this
.
list
.
concat
(
tmps
)
// 将list合并给上以页面
prevPage
.
$vm
.
setData
(
data
)
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
uni
.
navigateBack
()
},
},
}
;
}
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
Write
Preview
Markdown
is supported
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