Commit 83801dbb by 前端

Merge branch 'zq_dev_3.0' into 'v3.0'

分享页需求变更

See merge request !80
2 parents 4447929c f1b8a27f
...@@ -22,13 +22,13 @@ Page({ ...@@ -22,13 +22,13 @@ Page({
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,7 +69,6 @@ Page({ ...@@ -69,7 +69,6 @@ Page({
activeNavIdx, activeNavIdx,
fromLocal fromLocal
}) })
this.createImg()
}, },
createImg(){ createImg(){
if(this.data.isShow && this.data.fromLocal==1){ if(this.data.isShow && this.data.fromLocal==1){
...@@ -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, // x: imgW/4+22,
y: 15, // y: 15,
text: senceData[actNum].productList[activeNavIdx].proName, // text: senceData[actNum].productList[activeNavIdx].proName,
textBaseline: 'top' // textBaseline: 'top'
}, // },
{ // {
x: imgW/4+22, // x: imgW/4+22,
y: (imgW/4+12)/2, // y: (imgW/4+12)/2,
color: '#7A8299', // color: '#7A8299',
text: `${senceData[actNum].productList[activeNavIdx].varType==1?'三年售后存量数':'新车销量'} ${senceData[actNum].productList[activeNavIdx].sale}`, // text: `${senceData[actNum].productList[activeNavIdx].varType==1?'三年售后存量数':'新车销量'} ${senceData[actNum].productList[activeNavIdx].sale}`,
}, // },
{ // {
x: imgW/4+22, // x: imgW/4+22,
y: imgW/4, // y: imgW/4,
text: '预估收益', // text: '预估收益',
maxWidth: 50, // maxWidth: 50,
color: '#7A8299' // color: '#7A8299'
}, // },
{ // {
x: imgW/4+77, // x: imgW/4+77,
y: imgW/4, // y: imgW/4,
text: `¥${senceData[actNum].productList[activeNavIdx].profit}`, // text: `¥${senceData[actNum].productList[activeNavIdx].profit}`,
color: '#F35251', // color: '#F35251',
fontSize: 14, // fontSize: 14,
fontWeight: 500 // fontWeight: 500
} // }
] // ]
let imgList = [ let imageList = [
{ {
x: 10, x: 0,
y: 10, y: 0,
width: imgW/4, width: imgW,
height: imgW/4+2, height: pradH,
url: `${IMGURL}prod/${senceData[actNum].productList[activeNavIdx].img}.png`, url: `${IMGURL}canvas/${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,15 +199,17 @@ Page({ ...@@ -193,15 +199,17 @@ Page({
}, },
// 下载海报 // 下载海报
download() { download() {
if(this.data.posterUrl){ wx.showModal({
wx.saveImageToPhotosAlbum({ content: '确认下载海报?',
filePath: this.data.posterUrl, //仅为示例,并非真实的资源 success: (res) => {
success (res) { console.log(res)
wx.$api.showToast('下载成功!') if(res.confirm){
this.createImg()
} }
},
fail: (res) => {},
complete: (res) => {},
}) })
}
this.modelClose();
}, },
//模态框关闭 //模态框关闭
modelClose() { modelClose() {
......
...@@ -73,3 +73,65 @@ page{ ...@@ -73,3 +73,65 @@ page{
} }
} }
} }
.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 \ No newline at end of file
<!--pages/checkProduct/checkProduct.wxml--> <product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- <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 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 +21,18 @@ ...@@ -30,4 +21,18 @@
</view> </view>
<view class="btom" bindtap="modelClose">取消</view> <view class="btom" bindtap="modelClose">取消</view>
</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> </view>
...@@ -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: 32rpx; margin-bottom: 16rpx;
padding: 0 20rpx; padding: 0 20rpx;
height: 80rpx;
} }
.prod-wrap .nav-wrap .nav { .prod-wrap .nav-wrap .nav {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<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 ? '三年售后存量数':'新车销量'}}&nbsp;<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 ? '三年售后存量数':'新车销量'}}&nbsp;<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}}">预估收益&nbsp;<text class="earnings-num"><text style="font-size: 24rpx; margin-right: 4rpx;">¥</text>{{senceData[actNum]['productList'][activeNavIdx].profit}}</text> <text class="earnings" decode="{{true}}">预估收益&nbsp;<text class="earnings-num"><text style="font-size: 24rpx; margin-right: 4rpx;">¥</text>{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text> </text>
......
...@@ -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: '10080000', 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: '360000', profit: '72000',
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: '10080000', profit: '232200',
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
} }
......
...@@ -177,6 +177,7 @@ Page({ ...@@ -177,6 +177,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 +205,13 @@ Page({ ...@@ -204,11 +205,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 +222,18 @@ Page({ ...@@ -219,19 +222,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) {
......
...@@ -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">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!