Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
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 6f500de2
authored
Oct 28, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
申请页面跳转
1 parent
2b15bc04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
263 additions
and
255 deletions
pages/scene/scene.js
pages/scene/scene.js
View file @
6f500de
const
navStyle
=
'background-color: transparent;'
const
navStyle
=
"background-color: transparent;"
;
import
util
from
"../../utils/util"
;
import
util
from
"../../utils/util"
;
// import { IMG_URL } from '~/utils/constantData.js'
// import { IMG_URL } from '~/utils/constantData.js'
// wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
// wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
import
{
senceData
}
from
'./constant/data'
import
{
senceData
}
from
"./constant/data"
;
// `${IMG_URL}index/car2.png`,
// `${IMG_URL}index/car2.png`,
//本地图片路径
//本地图片路径
let
IMG_URLLocal
=
'../../../images/'
let
IMG_URLLocal
=
"../../../images/"
;
// import { productBysceneApi, unreadApi, pageApi, readApi, tagApi } from '~/api/index.js'
// import { productBysceneApi, unreadApi, pageApi, readApi, tagApi } from '~/api/index.js'
let
IMG_URL
=
wx
.
$imgUrl
let
IMG_URL
=
wx
.
$imgUrl
;
Page
({
Page
({
// behaviors: [kfMixin],
// behaviors: [kfMixin],
/**
/**
...
@@ -19,61 +19,62 @@ Page({
...
@@ -19,61 +19,62 @@ Page({
// IMGURL: wx.$imgUrl,
// IMGURL: wx.$imgUrl,
IMG_URL
,
IMG_URL
,
// IMG_URLLocal,
// IMG_URLLocal,
actClass
:
'right'
,
actClass
:
"right"
,
guideSrcIndex
:
1
,
guideSrcIndex
:
1
,
guideShow
:
false
,
guideShow
:
false
,
dataArr
:
[
dataArr
:
[
{
{
src
:
`
${
IMG_URL
}
index/car1.png`
,
src
:
`
${
IMG_URL
}
index/car1.png`
,
name
:
'新车洽谈场景'
,
name
:
"新车洽谈场景"
,
msg
:
'1.0 新车权益销售'
msg
:
"1.0 新车权益销售"
,
},
},
{
{
src
:
`
${
IMG_URL
}
index/car2.png`
,
src
:
`
${
IMG_URL
}
index/car2.png`
,
name
:
'新车交付场景'
,
name
:
"新车交付场景"
,
msg
:
'1.1 新车精品升级'
msg
:
"1.1 新车精品升级"
,
},
},
{
{
src
:
`
${
IMG_URL
}
index/car3.png`
,
src
:
`
${
IMG_URL
}
index/car3.png`
,
name
:
'0-12个月'
,
name
:
"0-12个月"
,
msg
:
'1.2 新车线上转化'
msg
:
"1.2 新车线上转化"
,
},
},
{
{
src
:
`
${
IMG_URL
}
index/car4.png`
,
src
:
`
${
IMG_URL
}
index/car4.png`
,
name
:
'12个月以上'
,
name
:
"12个月以上"
,
msg
:
'1.3 存量用户众筹'
msg
:
"1.3 存量用户众筹"
,
}
}
,
],
],
apiData
:
[],
apiData
:
[],
actNum
:
3
,
//car 场景选择
actNum
:
3
,
//car 场景选择
wrapactiveNavIdx
:
0
,
// 产品选择
tabIndx
:
1
,
tabIndx
:
1
,
navList
:
[
'看线索'
,
'看产品'
],
navList
:
[
"看线索"
,
"看产品"
],
typeList
:
[
typeList
:
[
{
{
0
:
'无电话'
,
0
:
"无电话"
,
1
:
'有电话'
,
1
:
"有电话"
,
2
:
'联系电话'
,
2
:
"联系电话"
,
selectIndex
:
2
,
selectIndex
:
2
,
key
:
'hasPhone'
key
:
"hasPhone"
,
},
},
{
{
0
:
'非意向客户'
,
0
:
"非意向客户"
,
1
:
'是意向客户'
,
1
:
"是意向客户"
,
2
:
'意向客户'
,
2
:
"意向客户"
,
selectIndex
:
2
,
selectIndex
:
2
,
key
:
'starTag'
key
:
"starTag"
,
},
},
{
{
0
:
'来自访客'
,
0
:
"来自访客"
,
1
:
'来自门店'
,
1
:
"来自门店"
,
2
:
'线索来源'
,
2
:
"线索来源"
,
selectIndex
:
2
,
selectIndex
:
2
,
key
:
'clueSource'
key
:
"clueSource"
,
},
},
{
{
2
:
'重置'
,
2
:
"重置"
,
selectIndex
:
2
selectIndex
:
2
,
}
}
,
],
],
clueList
:
[],
clueList
:
[],
// 预估弹框
// 预估弹框
...
@@ -81,11 +82,11 @@ Page({
...
@@ -81,11 +82,11 @@ Page({
isReset
:
false
,
isReset
:
false
,
formData
:
{
formData
:
{
sales
:
100
,
sales
:
100
,
flow
:
10000
flow
:
10000
,
},
},
lastFormData
:
{
lastFormData
:
{
sales
:
100
,
sales
:
100
,
flow
:
10000
flow
:
10000
,
},
},
isFirst
:
true
,
isFirst
:
true
,
// tabList: pageData.tabList,
// tabList: pageData.tabList,
...
@@ -96,30 +97,30 @@ Page({
...
@@ -96,30 +97,30 @@ Page({
unreadClueCount
:
0
,
unreadClueCount
:
0
,
cluePageSize
:
10
,
cluePageSize
:
10
,
clueCurrentPage
:
1
,
clueCurrentPage
:
1
,
hasPhoneNumber
:
false
hasPhoneNumber
:
false
,
},
},
//引导图
//引导图
guideFn
()
{
guideFn
()
{
if
(
this
.
data
.
guideSrcIndex
===
5
)
{
if
(
this
.
data
.
guideSrcIndex
===
5
)
{
this
.
setData
({
this
.
setData
({
guideShow
:
false
guideShow
:
false
,
})
})
;
return
return
;
}
}
this
.
setData
({
this
.
setData
({
guideSrcIndex
:
++
this
.
data
.
guideSrcIndex
guideSrcIndex
:
++
this
.
data
.
guideSrcIndex
,
})
})
;
// console.log('guideSrcIndex',this.data.guideSrcIndex)
// console.log('guideSrcIndex',this.data.guideSrcIndex)
},
},
// navbar高度设置
// navbar高度设置
navbarReady
(
e
)
{
navbarReady
(
e
)
{
let
{
height
,
statusBarHeight
}
=
e
.
detail
let
{
height
,
statusBarHeight
}
=
e
.
detail
;
this
.
setData
({
this
.
setData
({
// tabBarStyle: height / 2 + statusBarHeight,
// tabBarStyle: height / 2 + statusBarHeight,
headerHeight
:
height
/
2
+
statusBarHeight
+
88
,
headerHeight
:
height
/
2
+
statusBarHeight
+
88
,
// headerHeight: height / 2 + statusBarHeight + 88 * 2
// headerHeight: height / 2 + statusBarHeight + 88 * 2
})
})
;
// console.log(e)
// console.log(e)
// console.log(this.data.headerHeight)
// console.log(this.data.headerHeight)
},
},
...
@@ -132,56 +133,56 @@ Page({
...
@@ -132,56 +133,56 @@ Page({
// },
// },
// 选车场景切换
// 选车场景切换
selectCar
(
e
)
{
selectCar
(
e
)
{
console
.
log
(
'e: '
,
e
)
console
.
log
(
"e: "
,
e
);
let
{
num
,
scenestatus
}
=
e
.
currentTarget
.
dataset
let
{
num
,
scenestatus
}
=
e
.
currentTarget
.
dataset
;
// console.log('actNum: ', actNum);
// console.log('actNum: ', actNum);
// if(scenestatus == 1){
// if(scenestatus == 1){
// }
// }
this
.
setData
({
this
.
setData
({
actNum
:
num
actNum
:
num
,
})
})
;
},
},
// 头部看线索,产品切换
// 头部看线索,产品切换
changeTabIndx
(
e
)
{
changeTabIndx
(
e
)
{
console
.
log
(
'e.detail: '
,
e
.
detail
)
console
.
log
(
"e.detail: "
,
e
.
detail
);
let
{
sessionId
}
=
wx
.
$storage
.
get
()
let
{
sessionId
}
=
wx
.
$storage
.
get
()
;
// console.log("sessionId: ", sessionId);
// console.log("sessionId: ", sessionId);
let
param
=
{
let
param
=
{
sessionId
sessionId
,
}
}
;
let
first
=
true
let
first
=
true
;
this
.
setData
({
this
.
setData
({
tabIndx
:
e
.
detail
tabIndx
:
e
.
detail
,
})
})
;
//标记线索已读
//标记线索已读
if
(
e
.
detail
==
0
&&
first
)
{
if
(
e
.
detail
==
0
&&
first
)
{
first
=
false
first
=
false
;
readApi
(
param
)
readApi
(
param
)
;
}
}
},
},
gotoApply
(
e
)
{
gotoApply
(
e
)
{
let
{
type
,
item
}
=
e
.
currentTarget
.
dataset
let
{
type
,
item
}
=
e
.
currentTarget
.
dataset
;
// let { } = e.currentTarget.dataset
// let { } = e.currentTarget.dataset
if
(
type
==
'active'
)
{
if
(
type
==
"active"
)
{
let
{
userInfo
}
=
wx
.
$storage
.
get
()
let
{
userInfo
}
=
wx
.
$storage
.
get
()
;
let
pMerchantName
=
userInfo
.
subLoginUser
.
merchantName
let
pMerchantName
=
userInfo
.
subLoginUser
.
merchantName
;
let
pMerchantId
=
userInfo
.
subLoginUser
.
merchantId
let
pMerchantId
=
userInfo
.
subLoginUser
.
merchantId
;
let
sceneActive
let
sceneActive
;
switch
(
this
.
data
.
actNum
)
{
switch
(
this
.
data
.
actNum
)
{
case
0
:
case
0
:
sceneActive
=
1
sceneActive
=
1
;
break
break
;
case
1
:
case
1
:
sceneActive
=
2
sceneActive
=
2
;
break
break
;
case
2
:
case
2
:
sceneActive
=
3
sceneActive
=
3
;
break
break
;
case
3
:
case
3
:
sceneActive
=
4
sceneActive
=
4
;
break
break
;
}
}
// let pMerchantId = userInfo.subLoginUser.merchantId
// let pMerchantId = userInfo.subLoginUser.merchantId
...
@@ -191,86 +192,86 @@ Page({
...
@@ -191,86 +192,86 @@ Page({
pMerchantId
,
pMerchantId
,
pMerchantName
,
pMerchantName
,
merchantId
:
item
.
visitList
[
0
].
merchantId
,
merchantId
:
item
.
visitList
[
0
].
merchantId
,
merchantName
:
item
.
visitList
[
0
].
merchantName
merchantName
:
item
.
visitList
[
0
].
merchantName
,
},
},
sceneActive
sceneActive
,
// sceneCodeList: ['SC001', 'SC002','SC003','SC004']
// sceneCodeList: ['SC001', 'SC002','SC003','SC004']
}
}
;
//申请活动
//申请活动
wx
.
$router
.
go
(
'packageOutput.openBusiness'
,
params
)
wx
.
$router
.
go
(
"packageOutput.openBusiness"
,
params
);
}
else
{
}
else
{
//申请门店
//申请门店
// let { type, item } = e.currentTarget.dataset
// let { type, item } = e.currentTarget.dataset
wx
.
$router
.
go
(
'apply'
,
item
?.
clueId
||
''
)
wx
.
$router
.
go
(
"apply"
,
item
?.
clueId
||
""
);
}
}
// wx.$router.go('apply',1235)
// wx.$router.go('apply',1235)
},
},
getMore
(
e
)
{
getMore
(
e
)
{
console
.
log
(
'显示更多数据'
)
console
.
log
(
"显示更多数据"
);
let
index
=
e
.
currentTarget
.
dataset
.
outidx
let
index
=
e
.
currentTarget
.
dataset
.
outidx
;
console
.
log
(
'index: '
,
index
)
console
.
log
(
"index: "
,
index
);
let
completeStatus
=
`clueList[
${
index
}
].getMoreFlag`
let
completeStatus
=
`clueList[
${
index
}
].getMoreFlag`
;
this
.
setData
({
this
.
setData
({
[
completeStatus
]:
!
this
.
data
.
clueList
[
index
].
getMoreFlag
[
completeStatus
]:
!
this
.
data
.
clueList
[
index
].
getMoreFlag
,
})
})
;
},
},
// 跳转咨询页面
// 跳转咨询页面
goConsult
()
{
goConsult
()
{
console
.
log
(
'跳转到咨询页面'
)
console
.
log
(
"跳转到咨询页面"
);
wx
.
pro
.
openCustomerServiceChat
({
wx
.
pro
.
openCustomerServiceChat
({
extInfo
:
{
url
:
'https://work.weixin.qq.com/kfid/kfcf7b721472201345e'
},
extInfo
:
{
url
:
"https://work.weixin.qq.com/kfid/kfcf7b721472201345e"
},
corpId
:
'ww047bdc0f1e76cc13'
,
corpId
:
"ww047bdc0f1e76cc13"
,
complete
:
r
=>
{
complete
:
(
r
)
=>
{
console
.
log
(
r
)
console
.
log
(
r
)
;
}
}
,
})
})
;
},
},
// 预估弹框
// 预估弹框
showCalculate
()
{
showCalculate
()
{
this
.
setData
({
this
.
setData
({
visible
:
!
this
.
data
.
visible
,
visible
:
!
this
.
data
.
visible
,
isReset
:
false
isReset
:
false
,
})
})
;
},
},
clickDialog
(
e
)
{
clickDialog
(
e
)
{
console
.
log
(
e
.
changedTouches
[
0
].
clientY
)
console
.
log
(
e
.
changedTouches
[
0
].
clientY
)
;
if
(
e
.
changedTouches
[
0
].
clientY
<
471
)
{
if
(
e
.
changedTouches
[
0
].
clientY
<
471
)
{
this
.
setData
({
this
.
setData
({
visible
:
false
,
visible
:
false
,
isReset
:
false
,
isReset
:
false
,
formData
:
this
.
data
.
lastFormData
formData
:
this
.
data
.
lastFormData
,
})
})
;
}
}
},
},
// 提交测算
// 提交测算
submit
(
e
)
{
submit
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
;
let
sales
=
e
?
+
e
.
detail
.
value
.
sales
:
this
.
data
.
formData
.
sales
let
sales
=
e
?
+
e
.
detail
.
value
.
sales
:
this
.
data
.
formData
.
sales
;
let
flow
=
e
?
+
e
.
detail
.
value
.
flow
:
this
.
data
.
formData
.
flow
let
flow
=
e
?
+
e
.
detail
.
value
.
flow
:
this
.
data
.
formData
.
flow
;
console
.
log
(
'flow'
,
sales
,
flow
)
console
.
log
(
"flow"
,
sales
,
flow
);
const
reg
=
/^
[
1-9
]\d
*$/
const
reg
=
/^
[
1-9
]\d
*$/
;
console
.
log
(
reg
.
test
(
sales
),
flow
,
'---'
)
console
.
log
(
reg
.
test
(
sales
),
flow
,
"---"
);
if
(
!
reg
.
test
(
sales
))
{
if
(
!
reg
.
test
(
sales
))
{
wx
.
showToast
({
wx
.
showToast
({
title
:
'门店月平均新车销量应为正整数'
,
title
:
"门店月平均新车销量应为正整数"
,
icon
:
'none'
,
icon
:
"none"
,
duration
:
2000
duration
:
2000
,
})
})
;
return
return
;
}
}
if
(
!
reg
.
test
(
flow
))
{
if
(
!
reg
.
test
(
flow
))
{
wx
.
showToast
({
wx
.
showToast
({
title
:
'3年内售后存量用户应为正整数'
,
title
:
"3年内售后存量用户应为正整数"
,
icon
:
'none'
,
icon
:
"none"
,
duration
:
2000
duration
:
2000
,
})
})
;
return
return
;
}
}
this
.
setData
({
this
.
setData
({
'lastFormData.sales'
:
sales
,
"lastFormData.sales"
:
sales
,
'lastFormData.flow'
:
flow
"lastFormData.flow"
:
flow
,
})
})
;
const
_this
=
this
const
_this
=
this
;
// this.data.tabList.forEach((item, index) => {
// this.data.tabList.forEach((item, index) => {
// item.productList.forEach((i, lastIndex) => {
// item.productList.forEach((i, lastIndex) => {
// if (i.profit) {
// if (i.profit) {
...
@@ -287,19 +288,19 @@ Page({
...
@@ -287,19 +288,19 @@ Page({
this
.
data
.
senceData
.
forEach
((
item
,
index
)
=>
{
this
.
data
.
senceData
.
forEach
((
item
,
index
)
=>
{
item
.
productList
.
forEach
((
i
,
lastIndex
)
=>
{
item
.
productList
.
forEach
((
i
,
lastIndex
)
=>
{
if
(
i
.
profit
)
{
if
(
i
.
profit
)
{
let
sale
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].sale`
let
sale
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].sale`
;
let
name
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].profit`
let
name
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].profit`
;
let
flowKey
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].flow`
let
flowKey
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].flow`
;
let
profit
=
_this
.
formula
(
i
.
productType
,
sales
,
flow
)
let
profit
=
_this
.
formula
(
i
.
productType
,
sales
,
flow
)
;
console
.
log
(
name
,
profit
)
console
.
log
(
name
,
profit
)
;
this
.
setData
({
this
.
setData
({
[
name
]:
profit
,
[
name
]:
profit
,
[
sale
]:
sales
,
[
sale
]:
sales
,
[
flowKey
]:
flow
[
flowKey
]:
flow
,
})
})
;
}
}
})
})
;
})
})
;
// 触发自定义事件 利润 数量
// 触发自定义事件 利润 数量
// this.triggerEvent('countProfit', profit, sales)
// this.triggerEvent('countProfit', profit, sales)
...
@@ -309,15 +310,15 @@ Page({
...
@@ -309,15 +310,15 @@ Page({
// console.log('profit: ', profit);
// console.log('profit: ', profit);
this
.
setData
({
this
.
setData
({
visible
:
false
visible
:
false
,
})
})
;
// this.showCase();
// this.showCase();
// if (!this.data.isFirst) {
// if (!this.data.isFirst) {
wx
.
showToast
({
wx
.
showToast
({
title
:
'测算结果已在页面内同步展示'
,
title
:
"测算结果已在页面内同步展示"
,
icon
:
'none'
,
icon
:
"none"
,
duration
:
2000
duration
:
2000
,
})
})
;
// } else {
// } else {
// this.setData({
// this.setData({
// isFirst: false
// isFirst: false
...
@@ -336,51 +337,51 @@ Page({
...
@@ -336,51 +337,51 @@ Page({
// },
// },
// 计算公式,参数:productType
// 计算公式,参数:productType
formula
(
productType
,
sales
,
flow
)
{
formula
(
productType
,
sales
,
flow
)
{
let
profit
=
0
let
profit
=
0
;
switch
(
productType
)
{
switch
(
productType
)
{
case
'benefitCard'
:
case
"benefitCard"
:
// 数字无忧权益卡
// 数字无忧权益卡
profit
=
(
sales
*
0.5
*
2000
*
12
).
toFixed
(
0
)
profit
=
(
sales
*
0.5
*
2000
*
12
).
toFixed
(
0
)
;
break
break
;
case
'sunMembrane'
:
case
"sunMembrane"
:
// 汽车太阳膜
// 汽车太阳膜
profit
=
(
sales
*
0.8
*
0.7
*
1500
*
12
).
toFixed
(
0
)
profit
=
(
sales
*
0.8
*
0.7
*
1500
*
12
).
toFixed
(
0
)
;
break
break
;
case
'protectMembrane'
:
case
"protectMembrane"
:
// 漆面保护膜
// 漆面保护膜
profit
=
(
sales
*
0.05
*
3000
*
12
).
toFixed
(
0
)
profit
=
(
sales
*
0.05
*
3000
*
12
).
toFixed
(
0
)
;
break
break
;
case
'colorMembrane'
:
case
"colorMembrane"
:
// 改色膜
// 改色膜
profit
=
(
sales
*
0.05
*
5000
*
12
).
toFixed
(
0
)
profit
=
(
sales
*
0.05
*
5000
*
12
).
toFixed
(
0
)
;
break
break
;
case
'digitBeauty'
:
case
"digitBeauty"
:
// 数字化美容
// 数字化美容
profit
=
(
sales
*
0.2
*
300
*
12
).
toFixed
(
0
)
profit
=
(
sales
*
0.2
*
300
*
12
).
toFixed
(
0
)
;
break
break
;
case
'chair'
:
case
"chair"
:
// 座椅通风
// 座椅通风
profit
=
(
flow
*
2580
*
0.9
*
0.01
).
toFixed
(
0
)
profit
=
(
flow
*
2580
*
0.9
*
0.01
).
toFixed
(
0
)
;
break
break
;
case
'ar'
:
case
"ar"
:
// AR导航
// AR导航
profit
=
(
flow
*
1680
*
0.9
*
0.015
).
toFixed
(
0
)
profit
=
(
flow
*
1680
*
0.9
*
0.015
).
toFixed
(
0
)
;
break
break
;
case
'lamp'
:
case
"lamp"
:
// 氛围灯
// 氛围灯
profit
=
(
flow
*
2680
*
0.9
*
0.015
).
toFixed
(
0
)
profit
=
(
flow
*
2680
*
0.9
*
0.015
).
toFixed
(
0
)
;
break
break
;
case
'navigation'
:
case
"navigation"
:
// 360全景导航
// 360全景导航
profit
=
(
flow
*
2880
*
0.9
*
0.015
).
toFixed
(
0
)
profit
=
(
flow
*
2880
*
0.9
*
0.015
).
toFixed
(
0
)
;
break
break
;
}
}
console
.
log
(
profit
.
length
)
console
.
log
(
profit
.
length
)
;
console
.
log
(
productType
,
sales
,
flow
,
profit
)
console
.
log
(
productType
,
sales
,
flow
,
profit
)
;
if
(
profit
.
length
>
9
)
{
if
(
profit
.
length
>
9
)
{
return
(
profit
/
10000
).
toFixed
(
0
)
+
'万'
return
(
profit
/
10000
).
toFixed
(
0
)
+
"万"
;
}
else
{
}
else
{
return
profit
return
profit
;
}
}
},
},
reset
()
{
reset
()
{
...
@@ -388,15 +389,15 @@ Page({
...
@@ -388,15 +389,15 @@ Page({
isReset
:
false
,
isReset
:
false
,
formData
:
{
formData
:
{
sales
:
100
,
sales
:
100
,
flow
:
10000
flow
:
10000
,
}
}
,
})
})
;
},
},
focus
()
{
focus
()
{
this
.
setData
({
this
.
setData
({
isReset
:
true
isReset
:
true
,
})
})
;
return
false
return
false
;
},
},
// 更新手机号
// 更新手机号
updatePhoneNumber
(
e
)
{
updatePhoneNumber
(
e
)
{
...
@@ -418,7 +419,7 @@ Page({
...
@@ -418,7 +419,7 @@ Page({
// sessionId
// sessionId
// }
// }
// 看产品
// 看产品
this
.
compositionData
(
senceData
,
[])
this
.
compositionData
(
senceData
,
[])
;
// productBysceneApi(param).then(res => {
// productBysceneApi(param).then(res => {
// let { code, data } = res
// let { code, data } = res
...
@@ -434,47 +435,54 @@ Page({
...
@@ -434,47 +435,54 @@ Page({
// this.getClueInit()
// this.getClueInit()
//第一次进来储缓存,以后不再用引导图
//第一次进来储缓存,以后不再用引导图
let
firstLogin
=
wx
.
$storage
.
get
(
'firstLogin'
)
let
firstLogin
=
wx
.
$storage
.
get
(
"firstLogin"
);
if
(
!
firstLogin
)
{
if
(
!
firstLogin
)
{
this
.
setData
({
this
.
setData
({
guideShow
:
true
guideShow
:
true
,
})
})
;
wx
.
$storage
.
set
(
'firstLogin'
,
'firstLogin'
)
wx
.
$storage
.
set
(
"firstLogin"
,
"firstLogin"
);
}
}
if
(
util
.
getUserInfo
().
phone
)
{
if
(
util
.
getUserInfo
().
phone
)
{
this
.
setData
({
this
.
setData
({
hasPhoneNumber
:
true
hasPhoneNumber
:
true
,
})
})
;
}
}
},
},
onRoute
(
options
)
{
console
.
log
(
options
,
"options"
);
this
.
setData
({
actNum
:
options
.
actNum
,
wrapactiveNavIdx
:
options
.
activeNavIdx
,
});
},
//接口数据,本地数据对接
//接口数据,本地数据对接
compositionData
(
localData
,
apiData
)
{
compositionData
(
localData
,
apiData
)
{
localData
.
forEach
((
item
,
index
)
=>
{
localData
.
forEach
((
item
,
index
)
=>
{
apiData
.
forEach
((
inner
,
idx
)
=>
{
apiData
.
forEach
((
inner
,
idx
)
=>
{
if
(
item
.
name
==
inner
.
stage
)
{
if
(
item
.
name
==
inner
.
stage
)
{
item
.
sceneStatus
=
inner
.
sceneStatus
item
.
sceneStatus
=
inner
.
sceneStatus
;
item
.
productList
.
forEach
((
outChild
,
outIndex
)
=>
{
item
.
productList
.
forEach
((
outChild
,
outIndex
)
=>
{
inner
.
productList
.
forEach
((
innerChild
,
innerIndex
)
=>
{
inner
.
productList
.
forEach
((
innerChild
,
innerIndex
)
=>
{
if
(
outChild
.
proName
==
innerChild
.
productName
)
{
if
(
outChild
.
proName
==
innerChild
.
productName
)
{
outChild
.
productStatus
=
innerChild
.
productStatus
outChild
.
productStatus
=
innerChild
.
productStatus
;
}
}
})
})
;
})
})
;
}
}
})
})
;
})
})
;
// console.log('localData, apiData: ', localData);
// console.log('localData, apiData: ', localData);
this
.
setData
({
this
.
setData
({
senceData
:
localData
senceData
:
localData
,
})
})
;
},
},
getFirstSenceIndex
(
param
)
{
getFirstSenceIndex
(
param
)
{
let
actTndex
=
this
.
data
.
apiData
.
findIndex
(
item
=>
item
.
sceneStatus
==
1
)
let
actTndex
=
this
.
data
.
apiData
.
findIndex
(
(
item
)
=>
item
.
sceneStatus
==
1
);
// console.log('actTndex: ', actTndex);
// console.log('actTndex: ', actTndex);
this
.
setData
({
this
.
setData
({
actNum
:
actTndex
actNum
:
actTndex
,
})
})
;
},
},
// 看线索相关
// 看线索相关
...
@@ -482,50 +490,50 @@ Page({
...
@@ -482,50 +490,50 @@ Page({
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
onReady
:
function
()
{
onReady
:
function
()
{
this
.
prompt
=
this
.
selectComponent
(
'#toast'
)
this
.
prompt
=
this
.
selectComponent
(
"#toast"
);
},
},
showToast
:
function
(
e
)
{
showToast
:
function
(
e
)
{
let
{
type
,
item
}
=
e
.
currentTarget
.
dataset
let
{
type
,
item
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
'type,item: '
,
type
,
item
)
console
.
log
(
"type,item: "
,
type
,
item
);
let
tipObj
=
{}
let
tipObj
=
{}
;
if
(
item
.
starTag
==
1
)
{
if
(
item
.
starTag
==
1
)
{
tipObj
=
{
tipObj
=
{
type
:
'fail'
,
type
:
"fail"
,
title
:
'取消标记为意向客户'
title
:
"取消标记为意向客户"
,
}
}
;
}
else
{
}
else
{
tipObj
=
{
tipObj
=
{
type
:
'success'
,
type
:
"success"
,
title
:
'成功标记为意向客户'
title
:
"成功标记为意向客户"
,
}
}
;
}
}
this
.
prompt
.
showToast
({
this
.
prompt
.
showToast
({
type
:
tipObj
.
type
,
type
:
tipObj
.
type
,
title
:
tipObj
.
title
,
title
:
tipObj
.
title
,
duration
:
1000
,
duration
:
1000
,
compelete
:
function
()
{
compelete
:
function
()
{
console
.
log
(
'toast框隐藏之后,会调用该函数'
)
console
.
log
(
"toast框隐藏之后,会调用该函数"
);
//例如:跳转页面wx.navigateTo({ url: 'xxx' });
//例如:跳转页面wx.navigateTo({ url: 'xxx' });
}
}
,
})
})
;
//切换收藏标记
//切换收藏标记
let
index
=
e
.
currentTarget
.
dataset
.
outidx
let
index
=
e
.
currentTarget
.
dataset
.
outidx
;
let
completeStatus
=
`clueList[
${
index
}
].like`
let
completeStatus
=
`clueList[
${
index
}
].like`
;
this
.
setData
({
this
.
setData
({
[
completeStatus
]:
!
this
.
data
.
clueList
[
index
].
like
[
completeStatus
]:
!
this
.
data
.
clueList
[
index
].
like
,
})
})
;
//发请求
//发请求
let
{
sessionId
}
=
wx
.
$storage
.
get
()
let
{
sessionId
}
=
wx
.
$storage
.
get
()
;
let
params
=
{
let
params
=
{
clueId
:
item
.
clueId
,
clueId
:
item
.
clueId
,
sessionId
sessionId
,
}
}
;
this
.
getTagApi
(
params
)
this
.
getTagApi
(
params
)
;
},
},
filterTypeFn
(
e
)
{
filterTypeFn
(
e
)
{
let
{
typeList
}
=
this
.
data
let
{
typeList
}
=
this
.
data
;
let
index
=
e
.
currentTarget
.
dataset
.
index
let
index
=
e
.
currentTarget
.
dataset
.
index
;
// console.log('index: ', index);
// console.log('index: ', index);
// let itemList = []
// let itemList = []
// let params = {
// let params = {
...
@@ -536,41 +544,41 @@ Page({
...
@@ -536,41 +544,41 @@ Page({
// console.log('index: ', index)
// console.log('index: ', index)
// 重置筛选
// 重置筛选
if
(
index
==
3
)
{
if
(
index
==
3
)
{
typeList
.
forEach
(
item
=>
{
typeList
.
forEach
(
(
item
)
=>
{
item
.
selectIndex
=
2
item
.
selectIndex
=
2
;
})
})
;
this
.
setData
({
this
.
setData
({
typeList
typeList
,
})
})
;
return
this
.
getPageApi
()
return
this
.
getPageApi
()
;
}
}
let
itemList
=
Object
.
values
(
typeList
[
index
]).
slice
(
0
,
2
)
let
itemList
=
Object
.
values
(
typeList
[
index
]).
slice
(
0
,
2
)
;
itemList
.
push
(
'全部'
)
itemList
.
push
(
"全部"
);
let
_this
=
this
let
_this
=
this
;
wx
.
pro
.
showActionSheet
({
wx
.
pro
.
showActionSheet
({
itemList
,
itemList
,
success
(
res
)
{
success
(
res
)
{
// 选中全部
// 选中全部
let
selectIndex
=
res
.
tapIndex
let
selectIndex
=
res
.
tapIndex
;
// console.log('selectIndex: ', selectIndex);
// console.log('selectIndex: ', selectIndex);
typeList
[
index
].
selectIndex
=
selectIndex
typeList
[
index
].
selectIndex
=
selectIndex
;
let
params
=
typeList
.
reduce
((
obj
,
item
,
index
)
=>
{
let
params
=
typeList
.
reduce
((
obj
,
item
,
index
)
=>
{
console
.
log
(
' item: '
,
item
)
console
.
log
(
" item: "
,
item
);
if
(
item
[
'key'
])
{
if
(
item
[
"key"
])
{
// selectIndex = index == 2 ? selectIndex + 1 : selectIndex
// selectIndex = index == 2 ? selectIndex + 1 : selectIndex
// console.log('selectIndex: ', selectIndex);
// console.log('selectIndex: ', selectIndex);
let
itemIndx
=
item
.
selectIndex
let
itemIndx
=
item
.
selectIndex
;
// console.log('itemIndx: ', itemIndx);
// console.log('itemIndx: ', itemIndx);
// key: 'clueSource'
// key: 'clueSource'
if
(
item
[
'key'
]
==
'clueSource'
)
{
if
(
item
[
"key"
]
==
"clueSource"
)
{
itemIndx
+=
1
itemIndx
+=
1
;
}
}
obj
[
item
[
'key'
]]
=
itemIndx
==
2
||
itemIndx
==
3
?
''
:
itemIndx
obj
[
item
[
"key"
]]
=
itemIndx
==
2
||
itemIndx
==
3
?
""
:
itemIndx
;
}
}
return
obj
return
obj
;
},
{})
},
{})
;
console
.
log
(
params
)
console
.
log
(
params
)
;
// let num
// let num
// if (index == 2) {
// if (index == 2) {
// num = res.tapIndex + 1
// num = res.tapIndex + 1
...
@@ -589,13 +597,13 @@ Page({
...
@@ -589,13 +597,13 @@ Page({
// params.clueSource = num
// params.clueSource = num
// break
// break
// }
// }
_this
.
setData
({
typeList
})
_this
.
setData
({
typeList
})
;
_this
.
getPageApi
(
params
)
_this
.
getPageApi
(
params
)
;
},
},
fail
(
res
)
{
fail
(
res
)
{
console
.
log
(
res
.
errMsg
)
console
.
log
(
res
.
errMsg
)
;
}
}
,
})
})
;
},
},
// // 打电话
// // 打电话
// phoneCallFn(e) {
// phoneCallFn(e) {
...
@@ -610,47 +618,47 @@ Page({
...
@@ -610,47 +618,47 @@ Page({
// },
// },
getClueInit
(
param
)
{
getClueInit
(
param
)
{
// console.log(22222)
// console.log(22222)
this
.
getUnreadApi
(
param
)
this
.
getUnreadApi
(
param
)
;
this
.
getPageApi
(
param
)
this
.
getPageApi
(
param
)
;
},
},
//未读消息
//未读消息
async
getUnreadApi
(
param
)
{
async
getUnreadApi
(
param
)
{
let
{
code
,
data
}
=
await
unreadApi
(
param
)
let
{
code
,
data
}
=
await
unreadApi
(
param
)
;
if
(
code
==
0
)
{
if
(
code
==
0
)
{
this
.
setData
({
this
.
setData
({
unreadClueCount
:
data
.
unreadClueCount
unreadClueCount
:
data
.
unreadClueCount
,
})
})
;
}
}
},
},
//获取浏览线索数据列表
//获取浏览线索数据列表
async
getPageApi
(
param
)
{
async
getPageApi
(
param
)
{
let
{
cluePageSize
,
clueCurrentPage
}
=
this
.
data
let
{
cluePageSize
,
clueCurrentPage
}
=
this
.
data
;
let
params
=
{
let
params
=
{
...
param
,
...
param
,
pageSize
:
1000
,
pageSize
:
1000
,
currentPage
:
clueCurrentPage
currentPage
:
clueCurrentPage
,
}
}
;
let
{
code
,
data
}
=
await
pageApi
(
params
)
let
{
code
,
data
}
=
await
pageApi
(
params
)
;
if
(
code
==
0
)
{
if
(
code
==
0
)
{
let
arr
=
data
.
list
.
map
(
item
=>
{
let
arr
=
data
.
list
.
map
(
(
item
)
=>
{
if
(
item
.
visitList
.
length
>
5
)
{
if
(
item
.
visitList
.
length
>
5
)
{
item
.
getMoreFlag
=
true
item
.
getMoreFlag
=
true
;
}
}
return
item
return
item
;
})
})
;
this
.
setData
({
this
.
setData
({
clueList
:
arr
clueList
:
arr
,
})
})
;
}
}
},
},
//喜欢收藏功能
//喜欢收藏功能
async
getTagApi
(
param
)
{
async
getTagApi
(
param
)
{
let
res
=
await
tagApi
(
param
)
let
res
=
await
tagApi
(
param
)
;
console
.
log
(
'res: '
,
res
)
console
.
log
(
"res: "
,
res
);
this
.
getPageApi
(
param
)
this
.
getPageApi
(
param
)
;
},
},
onReachBottom
()
{
onReachBottom
()
{
console
.
log
(
'滑到底部了'
)
console
.
log
(
"滑到底部了"
);
},
},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
...
@@ -661,16 +669,16 @@ Page({
...
@@ -661,16 +669,16 @@ Page({
// })
// })
},
},
onPageScroll
:
(
function
()
{
onPageScroll
:
(
function
()
{
let
timer
=
null
let
timer
=
null
;
return
function
(
e
)
{
return
function
(
e
)
{
// console.log("在滚动");
// console.log("在滚动");
// 监听页面的滚动开始和结束
// 监听页面的滚动开始和结束
clearTimeout
(
timer
)
clearTimeout
(
timer
)
;
timer
=
setTimeout
(()
=>
{
timer
=
setTimeout
(()
=>
{
// console.log("滚动结束");
// console.log("滚动结束");
wx
.
$eventbus
.
emit
(
'evt_page_scroll'
,
{
scrollTop
:
e
.
scrollTop
})
wx
.
$eventbus
.
emit
(
"evt_page_scroll"
,
{
scrollTop
:
e
.
scrollTop
});
},
500
)
},
500
)
;
}
}
;
})(),
})(),
/**
/**
* 生命周期函数--监听页面隐藏
* 生命周期函数--监听页面隐藏
...
@@ -695,5 +703,5 @@ Page({
...
@@ -695,5 +703,5 @@ Page({
* 用户点击右上角分享
* 用户点击右上角分享
*/
*/
onShareAppMessage
:
function
()
{},
onShareAppMessage
:
function
()
{},
onShareTimeline
:
function
()
{}
onShareTimeline
:
function
()
{}
,
})
})
;
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