Commit 583137d8 by xinla

--no commit message

1 parent d0045c80
<template>
<div style="padding: 10px 20px">
<template v-if="dateType === 1 || dateType === 3 || dateType === 4">
第
<el-input-number
style="width: 100px"
v-model="form.pushTimePre"
controls-position="right"
:min="1"
:readonly="read"
@input="nubmerFn($event)"></el-input-number>
天,
</template>
<template v-else-if="dateType === 2 || dateType === 6">
<el-date-picker
:readonly="read"
style="width: 130px; margin-right: 10px"
v-model="form.pushTimePre"
value-format="yyyy-MM-dd"
@change="setChange"
type="date"
placeholder="选择日期"
v-bind="pickerOptions"></el-date-picker>
</template>
<template v-else>
推送周期:
<el-select :readonly="read" @change="setChange" v-model="form.pushTimePre">
<el-option v-for="(unit, key) in list" :key="key" :value="unit.value" :label="unit.label"></el-option>
</el-select>
<div style="margin-top: 20px">
具体时间:
<el-time-select
:readonly="read"
style="width: 120px"
v-model="form.pushStartTime"
v-bind="{
start: '00:00',
end: '23:59',
step: '00:15',
maxTime: form.pushEndTime,
}"
placeholder="时间点"
@change="setChange"></el-time-select>
--
<el-time-select
:readonly="read"
style="width: 120px"
v-bind="{
start: '00:00',
end: '23:59',
step: '00:15',
minTime: form.pushStartTime,
}"
v-model="form.pushEndTime"
placeholder="时间点"
@change="setChange"></el-time-select>
</div>
</template>
<template v-if="dateType !== 5">
<el-time-select
:readonly="read"
style="width: 120px"
v-model="form.pushStartTime"
v-bind="{
start: '00:00',
end: '23:59',
step: '00:15',
maxTime: form.pushEndTime,
}"
placeholder="时间点"
@change="setChange"></el-time-select>
至
<el-time-select
:readonly="read"
style="width: 120px"
v-bind="{
start: '00:00',
end: '23:59',
step: '00:15',
minTime: form.pushStartTime,
}"
v-model="form.pushEndTime"
placeholder="时间点"
@change="setChange"></el-time-select>
内推送
</template>
</div>
</template>
<script>
export default {
name: 'push-time-unit',
props: {
read: {
type: Boolean,
default: false,
},
dateType: {
type: Number,
default: 1,
},
init: {
type: Object,
default: {
pushStartTime: '',
pushEndTime: '',
pushTimeType: 3,
pushTimePre: '',
attachments: [],
},
},
},
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
},
},
form: {
pushStartTime: '',
pushEndTime: '',
pushTimeType: 3,
pushTimePre: '',
attachments: [],
},
list: [
{ value: '', label: '请选择周期' },
{ value: '1', label: '周一' },
{ value: '2', label: '周二' },
{ value: '3', label: '周三' },
{ value: '4', label: '周四' },
{ value: '5', label: '周五' },
{ value: '6', label: '周六' },
{ value: '7', label: '周日' },
],
rules: {},
}
},
methods: {
nubmerFn(event) {
console.log()
let data = event.target.value
let reg = /^[1-9]+$/
if (!reg.test(data)) {
this.msgError('只能输入正整数排序')
this.$nextTick(() => {
console.log(data)
event.target.value = data ? data.replace(/[^1-9]/g, '') : 1
})
}
this.setChange()
},
setChange() {
this.$emit('update', this.form)
},
},
created() {
this.form = this.init
this.form.pushTimeType = this.dateType === 5 ? 2 : this.dateType === 2 || this.dateType === 6 ? 1 : 3
},
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<el-button icon="el-icon-plus" type="primary" plain @click="addItem">添加属性</el-button>
<div class="form_inline">
<div
class="first_level_left"
v-if="dataList.length > 1 || (dataList[0] && dataList[0].executeCustomerQUECondits.length > 1)">
<div
class="border_dot"
v-if="!(dataList.length === 2 && dataList[0].executeCustomerQUECondits.length === 0)"></div>
<div class="word_con" v-if="!(dataList.length === 2 && dataList[0].executeCustomerQUECondits.length === 0)">
<span>且</span>
</div>
</div>
<div class="first_level_right">
<template v-for="(unit, key) in dataList" :key="key">
<div v-if="key === 0">
<template v-for="(item, index) in unit.executeCustomerQUECondits" :key="index + 1">
<CustomerAttributes
:disabled="disableList"
:enableList="attributesList"
v-model:currentData="dataList[key].executeCustomerQUECondits[index]"
:baseData="baseEnum.CustomerAttributesEnum"
:relationData="baseEnum.RelationEnum"
:groupChatEnum="baseEnum.GroupChatEnum"
:weCorpTagEnum="baseEnum.WeCorpTagEnum"
@change="getChange"
ref="attributes"
@updatedata="updateData"
@remove="setRemoveFn(key, index)"
:showDelete="index !== 0 || dataList.length > 1"></CustomerAttributes>
</template>
</div>
<div v-if="key > 0">
<div class="form_inline" style="margin-top: 0; margin-left: 5px">
<div class="first_level_left">
<div class="border_dot"></div>
<div class="word_con">
<span>或</span>
</div>
</div>
<div class="first_level_right">
<template v-for="(item, index) in unit.executeCustomerQUECondits" :key="index + 2">
<CustomerAttributes
:disabled="disableList"
:enableList="attributesList"
ref="attributes"
:showDelete="index !== 0 || dataList[0].executeCustomerQUECondits.length !== 0"
v-model:currentData="dataList[key].executeCustomerQUECondits[index]"
:baseData="baseEnum.CustomerAttributesEnum"
:relationData="baseEnum.RelationEnum"
:groupChatEnum="baseEnum.GroupChatEnum"
:weCorpTagEnum="baseEnum.WeCorpTagEnum"
@change="getChange"
@updatedata="updateData"
@remove="setRemoveFn(key, index)"></CustomerAttributes>
</template>
</div>
</div>
</div>
</template>
</div>
</div>
</div>
</template>
<script>
import { getBaseData } from '@/api/sop/index'
import CustomerAttributes from './CustomerAttributes.vue'
export default {
name: 'select-attribute-in-sop',
components: {
CustomerAttributes,
},
props: {
init: {
type: Array,
default: () => [],
},
baseData: {
type: Object,
default: {
businessType: null,
sendType: 1,
},
},
},
watch: {
init: {
deep: true,
handler() {
this.dataList = this.init
this.setEnableList()
this.setDisableList()
},
},
},
data() {
return {
attributesList: [],
disableList: [],
baseEnum: {
CustomerAttributesEnum: [],
RelationEnum: [],
GroupChatEnum: [],
WeCorpTagEnum: [],
},
realtionData: [],
dataList: [],
}
},
computed: {},
methods: {
setEnableList() {
if (this.baseData.businessType === 1) {
this.attributesList = [2, 100, 0]
} else {
if (this.baseData.sendType === 1) {
this.attributesList = [2, 15, 100, 0]
} else {
this.attributesList = [2, 3, 5, 7, 12, 15, 100, 0, 102]
}
}
// [2, 3, 5, 7, 12, 15, 100, 0, 102] //base
// [2, 15, 100, 0] // 企微群发
// [2, 100, 0] // 新客
},
setDisableList() {
let arr = []
this.dataList.forEach((dd, index) => {
if (index > 0) {
arr.push(dd.executeCustomerQUECondits[0].code)
}
})
this.disableList = arr
},
validateFn() {
if (this.$refs['attributes']) {
let result = []
let arr = this.$refs['attributes']
let channelGo = true
arr.forEach((dd, index) => {
if (dd && !dd.handleValidateFn()) {
channelGo = false
}
})
result.push(channelGo)
let valid = true
result.forEach((dd) => {
if (!dd) {
valid = false
}
})
return valid
} else {
this.msgError('请添加属性!')
return false
}
},
updateData() {
this.$emit('update', this.dataList)
},
setRemoveFn(key, index) {
this.dataList[key].executeCustomerQUECondits.splice(index, 1)
this.getChange()
},
async getChange() {
let arr = []
this.dataList.forEach((dd) => {
arr = [...arr, ...dd.executeCustomerQUECondits]
})
let data = await this.newArryByCode(arr)
this.dataList = []
let newValue = [{ andOr: 1, executeCustomerQUECondits: [] }]
data.forEach((dd) => {
if (dd.code && dd.data.length > 1) {
newValue.push({
andOr: 2,
executeCustomerQUECondits: dd.data,
})
} else {
newValue[0].executeCustomerQUECondits.push(...dd.data)
}
})
this.dataList = newValue
// this.$forceUpdate()
this.setDisableList()
},
newArryByCode(arr) {
let map = {}
let dest = []
for (let i = 0; i < arr.length; i++) {
let ai = arr[i]
let current = ai.code.toString()
if (!map[current]) {
dest.push({
code: current,
data: [ai],
})
map[current] = ai
} else {
for (let j = 0; j < dest.length; j++) {
let dj = dest[j]
if (dj.code == current) {
dj.data.push(ai)
break
}
}
}
}
return dest
},
addItem() {
if (!this.dataList.length) {
this.dataList.push({
andOr: 1,
executeCustomerQUECondits: [
{
swipType: '',
code: '',
endTime: '',
name: '',
relation: null,
startTime: '',
value: '',
},
],
})
} else {
this.dataList[0].executeCustomerQUECondits.push({
swipType: '',
code: '',
endTime: '',
name: '',
relation: null,
startTime: '',
value: '',
})
}
},
},
created() {
if (this.init && this.init.length) {
this.dataList = this.init
}
this.setEnableList()
getBaseData(['CustomerAttributesEnum', 'RelationEnum', 'GroupChatEnum', 'WeCorpTagEnum']).then((res) => {
if (res.code === 200) {
this.baseEnum = res.data
let arr = [
{
code: 100,
value: '客户标签',
},
{
code: 0,
value: '渠道来源',
},
{
code: 102,
value: '所属群聊',
},
]
this.baseEnum.CustomerAttributesEnum = [...this.baseEnum.CustomerAttributesEnum, ...arr]
}
})
},
}
</script>
<style scoped lang="scss">
.form_inline {
margin-top: 20px;
display: flex;
justify-items: center;
.first_level_left {
margin: 10px 0;
height: auto;
position: relative;
.border_dot {
border: 1px dotted var(--color);
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
border-right: transparent;
width: 30px;
height: 100%;
}
.word_con {
line-height: normal;
background-color: #ecf5ff;
font-size: 12px;
color: var(--color);
position: absolute;
top: 50%;
left: -5px;
transform: translateY(-50%);
display: flex;
border-radius: 3px;
}
}
}
</style>
<template>
<div>
<el-radio-group v-model="newCustomerAll" @change="clearChange">
<el-radio :label="1">{{ currentType === 4 ? '全部新客群' : '全部客群' }}</el-radio>
<el-radio v-if="!hidePart" :label="2">{{ currentType === 4 ? '部分新客群' : '部分客群' }}</el-radio>
</el-radio-group>
<div class="select_content" v-if="newCustomerAll === 2">
<div>
<el-checkbox
v-model="form.weSopExecuteGroupTimeCondit.change"
@change="selectGroupTimeChange"
label="客群创建时间"></el-checkbox>
<div class="select_unit" v-if="form.weSopExecuteGroupTimeCondit.change">
<el-date-picker
@change="getChangeDate"
v-model="dateRange"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
v-bind="pickerOptions"></el-date-picker>
</div>
</div>
<div>
<el-checkbox
v-model="form.weSopExecuteGroupTagIdsCondit.change"
@change="clearTagFn"
label="客群标签"></el-checkbox>
<div class="select_unit" v-if="form.weSopExecuteGroupTagIdsCondit.change">
<div v-if="selectedTagList.length > 0">
<el-tag v-for="(item, index) in selectedTagList" :key="index">{{ item.name }}</el-tag>
</div>
<el-button icon="el-icon-plus" type="primary" plain @click="dialogVisibleSelectTag = true">
{{ selectedTagList.length ? '修改' : '选择' }}标签
</el-button>
</div>
</div>
<div v-if="currentType !== 4">
<el-checkbox
v-model="form.weSopExecuteGroupMemberLimitCondit.change"
@change="clearNumberFn"
label="客群人数"></el-checkbox>
<div class="select_unit" v-if="form.weSopExecuteGroupMemberLimitCondit.change">
<div style="display: flex">
<el-input
@input="nubmer($event)"
style="width: 150px"
v-model="form.weSopExecuteGroupMemberLimitCondit.groupMemberDown"></el-input>
<span style="padding: 0 20px">--</span>
<el-input
@input="nubmer($event)"
style="width: 150px"
v-model="form.weSopExecuteGroupMemberLimitCondit.groupMemberUp"></el-input>
</div>
</div>
</div>
</div>
<SelectTag
v-model:visible="dialogVisibleSelectTag"
type="2"
:selected="selectedTagList"
@success="getSelectTag"></SelectTag>
</div>
</template>
<script>
import SelectTag from '@/components/SelectTag.vue'
import { pickerOptions } from '@/utils/index'
import { getList } from '@/api/customer/tag'
export default {
name: 'select-group',
data() {
return {
dialogVisibleSelectTag: false,
selectedTagList: [],
pickerOptions: pickerOptions,
dateRange: [],
newCustomerAll: 1, // 新客sop 生效客户
form: {
weSopExecuteGroupTimeCondit: {
change: false,
beginTime: '',
endTime: '',
},
weSopExecuteGroupTagIdsCondit: {
change: false,
tagIds: [],
},
weSopExecuteGroupMemberLimitCondit: {
change: false,
groupMemberUp: '',
groupMemberDown: '',
},
},
hidePart: true,
}
},
props: {
sendType: {
type: Number,
default: 1,
},
currentType: {
type: Number,
default: 4,
},
initData: {
type: Object,
default: {
weSopExecuteGroupTimeCondit: {
change: false,
beginTime: '',
endTime: '',
},
weSopExecuteGroupTagIdsCondit: {
change: false,
tagIds: [],
},
weSopExecuteGroupMemberLimitCondit: {
change: false,
groupMemberUp: '',
groupMemberDown: '',
},
},
},
},
watch: {
sendType: {
immediate: true,
handler(val, old) {
if (val == 1) {
this.hidePart = true
this.newCustomerAll = 1
this.clearChange()
} else {
this.hidePart = false
// this.newCustomerAll = 2
}
},
},
},
components: {
SelectTag,
},
methods: {
nubmer(e) {
let _value = e.target.value
const reg = isNaN(_value)
if (reg) {
e.target.value = _value.replace(/^[^1-9]/g, '')
}
if (_value === '0') {
e.target.value = _value.replace(/^[^1-9]/g, '')
}
console.log(e.target.value)
},
clearNumberFn(data) {
if (!data) {
this.form.weSopExecuteGroupMemberLimitCondit.groupMemberUp = ''
this.form.weSopExecuteGroupMemberLimitCondit.groupMemberDown = ''
}
},
getChangeDate(data) {
if (data.length) {
this.form.weSopExecuteGroupTimeCondit.beginTime = data[0]
this.form.weSopExecuteGroupTimeCondit.endTime = data[1]
} else {
this.form.weSopExecuteGroupTimeCondit.beginTime = ''
this.form.weSopExecuteGroupTimeCondit.endTime = ''
}
},
selectGroupTimeChange(data) {
if (!data) {
this.form.weSopExecuteGroupTimeCondit.beginTime = ''
this.form.weSopExecuteGroupTimeCondit.endTime = ''
this.dateRange = []
}
},
clearTagFn(data) {
if (!data) {
this.form.weSopExecuteGroupTagIdsCondit.tagIds = []
}
},
getSelectTag(list) {
this.selectedTagList = list
let arr = []
let arr1 = []
list.forEach((dd) => {
arr.push(dd.name)
arr1.push(dd.tagId)
})
this.form.weSopExecuteGroupTagIdsCondit.tagIds = arr1
},
editTag() {
if (this.form.weSopExecuteGroupTagIdsCondit.tagIds.length) {
this.selectedTagList = []
getList({ groupTagType: 2 }).then(({ rows }) => {
this.listOneArray = []
rows.forEach((element) => {
element.weTags.forEach((d) => {
this.listOneArray.push({ tagId: d.tagId, name: d.name })
})
})
this.form.weSopExecuteGroupTagIdsCondit.tagIds.forEach((dd) => {
let index = this.listOneArray.findIndex((item) => item.tagId == dd)
if (index !== -1) {
this.selectedTagList.push(this.listOneArray[index])
}
})
})
}
},
validateFn() {
if (this.newCustomerAll === 2) {
if (this.currentType === 4) {
if (!this.form.weSopExecuteGroupTimeCondit.change && !this.form.weSopExecuteGroupTagIdsCondit.change) {
this.msgError('请至少勾选一项客群属性!')
return false
}
} else {
if (
!this.form.weSopExecuteGroupTimeCondit.change &&
!this.form.weSopExecuteGroupTagIdsCondit.change &&
!this.form.weSopExecuteGroupMemberLimitCondit.change
) {
this.msgError('请至少勾选一项客群属性!')
return false
}
}
if (this.form.weSopExecuteGroupTimeCondit.change) {
if (!this.form.weSopExecuteGroupTimeCondit.beginTime || !this.form.weSopExecuteGroupTimeCondit.endTime) {
this.msgError('请选择客群创建时间!')
return false
}
}
if (this.form.weSopExecuteGroupTagIdsCondit.change) {
if (!this.form.weSopExecuteGroupTagIdsCondit.tagIds.length) {
this.msgError('请选择客群标签!')
return false
}
}
if (this.currentType !== 4) {
if (this.form.weSopExecuteGroupMemberLimitCondit.change) {
if (
!this.form.weSopExecuteGroupMemberLimitCondit.groupMemberDown ||
!this.form.weSopExecuteGroupMemberLimitCondit.groupMemberUp
) {
this.msgError('请输入客群人数区间!')
return false
}
if (
Number(this.form.weSopExecuteGroupMemberLimitCondit.groupMemberDown) >
Number(this.form.weSopExecuteGroupMemberLimitCondit.groupMemberUp)
) {
this.msgError('请输入正确客群人数区间!')
return false
}
}
}
}
return true
},
clearChange() {
this.form = {
weSopExecuteGroupTimeCondit: {
change: false,
beginTime: '',
endTime: '',
},
weSopExecuteGroupTagIdsCondit: {
change: false,
tagIds: [],
},
weSopExecuteGroupMemberLimitCondit: {
change: false,
groupMemberUp: '',
groupMemberDown: '',
},
}
this.selectedTagList = []
this.dateRange = []
},
submitFn() {
if (this.newCustomerAll === 1) {
this.form = null
}
this.$emit('update', this.form)
},
},
created() {
if (this.initData) {
this.newCustomerAll = 2
if (this.initData.weSopExecuteGroupTimeCondit && this.initData.weSopExecuteGroupTimeCondit.change) {
this.form.weSopExecuteGroupTimeCondit = this.initData.weSopExecuteGroupTimeCondit
this.dateRange = [
this.initData.weSopExecuteGroupTimeCondit.beginTime,
this.initData.weSopExecuteGroupTimeCondit.endTime,
]
}
if (this.initData.weSopExecuteGroupTagIdsCondit && this.initData.weSopExecuteGroupTagIdsCondit.change) {
this.form.weSopExecuteGroupTagIdsCondit = this.initData.weSopExecuteGroupTagIdsCondit
this.editTag()
}
if (this.initData.weSopExecuteGroupMemberLimitCondit && this.initData.weSopExecuteGroupMemberLimitCondit.change) {
this.form.weSopExecuteGroupMemberLimitCondit = this.initData.weSopExecuteGroupMemberLimitCondit
}
// this.$forceUpdate()
}
},
}
</script>
<style lang="scss" scoped>
.select_content {
background-color: #ecf5ff;
padding: 20px;
border-radius: 5px;
.select_unit {
padding: 10px 25px;
}
}
</style>
<script>
import list from './list'
export default {
components: { list },
props: {
// 添加标签显隐
visible: {
type: Boolean,
default: false,
},
// title: {
// type: String,
// default: '',
// },
type: {
type: [String, Number],
default: '4',
},
// 显示哪些素材类型标签
showArr: {
type: Array,
default: () => [],
},
},
data() {
return {
text: {},
image: {},
file: {},
}
},
watch: {},
computed: {
title() {
const titleMap = {
4: '文本',
0: '图片',
9: '图文',
11: '小程序',
2: '视频',
3: '文件',
}
return titleMap[this.type] || '素材'
},
Pvisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
},
},
Ptype: {
get() {
return this.type
},
set(val) {
this.$emit('update:type', val)
},
},
},
created() {},
mounted() {},
methods: {
submit() {
this.Pvisible = false
this.$emit('success', this.selectedData)
},
onChange(data) {
this.selectedData = data
},
},
}
</script>
<template>
<el-dialog :title="`选择${title}`" v-model="Pvisible" width="680px" append-to-body destroy-on-close>
<div>
<list v-if="showArr.length <= 1" :type="showArr[0] || type" @change="onChange"></list>
<el-tabs v-else-if="showArr.length > 1" v-model="Ptype">
<!-- <el-tab-pane name="0" v-if="showArr.includes(0)">
<template #label> <el-icon-date class="el-icon-date"/> 文本 </template>
<list type="4" @change="onChange"> </list>
</el-tab-pane>
<el-tab-pane name="1" v-if="showArr.includes(1)">
<template #label> <el-icon-date class="el-icon-date"/> 图片 </template>
<list type="0" @change="onChange"> </list>
</el-tab-pane> -->
</el-tabs>
</div>
<template #footer>
<el-button @click="Pvisible = false">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</template>
</el-dialog>
</template>
<style lang="scss" scoped>
.user-list {
.el-row {
line-height: 26px;
}
}
.mr30 {
margin-right: 30px;
}
::v-deep.el-dialog__body {
padding: 5px 20px;
height: 76vh;
overflow: auto;
}
</style>
<script>
import { getTree, getList } from '@/api/material'
export default {
components: {},
props: {
type: {
type: [String, Number],
default: '4',
},
},
data() {
return {
loading: true, // 遮罩层
// 查询条件
query: {
pageNum: 1,
pageSize: 10,
categoryId: '',
search: '',
mediaType: '4',
},
list: [], // 列表
total: 0, // 总条数
treeData: [], // 树
// 树props
treeProps: {
children: 'children',
label: 'name',
},
// 分组props
groupProps: {
// expandTrigger: 'hover',
checkStrictly: true,
children: 'children',
label: 'name',
value: 'id',
emitPath: false,
},
radio: '',
}
},
watch: {
radio(val) {
this.$emit('change', val)
},
type(val) {
this.query.mediaType = this.type
this.query.pageNum = 1
this.list = []
this.getList()
},
},
computed: {},
created() {
this.query.mediaType = this.type
this.getList()
},
mounted() {},
methods: {
// 获取素材列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows.map((i) => {
i.checked = false
return i
})
this.total = +total
this.loading = false
this.$emit('listChange', this.list)
})
.catch(() => {
this.loading = false
})
},
onRowClick(row, column, event) {
const evTarget = event.target.nodeName.toUpperCase(0)
if (evTarget == 'INPUT') {
return
}
const checked = row.checked
if (!checked) {
this.list.forEach((i) => (i.checked = false))
}
row.checked = !checked
this.$emit('change', row.checked ? row : null)
},
},
}
</script>
<template>
<div>
<template v-if="type == 4">
<el-input
v-model="query.search"
class="ml10 mr10 mb20"
style="width: 260px"
placeholder="请输入文本内容"
@keydown.enter="getList(1)"></el-input>
</template>
<el-table v-loading="loading" :data="list" @row-click="onRowClick">
<el-table-column width="30">
<template #default="{ row }">
<el-radio v-model="row.checked" :label="true"></el-radio>
</template>
</el-table-column>
<!-- 文本 -->
<template v-if="type == 4">
<el-table-column prop="content" label="文本内容"></el-table-column>
</template>
<!-- 图片 -->
<template v-else-if="type == 0">
<el-table-column label="图片">
<template v-if="type == 0" #default="{ row }">
<div class="ma-img flex aic" :key="row.id">
<el-image fit class="img-li" :src="row.materialUrl" />
</div>
</template>
</el-table-column>
<el-table-column prop="materialUrl" label="图片地址"></el-table-column>
</template>
<!-- 链接 -->
<template v-else-if="type == 9">
<el-table-column prop="materialName" label="图文标题"></el-table-column>
<el-table-column prop="materialUrl" label="图文链接"></el-table-column>
</template>
<!-- 小程序 -->
<template v-else-if="type == 11">
<el-table-column prop="materialName" label="小程序标题"></el-table-column>
<el-table-column prop="digest" label="小程序AppID"></el-table-column>
</template>
<template v-else-if="type == 2">
<el-table-column prop="materialName" label="视频标题"></el-table-column>
<el-table-column prop="digest" label="视频描述"></el-table-column>
<el-table-column prop="materialUrl" label="视频"></el-table-column>
</template>
<template v-else-if="type == 3">
<el-table-column prop="materialName" label="文件标题"></el-table-column>
<el-table-column prop="digest" label="文件描述"></el-table-column>
<el-table-column prop="materialUrl" label="文件"></el-table-column>
</template>
<el-table-column prop="updateTime" label="最近更新时间"></el-table-column>
</el-table>
<el-pagination
class="fr"
@current-change="getList"
:current-page="query.pageNum"
:page-size="query.pageSize"
layout="prev, pager, next"
:total="total"></el-pagination>
</div>
</template>
<style lang="scss" scoped>
.ma-img {
width: 120px;
height: 120px;
border-radius: 8px;
border: 1px solid #e6ebf5;
justify-content: center;
}
</style>
<template>
<div class="select_content">
<div>
<el-checkbox v-model="form.executeUserCondit.change" @change="clearUserData" label="选择成员"></el-checkbox>
<div class="select_unit" v-if="form.executeUserCondit.change">
<div v-if="selectedUserList.length > 0">
<el-tag v-for="(item, index) in selectedUserList" :key="index">{{ item.name }}</el-tag>
</div>
<el-button icon="el-icon-plus" type="primary" plain @click="dialogVisibleSelectUser = true">
{{ selectedUserList.length ? '修改' : '选择' }}员工
</el-button>
</div>
</div>
<div>
<el-checkbox
v-model="form.executeDeptCondit.change"
@change="clearDeptsData"
label="选择部门范围与岗位"></el-checkbox>
<el-popover placement="top" trigger="hover">
<template #reference>
<el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" />
</template>
<div>可根据地域行政管理规划/组织架构部门,与岗位的组合条件来筛选执行成员。</div>
</el-popover>
<div class="select_unit" v-if="form.executeDeptCondit.change">
<div v-if="selectedDeptList.length > 0">
<el-tag v-for="(item, index) in selectedDeptList" :key="index">{{ item.deptName }}</el-tag>
</div>
<el-button icon="el-icon-plus" type="primary" plain @click="dialogVisibleSelectDept = true">
{{ selectedDeptList.length ? '修改' : '选择' }}部门
</el-button>
</div>
<div class="select_unit" v-if="form.executeDeptCondit.change">
<div v-if="selectedPostList.length > 0">
<el-tag v-for="(item, index) in selectedPostList" :key="index">{{ item }}</el-tag>
</div>
<el-button icon="el-icon-plus" type="primary" plain @click="dialogVisibleSelectPost = true">
{{ selectedPostList.length ? '修改' : '选择' }}岗位
</el-button>
</div>
</div>
<SelectDept
:defaultValues="selectedDeptList"
v-model:visible="dialogVisibleSelectDept"
title="选择部门"
@success="selectedDept"></SelectDept>
<SelectPost
:defaultValues="selectedPostList"
v-model:visible="dialogVisibleSelectPost"
title="选择岗位"
@success="selectedPost"></SelectPost>
<SelectUser
:defaultValues="selectedUserList"
v-model:visible="dialogVisibleSelectUser"
title="选择使用员工"
:isOnlyLeaf="true"
@success="selectedUser"></SelectUser>
</div>
</template>
<script>
import { getDeptTree, getDeptUserAll } from '@/api/organization'
import SelectDept from '@/components/SelectDept'
import SelectPost from '@/components/SelectPost'
export default {
name: 'select-member',
components: {
SelectDept,
SelectPost,
},
props: {
initData: {
type: Object,
default: {
executeUserCondit: {
change: false,
weUserIds: [],
},
executeDeptCondit: {
change: false,
deptIds: [],
posts: [],
},
},
},
},
data() {
return {
selectMember: false,
selectDept: false,
selectedUserList: [],
dialogVisibleSelectUser: false,
selectedDeptList: [],
dialogVisibleSelectDept: false,
dialogVisibleSelectPost: false,
selectedPostList: [],
form: {
executeUserCondit: {
change: false,
weUserIds: [],
},
executeDeptCondit: {
change: false,
deptIds: [],
posts: [],
},
},
}
},
methods: {
validateFn() {
if (!this.form.executeUserCondit.change && !this.form.executeDeptCondit.change) {
this.msgError('请选择执行成员!')
return false
}
if (this.form.executeUserCondit.change) {
if (!this.form.executeUserCondit.weUserIds || !this.form.executeUserCondit.weUserIds.length) {
this.msgError('请选择成员!')
return false
}
}
if (this.form.executeDeptCondit.change) {
if (!this.form.executeDeptCondit.posts.length && !this.form.executeDeptCondit.deptIds.length) {
this.msgError('请选择部门范围与岗位!')
return false
}
}
return true
},
selectedPost(data) {
this.selectedPostList = data
this.form.executeDeptCondit.posts = data
this.changeFn()
},
selectedUser(data) {
this.selectedUserList = data
this.form.executeUserCondit.weUserIds = data.map((dd) => {
return dd.userId
})
this.changeFn()
},
selectedDept(data) {
this.selectedDeptList = data
this.form.executeDeptCondit.deptIds = data.map((dd) => {
return dd.deptId
})
this.changeFn()
},
clearUserData(data) {
if (!data) {
this.selectedUserList = []
this.form.executeUserCondit.weUserIds = []
this.changeFn()
}
},
clearDeptsData(data) {
if (!data) {
this.selectedDeptList = []
this.form.executeDeptCondit.deptIds = []
this.selectedPostList = []
this.form.executeDeptCondit.posts = []
this.changeFn()
}
},
changeFn() {
this.$emit('update', this.form)
},
setEditUser() {
if (this.form.executeUserCondit.weUserIds) {
this.selectedUserList = []
getDeptUserAll().then(({ data }) => {
this.form.executeUserCondit.weUserIds.forEach((dd) => {
let index = data.findIndex((item) => item.weUserId === dd)
if (index != -1) {
data[index].userId = dd
data[index].name = data[index].userName
this.selectedUserList.push(data[index])
}
})
})
}
},
setEditDept() {
if (this.form.executeDeptCondit.deptIds.length) {
this.selectedDeptList = []
getDeptTree().then(({ data }) => {
this.form.executeDeptCondit.deptIds.forEach((dd) => {
let index = data.findIndex((item) => item.deptId === dd)
this.selectedDeptList.push(data[index])
})
})
}
if (this.form.executeDeptCondit.posts.length) {
this.selectedPostList = this.form.executeDeptCondit.posts
}
},
},
created() {
if (this.initData) {
this.form = JSON.parse(JSON.stringify(this.initData))
if (this.form && this.form.executeUserCondit.change) {
this.setEditUser()
}
if (this.form && this.form.executeDeptCondit.change) {
this.setEditDept()
}
}
},
}
</script>
<style lang="scss" scoped>
.select_content {
background-color: #ecf5ff;
padding: 20px;
border-radius: 5px;
.select_unit {
padding: 10px 25px;
}
}
</style>
<template>
<div class="select_content">
<template v-if="currentType !== 1">
<div>
<el-checkbox
v-model="form.executeCustomerCondit.change"
@change="selectAttributeChange"
label="客户属性"></el-checkbox>
<el-popover placement="top" trigger="hover">
<template #reference>
<el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" />
</template>
<div>可根据不同属性维度精细化筛选客户。不同的属性自动以“且”关联,相同的属性自动以“或”关联</div>
</el-popover>
<div class="select_unit" v-if="form.executeCustomerCondit.change">
<SelectAttribute
:init="form.executeCustomerCondit.executeCustomerQUECondits"
:baseData="base"
@update="changeFn"
ref="selectAttribute"></SelectAttribute>
</div>
</div>
<!-- <div>
<el-checkbox v-model="form.crowdAttribute.change" @change="selectCrowdChange" label="已有人群"></el-checkbox>
<div class="select_unit" v-if="form.crowdAttribute.change">
<div v-if="selectedPeopleList.length > 0">
<el-tag v-for="(item, index) in selectedPeopleList" :key="index">{{ item.name }}</el-tag>
</div>
<el-button icon="el-icon-plus" type="primary" plain @click="dialogVisibleSelectPeople = true">
{{ selectedPeopleList.length ? '修改' : '选择' }}人群
</el-button>
</div>
</div> -->
</template>
<template v-else>
<el-radio-group v-model="newCustomerAll" @change="clearChange">
<el-radio :label="1">全部新客户</el-radio>
<el-radio :label="2">部分新客户</el-radio>
</el-radio-group>
<div class="select_unit" v-if="newCustomerAll === 2">
客户属性
<el-popover placement="top" trigger="hover">
<template #reference>
<el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" />
</template>
<div>可根据不同属性维度精细化筛选客户。不同的属性自动以“且”关联,相同的属性自动以“或”关联</div>
</el-popover>
:
<SelectAttribute
v-if="form"
:baseData="base"
:init="form.executeCustomerCondit.executeCustomerQUECondits"
ref="selectAttribute"
@update="changeFn"></SelectAttribute>
</div>
</template>
<!-- <SelectCrowde
:selected="selectedPeopleList"
v-model:visible="dialogVisibleSelectPeople"
@success="setCrowdeData"
></SelectCrowde> -->
</div>
</template>
<script>
// import SelectCrowde from '@/components/SelectCrowde/index'
import SelectAttribute from './SelectAttribute.vue'
// import { getList } from '@/api/marketStrategy/people'
export default {
name: 'select-type',
data() {
return {
newCustomerAll: 1, // 新客sop 生效客户
dialogVisibleSelectPeople: false,
selectedPeopleList: [],
form: {
executeCustomerCondit: {
change: false,
executeCustomerQUECondits: [],
},
crowdAttribute: {
change: false,
crowdIds: [],
},
},
}
},
props: {
currentType: {
type: Number,
default: 1,
},
base: {
type: Object,
default: {},
},
initData: {
type: Object,
default: {
executeCustomerCondit: {
change: false,
executeCustomerQUECondits: [],
},
crowdAttribute: {
change: false,
crowdIds: [],
},
},
},
},
components: {
SelectAttribute,
// SelectCrowde
},
methods: {
setCheck() {
if (this.form.executeCustomerCondit && this.form.executeCustomerCondit.executeCustomerQUECondits.length) {
return true
} else {
return false
}
},
selectCrowdChange(data) {
if (!data) {
this.form.crowdAttribute.crowdIds = []
}
},
selectAttributeChange(data) {
if (!data) {
this.form.executeCustomerCondit.executeCustomerQUECondits = []
}
},
validateFn() {
if (this.currentType === 1) {
if (this.newCustomerAll === 2) {
return this.$refs.selectAttribute.validateFn()
}
return true
} else {
if (!this.form.executeCustomerCondit.change && !this.form.crowdAttribute.change) {
this.msgError('请选择生效客户!')
return false
}
if (this.form.executeCustomerCondit.change) {
if (!this.form.executeCustomerCondit.executeCustomerQUECondits.length) {
this.msgError('请选择客户属性!')
return false
} else {
return this.$refs.selectAttribute.validateFn()
}
}
// if (this.form.crowdAttribute.change) {
// if (!this.form.crowdAttribute.crowdIds.length) {
// this.msgError('请选择已有人群!')
// return false
// }
// }
return true
}
},
clearChange(type) {
if (type === 1) {
this.form = null
} else {
this.form = {
executeCustomerCondit: {
change: false,
executeCustomerQUECondits: [],
},
crowdAttribute: {
change: false,
crowdIds: [],
},
}
// this.$forceUpdate()
}
},
setCrowdeData(data) {
this.selectedPeopleList = data
this.form.crowdAttribute.crowdIds = data.map((item) => item.id)
},
changeFn(data) {
this.form.executeCustomerCondit.change = true
this.form.executeCustomerCondit.executeCustomerQUECondits = data
},
submitFn() {
if (this.newCustomerAll === 1 && this.currentType === 1) {
this.form = null
}
this.$emit('update', this.form)
},
// setEditCrowd() {
// getList({ pageSize: 10000, pageNum: 1 }).then(({ rows }) => {
// if (this.form.crowdAttribute.crowdIds.length) {
// this.form.crowdAttribute.crowdIds.forEach((dd) => {
// let index = rows.findIndex((item) => item.id === dd)
// if (index !== -1) {
// this.selectedPeopleList.push(rows[index])
// }
// })
// }
// })
// }
},
created() {
if (this.initData) {
if (this.initData.executeCustomerCondit.change) {
this.newCustomerAll = 2
this.form.executeCustomerCondit = this.initData.executeCustomerCondit
}
// if (this.initData.crowdAttribute.change) {
// this.form.crowdAttribute = this.initData.crowdAttribute
// this.setEditCrowd()
// }
}
},
}
</script>
<style lang="scss" scoped>
.select_content {
background-color: #ecf5ff;
padding: 20px;
border-radius: 5px;
.select_unit {
padding: 10px 25px;
}
}
</style>
<template>
<div>
<div class="g-card">
<div class="g-card-title">SOP基本信息</div>
<div class="cont">
<div class="sub-title">SOP规则名称:</div>
{{ detail.sopName }}
</div>
<div class="cont">
<div class="sub-title">SOP类型:</div>
{{ setName(detail.businessType) }}
</div>
<div class="cont">
<div class="sub-title">SOP已发送天数:</div>
{{ totalDayNumber }}
</div>
<div class="cont">
<div class="sub-title">SOP已发送次数:</div>
{{ totalNumber }}
</div>
</div>
<div class="g-pad20">
<div class="tab">
<el-steps :active="currentActive">
<template v-for="(unit, index) in list" :key="index">
<el-step :class="{ current: currentClick === index }" @click="setCurrent(index)"></el-step>
</template>
</el-steps>
</div>
<div class="send-content" v-if="list.length">
<div class="word-row">
<span v-if="detail.businessType === 1 || detail.businessType === 3 || detail.businessType === 4">
第{{ list[currentClick].pushTimePre }}天,
</span>
<!-- <span v-else>{{ list[currentClick].pushTimePre }}</span> -->
{{ list[currentClick].pushStartTime }} -- {{ list[currentClick].pushEndTime }}内推送
</div>
<div class="word-row">
SOP推送状态:
<span v-html="setStateStr()"></span>
</div>
<div class="view">
<show-in-phone name="SOP目标推送内容" :list="list[currentClick].weQrAttachments"></show-in-phone>
<show-in-phone name="SOP实际推送内容" :list="list[currentClick].actualPushWeQrAttachments"></show-in-phone>
</div>
</div>
</div>
</div>
</template>
<script>
import { compareTime } from '@/utils/index'
import ShowInPhone from './ShowInPhone'
export default {
name: 'send-detail',
data() {
return {
currentActive: 1,
currentClick: 0,
totalNumber: 0,
totalDayNumber: 0,
}
},
components: {
ShowInPhone,
},
props: {
detail: {
type: Object,
default: {},
},
list: {
type: Array,
default: () => [],
},
},
watch: {
list: {
handler(val) {
this.totalNumber = 0
this.totalDayNumber = 0
if (val && val.length) {
val.forEach((dd) => {
this.totalNumber = Number(dd.sendNumber) + this.totalNumber
this.totalDayNumber = Number(dd.sendDayNumber) + this.totalDayNumber
})
}
},
immediate: true,
},
},
methods: {
setStateStr() {
let timeS = compareTime(this.list[this.currentClick].pushStartTime, this.list[this.currentClick].pushEndTime)
if (this.list[this.currentClick].executeState === 0) {
if (timeS === 'before') {
return '未到发送日期'
} else if (timeS === 'middle') {
return '成员待发送'
} else {
return '成员未发送'
}
} else {
let sendState = compareTime(
this.list[this.currentClick].pushStartTime,
this.list[this.currentClick].pushEndTime,
this.list[this.currentClick].executeTime,
)
if (sendState === 'middle') {
return '成员已发送(' + this.list[this.currentClick].executeTime + ')'
} else {
return (
'成员已发送(' + '<span style="color: red;">' + this.list[this.currentClick].executeTime + '</span>' + ')'
)
}
}
},
setCurrent(index) {
this.currentClick = index
},
setName(data) {
let str = ''
switch (data) {
case 1:
str = '新客SOP'
break
case 2:
str = '活动节日SOP'
break
case 3:
str = '客户转化SOP'
break
case 4:
str = '新群培育SOP'
break
case 5:
str = '周期营销SOP'
break
case 6:
str = '特定宣发SOP'
break
default:
str = ''
break
}
return str
},
},
}
</script>
<style lang="scss" scoped>
.current {
::v-deep .el-step__head {
color: #06c160;
border-color: #06c160;
}
::v-deep .el-step__icon {
background: #eee;
}
}
.title {
margin-bottom: 10px;
font-size: 16px;
color: #333;
font-weight: 500;
}
.cont {
margin-bottom: 10px;
display: flex;
}
.sub-title {
width: 120px;
text-align: right;
color: #999;
}
.tab {
width: 500px;
height: 50px;
overflow-x: scroll;
overflow-y: hidden;
::v-deep .el-step__icon {
cursor: pointer;
}
}
.send-content {
margin-top: 10px;
}
.view {
display: flex;
}
.word-row {
margin-bottom: 10px;
}
</style>
<style>
.el-drawer__header {
margin-bottom: 10px;
}
</style>
<template>
<div class="preview">
<div class="title">{{ name }}</div>
<div class="content">
<div class="item" v-for="(data, key) in sendList" :key="key">
<div class="avatar222"><img src="../../../assets/drainageCode/header.png" /></div>
<div class="msg" v-if="data.msgType === '4'">
<div class="word">
{{ data.content }}
</div>
</div>
<div class="msg" v-if="data.msgType === '0'">
<div class="image">
<img :src="data.materialUrl" />
</div>
</div>
<div class="msg" v-if="data.msgType === '9'">
<div class="word-and-image">
<div>
{{ data.materialName }}
</div>
<div class="sub-content">
<div>
<!-- {{data.materialUrl}} -->
</div>
<div>
<img src="../../../assets/drainageCode/default_icon.png" />
</div>
</div>
</div>
</div>
<div class="msg" v-if="data.msgType === '12'">
<div class="word-and-image">
<div>
{{ data.materialName }}
</div>
<div class="sub-content">
<div>
<!-- {{ data.materialUrl }} -->
</div>
<div>
<img src="../../../assets/drainageCode/default_icon.png" />
</div>
</div>
</div>
</div>
<div class="msg" v-if="data.msgType === '2'">
<div class="word-and-image">
<div>
{{ data.materialName }}
</div>
<div class="sub-content" style="min-width: 100px">
<div class="digest">
{{ data.digest }}
</div>
<div>
<video style="height: 40px; width: 40px" :src="data.materialUrl" />
</div>
</div>
</div>
</div>
<div class="msg" v-if="data.msgType === '3'">
<div class="word-and-image">
<div>
{{ data.materialName }}
</div>
<div class="sub-content" style="min-width: 100px">
<div class="digest">
{{ data.digest }}
</div>
<div>
<svg-icon
class="svg"
:icon="data.materialUrl ? filType(data.materialUrl) : ''"
v-if="data.materialUrl"></svg-icon>
</div>
</div>
</div>
</div>
<div class="msg" v-if="data.msgType === '11'">
<div class="miniprogram">
<div class="mini-header">
<img src="../../../assets/drainageCode/miniprogram-icon.png" alt="" />
{{ data.materialName }}
</div>
<img class="mini-img" :src="data.coverUrl" />
<div class="mini-footer">
<img src="../../../assets/drainageCode/miniprogram-link.png" />
小程序
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'show-in-phone',
components: {},
props: {
name: {
type: String,
default: '小微',
},
list: {
type: Array,
default: () => [],
},
},
data() {
return {
sendList: [],
}
},
watch: {
list: {
handler(val) {
if (val && val.length) {
this.sendList = this.setEditList(val)
}
},
immediate: true,
},
},
computed: {},
created() {},
mounted() {},
methods: {
filType(file) {
let filecontent = JSON.parse(JSON.stringify(file))
filecontent = filecontent.split('.')
let type = filecontent[filecontent.length - 1]
if (type === 'pdf') {
return 'pdf'
} else if (type === 'doc' || type === 'docx') {
return 'word'
} else if (type === 'xls' || type === 'xlsx') {
return 'excel'
} else if (type === 'ppt' || type === 'pptx' || type === 'pps' || type === 'pptsx') {
return 'ppt'
} else {
return ''
}
},
setEditList(list) {
let arr = []
if (list && list.length) {
list.forEach((dd) => {
if (dd.msgType === 'link' && dd.appId) {
let obj = {
id: dd.id ? dd.id : '',
msgType: '12',
materialName: dd.title,
materialUrl: dd.linkUrl,
digest: dd.appId,
}
arr.push(obj)
} else if (dd.msgType === 'text') {
let obj = {
id: dd.id ? dd.id : '',
msgType: '4',
content: dd.content,
}
arr.push(obj)
} else if (dd.msgType === 'image') {
let obj = {
id: dd.id ? dd.id : '',
msgType: '0',
materialUrl: dd.picUrl,
}
arr.push(obj)
} else if (dd.msgType === 'link') {
let ob = {
id: dd.id ? dd.id : '',
msgType: '9',
materialName: dd.title,
materialUrl: dd.linkUrl,
}
arr.push(ob)
} else if (dd.msgType === 'miniprogram') {
let ff = {
id: dd.id ? dd.id : '',
msgType: '11',
digest: dd.appId,
materialName: dd.title,
coverUrl: dd.picUrl,
materialUrl: dd.linkUrl,
}
arr.push(ff)
} else if (dd.msgType === 'video') {
let ff = {
id: dd.id ? dd.id : '',
msgType: '2',
digest: dd.description,
materialName: dd.title,
materialUrl: dd.linkUrl,
}
arr.push(ff)
} else if (dd.msgType === 'file') {
let ff = {
id: dd.id ? dd.id : '',
msgType: '3',
digest: dd.description,
materialName: dd.title,
materialUrl: dd.linkUrl,
}
arr.push(ff)
}
})
}
return arr
},
},
}
</script>
<style lang="scss" scoped>
.svg {
height: 40px;
width: 40px;
}
.preview {
margin: 0 auto;
position: relative;
width: 300px;
height: 640px;
background: url(../../../assets/drainageCode/preview-bg.png);
background-repeat: no-repeat;
background-size: 100% 100%;
.title {
position: absolute;
top: 37px;
left: 50%;
transform: translateX(-50%);
font-size: 14px;
font-weight: 400;
color: #333333;
}
.content {
position: absolute;
height: 545px;
width: 280px;
overflow-y: auto;
top: 70px;
left: 50%;
transform: translateX(-50%);
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
padding: 20px;
.item {
font-size: 12px;
font-weight: 400;
color: #666666;
display: flex;
margin-top: 20px;
&:first-child {
margin-top: 0;
}
.avatar222 {
// align-self: center;
margin-right: 5px;
}
.msg {
position: relative;
min-height: 26px;
background: #ffffff;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border: 1px solid #e1edfc;
display: inline-block;
border-radius: 4px;
box-sizing: border-box;
word-break: break-all;
margin-left: 5px;
&:before {
content: ' ';
display: block;
position: absolute;
left: -5px;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border-width: 5px;
border-left: 0;
width: 0;
border-style: solid;
border-color: transparent;
border-right-color: #fff;
top: 8px;
z-index: 888;
}
.word {
padding: 5px 12px;
}
.image {
padding: 12px;
img {
width: 94px;
height: 90px;
}
}
.word-and-image {
padding: 12px;
.sub-content {
margin-top: 10px;
display: flex;
justify-content: space-between;
font-size: 12px;
font-weight: 400;
color: #999999;
height: 45px;
.digest {
line-height: 15px;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
img {
height: 40px;
width: 40px;
}
}
}
.miniprogram {
padding: 12px;
.mini-header {
display: flex;
align-items: center;
img {
height: 18px;
width: 18px;
margin-right: 5px;
}
}
.mini-img {
margin: 10px 0;
width: 143px;
height: 120px;
}
.mini-footer {
display: flex;
align-items: center;
img {
height: 14px;
width: 14px;
margin-right: 5px;
}
}
}
}
}
}
}
</style>
<template>
<div style="margin-top: 10px">
<div class="g-card">
<div class="g-card-title">基础设置</div>
<el-form ref="baseForm" :rules="baseRules" :model="baseForm" label-position="right" label-width="100px">
<el-form-item label="SOP名称" prop="sopName">
<el-input v-model="baseForm.sopName" style="width: 400px" maxlength="20" show-word-limit clearable></el-input>
</el-form-item>
<el-form-item label="发送方式" required prop="sendType">
<el-radio-group @change="setChangeCheck" v-model="baseForm.sendType">
<el-radio :label="1">
企微群发
<el-popover placement="top" trigger="hover">
<template #reference><el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" /></template>
<div>
企微群发采用企业微信官方的一键转发功能,每个客户/客群每天只可通过此种方式接收一条消息。设置SOP内容时每天仅可设置一条。
</div>
</el-popover>
</el-radio>
<el-radio :label="2">
手动发送
<el-popover placement="top" trigger="hover">
<template #reference>
<el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" />
</template>
<div>手动发送由员工自主推送,每个客户/客群每天不限制消息接收次数。设置SOP内容时可一天内设置多条。</div>
</el-popover>
</el-radio>
</el-radio-group>
</el-form-item>
<el-divider></el-divider>
<div class="g-card-title" style="margin-top: 20px">执行成员</div>
<el-form-item label="选择类型" required>
<el-radio-group v-model="type" @change="clearChange">
<el-radio :label="1">全部成员</el-radio>
<el-radio :label="2">部分成员</el-radio>
</el-radio-group>
</el-form-item>
<template v-if="type === 2">
<el-form-item label="">
<SelectMember ref="selectMember" :initData="baseForm.executeWeUser" @update="getExecuteData"></SelectMember>
</el-form-item>
</template>
<el-divider></el-divider>
<div class="g-card-title" style="margin-top: 20px">生效客户</div>
<el-form-item label="选择类型" required>
<SelectType
ref="selectType"
:currentType="baseForm.businessType"
:base="baseForm"
:initData="baseForm.executeCustomerOrGroup"
@update="getChangeData"></SelectType>
</el-form-item>
</el-form>
</div>
<div class="g-card" style="text-align: right">
<el-button plain v-if="!baseForm.id" @click="next(1)">上一步</el-button>
<el-button type="primary" @click="next(3)">下一步</el-button>
</div>
</div>
</template>
<script>
import SelectMember from './SelectMember.vue'
import SelectType from './SelectType.vue'
export default {
name: 'customer-step-2',
components: {
SelectMember,
SelectType,
},
props: {
initData: {
type: Object,
default: () => {},
},
},
data() {
return {
baseRules: {
sopName: [{ required: true, message: '请输入SOP名称', trigger: 'blur' }],
},
type: 1, // 前端维护 执行成员方式 executeWeUser 为空默认全部成员
baseForm: {
sopName: '',
sendType: 1,
executeWeUser: null,
executeCustomerOrGroup: {
executeCustomerCondit: {
change: false,
executeCustomerQUECondits: [],
},
crowdAttribute: {
change: false,
crowdIds: [],
},
},
},
}
},
methods: {
setChangeCheck(data) {
if (this.$refs.selectType.setCheck()) {
this.$confirm('是否确认切换当前发送方式?由于企业微信限制,切换发送方式后客户属性需重新编辑。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.$refs.selectType.selectAttributeChange(false)
})
.catch(() => {
this.baseForm.sendType = data === 1 ? 2 : 1
})
}
},
next(type) {
if (type === 3) {
this.$refs['baseForm'].validate((dd) => {
if (dd) {
let selectmember = true
let selecttype = true
if (this.type === 2) {
selectmember = this.$refs.selectMember.validateFn()
}
selecttype = this.$refs.selectType.validateFn()
if (selecttype) {
this.$refs.selectType.submitFn()
}
if (selectmember && selecttype) {
this.$emit('stepFn', type)
}
}
})
} else {
this.$emit('stepFn', type)
}
},
getExecuteData(data) {
this.baseForm.executeWeUser = data
},
clearChange(type) {
if (type === 1) {
this.baseForm.executeWeUser = null
} else {
this.baseForm.executeWeUser = {
executeUserCondit: {
change: false,
weUserIds: [],
},
executeDeptCondit: {
change: false,
deptIds: [],
posts: [],
},
}
}
},
getChangeData(data) {
this.baseForm.executeCustomerOrGroup = data
},
setEditData() {
if (this.baseForm.executeWeUser) {
this.type = 2
} else {
this.type = 1
}
},
},
created() {
this.baseForm = this.initData
if (this.baseForm.executeWeUser) {
this.type = 2
} else {
this.type = 1
}
},
}
</script>
<style lang="scss" scoped></style>
<template>
<div style="margin-top: 10px">
<div class="g-card">
<div class="g-card-title">内容配置</div>
<div>
<el-row type="flex">
<el-col style="flex-basis: 550px">
<template v-for="(unit, key) in list" :key="key">
<div class="unit" :class="{ active: currentIndex === key }" @click.capture="changeTab(key)">
<!-- :read="currentIndex !== key" -->
<PushTimeUnit
:key="key"
:dateType="initData.businessType"
:init="unit"
@update="getUpdate($event, key)"></PushTimeUnit>
</div>
</template>
<div class="operation_con">
<el-button icon="el-icon-plus" @click="addItem" type="primary" plain>添加推送</el-button>
</div>
</el-col>
<el-col style="background: rgb(236, 245, 255); padding: 20px; border-radius: 0 6px 6px 0">
<div class="right_title">
<div class="sub_con">
<span v-if="initData.businessType !== 2">第{{ list[currentIndex].pushTimePre }}天</span>
<span v-else>{{ list[currentIndex].pushTimePre }}</span>
{{ list[currentIndex].pushStartTime }}—{{ list[currentIndex].pushEndTime }}内推送
</div>
<div>
<el-button type="primary" plain @click="setPreview">预览</el-button>
<el-button type="primary" v-if="list.length != 1" plain @click="deleteFn">删除</el-button>
</div>
</div>
<SendContent
:sendType="initData.sendType"
ref="sendContent"
:baseData="list[currentIndex].attachments"
@update="getAttachments"></SendContent>
</el-col>
</el-row>
</div>
</div>
<div class="g-card" style="text-align: right">
<el-button plain @click="next(2)">上一步</el-button>
<el-button type="primary" @click="next(4)">下一步</el-button>
</div>
<el-dialog title="预览" v-model="dialogVisible" width="30%">
<show-in-phone v-if="dialogVisible" :list="previewList"></show-in-phone>
</el-dialog>
</div>
</template>
<script>
import ShowInPhone from './ShowInPhone'
import SendContent from './SendContent.vue'
import PushTimeUnit from './PushTimeUnit.vue'
export default {
name: 'customer-step-3',
components: {
PushTimeUnit,
SendContent,
ShowInPhone,
},
props: {
initData: {
type: Object,
default: {
weSopPushTimes: [
{
pushStartTime: '',
pushEndTime: '',
pushTimeType: 3,
pushTimePre: '',
attachments: [],
},
],
},
},
},
data() {
return {
dialogVisible: false,
currentIndex: 0,
list: [],
previewList: [],
}
},
methods: {
setPreview() {
this.previewList = this.$refs.sendContent.preview()
this.dialogVisible = true
},
getAttachments(data) {
this.list[this.currentIndex].attachments = data
},
checkData() {
if (
!this.list[this.currentIndex].pushStartTime ||
!this.list[this.currentIndex].pushEndTime ||
!this.list[this.currentIndex].pushTimePre
) {
this.msgError('请选填完整时间或周期!')
return false
}
if (!this.$refs.sendContent.submit()) {
return false
}
return true
},
next(type) {
if (this.checkData()) {
if (!this.setCheckTimeFn()) {
return
}
if (!this.checkTimePoint()) {
return
}
this.$emit('stepFn', type, { weSopPushTimes: this.list })
}
},
changeTab(key) {
if (key === this.currentIndex) {
return
}
if (this.checkData()) {
this.currentIndex = key
}
},
addItem() {
if (this.checkData()) {
let obj = {
pushStartTime: '',
pushEndTime: '',
pushTimeType: 3,
pushTimePre: '',
attachments: [],
}
this.list.push(obj)
this.currentIndex = this.list.length - 1
}
},
getUpdate(data, index) {
this.list[index] = data
},
deleteFn() {
this.$confirm('是否确认删除此条SOP内容?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.list.splice(this.currentIndex, 1)
this.currentIndex = 0
// this.$forceUpdate()
})
.catch(function () {})
},
setCheckTimeFn() {
// 天数、日期 --递增
if (this.list.length > 1) {
let arr = this.list.map((unit) => {
return unit.pushTimePre
})
let isSorted = arr.every((x, i) => i === 0 || x >= arr[i - 1])
if (!isSorted) {
this.msgError('发送时间顺序存在问题,请按照递增顺序选择天数或日期!')
return false
}
}
if (this.initData.sendType === 1) {
// 天不能重复 企微群发
let repeat = false
let day = this.list.map((value) => value.pushTimePre)
let daySet = new Set(day)
if (daySet.size !== day.length) {
repeat = true
this.msgError('发送方式选项为【企微群发】时,天数日期不可重复!')
}
return !repeat
} else {
// 天可以重复 时间段不能交叉
let result = false
for (let i = 0; i < this.list.length; i++) {
let arr = []
this.list.forEach((unit, key) => {
if (key !== i && this.list[i].pushTimePre === unit.pushTimePre) {
arr.push(unit)
}
})
result = this.checkTime(arr, this.list[i])
if (result) {
break
}
}
if (result) {
this.msgError('推送时间区间存在交叉,请检查调整!')
}
return !result
}
},
checkTimePoint() {
let result = false
for (let i = 0; i < this.list.length; i++) {
let arr = []
this.list.forEach((unit, key) => {
if (this.list[i].pushTimePre === unit.pushTimePre) {
arr.push(unit)
}
})
let isSorted = arr.every(
(x, i) => i === 0 || this.tranDate(x.pushStartTime) >= this.tranDate(arr[i - 1].pushEndTime),
)
if (!isSorted) {
this.msgError('发送时间顺序存在问题,请按照递增顺序选择时间区间')
result = true
break
}
}
return !result
},
checkTime(arr, current) {
let repeat = false
arr.forEach((item, index) => {
let state = this.compareTime(item.pushStartTime, item.pushEndTime, current.pushStartTime, current.pushEndTime)
if (state) {
repeat = true
}
})
return repeat
},
compareTime(stime, etime, currentSTime, currentETime) {
let startTime = this.tranDate(stime)
let endTime = this.tranDate(etime)
let nowSTime = this.tranDate(currentSTime)
let nowETime = this.tranDate(currentETime)
if (startTime === nowSTime && endTime === nowETime) {
return true
} else if (nowETime <= startTime) {
return false
} else if (nowSTime >= endTime) {
return false
} else {
return true
}
},
tranDate(time) {
let s = ''
let hour = 0
let min = 0
let sec = 0
if (time.split(':')[0]) {
hour = time.split(':')[0]
}
if (time.split(':')[1]) {
min = time.split(':')[1]
}
if (time.split(':')[2]) {
sec = time.split(':')[2]
}
s = Number(hour * 3600) + Number(min * 60) + Number(sec)
return s
},
},
created() {
this.list = this.initData.weSopPushTimes
},
}
</script>
<style lang="scss" scoped>
.unit {
width: 550px;
background: #fafafa;
color: rgba(0, 0, 0, 0.6);
border-radius: 6px 0 0 6px;
font-size: 14px;
cursor: pointer;
&:hover {
font-weight: 500;
color: rgba(0, 0, 0, 0.9);
// background: #ecf5ff;
}
&:not(:last-child) {
margin-bottom: 5px;
}
}
.active {
font-weight: 500;
color: rgba(0, 0, 0, 0.9);
background: #ecf5ff;
}
.right_title {
display: flex;
justify-content: space-between;
font-size: 14px;
color: var(--color);
font-weight: 600;
}
.operation_con {
display: flex;
justify-content: center;
}
</style>
<template>
<div style="margin-top: 10px">
<div class="g-card">
<div class="g-card-title">基础设置</div>
<el-form ref="baseForm" :rules="baseRules" :model="baseForm" label-position="right" label-width="100px">
<el-form-item label="SOP名称" prop="sopName">
<el-input v-model="baseForm.sopName" style="width: 400px" maxlength="20" show-word-limit clearable></el-input>
</el-form-item>
<el-form-item label="发送方式" required prop="sendType">
<el-radio-group v-model="baseForm.sendType">
<el-radio :label="1">
企微群发
<el-popover placement="top" trigger="hover">
<template #reference><el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" /></template>
<div>
企微群发采用企业微信官方的一键转发功能,每个客户/客群每天只可通过此种方式接收一条消息。设置SOP内容时每天仅可设置一条。
</div>
</el-popover>
</el-radio>
<el-radio :label="2">
手动发送
<el-popover placement="top" trigger="hover">
<template #reference>
<el-icon-QuestionFilled class="el-icon-QuestionFilled ml5" />
</template>
<div>手动发送由员工自主推送,每个客户/客群每天不限制消息接收次数。设置SOP内容时可一天内设置多条。</div>
</el-popover>
</el-radio>
</el-radio-group>
</el-form-item>
<el-divider></el-divider>
<div class="g-card-title" style="margin-top: 20px">执行成员</div>
<el-form-item label="选择类型" required>
<el-radio-group v-model="type" @change="clearChange">
<el-radio :label="1">全部成员</el-radio>
<el-radio :label="2">部分成员</el-radio>
</el-radio-group>
</el-form-item>
<template v-if="type === 2">
<el-form-item label="">
<SelectMember ref="selectMember" :initData="baseForm.executeWeUser" @update="getExecuteData"></SelectMember>
</el-form-item>
</template>
<el-divider></el-divider>
<div class="g-card-title" style="margin-top: 20px">生效客群</div>
<el-form-item label="选择类型" required>
<SelectGroup
ref="selectGroup"
:sendType="baseForm.sendType"
:currentType="baseForm.businessType"
:initData="baseForm.executeCustomerOrGroup"
@update="getChangeData"></SelectGroup>
</el-form-item>
</el-form>
</div>
<div class="g-card" style="text-align: right">
<el-button v-if="!baseForm.id" plain @click="next(1)">上一步</el-button>
<el-button type="primary" @click="next(3)">下一步</el-button>
</div>
</div>
</template>
<script>
import SelectMember from './SelectMember.vue'
import SelectGroup from './SelectGroup.vue'
export default {
name: 'group-step-2',
components: {
SelectMember,
SelectGroup,
},
props: {
initData: {
type: Object,
default: () => {},
},
},
data() {
return {
baseRules: {
sopName: [{ required: true, message: '请输入SOP名称', trigger: 'blur' }],
},
type: 1, // 前端维护 执行成员方式 executeWeUser 为空默认全部成员
baseForm: {
sopName: '',
sendType: 1,
executeWeUser: null,
executeCustomerOrGroup: {
weSopExecuteGroupTimeCondit: {
change: false,
beginTime: '',
endTime: '',
},
weSopExecuteGroupTagIdsCondit: {
change: false,
tagIds: [],
},
weSopExecuteGroupMemberLimitCondit: {
change: false,
groupMemberUp: '',
groupMemberDown: '',
},
},
},
}
},
methods: {
next(type) {
if (type === 3) {
this.$refs['baseForm'].validate((dd) => {
if (dd) {
let selectmember = true
let selectgroup = true
if (this.type === 2) {
selectmember = this.$refs.selectMember.validateFn()
}
selectgroup = this.$refs.selectGroup.validateFn()
if (selectgroup) {
this.$refs.selectGroup.submitFn()
}
if (selectmember && selectgroup) {
this.$emit('stepFn', type)
}
}
})
} else {
this.$emit('stepFn', type)
}
},
getExecuteData(data) {
this.baseForm.executeWeUser = data
},
clearChange(type) {
if (type === 1) {
this.baseForm.executeWeUser = null
} else {
this.baseForm.executeWeUser = {
executeUserCondit: {
change: false,
weUserIds: [],
},
executeDeptCondit: {
change: false,
deptIds: [],
posts: [],
},
}
}
},
getChangeData(data) {
this.baseForm.executeCustomerOrGroup = data
// this.$emit('stepFn', 3, this.baseForm)
},
setEditData() {
if (this.baseForm.executeWeUser) {
this.type = 2
} else {
this.type = 1
}
},
},
created() {
this.baseForm = this.initData
if (this.baseForm.executeWeUser) {
this.type = 2
} else {
this.type = 1
}
},
}
</script>
<style lang="scss" scoped></style>
<template>
<div style="margin-top: 10px">
<div class="g-card">
<div class="g-card-title">结束SOP配置</div>
<el-form ref="form" :model="form" label-position="right" label-width="130px">
<el-form-item label="结束SOP内容项:" prop="name">
<div class="select_content">
<div>
<el-checkbox
v-model="form.endContent.executeTag.change"
@change="clearTagFn"
label="客群标签变化"></el-checkbox>
<span class="sub-des">
设置该项后。SOP结束后用户标签仅会生成以下标签。如需保留用户原有标签,请一并勾选。
</span>
<div class="select_unit" v-if="form.endContent.executeTag.change">
<div v-if="selectedTagList.length > 0">
<el-tag v-for="(item, index) in selectedTagList" :key="index">{{ item.name }}</el-tag>
</div>
<el-button icon="el-icon-plus" type="primary" plain @click="dialogVisibleSelectTag = true">
{{ selectedTagList.length ? '修改' : '选择' }}标签
</el-button>
</div>
</div>
</div>
</el-form-item>
<el-form-item label="提前结束SOP:" prop="name">
<el-checkbox v-model="endState" @change="clearTagFn"></el-checkbox>
当满足以上勾选项时,则自动结束当前SOP。
</el-form-item>
<el-form-item style="text-align: right" v-if="!isDetail" v-loading="loading">
<el-button plain @click="next(3)">上一步</el-button>
<el-button type="primary" @click="submitFn">确定</el-button>
</el-form-item>
</el-form>
<SelectTag
v-model:visible="dialogVisibleSelectTag"
type="2"
:selected="selectedTagList"
@success="getSelectTag"></SelectTag>
</div>
</div>
</template>
<script>
import SelectTag from '@/components/SelectTag.vue'
import { getList } from '@/api/customer/tag'
export default {
name: 'group-step-4',
components: {
SelectTag,
},
props: {
loading: {
type: Boolean,
default: false,
},
initData: {
type: Object,
default: {
earlyEnd: 1, // 1 满足任意勾选项 2 全部勾选项
endContent: {
executeTag: {
change: false,
tagIds: [],
},
},
},
},
},
data() {
return {
endState: false,
isDetail: false,
selectedTagList: [],
dialogVisibleSelectTag: false,
form: {
earlyEnd: 1, // 1 满足任意勾选项 2 全部勾选项
endContent: {
executeTag: {
change: false,
tagIds: [],
},
},
},
}
},
methods: {
clearTagFn(data) {
if (!data) {
this.form.endContent.executeTag.tagIds = []
this.selectedTagList = []
}
},
submitFn() {
// 校验
if (this.form.endContent.executeTag.change) {
if (!this.selectedTagList.length) {
this.msgError('请选择客群标签!')
return false
}
}
if (!this.endState) {
this.form.earlyEnd = 0
}
this.$emit('success', this.form)
},
next(type) {
this.$emit('stepFn', type)
},
getSelectTag(list) {
this.selectedTagList = list
let arr = []
let arr1 = []
list.forEach((dd) => {
arr.push(dd.name)
arr1.push(dd.tagId)
})
this.form.endContent.executeTag.tagIds = arr1
},
editTag() {
if (this.form.endContent.executeTag.tagIds.length) {
this.selectedTagList = []
getList({ groupTagType: 2 }).then(({ rows }) => {
this.listOneArray = []
rows.forEach((element) => {
element.weTags.forEach((d) => {
this.listOneArray.push({ tagId: d.tagId, name: d.name })
})
})
this.form.endContent.executeTag.tagIds.forEach((dd) => {
let index = this.listOneArray.findIndex((item) => item.tagId == dd)
if (index !== -1) {
this.selectedTagList.push(this.listOneArray[index])
}
})
})
}
},
},
created() {
if (this.initData.endContent) {
if (this.initData.endContent.executeTag && this.initData.endContent.executeTag.change) {
this.form.endContent.executeTag = this.initData.endContent.executeTag
this.editTag()
}
if (this.initData.earlyEnd === 0) {
this.endState = false
} else {
this.form.earlyEnd = this.initData.earlyEnd
this.endState = true
}
}
},
}
</script>
<style lang="scss" scoped>
.select_content {
background-color: #ecf5ff;
padding: 20px;
border-radius: 5px;
.select_unit {
padding: 10px 25px;
}
}
.sub-des {
margin-left: 10px;
font-size: 12px;
font-weight: 400;
color: #999999;
}
</style>
<template>
<div>
<el-steps class="g-card" :active="currentActive" align-center finish-status="success">
<el-step title="选SOP类型"></el-step>
<el-step title="选择发送配置"></el-step>
<el-step title="制定发送内容"></el-step>
<el-step title="设置结束条件"></el-step>
</el-steps>
<div class="g-card" v-if="currentActive === 1">
<div class="g-card-title">客户SOP类型</div>
<el-divider></el-divider>
<div>
<div class="unit active" :class="{ selected: form.businessType === 1 }" @click="gotoNext(1)">
<img style="height: 80px; width: 80px; margin-right: 10px" src="../../../assets/sop/sop1.svg" />
<div class="content">
<div class="content-title">新客SOP</div>
<div class="content-sub">
<div>适用于新客户的承接、留存、转化。对新添加的客户设置SOP自动推送营销内容。</div>
<div style="margin-top: 3px">仅对创建本类型SOP开始之日起后添加的新客户有效。</div>
</div>
</div>
</div>
<div class="unit active" :class="{ selected: form.businessType === 2 }" @click="gotoNext(2)">
<img style="height: 80px; width: 80px; margin-right: 10px" src="../../../assets/sop/sop2.svg" />
<div class="content">
<div class="content-title">活动节日SOP</div>
<div class="content-sub">
<div>可对特定目标的客户群体做自定义的节日问候SOP或活动推广预热SOP。</div>
<div style="margin-top: 3px">适用于所有客户。</div>
</div>
</div>
</div>
<div class="unit active" :class="{ selected: form.businessType === 3 }" @click="gotoNext(3)">
<img style="height: 80px; width: 80px; margin-right: 10px" src="../../../assets/sop/sop3.svg" />
<div class="content">
<div class="content-title">客户转化SOP</div>
<div class="content-sub">
<div>当客户状态满足设定的条件时,开始定期给客户发送指定的消息,起到更好的培育转化效果。</div>
<div style="margin-top: 3px">适用于所有客户。</div>
</div>
</div>
</div>
</div>
</div>
<div v-if="currentActive === 2">
<CustomerStep2 :initData="form" @stepFn="setStepChange" />
</div>
<div v-if="currentActive === 3">
<CustomerStep3 :initData="form" @stepFn="setStepChange" />
</div>
<div v-if="currentActive === 4">
<CustomerStep4 :initData="form" :loading="submitLoading" @stepFn="setStepChange" @success="submit" />
</div>
</div>
</template>
<script>
import { addSop, updateSop, getSopDetail } from '@/api/sop/index'
import CustomerStep2 from '../components/customerStep2.vue'
import CustomerStep3 from '../components/customerStep3.vue'
import CustomerStep4 from '../components/customerStep4.vue'
export default {
name: 'customer-sop-add-or-edit',
components: {
CustomerStep2,
CustomerStep3,
CustomerStep4,
},
data() {
return {
submitLoading: false,
currentActive: 1,
form: {
baseType: 1, // 1 客户sop 2 客群sop
businessType: null, // 1:新客sop;2:活动节日sop;3:客户转化sop;4:新群培育sop;5:周期营销sop;6:特定宣发sop
sopName: '',
sendType: 1, // 1:企业微信发送;2:手动发送
executeWeUser: null,
executeCustomerOrGroup: {
executeCustomerCondit: {
change: false,
executeCustomerQUECondits: [],
},
crowdAttribute: {
change: false,
crowdIds: [],
},
},
weSopPushTimes: [
{
pushStartTime: '',
pushEndTime: '',
pushTimeType: 3,
pushTimePre: '',
attachments: [],
},
],
},
}
},
methods: {
gotoNext(type) {
this.form.businessType = type
this.currentActive = 2
},
setStepChange(type, data) {
this.currentActive = type
if (data) {
this.form = { ...this.form, ...data }
}
},
submit(data) {
this.submitLoading = true
this.form = { ...this.form, ...data }
if (this.form.executeCustomerOrGroup) {
if (this.form.executeCustomerOrGroup.executeCustomerCondit.change) {
let arr = this.form.executeCustomerOrGroup.executeCustomerCondit.executeCustomerQUECondits
let value = []
arr.forEach((dd) => {
dd.executeCustomerQUECondits.forEach((ff) => {
ff.andOr = dd.andOr
})
value = [...value, ...dd.executeCustomerQUECondits]
})
if (value.length) {
this.form.executeCustomerSwipe = value
} else {
this.form.executeCustomerSwipe = null
}
} else {
this.form.executeCustomerSwipe = null
}
}
if (this.form.weSopPushTimes.length && this.form.endContent.joinCustomerGroup.change) {
if (this.form.endContent.joinCustomerGroup.joinGroupTip) {
let obj = {
source: 2,
msgType: 'text',
content: this.form.endContent.joinCustomerGroup.joinGroupTip,
}
this.form.weSopPushTimes[this.form.weSopPushTimes.length - 1].attachments.push(obj)
}
if (this.form.endContent.joinCustomerGroup.groupCodeId) {
let obj = {
source: 2,
msgType: 'image',
picUrl: this.form.endContent.joinCustomerGroup.groupUrl,
}
this.form.weSopPushTimes[this.form.weSopPushTimes.length - 1].attachments.push(obj)
}
}
if (this.$route.query.id) {
updateSop(this.form).then((res) => {
if (res.code === 200) {
this.msgSuccess('操作成功!')
this.$router.back(-1)
} else {
this.msgError(res.msg)
}
this.submitLoading = false
})
} else {
addSop(this.form).then((res) => {
if (res.code === 200) {
this.msgSuccess('操作成功!')
this.$router.back(-1)
} else {
this.msgError(res.msg)
}
this.submitLoading = false
})
}
},
},
created() {
if (this.$route.query.id) {
getSopDetail(this.$route.query.id).then((res) => {
if (res.code === 200) {
this.form = res.data
let arr = JSON.parse(
JSON.stringify(this.form.weSopPushTimes[this.form.weSopPushTimes.length - 1].attachments),
)
this.form.weSopPushTimes[this.form.weSopPushTimes.length - 1].attachments = arr.filter(
(item) => item.source !== 2,
)
this.currentActive = 2
}
})
}
},
}
</script>
<style lang="scss" scoped>
.unit {
padding: 20px;
height: 120px;
display: flex;
align-items: center;
background: #fafafa;
color: rgba(0, 0, 0, 0.6);
border-radius: 6px;
font-size: 14px;
cursor: pointer;
margin-bottom: 12px;
.content {
padding: 5px 0;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
.content-title {
font-size: 16px;
color: #333;
}
}
}
.selected {
font-weight: 500;
color: rgba(0, 0, 0, 0.9);
background: #ecf5ff;
}
.active {
&:hover {
font-weight: 500;
color: rgba(0, 0, 0, 0.9);
background: #ecf5ff;
}
}
</style>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<el-form :inline="true" label-width="80px" label-position="left" class="top-search">
<el-form-item label="客户名称">
<el-input v-model="query.customerName" placeholder="请输入客户名称" clearable @keyup.enter="search()" />
</el-form-item>
<el-form-item label-width="120px" label="SOP结果状态">
<el-select v-model="query.executeState">
<el-option v-for="(unit, key) in statusList" :key="key" :label="unit.name" :value="unit.status"></el-option>
</el-select>
</el-form-item>
<el-form-item label="跟进员工">
<el-input :model-value="userName" readonly @click="dialogVisible = true" placeholder="请选择跟进员工" />
</el-form-item>
<el-form-item label-width="0">
<el-button type="primary" @click="search()">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="g-card-title mid-action">
数据明细
<el-button type="primary" @click="syncFn()">同步</el-button>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%">
<el-table-column label="客户" align="center" min-width="100" prop="xtime" show-overflow-tooltip>
<template #default="{ row }">
<div class="cp flex aic">
<el-image style="width: 50px; height: 50px; flex: none" :src="row.avatar" fit="fill"></el-image>
<div class="ml10">
<p style="text-align: left">{{ row.customerName }}</p>
<i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[row.gender]]" />
<span :style="{ color: row.customerType === 1 ? '#4bde03' : '#f9a90b' }">
{{ { 1: '@微信', 2: row.corpName ? '@' + row.corpName : '@企业微信' }[row.customerType] }}
</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="SOP结果状态" align="center" min-width="130" prop="visitTotalCnt" show-overflow-tooltip>
<template #default="{ row }">
<div>
{{ setName(row.executeState) }}
</div>
</template>
</el-table-column>
<el-table-column
label="跟进员工"
align="center"
prop="userName"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column
label="岗位名称"
align="center"
prop="position"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column
label="所属部门"
align="center"
prop="deptName"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP执行效率" align="center" prop="efficiency" min-width="100" show-overflow-tooltip>
<template #header>
<el-popover placement="top" trigger="hover">
<template #reference>
SOP执行效率
<el-icon-QuestionFilled class="el-icon-QuestionFilled" />
</template>
<div>成员在规定时间内及时推送的SOP数/截止目前应推送的总SOP数</div>
</el-popover>
</template>
<template #default="{ row }">
{{ row.efficiency ? row.efficiency + '%' : '--' }}
</template>
</el-table-column>
<el-table-column
label="进入SOP时间"
align="center"
prop="createTime"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column label="结束SOP时间" align="center" prop="executeEndTime" min-width="100" show-overflow-tooltip>
<template #default="{ row }">
{{ row.executeEndTime ? row.executeEndTime : '--' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="{ row }">
<el-button text :data="row" @click="getContent(row.weUserId, row.externalUserid, row.executeTargetId)">
查看推送详情
</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="getList()" />
</div>
<el-drawer :size="650" title="查看推送详情" v-model="drawer" direction="rtl" :modal="false">
<SendDetail :detail="detail" :list="sendList"></SendDetail>
</el-drawer>
<SelectUser
v-model:visible="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"></SelectUser>
</div>
</template>
<script>
import {
getDetailTab,
getCustomerDetailTable,
getCustomerSendContent,
getSopDetail,
getSyncData,
} from '@/api/sop/index'
import Calculation from '@/utils/calculation'
import SendDetail from '../components/SendDetail'
export default {
name: 'customer-sop-detail',
components: {
SendDetail,
},
data() {
return {
detail: {},
sendList: [],
drawer: false,
id: '',
userName: undefined,
userArray: [],
total: 0,
dialogVisible: false,
query: {
pageSize: 10,
pageNum: 1,
sopBaseId: '',
groupName: '',
executeState: '',
weUserId: '',
},
statusList: [
{
status: '',
name: '全部',
},
{
status: 1,
name: '进行中',
},
{
status: 2,
name: '提前结束',
},
{
status: 3,
name: '正常结束',
},
{
status: 4,
name: '异常结束',
},
],
tableList: [],
loading: false,
cardData: [
{
title: 'SOP对象客户数',
tips: '满足当前SOP执行的目标对象条件,且正在执行中的客户数',
value: 0,
title1: '较昨日',
value1: 0,
},
{
title: '正常结束客户数',
tips: 'SOP执行完成后自动变更配置SOP结束条件的客户数',
value: 0,
title1: '较昨日',
value1: 0,
},
{
title: '提前结束客户数',
tips: 'SOP执行过程中已满足SOP结束条件而提前结束SOP执行过程的客户数',
value: 0,
title1: '较昨日',
value1: 0,
},
{
title: '异常结束客户数',
tips: '除了正常结束与提前结束外,不满足“员工继续发送”或“客户继续接收”导致的SOP无法正常执行而结束SOP的客户数',
value: 0,
title1: '较昨日',
value1: 0,
},
],
}
},
methods: {
syncFn() {
getSyncData(this.id).then((res) => {
if (res.code === 200) {
this.getTabFn()
this.getList()
this.msgSuccess('同步成功!')
}
})
},
setName(type) {
let index = this.statusList.findIndex((item) => {
return item.status === type
})
if (index !== -1) {
return this.statusList[index].name
} else {
return ''
}
},
getContent(weUserId, externalUserid, executeTargetId) {
getCustomerSendContent({ weUserId, externalUserid, executeTargetId, sopBaseId: this.id }).then((res) => {
this.sendList = res.data
this.drawer = true
})
},
search() {
this.query.pageNum = 1
this.getList()
},
resetQuery() {
this.query = {
pageSize: 10,
pageNum: 1,
sopBaseId: this.id,
customerName: '',
executeState: '',
weUserId: '',
}
this.userArray = []
this.userName = ''
this.getList()
},
getSelectUser(data) {
this.userArray = data
this.userName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
this.query.weUserId = this.userArray
.map(function (obj, index) {
return obj.userId
})
.join(',')
},
getList() {
this.query.sopBaseId = this.id
getCustomerDetailTable(this.query).then((res) => {
if (res.code === 200 && res.rows) {
this.tableList = res.rows
this.total = ~~res.total
}
})
},
getTabFn() {
getDetailTab(this.id).then((res) => {
if (res.code === 200) {
this.cardData[0].value = res.data.tdCustomerNumber
this.cardData[0].value1 = Calculation.accSub(res.data.tdCustomerNumber, res.data.ydCustomerNumber)
this.cardData[1].value = res.data.tdCommonEndCustomerNumber
this.cardData[1].value1 = Calculation.accSub(
res.data.tdCommonEndCustomerNumber,
res.data.ydCommonEndCustomerNumber,
)
this.cardData[2].value = res.data.tdEarlyEndCustomerNumber
this.cardData[2].value1 = Calculation.accSub(
res.data.tdEarlyEndCustomerNumber,
res.data.ydEarlyEndCustomerNumber,
)
this.cardData[3].value = res.data.tdErrorEndCustomerNumber
this.cardData[3].value1 = Calculation.accSub(
res.data.tdErrorEndCustomerNumber,
res.data.ydErrorEndCustomerNumber,
)
}
})
},
},
created() {
this.id = this.$route.query.id
this.getTabFn()
this.getList()
getSopDetail(this.id).then((res) => {
if (res.code === 200) {
this.detail = res.data
}
})
},
}
</script>
<style lang="scss" scoped>
.el-icon-s-custom {
font-size: 16px;
// margin-left: 4px;
color: #999;
&.man {
color: #13a2e8;
}
&.woman {
color: #f753b2;
}
}
</style>
<template>
<div>
<el-form :inline="true" label-width="80px" label-position="left" class="top-search">
<el-form-item label="SOP名称">
<el-input v-model="query.sopName" placeholder="请输入SOP规则名称" clearable @keyup.enter="search()" />
</el-form-item>
<el-form-item label="SOP类型">
<el-select v-model="query.businessType">
<el-option v-for="(unit, key) in styleList" :key="key" :label="unit.name" :value="unit.type"></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
value-format="yyyy-MM-dd"
v-model="dateValue"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="setDateChange"></el-date-picker>
</el-form-item>
<el-form-item label="SOP状态">
<el-select v-model="query.sopState">
<el-option v-for="(unit, key) in statusList" :key="key" :label="unit.name" :value="unit.status"></el-option>
</el-select>
</el-form-item>
<el-form-item label-width="0">
<el-button type="primary" @click="search()">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="mid-action">
<el-button type="primary" @click="goRoute('add')">新建SOP</el-button>
</div>
<el-table v-loading="loading" :data="list" style="width: 100%">
<el-table-column
label="SOP名称"
align="center"
prop="sopName"
min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP类型" align="center" prop="qrCode" min-width="120">
<template #default="{ row }">
<div>
{{
row.businessType === 1
? '新客SOP'
: row.businessType === 2
? '活动节日SOP'
: row.businessType === 3
? '客户转化SOP'
: ''
}}
</div>
</template>
</el-table-column>
<el-table-column label="执行成员" align="center" min-width="150" prop="executeUser">
<template #default="{ row }">
<tag-ellipsis v-if="row.executeUser" :list="row.executeUser.split(',')"></tag-ellipsis>
</template>
</el-table-column>
<el-table-column label="SOP数据" align="center" min-width="100" prop="crowdNum" show-overflow-tooltip>
<template #header>
<el-popover placement="top" trigger="hover">
<template #reference>
SOP数据
<el-icon-QuestionFilled class="el-icon-QuestionFilled" />
</template>
<div>本SOP执行完毕所需的全部天数与全部次数</div>
</el-popover>
</template>
<template #default="{ row }">
<div>推送所需天数: {{ row.pushNeedDayNumber }}</div>
<div>推送所需次数: {{ row.pushNeedUserNumber }}</div>
</template>
</el-table-column>
<el-table-column
label="创建人"
align="center"
min-width="140"
prop="createBy"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP状态" align="center" min-width="100" prop="sopState" show-overflow-tooltip>
<template #default="{ row }">
<div :class="{ color1: row.sopState === 1, color2: row.sopState === 2 }">
{{ row.sopState === 2 ? '已暂停' : row.sopState === 1 ? '执行中' : '' }}
</div>
</template>
</el-table-column>
<el-table-column label="SOP推送方式" align="center" min-width="100" prop="sendType" show-overflow-tooltip>
<template #default="{ row }">
<div :class="{ color1: row.sendType === 1, color2: row.sendType === 2 }">
{{ row.sendType === 1 ? '企微群发' : row.sendType === 2 ? '手动发送' : '' }}
</div>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
<template #default="{ row }">
<el-button text @click="goRoute('detail', row.sopBaseId)">详情</el-button>
<el-button text @click="goRoute('add', row.sopBaseId)">编辑</el-button>
<template v-if="row.sopState === 2">
<el-button text @click="updateStateFn(row.sopBaseId, 1)">执行</el-button>
</template>
<template v-else>
<el-button text @click="updateStateFn(row.sopBaseId, 2)">暂停</el-button>
</template>
<el-button text @click="removeFn(row.sopBaseId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="getList()" />
</div>
</div>
</template>
<script>
import TagEllipsis from '@/components/TagEllipsis'
import { getTableList, deleteTableItems, updateSopState } from '@/api/sop/index'
export default {
name: 'customer-sop',
data() {
return {
query: {
sopName: '',
baseType: 1, // 1.客户sop 2.客群sop
businessType: '',
sopState: '',
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 10,
},
dateValue: [],
styleList: [
{
type: '',
name: '全部',
},
{
type: 1,
name: '新客SOP',
},
{
type: 2,
name: '活动节日SOP',
},
{
type: 3,
name: '客户转化SOP',
},
],
statusList: [
{
status: '',
name: '全部',
},
{
status: 1,
name: '执行中',
},
{
status: 2,
name: '暂停',
},
],
loading: false,
list: [],
total: 0,
}
},
components: {
TagEllipsis,
},
methods: {
setDateChange(data) {
if (data) {
this.query.beginTime = data[0]
this.query.endTime = data[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
},
search() {
this.query.pageNum = 1
this.getList()
},
resetQuery() {
this.query = {
sopName: '',
baseType: 1, // 1.客户sop 2.客群sop
businessType: '',
sopState: '',
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 10,
}
this.dateValue = []
this.getList()
},
getList() {
this.loading = true
getTableList(this.query).then((res) => {
if (res.code === 200) {
this.total = Number(res.total)
this.list = res.rows
}
this.loading = false
})
},
goRoute(path, id) {
this.$router.push({ path: path, query: { id } })
},
updateStateFn(id, state) {
this.$confirm('是否确认进行当前操作!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return updateSopState({ id, sopState: state })
})
.then(() => {
this.search()
this.msgSuccess('操作成功')
})
.catch(function () {})
},
removeFn(id) {
this.$confirm('是否确认删除当前客户SOP?删除后不可撤销,历史数据将清空,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return deleteTableItems(id)
})
.then(() => {
this.search()
this.msgSuccess('删除成功')
})
.catch(function () {})
},
},
created() {
this.getList()
this.$store.setBusininessDesc(
`
<div>管理员在创建个人SOP规则后,员工通过推送的消息通知,在指定时间内给指定客户发送指定内容</div>
`,
)
},
}
</script>
<style lang="scss" scoped>
.color1 {
color: rgba(0, 0, 0, 0.9);
}
.color2 {
color: #fa7216;
}
</style>
<template>
<div>
<div class="g-card">
<el-steps :active="currentActive" align-center finish-status="success">
<el-step title="选SOP类型"></el-step>
<el-step title="选择发送配置"></el-step>
<el-step title="制定发送内容"></el-step>
<el-step title="设置结束条件"></el-step>
</el-steps>
</div>
<div class="g-card" v-if="currentActive === 1">
<div class="g-card-title">客户SOP类型</div>
<el-divider></el-divider>
<div>
<div class="unit active" :class="{ selected: form.businessType === 4 }" @click="gotoNext(4)">
<img style="height: 80px; width: 80px; margin-right: 10px" src="../../../assets/sop/sop4.svg" />
<div class="content">
<div class="content-title">新群培育SOP</div>
<div class="content-sub">
<div>适用于新创建的群聊,帮助成员在群聊中快速破冰,熟络客群成员,建立群聊氛围。</div>
<div style="margin-top: 3px">仅针对创建本类型SOP开始之日起后目标新客群有效。</div>
</div>
</div>
</div>
<div class="unit active" :class="{ selected: form.businessType === 5 }" @click="gotoNext(5)">
<img style="height: 80px; width: 80px; margin-right: 10px" src="../../../assets/sop/sop5.svg" />
<div class="content">
<div class="content-title">周期营销SOP</div>
<div class="content-sub">
<div>适用于所有群聊,帮助企业定期推广自身的运营任务,强化客户企业品牌印象。</div>
<div style="margin-top: 3px">适用于除新创建客群之外的其它所有客群。</div>
</div>
</div>
</div>
<div class="unit active" :class="{ selected: form.businessType === 6 }" @click="gotoNext(6)">
<img style="height: 80px; width: 80px; margin-right: 10px" src="../../../assets/sop/sop6.svg" />
<div class="content">
<div class="content-title">特定宣发SOP</div>
<div class="content-sub">
<div>适用于所有群聊,帮助企业在特殊节日、活动推广等一次性主题相关的活动中提前宣发推广,造势预热。</div>
<div style="margin-top: 3px">适用于所有客群。</div>
</div>
</div>
</div>
</div>
</div>
<div v-if="currentActive === 2">
<GroupStep2 :initData="form" @stepFn="setStepChange" />
</div>
<div v-if="currentActive === 3">
<CustomerStep3 :initData="form" @stepFn="setStepChange" />
</div>
<div v-if="currentActive === 4">
<GroupStep4 :initData="form" :loading="submitLoading" @stepFn="setStepChange" @success="submit" />
</div>
</div>
</template>
<script>
import { addSop, updateSop, getSopDetail } from '@/api/sop/index'
import GroupStep2 from '../components/groupStep2.vue'
import CustomerStep3 from '../components/customerStep3.vue'
import GroupStep4 from '../components/groupStep4.vue'
export default {
name: 'group-sop-add-or-edit',
components: {
GroupStep2,
CustomerStep3,
GroupStep4,
},
data() {
return {
submitLoading: false,
currentActive: 1,
form: {
baseType: 2, // 1 客户sop 2 客群sop
businessType: null, // 1:新客sop;2:活动节日sop;3:客户转化sop;4:新群培育sop;5:周期营销sop;6:特定宣发sop
sopName: '',
sendType: 1, // 1:企业微信发送;2:手动发送
executeWeUser: null,
executeCustomerOrGroup: null,
// {
// weSopExecuteGroupTimeCondit: {
// change: false,
// beginTime: '',
// endTime: ''
// },
// weSopExecuteGroupTagIdsCondit: {
// change: false,
// tagIds: []
// },
// weSopExecuteGroupMemberLimitCondit: {
// change: false,
// groupMemberUp: '',
// groupMemberDown: ''
// }
// },
weSopPushTimes: [
{
pushStartTime: '',
pushEndTime: '',
pushTimeType: 3,
pushTimePre: '',
attachments: [],
},
],
executeTag: {
change: false,
tagIds: [],
},
earlyEnd: 0,
},
}
},
methods: {
gotoNext(type) {
this.form.businessType = type
this.currentActive = 2
},
setStepChange(type, data) {
this.currentActive = type
if (data) {
this.form = { ...this.form, ...data }
}
},
submit(data) {
this.submitLoading = true
this.form = { ...this.form, ...data }
if (this.$route.query.id) {
updateSop(this.form).then((res) => {
if (res.code === 200) {
this.msgSuccess('操作成功!')
this.$router.back(-1)
} else {
this.msgError(res.msg)
}
this.submitLoading = false
})
} else {
addSop(this.form).then((res) => {
if (res.code === 200) {
this.msgSuccess('操作成功!')
this.$router.back(-1)
} else {
this.msgError(res.msg)
}
this.submitLoading = false
})
}
},
},
created() {
if (this.$route.query.id) {
getSopDetail(this.$route.query.id).then((res) => {
if (res.code === 200) {
this.form = res.data
let arr = JSON.parse(
JSON.stringify(this.form.weSopPushTimes[this.form.weSopPushTimes.length - 1].attachments),
)
this.form.weSopPushTimes[this.form.weSopPushTimes.length - 1].attachments = arr.filter(
(item) => item.source !== 2,
)
this.currentActive = 2
}
})
}
},
}
</script>
<style lang="scss" scoped>
.unit {
padding: 20px;
height: 120px;
display: flex;
align-items: center;
background: #fafafa;
color: rgba(0, 0, 0, 0.6);
border-radius: 6px;
font-size: 14px;
cursor: pointer;
margin-bottom: 12px;
.content {
padding: 5px 0;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
.content-title {
font-size: 16px;
color: #333;
}
}
}
.selected {
font-weight: 500;
color: rgba(0, 0, 0, 0.9);
background: #ecf5ff;
}
.active {
&:hover {
font-weight: 500;
color: rgba(0, 0, 0, 0.9);
background: #ecf5ff;
}
}
</style>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<el-form :inline="true" label-width="" label-position="left" class="top-search">
<el-form-item label="群聊名称">
<el-input v-model="query.groupName" placeholder="请输入群聊名称" clearable @keyup.enter="search()" />
</el-form-item>
<el-form-item label="SOP结果状态">
<el-select v-model="query.executeState">
<el-option v-for="(unit, key) in statusList" :key="key" :label="unit.name" :value="unit.status"></el-option>
</el-select>
</el-form-item>
<el-form-item label="成员名称">
<el-input :model-value="userName" readonly @click="dialogVisible = true" placeholder="请选择客群群主" />
</el-form-item>
<el-form-item label-width="0">
<el-button type="primary" @click="search()">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="g-card-title mid-action">
数据明细
<el-button type="primary" class="" @click="syncFn()">同步</el-button>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%">
<el-table-column
label="群聊名称"
align="center"
min-width="100"
prop="groupName"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP结果状态" align="center" min-width="130" prop="visitTotalCnt" show-overflow-tooltip>
<template #default="{ row }">
<div>
{{ setName(row.executeState) }}
</div>
</template>
</el-table-column>
<el-table-column
label="客群成员"
align="center"
prop="userName"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column
label="岗位名称"
align="center"
prop="position"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column
label="所属部门"
align="center"
prop="deptName"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP执行效率" align="center" prop="efficiency" min-width="100" show-overflow-tooltip>
<template #header>
<el-popover placement="top" trigger="hover">
<template #reference>
SOP执行效率
<el-icon-QuestionFilled class="el-icon-QuestionFilled" />
</template>
<div>成员在规定时间内及时推送的SOP数/截止目前应推送的总SOP数</div>
</el-popover>
</template>
<template #default="{ row }">
{{ row.efficiency ? row.efficiency + '%' : '--' }}
</template>
</el-table-column>
<el-table-column
label="进入SOP时间"
align="center"
prop="createTime"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column
label="结束SOP时间"
align="center"
prop="executeEndTime"
min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="{ row }">
<el-button text :data="row" @click="getContent(row.chatId, row.executeTargetId)">查看推送详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="getList()" />
</div>
<el-drawer :size="650" title="查看推送详情" v-model="drawer" direction="rtl">
<SendDetail :detail="detail" :list="sendList"></SendDetail>
</el-drawer>
<SelectUser
v-model:visible="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"></SelectUser>
</div>
</template>
<script>
import { getDetailTab, getGroupDetailTable, getGroupSendContent, getSopDetail, getSyncData } from '@/api/sop/index'
import Calculation from '@/utils/calculation'
import SendDetail from '../components/SendDetail'
export default {
name: 'customer-sop-detail',
components: {
SendDetail,
},
data() {
return {
detail: {},
sendList: [],
drawer: false,
id: '',
userName: undefined,
userArray: [],
total: 0,
dialogVisible: false,
query: {
pageSize: 10,
pageNum: 1,
sopBaseId: '',
groupName: '',
executeState: '',
weUserId: '',
},
statusList: [
{
status: '',
name: '全部',
},
{
status: 1,
name: '进行中',
},
{
status: 2,
name: '提前结束',
},
{
status: 3,
name: '正常结束',
},
{
status: 4,
name: '异常结束',
},
],
tableList: [],
loading: false,
cardData: [
{
title: 'SOP对象客群数',
tips: '满足当前SOP执行的目标对象条件,且正在执行中的客群数',
value: 0,
title1: '较昨日',
value1: 0,
},
{
title: '正常结束客群数',
tips: 'SOP执行完成后自动变更配置SOP结束条件的客群数',
value: 0,
title1: '较昨日',
value1: 0,
},
{
title: '提前结束客群数',
tips: 'SOP执行过程中已满足SOP结束条件而提前结束SOP执行过程的客群数',
value: 0,
title1: '较昨日',
value1: 0,
},
{
title: '异常结束客群数',
tips: '除了正常结束与提前结束外,不满足“员工继续发送”或“客群继续接收”导致的SOP无法正常执行而结束SOP的客群数',
value: 0,
title1: '较昨日',
value1: 0,
},
],
}
},
methods: {
syncFn() {
getSyncData(this.id).then((res) => {
if (res.code === 200) {
this.getTabFn()
this.getList()
this.msgSuccess('同步成功!')
}
})
},
setName(type) {
let index = this.statusList.findIndex((item) => {
return item.status === type
})
if (index !== -1) {
return this.statusList[index].name
} else {
return ''
}
},
getContent(chatId, executeTargetId) {
getGroupSendContent({ chatId, executeTargetId, sopBaseId: this.id }).then((res) => {
this.sendList = res.data
this.drawer = true
})
},
search() {
this.query.pageNum = 1
this.getList()
},
resetQuery() {
this.query = {
pageSize: 10,
pageNum: 1,
sopBaseId: this.id,
groupName: '',
executeState: '',
weUserId: '',
}
this.userArray = []
this.userName = ''
this.getList()
},
getSelectUser(data) {
this.userArray = data
this.userName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
this.query.weUserId = this.userArray
.map(function (obj, index) {
return obj.userId
})
.join(',')
},
getList() {
this.query.sopBaseId = this.id
getGroupDetailTable(this.query).then((res) => {
if (res.code === 200 && res.rows) {
this.tableList = res.rows
this.total = ~~res.total
}
})
},
getTabFn() {
getDetailTab(this.id).then((res) => {
if (res.code === 200) {
this.cardData[0].value = res.data.tdCustomerNumber
this.cardData[0].value1 = Calculation.accSub(res.data.tdCustomerNumber, res.data.ydCustomerNumber)
this.cardData[1].value = res.data.tdCommonEndCustomerNumber
this.cardData[1].value1 = Calculation.accSub(
res.data.tdCommonEndCustomerNumber,
res.data.ydCommonEndCustomerNumber,
)
this.cardData[2].value = res.data.tdEarlyEndCustomerNumber
this.cardData[2].value1 = Calculation.accSub(
res.data.tdEarlyEndCustomerNumber,
res.data.ydEarlyEndCustomerNumber,
)
this.cardData[3].value = res.data.tdErrorEndCustomerNumber
this.cardData[3].value1 = Calculation.accSub(
res.data.tdErrorEndCustomerNumber,
res.data.ydErrorEndCustomerNumber,
)
}
})
},
},
created() {
this.id = this.$route.query.id
this.getTabFn()
this.getList()
getSopDetail(this.id).then((res) => {
if (res.code === 200) {
this.detail = res.data
}
})
},
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<el-form :inline="true" label-width="80px" label-position="left" class="top-search">
<el-form-item label="SOP名称">
<el-input v-model="query.sopName" placeholder="请输入SOP规则名称" clearable @keyup.enter="search()" />
</el-form-item>
<el-form-item label="SOP类型">
<el-select v-model="query.businessType">
<el-option v-for="(unit, key) in styleList" :key="key" :label="unit.name" :value="unit.type"></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
value-format="yyyy-MM-dd"
v-model="dateValue"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="setDateChange"></el-date-picker>
</el-form-item>
<el-form-item label="SOP状态">
<el-select v-model="query.sopState">
<el-option v-for="(unit, key) in statusList" :key="key" :label="unit.name" :value="unit.status"></el-option>
</el-select>
</el-form-item>
<el-form-item label-width="0">
<el-button type="primary" @click="search()">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="mid-action">
<el-button type="primary" @click="goRoute('add')">新建SOP</el-button>
</div>
<el-table v-loading="loading" :data="list" style="width: 100%">
<el-table-column
label="SOP名称"
align="center"
prop="sopName"
min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP类型" align="center" prop="qrCode" min-width="120">
<template #default="{ row }">
<div>
{{
row.businessType === 4
? '新群培育SOP'
: row.businessType === 5
? '周期营销SOP'
: row.businessType === 6
? '特定宣发SOP'
: ''
}}
</div>
</template>
</el-table-column>
<el-table-column label="执行成员" align="center" min-width="150" prop="executeUser">
<template #default="{ row }">
<tag-ellipsis v-if="row.executeUser" :list="row.executeUser.split(',')"></tag-ellipsis>
</template>
</el-table-column>
<el-table-column label="SOP数据" align="center" min-width="100" prop="crowdNum" show-overflow-tooltip>
<template #header>
<el-popover placement="top" trigger="hover">
<template #reference>
SOP数据
<el-icon-QuestionFilled class="el-icon-QuestionFilled" />
</template>
<div>本SOP执行完毕所需的全部天数与全部次数</div>
</el-popover>
</template>
<template #default="{ row }">
<div>推送所需天数: {{ row.pushNeedDayNumber }}</div>
<div>推送所需次数: {{ row.pushNeedUserNumber }}</div>
</template>
</el-table-column>
<el-table-column
label="创建人"
align="center"
min-width="140"
prop="createBy"
show-overflow-tooltip></el-table-column>
<el-table-column label="SOP状态" align="center" min-width="100" prop="sopState" show-overflow-tooltip>
<template #default="{ row }">
<div :class="{ color1: row.sopState === 1, color2: row.sopState === 2 }">
{{ row.sopState === 2 ? '已暂停' : row.sopState === 1 ? '执行中' : '' }}
</div>
</template>
</el-table-column>
<el-table-column label="SOP推送方式" align="center" min-width="100" prop="sendType" show-overflow-tooltip>
<template #default="{ row }">
<div :class="{ color1: row.sendType === 1, color2: row.sendType === 2 }">
{{ row.sendType === 1 ? '企微群发' : row.sendType === 2 ? '手动发送' : '' }}
</div>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
<template #default="{ row }">
<el-button text @click="goRoute('detail', row.sopBaseId)">详情</el-button>
<el-button text @click="goRoute('add', row.sopBaseId)">编辑</el-button>
<el-button v-if="row.sopState === 2" text @click="updateStateFn(row.sopBaseId, 1)">执行</el-button>
<el-button v-else text @click="updateStateFn(row.sopBaseId, 2)">暂停</el-button>
<el-button text @click="removeFn(row.sopBaseId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="getList()" />
</div>
</div>
</template>
<script>
import TagEllipsis from '@/components/TagEllipsis'
import { getTableList, deleteTableItems, updateSopState } from '@/api/sop/index'
export default {
name: 'customer-sop',
data() {
return {
query: {
sopName: '',
baseType: 2, // 1.客户sop 2.客群sop
businessType: '',
sopState: '',
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 10,
},
dateValue: [],
styleList: [
{
type: '',
name: '全部',
},
{
type: 4,
name: '新群培育SOP',
},
{
type: 5,
name: '周期营销SOP',
},
{
type: 6,
name: '特定宣发SOP',
},
],
statusList: [
{
status: '',
name: '全部',
},
{
status: 1,
name: '执行中',
},
{
status: 2,
name: '暂停',
},
],
loading: false,
list: [],
total: 0,
}
},
components: {
TagEllipsis,
},
methods: {
setDateChange(data) {
if (data) {
this.query.beginTime = data[0]
this.query.endTime = data[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
},
search() {
this.query.pageNum = 1
this.getList()
},
resetQuery() {
this.query = {
sopName: '',
baseType: 2, // 1.客户sop 2.客群sop
businessType: '',
sopState: '',
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 10,
}
this.dateValue = []
this.getList()
},
getList() {
this.loading = true
getTableList(this.query).then((res) => {
if (res.code === 200) {
this.total = Number(res.total)
this.list = res.rows
}
this.loading = false
})
},
goRoute(path, id) {
this.$router.push({ path: path, query: { id } })
},
updateStateFn(id, state) {
this.$confirm('是否确认进行当前操作!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return updateSopState({ id, sopState: state })
})
.then(() => {
this.search()
this.msgSuccess('操作成功')
})
.catch(function () {})
},
removeFn(id) {
this.$confirm('是否确认删除当前客群SOP?删除后不可撤销,历史数据将清空,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return deleteTableItems(id)
})
.then(() => {
this.search()
this.msgSuccess('删除成功')
})
.catch(function () {})
},
},
created() {
this.getList()
this.$store.setBusininessDesc(
`
<div>管理员在创建个人SOP规则后,员工通过推送的消息通知,在指定时间内给指定客户发送指定内容</div>
`,
)
},
}
</script>
<style lang="scss" scoped>
.color1 {
color: rgba(0, 0, 0, 0.9);
}
.color2 {
color: #fa7216;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!