Commit a94f6a44 by chenwq

转化订单推送

1 parent d1e88b9a
......@@ -87,6 +87,13 @@ const staticRoutes = Object.freeze([
path: '/payMerchantsManage/addPayMerchant',
component: resolve => require([`@/views/payMerchantsManage/addPayMerchant.vue`], resolve),
meta: {}
},
// 转化+订单推送
{
name: 'saasOrder',
path: '/saasOrder/index',
component: resolve => require([`@/views/saasOrder/index.vue`], resolve),
meta: {}
}
])
export default staticRoutes
<!-- 转化订单推送 -->
<template>
<div class="activity">
<!-- <GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> -->
<!-- 表格区域 开始 -->
<div class="container">
<div class="flex-between title">
<div class="title-text">专员列表</div>
<!-- <template v-if="activeName == 'first'"> -->
<el-button :size="size" type="primary" class="battle-set-btn" @click="battleSetHandle">批量配置专员</el-button>
<!-- </template> -->
</div>
<GLTable ref="battleRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @selectionTable="selectionTable">
<div slot="activityTime" slot-scope="scope">{{ dateFormatFun(scope.scope.startTime) }}-{{ dateFormatFun(scope.scope.endTime) }}</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" v-if="scope.scope.reportStaffs.length == 0" @click="handlebattleOn(scope.scope)">配置</el-button>
<el-button type="text" v-else @click="handlebattleOn(scope.scope, 'edit')">编辑</el-button>
</div>
</GLTable>
</div>
<GLDialog :mode="mode" class="battle-dialog" title="配置专员" @onOk="handlebattleConfirm" @onCancel="handlebattleClose" :visible.sync="battleVisible" :beforeSearchFn="beforeSearchFn">
<div class="gl-form-page gl-form-min">
<el-form ref="form" label-width="154px">
<!-- <el-form-item label="发送人员:">
<el-radio-group v-model="config.staffType" @change="changeType">
<el-radio v-model="radio" label="1">全部人员</el-radio>
<el-radio v-model="radio" label="2">指定人员</el-radio>
</el-radio-group>
</el-form-item> -->
<el-form-item label="所属企业:">
<el-radio-group v-model="config.merchantId" @change="changeRadio">
<template v-for="(item, index) in merchantList">
<el-radio :key="index" :label="item.merchantId">{{ item.merchantName }}</el-radio>
</template>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="人员选择:" v-show="config.staffType == 2">
<el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i>
选择成员
</el-button>
<div class="el-input-tag input-tag-wrapper" v-show="userList.length">
<GLFull :label="tag.staffName" :identi="`${tag.id}`" labelWidth="110" textType="user" :haveClose="true" v-for="(tag, idx) in userList" :key="idx" @handleRemove="removeStaff(idx)"></GLFull>
</div>
</el-form-item> -->
<!-- 战报自动发送 -->
<el-form-item class="select-wrap" label="战报自动发送:">
<div class="common el-form-item__content">
<div class="el-input" ref="automaticRef">
<div class="el-input__inner" @click="openAutomatic">
<span v-if="wechat.automaticName == ''" class="placeholder">选择成员</span>
{{ wechat.automaticName }}
</div>
<span class="el-input__suffix" @click="openAutomatic">
<span class="el-input__suffix-inner"><i :class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up', isAutomatic ? 'is-reverse' : '']"></i></span>
</span>
</div>
</div>
<transition name="el-zoom-in-top" v-if="!isAutomatic">
<gl-select-menu :domEl="automaticEl" @changeStatu="hideSelect">
<el-form-item class="search-groomname">
<el-input placeholder="请输入搜索关键词" v-model="filterText"></el-input>
</el-form-item>
<div class="el-select-dropdown__wrap el-scrollbar__wrap">
<template v-if="automaticData.length > 0">
<el-tree class="filter-tree" :data="automaticData" node-key="id" :default-expanded-keys="expandedKeys" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree" @node-click="handleNodeClick"></el-tree>
</template>
<div class="empty" v-else>暂无数据</div>
</div>
</gl-select-menu>
</transition>
</el-form-item>
<!-- 关联群 -->
<el-form-item class="select-wrap" label="关联群:">
<div class="common el-form-item__content">
<div class="el-input" ref="groupRef">
<div class="el-input__inner" @click="openGroup">
<span class="placeholder" v-if="wechat.roomName == ''">选择选择群</span>
{{ wechat.roomName }}
</div>
<span class="el-input__suffix" @click="openGroup">
<span class="el-input__suffix-inner"><i :class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up', isgroup ? 'is-reverse' : '']"></i></span>
</span>
</div>
</div>
<transition name="el-zoom-in-top" v-if="!isgroup">
<gl-select-menu :domEl="domEl" @changeStatu="hideSelect">
<el-form-item class="search-groomname">
<el-input placeholder="请输入搜索关键词" prefix-icon="el-icon-search" v-model="roomName"></el-input>
</el-form-item>
<div class="el-select-dropdown__wrap el-scrollbar__wrap">
<ul class="el-scrollbar__view el-select-dropdown__list">
<template v-if="groupList.length > 0">
<li v-for="i in roomName == '' ? groupList : stageList" class="el-select-dropdown__item" :key="i" @click="selectGroup(i)">
<span>{{ i.roomName }}</span>
</li>
</template>
<div class="empty" v-else>暂无数据</div>
</ul>
</div>
</gl-select-menu>
</transition>
</el-form-item>
</el-form>
</div>
</GLDialog>
<!-- <GLDialog :mode="mode" title="选择员工" @onOk="handlestaffbattleConfirm" @onCancel="handlestaffbattleClose" :visible.sync="battlestaffVisible">
<SelectMember ref="selectMember" :selectlist="userList" v-if="battlestaffVisible" :merchantId="config.merchantId"></SelectMember>
</GLDialog> -->
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { dateFormat } from '../../utils/index'
// import SelectMember from '../battle/components/SelectMember.vue'
import GlSelectMenu from '../battle/components/select-dropdown.vue'
export default {
components: {
// SelectMember,
GlSelectMenu
},
data() {
return {
isgroup: true,
isAutomatic: true,
merchantId: '',
merchantName: '',
// activeName: 'first',
size: 'small',
mode: 'mid',
battleVisible: false,
battlestaffVisible: false,
url: url,
setectList: [],
merchantList: [],
groupList: [],
tabPaneList: [
{
label: '进行中',
name: 'first'
},
{
label: '已结束',
name: 'second'
}
],
tableSearchForm: {},
// 表格
userList: [],
selectArray: [],
getListApi: this.$apis.battle.getActivitylist,
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
// // 行数据的key
mutiSelectUniqueKey: 'activityId',
// 多选ref的名称
mutiSelectName: 'activity',
tableColumns: [
{
label: '活动名称',
prop: 'activityName'
},
{
label: '活动门店',
prop: 'merchantName'
},
{
label: '活动时间',
addHtml: 'activityTime'
},
{
label: '负责人',
formatter: val => {
return val.reportStaffs.length > 0 ? val.reportStaffs.map(item => item.staffName).join('、') : '--'
},
prop: 'reportStaffs',
line: 1,
width: 300
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
defaultProps: {
children: 'children',
label: 'name'
},
expandedKeys: [],
filterText: '',
automaticData: [],
stageList: [],
roomName: '',
config: {
merchantId: ''
// staffType: '2'
},
wechat: {
automaticName: '',
roomName: ''
}
}
},
mounted() {
this.getMerchantList()
},
computed: {
domEl() {
return this.$refs.groupRef
},
automaticEl() {
return this.$refs.automaticRef
}
},
watch: {
// activeName: {
// handler(val) {
// if (val == 'first') {
// this.tableParams.tableOption = true
// this.$nextTick(() => {
// this.tableParams.mutiSelectUniqueKey = 'activityId'
// this.tableParams.mutiSelectName = 'activityId'
// })
// } else {
// this.tableParams.tableOption = false
// this.$nextTick(() => {
// this.tableParams.mutiSelectUniqueKey = ''
// this.tableParams.mutiSelectName = ''
// })
// }
// },
// immediate: true
// },
filterText(val) {
this.$refs.tree.filter(val)
},
roomName(val) {
this.filterRoomName(val)
}
},
methods: {
clearData() {
this.setectList = []
this.config.merchantId = this.merchantId
// this.config.staffType = '2'
this.wechat = {
automaticName: '',
roomName: ''
}
this.hideSelect()
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
filterRoomName(value) {
this.stageList = this.groupList.filter(item => {
if (item.roomName.indexOf(value) !== -1) {
return item
}
})
},
handleNodeClick(data) {
this.hideSelect()
this.wechat.automaticName = data.name
this.wechat.staffId = data.staffId
this.wechat.roomName = ''
this.getGroupList(this.wechat.staffId)
},
hideSelect() {
this.isgroup = true
this.isAutomatic = true
},
selectGroup(data) {
this.hideSelect()
this.wechat.roomName = data.roomName
this.wechat.groupId = data.roomChatId
},
openGroup(e) {
this.isAutomatic = true
this.isgroup = !this.isgroup
},
openAutomatic() {
this.isgroup = true
this.isAutomatic = !this.isAutomatic
},
removeStaff(index) {
this.userList.splice(index, 1)
},
//所属企业
changeRadio(val) {
this.getDepartmentTree()
this.merchantList.forEach(item => {
item.merchantId == val ? (this.merchantName = item.merchantName) : ''
})
this.userList = []
},
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res
this.config.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantName = this.merchantList && this.merchantList[0].merchantName
})
},
// changeType(val) {
// if (val == 1) {
// this.getDepartmentTree()
// } else {
// this.userList = []
// }
// },
battleSetHandle() {
if (this.setectList.length == 0) {
this.$message({
message: '请选择活动',
type: 'error'
})
return
}
this.userList = []
this.battleVisible = true
},
dateFormatFun(date) {
return dateFormat(date)
},
selectionTable(val) {
this.setectList = val
},
handlestaffbattleConfirm() {
this.battlestaffVisible = false
this.userList = this.$refs.selectMember.userList
},
handlestaffbattleClose() {
this.battlestaffVisible = false
},
// openMembers() {
// this.battlestaffVisible = true
// // if (this.ids.length > 0) {
// // this.$refs.selectMember.$refs.tree.setCheckedKeys(this.ids)
// // }
// },
handlebattleConfirm() {
if (this.userList.length == 0) {
this.$message({
message: '请选择专员',
type: 'error'
})
return
}
if (this.wechat.automaticName !== '' && this.wechat.roomName == '') {
this.$message({
message: '请选择关联群',
type: 'error'
})
}
let staffRequestList = []
let batchstaffRequestList = []
this.userList.forEach(item => {
staffRequestList.push({
staffId: item.staffId,
staffName: item.staffName,
merchantId: this.config.merchantId,
merchantName: this.merchantName,
userId: item.userId
})
})
this.setectList.forEach(item => {
batchstaffRequestList.push({
activityId: item.activityId,
autoStaffId: this.wechat.staffId,
autoStaffName: this.wechat.automaticName,
autoGroupId: this.wechat.groupId,
autoGroupName: this.wechat.roomName,
autoGroupMerchantId: this.$merchantId,
staffRequestList
})
})
this.$apis.battle.insertStaff({ batchstaffRequestList }).then(res => {
this.$message({
message: res.code == '0' ? '配置成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.data) {
this.battleVisible = false
this.handleSearch()
// this.activeName = 'first'
this.clearData()
}
})
},
handlebattleClose() {
this.clearData()
this.battleVisible = false
},
handleDetails() { },
handlebattleOn(data, sign) {
this.setectList = []
this.userList = []
this.setectList.push(data)
this.battleVisible = true
if (sign) this.getStaffList(data)
this.getDepartmentTree()
},
//获取编辑
getStaffList(data) {
this.$apis.battle.getStaffList({ id: data.activityId }).then(res => {
this.config.merchantId = res.staffs[0].merchantId
this.merchantId = res.staffs[0].merchantId
this.merchantName = res.staffs[0].merchantName
this.userList = res.staffs
// this.config.staffType = res.staffType + ''
this.wechat.staffId = res.autoStaffId
this.wechat.automaticName = res.autoStaffName
this.wechat.groupId = res.autoGroupId
this.wechat.roomName = res.autoGroupName
this.getGroupList(this.wechat.staffId)
})
},
getGroupList(id) {
this.$apis.battle.getGroupList({ msgStaffIdList: id }).then(res => {
if (res.code == 0) this.groupList = res.data
})
},
handleSetting() {
this.drawer = true
},
handleClick() {
this.handleSearch()
},
getParams() {
let params = {}
params.activityStatus = 2
// this.activeName == 'first' ? (params.activityStatus = 2) : (params.activityStatus = 3)
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.battleRef.data.length ? (this.$refs.battleRef.tableHeightValues = '') : this.$refs.battleRef.setTableHeightFun()
},
handleSearch() {
this.$refs.battleRef.refreshTable()
},
async getDepartmentTree() {
// let params = { addChildrensFlag: true, queryMerchantId: this.config.merchantId,loginStatus:1 }
let params = { addChildrensFlag: true, queryMerchantId: 44210895, loginStatus: 1 }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
this.automaticData = data
await this.initData(this.automaticData)
this.expandedKeys = [this.automaticData[0].id]
},
initData(data) {
data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
let entmicroStaffResponses = this.$common.utils.deepClone(item.entmicroStaffResponses) || []
entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
}
})
let child = this.$common.utils.deepClone(item.children) || []
child = child.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
} else if (staff.entmicroStaffResponses) {
staff.staffId = staff.id
return true
}
})
const children = [...child, ...entmicroStaffResponses]
item.children = children
//清除没有员工的部门
if (!item.staffName && item.entmicroStaffResponses === null) {
// data.splice(index, 1)
}
children.length && this.initData(children)
})
}
}
}
</script>
<style scoped lang="scss">
.activity {
.container {
margin-top: 16px;
.title {
height: 32px;
line-height: 32px;
margin-bottom: 10px;
.title-text {
font-weight: 600;
font-size: 16px;
color: #333333;
margin-left: 4px;
}
}
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px;
max-height: 68px;
overflow: auto;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 450px;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
/deep/ .el-tag {
background-color: #fff !important;
margin-bottom: 4px;
}
}
.select-wrap {
.common {
margin: 4px 0;
height: 40px !important;
overflow: hidden;
/deep/ .el-input {
height: 40px !important;
line-height: 40px !important;
}
/deep/ .el-input__suffix {
height: 40px !important;
margin-top: -4px;
.is-reverse {
transform: rotate(180deg);
}
}
}
}
}
.search-groomname {
width: 252px;
margin: 12px 16px 0;
/deep/.el-input {
width: 252px;
}
}
.filter-tree {
padding: 0 16px;
}
.empty {
padding: 10px 0;
margin: 0;
text-align: center;
color: #999;
font-size: 13px;
}
.placeholder {
font-size: 14px;
color: #c0c6ce;
line-height: 20px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!