Commit 636c3775 by 前端

更新v3.4.0代码

1 parent 9e5157be
export default {
data() {
return {
groupNumber: 0,
viewLoading: false,
isUpdate: true,
dateOptions: {
disabledDate(time) {
let now = new Date()
now.setTime(now.getTime() - 3600 * 1000 * 24)
return time.getTime() < now
}
},
timeOptions: {
selectableRange: '00:00:00 - 23:59:59'
},
}
},
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 = []
this.$refs.selectLabel.labelTreeRetSelect = []
}
}
},
methods: {
// 选择客户change事件
radioChange(val) {
this.isSelectCrowd = false
this.isUpdate = true
this.tagging = []
this.taggingList = []
},
// 打开标签筛选
openLabel(merchant) {
if (!this.basicForm[merchant]) {
this.$message({
type: 'error',
message: '请先选择门店'
})
return
}
this.dialogVisible = !this.dialogVisible
this.$refs.selectLabel.init(this.tagging)
},
selectChange(val) {
// 选择门店时,替换欢迎语组件当中的所有merchantId
this.btnList.forEach(item => {
if (item.params && item.params.hasOwnProperty('merchant')) {
item.params.merchant = val
}
if (item.funParams && Object.prototype.toString.call(item.funParams) === '[object Array]') {
item.funParams.forEach(funArr => {
if (funArr.params && funArr.params.hasOwnProperty('merchantId')) {
funArr.params.merchantId = val
}
if (funArr.merchantOpen && funArr.merchantOpen.params && funArr.merchantOpen.params.hasOwnProperty('merchantId')) {
funArr.merchantOpen.params.merchantId = val
}
})
}
})
this.tagging = []
this.taggingList = []
this.basicForm.crowdList = []
this.$refs.selectLabel.labelTreeRetSelect = []
this.isUpdate = true
this.resetMerchantId = val
this.msgMerchantName = val && this.dataItems.find(item => item.msgMerchantId == val).msgMerchantName
},
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) {
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
},
// 查看群发人数
viewMembers() {
if (this.basicForm.selectType == '1' && !this.taggingList.length) {
return this.$message({
type: 'error',
message: '请选择标签'
})
}
if (this.basicForm.selectType == 2 && !this.basicForm.crowdList.length) {
return this.$message({
type: 'error',
message: '请选择人群'
})
}
const params = this.getBaseInfo()
this.viewLoading = true
this.$apis.wechatGroup
.batchmessagingCustomercount(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
})
},
getBaseInfo() {
let params = {
customerType: this.basicForm.selectType,
msgName: this.basicForm.groupName,
msgMerchantId: this.basicForm.selectStore,
msgMerchantName: this.msgMerchantName
}
const combineType = {
label: 2,
crowd: 1
}
if (params.customerType == 1) {
params.combineType = combineType.label
params.labelList = this.taggingList
} else if (params.customerType == 2) {
params.crowdList = this.basicForm.crowdList
params.combineType = combineType.crowd
}
return params
},
// 人群筛选弹窗
selectCrowd(merchant) {
if (!this.basicForm[merchant]) {
this.$message({
type: 'error',
message: '请先选择门店'
})
return
}
this.$refs.selectCrowd.init(this.basicForm.crowdList)
},
// 获取人群数据(根据人群筛选获取群发账号人群数据)
getCrowdData(val) {
this.isUpdate = true
if (val.length) {
this.isSelectCrowd = true
this.basicForm.crowdList = val
} else {
this.basicForm.userList = []
this.basicForm.crowdList = []
this.selectData = []
this.isSelectCrowd = false
this.editStatus = true
this.key = new Date()
}
},
// 删除人群筛选标签
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()
},
}
}
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
</el-form-item> </el-form-item>
<el-form-item prop="taskMerchantId" label="选择门店:" size="small"> <el-form-item prop="taskMerchantId" label="选择门店:" size="small">
<el-select filterable v-model="basicForm.taskMerchantId" placeholder="请选择门店"> <el-select filterable v-model="basicForm.taskMerchantId" placeholder="请选择门店">
<el-option v-for="item in optionsMe" :key="item.msgMerchantId" :label="item.msgMerchantName" :value="item.msgMerchantId"></el-option> <el-option v-for="item in optionsMe" :key="item.msgMerchantId" :label="item.msgMerchantName"
:value="item.msgMerchantId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="userList"> <el-form-item prop="userList">
...@@ -21,7 +22,8 @@ ...@@ -21,7 +22,8 @@
</el-button> </el-button>
<div class="sale-select" v-show="basicForm.userList && basicForm.userList.length != 0"> <div class="sale-select" v-show="basicForm.userList && basicForm.userList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper"> <div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag effect="plain" type="info" v-for="(tag, idx) in basicForm.userList" :key="idx" closable :disable-transitions="false" @close="remove(tag, idx)"> <el-tag effect="plain" type="info" v-for="(tag, idx) in basicForm.userList" :key="idx" closable
:disable-transitions="false" @close="remove(tag, idx)">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
{{ tag.staffName }} {{ tag.staffName }}
</el-tag> </el-tag>
...@@ -29,22 +31,93 @@ ...@@ -29,22 +31,93 @@
</div> </div>
<div v-show="empErrorShow" class="el-form-item__error">请选择员工</div> <div v-show="empErrorShow" class="el-form-item__error">请选择员工</div>
</el-form-item> </el-form-item>
<el-form-item label="选择客户:" prop="selectType">
<el-radio-group @change="radioChange" v-model="basicForm.selectType">
<el-radio :label="0">全部客户</el-radio>
<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('taskMerchantId')">
<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('taskMerchantId')">
{{ 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" v-show="basicForm.selectType !== 0">
<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-item prop="attachmentList" class="attachment-panel"> <el-form-item prop="attachmentList" class="attachment-panel">
<label slot="label" class="required">朋友圈内容:</label> <label slot="label" class="required">朋友圈内容:</label>
<GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor> <GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
<div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div> <div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div>
</el-form-item> </el-form-item>
<el-form-item label="发送时间:" prop="sendType">
<el-radio-group v-model="basicForm.sendType">
<el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio>
</el-radio-group>
<div v-show="basicForm.sendType == 2" class="date-picker">
<el-date-picker v-model="basicForm.sendTime" size="small" type="date" value-format="yyyy-MM-dd"
placeholder="选择日期" :picker-options="dateOptions"
@change="changeValue"></el-date-picker>
-
<el-time-picker v-model="basicForm.sendDate" size="small" value-format="HH:mm:ss" placeholder="选择时间"
:picker-options="timeOptions"></el-time-picker>
</div>
</el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
<GLDialog bigTitle="选择成员" mode="big" :visible.sync="membersVisible" @onOk="handleConfirm" @onCancel="membersVisible = !membersVisible"> <GLDialog bigTitle="选择成员" mode="big" :visible.sync="membersVisible" @onOk="handleConfirm"
<SelectMember ref="membersForm" v-if="membersVisible" :selectData="selectData" :taskMerchantId="basicForm.taskMerchantId"></SelectMember> @onCancel="membersVisible = !membersVisible">
<SelectMember ref="membersForm" v-if="membersVisible" :selectData="selectData"
:taskMerchantId="basicForm.taskMerchantId"></SelectMember>
</GLDialog> </GLDialog>
</div> </div>
<GLFooter> <GLFooter>
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button type="primary" v-loading="addLoading" @click="handleSubmit">提交</el-button> <el-button type="primary" v-loading="addLoading" @click="handleSubmit">提交</el-button>
</GLFooter> </GLFooter>
<SelectLabel ref="selectLabel" @tagSelected="handleSelect" :resetMerchantId="resetMerchantId"
:dialogVisible="dialogVisible"></SelectLabel>
<SelectCrowd ref="selectCrowd" @crowdData="getCrowdData" :resetMerchantId="resetMerchantId"
:selectCrowdData="basicForm.crowdList"></SelectCrowd>
</div> </div>
</template> </template>
...@@ -58,16 +131,39 @@ const ATT_TYPE = { ...@@ -58,16 +131,39 @@ const ATT_TYPE = {
FILE: 6, FILE: 6,
ACTIVITY: 7 ACTIVITY: 7
} }
import { utils } from 'glsx-common' import {utils} from 'glsx-common'
import department from '@/mixins/department' import department from '@/mixins/department'
import marketingGroup from '@/mixins/marketingGroup'
import SelectMember from './components/selectMember.vue' import SelectMember from './components/selectMember.vue'
import SelectCrowd from '@/components/selectCrowd/selectCrowd'
import SelectLabel from '@/components/SelectLabel/SelectLabel'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
export default { export default {
mixins: [department], mixins: [department, marketingGroup],
components: { components: {
SelectMember SelectMember,
SelectLabel,
SelectCrowd
}, },
data() { data() {
const validatorSendType = (rule, value, callback) => {
if (value) {
if (value == 2) {
if (!this.basicForm.sendTime) {
callback(new Error('请选择日期'))
}
if (!this.basicForm.sendDate) {
callback(new Error('请选择时间'))
}
if (this.basicForm.sendTime && this.basicForm.sendDate) {
callback()
}
} else {
callback()
}
}
}
return { return {
optionsMe: [], optionsMe: [],
addLoading: false, addLoading: false,
...@@ -115,43 +211,40 @@ export default { ...@@ -115,43 +211,40 @@ export default {
// templateDetailApi: this.$apis.welcomeword.templateDetail // templateDetailApi: this.$apis.welcomeword.templateDetail
// } // }
], ],
dialogVisible: false,
basicForm: { basicForm: {
userList: [], userList: [],
taskName: '', taskName: '',
taskMerchantId: '' taskMerchantId: '',
sendType: 1,
sendTime: '',
sendDate: '',
selectType: 1,
crowdList: []
}, },
attachmentShow: false, attachmentShow: false,
empErrorShow: false, empErrorShow: false,
attachmentText: '请输入朋友圈内容', attachmentText: '请输入朋友圈内容',
basicRules: { basicRules: {
taskMerchantId: [{ required: true, message: '请选择门店', trigger: 'change' }], taskMerchantId: [{required: true, message: '请选择门店', trigger: 'change'}],
taskName: [{ required: true, message: '请输入群发名称', trigger: 'blur' }] taskName: [{required: true, message: '请输入群发名称', trigger: 'blur'}],
sendType: [
{required: true, message: '请选择发送时间', trigger: 'change'},
{validator: validatorSendType, trigger: 'change'}
]
}, },
membersVisible: false, membersVisible: false,
groupList: [], groupList: [],
key: new Date(), key: new Date(),
dialogVisible: false,
previewFlag: false, previewFlag: false,
selectData: [], selectData: [],
// 是否有修改筛选成员 // 是否有修改筛选成员
isUpdate: true, // isUpdate: true,
tagging: [], tagging: [],
groupNumber: 0,
dateOptions: {
disabledDate(time) {
let now = new Date()
now.setTime(now.getTime() - 3600 * 1000 * 24)
return time.getTime() < now
}
},
timeOptions: {
selectableRange: '00:00:00 - 23:59:59'
},
editStatus: false, editStatus: false,
firstFlag: true, firstFlag: true,
footerLeft: 40, footerLeft: 40,
footerWidth: 500, footerWidth: 500,
viewLoading: false
} }
}, },
watch: { watch: {
...@@ -170,35 +263,10 @@ export default { ...@@ -170,35 +263,10 @@ export default {
} }
}, },
async mounted() { async mounted() {
console.log(this.size)
// this.SET_TOKEN(888)
const merchantList = await this.merchantList() const merchantList = await this.merchantList()
this.optionsMe = merchantList ? merchantList : [] this.optionsMe = merchantList ? merchantList : []
}, },
methods: { methods: {
// uploadFile(e) {
// const files = e.target.files
// var formData = new FormData()
// formData.append('file', files[0])
// // formData.append('picWidth', 1080)
// // formData.append('picHeight', 1920)
// // fetch('http://192.168.1.170:8086/rpc-scrm-entmicro-container/picture/compression/upload', {
// // method: 'post',
// // body: formData
// // })
// // window
// // .axios({
// // url: 'http://192.168.3.101:8186/rpc-scrm-entmicro-container/file/upload',
// // method: 'post',
// // data: formData
// // })
// // .then(res => {
// // console.log(res)
// // })
// this.$apis.friendGroup.compressionUpload({ file: files[0] }).then(res => {
// console.log(res)
// })
// },
previewForm(val) { previewForm(val) {
this.previewView = val this.previewView = val
this.attachmentShow = false this.attachmentShow = false
...@@ -216,14 +284,14 @@ export default { ...@@ -216,14 +284,14 @@ export default {
.then(() => { .then(() => {
this.$router.push('/friendGroup/index') this.$router.push('/friendGroup/index')
}) })
.catch(() => {}) .catch(() => {
})
} else { } else {
this.$router.push('/friendGroup/index') this.$router.push('/friendGroup/index')
} }
}, },
// 成员弹窗 // 成员弹窗
handleConfirm() { handleConfirm() {
console.log(this.$refs.membersForm.innerTags)
if (this.$refs.membersForm.innerTags.length) { if (this.$refs.membersForm.innerTags.length) {
// this.basicForm.userList = this.$refs.membersForm.innerTags // this.basicForm.userList = this.$refs.membersForm.innerTags
this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags) this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags)
...@@ -250,7 +318,7 @@ export default { ...@@ -250,7 +318,7 @@ export default {
} }
this.isUpdate = true this.isUpdate = true
}, },
handleSubmit: utils.debounce(function() { handleSubmit: utils.debounce(function () {
this.$refs.groupForm.validate(valid => { this.$refs.groupForm.validate(valid => {
if (valid) { if (valid) {
if (this.basicForm.userList.length == 0) { if (this.basicForm.userList.length == 0) {
...@@ -288,7 +356,7 @@ export default { ...@@ -288,7 +356,7 @@ export default {
if (material.length > 1) { if (material.length > 1) {
materialType = 2 materialType = 2
} }
const { taskName, taskMerchantId } = this.basicForm const {taskName, taskMerchantId, sendType} = this.basicForm
const taskMerchantName = this.optionsMe.find(item => item.msgMerchantId == taskMerchantId).msgMerchantName const taskMerchantName = this.optionsMe.find(item => item.msgMerchantId == taskMerchantId).msgMerchantName
let params = { let params = {
materialType, materialType,
...@@ -296,7 +364,11 @@ export default { ...@@ -296,7 +364,11 @@ export default {
staffIds, staffIds,
taskName, taskName,
taskMerchantName, taskMerchantName,
taskMerchantId taskMerchantId,
sendType
}
if (params.sendType == 2) {
params.sendTimeStr = this.basicForm.sendTime + ' ' + this.basicForm.sendDate
} }
this.addLoading = true this.addLoading = true
this.$apis.friendGroup.batchmomentSave(params).then(res => { this.$apis.friendGroup.batchmomentSave(params).then(res => {
...@@ -328,6 +400,7 @@ export default { ...@@ -328,6 +400,7 @@ export default {
color: #333; color: #333;
font-weight: 600; font-weight: 600;
border-bottom: 1px solid #d8d8d8; border-bottom: 1px solid #d8d8d8;
> span { > span {
font-size: 14px; font-size: 14px;
color: #999999; color: #999999;
...@@ -335,12 +408,14 @@ export default { ...@@ -335,12 +408,14 @@ export default {
font-weight: 100; font-weight: 100;
} }
} }
.attachment-panel { .attachment-panel {
/deep/ .btn-group-panel { /deep/ .btn-group-panel {
height: 40px; height: 40px;
padding: 0px 0px 0px 20px; padding: 0px 0px 0px 20px;
} }
} }
.tips-text { .tips-text {
display: flex; display: flex;
// align-items: center; // align-items: center;
...@@ -357,12 +432,14 @@ export default { ...@@ -357,12 +432,14 @@ export default {
max-width: 844px; max-width: 844px;
width: auto; width: auto;
box-sizing: border-box; box-sizing: border-box;
.tips-icon { .tips-icon {
width: 14px; width: 14px;
height: 14px; height: 14px;
margin: 6px 8px 0 0; margin: 6px 8px 0 0;
} }
} }
.info-box { .info-box {
.basic-form { .basic-form {
padding: 32px 0 20px 20px; padding: 32px 0 20px 20px;
...@@ -373,22 +450,27 @@ export default { ...@@ -373,22 +450,27 @@ export default {
font-size: 12px; font-size: 12px;
color: #999; color: #999;
} }
.preview { .preview {
margin-right: 24px; margin-right: 24px;
margin-bottom: 100px; margin-bottom: 100px;
} }
} }
.label-text { .label-text {
margin-left: 10px; margin-left: 10px;
font-size: 14px; font-size: 14px;
span { span {
color: #5850ff; color: #5850ff;
} }
} }
.sale-select { .sale-select {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.input-tag-wrapper { .input-tag-wrapper {
max-height: 75px; max-height: 75px;
overflow: auto; overflow: auto;
...@@ -410,12 +492,14 @@ export default { ...@@ -410,12 +492,14 @@ export default {
align-items: center; align-items: center;
margin-top: 6px; margin-top: 6px;
font-size: 14px; font-size: 14px;
i { i {
color: #75acff; color: #75acff;
margin-right: 3px; margin-right: 3px;
font-size: 14px; font-size: 14px;
} }
} }
.el-tag { .el-tag {
margin-right: 4px; margin-right: 4px;
height: 26px; height: 26px;
...@@ -423,6 +507,7 @@ export default { ...@@ -423,6 +507,7 @@ export default {
margin-bottom: 5px; margin-bottom: 5px;
// background: #fff !important; // background: #fff !important;
} }
.tag-input { .tag-input {
background: transparent; background: transparent;
border: none !important; border: none !important;
...@@ -432,38 +517,70 @@ export default { ...@@ -432,38 +517,70 @@ export default {
padding-left: 0; padding-left: 0;
width: 100px; width: 100px;
} }
.form-error { .form-error {
color: #f56c6c; color: #f56c6c;
font-size: 12px; font-size: 12px;
margin-left: 186px; margin-left: 186px;
margin-top: 10px; margin-top: 10px;
} }
/deep/ { /deep/ {
.el-form-item .el-form-item { .el-form-item .el-form-item {
margin-bottom: 22px; margin-bottom: 22px;
} }
.required { .required {
display: inline-block; display: inline-block;
line-height: 40px; line-height: 40px;
} }
.required::before { .required::before {
content: '*'; content: '*';
color: #f56c6c; color: #f56c6c;
margin-right: 4 px; margin-right: 4px;
} }
.el-loading-spinner { .el-loading-spinner {
transform: translateY(8px); transform: translateY(8px);
} }
.el-scrollbar { .el-scrollbar {
padding-bottom: 10px; padding-bottom: 10px;
} }
.welcome-box { .welcome-box {
min-width: 488px; min-width: 488px;
max-width: 844px; max-width: 844px;
width: auto !important; width: auto !important;
} }
} }
.group-content { .group-content {
padding: 22px 0 20px; padding: 22px 0 20px;
} }
.crowd-tips {
color: #999999;
font-size: 12px;
line-height: 16px;
}
.filter-footer {
display: flex;
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;
}
}
}
</style> </style>
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<div class="marketing pro-group"> <div class="marketing pro-group">
<div class="m-b-20 friend-title"> <div class="m-b-20 friend-title">
<div> <div>
<GLButton :size="size" class="el-icon-plus" type="primary" fn="新建朋友圈群发" @click="handleEdit(1)">新建朋友圈群发</GLButton> <!-- <GLButton :size="size" class="el-icon-plus" type="primary" fn="新建朋友圈群发" @click="handleEdit(1)">新建朋友圈群发</GLButton>-->
<!-- <el-button :size="size" type="primary" class="el-icon-plus" fn="新建朋友圈群发" @click="handleEdit(1)">新建朋友圈群发</el-button> --> <el-button :size="size" type="primary" class="el-icon-plus" fn="新建朋友圈群发" @click="handleEdit(1)">新建朋友圈群发</el-button>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
<el-input size="small" v-model="basicForm.groupName" placeholder="请输入群发名称"></el-input> <el-input size="small" v-model="basicForm.groupName" placeholder="请输入群发名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="选择门店:" prop="selectStore" class="settingSelect"> <el-form-item label="选择门店:" prop="selectStore" class="settingSelect">
<!-- <SearchDropDown :label="'msgMerchantName'" :value="'msgMerchantId'"></SearchDropDown>--> <el-select ref="selectLabel" clearable filterable v-model="basicForm.selectStore"
<el-select ref="selectLabel" clearable filterable v-model="basicForm.selectStore" placeholder="请选择门店" @change="selectChange"> placeholder="请选择门店" @change="selectChange">
<el-option v-for="(item, i) in dataItems" :key="i" :label="item.msgMerchantName" :value="item.msgMerchantId"></el-option> <el-option v-for="(item, i) in dataItems" :key="i" :label="item.msgMerchantName"
:value="item.msgMerchantId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="选择客户:" prop="selectType"> <el-form-item label="选择客户:" prop="selectType">
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
</el-radio-group> </el-radio-group>
<div v-show="basicForm.selectType == 1"> <div v-show="basicForm.selectType == 1">
<div class="selectedLabel"> <div class="selectedLabel">
<el-button size="small" @click="openLabel"> <el-button size="small" @click="openLabel('selectStore')">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
选择标签 选择标签
</el-button> </el-button>
...@@ -34,17 +35,21 @@ ...@@ -34,17 +35,21 @@
</div> </div>
<div v-show="tagging.length != 0" :key="key" class="el-input-tag input-tag-wrapper"> <div v-show="tagging.length != 0" :key="key" class="el-input-tag input-tag-wrapper">
<span v-for="(tag, idx) in tagging" :key="idx"> <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> <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> </span>
</div> </div>
</div> </div>
<div v-show="basicForm.selectType == 2" style="line-height: 32px; padding-bottom: 10px"> <div v-show="basicForm.selectType == 2" style="line-height: 32px; padding-bottom: 10px">
<el-button :size="size" icon="el-icon-plus" @click="selectCrowd"> <el-button :size="size" icon="el-icon-plus" @click="selectCrowd('selectStore')">
{{ isSelectCrowd ? '继续选择' : '选择人群' }} {{ isSelectCrowd ? '继续选择' : '选择人群' }}
</el-button> </el-button>
<div class="sale-select" v-show="basicForm.crowdList && basicForm.crowdList.length != 0"> <div class="sale-select" v-show="basicForm.crowdList && basicForm.crowdList.length != 0">
<div class="el-input-tag input-tag-wrapper"> <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)"> <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 }} {{ t.crowdName }}
</el-tag> </el-tag>
</div> </div>
...@@ -56,7 +61,8 @@ ...@@ -56,7 +61,8 @@
<div class="filter-footer"> <div class="filter-footer">
<div class="filter-number"> <div class="filter-number">
预计群发人数 预计群发人数
<el-button type="text" v-show="isUpdate" :loading="viewLoading" @click="viewMembers">查看</el-button> <el-button type="text" v-show="isUpdate" :loading="viewLoading" @click="viewMembers">查看
</el-button>
<span v-show="!isUpdate">{{ groupNumber }}</span> <span v-show="!isUpdate">{{ groupNumber }}</span>
</div> </div>
</div> </div>
...@@ -70,6 +76,21 @@ ...@@ -70,6 +76,21 @@
<GLEditor ref="welcome" :form="'customer'" style="line-height: 12px;" :btnList="btnList"></GLEditor> <GLEditor ref="welcome" :form="'customer'" style="line-height: 12px;" :btnList="btnList"></GLEditor>
<div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div> <div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div>
</el-form-item> </el-form-item>
<el-form-item label="发送时间:" prop="sendType">
<el-radio-group v-model="basicForm.sendType">
<el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio>
</el-radio-group>
<div v-show="basicForm.sendType == 2" class="date-picker">
<el-date-picker v-model="basicForm.sendTime" size="small" type="date" value-format="yyyy-MM-dd"
placeholder="选择日期" :picker-options="dateOptions"
@change="changeValue"></el-date-picker>
-
<el-time-picker v-model="basicForm.sendDate" size="small" value-format="HH:mm:ss"
placeholder="选择时间"
:picker-options="timeOptions"></el-time-picker>
</div>
</el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
...@@ -80,25 +101,32 @@ ...@@ -80,25 +101,32 @@
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button type="primary" v-loading="addLoading" @click="handleSubmit">提交</el-button> <el-button type="primary" v-loading="addLoading" @click="handleSubmit">提交</el-button>
</GLFooter> </GLFooter>
<SelectLabel ref="selectLabel" @tagSelected="handleSelect" :resetMerchantId="resetMerchantId" :dialogVisible="dialogVisible"></SelectLabel>
<SelectCrowd ref="selectCrowd" @crowdData="getCrowdData" :resetMerchantId="resetMerchantId" :selectCrowdData="basicForm.crowdList"></SelectCrowd> <SelectLabel ref="selectLabel" @tagSelected="handleSelect" :resetMerchantId="resetMerchantId"
:dialogVisible="dialogVisible"></SelectLabel>
<SelectCrowd ref="selectCrowd" @crowdData="getCrowdData" :resetMerchantId="resetMerchantId"
:selectCrowdData="basicForm.crowdList"></SelectCrowd>
</div> </div>
</template> </template>
<script> <script>
import department from "@/mixins/department";
const combineType = { const combineType = {
label: 2, label: 2,
crowd: 1 crowd: 1
} }
import emoji from '@/utils/emo' import emoji from '@/utils/emo'
import SelectCrowd from './components/selectCrowd.vue' import SelectCrowd from '@/components/selectCrowd/selectCrowd'
import SelectLabel from './components/SelectLabel.vue' import SelectLabel from '@/components/SelectLabel/SelectLabel'
import marketingGroup from '@/mixins/marketingGroup'
// import SearchDropDown from './components/searchDropDown/index' // import SearchDropDown from './components/searchDropDown/index'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
export default { export default {
mixins: [marketingGroup],
components: { components: {
SelectLabel, SelectLabel,
SelectCrowd SelectCrowd
// SearchDropDown
}, },
data() { data() {
return { return {
...@@ -218,9 +246,9 @@ export default { ...@@ -218,9 +246,9 @@ export default {
attachmentShow: false, attachmentShow: false,
attachmentText: '', attachmentText: '',
basicRules: { basicRules: {
groupName: [{ required: true, message: '请输入群发名称', trigger: 'blur' }], groupName: [{required: true, message: '请输入群发名称', trigger: 'blur'}],
selectStore: [{ required: true, message: '请选择门店', trigger: 'change' }], selectStore: [{required: true, message: '请选择门店', trigger: 'change'}],
selectType: [{ required: true, message: '请选择客户类型', trigger: 'change' }] selectType: [{required: true, message: '请选择客户类型', trigger: 'change'}]
}, },
basicForm: { basicForm: {
groupName: '', groupName: '',
...@@ -240,11 +268,6 @@ export default { ...@@ -240,11 +268,6 @@ export default {
footerWidth: 500, footerWidth: 500,
viewLoading: false, viewLoading: false,
isSelectCrowd: false, isSelectCrowd: false,
pageData: {
//懒加载相关参数,这里代表从第一条数据开始加载,一次加载40项
pageNum: 1,
pageSize: 40
},
dataItems: [] dataItems: []
} }
}, },
...@@ -276,7 +299,6 @@ export default { ...@@ -276,7 +299,6 @@ export default {
this.loadUpData() this.loadUpData()
}, },
methods: { methods: {
async loadUpData() { async loadUpData() {
const params = { const params = {
pageNum: 1, pageNum: 1,
...@@ -286,31 +308,6 @@ export default { ...@@ -286,31 +308,6 @@ export default {
this.dataItems = res || [] this.dataItems = res || []
}) })
}, },
selectChange(val) {
// 选择门店时,替换欢迎语组件当中的所有merchantId
this.btnList.forEach(item => {
if (item.params && item.params.hasOwnProperty('merchant')) {
item.params.merchant = val
}
if (item.funParams && Object.prototype.toString.call(item.funParams) === '[object Array]') {
item.funParams.forEach(funArr => {
if (funArr.params && funArr.params.hasOwnProperty('merchantId')) {
funArr.params.merchantId = val
}
if (funArr.merchantOpen && funArr.merchantOpen.params && funArr.merchantOpen.params.hasOwnProperty('merchantId')) {
funArr.merchantOpen.params.merchantId = val
}
})
}
})
this.tagging = []
this.taggingList = []
this.basicForm.crowdList = []
this.$refs.selectLabel.labelTreeRetSelect = []
this.isUpdate = true
this.resetMerchantId = val
this.msgMerchantName = val && this.dataItems.find(item => item.msgMerchantId == val).msgMerchantName
},
// 返回 // 返回
handleCancel() { handleCancel() {
if (this.editStatus || this.$refs.welcome.previewList.length > 0) { if (this.editStatus || this.$refs.welcome.previewList.length > 0) {
...@@ -322,23 +319,12 @@ export default { ...@@ -322,23 +319,12 @@ export default {
.then(() => { .then(() => {
this.$router.push('/wechatGroup/index') this.$router.push('/wechatGroup/index')
}) })
.catch(() => {}) .catch(() => {
})
} else { } else {
this.$router.push('/wechatGroup/index') 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)
},
// 提交 // 提交
async handleSubmit() { async handleSubmit() {
const params = this.getBaseInfo() const params = this.getBaseInfo()
...@@ -395,12 +381,15 @@ export default { ...@@ -395,12 +381,15 @@ export default {
if (v) { if (v) {
const params = this.getBaseInfo() const params = this.getBaseInfo()
params.type = 1 params.type = 1
if (params.sendType == 2) {
params.sendTimeStr = this.basicForm.sendTime + ' ' + this.basicForm.sendDate
}
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
const contentList = previewList.map(item => { const contentList = previewList.map(item => {
if (item.attType == 1) { if (item.attType == 1) {
const list = emoji.flat(Infinity) const list = emoji.flat(Infinity)
const cutImg = item.attContent.replaceAll('<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/', '') 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) { const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1] let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]` return `[${s}]`
}) })
...@@ -437,139 +426,6 @@ export default { ...@@ -437,139 +426,6 @@ export default {
} }
}) })
}, },
// 选择标签
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) {
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()
},
getBaseInfo() {
let params = {
customerType: this.basicForm.selectType,
msgName: this.basicForm.groupName,
msgMerchantId: this.basicForm.selectStore,
msgMerchantName: this.msgMerchantName
}
if (params.customerType == 1) {
params.combineType = combineType.label
params.labelList = this.taggingList
} else if (params.customerType == 2) {
params.crowdList = this.basicForm.crowdList
params.combineType = combineType.crowd
}
return params
},
// 查看群发人数
viewMembers() {
if (this.basicForm.selectType == '1' && !this.taggingList.length) {
return this.$message({
type: 'error',
message: '请选择标签'
})
}
if (this.basicForm.selectType == 2 && !this.basicForm.crowdList.length) {
return this.$message({
type: 'error',
message: '请选择人群'
})
}
const params = this.getBaseInfo()
this.viewLoading = true
this.$apis.wechatGroup
.batchmessagingCustomercount(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) {
this.isUpdate = true
if (val.length) {
this.isSelectCrowd = true
this.basicForm.crowdList = val
} else {
this.basicForm.userList = []
this.basicForm.crowdList = []
this.selectData = []
this.isSelectCrowd = false
this.editStatus = true
this.key = new Date()
}
}
} }
} }
</script> </script>
...@@ -586,12 +442,14 @@ export default { ...@@ -586,12 +442,14 @@ export default {
font-weight: 600; font-weight: 600;
border-bottom: 1px solid #d8d8d8; border-bottom: 1px solid #d8d8d8;
} }
.info-box { .info-box {
display: inline-flex; display: inline-flex;
width: 100%; width: 100%;
padding-bottom: 30px; padding-bottom: 30px;
align-items: flex-end; align-items: flex-end;
justify-content: space-between; justify-content: space-between;
.info-content { .info-content {
// width: calc(100% - 360px); // width: calc(100% - 360px);
width: 66%; width: 66%;
...@@ -618,6 +476,7 @@ export default { ...@@ -618,6 +476,7 @@ export default {
align-items: center; align-items: center;
color: #999; color: #999;
font-size: 14px; font-size: 14px;
.filter-number { .filter-number {
display: inline-block; display: inline-block;
line-height: 20px; line-height: 20px;
...@@ -625,25 +484,31 @@ export default { ...@@ -625,25 +484,31 @@ export default {
background-color: #e6e9ff; background-color: #e6e9ff;
color: #333; color: #333;
margin-top: 8px; margin-top: 8px;
span { span {
color: #5850ff; color: #5850ff;
cursor: pointer; cursor: pointer;
} }
} }
} }
.basic-form { .basic-form {
padding: 32px 0 20px 20px; padding: 32px 0 20px 20px;
.settingSelect { .settingSelect {
/deep/ input { /deep/ input {
height: 35px; height: 35px;
} }
} }
.selectedLabel { .selectedLabel {
display: flex; display: flex;
.selectLen { .selectLen {
margin-left: 20px; margin-left: 20px;
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
.num { .num {
color: #5850ff; color: #5850ff;
} }
...@@ -652,16 +517,19 @@ export default { ...@@ -652,16 +517,19 @@ export default {
} }
} }
} }
.form-tips { .form-tips {
font-size: 12px; font-size: 12px;
color: #999; color: #999;
} }
.preview { .preview {
flex: 1; flex: 1;
margin-right: 24px; margin-right: 24px;
margin-bottom: 58px; margin-bottom: 58px;
} }
} }
.footer-panel { .footer-panel {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -673,18 +541,22 @@ export default { ...@@ -673,18 +541,22 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
.label-text { .label-text {
margin-left: 10px; margin-left: 10px;
font-size: 14px; font-size: 14px;
span { span {
color: #5850ff; color: #5850ff;
} }
} }
.sale-select { .sale-select {
display: flex; display: flex;
align-items: center; align-items: center;
// width: 50%; // width: 50%;
} }
.input-tag-wrapper { .input-tag-wrapper {
max-height: 75px; max-height: 75px;
min-width: 488px; min-width: 488px;
...@@ -709,12 +581,14 @@ export default { ...@@ -709,12 +581,14 @@ export default {
align-items: center; align-items: center;
margin-top: 6px; margin-top: 6px;
font-size: 14px; font-size: 14px;
i { i {
color: #75acff; color: #75acff;
margin-right: 3px; margin-right: 3px;
font-size: 14px; font-size: 14px;
} }
} }
.el-tag { .el-tag {
margin-right: 4px; margin-right: 4px;
height: 26px; height: 26px;
...@@ -722,6 +596,7 @@ export default { ...@@ -722,6 +596,7 @@ export default {
margin-bottom: 6px; margin-bottom: 6px;
// background: #fff !important; // background: #fff !important;
} }
.tag-input { .tag-input {
background: transparent; background: transparent;
border: none !important; border: none !important;
...@@ -731,12 +606,14 @@ export default { ...@@ -731,12 +606,14 @@ export default {
padding-left: 0; padding-left: 0;
width: 100px; width: 100px;
} }
.form-error { .form-error {
color: #f56c6c; color: #f56c6c;
font-size: 12px; font-size: 12px;
margin-left: 186px; margin-left: 186px;
margin-top: 10px; margin-top: 10px;
} }
/deep/ { /deep/ {
//.el-form-item .el-form-item { //.el-form-item .el-form-item {
// margin-bottom: 22px; // margin-bottom: 22px;
...@@ -745,26 +622,32 @@ export default { ...@@ -745,26 +622,32 @@ export default {
display: inline-block; display: inline-block;
line-height: 40px; line-height: 40px;
} }
.required::before { .required::before {
content: '*'; content: '*';
color: #f56c6c; color: #f56c6c;
margin-right: 4px; margin-right: 4px;
} }
.el-loading-spinner { .el-loading-spinner {
transform: translateY(8px); transform: translateY(8px);
} }
.el-scrollbar { .el-scrollbar {
padding-bottom: 10px; padding-bottom: 10px;
} }
.gl-form-page .el-form .welcome-box { .gl-form-page .el-form .welcome-box {
min-width: 488px; min-width: 488px;
max-width: 844px; max-width: 844px;
width: auto; width: auto;
} }
} }
.group-content { .group-content {
padding: 0 0 20px 0; padding: 0 0 20px 0;
} }
.tips-text { .tips-text {
font-size: 12px; font-size: 12px;
color: #f56c6c; color: #f56c6c;
...@@ -772,18 +655,22 @@ export default { ...@@ -772,18 +655,22 @@ export default {
line-height: 20px; line-height: 20px;
padding-bottom: 4px; padding-bottom: 4px;
} }
.crowd-tips { .crowd-tips {
color: #999999; color: #999999;
font-size: 12px; font-size: 12px;
line-height: 16px; line-height: 16px;
} }
/deep/ .content .btn-group { /deep/ .content .btn-group {
line-height: 14px; line-height: 14px;
} }
/deep/ .el-select { /deep/ .el-select {
.el-select__caret:first-child::before { .el-select__caret:first-child::before {
content: '\e6e1'; content: '\e6e1';
} }
.is-focus { .is-focus {
.el-select__caret:first-child { .el-select__caret:first-child {
transform: rotateZ(0deg); transform: rotateZ(0deg);
......
<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',
props: {
resetMerchantId: {
type: String,
default: ''
}
},
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.resetMerchantId ? this.resetMerchantId : 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 {
const labelTreeRets = res.labelTreeRets || []
this.labelTreeRets = 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)
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',
props: {
resetMerchantId: {
type: String,
default: ''
}
},
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.resetMerchantId ? this.resetMerchantId : 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: 100%;
display: flex;
align-items: center;
max-height: 557px;
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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!