Commit 1fa2c11e by luyt

feat;预估产值添加

1 parent a234637c
......@@ -10,6 +10,7 @@ Component({
properties: {
stickyTop: Number,
actNum: Number,
senceData:Object,
},
/**
......@@ -75,6 +76,7 @@ Component({
navList,
tab,
intoViewId: `to-0`,
activeNavIdx: 0,
});
// 每次切换场景,重新获取流程图高度
this.getImgHeight();
......@@ -85,6 +87,9 @@ Component({
* 组件的方法列表
*/
methods: {
saleTextChange(e){
},
changeTab(e) {
let idx = e.detail;
this.setData({
......
......@@ -15,9 +15,9 @@
<view class="prod-info">
<text class="title">360全景导航</text>
<text class="sale">新车销量 <text class="sale-num">100</text>
<text class="sale">新车销量 <text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].changeSale || senceData[actNum]['productList'][activeNavIdx].sale}}</text>
</text>
<text class="earnings">预估收益 <text class="earnings-num">92.4 万</text>
<text class="earnings">预估收益 <text class="earnings-num">{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text>
</view>
......
const navStyle = "background-color: transparent;";
import { IMG_URL } from "~/utils/constantData.js";
import pageData from "./constant/data";
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = "../../../images/";
......@@ -40,7 +42,7 @@ Page({
],
actNum: 0,
tabIndx: 1,
tabList: ["看线索", "看产品"],
navList: ["看线索", "看产品"],
typeList: ["联系电话", "意向客户", "线索来源", "重置"],
clueList: [
{
......@@ -144,7 +146,24 @@ Page({
},
],
filterType: "", //看线索过滤类型
// 预估弹框
visible: false,
isReset: false,
formData: {
sales: 100,
flow: 10000,
},
lastFormData: {
sales: 100,
flow: 10000,
},
isFirst: true,
// tabList: pageData.tabList,
// 定义数据
senceData: pageData.senceData,
changeSale: 0, //每次改变的销量
},
//引导图
guideFn() {
if (this.data.guideSrcIndex === 5) {
......@@ -202,6 +221,190 @@ Page({
[completeStatus]: !this.data.clueList[index].getMoreFlag,
});
},
// 跳转咨询页面
goConsult() {
console.log("跳转到咨询页面");
wx.pro.openCustomerServiceChat({
extInfo: { url: "https://work.weixin.qq.com/kfid/kfcf7b721472201345e" },
corpId: "ww047bdc0f1e76cc13",
complete: (r) => {
console.log(r);
},
});
},
// 预估弹框
showCalculate() {
this.setData({
visible: !this.data.visible,
isReset: false,
});
},
clickDialog(e) {
console.log(e.changedTouches[0].clientY);
if (e.changedTouches[0].clientY < 352) {
this.setData({
visible: false,
isReset: false,
formData: this.data.lastFormData,
});
}
},
// 提交测算
submit(e) {
console.log(e);
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(reg.test(sales), flow, "---");
if (!reg.test(sales)) {
wx.showToast({
title: "门店月平均新车销量应为正整数",
icon: "none",
duration: 2000,
});
return;
}
if (!reg.test(flow)) {
wx.showToast({
title: "3年内售后存量用户应为正整数",
icon: "none",
duration: 2000,
});
return;
}
this.setData({
"lastFormData.sales": sales,
"lastFormData.flow": flow,
});
const _this = this;
// this.data.tabList.forEach((item, index) => {
// item.productList.forEach((i, lastIndex) => {
// if (i.profit) {
// let name = `tabList[${index}].productList[${lastIndex}].profit`;
// let profit = _this.formula(i.productType, sales, flow);
// console.log(name, profit);
// this.setData({
// [name]: profit,
// });
// }
// });
// });
this.data.senceData.forEach((item, index) => {
item.productList.forEach((i, lastIndex) => {
if (i.profit) {
// let name = `senceData[${index}].productList[${lastIndex}].profit`;
let sale = `senceData[${index}].productList[${lastIndex}].sale`;
let name = `senceData[${index}].productList[${lastIndex}].profit`;
// let changeSale = `senceData[${index}].productList[${lastIndex}].changeSale`;
let profit = _this.formula(i.productType, sales, flow);
console.log(name, profit);
this.setData({
[name]: profit,
[sale]:sales
// [changeSale]: sales,
});
}
});
});
// 触发自定义事件 利润 数量
// this.triggerEvent('countProfit', profit, sales)
// let type = this.getProductType(sceneIndex, tabIndex);
// let profit = this.formula(type, sales, flow);
// console.log('profit: ', profit);
this.setData({
visible: false,
});
// this.showCase();
if (!this.data.isFirst) {
wx.showToast({
title: "测算结果已在页面内同步展示",
icon: "none",
duration: 2000,
});
} else {
this.setData({
isFirst: false,
});
}
},
// // 获取场景下的产品类型
// getProductType(sceneIndex, tabIndex) {
// let typeArray = [
// ["benefitCard"], //数字无忧权益卡
// ["sunMembrane"], //汽车太阳膜
// ["protectMembrane", "colorMembrane"], //'漆面保护膜','改色膜'
// ["digitBeauty", "chair", "ar", "lamp", "navigation"], //'数字化美容','座椅通风','AR导航','氛围灯','360全景导航'
// ];
// return typeArray[sceneIndex][tabIndex];
// },
// 计算公式,参数:productType
formula(productType, sales, flow) {
let profit = 0;
switch (productType) {
case "benefitCard":
// 数字无忧权益卡
profit = (sales * 0.5 * 2000 * 12).toFixed(0);
break;
case "sunMembrane":
// 汽车太阳膜
profit = (sales * 0.8 * 0.7 * 1500 * 12).toFixed(0);
break;
case "protectMembrane":
// 漆面保护膜
profit = (flow * 0.15 * 12000 * 12).toFixed(0);
break;
case "colorMembrane":
// 改色膜
profit = (flow * 0.05 * 5000 * 12).toFixed(0);
break;
case "digitBeauty":
// 数字化美容
profit = (sales * 0.2 * 300 * 12).toFixed(0);
break;
case "chair":
// 座椅通风
profit = (flow * 2580 * 0.9 * 0.01).toFixed(0);
break;
case "ar":
// AR导航
profit = (flow * 1680 * 0.9 * 0.015).toFixed(0);
break;
case "lamp":
// 氛围灯
profit = (flow * 2680 * 0.9 * 0.015).toFixed(0);
break;
case "navigation":
// 360全景导航
profit = (flow * 2880 * 0.9 * 0.015).toFixed(0);
break;
}
console.log(profit.length);
console.log(productType, sales, flow, profit);
if (profit.length > 6) {
return (profit / 10000).toFixed(0) + "万";
} else {
return profit;
}
},
reset() {
this.setData({
isReset: false,
formData: {
sales: 100,
flow: 10000,
},
});
},
focus() {
this.setData({
isReset: true,
});
return false;
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -289,10 +492,6 @@ Page({
let { phone } = e.currentTarget.dataset;
wx.$api.setCopyData(phone);
},
// 聊天
chatFn() {},
// 估值
valuationFn() {},
/**
* 生命周期函数--监听页面显示
*/
......
......@@ -325,3 +325,107 @@ page {
border-radius: 50%;
z-index: 1;
}
/* 测算弹窗 */
.dialog-wrapper {
position: fixed;
height: 100vh;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(45,45,51,0.50);
z-index: 1;
.dialog-box {
position: fixed;
bottom: 0;
width: 100%;
height: 744rpx;
background-color: #fff;
box-shadow: 0 -8rpx 20rpx 0 rgba(180,186,204,0.32);
border-radius: 32rpx 32rpx 0 0;
}
.dialog-header {
display: flex;
justify-content: space-between;
padding: 32rpx 48rpx;
border-bottom: 1rpx solid #eee;
}
.header-btn {
display: inline-block;
font-size: 32rpx;
line-height: 48rpx;
}
.btn-gray {
color: #6C737A;
}
.btn-primary {
background-color: #fff;
border: none;
margin: 0;
padding: 0;
font-weight: 500;
color: #5850FF;
}
.btn-primary::after {
border: none;
}
.dialog-content {
padding: 40rpx 24rpx 60rpx;
}
.dialog-title {
font-weight: 600;
font-size: 36rpx;
color: #333333;
letter-spacing: 0;
text-align: center;
line-height: 56rpx;
margin-bottom: 24rpx;
}
.dialog-form {
width: 100%;
height: 384rpx;
background-image: linear-gradient(179deg, rgba(123,112,255,0.02) 15%, rgba(99,92,255,0.10) 100%);
border-radius: 8rpx;
padding: 32rpx;
box-sizing: border-box;
}
.form-item {
display: flex;
align-items: center;
height: 80rpx;
margin-bottom: 24rpx;
justify-content: space-between;
}
.form-label {
width: 256rpx;
font-size: 28rpx;
color: #2D2D33;
}
.form-input {
width: 216rpx;
padding: 16rpx 20rpx;
border: 2rpx solid #E6E6E6;
border-radius: 4rpx;
margin-left: 64rpx;
margin-right: 16rpx;
}
.form-unit {
font-size: 28rpx;
color: #6E6E7A;
}
.dialog-btn {
width: 100%;
padding: 24rpx 0;
box-sizing: border-box;
background: #5850FF;
border-radius: 8rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
letter-spacing: 0.8rpx;
text-align: center;
line-height: 48rpx;
margin-top: 40rpx;
}
}
<wxs src="./index.wxs" module="filterUtils" />
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}">拓客户</navigation-bar>
<view class="reclaim">
<!-- 头部 -->
<view class="header-wrap" style="height:{{headerHeight}}rpx; background-image: url('{{IMG_URL}}index/head.png')">
<view class="header">
<tab tab="{{tabList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" bindclick="changeTabIndx" class="tabContainer" />
<tab tab="{{navList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" bindclick="changeTabIndx" class="tabContainer" />
<view class="right" bindtap="gotoApply">
<image class="img" src="{{IMG_URL}}index/apply.png" />
<view class="apply">申请业务</view>
</view>
</view>
</view>
<!-- 托客户内容 -->
<view class="content" wx:if="{{tabIndx == 1 }}" hover-class="none" hover-stop-propagation="false">
<view class="scene">
<view class="item-wrap {{actNum== index ? 'act':''}}" data-num="{{index}}" bindtap="selectCar" wx:for="{{dataArr}}" wx:key="name">
......@@ -20,8 +22,9 @@
</view>
</view>
</view>
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" />
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" />
</view>
<!-- 看线索内容 -->
<view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false">
<view class="types">
<view class="type" wx:for="{{typeList}}" wx:key="*this" data-index="{{index}}" bindtap="filterTypeFn">
......@@ -114,10 +117,42 @@
</view>
</view>
</view>
<!-- 收藏、取消提示框 -->
<vas-toast isShow="{{true}}" id='toast' />
<!-- 引导图 -->
<view class="guide" wx:if="{{guideShow}}">
<image bindtap="guideFn" class="guide-img" src="{{IMG_URL}}index/guide{{guideSrcIndex}}.png" />
</view>
<image class="chat" bindtap="chatFn" src="{{IMG_URL}}index/contact.png" />
<image class="output-value" bindtap="valuationFn" src="{{IMG_URL}}index/valuation.png" />
<!-- 在线客服 -->
<image class="chat" src="{{IMG_URL}}index/contact.png" bindtap="goConsult" />
<!-- 预估产值 -->
<image class="output-value" bindtap="showCalculate" src="{{IMG_URL}}index/valuation.png" />
<!-- 预估产值弹框 -->
<view class="dialog-wrapper" bindtap="clickDialog" hidden="{{!visible}}">
<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>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
<view class="dialog-content">
<view class="dialog-title">输入您门店的基本情况</view>
<view class="dialog-form">
<view class="form-item">
<view class="form-label">门店月平均新车销量</view>
<input class="form-input" bindfocus="focus" maxlength="8" name="sales" value="{{formData.sales}}" type="number" />
<!-- <view class="form-unit">台</view> -->
</view>
<view class="form-item">
<view class="form-label">3年内售后存量用户</view>
<input class="form-input" bindfocus="focus" maxlength="8" name="flow" type="number" value="{{formData.flow}}" />
<!-- <view class="form-unit">人</view> -->
</view>
<button class="dialog-btn" form-type="submit">提交测算</button>
</view>
</view>
</form>
</view>
</view>
<!-- <chat></chat> -->
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!