Commit 6fe43ba9 by chenwq

sop

1 parent 429ac7f9
<template>
<div>
<base-info v-show="activeName == 'baseInfo'" ref="baseInfoRef" :routeInfo="routeInfo" @handleTabChange="jumpEvent"></base-info>
<edit-event v-if="activeName == 'editEvent'" :eventObj="eventObj" @handleTabChange="jumpBaseInfo" @handleInfoConfirm="handleInfoConfirm"></edit-event>
<edit-event v-if="activeName == 'editEvent'" :eventObj="eventObj" :parentCustomerObj="parentCustomerObj" @handleTabChange="jumpBaseInfo" @handleInfoConfirm="handleInfoConfirm"></edit-event>
</div>
</template>
......@@ -24,6 +24,16 @@ export default {
eventObj: {
addOrEdit: 'add',
info: {}
},
parentCustomerObj: {
// 人群,标签,指定
currentCustomerTypeName: '',
parentPredictObj: {
total: '',
qiwei: '',
phone: ''
},
list: []
}
}
},
......@@ -43,6 +53,8 @@ export default {
},
handleInfoConfirm(info) {
this.eventObj.addOrEdit == 'add' ? this.$refs.baseInfoRef.editForm.eventList.push(info.baseInfo) : this.$set(this.$refs.baseInfoRef.editForm.eventList, this.eventIndex, info.baseInfo)
this.$refs.baseInfoRef.parentCustomerObj.phone = info.predictCountObj.phone
this.$refs.baseInfoRef.parentCustomerObj.qiwei = info.predictCountObj.qiwei
this.$refs.baseInfoRef.dealSopTime()
this.jumpBaseInfo({ activeName: 'baseInfo' })
},
......@@ -50,6 +62,7 @@ export default {
jumpEvent(obj) {
this.$set(this.eventObj, 'addOrEdit', obj.addOrEdit)
this.$set(this.eventObj, 'info', obj.info)
this.parentCustomerObj = obj.parentCustomerObj
this.eventIndex = obj.eventIndex
this.activeName = obj.activeName
}
......
......@@ -98,7 +98,7 @@
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
<select-Crowd v-if="isCrowdCustVisible" :dialogVisible="isCrowdCustVisible" :selectedCustomerList="customerDataList[0].list" @handleCrowdCustClose="handleCrowdCustClose" @handleCrowdCustConfirm="handleDialogConfirm"></select-Crowd>
<select-Crowd v-if="isCrowdCustVisible" :dialogVisible="isCrowdCustVisible" :selectedCrowdList="customerDataList[0].list" @handleCrowdCustClose="handleCrowdCustClose" @handleCrowdCustConfirm="handleDialogConfirm"></select-Crowd>
<select-tag ref="selectTagForm" @tagSelected="handleDialogConfirm" :dialogVisible="isTagVisible"></select-tag>
<select-customer v-if="isAppointCustVisible" :dialogVisible="isAppointCustVisible" :selectedCustomerList="customerDataList[2].list" @handleAppointCustClose="handleAppointCustClose" @handleAppointCustConfirm="handleDialogConfirm"></select-customer>
</div>
......@@ -129,22 +129,33 @@ export default {
3: 'coupon',
4: 'nickname'
},
markCondLimitObj: {
// 1-有;0-无
hasPhone: -1,
hasQw: -1
},
// markCondLimitObj: {
// // 1-有;0-无
// hasPhone: -1,
// hasQw: -1
// },
// condLimitObj: {
// // 1-有;0-无
// hasPhone: 0,
// hasQw: 0
// },
parentCustomerObj: {
// 人群,标签,指定
currentCustomerTypeName: '',
parentPredictObj: {
total: '',
qiwei: '',
phone: ''
},
list: []
},
// 标签弹窗
isTagVisible: false,
isAppointCustVisible: false,
isCrowdCustVisible: false,
// tagging: [],
currentCustomerIdx: -1,
// confId值与customerRadioList对应;confName判断标识,不要改
customerDataList: [
{
confId: 2,
......@@ -463,7 +474,7 @@ export default {
getCustomerByCrowdList() {
var params = {
pageSize: 9999,
pageSize: 1,
pageNum: 1,
crowdId: this.customerDataList[this.currentCustomerIdx].list[0].crowdId
}
......@@ -475,7 +486,7 @@ export default {
getCustomerByTagList() {
var params = {
combineType: 2,
pageSize: 9999,
pageSize: 1,
pageNum: 1,
tagLists: []
}
......@@ -650,8 +661,21 @@ export default {
},
handleEventEdit(addOrEdit, row, idx) {
let currentCustObj = JSON.parse(JSON.stringify(this.customerDataList[this.currentCustomerIdx]))
this.parentCustomerObj.currentCustomerTypeName = currentCustObj.confName
this.parentCustomerObj.parentPredictObj.total = currentCustObj.customerCount
this.parentCustomerObj.list = currentCustObj.list
// 指定客户需自己算
if (currentCustObj.confName == '指定') {
this.parentCustomerObj.parentPredictObj.phone = 0
this.parentCustomerObj.parentPredictObj.qiwei = 0
this.parentCustomerObj.list.forEach(item => {
item.customerPhone && this.parentCustomerObj.parentPredictObj.phone++
item.isJoin == 1 && this.parentCustomerObj.parentPredictObj.qiwei++
})
}
// this.$emit('handleTabChange', { activeName: 'editEvent', addOrEdit: addOrEdit, eventIndex: addOrEdit == 'add' ? '-1' : idx, condLimitObj: this.condLimitObj, info: { ...row, sopName: this.editForm.sopName } })
this.$emit('handleTabChange', { activeName: 'editEvent', addOrEdit: addOrEdit, eventIndex: addOrEdit == 'add' ? '-1' : idx, info: { ...row, sopName: this.editForm.sopName } })
this.$emit('handleTabChange', { activeName: 'editEvent', addOrEdit: addOrEdit, eventIndex: addOrEdit == 'add' ? '-1' : idx, parentCustomerObj: this.parentCustomerObj, info: { ...row, sopName: this.editForm.sopName } })
},
reqCrowdAttrs() {
......@@ -718,6 +742,11 @@ export default {
params[this.customerDataList[this.currentCustomerIdx].reqListName] = JSON.stringify(this.reqCustAttrs())
params.customerCount = this.customerDataList[this.currentCustomerIdx].customerCount
delete params.customerInfoList
this.customerDataList.forEach((item, index) => {
if (index != this.currentCustomerIdx) {
delete params[item.reqListName]
}
})
if (this.routeInfo.addOrEdit == 'edit') {
params.id = this.routeInfo.id
params.eventList = []
......@@ -726,14 +755,15 @@ export default {
if (new Date(item.eventStartDate) > new Date()) {
params.eventList.push({
eventContent: item.eventContent,
eventCount: item.eventCount,
// eventCount: item.eventCount,
eventStartDate: item.eventStartDate,
eventTime: item.eventTime,
pushChannelType: item.pushChannelType,
repeatFlag: item.repeatFlag,
repeatMode: item.repeatMode,
sopName: item.sopName,
sopId: this.routeInfo.id,
predictCount: item.predictCount,
// sopName: item.sopName,
// sopId: this.routeInfo.id,
followerTypeId: item.followerTypeId,
followerTypeName: item.followerTypeName,
reachesType: item.reachesType,
......@@ -767,8 +797,7 @@ export default {
}
})
}
params.eventList = JSON.stringify(params.eventList)
console.log(params)
// console.log(params)
if (this.editDisabled) {
var batchEditParams = {
sopId: params.id,
......@@ -786,6 +815,7 @@ export default {
}
})
} else {
params.eventList = JSON.stringify(params.eventList)
// 新增事件或者事件未开始,调这里
this.$apis.sop.insertOrUpdateSopApi(params).then(res => {
this.$message({
......
......@@ -6,7 +6,11 @@
<el-button :size="size" type="primary" @click="getList">查询</el-button>
</span>
</glsx-combi-form>
<GLTable ref="crowdRef" :pageConf="pageConf" :noDataImg="url" :tableData="crowdList" :tableTotal="total" :tableParams="tableParams" @refreshTable="getList" @selectionTable="handleSelectionTable"></GLTable>
<GLTable ref="crowdRef" :pageConf="pageConf" :hasNum="false" :noDataImg="url" :tableData="crowdList" :tableTotal="total" :tableParams="tableParams" @refreshTable="getList" :setTableFinishFun="setTableFinishFun">
<div slot="radioHtml" class="crowd-table" slot-scope="scope">
<el-radio v-model="selectedCrowdId" :label="scope.scope.crowdId" @click.native="handleClick(scope.scope)"></el-radio>
</div>
</GLTable>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleClose">取 消</el-button>
<el-button size="small" type="primary" @click="handleConfirm">确 定</el-button>
......@@ -30,6 +34,7 @@ export default {
total: 0,
crowdList: [],
heightBox: 200,
selectedCrowdId: '',
// 搜索
searchFormData: [
{
......@@ -51,6 +56,17 @@ export default {
// mutiSelectName: 'list',
tableColumns: [
{
label: '',
prop: '',
width: 80,
addHtml: 'radioHtml'
},
{
label: '序号',
prop: 'idx',
width: 80
},
{
label: '人群名称',
prop: 'crowdName',
formatter: cellValue => {
......@@ -81,11 +97,7 @@ export default {
type: Boolean,
default: false
},
selectedLabelList: {
type: Array,
default: () => []
},
selectedCustomerList: {
selectedCrowdList: {
type: Array,
default: () => []
}
......@@ -109,58 +121,42 @@ export default {
this.$apis.common.getCrowdTreeListApi(params).then(res => {
this.crowdList = res.crowdUnitList
this.total = res.total
this.recoverySelected()
var page = this.$refs.crowdRef.page
// 添加序号
this.crowdList.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
this.selectedCrowdList.length && (this.selectedCrowdId = this.selectedCrowdList[0].crowdId)
// this.recoverySelected()
this.$refs.crowdRef.tableHeightValues = '460px'
})
},
// setTableFinishFun() {
// this.crowdList = this.$refs.crowdRef.data
// this.recoverySelected()
// //接收到的数据为空
// // this.$refs.crowdRef.tableHeightValues = this.$refs.crowdRef.data.length ? '' : '400px'
// this.$refs.crowdRef.tableHeightValues = '460px'
// },
recoverySelected() {
this.$nextTick(() => {
this.selectedCustomerList.forEach(row => {
var idx = this.crowdList.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.crowdList[idx], true)
}
})
})
setTableFinishFun() {
this.crowdList = this.$refs.crowdRef.data
// this.recoverySelected()
//接收到的数据为空
// this.$refs.crowdRef.tableHeightValues = this.$refs.crowdRef.data.length ? '' : '400px'
this.$refs.crowdRef.tableHeightValues = '460px'
},
handleSelectionTable(val) {
// 未选客户时,筛选客户条件
// if (!this.selectedCustomerList.length) {
// this.dealCondLimit(val[0])
// }
let currentList = JSON.parse(JSON.stringify(this.selectedCustomerList))
let tableIds = this.crowdList.map(item => item.crowdId)
this.selectedCustomerList = JSON.parse(JSON.stringify(val))
var selectIds = this.selectedCustomerList.map(item => item.crowdId)
currentList.forEach(item => {
if (!selectIds.includes(item.crowdId) && !tableIds.includes(item.crowdId)) {
this.selectedCustomerList.push(item)
}
})
this.recoverySelected()
handleClick(val) {
let temp = JSON.parse(JSON.stringify(val))
delete temp.idx
this.selectedCrowdList = [temp]
},
handleClose() {
this.$emit('handleCrowdCustClose')
},
handleConfirm() {
this.$emit('handleCrowdCustConfirm', this.selectedCustomerList)
this.$emit('handleCrowdCustConfirm', this.selectedCrowdList)
}
}
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.select-crowd {
.title {
margin-bottom: 12px;
......@@ -207,5 +203,8 @@ export default {
.p-16 {
padding: 16px;
}
.crowd-table .el-radio__label {
display: none;
}
}
</style>
......@@ -77,15 +77,17 @@
<div class="container edit-container">
<p class="edit-title">营销渠道</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRefChannel" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormDataChannel" :formRules="editRule">
<div slot="channelSuffix" class="edit-tips m-t-8">预估受众用户总数:100/500</div>
<div v-show="editForm.pushChannelType" slot="channelSuffix" class="edit-tips m-t-8">预估受众用户总数:{{ editForm.pushChannelType == 2 ? predictCountObj.phone : predictCountObj.qiwei }} /{{ predictCountObj.total }}</div>
<template slot="reachesType" slot-scope="scope">
<el-radio-group v-model="editForm[scope.scope.name]" @change="handleReachesType">
<el-radio-group v-model="editForm[scope.scope.name]" @change="handleReachesType" :disabled="editForm.repeatFlag == 'N'">
<el-radio v-for="(item, index) in scope.scope.optionList" :key="index" :label="item[scope.scope.optionId]">{{ item[scope.scope.optionLabel] }}</el-radio>
</el-radio-group>
<span class="m-l-20" v-if="editForm[scope.scope.name] == 2" id="reachesTypeSet">
同一用户最多参与
<el-form-item prop="reachesTypeSet">
<el-input v-model="editForm.reachesTypeSet"></el-input>
<span class="txt-red" v-if="+maxReachesTypeSet < editForm.reachesTypeSet">该用户最多能参与{{ maxReachesTypeSet }}次</span>
<span class="txt-red" v-else-if="editForm.reachesTypeSet < 2">只能输入2及以上的数字</span>
</el-form-item>
次
</span>
......@@ -103,6 +105,7 @@
</template>
<script>
import { limitPrice } from '@/common/constant'
import ActivityModel from './components/activityModel'
import materialModel from './components/materialModel'
import nicknameModel from './components/nicknameModel'
......@@ -119,6 +122,12 @@ export default {
isNicknameVisible: false,
editStatus: false,
labelWidth: '144px',
maxReachesTypeSet: '',
predictCountObj: {
total: '',
qiwei: '',
phone: ''
},
editForm: {
sopName: '',
eventStartDate: '',
......@@ -129,13 +138,15 @@ export default {
repeatTime: '',
eventEndDate: '',
pushChannelType: '',
// 预估可触达人数
predictCount: '',
// 营销内容
eventContent: '',
eventCount: '',
// eventCount: '',
object: {},
//营销渠道
followerTypeId: '',
reachesType: '',
reachesType: 1,
reachesTypeSet: ''
},
// 营销内容
......@@ -253,6 +264,9 @@ export default {
this.editForm.repeatMode = 1
this.editForm.repeatTime = ''
this.editForm.eventEndDate = ''
// 参与次数
this.editForm.reachesType = 1
this.editForm.reachesTypeSet = 1
}
}
},
......@@ -334,7 +348,19 @@ export default {
confName: '微信朋友圈',
isDisabled: false
}
]
],
handleRadioChange: val => {
switch (this.parentCustomerObj.currentCustomerTypeName) {
case '人群':
this.getCustomerByCrowdList()
break
case '标签':
this.getCustomerByTagList()
break
case '指定':
break
}
}
},
{
label: '跟进员工类型',
......@@ -363,7 +389,7 @@ export default {
confName: '多次',
isDisabled: false
}
]
],
}
],
baseData: {
......@@ -384,6 +410,21 @@ export default {
info: {}
}
}
},
parentCustomerObj: {
type: Object,
default: () => {
return {
// 人群,标签,指定
currentCustomerTypeName: '',
parentPredictObj: {
total: '',
qiwei: '',
phone: ''
},
list: []
}
}
}
// condLimitObj: {
// type: Object,
......@@ -409,6 +450,9 @@ export default {
this.editStatus = true
},
deep: true
},
'editForm.reachesTypeSet'(newValue, oldValue) {
this.editForm.reachesTypeSet = limitPrice(newValue, oldValue, 5, 0, 1, 9999, 'zNumReg')
}
// 'editForm.object.additionalType'(val) {
// var idx = this.editFormDataChannel.findIndex(item => item.name == 'pushChannelType')
......@@ -423,6 +467,7 @@ export default {
created() {
this.getDay('weekList', 7)
this.getDay('monthList', 31)
this.predictCountObj = JSON.parse(JSON.stringify(this.parentCustomerObj.parentPredictObj))
// this.limitQwPhone()
},
......@@ -500,6 +545,11 @@ export default {
let index = this.editFormDataTime.findIndex(k => k.name == item)
this.editFormDataTime[index].isHide = this.editForm.repeatFlag == 'N'
})
if (this.editForm.repeatFlag == 'N') {
// 参与次数
this.editForm.reachesType = 1
this.editForm.reachesTypeSet = 1
}
},
recoveryEndTime() {
......@@ -605,6 +655,45 @@ export default {
},
// 营销内容
getCustomerByCrowdList() {
var params = {
pageSize: 1,
pageNum: 1,
crowdId: this.parentCustomerObj.list[0].crowdId
}
// 1-企业微信;2-短信;3-微信朋友圈
this.editForm.pushChannelType == 2 ? (params.customerPhone = '1') : (params.isJoin = 1)
this.$apis.sop.getCustomerCrowdApi(params).then(res => {
this.predictCountObj[this.editForm.pushChannelType == 2 ? 'phone' : 'qiwei'] = res.count
})
},
getCustomerByTagList() {
var params = {
combineType: 2,
pageSize: 1,
pageNum: 1,
tagLists: []
}
this.parentCustomerObj.list.list &&
this.parentCustomerObj.list.list.forEach(item => {
item.labelList.length &&
item.labelList.forEach(subItem => {
params.tagLists.push({
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
groupType: item.labelType,
labelId: subItem.id,
labelName: subItem.name
})
})
})
// 1-企业微信;2-短信;3-微信朋友圈
this.editForm.pushChannelType == 2 ? (params.customerPhone = '1') : (params.isJoin = 1)
this.$apis.sop.getCustomerByTagListApi(params).then(res => {
this.predictCountObj[this.editForm.pushChannelType == 2 ? 'phone' : 'qiwei'] = res.count
})
},
// 跳转
whereToGo(id) {
document.getElementById(id).scrollIntoView()
......@@ -642,15 +731,23 @@ export default {
}
// 跟进员工类型followerTypeId
this.editForm.followerTypeName = this.baseData.staffTypeList.find(item => item.id).businessName
// console.log(this.editForm)
// 预估可触达人数
this.editForm.predictCount = this.predictCountObj[this.editForm.pushChannelType == 2 ? 'phone' : 'qiwei']
console.log(this.editForm)
if (this.editForm.repeatFlag == 'Y') {
this.$apis.sop.parseEventCountApi(countParams).then(res => {
this.editForm.eventCount = res.eventStatistics.eventCount
this.$emit('handleInfoConfirm', { baseInfo: this.editForm })
// this.editForm.eventCount = res.eventStatistics.eventCount
this.maxReachesTypeSet = res.eventStatistics.eventCount
if (this.maxReachesTypeSet < this.editForm.reachesTypeSet || this.editForm.reachesTypeSet < 2) {
this.whereToGo('reachesTypeSet')
this.submit = false
return true
}
this.$emit('handleInfoConfirm', { baseInfo: this.editForm, predictCountObj: this.predictCountObj })
})
} else {
this.editForm.eventCount = 1
this.$emit('handleInfoConfirm', { baseInfo: this.editForm })
// this.editForm.eventCount = 1
this.$emit('handleInfoConfirm', { baseInfo: this.editForm, predictCountObj: this.predictCountObj })
}
},
cancelJump() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!