Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant
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 e5fc9f53
authored
Oct 27, 2022
by
张晓玮
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v3.0' into 'zhangxw_dev_3.0'
V3.0 See merge request
!90
2 parents
fe7af718
4d363e76
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
439 additions
and
166 deletions
api/usersApi/UsersApi.js
app.json
components/Authorize/Authorize.js
packageMine/pages/withdrawal/index.js
pages/authentication/login.scss
pages/authentication/login/login.js
pages/authentication/login/login.wxml
pages/authentication/register/register.js
pages/authentication/register/register.wxml
pages/authentication/registerInfo/registerInfo.js
pages/checkProduct/checkProduct.js
pages/checkProduct/checkProduct.scss
pages/checkProduct/checkProduct.wxml
pages/tab/discovery/components/product/product.js
pages/tab/discovery/components/product/product.json
pages/tab/discovery/components/product/product.scss
pages/tab/discovery/components/product/product.wxml
pages/tab/discovery/constant/data.js
pages/tab/discovery/discovery.js
pages/tab/discovery/discovery.scss
pages/tab/discovery/discovery.wxml
utils/cache/storage.js
utils/request/request.js
api/usersApi/UsersApi.js
View file @
e5fc9f5
...
@@ -45,13 +45,11 @@ class UsersApi {
...
@@ -45,13 +45,11 @@ class UsersApi {
}
}
/**授权手机号登录 */
/**授权手机号登录 */
async
authUserPhone
(
detail
,
loginToken
)
{
async
authUserPhone
(
detail
,
loginToken
)
{
console
.
log
(
221
)
if
(
!
loginToken
)
{
if
(
!
loginToken
)
{
wx
.
$api
.
showToast
(
'缺少loginToken'
)
wx
.
$api
.
showToast
(
'缺少loginToken'
)
Promise
.
reject
()
Promise
.
reject
()
return
return
}
}
console
.
log
(
111
)
if
(
detail
.
errMsg
&&
detail
.
errMsg
==
'getPhoneNumber:fail user deny'
)
Promise
.
reject
()
if
(
detail
.
errMsg
&&
detail
.
errMsg
==
'getPhoneNumber:fail user deny'
)
Promise
.
reject
()
delete
detail
.
errMsg
delete
detail
.
errMsg
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
...
...
app.json
View file @
e5fc9f5
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
],
],
"usingComponents"
:
{
"usingComponents"
:
{
"navigation-bar"
:
"/components/NavigationBar/NavigationBar"
,
"navigation-bar"
:
"/components/NavigationBar/NavigationBar"
,
"authorize"
:
"/components/Authorize/Authorize"
,
"popup"
:
"/components/Popup/Popup"
,
"popup"
:
"/components/Popup/Popup"
,
"van-picker"
:
"@vant/weapp/picker/index"
,
"van-picker"
:
"@vant/weapp/picker/index"
,
"van-popup"
:
"@vant/weapp/popup/index"
,
"van-popup"
:
"@vant/weapp/popup/index"
,
...
...
components/Authorize/Authorize.js
View file @
e5fc9f5
...
@@ -52,7 +52,7 @@ Component({
...
@@ -52,7 +52,7 @@ Component({
/**
/**
* 禁止滑动
* 禁止滑动
*/
*/
noScroll
:
wx
.
$util
.
noScroll
(),
//
noScroll: wx.$util.noScroll(),
cancel
(
e
)
{
cancel
(
e
)
{
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
buttonType
,
title
}
=
this
.
data
let
{
buttonType
,
title
}
=
this
.
data
...
...
packageMine/pages/withdrawal/index.js
View file @
e5fc9f5
...
@@ -13,8 +13,8 @@ Page({
...
@@ -13,8 +13,8 @@ Page({
if
(
!
sumbitScore
)
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
!
sumbitScore
)
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
sumbitScore
==
0
)
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
sumbitScore
==
0
)
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
isString
&&
sumbitScore
.
indexOf
(
'.'
)
==
(
sumbitScore
.
length
-
1
))
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
isString
&&
sumbitScore
.
indexOf
(
'.'
)
==
(
sumbitScore
.
length
-
1
))
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
sumbitScore
<
0.3
)
return
wx
.
$api
.
showToast
(
'
至少提现0.3
'
)
if
(
sumbitScore
<
0.3
)
return
wx
.
$api
.
showToast
(
'
单次最低提现积分不得低于0.3,请确认后重新申请提现
'
)
if
(
Number
(
sumbitScore
)
>
Number
(
withdrawalScore
))
return
wx
.
$api
.
showToast
(
`
当前可提现最大积分为
${
Number
(
withdrawalScore
)}
`
)
if
(
Number
(
sumbitScore
)
>
Number
(
withdrawalScore
))
return
wx
.
$api
.
showToast
(
`
您的积分不足,请确认后重新申请提现
`
)
Dialog
.
confirm
({
Dialog
.
confirm
({
title
:
'提示'
,
title
:
'提示'
,
message
:
`请确认是否将
${
sumbitScore
}
积分进行提现`
,
message
:
`请确认是否将
${
sumbitScore
}
积分进行提现`
,
...
...
pages/authentication/login.scss
View file @
e5fc9f5
...
@@ -4,6 +4,11 @@
...
@@ -4,6 +4,11 @@
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
}
}
.bar-text
{
font-weight
:
600
;
font-size
:
34rpx
;
color
:
#2D2D2E
;
}
.container
{
.container
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
...
pages/authentication/login/login.js
View file @
e5fc9f5
...
@@ -42,7 +42,7 @@ Page({
...
@@ -42,7 +42,7 @@ Page({
this
.
init
()
this
.
init
()
},
},
async
init
()
{
async
init
(
tip
)
{
try
{
try
{
const
{
const
{
data
,
data
,
...
@@ -51,12 +51,15 @@ Page({
...
@@ -51,12 +51,15 @@ Page({
}
=
await
USERAPI
.
wxCodeLogin
()
}
=
await
USERAPI
.
wxCodeLogin
()
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
this
.
loginToken
=
data
this
.
loginToken
=
data
if
(
tip
){
wx
.
$api
.
showToast
(
`
${
tip
==
1
?
'登录'
:
'注册'
}
信息已失效,请重试`
)
}
}
else
this
.
reLogin
(
message
)
}
else
this
.
reLogin
(
message
)
wx
.
hideLoading
()
wx
.
hideLoading
()
}
catch
({
}
catch
({
errMsg
errMsg
})
{
})
{
console
.
error
(
errMsg
)
console
.
log
(
errMsg
)
this
.
reLogin
(
errMsg
)
this
.
reLogin
(
errMsg
)
}
}
},
},
...
@@ -101,15 +104,15 @@ Page({
...
@@ -101,15 +104,15 @@ Page({
mobile
:
formData
.
phone
,
mobile
:
formData
.
phone
,
code
:
formData
.
code
code
:
formData
.
code
}
}
wx
.
showLoading
()
if
(
this
.
data
.
showLoading
||
this
.
data
.
disabled
)
return
;
if
(
this
.
data
.
showLoading
||
this
.
data
.
disabled
)
return
;
this
.
setShowLoading
(
true
)
USERAPI
.
phoneSmsLogin
(
obj
).
then
(({
USERAPI
.
phoneSmsLogin
(
obj
).
then
(({
code
,
code
,
data
,
data
,
message
,
message
,
errId
errId
})
=>
{
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
this
.
checkLoginUserInfo
(
data
)
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'30990103'
)
{
}
else
if
(
errId
==
'30990103'
)
{
...
@@ -120,7 +123,7 @@ Page({
...
@@ -120,7 +123,7 @@ Page({
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
wx
.
$api
.
showToast
(
'系统异常'
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
})
},
},
...
@@ -132,7 +135,7 @@ Page({
...
@@ -132,7 +135,7 @@ Page({
/**多个账号 */
/**多个账号 */
console
.
log
(
loginUserInfoList
,
'loginUserInfoList'
)
console
.
log
(
loginUserInfoList
,
'loginUserInfoList'
)
if
(
loginUserInfoList
.
length
>
1
)
wx
.
$router
.
go
(
'/pages/authentication/accountItems/accountItems'
,
{
if
(
loginUserInfoList
.
length
>
1
)
wx
.
$router
.
reLaunch
(
'/pages/authentication/accountItems/accountItems'
,
{
sessionId
,
sessionId
,
...
this
.
options
...
this
.
options
})
})
...
@@ -184,8 +187,12 @@ Page({
...
@@ -184,8 +187,12 @@ Page({
// this.setData({
// this.setData({
// smsLoading: false
// smsLoading: false
// })
// })
if
(
code
==
'0'
)
this
.
countDown
(
countDown
)
if
(
code
==
'0'
)
{
else
wx
.
$api
.
showToast
(
message
||
'发送验证码失败'
)
wx
.
$api
.
showToast
(
'验证码已发送'
)
this
.
countDown
(
countDown
)
}
else
{
wx
.
$api
.
showToast
(
message
||
'发送验证码失败'
)
}
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
// this.setData({
// this.setData({
// smsLoading: false
// smsLoading: false
...
@@ -220,27 +227,30 @@ Page({
...
@@ -220,27 +227,30 @@ Page({
detail
detail
})
{
})
{
if
(
!
detail
.
code
||
this
.
data
.
showLoading
)
return
if
(
!
detail
.
code
||
this
.
data
.
showLoading
)
return
this
.
setShowLoading
(
true
)
// this.setShowLoading(true)
wx
.
showLoading
()
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
code
,
code
,
data
,
data
,
message
,
message
,
errId
errId
})
=>
{
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
if
(
code
==
'0'
){
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'30990103'
){
}
else
if
(
errId
==
'30990103'
){
this
.
setData
({
this
.
setData
({
authorized
:
true
authorized
:
true
})
})
}
else
if
(
errId
==
'200122'
){
this
.
init
(
1
)
}
else
{
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}
}).
catch
(({
}).
catch
(({
errMsg
errMsg
})
=>
{
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
wx
.
$api
.
showToast
(
'系统异常'
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
})
},
},
...
...
pages/authentication/login/login.wxml
View file @
e5fc9f5
<!--pages/login.wxml-->
<!--pages/login.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<text>门店助手</text>
<text
class="bar-text"
>门店助手</text>
</navigation-bar>
</navigation-bar>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<view class="container" style="padding-top: {{headerHeight}}px;">
<view class="container" style="padding-top: {{headerHeight}}px;">
...
...
pages/authentication/register/register.js
View file @
e5fc9f5
...
@@ -22,7 +22,7 @@ Page({
...
@@ -22,7 +22,7 @@ Page({
headerHeight
:
height
,
headerHeight
:
height
,
});
});
},
},
async
init
()
{
async
init
(
tip
)
{
try
{
try
{
const
{
const
{
data
,
data
,
...
@@ -30,10 +30,10 @@ Page({
...
@@ -30,10 +30,10 @@ Page({
message
message
}
=
await
USERAPI
.
wxCodeLogin
()
}
=
await
USERAPI
.
wxCodeLogin
()
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
this
.
setData
({
disabled
:
false
})
this
.
loginToken
=
data
this
.
loginToken
=
data
if
(
tip
){
wx
.
$api
.
showToast
(
`
${
tip
==
1
?
'登录'
:
'注册'
}
信息已失效,请重试`
)
}
}
else
this
.
reLogin
(
message
)
}
else
this
.
reLogin
(
message
)
wx
.
hideLoading
()
wx
.
hideLoading
()
}
catch
({
}
catch
({
...
@@ -83,9 +83,12 @@ Page({
...
@@ -83,9 +83,12 @@ Page({
},
},
register
(
params
,
detail
){
register
(
params
,
detail
){
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
console
.
log
(
res
,
'errId'
)
if
(
res
.
code
==
'0'
){
if
(
res
.
code
==
'0'
){
this
.
toLogin
(
detail
)
this
.
toLogin
(
detail
)
}
else
{
}
else
if
(
res
.
errId
==
'200122'
){
this
.
init
(
2
)
}
else
{
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
}
}
})
})
...
@@ -99,6 +102,8 @@ Page({
...
@@ -99,6 +102,8 @@ Page({
})
=>
{
})
=>
{
if
(
code
==
'0'
){
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'200122'
){
this
.
init
(
1
)
}
else
{
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}
...
...
pages/authentication/register/register.wxml
View file @
e5fc9f5
<!--pages/login/register/register.wxml-->
<!--pages/login/register/register.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<text>门店助手</text>
<text
class="bar-text"
>门店助手</text>
</navigation-bar>
</navigation-bar>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<view class="container" style="padding-top: {{headerHeight}}px;">
<view class="container" style="padding-top: {{headerHeight}}px;">
...
...
pages/authentication/registerInfo/registerInfo.js
View file @
e5fc9f5
...
@@ -32,10 +32,8 @@ Page({
...
@@ -32,10 +32,8 @@ Page({
onRoute
(
options
){
onRoute
(
options
){
this
.
setData
({
this
.
setData
({
dataFromOptions
:
options
,
dataFromOptions
:
options
staffName
:
options
.
staffName
})
})
console
.
log
(
this
.
data
.
dataFromOptions
)
},
},
/**
/**
...
@@ -44,7 +42,7 @@ Page({
...
@@ -44,7 +42,7 @@ Page({
onLoad
(
options
)
{
onLoad
(
options
)
{
this
.
init
()
this
.
init
()
},
},
async
init
()
{
async
init
(
tip
)
{
try
{
try
{
const
{
const
{
data
,
data
,
...
@@ -53,6 +51,9 @@ Page({
...
@@ -53,6 +51,9 @@ Page({
}
=
await
USERAPI
.
wxCodeLogin
()
}
=
await
USERAPI
.
wxCodeLogin
()
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
this
.
loginToken
=
data
this
.
loginToken
=
data
if
(
tip
){
wx
.
$api
.
showToast
(
`
${
tip
==
1
?
'登录'
:
'注册'
}
信息已失效,请重试`
)
}
}
else
this
.
reLogin
(
message
)
}
else
this
.
reLogin
(
message
)
wx
.
hideLoading
()
wx
.
hideLoading
()
}
catch
({
}
catch
({
...
@@ -113,6 +114,8 @@ Page({
...
@@ -113,6 +114,8 @@ Page({
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
'0'
){
if
(
res
.
code
==
'0'
){
this
.
toLogin
()
this
.
toLogin
()
}
else
if
(
res
.
errId
==
'200122'
){
this
.
init
(
2
)
}
else
{
}
else
{
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
}
}
...
@@ -128,6 +131,8 @@ Page({
...
@@ -128,6 +131,8 @@ Page({
})
=>
{
})
=>
{
if
(
code
==
'0'
){
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'200122'
){
this
.
init
(
1
)
}
else
{
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}
...
...
pages/checkProduct/checkProduct.js
View file @
e5fc9f5
...
@@ -19,16 +19,16 @@ Page({
...
@@ -19,16 +19,16 @@ Page({
fromLocal
:
0
,
fromLocal
:
0
,
// 模态框
// 模态框
isShow
:
true
,
isShow
:
true
,
showAuth
:
false
,
btnList
:
[
btnList
:
[
{
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"微信转发"
,
},
{
src
:
`
${
IMGURL
}
down.png`
,
src
:
`
${
IMGURL
}
down.png`
,
name
:
"下载
为
海报"
,
name
:
"下载海报"
,
},
},
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"转发给好友"
,
}
],
],
posterUrl
:
""
,
//海报url
posterUrl
:
""
,
//海报url
},
},
...
@@ -69,10 +69,9 @@ Page({
...
@@ -69,10 +69,9 @@ Page({
activeNavIdx
,
activeNavIdx
,
fromLocal
fromLocal
})
})
this
.
createImg
()
},
},
createImg
(){
createImg
(){
if
(
this
.
data
.
isShow
&&
this
.
data
.
fromLocal
==
1
){
if
(
this
.
data
.
fromLocal
==
1
){
let
{
actNum
,
activeNavIdx
,
senceData
}
=
this
.
data
;
let
{
actNum
,
activeNavIdx
,
senceData
}
=
this
.
data
;
let
img
=
`
${
IMGURL
}
scene/longpic
${
actNum
+
1
}
.png`
let
img
=
`
${
IMGURL
}
scene/longpic
${
actNum
+
1
}
.png`
wx
.
showLoading
({
wx
.
showLoading
({
...
@@ -82,9 +81,10 @@ Page({
...
@@ -82,9 +81,10 @@ Page({
src
:
img
,
src
:
img
,
success
:(
res
)
=>
{
success
:(
res
)
=>
{
let
imgW
=
res
.
width
/
4
,
imgH
=
res
.
height
/
4
;
let
imgW
=
res
.
width
/
4
,
imgH
=
res
.
height
/
4
;
let
pradH
=
288
*
imgW
/
1029
,
qrcodeH
=
100
;
let
drawFun
=
new
Draw
({
let
drawFun
=
new
Draw
({
width
:
imgW
,
width
:
imgW
,
height
:
imgH
+
imgW
/
4
+
22
height
:
imgH
+
pradH
});
});
// let scene = {
// let scene = {
// actNum,
// actNum,
...
@@ -94,7 +94,6 @@ Page({
...
@@ -94,7 +94,6 @@ Page({
scene
:
`actNum=
${
actNum
}
&activeNavIdx=
${
activeNavIdx
}
`
,
scene
:
`actNum=
${
actNum
}
&activeNavIdx=
${
activeNavIdx
}
`
,
path
:
'pages/checkProduct/checkProduct'
path
:
'pages/checkProduct/checkProduct'
}
}
let
qrcodeH
=
actNum
==
3
?
68
:
100
commonApi
.
createQrcode
(
params
).
then
(
response
=>
{
commonApi
.
createQrcode
(
params
).
then
(
response
=>
{
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'海报生成中...'
,
title
:
'海报生成中...'
,
...
@@ -105,66 +104,73 @@ Page({
...
@@ -105,66 +104,73 @@ Page({
imgH
:
(
imgH
/
imgW
)
*
450
imgH
:
(
imgH
/
imgW
)
*
450
})
})
console
.
log
(
actNum
,
activeNavIdx
,
senceData
)
console
.
log
(
actNum
,
activeNavIdx
,
senceData
)
let
textList
=
[
// let textList = [
// {
// x: imgW/4+22,
// y: 15,
// text: senceData[actNum].productList[activeNavIdx].proName,
// textBaseline: 'top'
// },
// {
// x: imgW/4+22,
// y: (imgW/4+12)/2,
// color: '#7A8299',
// text: `${senceData[actNum].productList[activeNavIdx].varType==1?'三年售后存量数':'新车销量'} ${senceData[actNum].productList[activeNavIdx].sale}`,
// },
// {
// x: imgW/4+22,
// y: imgW/4,
// text: '预估收益',
// maxWidth: 50,
// color: '#7A8299'
// },
// {
// x: imgW/4+77,
// y: imgW/4,
// text: `¥${senceData[actNum].productList[activeNavIdx].profit}`,
// color: '#F35251',
// fontSize: 14,
// fontWeight: 500
// }
// ]
let
imageList
=
[
{
{
x
:
imgW
/
4
+
22
,
x
:
0
,
y
:
15
,
y
:
0
,
text
:
senceData
[
actNum
].
productList
[
activeNavIdx
].
proName
,
width
:
imgW
,
textBaseline
:
'top'
height
:
pradH
,
},
url
:
`
${
IMGURL
}
canvas/
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
img
}
.png`
,
{
x
:
imgW
/
4
+
22
,
y
:
(
imgW
/
4
+
12
)
/
2
,
color
:
'#7A8299'
,
text
:
`
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
varType
==
1
?
'三年售后存量数'
:
'新车销量'
}
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
sale
}
`
,
},
{
x
:
imgW
/
4
+
22
,
y
:
imgW
/
4
,
text
:
'预估收益'
,
maxWidth
:
50
,
color
:
'#7A8299'
},
{
x
:
imgW
/
4
+
77
,
y
:
imgW
/
4
,
text
:
`¥
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
profit
}
`
,
color
:
'#F35251'
,
fontSize
:
14
,
fontWeight
:
500
}
]
let
imgList
=
[
{
x
:
10
,
y
:
10
,
width
:
imgW
/
4
,
height
:
imgW
/
4
+
2
,
url
:
`
${
IMGURL
}
prod/
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
img
}
.png`
,
},
},
{
{
x
:
0
,
x
:
0
,
y
:
imgW
/
4
+
22
,
y
:
pradH
,
width
:
imgW
,
width
:
imgW
,
height
:
imgH
,
height
:
imgH
,
url
:
img
,
url
:
img
,
},
},
{
{
x
:
imgW
-
qrcodeH
-
5
,
x
:
imgW
-
qrcodeH
,
y
:
imgH
+
imgW
/
4
+
17
-
qrcodeH
,
y
:
imgH
+
pradH
-
qrcodeH
-
20
,
width
:
qrcodeH
,
width
:
qrcodeH
,
height
:
qrcodeH
,
height
:
qrcodeH
,
url
:
qrcode
,
//二维码
url
:
qrcode
,
//二维码
},
},
];
];
drawFun
.
begin
({
drawFun
.
begin
({
imageList
:
imgList
,
imageList
textList
}).
then
(
resp
=>
{
}).
then
(
resp
=>
{
this
.
setData
({
this
.
setData
({
posterUrl
:
resp
.
path
,
posterUrl
:
resp
.
path
,
});
});
wx
.
hideLoading
()
wx
.
hideLoading
()
if
(
resp
.
path
){
wx
.
saveImageToPhotosAlbum
({
filePath
:
resp
.
path
,
//仅为示例,并非真实的资源
success
:(
res
)
=>
{
wx
.
$api
.
showToast
(
'下载成功!'
)
}
})
}
})
})
}
else
{
}
else
{
wx
.
$api
.
showToast
(
'接口异常'
)
wx
.
$api
.
showToast
(
'接口异常'
)
...
@@ -179,10 +185,10 @@ Page({
...
@@ -179,10 +185,10 @@ Page({
let
{
index
}
=
e
.
currentTarget
.
dataset
;
let
{
index
}
=
e
.
currentTarget
.
dataset
;
switch
(
index
)
{
switch
(
index
)
{
case
0
:
case
0
:
this
.
wechatFn
();
this
.
download
();
break
;
break
;
case
1
:
case
1
:
this
.
download
();
this
.
wechatFn
();
break
;
break
;
}
}
},
},
...
@@ -193,21 +199,67 @@ Page({
...
@@ -193,21 +199,67 @@ Page({
},
},
// 下载海报
// 下载海报
download
()
{
download
()
{
if
(
this
.
data
.
posterUrl
){
wx
.
showModal
({
wx
.
saveImageToPhotosAlbum
({
content
:
'确认下载海报?'
,
filePath
:
this
.
data
.
posterUrl
,
//仅为示例,并非真实的资源
success
:
async
(
res
)
=>
{
success
(
res
)
{
if
(
res
.
confirm
){
wx
.
$api
.
showToast
(
'下载成功!'
)
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
===
false
){
this
.
setData
({
showAuth
:
true
})
}
else
{
this
.
createImg
()
}
}
})
}
},
fail
:
(
res
)
=>
{},
complete
:
(
res
)
=>
{},
})
},
authFail
(){
wx
.
showToast
({
title
:
"下载海报前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
},
authSuccess
(){
this
.
createImg
()
},
toSetting
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
openSetting
({
success
:(
resp
)
=>
{
if
(
resp
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
showToast
({
title
:
"下载海报前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
}
}
})
}
}
}
})
})
}
})
this
.
modelClose
();
},
},
//模态框关闭
//模态框关闭
modelClose
()
{
modelClose
()
{
this
.
setData
({
//
this.setData({
isShow
:
false
//
isShow: false
});
//
});
},
},
// 图片加载事件
// 图片加载事件
onloadFn
(
event
)
{
onloadFn
(
event
)
{
...
...
pages/checkProduct/checkProduct.scss
View file @
e5fc9f5
...
@@ -72,4 +72,64 @@ page{
...
@@ -72,4 +72,64 @@ page{
text-align
:
center
;
text-align
:
center
;
}
}
}
}
}
.btns-wrap
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
background
:
#ffffff
;
border-radius
:
8px
8px
0
0
;
z-index
:
5
;
.top
{
display
:
flex
;
justify-content
:
space-around
;
align-items
:
center
;
height
:
130rpx
;
.img
{
display
:
block
;
margin
:
0
auto
8px
;
width
:
40px
;
height
:
40px
;
}
// .name {
// font-size: 12px;
// color: #323436;
// text-align: center;
// }
.name0
{
width
:
256rpx
;
height
:
88rpx
;
border
:
1px
solid
#EEEEEE
;
border-radius
:
8rpx
;
font-size
:
28rpx
;
color
:
#8A8C90
;
text-align
:
center
;
line-height
:
88rpx
;
}
.name1
{
width
:
414rpx
;
height
:
88rpx
;
background
:
#3666FE
;
border-radius
:
8rpx
;
font-size
:
28rpx
;
color
:
#FFFFFF
;
line-height
:
88rpx
;
}
.btn-wechat
{
width
:
auto
;
margin
:
0
;
padding
:
0
;
background-color
:
#fff
;
}
}
.btom
{
margin
:
18px
auto
0
;
width
:
343px
;
height
:
44px
;
line-height
:
44px
;
border
:
1px
solid
#eeeeee
;
border-radius
:
4px
;
text-align
:
center
;
}
}
}
\ No newline at end of file
\ No newline at end of file
pages/checkProduct/checkProduct.wxml
View file @
e5fc9f5
<!--pages/checkProduct/checkProduct.wxml-->
<view style="padding-bottom: {{fromLocal==1? 150: 0}}rpx">
<!-- <navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">特色产品</navigation-bar>
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<view style="height:{{headerHeight}}px">
</view>
</view> -->
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- 分享弹框 -->
<!-- 分享弹框 -->
<view class="share-wrap" wx:if="{{isShow && fromLocal==1}}">
<
!-- <
view class="share-wrap" wx:if="{{isShow && fromLocal==1}}">
<view class="img-wrap" wx:if="{{posterUrl}}">
<view class="img-wrap" wx:if="{{posterUrl}}">
<image class="img" style="height:{{imgH}}rpx" src="{{posterUrl}}" />
<image class="img" style="height:{{imgH}}rpx" src="{{posterUrl}}" />
<!-- <block wx:for="{{imgList}}" wx:key="*this">
<image class="img" src="{{item}}"/>
</block> -->
</view>
</view>
<view class="btns" wx:if="{{posterUrl}}">
<view class="btns" wx:if="{{posterUrl}}">
<view class="top">
<view class="top">
...
@@ -30,4 +24,22 @@
...
@@ -30,4 +24,22 @@
</view>
</view>
<view class="btom" bindtap="modelClose">取消</view>
<view class="btom" bindtap="modelClose">取消</view>
</view>
</view>
</view> -->
<view class="btns-wrap isFullSucreen" wx:if="{{isShow && fromLocal==1}}">
<view class="top">
<view class="btn" wx:for="{{btnList}}" wx:key="name" bindtap="handleClick" data-index="{{index}}">
<block wx:if="{{index == 1}}">
<button open-type="share" class="btn-wechat">
<view class="name{{index}}">{{item.name}}</view>
</button>
</block>
<block wx:else>
<view class="name{{index}}">{{item.name}}</view>
</block>
</view>
</view>
</view>
</view>
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
pages/tab/discovery/components/product/product.js
View file @
e5fc9f5
...
@@ -21,8 +21,9 @@ Component({
...
@@ -21,8 +21,9 @@ Component({
tab
:[
'适用场景'
,
'营销链路'
,
'项目亮点'
,
'转化漏斗'
,
'合作流程'
,
'合作案例'
],
tab
:[
'适用场景'
,
'营销链路'
,
'项目亮点'
,
'转化漏斗'
,
'合作流程'
,
'合作案例'
],
heightArr
:[],
heightArr
:[],
curTabIdx
:
0
,
//适用产品
curTabIdx
:
0
,
//适用产品
intoViewId
:
'to-0'
,
actNum
:
0
,
//场景
actNum
:
0
,
//场景
showAuth
:
false
,
throttle
:
false
},
},
lifetimes
:{
lifetimes
:{
ready
:
function
(){
ready
:
function
(){
...
@@ -39,7 +40,7 @@ Component({
...
@@ -39,7 +40,7 @@ Component({
return
pre
+
cur
.
height
return
pre
+
cur
.
height
},
heightTop
)
},
heightTop
)
let
idx
=
imgHeightArr
.
findIndex
(
item
=>
item
>
e
.
scrollTop
)
let
idx
=
imgHeightArr
.
findIndex
(
item
=>
item
>
e
.
scrollTop
)
if
(
idx
>-
1
){
if
(
idx
>-
1
&&
!
this
.
data
.
throttle
){
this
.
setData
({
this
.
setData
({
curTabIdx
:
idx
curTabIdx
:
idx
})
})
...
@@ -78,7 +79,7 @@ Component({
...
@@ -78,7 +79,7 @@ Component({
}
}
this
.
setData
({
this
.
setData
({
navList
,
navList
,
intoViewId
:
`to-0`
,
curTabIdx
:
0
,
activeNavIdx
:
this
.
data
.
isShare
?
this
.
data
.
navIdx
:
0
,
activeNavIdx
:
this
.
data
.
isShare
?
this
.
data
.
navIdx
:
0
,
tab
tab
})
})
...
@@ -88,10 +89,11 @@ Component({
...
@@ -88,10 +89,11 @@ Component({
methods
:
{
methods
:
{
async
changeTab
(
e
){
async
changeTab
(
e
){
let
idx
=
e
.
detail
let
{
idx
}
=
e
.
currentTarget
.
dataset
this
.
setData
({
this
.
setData
({
intoViewId
:
`to-
${
idx
}
`
curTabIdx
:
idx
})
})
this
.
data
.
throttle
=
true
let
heightTop
=
this
.
data
.
headerHeight
+
90
-
16
-
46
// 90 场景高度,16 可能是误差 , 46 tab高度
let
heightTop
=
this
.
data
.
headerHeight
+
90
-
16
-
46
// 90 场景高度,16 可能是误差 , 46 tab高度
let
prodArr
=
await
this
.
getHeight
(
'.prod-wrap'
)
let
prodArr
=
await
this
.
getHeight
(
'.prod-wrap'
)
heightTop
+=
prodArr
[
0
].
height
heightTop
+=
prodArr
[
0
].
height
...
@@ -103,6 +105,9 @@ Component({
...
@@ -103,6 +105,9 @@ Component({
scrollTop
:
heightTop
,
scrollTop
:
heightTop
,
duration
:
0
duration
:
0
})
})
setTimeout
(()
=>
{
this
.
data
.
throttle
=
false
},
500
)
},
},
getHeight
(
cla
){
getHeight
(
cla
){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -118,23 +123,32 @@ Component({
...
@@ -118,23 +123,32 @@ Component({
activeNavIdx
:
event
.
target
.
dataset
.
index
activeNavIdx
:
event
.
target
.
dataset
.
index
})
})
},
},
scrolltoupper
(
event
)
{
downVideo
(
e
)
{
const
idx
=
this
.
data
.
heightArr
.
findIndex
(
item
=>
item
>
event
.
detail
.
scrollTop
)
let
{
url
}
=
e
.
target
.
dataset
this
.
setData
({
this
.
setData
({
curTabIdx
:
idx
curVideoUrl
:
url
})
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
===
false
){
this
.
setData
({
showAuth
:
true
})
}
else
{
this
.
toDown
()
}
}
})
})
},
},
downVideo
(
e
)
{
toDown
(){
let
{
url
}
=
e
.
target
.
dataset
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
wx
.
downloadFile
({
url
:
u
rl
,
url
:
this
.
data
.
curVideoU
rl
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
statusCode
===
200
)
{
if
(
res
.
statusCode
===
200
)
{
wx
.
saveVideoToPhotosAlbum
({
wx
.
saveVideoToPhotosAlbum
({
filePath
:
res
.
tempFilePath
,
filePath
:
res
.
tempFilePath
,
success
(
res
)
{
success
(
res
p
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
wx
.
$api
.
showToast
(
'下载成功!'
)
}
}
})
})
...
@@ -142,6 +156,41 @@ Component({
...
@@ -142,6 +156,41 @@ Component({
}
}
})
})
},
},
authFail
(){
wx
.
showToast
({
title
:
"下载视频前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
},
authSuccess
(){
this
.
toDown
()
},
toSetting
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
openSetting
({
success
:(
resp
)
=>
{
if
(
resp
.
authSetting
[
'scope.writePhotosAlbum'
]){
resolve
(
true
)
}
else
{
wx
.
showToast
({
title
:
"下载视频前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
}
}
})
}
}
})
})
},
getImgHeight
(){
getImgHeight
(){
let
query
=
wx
.
createSelectorQuery
().
in
(
this
)
let
query
=
wx
.
createSelectorQuery
().
in
(
this
)
let
heightArr
=
[]
let
heightArr
=
[]
...
...
pages/tab/discovery/components/product/product.json
View file @
e5fc9f5
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{
"usingComponents"
:
{
"tab"
:
"../../../../../components/Tab/Tab"
}
}
}
}
\ No newline at end of file
\ No newline at end of file
pages/tab/discovery/components/product/product.scss
View file @
e5fc9f5
...
@@ -13,8 +13,9 @@
...
@@ -13,8 +13,9 @@
white-space
:
nowrap
;
white-space
:
nowrap
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
margin-top
:
24rpx
;
margin-top
:
24rpx
;
margin-bottom
:
32
rpx
;
margin-bottom
:
10
rpx
;
padding
:
0
20rpx
;
padding
:
0
20rpx
;
height
:
86rpx
;
}
}
.prod-wrap
.nav-wrap
.nav
{
.prod-wrap
.nav-wrap
.nav
{
...
@@ -305,15 +306,15 @@
...
@@ -305,15 +306,15 @@
}
}
.download
{
.download
{
position
:
absolute
;
position
:
absolute
;
top
:
8
rpx
;
top
:
16
rpx
;
right
:
8
rpx
;
right
:
16
rpx
;
z-index
:
1
;
z-index
:
1
;
width
:
5
0rpx
;
width
:
4
0rpx
;
height
:
50rpx
;
height
:
50rpx
;
}
}
.video-item
video
{
.video-item
video
{
width
:
100%
;
width
:
100%
;
height
:
59
0
rpx
;
height
:
59
2
rpx
;
}
}
.video-item
:nth-child
(
even
)
{
.video-item
:nth-child
(
even
)
{
margin-left
:
22rpx
;
margin-left
:
22rpx
;
...
@@ -331,4 +332,55 @@
...
@@ -331,4 +332,55 @@
font-size
:
28rpx
;
font-size
:
28rpx
;
color
:
rgba
(
255
,
255
,
255
,.
6
);
color
:
rgba
(
255
,
255
,
255
,.
6
);
padding
:
16rpx
0
92rpx
;
padding
:
16rpx
0
92rpx
;
}
.tab-box
{
display
:
flex
;
width
:
100%
;
height
:
46px
;
box-sizing
:
border-box
;
border-bottom
:
1rpx
solid
#EAEBEF
;
.tab
{
position
:
relative
;
flex-shrink
:
0
;
.text
{
height
:
84rpx
;
display
:
flex
;
align-items
:
center
;
box-sizing
:
border-box
;
color
:
#8A8C90
;
justify-content
:
center
;
margin
:
0
24rpx
;
font-weight
:
400
;
font-size
:
28rpx
;
font-family
:
PingFangSC-Medium
;
}
.line
{
width
:
48rpx
;
height
:
var
(
--
borderRadius
);
background
:
var
(
--
btnColor
);
border-radius
:
8rpx
8rpx
0
0
;
margin
:
0
auto
;
transform
:
scale
(
0
);
transition
:
all
.25s
;
}
}
.active
{
.text
{
font-weight
:
500
;
font-size
:
28rpx
;
transition
:
all
.25s
;
color
:
var
(
--
btnColor
);
}
.line
{
transform
:
scale
(
1
);
}
}
}
.
tab-box
:
:-
webkit-scrollbar
{
display
:
none
;
width
:
0
;
height
:
0
;
color
:
transparent
;
}
}
\ No newline at end of file
\ No newline at end of file
pages/tab/discovery/components/product/product.wxml
View file @
e5fc9f5
<view class="prod-wrap">
<view class="prod-wrap">
<text class="big-title">特色产品</text>
<text class="big-title">特色产品</text>
<scroll-view enhanced="{{true}}" show-scrollbar="{{false}}" class="nav-wrap" scroll-x="{{true}}">
<scroll-view enhanced="{{true}}"
show-scrollbar="{{false}}" class="nav-wrap" scroll-x="{{true}}">
<block wx:for="{{senceData[actNum].productList}}" wx:key="index">
<block wx:for="{{senceData[actNum].productList}}" wx:key="index">
<
text wx:if="{{!isShare || activeNavIdx==index}}" class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item.proName}}</text
>
<
view wx:if="{{!isShare || activeNavIdx==index}}" class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item.proName}}</view
>
</block>
</block>
</scroll-view>
</scroll-view>
<view class="prod-item">
<view class="prod-item">
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<view class="prod-info">
<view class="prod-info">
<text class="title">{{senceData[actNum].productList[activeNavIdx].proName}}</text>
<text class="title">{{senceData[actNum].productList[activeNavIdx].proName}}</text>
<text class="sale" decode="{{true}}">{{senceData[actNum]['productList'][activeNavIdx].varType == 1 ? '三年售后存量数':'新车销量'}} <text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].
changeSale ||
senceData[actNum]['productList'][activeNavIdx].sale}}</text>
<text class="sale" decode="{{true}}">{{senceData[actNum]['productList'][activeNavIdx].varType == 1 ? '三年售后存量数':'新车销量'}} <text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].
varType == 1? senceData[actNum]['productList'][activeNavIdx].flow :
senceData[actNum]['productList'][activeNavIdx].sale}}</text>
</text>
</text>
<text class="earnings" decode="{{true}}">预估收益 <text class="earnings-num"><text style="font-size: 24rpx; margin-right: 4rpx;">¥</text>{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
<text class="earnings" decode="{{true}}">预估收益 <text class="earnings-num"><text style="font-size: 24rpx; margin-right: 4rpx;">¥</text>{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text>
</text>
...
@@ -29,9 +29,17 @@
...
@@ -29,9 +29,17 @@
</view>
</view>
<view class="project-wrap">
<view class="project-wrap">
<view style="position: sticky;top: {{headerHeight}}px ;z-index: 2;background-color: #F5F7FB;">
<view style="position: sticky;top: {{headerHeight}}px ;z-index: 2;background-color: #F5F7FB;">
<tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab>
<!-- <tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab> -->
<scroll-view enhanced="{{true}}" show-scrollbar="{{false}}" scroll-left="{{curTabIdx*46}}" class="tab-box" scroll-x enable-flex scroll-with-animation >
<block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==curTabIdx?'active':''}}" bindtap="changeTab" data-idx="{{index}}">
<view class="text" >{{item}}</view>
<view class="line"></view>
</view>
</block>
</scroll-view>
</view>
</view>
<scroll-view class="project-img" scroll-
into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-
y="{{true}}">
<scroll-view class="project-img" scroll-y="{{true}}">
<block wx:for="{{tab}}" wx:key="index">
<block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}">
<view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}">
<image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}/scene/scene{{actNum+1}}{{index+1}}.png" />
<image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}/scene/scene{{actNum+1}}{{index+1}}.png" />
...
@@ -49,4 +57,7 @@
...
@@ -49,4 +57,7 @@
</view>
</view>
</block>
</block>
</scroll-view>
</scroll-view>
</view>
\ No newline at end of file
\ No newline at end of file
</view>
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
pages/tab/discovery/constant/data.js
View file @
e5fc9f5
...
@@ -15,6 +15,7 @@ var senceData = [
...
@@ -15,6 +15,7 @@ var senceData = [
type
:
'service'
,
type
:
'service'
,
productType
:
'benefitCard'
,
productType
:
'benefitCard'
,
path
:
'equity'
,
path
:
'equity'
,
flow
:
10000
,
sale
:
100
,
//销量
sale
:
100
,
//销量
varType
:
0
varType
:
0
}
}
...
@@ -54,10 +55,11 @@ var senceData = [
...
@@ -54,10 +55,11 @@ var senceData = [
img
:
'product-img2'
,
img
:
'product-img2'
,
proName
:
'汽车太阳膜'
,
proName
:
'汽车太阳膜'
,
price
:
'1500'
,
price
:
'1500'
,
profit
:
'1008000
0
'
,
profit
:
'1008000'
,
type
:
'membrane'
,
type
:
'membrane'
,
productType
:
'sunMembrane'
,
productType
:
'sunMembrane'
,
path
:
'solarFilm'
,
path
:
'solarFilm'
,
flow
:
10000
,
sale
:
100
,
//销量
sale
:
100
,
//销量
varType
:
0
varType
:
0
}
}
...
@@ -86,8 +88,9 @@ var senceData = [
...
@@ -86,8 +88,9 @@ var senceData = [
type
:
'membrane'
,
type
:
'membrane'
,
productType
:
'protectMembrane'
,
productType
:
'protectMembrane'
,
path
:
'paintProtect'
,
path
:
'paintProtect'
,
flow
:
10000
,
sale
:
100
,
//销量
sale
:
100
,
//销量
varType
:
1
varType
:
0
},
},
{
{
img
:
'product-img4'
,
img
:
'product-img4'
,
...
@@ -97,8 +100,9 @@ var senceData = [
...
@@ -97,8 +100,9 @@ var senceData = [
type
:
'membrane'
,
type
:
'membrane'
,
productType
:
'colorMembrane'
,
productType
:
'colorMembrane'
,
path
:
'changingFilm'
,
path
:
'changingFilm'
,
flow
:
10000
,
sale
:
100
,
//销量
sale
:
100
,
//销量
varType
:
1
varType
:
0
}
}
]
]
},
},
...
@@ -114,10 +118,11 @@ var senceData = [
...
@@ -114,10 +118,11 @@ var senceData = [
img
:
'product-img5'
,
img
:
'product-img5'
,
proName
:
'数字化美容'
,
proName
:
'数字化美容'
,
price
:
'300'
,
price
:
'300'
,
profit
:
'
360
000'
,
profit
:
'
72
000'
,
type
:
'beauty'
,
type
:
'beauty'
,
productType
:
'digitBeauty'
,
productType
:
'digitBeauty'
,
path
:
'carBeauty'
,
path
:
'carBeauty'
,
flow
:
10000
,
sale
:
100
,
//销量
sale
:
100
,
//销量
varType
:
0
varType
:
0
},
},
...
@@ -125,11 +130,12 @@ var senceData = [
...
@@ -125,11 +130,12 @@ var senceData = [
img
:
'product-img6'
,
img
:
'product-img6'
,
proName
:
'座椅通风'
,
proName
:
'座椅通风'
,
price
:
'1500'
,
price
:
'1500'
,
profit
:
'
100800
00'
,
profit
:
'
2322
00'
,
type
:
'light'
,
type
:
'light'
,
productType
:
'chair'
,
productType
:
'chair'
,
path
:
'seatVentilate'
,
path
:
'seatVentilate'
,
sale
:
10000
,
//销量
flow
:
10000
,
sale
:
10000
,
//销量
varType
:
1
varType
:
1
},
},
{
{
...
@@ -140,6 +146,7 @@ var senceData = [
...
@@ -140,6 +146,7 @@ var senceData = [
type
:
'light'
,
type
:
'light'
,
productType
:
'ar'
,
productType
:
'ar'
,
path
:
'arNavigation'
,
path
:
'arNavigation'
,
flow
:
10000
,
sale
:
10000
,
//销量
sale
:
10000
,
//销量
varType
:
1
varType
:
1
},
},
...
@@ -151,6 +158,7 @@ var senceData = [
...
@@ -151,6 +158,7 @@ var senceData = [
type
:
'light'
,
type
:
'light'
,
productType
:
'lamp'
,
productType
:
'lamp'
,
path
:
'ambientLighting'
,
path
:
'ambientLighting'
,
flow
:
10000
,
sale
:
10000
,
//销量
sale
:
10000
,
//销量
varType
:
1
varType
:
1
},
},
...
@@ -162,6 +170,7 @@ var senceData = [
...
@@ -162,6 +170,7 @@ var senceData = [
type
:
'service'
,
type
:
'service'
,
productType
:
'navigation'
,
productType
:
'navigation'
,
path
:
'navigationArround'
,
path
:
'navigationArround'
,
flow
:
10000
,
sale
:
10000
,
//销量
sale
:
10000
,
//销量
varType
:
1
varType
:
1
}
}
...
...
pages/tab/discovery/discovery.js
View file @
e5fc9f5
...
@@ -10,7 +10,7 @@ Page({
...
@@ -10,7 +10,7 @@ Page({
data
:
{
data
:
{
senceData
,
senceData
,
headerHeight
:
0
,
headerHeight
:
0
,
actNum
:
3
,
actNum
:
0
,
navStyle
,
navStyle
,
// 预估弹框
// 预估弹框
visible
:
false
,
visible
:
false
,
...
@@ -27,7 +27,8 @@ Page({
...
@@ -27,7 +27,8 @@ Page({
changeSale
:
0
,
changeSale
:
0
,
sceneCodeList
:[],
sceneCodeList
:[],
currentId
:
0
,
currentId
:
0
,
showPage
:
false
showPage
:
false
,
showAuth
:
false
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
...
@@ -45,14 +46,14 @@ Page({
...
@@ -45,14 +46,14 @@ Page({
let
sceneCodeList
=
[]
let
sceneCodeList
=
[]
let
senceData
=
[...
this
.
data
.
senceData
]
let
senceData
=
[...
this
.
data
.
senceData
]
// let res = [
// let res = [
//
{
//
{
//
sceneCode: 'SC001',
//
sceneCode: 'SC001',
// status: 1
// status: 0
//
},
//
},
//
{
//
{
//
sceneCode: 'SC002',
//
sceneCode: 'SC002',
//
status: 1
//
status: 1
//
},
//
},
// {
// {
// sceneCode: 'SC003',
// sceneCode: 'SC003',
// status: 1
// status: 1
...
@@ -66,22 +67,17 @@ Page({
...
@@ -66,22 +67,17 @@ Page({
if
(
item
.
status
==
1
)
{
if
(
item
.
status
==
1
)
{
let
sceneTarget
=
senceData
.
find
(
sitem
=>
sitem
.
sceneCode
==
item
.
sceneCode
)
let
sceneTarget
=
senceData
.
find
(
sitem
=>
sitem
.
sceneCode
==
item
.
sceneCode
)
sceneTarget
.
show
=
1
sceneTarget
.
show
=
1
}
})
senceData
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
show
==
1
)
{
sceneCodeList
.
push
(
item
.
sceneCode
)
sceneCodeList
.
push
(
item
.
sceneCode
)
}
}
})
})
let
idx
=
sceneCodeList
.
findIndex
(
item
=>
item
==
'SC004'
)
// senceData.forEach((item,index) => {
// if(item.show==1) {
// sceneCodeList.push(item.sceneCode)
// }
// })
let
actNum
=
0
,
currentId
=
0
;
let
actNum
=
0
,
currentId
=
0
;
if
(
sceneCodeList
?.
length
){
if
(
sceneCodeList
?.
length
){
if
(
idx
>-
1
){
actNum
=
senceData
.
findIndex
(
item
=>
item
.
sceneCode
==
sceneCodeList
[
0
])
actNum
=
3
currentId
=
idx
}
else
{
actNum
=
senceData
.
findIndex
(
item
=>
item
.
sceneCode
==
sceneCodeList
[
0
])
}
}
}
this
.
setData
({
this
.
setData
({
sceneCodeList
,
sceneCodeList
,
...
@@ -177,6 +173,7 @@ Page({
...
@@ -177,6 +173,7 @@ Page({
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
;
const
reg
=
/^
[
1-9
]\d
*$/
;
const
reg
=
/^
[
1-9
]\d
*$/
;
console
.
log
(
'flow'
,
sales
,
flow
)
if
(
!
reg
.
test
(
sales
))
{
if
(
!
reg
.
test
(
sales
))
{
wx
.
showToast
({
wx
.
showToast
({
title
:
"门店月平均新车销量应为正整数"
,
title
:
"门店月平均新车销量应为正整数"
,
...
@@ -204,11 +201,13 @@ Page({
...
@@ -204,11 +201,13 @@ Page({
// let name = `senceData[${index}].productList[${lastIndex}].profit`;
// let name = `senceData[${index}].productList[${lastIndex}].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 changeSale = `senceData[${index}].productList[${lastIndex}].changeSale`;
// let changeSale = `senceData[${index}].productList[${lastIndex}].changeSale`;
let
profit
=
_this
.
formula
(
i
.
productType
,
sales
,
flow
);
let
profit
=
_this
.
formula
(
i
.
productType
,
sales
,
flow
);
this
.
setData
({
this
.
setData
({
[
name
]:
profit
,
[
name
]:
profit
,
[
sale
]:
sales
[
sale
]:
sales
,
[
flowKey
]:
flow
// [changeSale]: sales,
// [changeSale]: sales,
});
});
}
}
...
@@ -219,19 +218,18 @@ Page({
...
@@ -219,19 +218,18 @@ Page({
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,
});
//
});
}
//
}
},
},
formula
(
productType
,
sales
,
flow
)
{
formula
(
productType
,
sales
,
flow
)
{
let
profit
=
0
;
let
profit
=
0
;
switch
(
productType
)
{
switch
(
productType
)
{
...
...
pages/tab/discovery/discovery.scss
View file @
e5fc9f5
...
@@ -4,6 +4,11 @@ page{
...
@@ -4,6 +4,11 @@ page{
}
}
.container
{
.container
{
position
:
relative
;
position
:
relative
;
.bar-text
{
font-weight
:
600
;
font-size
:
34rpx
;
color
:
#2D2D2E
;
}
.header
{
.header
{
padding-bottom
:
8px
;
padding-bottom
:
8px
;
}
}
...
...
pages/tab/discovery/discovery.wxml
View file @
e5fc9f5
<view class="container">
<view class="container">
<image wx:if="{{sceneCodeList.length>0 && showPage}}" style="height: {{headerHeight+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<image wx:if="{{sceneCodeList.length>0 && showPage}}" style="height: {{headerHeight+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text>
<text
class="bar-text"
>发现</text>
</navigation-bar>
</navigation-bar>
<block wx:if="{{sceneCodeList.length>0 && showPage}}">
<block wx:if="{{sceneCodeList.length>0 && showPage}}">
<view style="padding-top: {{headerHeight}}px;">
<view style="padding-top: {{headerHeight}}px;">
<view class="header">
<view class="header">
<swiper bindchange="changeSwiper" current="{{currentId}}" class="scene-wrap"
circular="{{true}}"
previousMargin="40rpx" nextMargin="40rpx">
<swiper bindchange="changeSwiper" current="{{currentId}}" class="scene-wrap" previousMargin="40rpx" nextMargin="40rpx">
<block wx:for="{{senceData}}" wx:key="index">
<block wx:for="{{senceData}}" wx:key="index">
<swiper-item item-id="{{index}}" wx:if="{{item.show}}">
<swiper-item item-id="{{index}}" wx:if="{{item.show}}">
<image class="scene-img" src="{{IMGURL}}{{item.img}}"></image>
<image class="scene-img" src="{{IMGURL}}{{item.img}}"></image>
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
<view class="dialog-box">
<view class="dialog-box">
<form bindsubmit="submit">
<form bindsubmit="submit">
<view class="dialog-header">
<view class="dialog-header">
<view
hidden="{{
isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view
wx:if="{{!
isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view
hidden="{{!
isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<view
wx:if="{{
isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<button class="header-btn btn-primary" form-type="submit">确定</button>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
</view>
<view class="dialog-content">
<view class="dialog-content">
...
...
utils/cache/storage.js
View file @
e5fc9f5
...
@@ -97,9 +97,9 @@ class Storage {
...
@@ -97,9 +97,9 @@ class Storage {
*
*
* @param {*} key | 要操作的键值
* @param {*} key | 要操作的键值
* @param {*} data | 要存储的值,会转换为 JSON 串进行存储
* @param {*} data | 要存储的值,会转换为 JSON 串进行存储
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
* @param {*} syncFlag | 同步状态,默认
同步
false (异步),true 为同步
*/
*/
set
=
(
key
,
data
,
syncFlag
)
=>
{
set
=
(
key
,
data
,
syncFlag
=
true
)
=>
{
let
tmpKey
=
this
.
checkKeyType
(
key
,
2
)
let
tmpKey
=
this
.
checkKeyType
(
key
,
2
)
if
(
tmpKey
)
{
if
(
tmpKey
)
{
tmpKey
=
this
.
addEvnToKey
(
tmpKey
)
tmpKey
=
this
.
addEvnToKey
(
tmpKey
)
...
...
utils/request/request.js
View file @
e5fc9f5
...
@@ -53,6 +53,8 @@ class Request {
...
@@ -53,6 +53,8 @@ class Request {
data
data
}
=
response
}
=
response
if
(
code
==
20
||
code
==
21
)
{
if
(
code
==
20
||
code
==
21
)
{
wx
.
$storage
.
rm
(
'sessionId'
)
wx
.
$storage
.
rm
(
'userInfo'
)
const
thisPage
=
wx
.
$router
.
getPageInstance
()
const
thisPage
=
wx
.
$router
.
getPageInstance
()
if
(
thisPage
.
route
==
'pages/authentication/loading/loading'
)
{
if
(
thisPage
.
route
==
'pages/authentication/loading/loading'
)
{
resolve
(
data
)
resolve
(
data
)
...
...
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