import Vue from 'vue' const addMixins = { data() { return { items: [ { value: '1',name: '已沟通',checked: false}, { value: '2',name: '联系不上',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: 1 }, { name: '小程序', value: 2 }, { name: '公众号', value: 3 }, { name: '小红书', value: 4 }, { name: '微博', value: 5 }, { name: '搜狐', value: 6 }, { name: '其他', value: 7 } ], genderText: '', // 客户性别 genderActions: [ { name: '男', value: 1 }, { name: '女', value: 2 } ], ageText: '', // 客户年龄 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: 1 }, { name: '未加群', value: 2 } ], labelsList: [ { name: '国产品牌', value: 1, isChecked: false }, { name: '国产品牌', value: 1, isChecked: false }, { name: '国产品牌', value: 1, isChecked: false }, { name: '国产品牌', value: 1, isChecked: false }, { name: '国产品牌', value: 1, isChecked: false }, { name: '国产品牌', value: 1, isChecked: false }, ], checkedLabelList: '', staticLabelsList: [{ // 静态标签 label: '', isAssociation: false }], checkStaticLabelsIndex: 0, // 静态标签索引 staticLabelsActionList: [],// 静态标签联动搜索列表 trendsLabelsList: [{ // 动态标签 label: '', isAssociation: false }], checkTrendsLabelsIndex: 0, // 动态标签索引 trendsLabelsActionList: [],// 动态标签联动搜索列表 } }, computed: { }, methods: { // 切换沟通情况 radioChange(evt) { for (let i = 0; i < this.items.length; i++) { if (this.items[i].value === evt.detail.value) { this.current = i break } } }, handleCheckedLabel(label, index) { // 选择标签 label.isChecked = !label.isChecked if (label.isChecked) { if (!this.contains(this.checkedLabelList, label.id)) { this.checkedLabelList.push(label.id) } } else { this.checkedLabelList.splice(this.checkedLabelList.indexOf(label.id), 1) } this.remarksParams.labels = this.checkedLabelList.join(',') }, // 标签联动搜索 async getCmremarkslist(index,value,type){ try{ const res = await this.UserService.getCmremarkslist({ remarks: value }) 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,2) } 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