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 {
}
/**授权手机号登录 */
async
authUserPhone
(
detail
,
loginToken
)
{
console
.
log
(
221
)
if
(
!
loginToken
)
{
wx
.
$api
.
showToast
(
'缺少loginToken'
)
Promise
.
reject
()
return
}
console
.
log
(
111
)
if
(
detail
.
errMsg
&&
detail
.
errMsg
==
'getPhoneNumber:fail user deny'
)
Promise
.
reject
()
delete
detail
.
errMsg
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
...
...
app.json
View file @
e5fc9f5
...
...
@@ -74,6 +74,7 @@
],
"usingComponents"
:
{
"navigation-bar"
:
"/components/NavigationBar/NavigationBar"
,
"authorize"
:
"/components/Authorize/Authorize"
,
"popup"
:
"/components/Popup/Popup"
,
"van-picker"
:
"@vant/weapp/picker/index"
,
"van-popup"
:
"@vant/weapp/popup/index"
,
...
...
components/Authorize/Authorize.js
View file @
e5fc9f5
...
...
@@ -52,7 +52,7 @@ Component({
/**
* 禁止滑动
*/
noScroll
:
wx
.
$util
.
noScroll
(),
//
noScroll: wx.$util.noScroll(),
cancel
(
e
)
{
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
buttonType
,
title
}
=
this
.
data
...
...
packageMine/pages/withdrawal/index.js
View file @
e5fc9f5
...
...
@@ -13,8 +13,8 @@ Page({
if
(
!
sumbitScore
)
return
wx
.
$api
.
showToast
(
'请输入有效的积分值'
)
if
(
sumbitScore
==
0
)
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
(
Number
(
sumbitScore
)
>
Number
(
withdrawalScore
))
return
wx
.
$api
.
showToast
(
`
当前可提现最大积分为
${
Number
(
withdrawalScore
)}
`
)
if
(
sumbitScore
<
0.3
)
return
wx
.
$api
.
showToast
(
'
单次最低提现积分不得低于0.3,请确认后重新申请提现
'
)
if
(
Number
(
sumbitScore
)
>
Number
(
withdrawalScore
))
return
wx
.
$api
.
showToast
(
`
您的积分不足,请确认后重新申请提现
`
)
Dialog
.
confirm
({
title
:
'提示'
,
message
:
`请确认是否将
${
sumbitScore
}
积分进行提现`
,
...
...
pages/authentication/login.scss
View file @
e5fc9f5
...
...
@@ -4,6 +4,11 @@
left
:
0
;
top
:
0
;
}
.bar-text
{
font-weight
:
600
;
font-size
:
34rpx
;
color
:
#2D2D2E
;
}
.container
{
display
:
flex
;
flex-direction
:
column
;
...
...
pages/authentication/login/login.js
View file @
e5fc9f5
...
...
@@ -42,7 +42,7 @@ Page({
this
.
init
()
},
async
init
()
{
async
init
(
tip
)
{
try
{
const
{
data
,
...
...
@@ -51,12 +51,15 @@ Page({
}
=
await
USERAPI
.
wxCodeLogin
()
if
(
code
==
'0'
)
{
this
.
loginToken
=
data
if
(
tip
){
wx
.
$api
.
showToast
(
`
${
tip
==
1
?
'登录'
:
'注册'
}
信息已失效,请重试`
)
}
}
else
this
.
reLogin
(
message
)
wx
.
hideLoading
()
}
catch
({
errMsg
})
{
console
.
error
(
errMsg
)
console
.
log
(
errMsg
)
this
.
reLogin
(
errMsg
)
}
},
...
...
@@ -101,15 +104,15 @@ Page({
mobile
:
formData
.
phone
,
code
:
formData
.
code
}
wx
.
showLoading
()
if
(
this
.
data
.
showLoading
||
this
.
data
.
disabled
)
return
;
this
.
setShowLoading
(
true
)
USERAPI
.
phoneSmsLogin
(
obj
).
then
(({
code
,
data
,
message
,
errId
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
if
(
code
==
'0'
)
{
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'30990103'
)
{
...
...
@@ -120,7 +123,7 @@ Page({
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}).
catch
(
err
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
},
...
...
@@ -132,7 +135,7 @@ Page({
/**多个账号 */
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
,
...
this
.
options
})
...
...
@@ -184,8 +187,12 @@ Page({
// this.setData({
// smsLoading: false
// })
if
(
code
==
'0'
)
this
.
countDown
(
countDown
)
else
wx
.
$api
.
showToast
(
message
||
'发送验证码失败'
)
if
(
code
==
'0'
)
{
wx
.
$api
.
showToast
(
'验证码已发送'
)
this
.
countDown
(
countDown
)
}
else
{
wx
.
$api
.
showToast
(
message
||
'发送验证码失败'
)
}
}).
catch
(
err
=>
{
// this.setData({
// smsLoading: false
...
...
@@ -220,27 +227,30 @@ Page({
detail
})
{
if
(
!
detail
.
code
||
this
.
data
.
showLoading
)
return
this
.
setShowLoading
(
true
)
// this.setShowLoading(true)
wx
.
showLoading
()
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
code
,
data
,
message
,
errId
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'30990103'
){
this
.
setData
({
authorized
:
true
})
}
else
if
(
errId
==
'200122'
){
this
.
init
(
1
)
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}).
catch
(({
errMsg
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
},
...
...
pages/authentication/login/login.wxml
View file @
e5fc9f5
<!--pages/login.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<text>门店助手</text>
<text
class="bar-text"
>门店助手</text>
</navigation-bar>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<view class="container" style="padding-top: {{headerHeight}}px;">
...
...
pages/authentication/register/register.js
View file @
e5fc9f5
...
...
@@ -22,7 +22,7 @@ Page({
headerHeight
:
height
,
});
},
async
init
()
{
async
init
(
tip
)
{
try
{
const
{
data
,
...
...
@@ -30,10 +30,10 @@ Page({
message
}
=
await
USERAPI
.
wxCodeLogin
()
if
(
code
==
'0'
)
{
this
.
setData
({
disabled
:
false
})
this
.
loginToken
=
data
if
(
tip
){
wx
.
$api
.
showToast
(
`
${
tip
==
1
?
'登录'
:
'注册'
}
信息已失效,请重试`
)
}
}
else
this
.
reLogin
(
message
)
wx
.
hideLoading
()
}
catch
({
...
...
@@ -83,9 +83,12 @@ Page({
},
register
(
params
,
detail
){
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
console
.
log
(
res
,
'errId'
)
if
(
res
.
code
==
'0'
){
this
.
toLogin
(
detail
)
}
else
{
}
else
if
(
res
.
errId
==
'200122'
){
this
.
init
(
2
)
}
else
{
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
}
})
...
...
@@ -99,6 +102,8 @@ Page({
})
=>
{
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'200122'
){
this
.
init
(
1
)
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
...
...
pages/authentication/register/register.wxml
View file @
e5fc9f5
<!--pages/login/register/register.wxml-->
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<text>门店助手</text>
<text
class="bar-text"
>门店助手</text>
</navigation-bar>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<view class="container" style="padding-top: {{headerHeight}}px;">
...
...
pages/authentication/registerInfo/registerInfo.js
View file @
e5fc9f5
...
...
@@ -32,10 +32,8 @@ Page({
onRoute
(
options
){
this
.
setData
({
dataFromOptions
:
options
,
staffName
:
options
.
staffName
dataFromOptions
:
options
})
console
.
log
(
this
.
data
.
dataFromOptions
)
},
/**
...
...
@@ -44,7 +42,7 @@ Page({
onLoad
(
options
)
{
this
.
init
()
},
async
init
()
{
async
init
(
tip
)
{
try
{
const
{
data
,
...
...
@@ -53,6 +51,9 @@ Page({
}
=
await
USERAPI
.
wxCodeLogin
()
if
(
code
==
'0'
)
{
this
.
loginToken
=
data
if
(
tip
){
wx
.
$api
.
showToast
(
`
${
tip
==
1
?
'登录'
:
'注册'
}
信息已失效,请重试`
)
}
}
else
this
.
reLogin
(
message
)
wx
.
hideLoading
()
}
catch
({
...
...
@@ -113,6 +114,8 @@ Page({
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
'0'
){
this
.
toLogin
()
}
else
if
(
res
.
errId
==
'200122'
){
this
.
init
(
2
)
}
else
{
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
}
...
...
@@ -128,6 +131,8 @@ Page({
})
=>
{
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'200122'
){
this
.
init
(
1
)
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
...
...
pages/checkProduct/checkProduct.js
View file @
e5fc9f5
...
...
@@ -19,16 +19,16 @@ Page({
fromLocal
:
0
,
// 模态框
isShow
:
true
,
showAuth
:
false
,
btnList
:
[
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"微信转发"
,
},
{
src
:
`
${
IMGURL
}
down.png`
,
name
:
"下载
为
海报"
,
name
:
"下载海报"
,
},
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"转发给好友"
,
}
],
posterUrl
:
""
,
//海报url
},
...
...
@@ -69,10 +69,9 @@ Page({
activeNavIdx
,
fromLocal
})
this
.
createImg
()
},
createImg
(){
if
(
this
.
data
.
isShow
&&
this
.
data
.
fromLocal
==
1
){
if
(
this
.
data
.
fromLocal
==
1
){
let
{
actNum
,
activeNavIdx
,
senceData
}
=
this
.
data
;
let
img
=
`
${
IMGURL
}
scene/longpic
${
actNum
+
1
}
.png`
wx
.
showLoading
({
...
...
@@ -82,9 +81,10 @@ Page({
src
:
img
,
success
:(
res
)
=>
{
let
imgW
=
res
.
width
/
4
,
imgH
=
res
.
height
/
4
;
let
pradH
=
288
*
imgW
/
1029
,
qrcodeH
=
100
;
let
drawFun
=
new
Draw
({
width
:
imgW
,
height
:
imgH
+
imgW
/
4
+
22
height
:
imgH
+
pradH
});
// let scene = {
// actNum,
...
...
@@ -94,7 +94,6 @@ Page({
scene
:
`actNum=
${
actNum
}
&activeNavIdx=
${
activeNavIdx
}
`
,
path
:
'pages/checkProduct/checkProduct'
}
let
qrcodeH
=
actNum
==
3
?
68
:
100
commonApi
.
createQrcode
(
params
).
then
(
response
=>
{
wx
.
showLoading
({
title
:
'海报生成中...'
,
...
...
@@ -105,66 +104,73 @@ Page({
imgH
:
(
imgH
/
imgW
)
*
450
})
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
,
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
imgList
=
[
{
x
:
10
,
y
:
10
,
width
:
imgW
/
4
,
height
:
imgW
/
4
+
2
,
url
:
`
${
IMGURL
}
prod/
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
img
}
.png`
,
x
:
0
,
y
:
0
,
width
:
imgW
,
height
:
pradH
,
url
:
`
${
IMGURL
}
canvas/
${
senceData
[
actNum
].
productList
[
activeNavIdx
].
img
}
.png`
,
},
{
x
:
0
,
y
:
imgW
/
4
+
22
,
y
:
pradH
,
width
:
imgW
,
height
:
imgH
,
url
:
img
,
},
{
x
:
imgW
-
qrcodeH
-
5
,
y
:
imgH
+
imgW
/
4
+
17
-
qrcodeH
,
x
:
imgW
-
qrcodeH
,
y
:
imgH
+
pradH
-
qrcodeH
-
20
,
width
:
qrcodeH
,
height
:
qrcodeH
,
url
:
qrcode
,
//二维码
},
];
drawFun
.
begin
({
imageList
:
imgList
,
textList
imageList
}).
then
(
resp
=>
{
this
.
setData
({
posterUrl
:
resp
.
path
,
});
wx
.
hideLoading
()
if
(
resp
.
path
){
wx
.
saveImageToPhotosAlbum
({
filePath
:
resp
.
path
,
//仅为示例,并非真实的资源
success
:(
res
)
=>
{
wx
.
$api
.
showToast
(
'下载成功!'
)
}
})
}
})
}
else
{
wx
.
$api
.
showToast
(
'接口异常'
)
...
...
@@ -179,10 +185,10 @@ Page({
let
{
index
}
=
e
.
currentTarget
.
dataset
;
switch
(
index
)
{
case
0
:
this
.
wechatFn
();
this
.
download
();
break
;
case
1
:
this
.
download
();
this
.
wechatFn
();
break
;
}
},
...
...
@@ -193,21 +199,67 @@ Page({
},
// 下载海报
download
()
{
if
(
this
.
data
.
posterUrl
){
wx
.
saveImageToPhotosAlbum
({
filePath
:
this
.
data
.
posterUrl
,
//仅为示例,并非真实的资源
success
(
res
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
wx
.
showModal
({
content
:
'确认下载海报?'
,
success
:
async
(
res
)
=>
{
if
(
res
.
confirm
){
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
()
{
this
.
setData
({
isShow
:
false
});
//
this.setData({
//
isShow: false
//
});
},
// 图片加载事件
onloadFn
(
event
)
{
...
...
pages/checkProduct/checkProduct.scss
View file @
e5fc9f5
...
...
@@ -72,4 +72,64 @@ page{
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
pages/checkProduct/checkProduct.wxml
View file @
e5fc9f5
<!--pages/checkProduct/checkProduct.wxml-->
<!-- <navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">特色产品</navigation-bar>
<view style="height:{{headerHeight}}px">
</view> -->
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<view style="padding-bottom: {{fromLocal==1? 150: 0}}rpx">
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
</view>
<!-- 分享弹框 -->
<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}}">
<image class="img" style="height:{{imgH}}rpx" src="{{posterUrl}}" />
<!-- <block wx:for="{{imgList}}" wx:key="*this">
<image class="img" src="{{item}}"/>
</block> -->
</view>
<view class="btns" wx:if="{{posterUrl}}">
<view class="top">
...
...
@@ -30,4 +24,22 @@
</view>
<view class="btom" bindtap="modelClose">取消</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>
<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({
tab
:[
'适用场景'
,
'营销链路'
,
'项目亮点'
,
'转化漏斗'
,
'合作流程'
,
'合作案例'
],
heightArr
:[],
curTabIdx
:
0
,
//适用产品
intoViewId
:
'to-0'
,
actNum
:
0
,
//场景
showAuth
:
false
,
throttle
:
false
},
lifetimes
:{
ready
:
function
(){
...
...
@@ -39,7 +40,7 @@ Component({
return
pre
+
cur
.
height
},
heightTop
)
let
idx
=
imgHeightArr
.
findIndex
(
item
=>
item
>
e
.
scrollTop
)
if
(
idx
>-
1
){
if
(
idx
>-
1
&&
!
this
.
data
.
throttle
){
this
.
setData
({
curTabIdx
:
idx
})
...
...
@@ -78,7 +79,7 @@ Component({
}
this
.
setData
({
navList
,
intoViewId
:
`to-0`
,
curTabIdx
:
0
,
activeNavIdx
:
this
.
data
.
isShare
?
this
.
data
.
navIdx
:
0
,
tab
})
...
...
@@ -88,10 +89,11 @@ Component({
methods
:
{
async
changeTab
(
e
){
let
idx
=
e
.
detail
let
{
idx
}
=
e
.
currentTarget
.
dataset
this
.
setData
({
intoViewId
:
`to-
${
idx
}
`
curTabIdx
:
idx
})
this
.
data
.
throttle
=
true
let
heightTop
=
this
.
data
.
headerHeight
+
90
-
16
-
46
// 90 场景高度,16 可能是误差 , 46 tab高度
let
prodArr
=
await
this
.
getHeight
(
'.prod-wrap'
)
heightTop
+=
prodArr
[
0
].
height
...
...
@@ -103,6 +105,9 @@ Component({
scrollTop
:
heightTop
,
duration
:
0
})
setTimeout
(()
=>
{
this
.
data
.
throttle
=
false
},
500
)
},
getHeight
(
cla
){
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -118,23 +123,32 @@ Component({
activeNavIdx
:
event
.
target
.
dataset
.
index
})
},
scrolltoupper
(
event
)
{
const
idx
=
this
.
data
.
heightArr
.
findIndex
(
item
=>
item
>
event
.
detail
.
scrollTop
)
downVideo
(
e
)
{
let
{
url
}
=
e
.
target
.
dataset
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
)
{
let
{
url
}
=
e
.
target
.
dataset
toDown
(){
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
url
:
u
rl
,
url
:
this
.
data
.
curVideoU
rl
,
success
(
res
)
{
if
(
res
.
statusCode
===
200
)
{
wx
.
saveVideoToPhotosAlbum
({
filePath
:
res
.
tempFilePath
,
success
(
res
)
{
success
(
res
p
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
}
})
...
...
@@ -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
(){
let
query
=
wx
.
createSelectorQuery
().
in
(
this
)
let
heightArr
=
[]
...
...
pages/tab/discovery/components/product/product.json
View file @
e5fc9f5
{
"component"
:
true
,
"usingComponents"
:
{
"tab"
:
"../../../../../components/Tab/Tab"
}
}
\ No newline at end of file
pages/tab/discovery/components/product/product.scss
View file @
e5fc9f5
...
...
@@ -13,8 +13,9 @@
white-space
:
nowrap
;
box-sizing
:
border-box
;
margin-top
:
24rpx
;
margin-bottom
:
32
rpx
;
margin-bottom
:
10
rpx
;
padding
:
0
20rpx
;
height
:
86rpx
;
}
.prod-wrap
.nav-wrap
.nav
{
...
...
@@ -305,15 +306,15 @@
}
.download
{
position
:
absolute
;
top
:
8
rpx
;
right
:
8
rpx
;
top
:
16
rpx
;
right
:
16
rpx
;
z-index
:
1
;
width
:
5
0rpx
;
width
:
4
0rpx
;
height
:
50rpx
;
}
.video-item
video
{
width
:
100%
;
height
:
59
0
rpx
;
height
:
59
2
rpx
;
}
.video-item
:nth-child
(
even
)
{
margin-left
:
22rpx
;
...
...
@@ -331,4 +332,55 @@
font-size
:
28rpx
;
color
:
rgba
(
255
,
255
,
255
,.
6
);
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
pages/tab/discovery/components/product/product.wxml
View file @
e5fc9f5
<view class="prod-wrap">
<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">
<
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>
</scroll-view>
<view class="prod-item">
...
...
@@ -14,7 +14,7 @@
<view class="prod-info">
<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 class="earnings" decode="{{true}}">预估收益 <text class="earnings-num"><text style="font-size: 24rpx; margin-right: 4rpx;">¥</text>{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text>
...
...
@@ -29,9 +29,17 @@
</view>
<view class="project-wrap">
<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>
<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">
<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" />
...
...
@@ -49,4 +57,7 @@
</view>
</block>
</scroll-view>
</view>
\ 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 = [
type
:
'service'
,
productType
:
'benefitCard'
,
path
:
'equity'
,
flow
:
10000
,
sale
:
100
,
//销量
varType
:
0
}
...
...
@@ -54,10 +55,11 @@ var senceData = [
img
:
'product-img2'
,
proName
:
'汽车太阳膜'
,
price
:
'1500'
,
profit
:
'1008000
0
'
,
profit
:
'1008000'
,
type
:
'membrane'
,
productType
:
'sunMembrane'
,
path
:
'solarFilm'
,
flow
:
10000
,
sale
:
100
,
//销量
varType
:
0
}
...
...
@@ -86,8 +88,9 @@ var senceData = [
type
:
'membrane'
,
productType
:
'protectMembrane'
,
path
:
'paintProtect'
,
flow
:
10000
,
sale
:
100
,
//销量
varType
:
1
varType
:
0
},
{
img
:
'product-img4'
,
...
...
@@ -97,8 +100,9 @@ var senceData = [
type
:
'membrane'
,
productType
:
'colorMembrane'
,
path
:
'changingFilm'
,
flow
:
10000
,
sale
:
100
,
//销量
varType
:
1
varType
:
0
}
]
},
...
...
@@ -114,10 +118,11 @@ var senceData = [
img
:
'product-img5'
,
proName
:
'数字化美容'
,
price
:
'300'
,
profit
:
'
360
000'
,
profit
:
'
72
000'
,
type
:
'beauty'
,
productType
:
'digitBeauty'
,
path
:
'carBeauty'
,
flow
:
10000
,
sale
:
100
,
//销量
varType
:
0
},
...
...
@@ -125,11 +130,12 @@ var senceData = [
img
:
'product-img6'
,
proName
:
'座椅通风'
,
price
:
'1500'
,
profit
:
'
100800
00'
,
profit
:
'
2322
00'
,
type
:
'light'
,
productType
:
'chair'
,
path
:
'seatVentilate'
,
sale
:
10000
,
//销量
flow
:
10000
,
sale
:
10000
,
//销量
varType
:
1
},
{
...
...
@@ -140,6 +146,7 @@ var senceData = [
type
:
'light'
,
productType
:
'ar'
,
path
:
'arNavigation'
,
flow
:
10000
,
sale
:
10000
,
//销量
varType
:
1
},
...
...
@@ -151,6 +158,7 @@ var senceData = [
type
:
'light'
,
productType
:
'lamp'
,
path
:
'ambientLighting'
,
flow
:
10000
,
sale
:
10000
,
//销量
varType
:
1
},
...
...
@@ -162,6 +170,7 @@ var senceData = [
type
:
'service'
,
productType
:
'navigation'
,
path
:
'navigationArround'
,
flow
:
10000
,
sale
:
10000
,
//销量
varType
:
1
}
...
...
pages/tab/discovery/discovery.js
View file @
e5fc9f5
...
...
@@ -10,7 +10,7 @@ Page({
data
:
{
senceData
,
headerHeight
:
0
,
actNum
:
3
,
actNum
:
0
,
navStyle
,
// 预估弹框
visible
:
false
,
...
...
@@ -27,7 +27,8 @@ Page({
changeSale
:
0
,
sceneCodeList
:[],
currentId
:
0
,
showPage
:
false
showPage
:
false
,
showAuth
:
false
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -45,14 +46,14 @@ Page({
let
sceneCodeList
=
[]
let
senceData
=
[...
this
.
data
.
senceData
]
// let res = [
//
{
//
sceneCode: 'SC001',
// status: 1
//
},
//
{
//
sceneCode: 'SC002',
//
status: 1
//
},
//
{
//
sceneCode: 'SC001',
// status: 0
//
},
//
{
//
sceneCode: 'SC002',
//
status: 1
//
},
// {
// sceneCode: 'SC003',
// status: 1
...
...
@@ -66,22 +67,17 @@ Page({
if
(
item
.
status
==
1
)
{
let
sceneTarget
=
senceData
.
find
(
sitem
=>
sitem
.
sceneCode
==
item
.
sceneCode
)
sceneTarget
.
show
=
1
}
})
senceData
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
show
==
1
)
{
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
;
if
(
sceneCodeList
?.
length
){
if
(
idx
>-
1
){
actNum
=
3
currentId
=
idx
}
else
{
actNum
=
senceData
.
findIndex
(
item
=>
item
.
sceneCode
==
sceneCodeList
[
0
])
}
actNum
=
senceData
.
findIndex
(
item
=>
item
.
sceneCode
==
sceneCodeList
[
0
])
}
this
.
setData
({
sceneCodeList
,
...
...
@@ -177,6 +173,7 @@ Page({
let
sales
=
e
?
+
e
.
detail
.
value
.
sales
:
this
.
data
.
formData
.
sales
;
let
flow
=
e
?
+
e
.
detail
.
value
.
flow
:
this
.
data
.
formData
.
flow
;
const
reg
=
/^
[
1-9
]\d
*$/
;
console
.
log
(
'flow'
,
sales
,
flow
)
if
(
!
reg
.
test
(
sales
))
{
wx
.
showToast
({
title
:
"门店月平均新车销量应为正整数"
,
...
...
@@ -204,11 +201,13 @@ Page({
// let name = `senceData[${index}].productList[${lastIndex}].profit`;
let
sale
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].sale`
;
let
name
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].profit`
;
let
flowKey
=
`senceData[
${
index
}
].productList[
${
lastIndex
}
].flow`
// let changeSale = `senceData[${index}].productList[${lastIndex}].changeSale`;
let
profit
=
_this
.
formula
(
i
.
productType
,
sales
,
flow
);
this
.
setData
({
[
name
]:
profit
,
[
sale
]:
sales
[
sale
]:
sales
,
[
flowKey
]:
flow
// [changeSale]: sales,
});
}
...
...
@@ -219,19 +218,18 @@ Page({
visible
:
false
,
});
// this.showCase();
if
(
!
this
.
data
.
isFirst
)
{
//
if (!this.data.isFirst) {
wx
.
showToast
({
title
:
"测算结果已在页面内同步展示"
,
icon
:
"none"
,
duration
:
2000
,
});
}
else
{
this
.
setData
({
isFirst
:
false
,
});
}
//
} else {
//
this.setData({
//
isFirst: false,
//
});
//
}
},
formula
(
productType
,
sales
,
flow
)
{
let
profit
=
0
;
switch
(
productType
)
{
...
...
pages/tab/discovery/discovery.scss
View file @
e5fc9f5
...
...
@@ -4,6 +4,11 @@ page{
}
.container
{
position
:
relative
;
.bar-text
{
font-weight
:
600
;
font-size
:
34rpx
;
color
:
#2D2D2E
;
}
.header
{
padding-bottom
:
8px
;
}
...
...
pages/tab/discovery/discovery.wxml
View file @
e5fc9f5
<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>
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text>
<text
class="bar-text"
>发现</text>
</navigation-bar>
<block wx:if="{{sceneCodeList.length>0 && showPage}}">
<view style="padding-top: {{headerHeight}}px;">
<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">
<swiper-item item-id="{{index}}" wx:if="{{item.show}}">
<image class="scene-img" src="{{IMGURL}}{{item.img}}"></image>
...
...
@@ -30,8 +30,8 @@
<view class="dialog-box">
<form bindsubmit="submit">
<view class="dialog-header">
<view
hidden="{{
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="showCalculate">取消</view>
<view
wx:if="{{
isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
<view class="dialog-content">
...
...
utils/cache/storage.js
View file @
e5fc9f5
...
...
@@ -97,9 +97,9 @@ class Storage {
*
* @param {*} key | 要操作的键值
* @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
)
if
(
tmpKey
)
{
tmpKey
=
this
.
addEvnToKey
(
tmpKey
)
...
...
utils/request/request.js
View file @
e5fc9f5
...
...
@@ -53,6 +53,8 @@ class Request {
data
}
=
response
if
(
code
==
20
||
code
==
21
)
{
wx
.
$storage
.
rm
(
'sessionId'
)
wx
.
$storage
.
rm
(
'userInfo'
)
const
thisPage
=
wx
.
$router
.
getPageInstance
()
if
(
thisPage
.
route
==
'pages/authentication/loading/loading'
)
{
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