import Vue from 'vue' const addMixins = { data() { return { items: [ { name: '已沟通',value: '0',checked: false,}, { name: '联系不上',value: '1',checked: false} ], checkboItems:[ { name: '电话',value: '1',checked: false,}, { name: '微信',value: '2',checked: false} ], current: '', priceFlagText: '', priceActions: [ { name: '敏感', value: 1 }, { name: '适中', value: 2 }, { name: '不敏感', value: 3 }, { name: '不明确', value: 4 } ], intenFlagText: '', intenActions: [ { name: '意向强烈', value: 1 }, { name: '意向中等', value: 2 }, { name: '意向平淡', value: 3 }, { name: '随便看看', value: 4 } ], followStateText: '', stateActions: [ { name: '跟进中', value: 1 }, { name: '跟进完成', value: 2 }, { name: '已放弃', value: 3 }, ], sourceStateText: '', // 客户来源 sourceActions: [ { name: '网站', value: 0 }, { name: '小程序', value: 1 }, { name: '公众号', value: 2 }, { name: '小红书', value: 3 }, { name: '微博', value: 4 }, { name: '搜狐', value: 5 }, { name: '其他', value: 6 } ], genderText: '', // 客户性别 genderActions: [ { name: '男', value: 0 }, { name: '女', value: 1 } ], customerAge: '', // 客户年龄 ageActions: [ { name: '20-30', value: 1 }, { name: '30-40', value: 2 }, { name: '40-50', value: 3 }, { name: '50-60', value: 4 }, { name: '60以上', value: 4 } ], additiveText: '', // 加群情况 additiveActions: [ { name: '已加群', value: 0 }, { name: '未加群', value: 1 } ], labelsList: [], firstLabelList: [], staticLabelsList: [{ // 静态标签 label: '', isAssociation: false }], checkStaticLabelsIndex: 0, // 静态标签索引 staticLabelsActionList: [],// 静态标签联动搜索列表 trendsLabelsList: [{ // 动态标签 label: '', isAssociation: false }], checkTrendsLabelsIndex: 0, // 动态标签索引 trendsLabelsActionList: [],// 动态标签联动搜索列表 } }, computed: { }, methods: { // 切换沟通情况 radioChange(evt) { console.log('evnt',evt.detail.value) for (let i = 0; i < this.items.length; i++) { if (this.items[i].value === evt.detail.value) { this.current = i this.remarksParams.communicationSituation = evt.detail.value*1 console.log('communicationMethods',this.remarksParams.communicationSituation) break } } }, // 选择联系方式 checkboxChange(evnt){ let data = evnt.detail.value this.remarksParams.communicationMethods = data.join(',') console.log('communicationMethods',this.remarksParams.communicationMethods) }, bindPickerChange(type, e) { //选择筛选条件 switch (type) { case 1: this.priceFlagText = this.priceActions[e.target.value].name this.remarksParams.pinceSensitve = this.priceActions[e.target.value].value break case 2: this.intenFlagText = this.intenActions[e.target.value].name this.remarksParams.satisfied = this.intenActions[e.target.value].value break case 3: this.followStateText = this.stateActions[e.target.value].name this.remarksParams.followup = this.stateActions[e.target.value].value break case 4: // 客户来源 this.sourceStateText = this.sourceActions[e.target.value].name this.remarksParams.customerSource = this.sourceActions[e.target.value].value break case 5: // 客户性别 this.genderText = this.genderActions[e.target.value].name this.remarksParams.customerGender = this.genderActions[e.target.value].value break case 6: // 客户年龄 this.customerAge = this.ageActions[e.target.value].name this.remarksParams.customerAge = this.ageActions[e.target.value].name break case 7: // 加群情况 this.additiveText = this.additiveActions[e.target.value].name this.remarksParams.groupAddition = this.additiveActions[e.target.value].value break } }, handleCheckedLabel(label, index) { // 选择标签 label.isChecked = !label.isChecked if (label.isChecked) { if (!this.contains(this.firstLabelList, label.label)) { this.firstLabelList.push(label.label) } } else { this.firstLabelList.splice(this.firstLabelList.indexOf(label.label), 1) } console.log('firstLabelList', this.firstLabelList) }, // 标签联动搜索 async getCmremarkslist(index,value,type){ try{ const res = await this.UserService.getCmremarkslist({ remarks: value , type : type }) const data = res.data if(data && data.length > 0){ if(type === 1){ this.staticLabelsActionList = data this.staticLabelsList[index].isAssociation = true }else{ this.trendsLabelsActionList = data this.trendsLabelsList[index].isAssociation = true } }else{ if(type === 1){ this.staticLabelsActionList = [] this.staticLabelsList[index].isAssociation = false }else{ this.trendsLabelsActionList = [] this.trendsLabelsList[index].isAssociation = false } } }catch(error){ console.log('=========>获取静态标签联想列表失败') } }, // 静态标签联想 handleStaticLabelsAction(index, event) { this.staticLabelsActionList = [] this.checkStaticLabelsIndex = index if (event.detail.value != '') { this.getCmremarkslist(index,event.detail.value,1) } else { this.staticLabelsList[index].isAssociation = false } }, //隐藏对应的联想弹窗 hideStaticLabelsAction(item, event) { item.isAssociation = false }, //选择静态标签 handleSelectStaticLabels(ass, item) { item.isAssociation = false item.label = ass }, //添加静态标签 handleAddStaticLabels(item, index) { let obj = { label: '', isAssociation: false } item.isAssociation = false this.staticLabelsList.push(obj) }, //删除静态标签 handleDelStaticLabels(item, index) { this.staticLabelsList.splice(index, 1) }, // 动态标签联想 handleTrendsLabelsAction(index, event) { this.trendsLabelsActionList = [] this.checkTrendsLabelsIndex = index if (event.detail.value != '') { this.getCmremarkslist(index,event.detail.value,0) } else { this.trendsLabelsList[index].isAssociation = false } }, //隐藏对应的联想弹窗 hideTrendsLabelsAction(item, event) { item.isAssociation = false }, //选择动态标签 handleSelectTrendsLabels(ass, item) { item.isAssociation = false item.label = ass }, //添加动态标签 handleAddTrendsLabels(item, index) { let obj = { label: '', isAssociation: false } item.isAssociation = false this.trendsLabelsList.push(obj) }, //删除动态标签 handleDelTrendsLabels(item, index) { this.trendsLabelsList.splice(index, 1) }, } } export default addMixins