Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fb87ef72
authored
Jun 25, 2024
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v1.0.7' of
http://192.168.3.233:8090/glsx/gl_tape
into v1.0.7
2 parents
182ccda0
f0896682
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
357 additions
and
262 deletions
components/HomeFrame/components/RecordList.vue
main.js
mixin/click.js
mixin/storge.js
utils/cache/constantData.js
utils/utils.js
components/HomeFrame/components/RecordList.vue
View file @
fb87ef7
<
template
>
<
template
>
<scroll-view
<view
class=
"record-box"
>
class=
"record-box"
scroll-y
@
scrolltolower=
"pageonReachBottom"
@
scroll=
"scroll"
>
<view
class=
"record-content"
>
<view
class=
"record-content"
>
<view
class=
"data-box"
>
<view
class=
"data-box"
>
<template
v-for=
"(i, index) in dataList"
>
<template
v-for=
"(i, index) in dataList"
>
<view
<view
:class=
"['data-item', i.type]"
:key=
"index"
>
:class=
"['data-item', i.type]"
<image
:src=
"i.icon"
class=
"data-item-bg"
/>
:key=
"index"
>
<image
:src=
"i.icon"
class=
"data-item-bg"
/>
<view
class=
"title"
>
{{
dateList
[
index
].
text
}}
</view>
<view
class=
"title"
>
{{
dateList
[
index
].
text
}}
</view>
<view
class=
"content"
>
<view
class=
"content"
>
<view
class=
"total"
>
<view
class=
"total"
>
...
@@ -37,82 +26,121 @@
...
@@ -37,82 +26,121 @@
</view>
</view>
</
template
>
</
template
>
</view>
</view>
<view
:class=
"['data-tabs-box', { sticky: sticky }]"
>
<view
class=
"data-container"
>
<view
class=
"data-tabs"
>
<view
:class=
"['type-box']"
>
<
template
v-for=
"(i, index) in dateList"
>
<view
class=
"tab-item"
v-for=
"(i, index) in typeList"
:key=
"index"
@
click=
"changeType(index, 'firstIndex')"
>
<view
<view
:class=
"['tab flex',
{ active: dateIndex == index }]"
class=
"sprite-icon"
:key="index"
:class=
"[
@click="changeIndex(index)"
firstIndex == index ? `icon-${firstClass[index]} active` : '',
>
{{
i
.
text
}}
</view>
]"
</
template
>
:style=
"{ left: firstLeft[index] }"
<view
:class=
"['active-btn', `active-btn-${dateIndex}`]"
></view>
></view>
<view
class=
"text"
:class=
"[firstIndex == index ? `active` : '']"
>
{{ i.tabName
}}{{
i.num
&&
recordFailList.length > 0
? `(${recordFailList.length})`
: ""
}}
</view
>
</view>
</view>
</view>
</view>
<view
class=
"tabs-bottom"
></view>
<view
class=
"list"
>
<view
v-if=
"firstIndex == 0"
class=
"data-tabs-box"
>
<
template
v-if=
"flag"
>
<view
class=
"data-tabs"
>
<template
v-if=
"list.length && list[0] && list[0].length"
>
<
template
v-for=
"(i, index) in dateList"
>
<template
v-for=
"i in list"
>
<view
<template
v-for=
"item in i"
>
:class=
"['tab flex',
{ active: dateIndex == index }]"
<view
:key="index"
class=
"item"
@click="changeIndex(index)"
:key=
"item.id"
>
{{
i
.
text
}}
</view
>
>
<view
:class=
"[
</
template
>
'status flex',
<view
:class=
"['active-btn', `active-btn-${dateIndex}`]"
></view>
{ deal: item.receptionStatus == 1 },
</view>
]">
{{
</view>
{
<scroll-view
1
:
"成交"
,
class=
"record-list"
0
:
"战败"
,
:style=
"{
}
[
item
.
receptionStatus
]
height:
}}
<
/view
>
firstIndex == 0 ? 'calc(100% - 300rpx)' : 'calc(100% - 180rpx)',
<
view
class
=
"name"
>
}"
{{
item
.
customerName
}}
scroll-y
<
/view
>
@
scrolltolower=
"pageonReachBottom"
<
view
class
=
"goods-name"
>
{{
item
.
carModel
}}
<
/view
>
@
scroll=
"scroll"
<
template
v
-
for
=
"(k, ind) in itemObject"
>
>
<
view
<view
class=
"list"
>
class
=
"info flex"
<
template
v-if=
"flag"
>
:
key
=
"ind"
<template
v-if=
"list.length && list[0] && list[0].length"
>
>
<template
v-for=
"i in list"
>
<
view
class
=
"label"
>
{{
k
.
label
}}
<
/view
>
<template
v-for=
"item in i"
>
<
view
class
=
"value"
>
{{
item
[
k
.
key
]
||
"-"
}}
<
/view
>
<view
class=
"item"
:key=
"item.id"
>
<view
:class=
"[
'status flex',
{ deal: item.receptionStatus == 1 },
]"
>
{{
{
1
:
"成交"
,
0
:
"战败"
,
}
[
item
.
receptionStatus
]
}}
<
/vie
w
>
<
view
class
=
"name"
>
{{
item
.
customerName
}}
<
/view
>
<
view
class
=
"goods-name"
>
{{
item
.
carModel
}}
<
/view
>
<
template
v
-
for
=
"(k, ind) in itemObject"
>
<
view
class
=
"info flex"
:
key
=
"ind"
>
<
view
class
=
"label"
>
{{
k
.
label
}}
<
/view
>
<
view
class
=
"value"
>
{{
item
[
k
.
key
]
||
"-"
}}
<
/view
>
<
/view
>
<
/template
>
<
/view
>
<
/view
>
<
/template
>
<
/template
>
<
/template
>
<
/template
>
<
template
v
-
else
>
<
view
class
=
"nothing flex"
>
<
image
class
=
"icon"
src
=
"../../../assets/images/home/nothing.webp"
/>
暂无接待记录
<
/view
>
<
/view
>
<
/template
>
<
/template
>
<
/template
>
<
/template
>
<
/view
>
<
template
v
-
if
=
"nothing"
>
<
view
class
=
"end-text"
>
到底了!
<
/view
>
<
/template
>
<
/template
>
<
template
v
-
else
>
<
/scroll-view
>
<
view
class
=
"nothing flex"
>
<
image
class
=
"icon"
src
=
"../../../assets/images/home/nothing.webp"
/>
暂无接待记录
<
/view
>
<
/template
>
<
/template
>
<
/view
>
<
/view
>
<
template
v
-
if
=
"nothing"
>
<
view
class
=
"bottom-mask"
><
/view
>
<
view
class
=
"end-text"
>
到底了!
<
/view
>
<
/template
>
<
/view
>
<
/view
>
<
view
class
=
"bottom-mask"
><
/view
>
<
/view
>
<
/scroll-view
>
<
/template
>
<
/template
>
<
script
type
=
"text/ecmascript-6"
>
<
script
type
=
"text/ecmascript-6"
>
import
dayjs
from
'dayjs'
import
dayjs
from
'dayjs'
const
dayImgUrl
=
require
(
'@/assets/images/common/day.webp'
)
const
dayImgUrl
=
require
(
'@/assets/images/common/day.webp'
)
const
weekImgUrl
=
require
(
'@/assets/images/common/week.webp'
)
const
weekImgUrl
=
require
(
'@/assets/images/common/week.webp'
)
const
monthImgUrl
=
require
(
'@/assets/images/common/month.webp'
)
const
monthImgUrl
=
require
(
'@/assets/images/common/month.webp'
)
import
utils
from
"@/utils/utils.js"
;
export
default
{
export
default
{
name
:
''
,
name
:
''
,
data
()
{
data
()
{
return
{
return
{
sexType
:
{
'男'
:
'icon-male'
,
'女'
:
'icon-female'
}
,
dataList
:
[
dataList
:
[
{
{
label
:
'客户接待数'
,
label
:
'客户接待数'
,
...
@@ -130,6 +158,13 @@ export default {
...
@@ -130,6 +158,13 @@ export default {
icon
:
monthImgUrl
icon
:
monthImgUrl
}
}
],
],
typeList
:
[
{
tabName
:
'已上传'
}
,
{
tabName
:
'待上传'
,
num
:
true
}
,
],
firstIndex
:
0
,
firstLeft
:
[
'0rpx'
,
'352rpx'
,
'756rpx'
],
firstClass
:
[
'first-nav'
,
'second-nav'
,
'second-nav'
],
dateList
:
[
dateList
:
[
{
text
:
'今日'
}
,
{
text
:
'今日'
}
,
{
text
:
'本周'
}
,
{
text
:
'本周'
}
,
...
@@ -142,6 +177,7 @@ export default {
...
@@ -142,6 +177,7 @@ export default {
{
label
:
'开始接待'
,
key
:
'startTime'
}
,
{
label
:
'开始接待'
,
key
:
'startTime'
}
,
{
label
:
'结束接待'
,
key
:
'endTime'
}
,
{
label
:
'结束接待'
,
key
:
'endTime'
}
,
],
],
recordFailList
:[],
dateIndex
:
0
,
dateIndex
:
0
,
pageNum
:
1
,
pageNum
:
1
,
total
:
0
,
total
:
0
,
...
@@ -154,11 +190,54 @@ export default {
...
@@ -154,11 +190,54 @@ export default {
}
,
}
,
mounted
()
{
mounted
()
{
this
.
init
()
this
.
init
()
this
.
getRecordNum
()
}
,
}
,
methods
:
{
methods
:
{
changeType
(
index
,
name
)
{
if
(
this
[
name
]
==
index
)
return
// 点击同一个
this
.
direction
=
''
console
.
log
(
index
,
name
,
this
[
name
])
if
(
this
[
name
]
<
index
)
{
this
.
direction
=
'right'
}
else
{
this
.
direction
=
'left'
}
this
[
name
]
=
index
this
.
list
=
[]
this
.
pageNum
=
1
;
if
(
index
==
0
)
{
this
.
changeIndex
(
this
.
dateIndex
,
true
)
}
else
{
this
.
getRecordFail
()
}
}
,
scroll
(
e
)
{
scroll
(
e
)
{
this
.
sticky
=
e
.
detail
.
scrollTop
>=
148
this
.
sticky
=
e
.
detail
.
scrollTop
>=
148
}
,
}
,
getRecordNum
()
{
let
recordFailListAll
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
const
{
shopMerchantId
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
);
let
recordFailList
=
recordFailListAll
.
filter
(
i
=>
{
console
.
log
(
i
.
bussinessType
,
sceneType
)
return
i
.
merchantId
==
shopMerchantId
&&
i
.
bussinessType
==
(
sceneType
==
0
?
1
:
2
)
}
)
this
.
recordFailList
=
recordFailList
}
,
getRecordFail
()
{
this
.
getRecordNum
()
this
.
list
[
0
]
=
this
.
recordFailList
.
map
(
i
=>
{
return
{
receptionStatus
:
i
.
receptionStatus
,
phoneNumber
:
i
.
phoneNumber
,
salesName
:
i
.
salesName
,
customerName
:
i
.
customerName
,
carModel
:
i
.
carModel
,
duration
:
this
.
formatSeconds
(
new
Date
(
i
.
receptionEndTime
).
getTime
()
-
new
Date
(
i
.
receptionStartTime
).
getTime
()),
startTime
:
i
.
receptionStartTime
.
replace
(
/
\/
/g
,
'.'
),
endTime
:
i
.
receptionEndTime
.
replace
(
/
\/
/g
,
'.'
)
}
}
)
}
,
init
()
{
init
()
{
this
.
dateList
.
map
((
e
,
index
)
=>
{
this
.
dateList
.
map
((
e
,
index
)
=>
{
const
tatget
=
[
'day'
,
'week'
,
'month'
][
index
]
const
tatget
=
[
'day'
,
'week'
,
'month'
][
index
]
...
@@ -193,7 +272,6 @@ export default {
...
@@ -193,7 +272,6 @@ export default {
this
.
$set
(
this
.
dataList
,
index
,
{
...
this
.
dataList
[
index
],
...
data
}
)
this
.
$set
(
this
.
dataList
,
index
,
{
...
this
.
dataList
[
index
],
...
data
}
)
if
(
index
<
2
)
this
.
getReceptionStatistics
(
++
index
)
if
(
index
<
2
)
this
.
getReceptionStatistics
(
++
index
)
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
}
,
}
,
async
getReceptionList
()
{
async
getReceptionList
()
{
...
@@ -221,11 +299,12 @@ export default {
...
@@ -221,11 +299,12 @@ export default {
e
.
endTime
=
dayjs
(
e
.
receptionEndTime
).
format
(
"YYYY.MM.DD HH:mm:ss"
)
e
.
endTime
=
dayjs
(
e
.
receptionEndTime
).
format
(
"YYYY.MM.DD HH:mm:ss"
)
e
.
phoneNumber
=
phoneNumber
.
slice
(
0
,
3
)
+
" "
+
phoneNumber
.
slice
(
3
,
7
)
+
" "
+
phoneNumber
.
slice
(
7
)
e
.
phoneNumber
=
phoneNumber
.
slice
(
0
,
3
)
+
" "
+
phoneNumber
.
slice
(
3
,
7
)
+
" "
+
phoneNumber
.
slice
(
7
)
}
)
}
)
this
.
list
[
pageNum
-
1
]
=
list
this
.
$set
(
this
.
list
,
pageNum
-
1
,
list
)
// this.list[pageNum - 1] = list
console
.
log
(
this
.
list
)
this
.
flag
=
true
this
.
flag
=
true
this
.
total
=
total
this
.
total
=
total
}
catch
(
error
)
{
}
catch
(
error
)
{
uni
.
hideLoading
()
this
.
flag
=
true
this
.
flag
=
true
}
}
}
,
}
,
...
@@ -252,8 +331,8 @@ export default {
...
@@ -252,8 +331,8 @@ export default {
return
formattedTime
return
formattedTime
}
}
}
,
}
,
changeIndex
(
index
)
{
changeIndex
(
index
,
isType
=
false
)
{
if
(
this
.
dateIndex
==
index
)
return
if
(
this
.
dateIndex
==
index
&&
!
isType
)
return
this
.
flag
=
false
this
.
flag
=
false
this
.
nothing
=
false
this
.
nothing
=
false
this
.
total
=
0
this
.
total
=
0
...
@@ -265,6 +344,7 @@ export default {
...
@@ -265,6 +344,7 @@ export default {
}
,
}
,
pageonReachBottom
()
{
pageonReachBottom
()
{
let
{
pageNum
,
total
,
nothing
,
pageSize
}
=
this
let
{
pageNum
,
total
,
nothing
,
pageSize
}
=
this
console
.
log
(
pageNum
,
total
,
nothing
,
pageSize
)
if
(
!
nothing
)
nothing
=
'nothing'
if
(
!
nothing
)
nothing
=
'nothing'
if
(
Math
.
ceil
(
total
/
pageSize
)
>
pageNum
)
{
if
(
Math
.
ceil
(
total
/
pageSize
)
>
pageNum
)
{
this
.
pageNum
+=
1
this
.
pageNum
+=
1
...
@@ -288,7 +368,6 @@ export default {
...
@@ -288,7 +368,6 @@ export default {
}
else
{
}
else
{
return
'Invalid type'
;
return
'Invalid type'
;
}
}
return
{
return
{
startTime
:
dayjs
(
startTime
).
format
(
"YYYY-MM-DD"
)
+
' 00:00:00'
,
startTime
:
dayjs
(
startTime
).
format
(
"YYYY-MM-DD"
)
+
' 00:00:00'
,
endTime
:
dayjs
(
endTime
).
format
(
"YYYY-MM-DD"
)
+
' 23:59:59'
endTime
:
dayjs
(
endTime
).
format
(
"YYYY-MM-DD"
)
+
' 23:59:59'
...
@@ -297,7 +376,6 @@ export default {
...
@@ -297,7 +376,6 @@ export default {
}
}
}
}
<
/script
>
<
/script
>
<
style
scoped
lang
=
"scss"
>
<
style
scoped
lang
=
"scss"
>
@
font
-
face
{
@
font
-
face
{
font
-
family
:
"numberBold"
;
font
-
family
:
"numberBold"
;
...
@@ -308,19 +386,71 @@ export default {
...
@@ -308,19 +386,71 @@ export default {
height
:
100
%
;
height
:
100
%
;
.
record
-
content
{
.
record
-
content
{
padding
:
96
rpx
0
;
padding
:
96
rpx
0
;
.
data
-
container
{
background
:
#
ffffff
;
border
-
radius
:
48
rpx
;
margin
-
top
:
48
rpx
;
height
:
calc
(
100
vh
-
440
rpx
);
.
type
-
box
{
position
:
relative
;
display
:
flex
;
width
:
100
%
;
background
-
color
:
#
eef4fe
;
height
:
176
rpx
;
line
-
height
:
128
rpx
;
border
-
radius
:
48
rpx
48
rpx
0
0
;
z
-
index
:
0
;
.
tab
-
item
{
width
:
400
rpx
;
text
-
align
:
center
;
font
-
weight
:
500
;
font
-
size
:
40
rpx
;
color
:
#
1
f2133
;
.
text
{
position
:
relative
;
text
-
align
:
center
;
width
:
400
rpx
;
}
.
active
{
position
:
absolute
;
top
:
0
;
z
-
index
:
-
1
;
font
-
weight
:
700
;
font
-
size
:
40
rpx
;
color
:
#
2
c66f7
;
&
::
after
{
content
:
""
;
position
:
absolute
;
bottom
:
0
;
left
:
50
%
;
transform
:
translateX
(
-
50
%
);
width
:
48
rpx
;
height
:
8
rpx
;
background
-
color
:
#
2
c66f7
;
border
-
radius
:
16
rpx
;
}
}
}
}
}
}
.
record
-
list
{
height
:
calc
(
100
%
-
380
rpx
);
margin
-
top
:
24
rpx
;
}
}
.
list
{
.
list
{
display
:
flex
;
display
:
flex
;
flex
-
wrap
:
wrap
;
flex
-
wrap
:
wrap
;
gap
:
48
rpx
60
rpx
;
gap
:
48
rpx
60
rpx
;
padding
-
top
:
48
rpx
;
padding
:
0
rpx
64
rpx
20
rpx
;
.
item
{
.
item
{
width
:
6
40
rpx
;
width
:
6
08
rpx
;
background
:
#
ffffff
;
background
:
#
ffffff
;
border
-
radius
:
16
rpx
;
box
-
sizing
:
border
-
box
;
box
-
sizing
:
border
-
box
;
padding
:
24
rpx
32
rpx
;
padding
:
24
rpx
32
rpx
;
position
:
relative
;
position
:
relative
;
box
-
shadow
:
0
8
rpx
24
rpx
0
#
2
c66f71a
;
border
-
radius
:
16
rpx
;
.
status
{
.
status
{
position
:
absolute
;
position
:
absolute
;
top
:
24
rpx
;
top
:
24
rpx
;
...
@@ -421,7 +551,6 @@ export default {
...
@@ -421,7 +551,6 @@ export default {
font
-
family
:
"numberBold"
;
font
-
family
:
"numberBold"
;
font
-
size
:
48
rpx
;
font
-
size
:
48
rpx
;
font
-
weight
:
700
;
font
-
weight
:
700
;
margin
:
0
4
rpx
;
}
}
.
unit
{
.
unit
{
font
-
weight
:
500
;
font
-
weight
:
500
;
...
@@ -432,7 +561,6 @@ export default {
...
@@ -432,7 +561,6 @@ export default {
.
total
{
.
total
{
padding
-
left
:
96
rpx
;
padding
-
left
:
96
rpx
;
}
}
.
duration
{
.
duration
{
.
num
-
box
{
.
num
-
box
{
display
:
flex
;
display
:
flex
;
...
@@ -460,61 +588,64 @@ export default {
...
@@ -460,61 +588,64 @@ export default {
}
}
}
}
}
}
.
tabs
-
bottom
{
margin
-
top
:
-
45
rpx
;
background
:
#
fff
;
height
:
45
rpx
;
position
:
relative
;
z
-
index
:
3
;
}
.
data
-
tabs
-
box
{
.
data
-
tabs
-
box
{
position
:
relative
;
position
:
relative
;
top
:
0
;
top
:
0
;
z
-
index
:
3
;
z
-
index
:
3
;
width
:
calc
(
100
%
+
120
rpx
);
transform
:
translateX
(
-
60
rpx
);
padding
-
top
:
80
rpx
;
.
data
-
tabs
{
.
data
-
tabs
{
display
:
flex
;
display
:
flex
;
justify
-
content
:
space
-
between
;
justify
-
content
:
space
-
between
;
width
:
784
rpx
;
width
:
552
rpx
;
height
:
70
rpx
;
height
:
76
rpx
;
border
-
radius
:
370
rpx
;
background
-
color
:
#
f2f2f2
;
margin
:
0
auto
;
border
-
radius
:
16
rpx
;
margin
-
left
:
60
rpx
;
position
:
relative
;
position
:
relative
;
&
::
after
{
&
::
after
{
position
:
absolute
;
position
:
absolute
;
z
-
index
:
-
2
;
z
-
index
:
-
2
;
background
:
#
ffffff
b3
;
background
:
#
ffffff
;
width
:
100
%
;
width
:
100
%
;
height
:
100
%
;
height
:
100
%
;
border
-
radius
:
370
rpx
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
content
:
""
;
content
:
""
;
}
}
.
tab
{
.
tab
{
width
:
240
rpx
;
width
:
184
rpx
;
height
:
7
0
rpx
;
height
:
7
6
rpx
;
justify
-
content
:
center
;
justify
-
content
:
center
;
font
-
weight
:
500
;
font
-
weight
:
500
;
font
-
size
:
32
rpx
;
font
-
size
:
32
rpx
;
color
:
#
333333
;
color
:
#
1
f2133
;
z
-
index
:
10
;
}
}
.
active
{
.
active
{
color
:
#
ffffff
;
}
}
.
active
-
btn
{
.
active
-
btn
{
position
:
absolute
;
position
:
absolute
;
width
:
240
rpx
;
width
:
180
rpx
;
height
:
70
rpx
;
height
:
68
rpx
;
background
:
#
3
b73ff
;
background
:
#
ffffff
;
border
-
radius
:
360
rpx
;
top
:
4
rpx
;
top
:
0
;
z
-
index
:
-
1
;
transition
:
all
0.15
s
;
transition
:
all
0.15
s
;
border
-
radius
:
16
rpx
;
}
}
.
active
-
btn
-
0
{
.
active
-
btn
-
0
{
left
:
0
;
left
:
4
rpx
;
}
}
.
active
-
btn
-
1
{
.
active
-
btn
-
1
{
left
:
272
rpx
;
left
:
184
rpx
;
}
}
.
active
-
btn
-
2
{
.
active
-
btn
-
2
{
left
:
544
rpx
;
left
:
368
rpx
;
}
}
}
}
}
}
...
...
main.js
View file @
fb87ef7
...
@@ -24,6 +24,7 @@ Vue.component("UpdateBox", UpdateBox);
...
@@ -24,6 +24,7 @@ Vue.component("UpdateBox", UpdateBox);
uni
.
$api
=
api
;
uni
.
$api
=
api
;
uni
.
$storage
=
new
Storage
();
uni
.
$storage
=
new
Storage
();
uni
.
$throttle
=
utils
.
throttle
;
uni
.
$throttle
=
utils
.
throttle
;
uni
.
$isNetWork
=
utils
.
isNetWork
;
Vue
.
config
.
productionTip
=
false
;
Vue
.
config
.
productionTip
=
false
;
App
.
mpType
=
"app"
;
App
.
mpType
=
"app"
;
Vue
.
prototype
.
$ossDomain
=
config
.
OSS_DOMAIN
;
Vue
.
prototype
.
$ossDomain
=
config
.
OSS_DOMAIN
;
...
...
mixin/click.js
View file @
fb87ef7
...
@@ -77,11 +77,6 @@ export default {
...
@@ -77,11 +77,6 @@ export default {
this
.
times
=
0
;
this
.
times
=
0
;
this
.
$refs
.
tipBox
?.
close
();
this
.
$refs
.
tipBox
?.
close
();
},
},
//检查缓存录音
checkVoice
()
{
const
file
=
uni
.
$storage
.
get
(
"storageFile"
);
if
(
file
)
this
.
uploadVoice
(
file
);
},
getParams
()
{
getParams
()
{
const
{
shopMerchantId
,
phone
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
),
const
{
shopMerchantId
,
phone
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
),
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
...
@@ -112,60 +107,6 @@ export default {
...
@@ -112,60 +107,6 @@ export default {
};
};
return
params
;
return
params
;
},
},
//保存录音记录及其他信息
async
uploadVoice
(
tempFilePath
)
{
try
{
const
{
shopMerchantId
,
phone
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
),
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
this
.
$store
.
state
.
user
.
customerInfo
,
receptionCustomerPaySourceList
=
this
.
booksList
.
map
((
item
)
=>
{
return
{
id
:
item
.
id
,
sourceType
:
item
.
id
,
sourceUrl
:
item
.
imgUrl
,
};
}),
{
receptionStartTime
,
receptionEndTime
,
endReasonType
}
=
this
.
audioInfo
,
params
=
{
carModel
,
endReasonType
,
//原因 1.异常 0.正常
customerName
,
phoneNumber
,
loginPhone
:
phone
,
salesName
:
staffName
,
salesUuid
,
receptionStatus
:
this
.
receptionStatus
,
//接待结果 1.成交 0.战败
recordUrlList
:
tempFilePath
,
receptionStartTime
,
receptionEndTime
,
receptionCustomerPaySourceList
,
//1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId
:
shopMerchantId
,
bussinessType
:
sceneType
==
0
?
1
:
2
,
// sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
};
console
.
log
(
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
tempFilePath
);
if
(
customerName
&&
phoneNumber
&&
salesUuid
)
{
uni
.
$api
.
commonApi
.
saveRecCustomer
(
params
).
then
((
res
)
=>
{
console
.
log
(
res
,
params
);
});
}
this
.
setBooks
([]);
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
this
.
setReceptionStatus
(
1
);
this
.
setAudioInfo
({
endReasonType
:
0
,
audioStatus
:
"finish"
});
uni
.
$storage
.
set
(
"storageFile"
,
""
);
}
catch
(
error
)
{
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
console
.
log
(
error
);
}
},
//开始录音
//开始录音
async
startAudio
()
{
async
startAudio
()
{
if
(
this
.
audioInfo
.
audioStatus
==
"start"
)
return
;
if
(
this
.
audioInfo
.
audioStatus
==
"start"
)
return
;
...
@@ -194,41 +135,34 @@ export default {
...
@@ -194,41 +135,34 @@ export default {
});
});
return
;
return
;
}
}
// const isContinue = this.hasErrorFile();
const
saveResult
=
await
uni
.
saveFile
({
// if (isContinue) {
tempFilePath
:
res
.
tempFilePath
,
// this.handleErrorFile(res.tempFilePath);
});
// 保存文件到本地
// if (this.audioInfo.audioStatus == 'end') {
//删除默认文件
// this.saveRecord();
uni
.
removeSavedFile
({
// }
filePath
:
res
.
tempFilePath
,
// return;
complete
:
function
(
res
)
{
// }
console
.
log
(
res
);
const
result
=
await
this
.
checkUploadFile
(
res
.
tempFilePath
);
},
if
(
result
instanceof
Error
)
{
});
console
.
error
(
"上传失败:"
,
result
);
this
.
handleSave
(
saveResult
);
const
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
this
.
$store
.
state
.
user
.
customerInfo
;
const
{
name
}
=
uni
.
$storage
.
get
(
"userInfo"
);
this
.
$sendSentry
(
`重试多次失败:手机号-
${
phoneNumber
}
姓名-
${
customerName
}
销售-
${
staffName
}
车型-
${
carModel
}
员工-
${
name
}
,失败原因-
${
result
}
`
);
// this.handleErrorFile(res.tempFilePath, UPLOAD_STATUS.fail);
// return;
}
else
{
// this.handleErrorFile(result, UPLOAD_STATUS.success);
}
const
storageFile
=
[...
this
.
audioInfo
.
audioList
,
result
];
uni
.
$storage
.
set
(
"storageFile"
,
storageFile
);
this
.
setAudioInfo
({
audioList
:
storageFile
});
if
(
this
.
audioInfo
.
audioStatus
==
"start"
)
{
return
;
}
this
.
uploadVoice
(
storageFile
);
});
});
},
},
handleSave
(
file
)
{
if
(
this
.
audioInfo
.
audioStatus
==
"end"
)
{
this
.
saveRecord
();
this
.
setBooks
([]);
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
this
.
setReceptionStatus
(
1
);
this
.
setAudioInfo
({
endReasonType
:
0
,
audioStatus
:
"finish"
});
}
else
{
const
audioList
=
[...
this
.
audioInfo
.
audioList
,
file
];
this
.
setAudioInfo
({
audioList
});
}
},
/**保存记录*/
/**保存记录*/
saveRecord
()
{
saveRecord
()
{
const
recordUrlList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"errorFile"
)
||
"[]"
)
;
const
recordUrlList
=
this
.
audioInfo
.
audioList
;
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
recordList
=
[
recordList
=
[
...
recordList
,
...
recordList
,
...
@@ -239,67 +173,6 @@ export default {
...
@@ -239,67 +173,6 @@ export default {
];
];
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
},
},
/**是否存在错误文件*/
hasErrorFile
()
{
const
fileList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"errorFile"
)
||
"[]"
);
const
errorFileList
=
fileList
.
filter
(
(
item
)
=>
item
.
status
==
UPLOAD_STATUS
.
fail
);
return
errorFileList
.
length
>
0
;
},
/**处理失败的文件*/
handleErrorFile
(
file
,
status
)
{
const
errorFileList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"errorFile"
)
||
"[]"
);
const
errorFile
=
[...
errorFileList
,
{
file
,
status
}];
uni
.
$storage
.
set
(
"errorFile"
,
JSON
.
stringify
(
errorFile
));
},
/**上传记录*/
async
handleRerord
(
val
)
{
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
let
idx
=
recordList
.
findIndex
(
(
item
)
=>
item
.
receptionStartTime
==
val
.
receptionStartTime
);
let
recordUrlList
=
val
.
recordUrlList
;
// 上传失败的记录
for
(
let
i
of
recordUrlList
)
{
if
(
i
.
status
==
UPLOAD_STATUS
.
fail
)
{
const
result
=
await
this
.
checkUploadFile
(
i
.
file
);
if
(
!
(
result
instanceof
Error
))
{
i
.
status
=
UPLOAD_STATUS
.
success
;
}
}
}
// 判断是否全部上传成功
if
(
recordUrlList
.
every
((
i
)
=>
i
.
status
==
UPLOAD_STATUS
.
success
))
{
recordList
.
splice
(
idx
,
1
);
val
.
recordUrlList
=
val
.
recordUrlList
.
map
((
i
)
=>
i
.
file
);
this
.
uploadVoice
(
val
);
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
}
},
async
checkUploadFile
(
tempFilePath
)
{
let
attempt
=
0
;
let
errorMsg
=
""
;
while
(
attempt
<
5
)
{
try
{
const
result
=
await
upload
(
tempFilePath
);
// 上传成功
return
result
;
}
catch
(
error
)
{
if
(
attempt
==
0
)
{
this
.
$sendSentry
(
`第一次上传失败:文件
${
tempFilePath
}
`
);
}
errorMsg
=
error
;
attempt
++
;
// 等待一段时间后重试
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
3000
));
// 3秒后重试
}
}
// 达到最大尝试次数后,如果上传仍然失败,可以进行相应的处理
console
.
error
(
"上传失败,达到最大尝试次数"
);
// 返回一个错误或者进行其他操作
return
new
Error
(
errorMsg
);
},
//结束接待
//结束接待
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
// const result = await this.$permision.requestAndroidPermission(
// const result = await this.$permision.requestAndroidPermission(
...
@@ -322,12 +195,7 @@ export default {
...
@@ -322,12 +195,7 @@ export default {
if
(
!
status
)
{
if
(
!
status
)
{
uni
.
showLoading
({
uni
.
showLoading
({
mask
:
true
,
mask
:
true
,
title
:
"处理中请稍后..."
,
});
});
// setTimeout(() => {
// uni.hideLoading();
// clearInterval(finish_timer);
// }, 1000 * 60);
}
}
this
.
times
=
0
;
this
.
times
=
0
;
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
...
...
mixin/storge.js
0 → 100644
View file @
fb87ef7
const
UPLOAD_STATUS
=
{
// 上传状态
success
:
1
,
fail
:
2
,
};
import
upload
from
"@/utils/ossUploadFile/uploadFile.js"
;
import
utils
from
"@/utils/utils.js"
;
export
default
{
mounted
()
{
// this.checkRecord();
// setInterval(() => {
// this.checkRecord();
// }, 1000 * 60 * 10);
},
methods
:
{
checkRecord
()
{
utils
.
isNetWork
().
then
(
async
(
res
)
=>
{
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
console
.
log
(
recordList
,
"recordList"
);
for
(
let
i
=
0
;
i
<
recordList
.
length
;
i
++
)
{
await
this
.
handleRerord
(
recordList
[
i
]);
}
});
},
/**上传记录*/
async
handleRerord
(
val
)
{
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
let
idx
=
recordList
.
findIndex
(
(
item
)
=>
item
.
receptionStartTime
==
val
.
receptionStartTime
);
let
recordUrlList
=
val
.
recordUrlList
;
// 上传失败的记录
for
(
let
i
of
recordUrlList
)
{
if
(
i
.
status
==
UPLOAD_STATUS
.
fail
)
{
const
filePath
=
i
.
file
;
console
.
log
(
filePath
,
"filePath"
);
const
result
=
await
this
.
checkFileUpload
(
filePath
);
if
(
!
(
result
instanceof
Error
))
{
i
.
status
=
UPLOAD_STATUS
.
success
;
i
.
file
=
result
;
}
}
}
// 判断是否全部上传成功
if
(
recordUrlList
.
every
((
i
)
=>
i
.
status
==
UPLOAD_STATUS
.
success
))
{
val
.
recordUrlList
=
val
.
recordUrlList
.
map
((
i
)
=>
i
.
file
);
try
{
const
res
=
await
uni
.
$api
.
commonApi
.
saveRecCustomer
(
val
);
console
.
log
(
res
,
val
);
recordList
.
splice
(
idx
,
1
);
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
}
catch
(
err
)
{
Promise
.
reject
(
error
);
}
}
},
async
checkFileUpload
(
tempFilePath
)
{
console
.
log
(
tempFilePath
);
let
attempt
=
0
;
let
errorMsg
=
""
;
while
(
attempt
<
2
)
{
try
{
const
result
=
await
upload
(
tempFilePath
);
// 上传成功
return
result
;
}
catch
(
error
)
{
errorMsg
=
error
;
attempt
++
;
// 等待一段时间后重试
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
3000
));
// 3秒后重试
}
}
// 达到最大尝试次数后,如果上传仍然失败,可以进行相应的处理
console
.
error
(
"上传失败,达到最大尝试次数"
);
// 返回一个错误或者进行其他操作
return
new
Error
(
errorMsg
);
},
},
};
utils/cache/constantData.js
View file @
fb87ef7
...
@@ -16,8 +16,9 @@ export const STORAGE_OBJECTkEY = {
...
@@ -16,8 +16,9 @@ export const STORAGE_OBJECTkEY = {
noSignInUuid
:
"noSignInUuid"
,
noSignInUuid
:
"noSignInUuid"
,
noviceGuideStatus
:
"noviceGuideStatus"
,
noviceGuideStatus
:
"noviceGuideStatus"
,
accountLength
:
"accountLength"
,
accountLength
:
"accountLength"
,
carBrandList
:
'carBrandList'
,
carBrandList
:
"carBrandList"
,
employeeList
:
'employeeList'
employeeList
:
"employeeList"
,
recordList
:
"recordList"
,
};
};
// export const IMG_VERSION = async () => {
// export const IMG_VERSION = async () => {
...
...
utils/utils.js
View file @
fb87ef7
...
@@ -76,10 +76,25 @@ var throttle = function (fn, delay) {
...
@@ -76,10 +76,25 @@ var throttle = function (fn, delay) {
},
delay
);
},
delay
);
};
};
};
};
//检查是否有网络
var
isNetWork
=
function
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getNetworkType
({
complete
:
function
(
res
)
{
if
(
res
.
networkType
==
"none"
)
{
reject
();
}
else
{
resolve
();
}
},
});
});
};
export
default
{
export
default
{
convertDateTimeFormat
,
convertDateTimeFormat
,
deepClone
,
deepClone
,
accDiv
,
accDiv
,
debounce
,
debounce
,
throttle
,
throttle
,
isNetWork
,
};
};
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