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
2023fc1c
Commit
2023fc1c
authored
Jul 08, 2021
by
高铭波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf(order):勘查材料金额计算修改
parent
08090899
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
203 additions
and
188 deletions
+203
-188
index.vue
src/components/order/index.vue
+170
-172
material.vue
src/pages/order/material.vue
+33
-16
No files found.
src/components/order/index.vue
View file @
2023fc1c
...
...
@@ -10,14 +10,14 @@
<view
class=
"right-view"
>
{{
orderData
.
orderBusinessTypeText
}}
</view>
</view>
<view
class=
"content-view"
>
<view
class=
"info-view"
v-for=
"(item, key) in infoTexts"
:key=
"key"
>
<view
class=
"info-title"
>
<text>
{{
item
.
name
+
':'
}}
</text>
</view>
<view
class=
"info-content"
>
<text>
{{
orderData
[
key
]
}}
</text>
<text
v-if=
"item.content"
>
{{
' / '
+
orderData
[
item
.
content
]
}}
</text>
</view>
<view
class=
"info-view"
v-for=
"(item, key) in infoTexts"
:key=
"key"
>
<view
class=
"info-title"
>
<text>
{{
item
.
name
+
':'
}}
</text>
</view>
<view
class=
"info-content"
>
<text>
{{
orderData
[
key
]
}}
</text>
<text
v-if=
"item.content"
>
{{
' / '
+
orderData
[
item
.
content
]
}}
</text>
</view>
</view>
<view
class=
"address-view"
>
<view
class=
"address-left-view"
>
...
...
@@ -31,7 +31,7 @@
</view>
<view
class=
"line-view"
></view>
<view
class=
"reason-view"
v-if=
"showReason"
>
<view
class=
"reason-view"
v-if=
"showReason"
>
<view
class=
"reason-title"
><text>
未通过原因:
</text></view>
<view
class=
"reason-text"
><text
v-for=
"(item, index) in orderData.auditResults"
:key=
"index"
>
{{
item
}}
</text></view>
</view>
...
...
@@ -53,7 +53,6 @@
</u-button>
</view>
</view>
</view>
</
template
>
<
script
>
...
...
@@ -79,19 +78,19 @@
auditDatetime
:
'2021.04.19 12:45:09'
,
// 审核时间
orderFinishDatetime
:
'2021.04.19 16:24:48'
,
// 提交时间
auditResults
:
{},
// 审核结果
orderBusinessType
:
'R'
,
// 业务类型 R 为抢单
orderBusinessType
:
'R'
,
// 业务类型 R 为抢单
orderId
:
'0'
,
// 订单id
}
}
},
/* 订单类型
waitAccept:待接单、
waitAppointment:待预约、
waitCheckIn:待签到、
waitFinish:待完工、
audit: 审核中、
exception:异常单、
finish:已完工
},
/* 订单类型
waitAccept:待接单、
waitAppointment:待预约、
waitCheckIn:待签到、
waitFinish:待完工、
audit: 审核中、
exception:异常单、
finish:已完工
*/
type
:
String
,
location
:
{
// 当前坐标
...
...
@@ -103,8 +102,8 @@
},
data
()
{
return
{
timeout
:
false
,
timestamp
:
0
,
timeout
:
false
,
timestamp
:
0
,
};
},
computed
:
{
...
...
@@ -138,7 +137,7 @@
},
infoTexts
()
{
return
{
'orderNumber'
:
{
name
:
'工单编号'
},
'orderNumber'
:
{
name
:
'工单编号'
},
'partnerCompanyName'
:
{
name
:
'合作厂商'
},
'contactName'
:
{
name
:
'客户信息'
,
content
:
'contactPhone'
},
...
...
@@ -182,9 +181,9 @@
},
tagText
()
{
return
this
.
timeout
?
'超'
:
'剩'
},
timeText
()
{
let
time
=
this
.
orderType
==
4
?
this
.
orderData
.
orderFinishDatetime
:
this
.
orderData
.
auditDatetime
},
timeText
()
{
let
time
=
this
.
orderType
==
4
?
this
.
orderData
.
orderFinishDatetime
:
this
.
orderData
.
auditDatetime
return
time
?
this
.
$u
.
timeFormat
(
time
,
'yyyy.mm.dd hh:MM:ss'
)
:
''
},
timeTitle
()
{
...
...
@@ -193,92 +192,92 @@
showReason
()
{
return
this
.
orderType
==
5
},
showDistance
()
{
showDistance
()
{
return
this
.
orderType
==
0
&&
this
.
location
.
length
>=
2
&&
(
this
.
orderData
.
contactAddressLatitud
||
this
.
orderData
.
contactAddressLongitud
)
},
titles
()
{
return
{
'waitAccept'
:
'待'
+
this
.
type0Text
,
// 待接单、
'waitAppointment'
:
'待预约'
,
// 待预约、
'waitCheckIn'
:
'待签到'
,
// 待签到、
'waitFinish'
:
'待完工'
,
// 待完工、
'audit'
:
'审核中'
,
// 审核中、
'exception'
:
'异常单'
,
// 异常单、
'finish'
:
'已完工'
,
//已完工
}
},
types
()
{
return
{
'waitAccept'
:
0
,
// 待接单、
'waitAppointment'
:
1
,
// 待预约、
'waitCheckIn'
:
2
,
// 待签到、
'waitFinish'
:
3
,
// 待完工、
'audit'
:
4
,
// 审核中、
'exception'
:
5
,
// 异常单、
'finish'
:
6
,
//已完工
}
},
title
()
{
return
this
.
titles
[
this
.
type
]
},
orderDistance
()
{
},
titles
()
{
return
{
'waitAccept'
:
'待'
+
this
.
type0Text
,
// 待接单、
'waitAppointment'
:
'待预约'
,
// 待预约、
'waitCheckIn'
:
'待签到'
,
// 待签到、
'waitFinish'
:
'待完工'
,
// 待完工、
'audit'
:
'审核中'
,
// 审核中、
'exception'
:
'异常单'
,
// 异常单、
'finish'
:
'已完工'
,
//已完工
}
},
types
()
{
return
{
'waitAccept'
:
0
,
// 待接单、
'waitAppointment'
:
1
,
// 待预约、
'waitCheckIn'
:
2
,
// 待签到、
'waitFinish'
:
3
,
// 待完工、
'audit'
:
4
,
// 审核中、
'exception'
:
5
,
// 异常单、
'finish'
:
6
,
//已完工
}
},
title
()
{
return
this
.
titles
[
this
.
type
]
},
orderDistance
()
{
return
this
.
distance
(
this
.
orderData
.
contactAddressLatitud
,
this
.
orderData
.
contactAddressLongitud
,
this
.
location
[
0
],
this
.
location
[
1
])
},
/** orderType
0 待接单、
1 待预约、
2 待签到、
3 待完工、
4 审核中、
5 异常单、
6 已完工
*/
orderType
()
{
/*
orderStatus:
待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/
if
(
!
this
.
type
)
{
if
(
this
.
orderData
.
orderStatus
<
31
)
{
return
0
}
else
if
(
this
.
orderData
.
orderStatus
==
31
)
{
if
(
this
.
orderData
.
appointmentDatetime
)
{
return
2
}
else
{
return
1
}
}
else
if
(
this
.
orderData
.
orderStatus
>
31
&&
this
.
orderData
.
orderStatus
<
80
)
{
return
3
}
else
if
(
this
.
orderData
.
orderStatus
==
85
||
this
.
orderData
.
orderStatus
==
87
)
{
return
4
}
else
if
(
this
.
orderData
.
orderStatus
==
86
||
this
.
orderData
.
orderStatus
==
88
)
{
return
5
}
else
if
([
80
,
81
,
89
,
110
].
indexOf
(
this
.
orderData
.
orderStatus
)
!=
-
1
)
{
return
6
}
else
{
return
0
}
}
else
{
return
this
.
types
[
this
.
type
]
}
},
/** orderType
0 待接单、
1 待预约、
2 待签到、
3 待完工、
4 审核中、
5 异常单、
6 已完工
*/
orderType
()
{
/*
orderStatus:
待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/
if
(
!
this
.
type
)
{
if
(
this
.
orderData
.
orderStatus
<
31
)
{
return
0
}
else
if
(
this
.
orderData
.
orderStatus
==
31
)
{
if
(
this
.
orderData
.
appointmentDatetime
)
{
return
2
}
else
{
return
1
}
}
else
if
(
this
.
orderData
.
orderStatus
>
31
&&
this
.
orderData
.
orderStatus
<
80
)
{
return
3
}
else
if
(
this
.
orderData
.
orderStatus
==
85
||
this
.
orderData
.
orderStatus
==
87
)
{
return
4
}
else
if
(
this
.
orderData
.
orderStatus
==
86
||
this
.
orderData
.
orderStatus
==
88
)
{
return
5
}
else
if
([
80
,
81
,
89
,
110
].
indexOf
(
this
.
orderData
.
orderStatus
)
!=
-
1
)
{
return
6
}
else
{
return
0
}
}
else
{
return
this
.
types
[
this
.
type
]
}
}
},
created
()
{
this
.
updateTime
()
},
watch
:{
'orderData.currentCellTime'
(
val
)
{
// 从后台重新获取数据之后,时间重新计算
this
.
updateTime
()
}
},
methods
:
{
created
()
{
this
.
updateTime
()
},
watch
:{
'orderData.currentCellTime'
(
val
)
{
// 从后台重新获取数据之后,时间重新计算
this
.
updateTime
()
}
},
methods
:
{
// title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
handleClick
()
{
// if (this.buttonDisabled) return
...
...
@@ -287,14 +286,14 @@
handleClickCell
()
{
this
.
$emit
(
'click'
,
this
.
orderData
,
this
.
title
,
this
.
showCountTime
?
'show'
:
''
)
},
handleChange
(
timestamp
)
{
if
(
this
.
timeout
)
this
.
$refs
[
'order-count-down'
].
seconds
+=
2
if
(
timestamp
==
0
&&
!
this
.
timeout
)
{
// 超时之后倒计时变为正计时
setTimeout
(()
=>
{
this
.
timestamp
=
1
this
.
timeout
=
true
},
1000
)
}
handleChange
(
timestamp
)
{
if
(
this
.
timeout
)
this
.
$refs
[
'order-count-down'
].
seconds
+=
2
if
(
timestamp
==
0
&&
!
this
.
timeout
)
{
// 超时之后倒计时变为正计时
setTimeout
(()
=>
{
this
.
timestamp
=
1
this
.
timeout
=
true
},
1000
)
}
},
formatAddress
(
order
)
{
let
address
=
""
...
...
@@ -307,33 +306,33 @@
}
return
address
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 经度
* @param float $lat1 维度
* @param float $lon2 经度
* @param float $lat2 维度
* @return float 浮点数
*/
distance
(
lat1
,
lng1
,
lat2
,
lng2
)
{
var
radLat1
=
this
.
Rad
(
lat1
);
var
radLat2
=
this
.
Rad
(
lat2
);
var
a
=
radLat1
-
radLat2
;
var
b
=
this
.
Rad
(
lng1
)
-
this
.
Rad
(
lng2
);
var
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
6378.137
;
// EARTH_RADIUS;
s
=
Math
.
round
(
s
*
10000
)
/
10000
//输出为米
return
Number
(
s
?
s
.
toFixed
(
2
):
0
);
},
Rad
(
d
){
return
d
*
Math
.
PI
/
180.0
;
//经纬度转换成三角函数中度分表形式。
},
updateTime
()
{
var
time
=
new
Date
().
getTime
()
this
.
timeout
=
this
.
orderData
.
currentOverTime
<
time
this
.
timestamp
=
Math
.
round
(
Math
.
abs
(
this
.
orderData
.
currentOverTime
-
time
)
/
1000
)
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 经度
* @param float $lat1 维度
* @param float $lon2 经度
* @param float $lat2 维度
* @return float 浮点数
*/
distance
(
lat1
,
lng1
,
lat2
,
lng2
)
{
var
radLat1
=
this
.
Rad
(
lat1
);
var
radLat2
=
this
.
Rad
(
lat2
);
var
a
=
radLat1
-
radLat2
;
var
b
=
this
.
Rad
(
lng1
)
-
this
.
Rad
(
lng2
);
var
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
6378.137
;
// EARTH_RADIUS;
s
=
Math
.
round
(
s
*
10000
)
/
10000
//输出为米
return
Number
(
s
?
s
.
toFixed
(
2
):
0
);
},
Rad
(
d
){
return
d
*
Math
.
PI
/
180.0
;
//经纬度转换成三角函数中度分表形式。
},
updateTime
()
{
var
time
=
new
Date
().
getTime
()
this
.
timeout
=
this
.
orderData
.
currentOverTime
<
time
this
.
timestamp
=
Math
.
round
(
Math
.
abs
(
this
.
orderData
.
currentOverTime
-
time
)
/
1000
)
}
}
}
...
...
@@ -357,14 +356,14 @@
display
:
flex
;
align-items
:
center
;
.tag-view
{
.tag-view
{
text-align
:
center
;
width
:
84rpx
;
height
:
40rpx
;
color
:
#FFFFFF
;
border-radius
:
8rpx
;
background-image
:
linear-gradient
(
to
right
,
#FF930D
,
#FFC174
);
font-size
:
22rpx
;
font-size
:
22rpx
;
line-height
:
42rpx
;
&
.active
{
background-image
:
linear-gradient
(
to
right
,
#2272FF
,
#47ABFF
);
...
...
@@ -379,7 +378,7 @@
}
}
.right-view
{
.right-view
{
text-align
:
center
;
width
:
100rpx
;
height
:
40rpx
;
...
...
@@ -397,15 +396,15 @@
color
:
#333333
;
font-size
:
26rpx
;
margin-top
:
18rpx
;
margin-bottom
:
18rpx
;
display
:
flex
;
align-items
:
flex-start
;
.info-title
{
flex-shrink
:
0
;
}
.info-content
{
word-break
:
break-all
;
margin-bottom
:
18rpx
;
display
:
flex
;
align-items
:
flex-start
;
.info-title
{
flex-shrink
:
0
;
}
.info-content
{
word-break
:
break-all
;
}
}
...
...
@@ -421,19 +420,19 @@
display
:
flex
;
align-items
:
center
;
align-items
:
flex-start
;
text-align
:
left
;
text-align
:
left
;
.address-image
{
width
:
26rpx
;
height
:
28rpx
;
margin-right
:
8rpx
;
flex-shrink
:
0
;
margin-top
:
4rpx
;
margin-top
:
4rpx
;
}
}
.address-right-view
{
margin-left
:
30rpx
;
.address-right-view
{
margin-left
:
30rpx
;
}
}
}
...
...
@@ -450,16 +449,16 @@
margin-top
:
30rpx
;
font-size
:
26rpx
;
color
:
#FA5A49
;
display
:
flex
;
align-items
:
flex-start
;
display
:
flex
;
align-items
:
flex-start
;
display
:
flex
;
.reason-title
{
flex-shrink
:
0
;
flex-shrink
:
0
;
color
:
#666666
;
}
.reason-text
{
display
:
flex
;
flex-direction
:
column
;
}
.reason-text
{
display
:
flex
;
flex-direction
:
column
;
}
}
...
...
@@ -473,16 +472,16 @@
display
:
flex
;
align-items
:
center
;
.bottom-tag-view
{
.bottom-tag-view
{
width
:
52rpx
;
height
:
52rpx
;
border-radius
:
26rpx
;
color
:
#FFFFFF
;
font-size
:
26rpx
;
background-color
:
#FF930D
;
margin-right
:
16rpx
;
display
:
flex
;
justify-content
:
center
;
margin-right
:
16rpx
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
&
.timeout
{
...
...
@@ -491,7 +490,6 @@
}
}
.right-btn
{}
}
}
</
style
>
</
style
>
src/pages/order/material.vue
View file @
2023fc1c
...
...
@@ -25,7 +25,12 @@
</u-tr>
<view
class=
"line-view"
></view>
<u-tr
class=
"u-tr"
v-for=
"(item, index) in list"
:key=
"index"
>
<u-td
class=
"u-td"
v-for=
"(value, key) in titles"
:key=
"key"
>
<u-td
class=
"u-td"
v-for=
"(value, key) in titles"
:key=
"key"
width=
"200"
>
<view
v-if=
"key == 'useLength'"
class=
"uselen-input"
>
<u-input
@
blur=
"handleBlur(item)"
...
...
@@ -143,6 +148,15 @@ export default {
useLength
:
"用量"
,
};
},
widths
()
{
return
{
matName
:
200
,
matUnit
:
"auto"
,
freeLength
:
"auto"
,
unitAmt
:
"auto"
,
useLength
:
"auto"
,
};
},
thStyle
()
{
return
{
"font-weight"
:
"bold"
,
...
...
@@ -162,9 +176,9 @@ export default {
var
amount
=
0
;
for
(
var
item
of
this
.
list
)
{
if
(
N
umber
(
item
.
useLength
)
&&
N
umber
(
item
.
freeLength
)
&&
N
umber
(
item
.
unitAmt
)
this
.
$u
.
test
.
n
umber
(
item
.
useLength
)
&&
this
.
$u
.
test
.
n
umber
(
item
.
freeLength
)
&&
this
.
$u
.
test
.
n
umber
(
item
.
unitAmt
)
)
{
amount
+=
Math
.
max
(
Number
(
item
.
useLength
)
-
Number
(
item
.
freeLength
),
0
)
*
...
...
@@ -197,6 +211,9 @@ export default {
eventChannel
.
on
(
"showMaterialData"
,
function
(
data
)
{
if
(
!
data
||
data
.
length
===
0
)
{
self
.
getMaterialData
();
if
(
self
.
$u
.
test
.
isEmpty
(
self
.
other
))
{
self
.
handleAdd
();
}
}
else
{
self
.
formatServiceMoreList
(
data
);
}
...
...
@@ -208,7 +225,7 @@ export default {
matName
:
"开孔厚40cm以上,直径11cm以下"
,
matUnit
:
"个"
,
freeLength
:
0
,
unitAmt
:
0
,
unitAmt
:
1
0
,
useLength
:
0
,
},
{
...
...
@@ -217,7 +234,7 @@ export default {
matName
:
"验收完成后移动安装地点"
,
matUnit
:
"次"
,
freeLength
:
0
,
unitAmt
:
0
,
unitAmt
:
2
0
,
useLength
:
0
,
},
{
...
...
@@ -226,7 +243,7 @@ export default {
matName
:
"北京地区报装"
,
matUnit
:
"次"
,
freeLength
:
0
,
unitAmt
:
0
,
unitAmt
:
3
0
,
useLength
:
0
,
},
{
...
...
@@ -235,7 +252,7 @@ export default {
matName
:
"墙面开墙及恢复"
,
matUnit
:
"米"
,
freeLength
:
0
,
unitAmt
:
0
,
unitAmt
:
4
0
,
useLength
:
0
,
},
{
...
...
@@ -244,7 +261,7 @@ export default {
matName
:
"安装位置单次往返经销商距离"
,
matUnit
:
"千米"
,
freeLength
:
0
,
unitAmt
:
0
,
unitAmt
:
5
0
,
useLength
:
0
,
},
{
...
...
@@ -252,8 +269,8 @@ export default {
priceType
:
"01"
,
matName
:
"开孔厚40cm以上,直径11cm以下"
,
matUnit
:
"个"
,
freeLength
:
0
,
unitAmt
:
0
,
freeLength
:
1
,
unitAmt
:
6
0
,
useLength
:
0
,
},
{
...
...
@@ -261,8 +278,8 @@ export default {
priceType
:
"01"
,
matName
:
"桥架50mm*50mm"
,
matUnit
:
"米"
,
freeLength
:
0
,
unitAmt
:
0
,
freeLength
:
2
,
unitAmt
:
7
0
,
useLength
:
0
,
},
{
...
...
@@ -270,7 +287,7 @@ export default {
priceType
:
"01"
,
matName
:
"铺装庭院开挖(复合材料)"
,
matUnit
:
"米"
,
freeLength
:
0
,
freeLength
:
3
,
unitAmt
:
220
,
useLength
:
0
,
},
...
...
@@ -334,7 +351,7 @@ export default {
let
row
=
this
.
list
.
find
((
item
,
index
)
=>
{
return
item
.
useLength
!=
0
;
});
if
(
!
this
.
$u
.
test
.
isEmpty
(
this
.
list
)
&&
this
.
$u
.
test
.
isEmpty
(
row
))
{
if
(
this
.
$u
.
test
.
isEmpty
(
row
))
{
this
.
$refs
.
uToast
.
show
({
title
:
"请填写电缆、漏保、空开等用量"
,
type
:
"error"
,
...
...
@@ -351,7 +368,7 @@ export default {
return
false
;
}
for
(
let
item
of
this
.
other
)
{
if
(
!
item
.
otherExplain
)
{
if
(
this
.
other
.
length
>
1
&&
!
item
.
otherExplain
)
{
this
.
$refs
.
uToast
.
show
({
title
:
"请输入其他项说明"
,
type
:
"warning"
,
...
...
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