Commit d213eb62 by chenwq Committed by 杨北旺

编辑sop,客户弹窗

1 parent beee0f63
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const getCustomerByTagListApi = params => {
params.method = 'entmicro.api.customer.getCustomerPageByTag'
params.source = 'scrm-home'
return http({
url: 'rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getCustomerByTagListApi }
<!-- 编辑sop -->
<template>
<div class="edit-gift marketing p-t-20 edit-box">
<div class="sop-base-info marketing p-t-20 edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="customerList">
<el-button class="default-blue-btn" :size="size" @click="handleSelectCustomer">选择客户</el-button>
<el-button :size="size" @click="handleResetCostomer">重置客户</el-button>
<!-- <div v-show="editForm.customerList.length != 0" :key="key" class="el-input-tag input-tag-wrapper">
<span v-for="(tag, idx) in tagging" :key="idx">
<el-tag v-for="(tagItem, idx1) in tag.labelList" :key="idx1" :size="size" type="info" closable :disable-transitions="false" @close="removeTag(tag, idx1, idx)">{{ tagItem.name }}</el-tag>
</span>
</div> -->
<div v-show="editForm.customerList.length != 0" :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(item, idx) in editForm.customerList" :key="idx" :size="size" type="info" closable :disable-transitions="false" @close="removeTag(item, idx)">
<i class="el-icon-user-solid"></i>
{{ item.customerName }}
</el-tag>
</div>
</div>
</glsx-combi-form>
</div>
......@@ -106,7 +107,7 @@ export default {
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
console.log(this.routeInfo.addOrEdit)
// console.log(this.routeInfo.addOrEdit)
this.routeInfo.addOrEdit != 'add' ? this.getInfo() : ''
},
......@@ -121,9 +122,9 @@ export default {
},
// 选择标签
handleSelect(val) {
this.isUpdate = true
this.tagging = val
handleSelect(obj) {
this.tagging = obj.selectedLabelList
this.editForm.customerList = obj.selectedCustomerList
let arr = []
this.tagging.forEach(item => {
item.labelList.forEach(tag => {
......@@ -137,16 +138,17 @@ export default {
})
})
this.taggingList = arr
console.log(this.taggingList)
// this.taggingList = val
console.log(val, '1')
console.log(this.tagging, '2')
// console.log(this.taggingList)
// this.taggingList = obj
console.log(obj, '1')
this.key = new Date()
// console.log(this.tagging, '2')
},
handleSelectCustomer() {
this.isTagVisible = !this.isTagVisible
this.$refs.selectLabel.init(this.tagging)
console.log(this.isTagVisible)
this.$refs.selectLabel.init({ tagList: this.tagging, customerList: this.editForm.customerList })
// console.log(this.isTagVisible)
},
handleResetCostomer() { },
......@@ -194,9 +196,33 @@ export default {
}
}
</script>
<style scoped>
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
<style lang="scss" scoped>
.sop-base-info {
.input-tag-wrapper {
max-height: 75px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 450px;
display: flex;
align-items: center;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
}
</style>
<template>
<div class="select-cutomer">
<div class="title">备注:为确保营销渠道正常触达,仅支持选择同条件客户(是否加企微、是否有手机号)</div>
<div class="flex-default">
<div class="customer-list">
<div v-show="selectedLabelList.length != 0" class="tag-box">
<span class="tag-label">用户标签:</span>
<div class="el-input-tag input-tag-wrapper">
<span v-for="(tag, idx) in selectedLabelList" :key="idx">
<el-tag v-for="(tagItem, idx1) in tag.labelList" :key="idx1" :size="size" type="info" :disable-transitions="false">{{ tagItem.name }}</el-tag>
</span>
</div>
</div>
<GLTable ref="customerRef" :getListApi="getListApi" :pageConf="pageConf" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @selectionTable="handleSelectionTable"></GLTable>
</div>
<div class="selected-list">
<p class="list-title p-16">已选({{ selectedSum }})</p>
<div class="list-customers">
<el-tag v-for="(item, idx) in selectedCustomerList" :key="idx" :size="size" type="info" :disable-transitions="false">
<i class="el-icon-user-solid"></i>
{{ item.customerName }}
</el-tag>
</div>
</div>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'selectCustomer',
data() {
return {
url: url,
searchForm: {},
customerList: [],
selectedSum: 0,
// 表格
getListApi: this.$apis.sop.getCustomerByTagListApi,
tableParams: {
listName: 'data',
// 行数据的key
mutiSelectUniqueKey: 'oneId',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '客户名称',
prop: 'customerName',
line: 1,
width: '110px'
},
{
label: '客户手机号',
prop: 'customerPhone',
width: '110px',
formatter: cellValue => {
return cellValue.customerPhone || '-'
}
},
{
label: '性别',
prop: 'customerSex',
width: '60px',
formatter: cellValue => {
return this.baseData.sexList.find(item => item.confId == cellValue.customerSex).confName
}
},
{
label: '是否加企微',
prop: 'isJoin',
formatter: cellValue => {
return this.baseData.joinList.find(item => item.confId == cellValue.isJoin).confName
}
},
{
label: '添加客户时间',
prop: 'addTime',
width: '160px'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
baseData: {
sexList: [
{
confId: 0,
confName: '未知'
},
{
confId: 1,
confName: '男'
},
{
confId: 2,
confName: '女'
}
],
joinList: [
{
confId: 0,
confName: '否'
},
{
confId: 1,
confName: '是'
}
]
}
}
},
props: {
selectedLabelList: {
type: Array,
default: () => []
},
selectedCustomerList: {
type: Array,
default: () => []
}
},
mounted() {
// this.getList()
},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = {
tagLists: []
}
this.selectedLabelList.length &&
this.selectedLabelList.forEach(item => {
item.labelList.forEach(subItem => {
this.searchForm.tagLists.push({
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
groupType: item.labelType,
labelId: subItem.id,
labelName: subItem.name
})
})
})
// console.log(this.searchForm.tagLists)
resolve()
})
},
setTableFinishFun() {
this.tableList = this.$refs.customerRef.data
this.recoverySelected()
//接收到的数据为空
this.$refs.customerRef.data.length ? (this.$refs.customerRef.tableHeightValues = '') : this.$refs.customerRef.setTableHeightFun()
},
recoverySelected() {
this.selectedCustomerList.forEach(row => {
var idx = this.tableList.findIndex(k => k.oneId == row.oneId)
if (idx != -1) {
this.$refs.customerRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.tableList[idx], true)
}
})
},
handleSelectionTable(val) {
this.selectedCustomerList = JSON.parse(JSON.stringify(val))
console.log(this.selectedCustomerList)
},
getList() { }
}
}
</script>
<style lang="scss" scoped>
.select-cutomer {
.title {
margin-bottom: 12px;
}
.tag-box {
display: flex;
margin: 20px 16px;
.tag-label {
display: inline-block;
height: 30px;
line-height: 30px;
}
.input-tag-wrapper {
max-height: 75px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 450px;
display: flex;
align-items: center;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
}
.customer-list {
width: calc(100% - 280px);
border: 1px solid #eeeeee;
margin-right: 10px;
}
.p-16 {
padding: 16px;
}
.selected-list {
width: 280px;
border-radius: 2px;
border: 1px solid #eeeeee;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
.list-title {
font-size: 16px;
border-bottom: 1px solid #f1f1f1;
}
.list-customers {
box-sizing: border-box;
height: 61vh;
padding: 10px;
overflow-y: scroll;
}
.customer-box {
padding: 16px;
.customer-label {
color: #999999;
margin-bottom: 14px;
}
.customer-content {
border-bottom: 1px solid #e5e5e5;
.customer-item {
margin-bottom: 20px;
display: inline-flex;
align-items: center;
.muti-icon {
cursor: pointer;
}
.customer-coupon-name {
display: inline-block;
width: 109px;
margin: 0 5px 0 7px;
}
.customer-sum {
display: inline-block;
width: 82px;
text-align: right;
.el-input-number--mini .el-input__inner {
padding: 0 10px;
}
.sum-input {
display: inline-block;
width: 82px;
}
.el-input--mini .el-input__inner {
border: 0px;
}
.el-input-number--mini .el-input-number__decrease,
.el-input-number--mini .el-input-number__increase {
width: 20px !important;
border: 0px;
background-color: #fff;
}
}
.customer-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.customer-item:last-child {
margin-bottom: 0;
}
}
.customer-content:last-child {
border-bottom: 0px;
}
}
}
}
</style>
<template>
<div class="tag-main">
<el-dialog title="选择标签" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
<div class="tag-panel">
<el-dialog :title="activeName == 'tag' ? '选择标签' : '选择客户'" :visible.sync="dialogVisible" width="1080px" :before-close="handleClose">
<div v-show="activeName == 'tag'" class="tag-panel">
<div class="tag-panel-select">
<div class="tag-title">预选标签</div>
<div class="tag-select-box">
......@@ -42,6 +42,7 @@
</div>
</div>
</div>
<select-customer v-if="activeName == 'cutomer'" ref="customerRef" :selectedLabelList="selectedLabelList" :selectedCustomerList.sync="selectedCustomerList"></select-customer>
<span slot="footer" class="dialog-footer">
<!-- <a class="dialog-jump" @click="jumpUrl" v-if="this.$globalState.session.accountLevel == 4 && this.$globalState.session.merchantModel == 2">没有意向标签?点我创建</a> -->
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
......@@ -54,10 +55,12 @@
<script>
import { utils } from 'glsx-common'
import util from '@/utils/util'
import selectCustomer from './selectCustomer.vue'
export default {
name: 'activityModel',
data() {
return {
activeName: 'tag',
heightBox: 200,
dialogVisible: false,
labelGroupName: '',
......@@ -88,9 +91,14 @@ export default {
// isIndeterminate: false,
// checkAll: false
// }
]
],
selectedLabelList: [],
selectedCustomerList: []
}
},
components: {
selectCustomer
},
watch: {
labelTreeRets: {
handler() {
......@@ -112,7 +120,9 @@ export default {
init(item) {
this.labelGroupName = ''
this.dialogVisible = true
this.querylabeltree(item)
this.activeName = 'tag'
this.selectedCustomerList = JSON.parse(JSON.stringify(item.customerList))
this.querylabeltree(item.tagList)
},
handleSearch() {
this.searchStatus = true
......@@ -180,8 +190,7 @@ export default {
},
//选中
handleSelect() {
this.dialogVisible = false
let labelTreeRets = this.labelTreeRets
this.selectedLabelList = this.labelTreeRets
.map(item => {
if (item.tagChecked) {
return {
......@@ -192,8 +201,15 @@ export default {
}
})
.filter(item => item)
console.log(labelTreeRets)
this.$emit('tagSelected', labelTreeRets)
console.log(this.selectedLabelList)
// 标签
if (this.activeName == 'tag') {
this.activeName = 'cutomer'
return false
}
// 客户
this.$emit('tagSelected', { selectedLabelList: this.selectedLabelList, selectedCustomerList: this.$refs.customerRef.selectedCustomerList })
this.dialogVisible = false
},
handleReset() {
this.labelGroupName = ''
......@@ -297,7 +313,7 @@ export default {
margin: 8px 0;
display: inline-flex;
align-items: center;
/deep/.el-radio__inner{
/deep/.el-radio__inner {
box-shadow: none !important;
}
/deep/.el-radio__label {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!