Commit 6f500de2 by 前端

申请页面跳转

1 parent 2b15bc04
const navStyle = 'background-color: transparent;'
const navStyle = "background-color: transparent;";
import util from "../../utils/util";
// import { IMG_URL } from '~/utils/constantData.js'
// wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
import { senceData } from './constant/data'
import { senceData } from "./constant/data";
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = '../../../images/'
let IMG_URLLocal = "../../../images/";
// import { productBysceneApi, unreadApi, pageApi, readApi, tagApi } from '~/api/index.js'
let IMG_URL = wx.$imgUrl
let IMG_URL = wx.$imgUrl;
Page({
// behaviors: [kfMixin],
/**
......@@ -19,61 +19,62 @@ Page({
// IMGURL: wx.$imgUrl,
IMG_URL,
// IMG_URLLocal,
actClass: 'right',
actClass: "right",
guideSrcIndex: 1,
guideShow: false,
dataArr: [
{
src: `${IMG_URL}index/car1.png`,
name: '新车洽谈场景',
msg: '1.0 新车权益销售'
name: "新车洽谈场景",
msg: "1.0 新车权益销售",
},
{
src: `${IMG_URL}index/car2.png`,
name: '新车交付场景',
msg: '1.1 新车精品升级'
name: "新车交付场景",
msg: "1.1 新车精品升级",
},
{
src: `${IMG_URL}index/car3.png`,
name: '0-12个月',
msg: '1.2 新车线上转化'
name: "0-12个月",
msg: "1.2 新车线上转化",
},
{
src: `${IMG_URL}index/car4.png`,
name: '12个月以上',
msg: '1.3 存量用户众筹'
}
name: "12个月以上",
msg: "1.3 存量用户众筹",
},
],
apiData: [],
actNum: 3, //car 场景选择
wrapactiveNavIdx: 0, // 产品选择
tabIndx: 1,
navList: ['看线索', '看产品'],
navList: ["看线索", "看产品"],
typeList: [
{
0: '无电话',
1: '有电话',
2: '联系电话',
0: "无电话",
1: "有电话",
2: "联系电话",
selectIndex: 2,
key: 'hasPhone'
key: "hasPhone",
},
{
0: '非意向客户',
1: '是意向客户',
2: '意向客户',
0: "非意向客户",
1: "是意向客户",
2: "意向客户",
selectIndex: 2,
key: 'starTag'
key: "starTag",
},
{
0: '来自访客',
1: '来自门店',
2: '线索来源',
0: "来自访客",
1: "来自门店",
2: "线索来源",
selectIndex: 2,
key: 'clueSource'
key: "clueSource",
},
{
2: '重置',
selectIndex: 2
}
2: "重置",
selectIndex: 2,
},
],
clueList: [],
// 预估弹框
......@@ -81,11 +82,11 @@ Page({
isReset: false,
formData: {
sales: 100,
flow: 10000
flow: 10000,
},
lastFormData: {
sales: 100,
flow: 10000
flow: 10000,
},
isFirst: true,
// tabList: pageData.tabList,
......@@ -96,30 +97,30 @@ Page({
unreadClueCount: 0,
cluePageSize: 10,
clueCurrentPage: 1,
hasPhoneNumber: false
hasPhoneNumber: false,
},
//引导图
guideFn() {
if (this.data.guideSrcIndex === 5) {
this.setData({
guideShow: false
})
return
guideShow: false,
});
return;
}
this.setData({
guideSrcIndex: ++this.data.guideSrcIndex
})
guideSrcIndex: ++this.data.guideSrcIndex,
});
// console.log('guideSrcIndex',this.data.guideSrcIndex)
},
// navbar高度设置
navbarReady(e) {
let { height, statusBarHeight } = e.detail
let { height, statusBarHeight } = e.detail;
this.setData({
// tabBarStyle: height / 2 + statusBarHeight,
headerHeight: height / 2 + statusBarHeight + 88,
// headerHeight: height / 2 + statusBarHeight + 88 * 2
})
});
// console.log(e)
// console.log(this.data.headerHeight)
},
......@@ -132,56 +133,56 @@ Page({
// },
// 选车场景切换
selectCar(e) {
console.log('e: ', e)
let { num, scenestatus } = e.currentTarget.dataset
console.log("e: ", e);
let { num, scenestatus } = e.currentTarget.dataset;
// console.log('actNum: ', actNum);
// if(scenestatus == 1){
// }
this.setData({
actNum: num
})
actNum: num,
});
},
// 头部看线索,产品切换
changeTabIndx(e) {
console.log('e.detail: ', e.detail)
let { sessionId } = wx.$storage.get()
console.log("e.detail: ", e.detail);
let { sessionId } = wx.$storage.get();
// console.log("sessionId: ", sessionId);
let param = {
sessionId
}
sessionId,
};
let first = true
let first = true;
this.setData({
tabIndx: e.detail
})
tabIndx: e.detail,
});
//标记线索已读
if (e.detail == 0 && first) {
first = false
readApi(param)
first = false;
readApi(param);
}
},
gotoApply(e) {
let { type, item } = e.currentTarget.dataset
let { type, item } = e.currentTarget.dataset;
// let { } = e.currentTarget.dataset
if (type == 'active') {
let { userInfo } = wx.$storage.get()
let pMerchantName = userInfo.subLoginUser.merchantName
let pMerchantId = userInfo.subLoginUser.merchantId
let sceneActive
if (type == "active") {
let { userInfo } = wx.$storage.get();
let pMerchantName = userInfo.subLoginUser.merchantName;
let pMerchantId = userInfo.subLoginUser.merchantId;
let sceneActive;
switch (this.data.actNum) {
case 0:
sceneActive = 1
break
sceneActive = 1;
break;
case 1:
sceneActive = 2
break
sceneActive = 2;
break;
case 2:
sceneActive = 3
break
sceneActive = 3;
break;
case 3:
sceneActive = 4
break
sceneActive = 4;
break;
}
// let pMerchantId = userInfo.subLoginUser.merchantId
......@@ -191,86 +192,86 @@ Page({
pMerchantId,
pMerchantName,
merchantId: item.visitList[0].merchantId,
merchantName: item.visitList[0].merchantName
merchantName: item.visitList[0].merchantName,
},
sceneActive
sceneActive,
// sceneCodeList: ['SC001', 'SC002','SC003','SC004']
}
};
//申请活动
wx.$router.go('packageOutput.openBusiness', params)
wx.$router.go("packageOutput.openBusiness", params);
} else {
//申请门店
// let { type, item } = e.currentTarget.dataset
wx.$router.go('apply', item?.clueId || '')
wx.$router.go("apply", item?.clueId || "");
}
// wx.$router.go('apply',1235)
},
getMore(e) {
console.log('显示更多数据')
let index = e.currentTarget.dataset.outidx
console.log('index: ', index)
let completeStatus = `clueList[${index}].getMoreFlag`
console.log("显示更多数据");
let index = e.currentTarget.dataset.outidx;
console.log("index: ", index);
let completeStatus = `clueList[${index}].getMoreFlag`;
this.setData({
[completeStatus]: !this.data.clueList[index].getMoreFlag
})
[completeStatus]: !this.data.clueList[index].getMoreFlag,
});
},
// 跳转咨询页面
goConsult() {
console.log('跳转到咨询页面')
console.log("跳转到咨询页面");
wx.pro.openCustomerServiceChat({
extInfo: { url: 'https://work.weixin.qq.com/kfid/kfcf7b721472201345e' },
corpId: 'ww047bdc0f1e76cc13',
complete: r => {
console.log(r)
}
})
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
})
isReset: false,
});
},
clickDialog(e) {
console.log(e.changedTouches[0].clientY)
console.log(e.changedTouches[0].clientY);
if (e.changedTouches[0].clientY < 471) {
this.setData({
visible: false,
isReset: false,
formData: this.data.lastFormData
})
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
console.log('flow', sales, flow)
const reg = /^[1-9]\d*$/
console.log(reg.test(sales), flow, '---')
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;
console.log("flow", sales, flow);
const reg = /^[1-9]\d*$/;
console.log(reg.test(sales), flow, "---");
if (!reg.test(sales)) {
wx.showToast({
title: '门店月平均新车销量应为正整数',
icon: 'none',
duration: 2000
})
return
title: "门店月平均新车销量应为正整数",
icon: "none",
duration: 2000,
});
return;
}
if (!reg.test(flow)) {
wx.showToast({
title: '3年内售后存量用户应为正整数',
icon: 'none',
duration: 2000
})
return
title: "3年内售后存量用户应为正整数",
icon: "none",
duration: 2000,
});
return;
}
this.setData({
'lastFormData.sales': sales,
'lastFormData.flow': flow
})
const _this = this
"lastFormData.sales": sales,
"lastFormData.flow": flow,
});
const _this = this;
// this.data.tabList.forEach((item, index) => {
// item.productList.forEach((i, lastIndex) => {
// if (i.profit) {
......@@ -287,19 +288,19 @@ Page({
this.data.senceData.forEach((item, index) => {
item.productList.forEach((i, lastIndex) => {
if (i.profit) {
let sale = `senceData[${index}].productList[${lastIndex}].sale`
let name = `senceData[${index}].productList[${lastIndex}].profit`
let flowKey = `senceData[${index}].productList[${lastIndex}].flow`
let profit = _this.formula(i.productType, sales, flow)
console.log(name, profit)
let sale = `senceData[${index}].productList[${lastIndex}].sale`;
let name = `senceData[${index}].productList[${lastIndex}].profit`;
let flowKey = `senceData[${index}].productList[${lastIndex}].flow`;
let profit = _this.formula(i.productType, sales, flow);
console.log(name, profit);
this.setData({
[name]: profit,
[sale]: sales,
[flowKey]: flow
})
[flowKey]: flow,
});
}
})
})
});
});
// 触发自定义事件 利润 数量
// this.triggerEvent('countProfit', profit, sales)
......@@ -309,15 +310,15 @@ Page({
// console.log('profit: ', profit);
this.setData({
visible: false
})
visible: false,
});
// this.showCase();
// if (!this.data.isFirst) {
wx.showToast({
title: '测算结果已在页面内同步展示',
icon: 'none',
duration: 2000
})
title: "测算结果已在页面内同步展示",
icon: "none",
duration: 2000,
});
// } else {
// this.setData({
// isFirst: false
......@@ -336,51 +337,51 @@ Page({
// },
// 计算公式,参数:productType
formula(productType, sales, flow) {
let profit = 0
let profit = 0;
switch (productType) {
case 'benefitCard':
case "benefitCard":
// 数字无忧权益卡
profit = (sales * 0.5 * 2000 * 12).toFixed(0)
break
case 'sunMembrane':
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 = (sales * 0.8 * 0.7 * 1500 * 12).toFixed(0);
break;
case "protectMembrane":
// 漆面保护膜
profit = (sales * 0.05 * 3000 * 12).toFixed(0)
break
case 'colorMembrane':
profit = (sales * 0.05 * 3000 * 12).toFixed(0);
break;
case "colorMembrane":
// 改色膜
profit = (sales * 0.05 * 5000 * 12).toFixed(0)
break
case 'digitBeauty':
profit = (sales * 0.05 * 5000 * 12).toFixed(0);
break;
case "digitBeauty":
// 数字化美容
profit = (sales * 0.2 * 300 * 12).toFixed(0)
break
case 'chair':
profit = (sales * 0.2 * 300 * 12).toFixed(0);
break;
case "chair":
// 座椅通风
profit = (flow * 2580 * 0.9 * 0.01).toFixed(0)
break
case 'ar':
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 * 1680 * 0.9 * 0.015).toFixed(0);
break;
case "lamp":
// 氛围灯
profit = (flow * 2680 * 0.9 * 0.015).toFixed(0)
break
case 'navigation':
profit = (flow * 2680 * 0.9 * 0.015).toFixed(0);
break;
case "navigation":
// 360全景导航
profit = (flow * 2880 * 0.9 * 0.015).toFixed(0)
break
profit = (flow * 2880 * 0.9 * 0.015).toFixed(0);
break;
}
console.log(profit.length)
console.log(productType, sales, flow, profit)
console.log(profit.length);
console.log(productType, sales, flow, profit);
if (profit.length > 9) {
return (profit / 10000).toFixed(0) + '万'
return (profit / 10000).toFixed(0) + "万";
} else {
return profit
return profit;
}
},
reset() {
......@@ -388,15 +389,15 @@ Page({
isReset: false,
formData: {
sales: 100,
flow: 10000
}
})
flow: 10000,
},
});
},
focus() {
this.setData({
isReset: true
})
return false
isReset: true,
});
return false;
},
// 更新手机号
updatePhoneNumber(e) {
......@@ -418,7 +419,7 @@ Page({
// sessionId
// }
// 看产品
this.compositionData(senceData, [])
this.compositionData(senceData, []);
// productBysceneApi(param).then(res => {
// let { code, data } = res
......@@ -434,47 +435,54 @@ Page({
// this.getClueInit()
//第一次进来储缓存,以后不再用引导图
let firstLogin = wx.$storage.get('firstLogin')
let firstLogin = wx.$storage.get("firstLogin");
if (!firstLogin) {
this.setData({
guideShow: true
})
wx.$storage.set('firstLogin', 'firstLogin')
guideShow: true,
});
wx.$storage.set("firstLogin", "firstLogin");
}
if (util.getUserInfo().phone) {
this.setData({
hasPhoneNumber: true
})
hasPhoneNumber: true,
});
}
},
onRoute(options) {
console.log(options, "options");
this.setData({
actNum: options.actNum,
wrapactiveNavIdx: options.activeNavIdx,
});
},
//接口数据,本地数据对接
compositionData(localData, apiData) {
localData.forEach((item, index) => {
apiData.forEach((inner, idx) => {
if (item.name == inner.stage) {
item.sceneStatus = inner.sceneStatus
item.sceneStatus = inner.sceneStatus;
item.productList.forEach((outChild, outIndex) => {
inner.productList.forEach((innerChild, innerIndex) => {
if (outChild.proName == innerChild.productName) {
outChild.productStatus = innerChild.productStatus
outChild.productStatus = innerChild.productStatus;
}
})
})
});
});
}
})
})
});
});
// console.log('localData, apiData: ', localData);
this.setData({
senceData: localData
})
senceData: localData,
});
},
getFirstSenceIndex(param) {
let actTndex = this.data.apiData.findIndex(item => item.sceneStatus == 1)
let actTndex = this.data.apiData.findIndex((item) => item.sceneStatus == 1);
// console.log('actTndex: ', actTndex);
this.setData({
actNum: actTndex
})
actNum: actTndex,
});
},
// 看线索相关
......@@ -482,50 +490,50 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
this.prompt = this.selectComponent('#toast')
this.prompt = this.selectComponent("#toast");
},
showToast: function (e) {
let { type, item } = e.currentTarget.dataset
console.log('type,item: ', type, item)
let tipObj = {}
let { type, item } = e.currentTarget.dataset;
console.log("type,item: ", type, item);
let tipObj = {};
if (item.starTag == 1) {
tipObj = {
type: 'fail',
title: '取消标记为意向客户'
}
type: "fail",
title: "取消标记为意向客户",
};
} else {
tipObj = {
type: 'success',
title: '成功标记为意向客户'
}
type: "success",
title: "成功标记为意向客户",
};
}
this.prompt.showToast({
type: tipObj.type,
title: tipObj.title,
duration: 1000,
compelete: function () {
console.log('toast框隐藏之后,会调用该函数')
console.log("toast框隐藏之后,会调用该函数");
//例如:跳转页面wx.navigateTo({ url: 'xxx' });
}
})
},
});
//切换收藏标记
let index = e.currentTarget.dataset.outidx
let completeStatus = `clueList[${index}].like`
let index = e.currentTarget.dataset.outidx;
let completeStatus = `clueList[${index}].like`;
this.setData({
[completeStatus]: !this.data.clueList[index].like
})
[completeStatus]: !this.data.clueList[index].like,
});
//发请求
let { sessionId } = wx.$storage.get()
let { sessionId } = wx.$storage.get();
let params = {
clueId: item.clueId,
sessionId
}
this.getTagApi(params)
sessionId,
};
this.getTagApi(params);
},
filterTypeFn(e) {
let { typeList } = this.data
let index = e.currentTarget.dataset.index
let { typeList } = this.data;
let index = e.currentTarget.dataset.index;
// console.log('index: ', index);
// let itemList = []
// let params = {
......@@ -536,41 +544,41 @@ Page({
// console.log('index: ', index)
// 重置筛选
if (index == 3) {
typeList.forEach(item => {
item.selectIndex = 2
})
typeList.forEach((item) => {
item.selectIndex = 2;
});
this.setData({
typeList
})
return this.getPageApi()
typeList,
});
return this.getPageApi();
}
let itemList = Object.values(typeList[index]).slice(0, 2)
itemList.push('全部')
let _this = this
let itemList = Object.values(typeList[index]).slice(0, 2);
itemList.push("全部");
let _this = this;
wx.pro.showActionSheet({
itemList,
success(res) {
// 选中全部
let selectIndex = res.tapIndex
let selectIndex = res.tapIndex;
// console.log('selectIndex: ', selectIndex);
typeList[index].selectIndex = selectIndex
typeList[index].selectIndex = selectIndex;
let params = typeList.reduce((obj, item, index) => {
console.log(' item: ', item)
if (item['key']) {
console.log(" item: ", item);
if (item["key"]) {
// selectIndex = index == 2 ? selectIndex + 1 : selectIndex
// console.log('selectIndex: ', selectIndex);
let itemIndx = item.selectIndex
let itemIndx = item.selectIndex;
// console.log('itemIndx: ', itemIndx);
// key: 'clueSource'
if (item['key'] == 'clueSource') {
itemIndx += 1
if (item["key"] == "clueSource") {
itemIndx += 1;
}
obj[item['key']] = itemIndx == 2 || itemIndx == 3 ? '' : itemIndx
obj[item["key"]] = itemIndx == 2 || itemIndx == 3 ? "" : itemIndx;
}
return obj
}, {})
console.log(params)
return obj;
}, {});
console.log(params);
// let num
// if (index == 2) {
// num = res.tapIndex + 1
......@@ -589,13 +597,13 @@ Page({
// params.clueSource = num
// break
// }
_this.setData({ typeList })
_this.getPageApi(params)
_this.setData({ typeList });
_this.getPageApi(params);
},
fail(res) {
console.log(res.errMsg)
}
})
console.log(res.errMsg);
},
});
},
// // 打电话
// phoneCallFn(e) {
......@@ -610,47 +618,47 @@ Page({
// },
getClueInit(param) {
// console.log(22222)
this.getUnreadApi(param)
this.getPageApi(param)
this.getUnreadApi(param);
this.getPageApi(param);
},
//未读消息
async getUnreadApi(param) {
let { code, data } = await unreadApi(param)
let { code, data } = await unreadApi(param);
if (code == 0) {
this.setData({
unreadClueCount: data.unreadClueCount
})
unreadClueCount: data.unreadClueCount,
});
}
},
//获取浏览线索数据列表
async getPageApi(param) {
let { cluePageSize, clueCurrentPage } = this.data
let { cluePageSize, clueCurrentPage } = this.data;
let params = {
...param,
pageSize: 1000,
currentPage: clueCurrentPage
}
let { code, data } = await pageApi(params)
currentPage: clueCurrentPage,
};
let { code, data } = await pageApi(params);
if (code == 0) {
let arr = data.list.map(item => {
let arr = data.list.map((item) => {
if (item.visitList.length > 5) {
item.getMoreFlag = true
item.getMoreFlag = true;
}
return item
})
return item;
});
this.setData({
clueList: arr
})
clueList: arr,
});
}
},
//喜欢收藏功能
async getTagApi(param) {
let res = await tagApi(param)
console.log('res: ', res)
this.getPageApi(param)
let res = await tagApi(param);
console.log("res: ", res);
this.getPageApi(param);
},
onReachBottom() {
console.log('滑到底部了')
console.log("滑到底部了");
},
/**
* 生命周期函数--监听页面显示
......@@ -661,16 +669,16 @@ Page({
// })
},
onPageScroll: (function () {
let timer = null
let timer = null;
return function (e) {
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer)
clearTimeout(timer);
timer = setTimeout(() => {
// console.log("滚动结束");
wx.$eventbus.emit('evt_page_scroll', { scrollTop: e.scrollTop })
}, 500)
}
wx.$eventbus.emit("evt_page_scroll", { scrollTop: e.scrollTop });
}, 500);
};
})(),
/**
* 生命周期函数--监听页面隐藏
......@@ -695,5 +703,5 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
onShareTimeline: function () {}
})
onShareTimeline: function () {},
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!