eba05ee109
添加客户积分充值、兑换页面及相关功能组件 在客户列表页增加线索池展示和解锁功能 更新订单页面的购车券核销按钮 新增红色字体样式并更新项目配置
1136 lines
25 KiB
JavaScript
1136 lines
25 KiB
JavaScript
import _ from '../../commons/js/commons'
|
|
import popularData from '../../commons/js/lib/popularData';
|
|
const app = getApp()
|
|
Page({
|
|
data: {
|
|
key:'',//tab状态值
|
|
list: [],//客户列表
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
flag:1,
|
|
cus_id:'',//客户编号
|
|
name:'',//名字
|
|
mobile:'',//手机号
|
|
s_time:'',//开始时间
|
|
e_time:'',//结束时间
|
|
if_driver:'',//是否试驾
|
|
level:'',//客户顶级
|
|
// brand_id:'',//品牌
|
|
// s_id:'',//车型id
|
|
// v_id:'',//车辆版本id
|
|
cfrom:'',//客户来源
|
|
o_type:'',//排序类型
|
|
isShowfilter:false,//是否显示筛查
|
|
timeSlotIndex:-1,//常用时间索引
|
|
s_visit_time:'',//跟进时间段开始
|
|
e_visit_time:'',//跟进时间段结束
|
|
timeSlot:[//常用时间数组
|
|
{
|
|
title:'今天',
|
|
},
|
|
{
|
|
title:'明天',
|
|
},
|
|
{
|
|
title:'未来三天',
|
|
},
|
|
{
|
|
title:'未来七天',
|
|
},
|
|
],
|
|
testDriveIndex:-1,//是否试驾索引
|
|
testDrive:[//是否试驾数组
|
|
{
|
|
title:'全部',
|
|
},
|
|
{
|
|
title:'是',
|
|
},
|
|
{
|
|
title:'否',
|
|
},
|
|
],
|
|
sortList:['建卡日期','最近联系','特别关注',],//排序数组
|
|
sortListIndex:0,//排序索引
|
|
levelIndex:-1,//意向等级索引
|
|
brandIndex:-1,//车辆品牌索引
|
|
modelIndex:-1,//车系车型索引
|
|
cfromIndex:-1,//客户来源索引
|
|
isShowMessage:false,//是否显示短信弹窗
|
|
content:'',//短信内容
|
|
isRefresh:false,//判断返回是否需要刷新
|
|
isShowMobile: false,
|
|
staffArray: [],
|
|
staffobj: [],
|
|
staffIndex:-1,
|
|
userInfo:'',
|
|
|
|
of_id:'',
|
|
of2_id:'',
|
|
of1Index:-1,
|
|
of2Index:-1,
|
|
|
|
cid:[],//分配客户ID
|
|
employee_id:'',//分配销售ID
|
|
employeeIndex:-1,//分配销售索引
|
|
|
|
isShowTimePicker:false,
|
|
weekList:['日','一','二','三','四','五','六'],
|
|
dateList:[],
|
|
nextIndex:-1,//计划回访时间
|
|
|
|
distTabId:1,
|
|
distBizIndex:-1,
|
|
distBiz_id:'',
|
|
bizArray: [],
|
|
bizobj: [],
|
|
tag_ids:'',
|
|
|
|
cityIndex:-1,
|
|
city_id:'',
|
|
countyIndex:-1,
|
|
county_id:'',
|
|
|
|
isShowCall:false,//是否显示拨打电话确认弹框
|
|
phoneNumber:'',//拨打的电话号码
|
|
|
|
brand_page_show:false,
|
|
brand_name:'',
|
|
brand_id: '',
|
|
series_id: '', //车系id
|
|
modelArray: [],
|
|
modelIndex: -1, //车系车型索引
|
|
isShowLock: false
|
|
},
|
|
onLoad(options) {
|
|
for (let key in options) {
|
|
this.setData({
|
|
[key]: options[key]
|
|
})
|
|
}
|
|
|
|
this.setData({
|
|
userInfo:app.getStorageByKey("userInfo"),
|
|
})
|
|
|
|
//客户-tab
|
|
this.getAppCustomersTabs()
|
|
//获取列表筛选条件
|
|
this.getAppCustomersFilter()
|
|
//获取车型品牌
|
|
//this.getAppSeriesBrands()
|
|
//销售顾问
|
|
this.getAppUserAdmins()
|
|
//客户来源
|
|
// this.getAppCustomersOffline_sources()
|
|
|
|
this.getTimePicker()
|
|
|
|
this.getAppCustomersTag()
|
|
|
|
//获取城市列表
|
|
this.getAppCityArea_city()
|
|
|
|
},
|
|
|
|
onShow(){
|
|
//获取常用时间段
|
|
this.getDateLater()
|
|
},
|
|
|
|
//客户-tab
|
|
getAppCustomersTabs() {
|
|
_.apiQuery.getAppCustomersTabs().then(res => {
|
|
this.setData({
|
|
tab:res.data,
|
|
key:this.data.key==''?res.data[0].key:this.data.key,
|
|
})
|
|
|
|
this.getAppCustomersList()
|
|
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//获取销售顾问
|
|
getAppUserAdmins(){
|
|
let params = {};
|
|
params['page'] = 1;
|
|
params['size'] = 1000;
|
|
_.apiQuery.getAppUserAdmins(params).then(res => {
|
|
let staffArray = []
|
|
res.data.list.forEach(item => {
|
|
staffArray.push(item.uname)
|
|
})
|
|
let bizArray = []
|
|
res.data.bizs.forEach(item => {
|
|
bizArray.push(item.name)
|
|
})
|
|
this.setData({
|
|
staffArray:staffArray,
|
|
staffobj: res.data.list,
|
|
distributetabs:res.data.tabs,
|
|
bizArray:bizArray,
|
|
bizobj: res.data.bizs,
|
|
})
|
|
});
|
|
},
|
|
|
|
//切换tab
|
|
changeTab(e){
|
|
this.setData({
|
|
key: this.data.tab[e.currentTarget.dataset.index].key,
|
|
})
|
|
this.searchSubmit()
|
|
},
|
|
|
|
// 显示弹框
|
|
showMobileMsg(){
|
|
this.setData({
|
|
isShowMobile: true
|
|
})
|
|
},
|
|
|
|
//获取列表筛选条件
|
|
getAppCustomersFilter(){
|
|
_.apiQuery.getAppCustomersFilter().then(res => {
|
|
this.setData({
|
|
filter:res.data,
|
|
})
|
|
});
|
|
},
|
|
|
|
//获取车型品牌
|
|
getAppSeriesBrands(){
|
|
_.apiQuery.getAppSeriesBrands().then(res => {
|
|
if(res.data.list.length>0){
|
|
let brandArray = []
|
|
res.data.list.forEach(item => {
|
|
brandArray.push(item.name)
|
|
})
|
|
this.setData({
|
|
brandArray:brandArray,
|
|
brandList:res.data.list,
|
|
})
|
|
}
|
|
});
|
|
},
|
|
|
|
//获取车系车型
|
|
getAppSeries(){
|
|
let params = {};
|
|
params['brand_id'] = this.data.brand_id;
|
|
_.apiQuery.getAppSeries(params).then(res => {
|
|
if(res.data.list.length>0){
|
|
let modelArray = []
|
|
res.data.list.forEach(item => {
|
|
modelArray.push(item.name)
|
|
})
|
|
this.setData({
|
|
modelArray:modelArray,
|
|
modelList:res.data.list,
|
|
})
|
|
}
|
|
});
|
|
},
|
|
|
|
//选择人员
|
|
changeStaff(e) {
|
|
this.setData({
|
|
staffIndex: e.detail.value
|
|
})
|
|
},
|
|
|
|
//获取客户列表
|
|
getAppCustomersList() {
|
|
this.setData({
|
|
load: false,
|
|
loading: true,
|
|
})
|
|
|
|
let admin_ids = ''
|
|
this.data.staffobj.forEach(item => {
|
|
if(item.checked){
|
|
if(admin_ids==''){
|
|
admin_ids=item.id
|
|
}else{
|
|
admin_ids=admin_ids+','+item.id
|
|
}
|
|
}
|
|
})
|
|
|
|
let params = {};
|
|
params['page'] = this.data.pageNo;
|
|
params['size'] = 3;
|
|
params['status'] = this.data.key;
|
|
if(this.data.cus_id != ''){
|
|
params['cus_id'] = this.data.cus_id;
|
|
}
|
|
if(this.data.name != ''){
|
|
params['name'] = this.data.name;
|
|
}
|
|
if(this.data.mobile != ''){
|
|
params['mobile'] = this.data.mobile;
|
|
}
|
|
if(this.data.s_time != ''&&this.data.e_time != ''){
|
|
params['s_time'] = this.data.s_time;
|
|
params['e_time'] = this.data.e_time;
|
|
}
|
|
if(this.data.if_driver != ''){
|
|
params['if_driver'] = this.data.if_driver;
|
|
}
|
|
if(this.data.level != ''){
|
|
params['level'] = this.data.level;
|
|
}
|
|
if(this.data.brand_id != ''){
|
|
params['brand_id'] = this.data.brand_id;
|
|
}
|
|
if(this.data.series_id != ''){
|
|
params['series_id'] = this.data.series_id;
|
|
}
|
|
// if(this.data.v_id != ''){
|
|
// params['v_id'] = this.data.v_id;
|
|
// }
|
|
if(this.data.cfrom != ''){
|
|
params['cfrom'] = this.data.cfrom;
|
|
}
|
|
if(this.data.o_type != ''){
|
|
params['o_type'] = this.data.o_type;
|
|
}
|
|
if(this.data.of_id != ''){
|
|
params['of_id'] = this.data.of_id;
|
|
}
|
|
if(this.data.of2_id != ''){
|
|
params['of2_id'] = this.data.of2_id;
|
|
}
|
|
if(admin_ids!=''){
|
|
params['admin_ids'] = admin_ids;
|
|
}
|
|
if(this.data.tag_ids!=''){
|
|
params['tag_ids'] = this.data.tag_ids;
|
|
}
|
|
// if(this.data.staffIndex>-1){
|
|
// params['admin_id'] = this.data.staffobj[this.data.staffIndex].id;
|
|
// }
|
|
if(this.data.city_id!=''){
|
|
params['city_id'] = this.data.city_id;
|
|
}
|
|
if(this.data.county_id!=''){
|
|
params['county_id'] = this.data.county_id;
|
|
}
|
|
if(this.data.s_visit_time != ''&&this.data.e_visit_time != ''){
|
|
params['s_visit_time'] = this.data.s_visit_time;
|
|
params['e_visit_time'] = this.data.e_visit_time;
|
|
}
|
|
_.apiQuery.getAppCustomersList(params).then(res => {
|
|
this.setData({
|
|
flag: this.data.flag - 1
|
|
})
|
|
if (!this.data.flag) {
|
|
this.setData({
|
|
total: res.data.total,
|
|
pageNo: this.data.pageNo + 1,
|
|
list: this.data.list.concat(res.data.list),
|
|
load: true,
|
|
loading: false,
|
|
})
|
|
if (res.data.total == 0) {
|
|
this.setData({
|
|
noData: true
|
|
})
|
|
} else if (this.data.list.length == res.data.total) {
|
|
this.setData({
|
|
end: true
|
|
})
|
|
}
|
|
}
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//置顶操作
|
|
optTop(e){
|
|
let params = {};
|
|
params['id'] = this.data.list[e.currentTarget.dataset.index].id;
|
|
params['is_top'] = this.data.list[e.currentTarget.dataset.index].is_top==1?0:1;
|
|
_.apiQuery.putAppCustomers(params).then(res=>{
|
|
this.setData({
|
|
['list['+e.currentTarget.dataset.index+'].is_top']:this.data.list[e.currentTarget.dataset.index].is_top==1?0:1,
|
|
})
|
|
})
|
|
},
|
|
|
|
//获取常用时间段
|
|
getDateLater(){
|
|
popularData.getDateLater(0,0).then(res => {
|
|
this.setData({
|
|
today:res,
|
|
})
|
|
})
|
|
popularData.getDateLater(-1,0).then(res => {
|
|
this.setData({
|
|
tomorrow:res,
|
|
})
|
|
})
|
|
popularData.getDateLater(-3,2).then(res => {
|
|
this.setData({
|
|
next3:res,
|
|
})
|
|
})
|
|
popularData.getDateLater(-7,6).then(res => {
|
|
this.setData({
|
|
next7:res,
|
|
})
|
|
})
|
|
// popularData.getDateLater(0,6).then(res => {
|
|
// this.setData({
|
|
// last7:res,
|
|
// })
|
|
// })
|
|
// popularData.getDateLater(0,29).then(res => {
|
|
// this.setData({
|
|
// last30:res,
|
|
// })
|
|
// })
|
|
},
|
|
|
|
//拨打客户电话xz
|
|
call(e) {
|
|
let params = {};
|
|
params['id'] = e.currentTarget.dataset.id;
|
|
params['type'] = 0;
|
|
_.apiQuery.getAppXz(params).then(res=>{
|
|
this.setData({
|
|
isShowCall:true,
|
|
phoneNumber:res.data.mobile,
|
|
})
|
|
})
|
|
},
|
|
|
|
//提交搜索
|
|
searchSubmit(){
|
|
this.setData({
|
|
list: [],
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
flag: this.data.flag + 1
|
|
})
|
|
this.getAppCustomersList()
|
|
},
|
|
|
|
//排序方式
|
|
changeSortList(e){
|
|
|
|
let o_type = ''
|
|
if(e.detail.value == 0){
|
|
o_type = 1
|
|
}else if(e.detail.value == 1){
|
|
o_type = 2
|
|
}
|
|
|
|
this.setData({
|
|
o_type: o_type,
|
|
sortListIndex: e.detail.value,
|
|
})
|
|
this.searchSubmit()
|
|
},
|
|
|
|
//建卡时间
|
|
startDate(e){
|
|
this.setData({
|
|
s_time: e.detail.value,
|
|
})
|
|
},
|
|
|
|
//建卡时间
|
|
endDate(e){
|
|
this.setData({
|
|
e_time: e.detail.value,
|
|
})
|
|
},
|
|
|
|
//单选
|
|
radioPicker(e){
|
|
if(e.currentTarget.dataset.type == 'timeSlot'){
|
|
this.setData({
|
|
timeSlotIndex:e.currentTarget.dataset.index,
|
|
})
|
|
switch (e.currentTarget.dataset.index) {
|
|
case 0:
|
|
this.setData({
|
|
s_visit_time:this.data.today[0],
|
|
e_visit_time:this.data.today[1],
|
|
})
|
|
break;
|
|
case 1:
|
|
this.setData({
|
|
s_visit_time:this.data.tomorrow[0],
|
|
e_visit_time:this.data.tomorrow[1],
|
|
})
|
|
break;
|
|
case 2:
|
|
this.setData({
|
|
s_visit_time:this.data.next3[0],
|
|
e_visit_time:this.data.next3[1],
|
|
})
|
|
break;
|
|
case 3:
|
|
this.setData({
|
|
s_visit_time:this.data.next7[0],
|
|
e_visit_time:this.data.next7[1],
|
|
})
|
|
break;
|
|
}
|
|
} else if(e.currentTarget.dataset.type == 'testDrive'){
|
|
let if_driver = ''
|
|
if(e.currentTarget.dataset.index == 1){
|
|
if_driver = 1
|
|
}else if(e.currentTarget.dataset.index == 2){
|
|
if_driver = 0
|
|
}
|
|
this.setData({
|
|
if_driver:if_driver,
|
|
testDriveIndex:e.currentTarget.dataset.index,
|
|
})
|
|
}
|
|
},
|
|
|
|
//客户等级
|
|
changeLevel(e){
|
|
|
|
let level = ''
|
|
if(e.detail.value >= 0){
|
|
level = this.data.filter.level[e.detail.value]
|
|
}
|
|
|
|
this.setData({
|
|
level:level,
|
|
levelIndex: e.detail.value,
|
|
})
|
|
},
|
|
|
|
//选择品牌
|
|
changeBrand(e) {
|
|
if(this.data.brandIndex != e.detail.value && e.detail.value >= 0){
|
|
this.setData({
|
|
brand_id:this.data.brandList[e.detail.value].id,
|
|
brandIndex:e.detail.value,
|
|
s_id:'',//车系id
|
|
modelIndex:-1,//车系车型索引
|
|
})
|
|
this.getAppSeries()
|
|
}
|
|
},
|
|
|
|
//选择车型
|
|
changeModel(e) {
|
|
if(this.data.modelIndex != e.detail.value && e.detail.value >= 0){
|
|
this.setData({
|
|
series_id:this.data.modelList[e.detail.value].id,
|
|
modelIndex:e.detail.value,
|
|
})
|
|
}
|
|
},
|
|
|
|
//客户来源
|
|
changeCfrom(e){
|
|
|
|
let cfrom = ''
|
|
if(e.detail.value >= 0){
|
|
cfrom = this.data.filter.cfrom[e.detail.value]
|
|
}
|
|
|
|
this.setData({
|
|
cfrom:cfrom,
|
|
cfromIndex: e.detail.value,
|
|
})
|
|
},
|
|
|
|
//显示隐藏高级搜索
|
|
optfilter(){
|
|
this.setData({
|
|
isShowfilter: !this.data.isShowfilter
|
|
})
|
|
this.resetFilter()
|
|
},
|
|
|
|
//显示高级搜索
|
|
showfilter(){
|
|
this.setData({
|
|
isShowfilter:true,
|
|
})
|
|
},
|
|
|
|
//确定高级搜索
|
|
submitFilter() {
|
|
this.setData({
|
|
isShowfilter:false,
|
|
})
|
|
this.searchSubmit()
|
|
},
|
|
|
|
//重置高级搜索
|
|
resetFilter() {
|
|
let staffobj = this.data.staffobj
|
|
staffobj.forEach(item => {
|
|
item.checked = false
|
|
})
|
|
|
|
this.setData({
|
|
staffobj,
|
|
cus_id:'',//编号
|
|
name:'',//名字
|
|
mobile:'',//手机号
|
|
s_time:'',
|
|
e_time:'',
|
|
if_driver:'',
|
|
level:'',
|
|
brand_id:'',
|
|
series_id:'',
|
|
cfrom:'',
|
|
of_id:'',
|
|
of2_id:'',
|
|
of1Index:-1,
|
|
of2Index:-1,
|
|
timeSlotIndex:-1,
|
|
s_visit_time:'',//跟进时间段开始
|
|
e_visit_time:'',//跟进时间段结束
|
|
testDriveIndex:-1,
|
|
levelIndex:-1,
|
|
brandIndex:-1,
|
|
modelIndex:-1,
|
|
cfromIndex:-1,
|
|
staffIndex:-1,
|
|
tag_ids:'',
|
|
cityIndex:-1,
|
|
city_id:'',
|
|
countyIndex:-1,
|
|
county_id:'',
|
|
brand_name:'',
|
|
})
|
|
this.getAppCustomersTag()
|
|
},
|
|
|
|
//显示短信弹框
|
|
showMessage(e){
|
|
this.setData({
|
|
messageId:e.currentTarget.dataset.id,
|
|
isShowMessage:true,
|
|
content:'',
|
|
})
|
|
},
|
|
|
|
//关闭短信弹框
|
|
hideMessage(e){
|
|
this.setData({
|
|
isShowMessage:false,
|
|
})
|
|
},
|
|
|
|
//输入
|
|
inputTx(e) {
|
|
this.setData({
|
|
submitFlag: false,
|
|
[e.currentTarget.dataset.key]: e.detail.value
|
|
})
|
|
},
|
|
|
|
//发短信
|
|
postAppSmsCustomer(){
|
|
if (this.data.submitFlag) return;
|
|
if (this.data.content == '') {
|
|
wx.showToast({
|
|
title: '请填写短信内容',
|
|
icon: 'none'
|
|
})
|
|
} else {
|
|
this.setData({
|
|
submitFlag: true,
|
|
})
|
|
let params = {};
|
|
params['id'] = this.data.messageId;
|
|
params['content'] = this.data.content;
|
|
_.apiQuery.postAppSmsCustomer(params).then(res=>{
|
|
this.setData({
|
|
isShowMessage:false,
|
|
submitFlag:false,
|
|
content:'',
|
|
})
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
})
|
|
})
|
|
}
|
|
},
|
|
|
|
//推送链接
|
|
pushLink(e){
|
|
if(e.currentTarget.dataset.url){
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
}
|
|
},
|
|
|
|
//客户来源
|
|
getAppCustomersOffline_sources(){
|
|
_.apiQuery.getAppCustomersOffline_sources().then(res => {
|
|
let of1Arr = []
|
|
res.data.sources.forEach(item => {
|
|
of1Arr.push(item.name)
|
|
})
|
|
this.setData({
|
|
of1Arr,
|
|
sources:res.data.sources
|
|
})
|
|
});
|
|
},
|
|
|
|
//客户来源
|
|
changeOf1(e) {
|
|
if(this.data.of1Index!=e.detail.value){
|
|
let of2Arr = []
|
|
this.data.sources[e.detail.value].list.forEach(item => {
|
|
of2Arr.push(item.name)
|
|
})
|
|
this.setData({
|
|
of2Arr,
|
|
of2Index:-1,
|
|
of_id:this.data.sources[e.detail.value].id,
|
|
of1Index:e.detail.value,
|
|
})
|
|
}
|
|
},
|
|
|
|
changeOf2(e) {
|
|
if(this.data.of2Index!=e.detail.value){
|
|
this.setData({
|
|
of2_id:this.data.sources[this.data.of1Index].list[e.detail.value].id,
|
|
of2Index:e.detail.value,
|
|
})
|
|
}
|
|
},
|
|
|
|
//销售弹窗显示隐藏
|
|
optEmployees(e){
|
|
if(e.currentTarget.dataset.cid){
|
|
this.setData({
|
|
isShowEmployees:true,
|
|
employeeIndex:-1,
|
|
employee_id:'',
|
|
cid:[e.currentTarget.dataset.cid],
|
|
optLevel:e.currentTarget.dataset.level,
|
|
})
|
|
}else{
|
|
this.setData({
|
|
isShowEmployees:!this.data.isShowEmployees,
|
|
employeeIndex:-1,
|
|
employee_id:'',
|
|
cid:[],
|
|
optLevel:'',
|
|
nextIndex:-1,
|
|
distTabId:1,
|
|
distBiz_id:'',
|
|
distBizIndex:-1,
|
|
})
|
|
}
|
|
},
|
|
|
|
//选择店员
|
|
changeEmployee(e) {
|
|
let employee_id = ''
|
|
if(e.detail.value >= 0){
|
|
employee_id = this.data.staffobj[e.detail.value].id
|
|
}
|
|
this.setData({
|
|
employee_id,
|
|
employeeIndex:e.detail.value,
|
|
})
|
|
},
|
|
|
|
//分配客户
|
|
putAppCustomersAdmins(){
|
|
let that = this
|
|
if (that.data.distTabId==1&&that.data.employeeIndex == -1 ) {
|
|
wx.showToast({
|
|
title: '请选择店员',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
else if (that.data.distTabId==1&&that.data.nextIndex == -1 ) {
|
|
wx.showToast({
|
|
title: '请选择计划回访时间',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
else if (that.data.distTabId==2&&that.data.distBizIndex == -1 ) {
|
|
wx.showToast({
|
|
title: '请选择门店',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
else{
|
|
that.setData({
|
|
submitFlag: true,
|
|
})
|
|
let params = {};
|
|
params['ids'] = that.data.cid;
|
|
if(that.data.distTabId==1){
|
|
params['admin_id'] = that.data.employee_id;
|
|
params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day;
|
|
}
|
|
if(that.data.distTabId==2){
|
|
params['biz_id'] = that.data.distBiz_id;
|
|
}
|
|
_.apiQuery.putAppCustomersAdmins(params).then(res => {
|
|
|
|
wx.showToast({
|
|
title: '分配成功',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
that.setData({
|
|
isShowEmployees:false,
|
|
submitFlag:false,
|
|
nextIndex:-1,
|
|
})
|
|
that.onPullDownRefresh()
|
|
|
|
}).catch(res=>{
|
|
that.setData({
|
|
submitFlag: false,
|
|
})
|
|
});
|
|
}
|
|
},
|
|
|
|
//候取当前月日历
|
|
getTimePicker(){
|
|
let date = new Date();
|
|
let cYear = date.getFullYear(); //年份
|
|
let cMonth = date.getMonth()+1; //当前月份
|
|
let cDay = date.getDate();//当前日期
|
|
let fweek = new Date(cYear,cMonth-1,1).getDay();//本月第一天星期几
|
|
let days = new Date(cYear,cMonth,-1)
|
|
let cn = days.getDate()+1 //当月天数
|
|
let rn = ''//上个月天数
|
|
if (cMonth === 1) {
|
|
rn = 31
|
|
} else {
|
|
rn = new Date(cYear,cMonth-1,-1).getDate()+1
|
|
}
|
|
|
|
let dateList = []
|
|
for(let i=0;i<fweek;i++){
|
|
dateList.push({
|
|
isopt:false,
|
|
checked:false,
|
|
year:cMonth == 1?cYear-1:cYear,
|
|
month:cMonth == 1?12:cMonth-1,
|
|
day:rn-i,
|
|
})
|
|
}
|
|
for(let i=1;i<=cn;i++){
|
|
dateList.push({
|
|
isopt:false,
|
|
checked:false,
|
|
year:cYear,
|
|
month:cMonth,
|
|
day:i
|
|
})
|
|
}
|
|
|
|
if((cn-cDay)>29){//相差15天以上不用特意补下个月
|
|
let lweek = new Date(cYear,cMonth-1,cn).getDay();//本月最后天星期几
|
|
let sbu = 6 - lweek //最后一周补齐
|
|
for(let i=1;i<=sbu;i++){
|
|
dateList.push({
|
|
isopt:false,
|
|
checked:false,
|
|
year:cMonth == 12?cYear+1:cYear,
|
|
month:cMonth == 12?1:cMonth+1,
|
|
day:i
|
|
})
|
|
}
|
|
}else{
|
|
let zbu = 30 - (cn-cDay) //至少要补多少天
|
|
let bweek = ''//至少要补的最后一天星期几
|
|
if(cMonth==12){
|
|
bweek = new Date(cYear+1,1,zbu).getDay()
|
|
}else{
|
|
bweek = new Date(cYear,cMonth,zbu).getDay()
|
|
}
|
|
let sbu = zbu + 6 - bweek //最后一周补齐
|
|
for(let i=1;i<=sbu;i++){
|
|
dateList.push({
|
|
isopt:false,
|
|
checked:false,
|
|
year:cMonth == 12?cYear+1:cYear,
|
|
month:cMonth == 12?1:cMonth+1,
|
|
day:i
|
|
})
|
|
}
|
|
}
|
|
|
|
this.setData({
|
|
cYear,
|
|
cMonth,
|
|
cDay,
|
|
dateList,
|
|
})
|
|
|
|
},
|
|
|
|
//显示隐藏时间选择器
|
|
optShowTimePicker(){
|
|
this.setData({
|
|
isShowTimePicker:!this.data.isShowTimePicker,
|
|
})
|
|
|
|
let kd = 15 //可操作天数
|
|
if(this.data.optLevel=='H'){
|
|
kd = 3
|
|
}else if(this.data.optLevel=='A'){
|
|
kd = 7
|
|
}else if(this.data.optLevel=='B'){
|
|
kd = 15
|
|
}else if(this.data.optLevel=='C'){
|
|
kd = 30
|
|
}
|
|
let cindex = ''
|
|
let dateList = this.data.dateList
|
|
dateList.forEach((item,index) => {
|
|
if(item.year == this.data.cYear&&item.month == this.data.cMonth&&item.day == this.data.cDay){
|
|
cindex = index
|
|
}
|
|
})
|
|
dateList.forEach((item,index) => {
|
|
item.isopt = false
|
|
if(cindex<=index&&index<cindex+kd+1){
|
|
item.isopt = true
|
|
}
|
|
})
|
|
this.setData({
|
|
dateList,
|
|
})
|
|
|
|
},
|
|
|
|
//选择计划回访时间
|
|
optday(e){
|
|
if(this.data.nextIndex != e.currentTarget.dataset.index){
|
|
this.setData({
|
|
nextIndex:e.currentTarget.dataset.index,
|
|
})
|
|
}
|
|
},
|
|
|
|
//切换分配本地,其他门店
|
|
changeDistTab(e){
|
|
this.setData({
|
|
distTabId:e.currentTarget.dataset.id,
|
|
employeeIndex:-1,
|
|
employee_id:'',
|
|
nextIndex:-1,
|
|
distBiz_id:'',
|
|
distBizIndex:-1,
|
|
})
|
|
},
|
|
|
|
//分配选择门店
|
|
changeDistBiz(e) {
|
|
let distBiz_id = ''
|
|
if(e.detail.value >= 0){
|
|
distBiz_id = this.data.bizobj[e.detail.value].id
|
|
}
|
|
this.setData({
|
|
distBiz_id,
|
|
distBizIndex:e.detail.value,
|
|
})
|
|
},
|
|
|
|
//多选
|
|
checkPicker(e){
|
|
this.setData({
|
|
['staffobj['+e.currentTarget.dataset.index+'].checked']:!this.data.staffobj[e.currentTarget.dataset.index].checked,
|
|
})
|
|
},
|
|
|
|
//客户标签
|
|
getAppCustomersTag(){
|
|
_.apiQuery.getAppCustomersTag().then(res => {
|
|
this.setData({
|
|
taglList:res.data.tags&&res.data.tags.length>0?res.data.tags:[],
|
|
})
|
|
});
|
|
},
|
|
|
|
//单选
|
|
tagRadioPicker(e){
|
|
let taglList = this.data.taglList
|
|
taglList[e.currentTarget.dataset.i].list.forEach(item => {
|
|
item.checked=false
|
|
})
|
|
taglList[e.currentTarget.dataset.i].list[e.currentTarget.dataset.j].checked=true
|
|
this.setData({
|
|
taglList,
|
|
})
|
|
this.tagforEach()
|
|
},
|
|
|
|
//多选
|
|
tagCheckPicker(e){
|
|
this.setData({
|
|
['taglList['+e.currentTarget.dataset.i+'].list['+e.currentTarget.dataset.j+'].checked']:!this.data.taglList[e.currentTarget.dataset.i].list[e.currentTarget.dataset.j].checked,
|
|
})
|
|
this.tagforEach()
|
|
},
|
|
|
|
//tag遍历
|
|
tagforEach(){
|
|
let taglList = this.data.taglList
|
|
let tag_ids = ''
|
|
taglList.forEach(itemA => {
|
|
itemA.list.forEach(itemB => {
|
|
if(itemB.checked){
|
|
itemA.have=true
|
|
if(tag_ids==''){
|
|
tag_ids=itemB.id
|
|
}else{
|
|
tag_ids=tag_ids+','+itemB.id
|
|
}
|
|
}
|
|
})
|
|
})
|
|
this.setData({
|
|
tag_ids,
|
|
taglList,
|
|
})
|
|
},
|
|
|
|
//获取城市
|
|
getAppCityArea_city(){
|
|
let params = {};
|
|
params['type'] = 'city';
|
|
_.apiQuery.getAppCityArea(params).then(res => {
|
|
let cityArr = []
|
|
let cityIndex = -1
|
|
res.data.list.forEach((item,index) => {
|
|
cityArr.push(item.name)
|
|
// if(this.data.city_id == item.id){
|
|
// cityIndex = index
|
|
// }
|
|
})
|
|
this.setData({
|
|
cityIndex,
|
|
cityArr,
|
|
city:res.data.list
|
|
})
|
|
});
|
|
},
|
|
|
|
//获取行政区
|
|
getAppCityArea_county(){
|
|
let params = {};
|
|
params['pid'] = this.data.city_id;
|
|
params['type'] = 'county';
|
|
_.apiQuery.getAppCityArea(params).then(res => {
|
|
let countyArr = []
|
|
let countyIndex = -1
|
|
res.data.list.forEach((item,index) => {
|
|
countyArr.push(item.name)
|
|
if(this.data.county_id == item.id){
|
|
countyIndex = index
|
|
}
|
|
})
|
|
this.setData({
|
|
countyIndex,
|
|
countyArr,
|
|
county:res.data.list
|
|
})
|
|
});
|
|
},
|
|
|
|
//选择城市
|
|
changeCity(e) {
|
|
if(this.data.cityIndex!=e.detail.value){
|
|
this.setData({
|
|
cityIndex:e.detail.value,
|
|
city_id:this.data.city[e.detail.value].id,
|
|
})
|
|
this.getAppCityArea_county()
|
|
}
|
|
},
|
|
|
|
//选择地区
|
|
changeCounty(e) {
|
|
if(this.data.countyIndex!=e.detail.value){
|
|
this.setData({
|
|
countyIndex:e.detail.value,
|
|
county_id:this.data.county[e.detail.value].id,
|
|
})
|
|
}
|
|
},
|
|
|
|
//隐藏电话弹框
|
|
hideCall(){
|
|
this.setData({
|
|
isShowCall:false,
|
|
})
|
|
},
|
|
|
|
//拨打电话
|
|
makePhoneCall(){
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.phoneNumber,
|
|
})
|
|
},
|
|
|
|
//页面相关事件处理函数--监听用户下拉动作
|
|
onPullDownRefresh(){
|
|
this.setData({
|
|
list: [],
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
flag: this.data.flag + 1
|
|
})
|
|
this.getAppCustomersList()
|
|
},
|
|
|
|
//页面上拉触底事件的处理函数
|
|
onReachBottom(){
|
|
if (this.data.noData || this.data.end||!this.data.load) return;
|
|
this.setData({
|
|
flag: this.data.flag + 1
|
|
})
|
|
this.getAppCustomersList()
|
|
},
|
|
bindShowBrand(){
|
|
this.setData({
|
|
brand_page_show:true
|
|
})
|
|
},
|
|
//获取品牌信息
|
|
getBrandData(e) {
|
|
console.log(e.detail)
|
|
if (e.detail.index > -1 && e.detail.item) {
|
|
this.setData({
|
|
brand_id: e.detail.item.id,
|
|
brand_name: e.detail.item.name,
|
|
brandIndex: e.detail.index,
|
|
series_id: '', //车系id
|
|
modelArray: [],
|
|
modelIndex: -1, //车系车型索引
|
|
})
|
|
this.getAppSeries()
|
|
}
|
|
},
|
|
}) |