Commit 9bf6a3c0 by luyt

feat:看线索api联调

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