Commit 9bf6a3c0 by luyt

feat:看线索api联调

1 parent c420265d
/** /**
* 拓客户,看线索接口 * 拓客户,看线索接口
*/ */
import api from '~/utils/request/request' import api from "~/utils/request/request";
// const common = 'scrm.api.carlife.common.'
const serverApi = { const serverApi = {
// 拓客户 // 拓客户
productByscene:'scrm.api.busassistant.activity.findSceneProductStatus' productByscene: "scrm.api.busassistant.activity.findSceneProductStatus",
}
// 看线索
unread: "scrm.api.busassistant.clue.unread", //获取未读线索数量
page: "scrm.api.busassistant.clue.page", //分页查询线索列表
read: "scrm.api.busassistant.clue.read", //标记线索已读
tag: "scrm.api.busassistant.clue.tag", //线索标记意向客户
};
// 拓客户 // 拓客户
const productBysceneApi = (data) =>{ const productBysceneApi = (data) => {
return api.post( return api.post(
{ {
method: serverApi.productByscene, method: serverApi.productByscene,
...data ...data,
}, },
true true
) );
} };
// 看线索 // 看线索
const unreadApi = (data) => {
return api.post(
{
method: serverApi.unread,
...data,
},
true
);
};
const pageApi = (data) => {
return api.post(
{
method: serverApi.page,
...data,
},
true
);
};
const readApi = (data) => {
return api.post(
{
method: serverApi.read,
...data,
},
true
);
};
const tagApi = (data) => {
return api.post(
{
method: serverApi.tag,
...data,
},
true
);
};
module.exports = { module.exports = {
/** 线索埋点数据上报 /** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动) * operationType 操作类型(0:分享 1:浏览 2:申请活动)
*/ */
reportData(data = {}, operationType = 0) { reportData(data = {}, operationType = 0) {
return api.post({ return api.post({
method: 'scrm.api.busassistant.clue.report', method: "scrm.api.busassistant.clue.report",
...data, ...data,
operationType, operationType,
operationDate: new Date().format('yyyy-MM-dd hh:mm:ss'), operationDate: new Date().format("yyyy-MM-dd hh:mm:ss"),
});
})
}, },
productBysceneApi
}
\ No newline at end of file \ No newline at end of file
productBysceneApi,
unreadApi,
pageApi,
readApi,
tagApi,
};
...@@ -28,9 +28,9 @@ Component({ ...@@ -28,9 +28,9 @@ Component({
value: '' value: ''
}, },
// 是否有红点 // 是否有红点
redpoint: { unreadClueCount: {
type: Array, type: Number,
value: ['看线索'] value: 0
}, },
}, },
...@@ -41,6 +41,11 @@ Component({ ...@@ -41,6 +41,11 @@ Component({
count: 0, count: 0,
to: '' to: ''
}, },
// lifetimes:{
// attached: function() {
// console.log('unreadClueCount',this.data.unreadClueCount)
// }
// },
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -50,7 +55,8 @@ Component({ ...@@ -50,7 +55,8 @@ Component({
let { count } = e.currentTarget.dataset let { count } = e.currentTarget.dataset
this.setData({ this.setData({
count, count,
to: `to-${count}` to: `to-${count}`,
unreadClueCount:0
}) })
this.triggerEvent('click', count) this.triggerEvent('click', count)
} }
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
{{item}} {{item}}
</view> </view>
<view class="line" style="lineStyle" /> <view class="line" style="lineStyle" />
<view wx:if="{{filterUtils.hasRedpoint(redpoint,item)}}" class="redpoint" /> <!-- -->
<view wx:if="{{filterUtils.hasRedpoint(unreadClueCount)}}" class="redpoint" />
</view> </view>
</block> </block>
</view> </view>
......
/** var hasRedpoint = function (unreadClueCount) {
* // console.log('unreadClueCount: ', unreadClueCount);
* @param array 数组 if(unreadClueCount>0){
* @param item 数组中的某一项 return true
* @returns }else{
*/ return false;
var hasRedpoint = function (array, item) { }
// console.log('array: ', array);
return array.length > 0 && array.indexOf(item) != -1;
}; };
module.exports = { module.exports = {
hasRedpoint: hasRedpoint, hasRedpoint: hasRedpoint,
......
...@@ -71,10 +71,13 @@ ...@@ -71,10 +71,13 @@
height: 0; height: 0;
color: transparent; color: transparent;
} }
.active .redpoint{
display: none;
}
.redpoint { .redpoint {
position: absolute; position: absolute;
top: 0; top: 10px;
right: 0; right: 5px;
/* top: 8px; /* top: 8px;
right: 10px; */ right: 10px; */
width: 10px; width: 10px;
......
...@@ -5,7 +5,7 @@ import { senceData } from "./constant/data"; ...@@ -5,7 +5,7 @@ import { senceData } from "./constant/data";
// `${IMG_URL}index/car2.png`, // `${IMG_URL}index/car2.png`,
//本地图片路径 //本地图片路径
let IMG_URLLocal = "../../../images/"; let IMG_URLLocal = "../../../images/";
import { productBysceneApi } from "~/api/index.js"; import { productBysceneApi,unreadApi,pageApi,readApi,tagApi } from "~/api/index.js";
Page({ Page({
// behaviors: [kfMixin], // behaviors: [kfMixin],
...@@ -98,7 +98,7 @@ Page({ ...@@ -98,7 +98,7 @@ Page({
], ],
phone: 15718122929, phone: 15718122929,
isOpen: false, isOpen: false,
getMoreFlag: true, getMoreFlag: false,
}, },
{ {
source: "customer", source: "customer",
...@@ -147,7 +147,6 @@ Page({ ...@@ -147,7 +147,6 @@ Page({
isOpen: true, isOpen: true,
}, },
], ],
filterType: "", //看线索过滤类型
// 预估弹框 // 预估弹框
visible: false, visible: false,
isReset: false, isReset: false,
...@@ -164,6 +163,10 @@ Page({ ...@@ -164,6 +163,10 @@ Page({
// 定义数据 // 定义数据
senceData, senceData,
isShow: false, isShow: false,
// 看线索部分
unreadClueCount: 0,
cluePageSize:10,
clueCurrentPage: 1
}, },
//引导图 //引导图
...@@ -206,9 +209,21 @@ Page({ ...@@ -206,9 +209,21 @@ Page({
// 头部看线索,产品切换 // 头部看线索,产品切换
changeTabIndx(e) { changeTabIndx(e) {
console.log("e.detail: ", e.detail); console.log("e.detail: ", e.detail);
let { sessionId } = wx.$storage.get();
// console.log("sessionId: ", sessionId);
let param = {
sessionId,
};
let first = true
this.setData({ this.setData({
tabIndx: e.detail, tabIndx: e.detail,
}); });
//标记线索已读
if(e.detail == 0 && first ){
first = false
readApi(param)
}
}, },
gotoApply() { gotoApply() {
// wx.$router.go('apply',1235) // wx.$router.go('apply',1235)
...@@ -415,6 +430,7 @@ Page({ ...@@ -415,6 +430,7 @@ Page({
let param = { let param = {
sessionId, sessionId,
}; };
// 看产品
productBysceneApi(param).then((res) => { productBysceneApi(param).then((res) => {
let { code, data } = res; let { code, data } = res;
...@@ -426,6 +442,8 @@ Page({ ...@@ -426,6 +442,8 @@ Page({
this.getFirstSenceIndex() this.getFirstSenceIndex()
} }
}); });
// 看线索
this.getClueInit()
}, },
//接口数据,本地数据对接 //接口数据,本地数据对接
compositionData(localData, apiData) { compositionData(localData, apiData) {
...@@ -449,13 +467,15 @@ Page({ ...@@ -449,13 +467,15 @@ Page({
senceData:localData senceData:localData
}) })
}, },
getFirstSenceIndex(){ 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); // console.log('actTndex: ', actTndex);
this.setData({ this.setData({
actNum:actTndex actNum:actTndex
}) })
}, },
// 看线索相关
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -463,9 +483,10 @@ Page({ ...@@ -463,9 +483,10 @@ Page({
this.prompt = this.selectComponent("#toast"); this.prompt = this.selectComponent("#toast");
}, },
showToast: function (e) { showToast: function (e) {
let type = e.currentTarget.dataset.type; let {type,item} = e.currentTarget.dataset;
console.log('type,item: ', type,item);
let tipObj = {}; let tipObj = {};
if (type == "like") { if (item.starTag == 1) {
tipObj = { tipObj = {
type: "fail", type: "fail",
title: "取消标记为意向客户", title: "取消标记为意向客户",
...@@ -492,32 +513,63 @@ Page({ ...@@ -492,32 +513,63 @@ Page({
this.setData({ this.setData({
[completeStatus]: !this.data.clueList[index].like, [completeStatus]: !this.data.clueList[index].like,
}); });
//发请求
let { sessionId } = wx.$storage.get();
let params = {
clueId:item.clueId,
sessionId
}
this.getTagApi(params)
}, },
filterTypeFn(e) { filterTypeFn(e) {
let index = e.currentTarget.dataset.index; let index = e.currentTarget.dataset.index;
let itemList = []; let itemList = [];
// console.log("index: ", typeof index); let params = {
clueSource:'',
hasPhone:'',
starTag:''
}
console.log("index: ", index);
switch (index) { switch (index) {
case 0: case 0:
itemList = ["有", "无"]; itemList = ["无","有"];
break; break;
case 1: case 1:
itemList = ["是", "否"]; itemList = ["否","是"];
break; break;
case 2: case 2:
itemList = ["访客", "门店"]; itemList = ["访客", "门店"]; //线索来源(1访客,2门店)
break; break;
case 3: case 3:
console.log("重置"); params = {
return; clueSource:'',
hasPhone:'',
starTag:''
}
break;
} }
this.setData({ let _this = this;
filterType: "",
});
wx.pro.showActionSheet({ wx.pro.showActionSheet({
itemList, itemList,
success(res) { success(res) {
console.log(res.tapIndex); let num
if(index == 2){
num = res.tapIndex+1
}else{
num = res.tapIndex
}
switch (index) {
case 0:
params.hasPhone = num
break;
case 1:
params.starTag = num
break;
case 2:
params.clueSource = num
break;
}
_this.getPageApi(params)
}, },
fail(res) { fail(res) {
console.log(res.errMsg); console.log(res.errMsg);
...@@ -526,6 +578,10 @@ Page({ ...@@ -526,6 +578,10 @@ Page({
console.log("res: ", res); console.log("res: ", res);
}, },
}); });
if(index == 3){
this.getPageApi(params)
}
}, },
// 打电话 // 打电话
phoneCallFn(e) { phoneCallFn(e) {
...@@ -538,7 +594,49 @@ Page({ ...@@ -538,7 +594,49 @@ Page({
let { phone } = e.currentTarget.dataset; let { phone } = e.currentTarget.dataset;
wx.$api.setCopyData(phone); wx.$api.setCopyData(phone);
}, },
getClueInit(param){
this.getUnreadApi(param)
this.getPageApi(param)
},
//未读消息
async getUnreadApi(param){
let {code,data} = await unreadApi(param)
if(code == 0){
this.setData({
unreadClueCount:data.unreadClueCount
})
}
},
//获取浏览线索数据列表
async getPageApi(param){
let {cluePageSize,clueCurrentPage} = this.data
let params = {
...param,
pageSize:1000,
currentPage:clueCurrentPage
}
let {code,data} = await pageApi(params)
if(code == 0){
let arr = data.list.map(item=>{
if(item.visitList.length >5){
item.getMoreFlag = true
}
return item
})
this.setData({
clueList: arr
})
}
},
//喜欢收藏功能
async getTagApi(param){
let res = await tagApi(param)
console.log('res: ', res);
this.getPageApi(param)
},
onReachBottom(){
console.log("滑到底部了")
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
"vas-toast": "./components/likeToast/likeToast", "vas-toast": "./components/likeToast/likeToast",
"shareModel": "./components/shareModel/shareModel" "shareModel": "./components/shareModel/shareModel"
}, },
"navigationStyle": "custom" "navigationStyle": "custom",
"onReachBottomDistance":50
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- 头部 --> <!-- 头部 -->
<view class="header-wrap" style="height:{{headerHeight}}rpx; background-image: url('{{IMG_URL}}index/head.png')"> <view class="header-wrap" style="height:{{headerHeight}}rpx; background-image: url('{{IMG_URL}}index/head.png')">
<view class="header"> <view class="header">
<tab tab="{{navList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" bindclick="changeTabIndx" class="tabContainer" /> <tab tab="{{navList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" />
<view class="right" bindtap="gotoApply"> <view class="right" bindtap="gotoApply">
<image class="img" src="{{IMG_URL}}index/apply.png" /> <image class="img" src="{{IMG_URL}}index/apply.png" />
<view class="apply">申请业务</view> <view class="apply">申请业务</view>
...@@ -33,50 +33,12 @@ ...@@ -33,50 +33,12 @@
</view> </view>
</view> </view>
<view class="list" hover-class="none" hover-stop-propagation="false"> <view class="list" hover-class="none" hover-stop-propagation="false">
<view class="msg" wx:for="{{clueList}}" wx:key="phone"> <view class="msg" wx:for="{{clueList}}" wx:key="index">
<!-- 生意助手 -->
<view wx:if="{{item.source == 'customer'}}">
<image class="like" wx:if="{{item.like}}" src="{{IMG_URL}}index/like.png" data-type="like" data-outidx="{{index}}" bindtap="showToast" />
<image class="like" wx:else src="{{IMG_URL}}index/dislike.png" data-type="dislike" data-outidx="{{index}}" bindtap="showToast" />
<view class="name" hover-class="none" hover-stop-propagation="false">
{{item.name}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view>
<view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="want-more" style="height:{{item.getMoreFlag? 100: 'auto'}}px">
<view class="record" wx:for="{{item.records}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName">
<view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false">
{{filterUtils.filterType(itemName.type)}}:
</view>
<view class="detail" selectable="false" space="false" decode="false">
{{itemName.msg}}
</view>
</view>
<view class="time" selectable="false" space="false" decode="false">
{{itemName.time}}
</view>
</view>
</view>
<view class="want-btn" wx:if="{{item.records.length > 5}}" hover-class="none" hover-stop-propagation="false" data-outidx="{{index}}" bindtap="getMore">
{{ item.getMoreFlag ? '更多数据' : '收起数据'}}
</view>
<view class="info" hover-class="none" hover-stop-propagation="false">
<view class="phone-wrap">
<view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply">
+开店面
</view>
</view>
</view>
<!-- 门店助手 --> <!-- 门店助手 -->
<view class="shop" wx:else> <view class="shop" wx:if="{{item.clueType == 2}}">
<view class="name-wrap"> <view class="name-wrap">
<view class="name" hover-class="none" hover-stop-propagation="false"> <view class="name" hover-class="none" hover-stop-propagation="false">
{{item.name}} {{item.nickName}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" /> <image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view> </view>
<view class="source" hover-class="none" hover-stop-propagation="false">通过门店助手申请</view> <view class="source" hover-class="none" hover-stop-propagation="false">通过门店助手申请</view>
...@@ -86,30 +48,66 @@ ...@@ -86,30 +48,66 @@
<view class="shop-record"> <view class="shop-record">
<view class="shop-action-wrap"> <view class="shop-action-wrap">
<view class="action-wrap"> <view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false"> <view class="action" selectable="false" space="false" decode="false">访问页面:</view>
{{filterUtils.filterType(itemName.type)}}:
</view>
<view class="detail" selectable="false" space="false" decode="false"> <view class="detail" selectable="false" space="false" decode="false">
{{itemName.msg}} {{itemName.productDesc}}
</view> </view>
</view> </view>
<view class="time" selectable="false" space="false" decode="false"> <view class="time" selectable="false" space="false" decode="false">
{{itemName.time}} {{itemName.clueDate}}
</view> </view>
</view> </view>
<view class="shop-source" hover-class="none" hover-stop-propagation="false"> <view class="shop-source" hover-class="none" hover-stop-propagation="false">
所属门店:{{itemName.shop}} 所属门店:{{itemName.shopName}}
</view> </view>
</view> </view>
</view> </view>
<view class="info" hover-class="none" hover-stop-propagation="false"> <view class="info" hover-class="none" hover-stop-propagation="false">
<view>
<view class="phone-wrap" wx:if="{{item.phone}}">
<view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view>
</view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply">
开通活动
</view>
</view>
</view>
<!-- 生意助手 -->
<view wx:else>
<image class="like" wx:if="{{item.starTag == 1}}" src="{{IMG_URL}}index/like.png" data-type="like" data-outidx="{{index}}" data-item="{{item}}" bindtap="showToast" />
<image class="like" wx:else src="{{IMG_URL}}index/dislike.png" data-type="dislike" data-outidx="{{index}}" data-item="{{item}}" bindtap="showToast" />
<view class="name" hover-class="none" hover-stop-propagation="false">
{{item.nickName}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view>
<view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="want-more" style="height:{{item.getMoreFlag? 100: 'auto'}}px">
<view class="record" wx:for="{{item.visitList}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName">
<view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false">访问页面:</view>
<view class="detail" selectable="false" space="false" decode="false">
{{itemName.productDesc}}
</view>
</view>
<view class="time" selectable="false" space="false" decode="false">
{{itemName.clueDate}}
</view>
</view>
</view>
<view class="want-btn" wx:if="{{item.visitList.length > 5}}" hover-class="none" hover-stop-propagation="false" data-outidx="{{index}}" bindtap="getMore">
{{ item.getMoreFlag ?'更多数据':'收起数据'}}
</view>
<view class="info" hover-class="none" hover-stop-propagation="false" wx:if="{{item.phone}}">
<view class="phone-wrap"> <view class="phone-wrap">
<view class="phone">{{item.phone}}</view> <view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" /> <image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" /> <image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view> </view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply"> <view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply" wx:if="{{item.applyStatus == 0}}">
开通活动 +开店面
</view> </view>
</view> </view>
</view> </view>
...@@ -154,4 +152,4 @@ ...@@ -154,4 +152,4 @@
</view> </view>
</form> </form>
</view> </view>
</view> </view>
\ No newline at end of file \ 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!