Commit e45e3adb by 杨明

fixed

2 parents f0773c43 73370fe4
import { http, http2 } from '@/main'
const URL = 'rop-scrm-entmicro/router'
export default {
}
......@@ -2,12 +2,11 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-09-15 15:23:08
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-09-22 17:37:53
* @LastEditTime: 2022-09-23 09:39:55
* @FilePath: \scrm-micro-authorize\src\api\modules\common.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { http_common } from '@/main'
const pictureUpload = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http_common({
......
import { http, http2 } from '@/main'
const path = 'entmicro.api.mass.'
const URL = 'rop-scrm-entmicro/router'
const querylabeltree = params => {
params.method = 'scrm.api.datahub.labelgroup.queryLabelTree'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
const queryCrowdtree = params => {
params.method = 'scrm.api.datahub.user.queryCrowdTree'
return http({
url: 'rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
const batchmessagingRecord = params => {
params.method = 'entmicro.api.wechatcloudcontrol.batchmessaging.record'
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
// 企微群发查看预计群发人数
const atchmessagingCustomercount = params => {
params.method = 'entmicro.api.wechatcloudcontrol.batchmessaging.customercount'
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
// 企微群发任务创建
const atchmessagingCreate = params => {
params.method = 'entmicro.api.wechatcloudcontrol.batchmessaging.create'
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
export default {
querylabeltree,
queryCrowdtree,
batchmessagingRecord,
atchmessagingCustomercount,
atchmessagingCreate
}
import { http } from '@/main'
const path = 'entmicro.api.mass.'
const URL = 'rop-scrm-entmicro/router'
//权益卡
const getCard = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//权益卡
const merchant = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//是否开通权益
const merchantOpen = params => {
params.method = 'scrm.api.equity.service.merchant.config.get'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//优惠券
const getCoupon = params => {
params.method = 'scrm.api.boutiquecoupon.coupon.page'
return http({
url: '/rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//套餐
const getPackage = params => {
params.method = 'scrm.api.equity.package.info.list.with.page'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getMerchant = params => {
params.method = 'scrm.api.coupon.list.merchant'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
//秒杀活动
const getActivity = params => {
params.method = 'scrm.api.shopmall.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取素材组列表
const getGroupListApi = params => {
params.method = 'marketing.api.material.group.list'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取素材列表
const getMaterialListApi = params => {
// params.method = 'marketing.api.material.page'
params.method = 'marketing.api.material.sop.page'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
}
// 众筹模式活动
const crowdfundingActivity = params => {
params.method = 'scrm.api.shopmall.crowdfunding.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//模板列表
const templatePage = params => {
params.method = `${path}template.page.search`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板保存
const templateSave = params => {
params.method = `${path}template.save`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板更新
const templateUpdate = params => {
params.method = `${path}template.update`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板创建人
const createdNameList = params => {
params.method = `${path}template.created.name.list`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
export default {
getCard,
merchant,
getActivity,
getPackage,
getMerchant,
getCoupon,
merchantOpen,
getGroupListApi,
getMaterialListApi,
templatePage,
createdNameList,
templateUpdate,
templateSave,
crowdfundingActivity
}
......@@ -4,7 +4,7 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-09-23 09:33:26
* @LastEditTime: 2022-09-23 09:40:29
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
// let request = require('@/http/request.js')
......@@ -12,11 +12,11 @@ let cfg = require('./conf.js')
import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) {
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
// }
if (isEnv) {
let { request } = cfg
Object.assign(request, { timeout })
return Promise.resolve(cfg)
}
//return window.fetch('https://', {}).then(res => res.json())
// return new Http().get('https://oss-config.test.glsx.com.cn/mock/6215f98e60f415276f6dfe56/authorize/config')
return new Http().get('https://oss-config.test.glsx.com.cn/mock/6215f98e60f415276f6dfe56/authorize/config')
......
......@@ -26,6 +26,7 @@ Vue.use(GLFooter)
Vue.use(GLTableButton)
Vue.use(GLEditor)
Vue.use(GLDialog)
Vue.use(GLEditor)
export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
const { response, request, sign, sign_common, secret, request_common } = await fetchConfig(true) //globalState.configSwitch
Vue.prototype.$history = history
......
import { Message } from 'element-ui'
let util = {}
util.cloneText = function(message) {
let input = document.createElement('input')
input.value = message
document.body.appendChild(input)
input.select()
input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
document.body.removeChild(input)
Message.success('复制成功')
}
util.getBeforeDate = function(sign = '-') {
let day = new Date()
let month = day.getMonth() + 1
let date = day.getDate()
if (month < 10) month = '0' + month
if (date < 10) date = '0' + date
var s = day.getFullYear() + sign + month + sign + date
return s
}
util.getBeforeMonth = function(days) {
let month = new Date().getMonth() + 1
let year = new Date().getFullYear()
let arr = new Array()
for (let i = 0; i < days; i++) {
if (month <= 0) {
year = year - 1
month = month + 12
}
if (month < 10) month = '0' + month
arr[i] = year + '年' + month + '月'
month--
}
return arr
}
/**
* 格式化时间
* @param {Array} time
*/
util.formatTime = function(time) {
return {
startTime: time ? time[0] + ' ' + '00:00:00' : '',
endTime: time ? time[1] + ' ' + '23:59:59' : ''
}
}
util.tringToDate = function(dateStr, separator) {
if (!separator) {
separator = '-'
}
var dateArr = dateStr.split(separator)
var year = parseInt(dateArr[0])
var month
//处理月份为04这样的情况
if (dateArr[1].indexOf('0') == 0) {
month = parseInt(dateArr[1].substring(1))
} else {
month = parseInt(dateArr[1])
}
var day = parseInt(dateArr[2])
var date = new Date(year, month - 1, day)
return date
}
util.getDay = function(num, str = '-') {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
}
util.openUrl = function(url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
util.downloadIamge = function(imgsrc, name = new Date().getTime()) {
//下载图片地址和图片名
var image = new Image()
// 解决跨域 Canvas 污染问题
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function() {
var canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
var context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height)
var url = canvas.toDataURL('image/png') //得到图片的base64编码数据
var a = document.createElement('a') // 生成一个a元素
var event = new MouseEvent('click') // 创建一个单击事件
a.download = name || 'photo' // 设置图片名称
a.href = url // 将生成的URL设置为a.href属性
a.dispatchEvent(event) // 触发a的单击事件
}
image.src = imgsrc
}
export default util
<template>
<div class="container">
<GLCombiForm :formObj="searchForm" :rowNumber="1" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<div class="header-text">已激活列表</div>
<div>
<el-button class="table-btn" @click="handleqrCode" :size="size" type="primary" plain mode="el-button">企微接入授权</el-button>
</div>
</div>
<GLTable ref="activeTable" :noDataImg="url" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"></GLTable>
<GLDialog :title="'授权登入二维码'" mode="small" :visible.sync="qrCodeVisible">
<div class="qrIMGbox">
<img class="qrIMG" :src="url" />
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" size="small" @click="refreshQrcode">刷新</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'collocation',
data() {
return {
url,
qrCodeVisible: false,
searchForm: {
belongWechat: '',
staffName: '',
telphone: '',
status: ''
},
searchFormData: [
{
label: '所属企微',
name: 'belongWechat',
type: 'input',
isClear: true
},
{
label: '员工姓名',
name: 'staffName',
type: 'input',
isClear: true
},
{
label: '手机号码',
name: 'telphone',
type: 'input',
isClear: true
},
{
label: '状态',
name: 'status',
type: 'select',
optionList: [
{
label: '全部',
value: ''
},
{
label: '在线',
value: 1
},
{
label: '离线',
value: 0
}
],
optionId: 'value',
optionLabel: 'label',
isClear: true
}
],
tableParams: {
listName: 'list',
tableColumns: [
{
label: '员工企微',
prop: 'staffNum'
},
{
label: '手机号码',
prop: 'telphone'
},
{
label: '所属门店',
prop: 'belongStore'
},
{
label: '所属企微',
prop: 'belongWechat'
},
{
label: '最后同步时间',
prop: 'time'
},
{
label: '状态',
prop: 'status'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
// getListApi: this.$apis.accountConfig.listCustomizedAgentWithPage,
}
},
methods: {
handleSearch() {
this.$refs.activeTable.refreshTable()
},
// 重置搜索框搜索
handleReset() {
this.searchForm = {
isBuyPermit: '',
merchantId: '',
merchantName: ''
}
this.handleSearch()
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.activeTable.data.length ? (this.$refs.activeTable.tableHeightValues = '') : this.$refs.activeTable.setTableHeightFun()
},
handleqrCode() {
this.qrCodeVisible = true
},
refreshQrcode() {
console.log('1111')
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 20px;
background-color: #fff;
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
.header-text {
font-size: 16px;
color: #333333;
font-weight: 600;
}
}
.table-btn {
color: #5850ff;
border: 1px solid #5850ff;
}
.qrIMGbox{
display: flex;
align-items: center;
justify-content: center;
.qrIMG {
width: 150px;
height: 150px;
}
}
}
</style>
<template>
<div class>
<div class="container">
<div>
<div class="title">基础信息</div>
<div class="info-box">
<div class="info-content gl-form-page">
<el-form class="basic-form" :model="basicForm" :rules="basicRules" ref="basicForm" label-width="154px">
<el-form-item label="群发名称:" prop="groupName">
<el-input size="small" v-model="basicForm.groupName"></el-input>
</el-form-item>
<!-- <el-form-item label="选择门店:">-->
<!-- <el-select-->
<!-- clearable-->
<!-- filterable-->
<!-- remote-->
<!-- :remote-method="remoteMethod"-->
<!-- v-el-select-loadmore="loadmore"-->
<!-- v-model="ruleForm.merchant"-->
<!-- placeholder="请选择商户"-->
<!-- @change="selectChange"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="(x, i) in dataItems"-->
<!-- :key="i"-->
<!-- :label="x.merchantName"-->
<!-- :value="x.merchantName"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="选择客户:" prop="selectType">
<el-radio-group @change="radioChange" v-model="basicForm.selectType">
<el-radio :label="1">标签筛选</el-radio>
<el-radio :label="2">人群筛选</el-radio>
</el-radio-group>
<div v-show="basicForm.selectType == 1">
<div class="selectedLabel">
<el-button size="small" @click="openLabel">
<i class="el-icon-plus"></i>
选择标签
</el-button>
<div class="selectLen" v-show="taggingList.length != 0">(已选
<span class="num">{{taggingList.length}}</span>
个标签)</div>
</div>
<div v-show="tagging.length != 0" :key="key" class="el-input-tag input-tag-wrapper">
<span v-for="(tag, idx) in tagging" :key="idx">
<el-tag v-for="(tagItem, idx1) in tag.labelList" :key="idx1" :size="size" type="info" closable :disable-transitions="false" @close="removeTag(tag, idx1, idx)">{{ tagItem.name }}</el-tag>
</span>
</div>
</div>
<div v-show="basicForm.selectType == 2" style="line-height: 32px; padding-bottom: 10px">
<el-button :size="size" icon="el-icon-plus" @click="selectCrowd">{{ isSelectCrowd ? '继续选择' : '选择人群' }}</el-button>
<div class="sale-select" v-show="basicForm.crowdList && basicForm.crowdList.length != 0">
<div class="el-input-tag input-tag-wrapper">
<el-tag effect="plain" type="info" v-for="(t, i) in basicForm.crowdList" :key="i" closable :disable-transitions="false" @close="removeCrowd(t, i)">
{{ t.crowdName }}
</el-tag>
</div>
</div>
</div>
<div v-show="basicForm.selectType == 2" class="crowd-tips">人群标签存在重复客户,群发人数会自动去重。若一个客户有多个成员添加,可手动在群发账号中删除多余成员。</div>
<div class="filter-footer">
<div class="filter-number">
预计群发人数
<el-button type="text" v-show="isUpdate" :loading="viewLoading" @click="viewMembers">查看</el-button>
<span v-show="!isUpdate">{{ groupNumber }}</span>
</div>
</div>
</el-form-item>
</el-form>
<!-- 编辑入群欢迎语 -->
<div class="title">编辑群发内容</div>
<div class="group-content">
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="154px">
<el-form-item prop="attachmentList">
<label slot="label" class="required">群发内容:</label>
<GLEditor ref="welcome" :form="'customer'" style="line-height: 12px;" :btnList="btnList" ></GLEditor>
<div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div>
</el-form-item>
<div class="transform-text">
<span>每位客户每天可接收1条群发消息,超过接收上限的客户将无法再收到群发消息。</span>
</div>
</el-form>
</div>
</div>
</div>
</div>
</div>
<GLFooter>
<el-button type="primary" v-loading="addLoading" @click="handleSubmit">发送</el-button>
<el-button @click="handleCancel">取消</el-button>
</GLFooter>
<SelectLabel ref="selectLabel" @tagSelected="handleSelect" :dialogVisible="dialogVisible"></SelectLabel>
<SelectCrowd ref="selectCrowd" @crowdData="getCrowdData" :selectCrowdData="basicForm.crowdList"></SelectCrowd>
</div>
</template>
<script>
const combineType = {
label: 2,
crowd: 1
}
import emoji from '@/utils/emo'
import SelectCrowd from './components/selectCrowd.vue'
import SelectLabel from './components/SelectLabel.vue'
import * as dayjs from 'dayjs'
export default {
components: {
SelectLabel,
SelectCrowd
},
data() {
const validatorUser = (rule, value, callback) => {
const userList = this.basicForm.userList
if (userList && userList.length != 0) {
callback()
} else {
callback(new Error('请选择群发账号'))
}
}
const validatorAttachment = (rule, value, callback) => {
const previewList = this.$refs.welcome.previewList
if (previewList.length != 0) {
this.basicForm.attachmentList = previewList
}
if (this.basicForm.attachmentList) {
if (this.basicForm.attachmentList.length > 9) {
callback(new Error('附件不可超过9个'))
} else {
callback()
}
} else {
callback(new Error('请输入群发内容'))
}
}
return {
// 新建按钮加载
addLoading: false,
// 标签/人群筛选数组
taggingList: [],
btnList: [
{
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
name: '图片',
funcName: '',
type: 'img',
uploadApi: this.$apis.common.pictureUpload
},
{
name: '活动',
type: 'activity',
funName: 'activity',
funParams: [
{
itemName: '权益卡试用',
itemValue: 3,
itemType: 'card',
getInterfaceApi: this.$apis.welcomeword.getCard,
params: {
tryAble: 1,
merchantId: this.$globalState.session.merchantId
}
},
{
itemName: '权益套餐',
itemValue: 4,
itemType: 'package',
getInterfaceApi: this.$apis.welcomeword.getPackage,
params: {}
},
{
itemName: '商城券',
itemValue: 2,
itemType: 'coupon',
getInterfaceApi: this.$apis.welcomeword.getMerchant,
params: {
discountTypes: [2, 3, 4],
directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
validType: 'valid'
}
},
{
itemName: '秒杀活动',
itemValue: 5,
itemType: 'activity',
getInterfaceApi: this.$apis.welcomeword.getActivity,
params: {
activityStatus: 2,
currentPage: 1
}
},
{
itemName: '无忧服务',
itemValue: 6,
itemType: 'merchant',
getInterfaceApi: this.$apis.welcomeword.merchant,
merchantOpen: {
merchantOpenApi: this.$apis.welcomeword.merchantOpen,
params: {
merchantId: this.$globalState.session.merchantId
}
},
params: {
merchantId: this.$globalState.session.merchantId
}
},
{
itemName: '众筹活动',
itemValue: 7,
itemType: 'crowdfunding',
getInterfaceApi: this.$apis.welcomeword.crowdfundingActivity,
params: {
currentPage: 1,
activityStatus: 2
}
}
]
},
{
name: '素材',
type: 'material',
funName: 'material',
groupListApi: this.$apis.welcomeword.getGroupListApi,
materialListApi: this.$apis.welcomeword.getMaterialListApi
// pdfNo: 1
// videoNo: 1
},
{
name: '模板',
type: 'message',
funName: 'message',
getSearchApi: this.$apis.welcomeword.createdNameList,
templateApi: this.$apis.welcomeword.templatePage,
templateUpdateApi: this.$apis.welcomeword.templateUpdate,
templateSaveApi: this.$apis.welcomeword.templateSave,
templateDetailApi: this.$apis.welcomeword.templateDetail
}
],
attachmentShow: false,
attachmentText: '',
basicRules: {
groupName:[{ required: true, message: '请选择群发名称', trigger: 'blur' }],
selectStore:[{ required: true, message: '请选择门店', trigger: 'change' }],
userList: [{ validator: validatorUser, trigger: 'change' }],
selectType: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
},
basicForm: {
groupName:'',
selectStore: '',
selectType: 1,
},
groupList: [],
selectData: [],
// 是否有修改筛选成员
isUpdate: true,
tagging: [],
groupNumber: 0,
editStatus: false,
firstFlag: true,
footerLeft: 40,
footerWidth: 500,
viewLoading: false,
isSelectCrowd: false,
}
},
watch: {
basicForm: {
handler(val) {
if (this.firstFlag) {
this.firstFlag = false
} else {
this.editStatus = true
}
},
deep: true
},
'basicForm.selectType'(newVal, oldVal) {
if (oldVal == 2 || newVal == 2) {
this.basicForm.userList = []
this.selectData = []
this.basicForm.crowdList = []
}
}
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.boxHeight = clientHeight - 200
},
methods: {
// 返回
handleCancel() {
if (this.editStatus || this.$refs.welcome.previewList.length > 0) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$router.push('/wechatGroup/index')
})
.catch(() => {})
} else {
this.$router.push('/wechatGroup/index')
}
},
// 打开标签筛选弹框
openLabel() {
// if (!this.basicForm.selectStore) {
// this.$message({
// type: 'error',
// message: '请先选择门店'
// })
// return
// }
this.dialogVisible = !this.dialogVisible
this.$refs.selectLabel.init(this.tagging)
},
// 提交
handleSubmit() {
this.$refs.basicForm.validate(valid => {
if (valid) {
this.attachmentShow = true
const previewList = this.$refs.welcome.previewList
if (previewList.length != 0) {
this.basicForm.attachmentList = previewList
}
if (this.basicForm.attachmentList && this.basicForm.attachmentList.length && this.basicForm.attachmentList[0].attType == 1 && this.basicForm.attachmentList[0].attContent != '') {
if (this.basicForm.attachmentList.length > 9) {
return (this.attachmentText = '附件不可超过9个')
} else {
this.attachmentText = ''
this.attachmentShow = false
}
} else {
return (this.attachmentText = '请输入群发内容')
}
console.log(this.basicForm)
if (this.basicForm.selectType == 2 && !this.basicForm.crowdList.length) {
return this.$message({
type: 'error',
message: '请选择人群'
})
}
this.$refs.groupForm.validate(async v => {
if (v) {
const params = this.getSiftMembers()
params.type = 1
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
const attachmentList = previewList.map(item => {
if (item.attType == 1) {
const list = emoji.flat(Infinity)
const cutImg = item.attContent.replaceAll('<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/', '')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
item.attContent = replaceImg.substring(0, 600)
} else if (item.attType == 7) {
if (item.attContent.title) {
item.attType = 4
params.crowdFunding = true
}
item.attContent = JSON.stringify(item.attContent)
}
return item
})
params.attachmentList = attachmentList
const countParams = this.getSiftMembers()
if (countParams) {
this.addLoading = true
this.$apis.wechatGroup
.atchmessagingCreate(params).then(res => {
if (res.code == '-1') {
this.$message({
type: 'error',
message: res.message
})
} else if (res.code == 0) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.$tracker.track(Object.assign({}, { pageName: '群发助手', name: '新建客户群发', params }))
} else {
this.$message({
type: 'error',
message: res.message
})
}
this.addLoading = false
this.$router.push('/wechatGroup/index')
})
} else {
this.$message({
type: 'error',
message: '客户数不可为0!'
})
}
}
})
}
})
},
// 选择标签
handleSelect(val) {
this.isUpdate = true
this.tagging = val
let arr = []
this.tagging.forEach(item => {
item.labelList.forEach(tag => {
arr.push({
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
labelId: tag.id,
labelName: tag.name,
groupType: item.labelType
})
})
})
this.taggingList = arr
},
// 删除标签筛选标签
removeTag(tag, idx1, idx) {
console.log(tag, 'tag')
tag.labelList.splice(idx1, 1)
if (tag.labelList.length == 0) {
this.tagging.splice(idx, 1)
}
let arr = []
this.tagging.forEach(item => {
item.labelList.forEach(tag => {
arr.push({
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
labelId: tag.id,
labelName: tag.name,
groupType: item.labelType
})
})
})
this.taggingList = arr
this.isUpdate = true
},
// 删除人群筛选标签
removeCrowd(item, index) {
this.basicForm.crowdList.splice(index, 1)
// this.getCrowdData(this.basicForm.crowdList)
if (!this.basicForm.crowdList.length) {
this.basicForm.userList = []
this.selectData = this.basicForm.userList
this.isUpdate = true
this.isSelectCrowd = false
}
this.key = new Date()
},
// 获取所在群聊信息
getGroupList() {
if (this.basicForm.userList && this.basicForm.userList.length != 0) {
const staffIds = this.basicForm.userList.map(item => item.staffId)
this.$apis.customerTransform.groupList({ staffIds }).then(res => {
this.groupList = res
})
} else {
this.$message({
type: 'error',
message: '请选择群发账号'
})
}
},
// 获取选择客户筛选信息
getSiftMembers() {
const params = {
selectType: this.basicForm.selectType
}
if (params.selectType == 1) {
console.log('111')
} else if (params.selectType == 2) {
params.crowdCondition = this.basicForm.crowdList
params.combineType = combineType.crowd
}
if (this.basicForm.userList && this.basicForm.userList.length) {
params.userList = this.basicForm.userList.map(item => {
return {
staffId: item.staffId
}
})
}
return params
},
// 查看群发人数
viewMembers() {
if (!this.basicForm.userList || this.basicForm.userList.length == 0) {
if (this.basicForm.selectType == 2) {
this.$message({
type: 'error',
message: '请选择人群'
})
} else {
if (this.basicForm.crowdList && this.basicForm.userList.length == 0) {
this.$message({
type: 'error',
message: '群发账号人数为0'
})
} else {
this.$message({
type: 'error',
message: '请选择群发账号'
})
}
}
return
}
const params = this.getSiftMembers()
this.viewLoading = true
this.$apis.wechatGroup
.atchmessagingCustomercount(params)
.then(res => {
if (res || res == 0) {
this.isUpdate = false
this.groupNumber = res
} else {
this.isUpdate = true
}
this.viewLoading = false
})
.catch(err => {
this.viewLoading = false
this.groupNumber = 0
this.isUpdate = false
})
},
// 选择客户change事件
radioChange(val) {
this.isSelectCrowd = false
this.isUpdate = true
this.tagging = []
this.taggingList = []
},
// 人群筛选弹窗
selectCrowd() {
if (!this.basicForm.selectStore) {
this.$message({
type: 'error',
message: '请先选择门店'
})
return
}
this.$refs.selectCrowd.init(this.basicForm.crowdList)
},
// 获取人群数据(根据人群筛选获取群发账号人群数据)
// getCrowdData(val) {
// if (val.length) {
// this.isSelectCrowd = true
// this.basicForm.crowdList = val
// const params = {
// combineType: combineType.crowd,
// crowdCondition: val
// }
// this.$apis.customerTransform.followerEcho(params).then(res => {
// console.log(res)
// this.$set(this.basicForm, 'userList', res)
// this.selectData = this.basicForm.userList
// this.key = new Date()
// this.isUpdate = true
// this.editStatus = true
// })
// } else {
// this.basicForm.userList = []
// this.basicForm.crowdList = []
// this.selectData = []
// this.isSelectCrowd = false
// this.isUpdate = true
// this.editStatus = true
// this.key = new Date()
// }
// },
}
}
</script>
<style lang="scss" scoped>
.container {
margin-bottom: 20px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
// padding: 20px;
.title {
padding: 20px 0 17px 20px;
font-size: 16px;
color: #333;
font-weight: 600;
border-bottom: 1px solid #d8d8d8;
}
.info-box {
display: inline-flex;
width: 100%;
padding-bottom: 30px;
align-items: flex-end;
justify-content: space-between;
.info-content {
// width: calc(100% - 360px);
width: 66%;
padding-right: 20px;
//.filter-box {
// // margin-left: 120px;
// margin-bottom: 10px;
// min-width: 656px;
// background-color: #f7f7f7;
//
// .filter-memeber {
// padding: 20px 20px 20px 0;
//
// // border-bottom: 1px solid #dcdfe6;
// .el-form {
// padding: 0;
// }
// }
//}
.filter-footer {
display: flex;
// padding: 14px 20px;
justify-content: space-between;
align-items: center;
color: #999;
font-size: 14px;
.filter-number {
display: inline-block;
line-height: 20px;
padding: 7px 14px;
background-color: #e6e9ff;
color: #333;
margin-top: 8px;
span {
color: #5850ff;
cursor: pointer;
}
}
}
.basic-form {
padding: 32px 0 20px 20px;
.selectedLabel{
display: flex;
.selectLen{
margin-left: 20px;
font-size: 14px;
color: #666666;
.num{
color: #5850FF;
}
}
}
}
}
}
.form-tips {
font-size: 12px;
color: #999;
}
.preview {
flex: 1;
margin-right: 24px;
margin-bottom: 58px;
}
}
.transform-text {
display: flex;
// align-items: center;
justify-self: center;
color: #000;
font-size: 14px;
padding: 10px 16px;
background-color: rgba(230, 233, 255, 0.49);
border: 1px solid rgba(88, 80, 255, 0.49);
border-radius: 4px;
line-height: 20px;
margin-left: 154px;
min-width: 488px;
max-width: 844px;
width: auto;
box-sizing: border-box;
.tips-icon {
display: flex;
align-items: center;
height: 20px;
img {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0px;
height: 64px;
width: 100%;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
.label-text {
margin-left: 10px;
font-size: 14px;
span {
color: #5850ff;
}
}
.sale-select {
display: flex;
align-items: center;
// width: 50%;
}
.input-tag-wrapper {
max-height: 75px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
// width: 50%;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
// background: #fff !important;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
.form-error {
color: #f56c6c;
font-size: 12px;
margin-left: 186px;
margin-top: 10px;
}
/deep/ {
.el-form-item .el-form-item {
margin-bottom: 22px;
}
.required {
display: inline-block;
line-height: 40px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
.el-loading-spinner {
transform: translateY(8px);
}
.el-scrollbar {
padding-bottom: 10px;
}
.gl-form-page .el-form .welcome-box {
min-width: 488px;
max-width: 844px;
width: auto;
}
}
.group-content {
padding: 22px 0 20px 0;
}
.tips-text {
font-size: 12px;
color: #f56c6c;
// margin-left: 20px;
line-height: 20px;
padding-bottom: 4px;
}
.crowd-tips {
color: #999999;
font-size: 12px;
line-height: 16px;
padding-bottom: 8px;
}
/deep/.content .btn-group {
line-height: 14px;
}
</style>
<template>
<div class="tag-main">
<GLDialog :bigTitle="'选择标签'" :visible.sync="dialogVisible" mode="big" :before-close="handleClose">
<div class="tag-panel">
<div class="tag-panel-select">
<div class="tag-title">预选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">
<el-input size="small" v-model="labelGroupName" placeholder="请输入搜索内容"></el-input>
<el-button size="small" type="primary" @click="handleSearch">查询</el-button>
<el-button size="small" @click="handleReset">重置</el-button>
</div>
<div class="checkbox-group-box" :style="{ height: heightBox + 'px' }" v-loading="loading">
<div style="margin-bottom: 8px" v-for="(item, index) in labelTreeRets" :key="index">
<span class="el-tree-node__expand-icon el-icon-caret-right" :class="{ expanded: item.checked }" @click.self="item.checked = !item.checked"></span>
<el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange(item.checkAll, index)">{{ item.labelGroup.name }}({{ item.tagChecked.length }}/{{ item.labelList.length }} 项)</el-checkbox>
<el-tag :size="size" class="tag-show">{{ item.labelType }}</el-tag>
<div style="margin: 15px 0"></div>
<el-checkbox-group class="tag-group" v-model="item.tagChecked" @change="handleCheckedChange(item.tagChecked, index)" v-show="item.checked">
<div v-for="(itm, idx) in item.labelList" :key="idx" class="radio-tag">
<el-tooltip effect="dark" placement="top" :disabled="itm.name.length < 8">
<el-checkbox class="check-text" :label="itm">{{ itm.name }}</el-checkbox>
<div slot="content">{{ itm.name }}</div>
</el-tooltip>
</div>
</el-checkbox-group>
</div>
</div>
</div>
</div>
<div class="tag-panel-selected">
<div class="tag-title">已选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">标签名称({{ selectNum }}项)</div>
<div class="tag-selected-box" :style="{ height: heightBox + 'px' }">
<template v-for="item in labelTreeRetSelect">
<template v-for="(tag, idx) in item.tagChecked">
<el-tag :title="tag.name" type="info" class="tag-selected-item" :key="idx" v-if="tag" closable :disable-transitions="false" @close="remove(item, idx)">
{{ tag.name }}
</el-tag>
</template>
</template>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleClose">
取 消
</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import util from '@/utils/util'
export default {
name: 'activityModel',
data() {
return {
loading: false,
heightBox: 200,
dialogVisible: false,
labelGroupName: '',
selectNum: 0,
searchStatus: false,
labelTreeRetSelect: [],
labelTreeRets: []
}
},
watch: {
labelTreeRetSelect: {
handler() {
this.selectNum = 0
this.labelTreeRetSelect.forEach(item => {
this.selectNum += item.tagChecked.length
})
},
deep: true
}
},
methods: {
jumpUrl() {
util.openUrl(location.origin + '/custom/tagsManage/index')
this.dialogVisible = false
},
init(item) {
this.labelGroupName = ''
this.dialogVisible = true
this.querylabeltree(item)
},
handleSearch() {
this.searchStatus = true
this.querylabeltree()
},
querylabeltree(selectItem) {
this.loading = true
this.$apis.wechatGroup
.querylabeltree({
labelTreeReq: {
pageNum: 1,
pageSize: 1000,
shopId: this.$globalState.session.merchantId,
labelGroupName: this.labelGroupName,
// labelTypesStr: '自店标签,企业标签',
edition: this.$globalState.session.merchantModel
}
})
.then(res => {
if (selectItem && selectItem.length > 0) {
this.labelTreeRets = res.labelTreeRets.map(item => {
return {
labelType: item.labelType == '企业标签' ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : item.labelType,
labelGroup: item.labelGroup,
labelList: item.labelList,
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
})
//回显
selectItem.forEach(item => {
this.labelTreeRets.forEach(tag => {
if (item.labelGroup.id == tag.labelGroup.id) {
let labelList = []
item.labelList.forEach(x => {
labelList.push(x.id)
})
this.$nextTick(() => {
tag.tagChecked = tag.labelList.filter(i => labelList.includes(i.id))
})
}
})
})
this.labelTreeRets.forEach((item, index) => {
this.$nextTick(() => {
this.handleCheckedChange(item.tagChecked, index, 1)
})
})
this.$nextTick(() => {
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets)
})
} else {
this.labelTreeRets = res.labelTreeRets.map(item => {
return {
labelType: item.labelType == '企业标签' ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : item.labelType,
labelGroup: item.labelGroup,
labelList: item.labelList,
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
})
this.labelTreeRets.forEach((item, index) => {
this.labelTreeRetSelect.forEach(itm => {
if (itm.labelGroup.id == item.labelGroup.id && itm.tagChecked.length > 0) {
let tagChecked = []
itm.tagChecked.forEach(x => {
tagChecked.push(x.id)
})
this.$nextTick(() => {
item.tagChecked = item.labelList.filter(i => tagChecked.includes(i.id))
})
this.$nextTick(() => {
this.handleCheckedChange(itm.tagChecked, index, 1)
})
}
})
})
if (this.labelTreeRetSelect.length == 0) {
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets)
}
}
this.$nextTick(() => {
this.loading = false
})
})
},
handleClose() {
this.labelTreeRetSelect = []
this.dialogVisible = false
},
remove(items, idx) {
items.tagChecked.splice(idx, 1)
this.labelTreeRets.forEach(item => {
this.labelTreeRetSelect.forEach(itm => {
if (item.labelGroup.id == itm.labelGroup.id) {
let tagChecked = []
itm.tagChecked.forEach(x => {
tagChecked.push(x.id)
})
this.$nextTick(() => {
item.tagChecked = item.labelList.filter(i => tagChecked.includes(i.id))
})
}
if (item.tagChecked.length == 0) {
this.$nextTick(() => {
item.checkAll = false
})
}
})
})
this.labelTreeRets.forEach((item, index) => {
this.$nextTick(() => {
this.handleCheckedChange(item.tagChecked, index, 1)
})
})
},
//选中
handleSelect() {
this.dialogVisible = false
let labelTreeRets = this.labelTreeRetSelect
.map(item => {
if (item.tagChecked.length) {
return {
labelGroup: item.labelGroup,
labelList: item.tagChecked
}
}
})
.filter(item => item)
console.log(labelTreeRets)
this.$emit('tagSelected', labelTreeRets)
},
//全选
handleCheckAllChange(val, index) {
if (val) {
this.labelTreeRets[index].tagChecked = []
this.labelTreeRets[index].labelList.forEach(item => {
this.labelTreeRets[index].tagChecked.push(item)
})
} else {
this.labelTreeRets[index].tagChecked = []
}
this.labelTreeRets[index].isIndeterminate = false
this.labelTreeRets.forEach(item => {
this.labelTreeRetSelect.forEach(itm => {
if (item.labelGroup.id == itm.labelGroup.id) {
itm.tagChecked = utils.deepClone(item.tagChecked)
}
})
})
},
//选中
handleCheckedChange(value, index, status) {
let checkedCount = value.length
this.labelTreeRets[index].checkAll = checkedCount === this.labelTreeRets[index].labelList.length
this.labelTreeRets[index].isIndeterminate = checkedCount > 0 && checkedCount < this.labelTreeRets[index].labelList.length
if (!status) {
this.labelTreeRets.forEach(item => {
this.labelTreeRetSelect.forEach(itm => {
if (item.labelGroup.id == itm.labelGroup.id) {
itm.tagChecked = utils.deepClone(item.tagChecked)
}
})
})
}
},
// 重置
handleReset() {
this.labelGroupName = ''
this.querylabeltree()
}
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 350
}
}
</script>
<style lang="scss" scoped>
.dialog-jump {
color: #5850ff;
float: left;
line-height: 24px;
text-decoration: underline;
cursor: pointer;
}
.tag-panel {
display: flex;
.tag-panel-select {
width: 60%;
/deep/ {
.el-checkbox__label {
width: 100%;
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: break-word;
}
}
}
.tag-panel-selected {
width: 40%;
margin-left: 10px;
.tag-box-header {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
padding-left: 20px !important;
}
}
.tag-title {
font-size: 16px;
font-weight: 400;
color: #333333;
line-height: 22px;
}
.tag-select-box {
margin-top: 10px;
border-radius: 2px;
border: 1px solid #eeeeee;
padding: 6px;
.tag-box-header {
box-sizing: border-box;
display: flex;
height: 56px;
align-items: center;
border-bottom: 1px solid #eeeeee;
margin: -6px;
margin-bottom: 10px;
padding: 0px 6px;
/deep/ {
.el-input {
width: 60%;
margin-right: 10px;
}
}
}
.tag-selected-item {
margin: 0px 6px 6px 0px;
height: 26px;
line-height: 24px;
font-size: 14px;
color: #666;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.el-tree-node__expand-icon {
color: #5850ff;
font-size: 16px;
}
.tag-group {
margin-left: 40px;
display: flex;
flex-wrap: wrap;
.radio-tag {
display: inline-block;
width: 50%;
.el-checkbox {
width: 40%;
margin-bottom: 6px;
display: flex;
align-items: center;
}
}
}
}
}
.tag-show {
color: #aaa5fa !important;
font-size: 12px;
border: none;
background: rgba(88, 80, 255, 0.1);
}
.checkbox-group-box {
overflow: auto;
}
.tag-selected-box {
// min-height: 200px;
overflow: auto;
}
</style>
<template>
<div>
<GLDialog :bigTitle="'人群筛选'" mode="big" :visible.sync="crowdVisible" v-if="crowdVisible">
<div class="member-wrapper">
<div class="member-left">
<div class="member-title">
人群列表
</div>
<div class="member-content">
<el-form :inline="true" class="member-form" :model="searchForm" @submit.native.prevent>
<el-form-item label="人群名称" style="margin-bottom: 0" size="small">
<el-input :size="size" v-model.trim="searchForm.keyword" @keyup.enter.native="search" clearable placeholder="请输入关键字搜索"></el-input>
</el-form-item>
<el-form-item label style="margin-bottom: 0;margin-left:10px" size="small">
<el-button type="primary" :size="size" @click="search">搜索</el-button>
</el-form-item>
</el-form>
<div class="table-content">
<GLTable ref="crowdTable" :tableData="tableData" @refreshTable="getCrowdList" :tableTotal="tableTotal" :layout="layout" :tableParams="crowdTableParams" :hasNum="true" :pageConf="pageConf" :noDataImg="url" @selectionTable="handleSelectionTable" @row-click="rowClick"></GLTable>
</div>
</div>
</div>
<div class="member-right">
<div class="member-title">已选</div>
<!-- <div class="member-name">人群({{ innerTags.length }}项)</div> -->
<div class="input-tag-wrapper">
<div class="tag-box">
<el-tag v-for="(tag, idx) in innerTags" :key="idx" type="info" closable :disable-transitions="false" @close="remove(tag, idx)">
{{ tag.crowdName }}
</el-tag>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button style="width: 68px;" size="small" @click="crowdVisible = false">取 消</el-button>
<el-button style="width: 68px;" size="small" type="primary" @click.native="handleConfirm">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
// import url from '@/assets/empty.png'
export default {
name: 'SelectCrowd',
data() {
return {
url: 0,
crowdVisible: false,
searchForm: { keyword: '' },
innerTags: [],
inner: [],
tableCrowdData: [
{
name: 'asda'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableData: [],
tableTotal: 0,
crowdTableParams: {
checkSelectKey: 'id',
checkSelectVal: [],
hasNum: false,
listName: 'crowdUnitList',
// 行数据的key
mutiSelectUniqueKey: 'crowdId',
// 多选ref的名称
mutiSelectName: 'crowdlist',
tableColumns: [
{
label: '人群名称',
prop: 'crowdName'
},
{
label: '人群描述',
prop: 'crowdDesc',
width: '200',
line: 1
},
{
label: '人数',
prop: 'total'
}
]
}
}
},
methods: {
init(val) {
this.inner = this.$common.utils.deepClone(val)
this.innerTags = this.$common.utils.deepClone(val)
this.crowdVisible = true
this.searchForm.keyword = ''
this.$nextTick(() => {
this.$refs.crowdTable.$refs.crowdlistMutiTable.clearSelection()
this.$refs.crowdTable.page.pageNum = 1
this.getCrowdList()
})
},
getCrowdList(page = { pageNum: 1, pageSize: 10 }) {
this.$refs.crowdTable.page = page
var params = {
req: {
keyword: this.searchForm.keyword,
merchantId: this.$globalState.session.merchantId,
crowdType: 3,
filterType: 2,
pageSize: page.pageSize,
pageNum: page.pageNum
}
}
this.$apis.wechatGroup.queryCrowdtree(params).then(res => {
this.tableData = res.crowdUnitList
this.tableTotal = res.total
// console.log(this.inner)
// console.log(this.tableData)
// this.tableData.forEach(item => {
// this.inner.forEach((itm, index) => {
// if (itm.crowdId == item.crowdId) {
// this.rowClick(item)
// }
// })
// })
this.recoverySelected()
})
},
// selectionTable(val) {
// this.innerTags = []
// for (let i = 0; i < val.length; i++) {
// const tagArr = this.innerTags.map(item => item.crowdId + '')
// console.log(tagArr)
// if (!tagArr.includes(val[i].crowdId)) {
// this.innerTags.push(val[i])
// }
// console.log(this.innerTags)
// }
// },
// 选择/取消
handleSelectionTable(val) {
var list = JSON.parse(JSON.stringify(this.innerTags))
this.innerTags = []
val.forEach(item => {
if (this.innerTags.findIndex(k => k.crowdId == item.crowdId) == '-1') {
this.innerTags.push(item)
}
})
list.forEach(item => {
if (this.tableData.findIndex(k => k.crowdId == item.crowdId) == '-1' && this.innerTags.findIndex(k => k.crowdId == item.crowdId) == '-1') {
this.innerTags.push(item)
}
})
},
// 恢复选择
addSelected() {
this.$nextTick(() => {
var list = JSON.parse(JSON.stringify(this.innerTags))
if (list && list.length) {
list.forEach(row => {
var idx = this.tableData.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[idx], true)
}
})
}
})
},
recoverySelected() {
// 翻页,去掉已选项
var selectedData = this.$refs.crowdTable.mutiSelectArr.crowdlist
var deleteList = []
this.addSelected()
if (selectedData) {
selectedData.forEach(item => {
if (this.innerTags.findIndex(subItem => subItem.crowdId == item.crowdId) == -1) {
deleteList.push(item)
}
})
this.deleteSelected(deleteList)
}
},
// 删除选中
deleteSelected(deleteList) {
this.$nextTick(() => {
deleteList.forEach(row => {
var idx = this.tableData.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[idx], false)
}
})
})
},
remove(item) {
var idx = this.innerTags.findIndex(k => k.crowdId == item.crowdId)
this.innerTags.splice(idx, 1)
if (this.tableData.map(k => k.crowdId).includes(item.crowdId)) {
var i = this.tableData.findIndex(k => k.crowdId == item.crowdId)
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[i])
}
},
rowClick(row) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(row)
},
search() {
this.getCrowdList({ pageNum: 1, pageSize: 10 })
},
handleConfirm() {
// console.log(this.innerTags)
this.$emit('crowdData', this.innerTags)
this.crowdVisible = false
this.searchForm = { keyword: {} }
}
}
}
</script>
<style lang="scss" scoped>
.member-wrapper {
display: flex;
.member-title {
font-size: 16px;
color: #333;
font-weight: 500;
line-height: 22px;
margin-bottom: 6px;
span {
display: inline-block;
padding-left: 5px;
font-size: 12px;
color: #999;
font-weight: 500;
}
}
.member-left {
width: calc(100% - 286px);
.member-content {
border: 1px solid #eee;
padding-bottom: 20px;
/deep/ {
.el-table {
// height: 40vh;
overflow-y: auto;
}
.el-pagination {
margin-top: 0;
}
}
.member-form {
padding: 10px 20px;
}
.table-content {
max-height: 480px;
overflow: auto;
border-top: 1px solid #eee;
}
}
.member-checked {
text-align: right;
margin-top: 10px;
}
}
.member-right {
width: 286px;
margin-left: 14px;
.member-name {
font-size: 14px;
color: #333;
line-height: 20px;
padding: 18px;
border: 1px solid #eee;
}
}
}
.tag-box {
height: 100%;
width: 100%;
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
border: 1px solid #eee;
border-top: none;
box-sizing: border-box;
color: #606266;
display: inline-block;
padding: 8px 10px;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
height: calc(100% - 86px);
display: flex;
align-items: center;
max-height: 500px;
overflow: auto;
// margin-bottom: 10px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
/deep/ input {
/* input { */
/* background-color: red!important; 调试用的样式 */
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
}
.el-tag {
margin-right: 10px;
line-height: 22px;
margin-bottom: 5px;
height: 24px;
background: #fafbfe !important;
}
/deep/ {
.el-dialog__title {
font-weight: 600;
}
.el-dialog__header {
padding: 20px;
}
.el-dialog__headerbtn {
height: 30px;
.el-dialog__close {
width: 24px;
height: 24px;
font-size: 24px;
}
}
.el-pagination {
padding-left: 20px;
border-top: 1px solid #e8e8ea;
padding-top: 16px;
}
.el-table:before {
display: none;
}
}
</style>
<template>
<div>
<GLDialog :mode="'big'" class="gl-form-min" bigTitle="选择门店" :visible.sync="storeDiaVisible" @close="clearStaff">
<el-form :inline="true" class="member-form" :model="searchForm" @submit.native.prevent>
<el-form-item label="门店名称:">
<el-input v-model="searchForm.storeName" :size="size" placeholder="输入关键字搜索"></el-input>
</el-form-item>
<el-form-item label="门店编号:">
<el-input v-model="searchForm.storeNum" :size="size" placeholder="输入关键字搜索"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" :size="size" class="gap8" @click="findNotActiveStaff">查询</el-button>
<el-button plain :size="size" class="btn-three" @click="resetSearch">重置</el-button>
</el-form-item>
</el-form>
<div class="member-wrapper">
<div class="member-left">
<div class="member-title">员工列表</div>
<div class="member-content">
<div class="table-content" style="max-height: 456px;">
<GLTable :hasPage="false" v-loading="loading" ref="activateTable" :tableData="tableActiveData" :tableParams="tableParams" :noDataImg="url" @selectionTable="selectionTable" @row-click="rowClick">
<div slot="openJoinStatusString" class="dot" slot-scope="scope">
<div :class="status[scope.scope.openJoinStatusString]"></div>
<span v-if="scope.scope.openJoinStatusString == '未开启'">未开启</span>
<span v-if="scope.scope.openJoinStatusString == '已开启'">已开启</span>
<span v-if="scope.scope.openJoinStatusString == '未授权'">未授权</span>
</div>
</GLTable>
</div>
</div>
</div>
<div class="member-right">
<div class="member-title">已选列表</div>
<div class="member-context">
<div class="member-name">已选({{ innerTags.length }}项)</div>
<el-button type="text" @click="clearStaff">清空</el-button>
</div>
<div class="input-tag-wrapper">
<div class="tag-box">
<el-tag v-for="tag in innerTags" :key="tag.userId" type="info" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="closeDia">取 消</el-button>
<el-button size="small" type="primary" @click="activeStaff" :loading="butLoading">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
const status = {
未开启: 'dot3',
已开启: 'dot2',
未授权: 'dot3'
}
const options = [
{
value: 0,
label: '未开启'
},
{
value: 1,
label: '已开启'
},
{
value: 2,
label: '未授权'
}
]
export default {
name: 'ActivateDia',
props: ['selectData'],
data() {
return {
url: url,
butLoading: false,
searchForm: {
storeName: '',
storeNum: ''
},
checked: '',
treeData: [],
options: options,
status,
storeDiaVisible: false,
defaultProps: {
children: 'children',
label: 'departmentName'
},
loading: false,
// 表格参数
tableParams: {
checkSelectKey: 'id',
checkSelectVal: [],
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'salelist',
tableColumns: [
{
label: '员工姓名',
prop: 'staffName'
},
{
label: '员工手机号',
prop: 'staffPhone'
},
{
label: '部门',
prop: 'departmentName'
},
{
label: '启用状态',
prop: 'openJoinStatusString',
addHtml: 'openJoinStatusString'
}
]
},
// 未激活员工表信息
tableActiveData: [],
innerTags: [],
// 账号信息
activeInfo: {}
}
},
mounted() {},
methods: {
init(row) {
this.activeInfo = row
this.storeDiaVisible = true
this.findNotActiveStaff()
},
selectionTable(val) {
this.innerTags = val
},
// 清空搜索条件
resetSearch() {
this.searchForm = {
storeName: '',
storeNum: ''
}
this.findNotActiveStaff()
},
findNotActiveStaff() {
const { corpId, merchantId } = this.activeInfo
var params = {
...JSON.parse(JSON.stringify(this.searchForm)),
corpId,
merchantId
}
this.loading = true
this.$apis.accountConfig.findNotActiveStaff(params).then(res => {
if (res.code == 0) {
this.tableActiveData = res.data
this.loading = false
} else {
this.loading = false
this.$message({
message: res.message,
type: 'error',
customClass: 'global-messageZindex'
})
}
})
},
handleNodeClick(data) {
this.searchForm.department = data.departmentName
this.currentTreeData = data
this.onHidePopover()
},
remove(item) {
this.$refs.activateTable.$refs.salelistMutiTable.toggleRowSelection(item)
},
rowClick(row) {
this.$refs.activateTable.$refs.salelistMutiTable.toggleRowSelection(row)
},
// 激活员工
activeStaff() {
if (!this.innerTags.length) {
this.$message({
message: '未选中员工,无法激活',
type: 'error',
customClass: 'global-messageZindex'
})
return
}
var userIdList = []
this.innerTags.forEach(item => {
userIdList.push(item.userId)
})
const { merchantId, corpId } = this.activeInfo
var params = {
corpId,
merchantId,
userIdList
}
this.butLoading = true
this.$apis.accountConfig.activeAccount(params).then(res => {
if (res.code == '0') {
this.butLoading = false
this.storeDiaVisible = false
var txt = '<p>已激活&nbsp;' + `${res.data ? res.data : 0}` + '&nbsp;个</p>'
this.$confirm(txt, '提示', {
confirmButtonText: '我知道了',
dangerouslyUseHTMLString: true,
showCancelButton: false,
confirmButtonClass: 'confirmbtn',
type: 'success',
customClass: 'gl-message-box confirm-btn',
callback: action => {
if (res.data && res.data > 0) {
this.$emit('activeStaff')
}
}
})
} else {
this.butLoading = false
this.$message.error(res.message)
}
})
},
// 清空右侧选择员工
clearStaff() {
this.$refs.activateTable.$refs.salelistMutiTable.clearSelection()
this.innerTags = []
},
// 关闭弹窗
closeDia() {
this.clearStaff()
this.storeDiaVisible = false
}
}
}
</script>
<style lang="scss">
.el-input.el-input--suffix.rotate .el-input__suffix .el-icon-arrow-down {
transform: rotate(-180deg);
}
.select-tree {
max-height: 400px;
overflow-y: scroll;
}
.staff-title {
position: relative;
font-size: 12px;
padding: 0 10px;
line-height: 12px;
color: #999;
&::before {
content: '';
position: absolute;
top: 50%;
left: 5px;
transform: translateY(-50%);
display: inline-block;
width: 1px;
height: 12px;
background-color: #999;
}
}
.member-wrapper {
display: flex;
.member-title {
font-size: 16px;
font-weight: 400;
line-height: 22px;
margin-bottom: 6px;
span {
display: inline-block;
padding-left: 5px;
font-size: 12px;
color: #999;
font-size: 500;
}
}
.member-left {
width: 70%;
.member-content {
border: 1px solid #eee;
.member-form {
padding: 10px 20px;
}
.table-content {
max-height: 456px;
overflow: auto;
border-top: 1px solid #eee;
}
}
.member-checked {
text-align: right;
margin-top: 10px;
}
}
.member-right {
width: 30%;
margin-left: 14px;
.member-context {
display: flex;
justify-content: space-between;
padding: 11px 8px 11px 16px;
border: 1px solid #eee;
.member-name {
font-size: 14px;
color: #333;
line-height: 20px;
}
}
}
}
.tag-box {
height: 100%;
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
border: 1px solid #eee;
border-top: none;
box-sizing: border-box;
color: #606266;
display: inline-block;
padding: 8px 10px;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
height: calc(100% - 72px);
display: flex;
align-items: center;
max-height: 500px;
overflow: auto;
// margin-bottom: 10px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
/deep/ input {
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
/deep/ .el-tag--info {
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
}
}
.el-tag {
margin-right: 10px;
line-height: 22px;
margin-bottom: 5px;
height: 24px;
}
.global-messageZindex {
z-index: 3000 !important;
}
</style>
<template>
<div>
<div class="createANewGroupBtn">
<el-button @click="addSendGroup" :size="size" type="primary" mode="el-button">
<i class="el-icon-plus"></i>
新建群发
</el-button>
</div>
<div class="container">
<GLCombiForm :formObj="searchForm" :rowNumber="1" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset">
<div slot="optionBtns">
<div class="sendRecord" @click="traceRecord">发送记录</div>
</div>
</GLCombiForm>
<GLTable ref="groupTable" :noDataImg="url" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"></GLTable>
</div>
<el-drawer size="40%" title="发送记录" :visible.sync="sendRecordDrawer.isVisible" :direction="sendRecordDrawer.direction">
<div class="horizon"></div>
<div class="sendRecordDrawerbox">
<div v-for="(item, index) in sendRecordDrawer.traceFailandSuccess" :key="index" class="itemContent">
<div>
<p class="title">{{ item.title }}</p>
<p class="num" :style="{ color: item.color }">{{ item.num }}</p>
</div>
</div>
</div>
<GLTable ref="sendRecordDrawer.ref" :noDataImg="url" :getListApi="sendRecordDrawer.getListApi" :searchForm="sendRecordDrawer.searchForm" :tableParams="sendRecordDrawer.tableParams" :pageConf="sendRecordDrawer.pageConf"></GLTable>
</el-drawer>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'collocation',
data() {
return {
url,
sendRecordDrawer: {
isVisible: false,
direction: 'rtl',
traceFailandSuccess: [
{
title: '发送成功',
id: '1',
num: 22,
color: '#2CCA74'
},
{
title: '发送失败',
id: '2',
num: 4,
color: '#EB4E4E '
}
],
ref: 'sendRecordDrawerRef',
getListApi: '',
searchForm: '',
tableParams: {
listName: 'list',
tableColumns: [
{
label: '客户',
prop: 'sendName'
},
{
label: '发送时间',
prop: 'senaStore'
},
{
label: '发送结果',
prop: 'customerNum'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
},
searchForm: {
sendName: '',
sendTime: '',
store: ''
},
searchFormData: [
{
label: '群发名称',
name: 'messagingName',
type: 'input',
isClear: true
},
{
label: '群发时间',
name: 'sendTime',
type: 'datePicker',
isClear: true
},
{
label: '群发门店',
name: 'merchantName',
type: 'input',
isClear: true
}
],
tableParams: {
listName: 'list',
tableColumns: [
{
label: '群发名称',
prop: 'messagingName'
},
{
label: '群发门店',
prop: 'messagingMerchant'
},
{
label: '客户数',
prop: 'customerCount'
},
{
label: '标签/人群',
prop: 'labelCrowdName'
},
{
label: '创建时间',
prop: 'createTime'
},
{
label: '发送状态',
prop: 'sendState'
},
{
label: '发送成功',
prop: 'successCompletion',
width: '200'
},
{
label: '发送失败',
prop: 'failCompletion',
width: '200'
},
{
label: '操作',
prop: 'optionBtns',
width: '66px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
getListApi: this.$apis.wechatGroup.batchmessagingRecord
}
},
methods: {
handleSearch() {
this.$refs.activeTable.refreshTable()
},
// 重置搜索框搜索
handleReset() {
this.searchForm = {
isBuyPermit: '',
merchantId: '',
merchantName: ''
}
this.handleSearch()
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.activeTable.data.length ? (this.$refs.activeTable.tableHeightValues = '') : this.$refs.activeTable.setTableHeightFun()
},
// 跳转新建群发
addSendGroup() {
this.$router.push('/wechatGroup/addWechatGroup')
},
traceRecord() {
this.sendRecordDrawer.isVisible = true
}
}
}
</script>
<style lang="scss" scoped>
.createANewGroupBtn {
margin-bottom: 16px;
}
.container {
padding: 20px;
background-color: #fff;
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
.header-text {
font-size: 16px;
color: #333333;
font-weight: 600;
}
}
.table-btn {
color: #5850ff;
border: 1px solid #5850ff;
}
.sendRecord {
color: #5850ff;
}
}
.horizon {
width: 100%;
height: 1px;
background: #e8e8ea;
}
.sendRecordDrawerbox {
padding: 20px;
display: flex;
justify-content: space-around;
.itemContent {
width: 334px;
padding: 8px 0 8px 20px;
border: 1px solid #e8e8ea;
}
.title {
color: #666666;
font-size: 14px;
margin-bottom: 8px;
}
.num {
font-size: 20px;
font-width: 600;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!