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 f1b8a27f
authored
Oct 26, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分享页需求变更
1 parent
d624bdde
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
176 additions
and
89 deletions
pages/checkProduct/checkProduct.js
pages/checkProduct/checkProduct.scss
pages/checkProduct/checkProduct.wxml
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.wxml
pages/checkProduct/checkProduct.js
View file @
f1b8a27
...
...
@@ -22,13 +22,13 @@ Page({
btnList
:
[
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"微信转发"
,
},
{
src
:
`
${
IMGURL
}
down.png`
,
name
:
"下载
为
海报"
,
name
:
"下载海报"
,
},
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"转发给好友"
,
}
],
posterUrl
:
""
,
//海报url
},
...
...
@@ -69,7 +69,6 @@ Page({
activeNavIdx
,
fromLocal
})
this
.
createImg
()
},
createImg
(){
if
(
this
.
data
.
isShow
&&
this
.
data
.
fromLocal
==
1
){
...
...
@@ -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
=
[
{
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
im
g
List
=
[
//
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
im
age
List
=
[
{
x
:
1
0
,
y
:
1
0
,
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,15 +199,17 @@ Page({
},
// 下载海报
download
()
{
if
(
this
.
data
.
posterUrl
){
wx
.
saveImageToPhotosAlbum
({
filePath
:
this
.
data
.
posterUrl
,
//仅为示例,并非真实的资源
success
(
res
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
wx
.
showModal
({
content
:
'确认下载海报?'
,
success
:
(
res
)
=>
{
console
.
log
(
res
)
if
(
res
.
confirm
){
this
.
createImg
()
}
})
}
this
.
modelClose
();
},
fail
:
(
res
)
=>
{},
complete
:
(
res
)
=>
{},
})
},
//模态框关闭
modelClose
()
{
...
...
pages/checkProduct/checkProduct.scss
View file @
f1b8a27
...
...
@@ -72,4 +72,66 @@ page{
text-align
:
center
;
}
}
}
.btns-wrap
{
padding-bottom
:
84rpx
;
position
:
fixed
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
height
:
120rpx
;
background
:
#ffffff
;
// border-radius: 8px 8px 0 0;
.top
{
display
:
flex
;
justify-content
:
space-around
;
.btn
{
padding-top
:
16px
;
}
.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 @
f1b8a27
<!--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}}"/>
<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}}">
<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 +21,18 @@
</view>
<view class="btom" bindtap="modelClose">取消</view>
</view>
</view> -->
<view class="btns-wrap">
<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>
pages/tab/discovery/components/product/product.scss
View file @
f1b8a27
...
...
@@ -13,8 +13,9 @@
white-space
:
nowrap
;
box-sizing
:
border-box
;
margin-top
:
24rpx
;
margin-bottom
:
32
rpx
;
margin-bottom
:
16
rpx
;
padding
:
0
20rpx
;
height
:
80rpx
;
}
.prod-wrap
.nav-wrap
.nav
{
...
...
pages/tab/discovery/components/product/product.wxml
View file @
f1b8a27
<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>
...
...
pages/tab/discovery/constant/data.js
View file @
f1b8a27
...
...
@@ -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 @
f1b8a27
...
...
@@ -177,6 +177,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 +205,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 +222,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.wxml
View file @
f1b8a27
...
...
@@ -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">
...
...
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