Commit 80ba389a by 杨明

fixed

1 parent 9be57e05
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-16 10:20:01
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-31 15:53:44
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\ChatGPT.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="gpt-box">
<div class="gpt-header" v-if="query.purchaseCustomerCount">
<div class="import-base">
<div class="import-item" v-for="(item, index) in importItem" :key="index">
{{ item.title }}:
<span>{{ query[item.name] }}</span>
</div>
</div>
</div>
<div class="gpt-header" v-else>
<div class="import-panel">
<el-button type="primary" size="small" icon="el-icon-download" @click="jumpUrl">导入企微魔方</el-button>
</div>
<div class="import-illustrate">
当前门店基盘客户为空,请通过企微魔方导入门店基盘客户数据。
</div>
</div>
<div class="gpt-body">
<div class="chat-panel" ref="chatRef">
<div class="chat-panel-b" ref="chatBRef">
<div v-for="(item, i) in chatItem" :key="i">
<div class="error-tips flex-center" v-if="item.type == 'error'">
<i class="el-icon-error"></i>
<span>{{ item.content }}</span>
<!-- <i class="el-icon-close"></i> -->
</div>
<template v-else>
<div :class="['chat-item', item.type == 'answer' ? 'is-left' : 'is-right']">
<div class="item-content left-item" v-if="item.type == 'answer'">{{ item.content }}</div>
<div class="item-content right-item" v-else>{{ item.content }}</div>
</div>
</template>
</div>
</div>
</div>
</div>
<div class="gpt-footer">
<div class="input-box" contenteditable="true" v-html="contentHtml" ref="inputRef"></div>
<div class="input-operate">
<div class="select-box">
<el-button size="mini" @click="phrasesShow = true" ref="phrases">常用语</el-button>
<div class="select-panel" v-show="phrasesShow">
<div class="select-item" v-for="(item, index) in phrases" :key="index" v-html="item" @click="selectText(item)"></div>
</div>
</div>
<el-button type="primary" size="small" @click="sendMsg">发送</el-button>
</div>
</div>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
data() {
return {
isError: true,
phrasesShow: false,
query: {},
contentHtml: '我需要制定一套<span>续保</span>营销方案,活动时间为<span>5月份</span>。',
phrases: ['创建一个<span>端午节</span>的营销活动,活动时间为<span>6月份</span>', '我需要一个<span>立夏</span>的节日关怀营销活动', '建立一个<span>父亲节</span>的节日关怀活动'],
chatItem: [],
importItem: [
{
title: '基盘总客户数',
name: 'purchaseCustomerCount'
},
{
title: '企微客户数',
name: 'entmicroAddCustomerCount'
},
{
title: '未加企微客户数',
name: 'entmicroNotAddCustomerCount'
}
]
}
},
computed: {
...mapState('marketing', ['calendarDataAll', 'activityInfo', 'keywords', 'GPTList'])
},
watch: {
chatItem() {
const chatRef = this.$refs.chatRef
this.$nextTick(() => {
const height = this.$refs.chatBRef.offsetHeight - chatRef.offsetHeight + 40
chatRef.scrollTop = height //滚动到最底部
})
},
activityInfo(val) {
if (!val) return
if (val.type != 'chatgpt') this.chatItem = []
}
},
methods: {
...mapActions('marketing', ['setActivityInfo', 'setKeyWords']),
selectText(html) {
this.contentHtml = html
this.phrasesShow = false
},
jumpUrl() {
this.$history.push('/drainage/square/index')
},
//发送消息
sendMsg() {
console.log(this.calendarDataAll)
const content = this.$refs.inputRef.textContent
if (!content.trim()) return
this.chatItem.push({
type: 'question',
content
})
//根据关键字查找模板
const calendarData = this.calendarDataAll.find(item => content.includes(item.keywords))
if (calendarData) {
this.chatItem.push({
type: 'answer',
content: '我们为您生成以下方案,请查看“营销模型解析”'
})
this.setKeyWords(calendarData.keywords)
this.setActivityInfo({
id: calendarData.id,
type: 'chatgpt'
})
} else {
this.chatItem.push({
type: 'error',
content: '无法识别营销场景,请重新输入'
})
}
this.$refs.inputRef.textContent = ''
this.contentHtml = ''
},
/**点击空白处隐藏下拉框 */
bodyCloseMenus(e) {
const self = this
if (this.$refs.phrases && !this.$refs.phrases.$el.contains(e.target)) {
if (self.phrasesShow === true) {
self.phrasesShow = false
}
}
}
},
mounted() {
document.addEventListener('click', this.bodyCloseMenus)
this.query = this.$route.query || {}
console.log(this.$route.query)
},
beforeDestroy() {
document.removeEventListener('click', this.bodyCloseMenus)
}
}
</script>
<style lang="scss" scoped>
.gpt-box {
box-sizing: border-box;
padding: 8px;
.gpt-header {
height: 48px;
background: #e4e3ff;
border-radius: 4px;
display: flex;
align-items: center;
color: #000000a6;
.import-illustrate {
margin-left: 10px;
}
.import-base {
padding-left: 16px;
display: flex;
align-items: center;
.import-item {
margin-right: 80px;
span {
color: #5850ff;
}
}
}
}
.gpt-body {
height: 170px;
.error-tips {
width: 274px;
height: 40px;
background: #fce3e3;
border-radius: 4px;
margin: 0px auto;
font-size: 14px;
color: #000000a6;
span {
margin: 0 20px 0px 10px;
}
.el-icon-error {
color: #eb4e4e;
}
.el-icon-close {
color: #666666;
}
}
.chat-panel {
padding-top: 12px;
height: 150px;
overflow: auto;
.chat-item {
margin-top: 8px;
display: flex;
&.is-left {
justify-content: flex-start;
}
&.is-right {
justify-content: flex-end;
}
.item-content {
font-size: 14px;
display: inline-block;
padding: 12px 8px;
border: 1px solid #e5e5e5;
border-radius: 4px 4px 4px 0;
background: #fafbfe;
max-width: 500px;
}
}
}
}
.gpt-footer {
height: 98px;
background: #f5f5f5;
border: 1px solid #e5e5e5;
border-radius: 4px;
padding: 8px;
.input-box {
height: 66px;
overflow: auto;
}
.input-operate {
display: flex;
justify-content: space-between;
align-items: center;
.select-box {
position: relative;
.select-panel {
z-index: 1000;
background: #fff;
position: absolute;
top: 28px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
width: 343px;
.select-item {
padding-left: 10px;
line-height: 36px;
color: #666666ff;
font-size: 14px;
cursor: pointer;
span {
color: #eb4e4e;
}
&:hover {
background: #f2f1ff;
}
}
}
}
}
}
}
</style>
<style>
.select-item span,
.input-box span {
color: #eb4e4e;
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:01
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-23 17:35:23
* @FilePath: \scrm-micro-home\src\views\home\components\marketing\MarketingLeft.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="left-wrap">
<div class="store-wrap">
<div class="mrglr text-16 scrm-c3 weight-6">{{ merchantInfo.merchantName }}</div>
<div class="merchantId scrm-c3 scrm-f14">商户号:{{ merchantInfo.merchantId }}</div>
<el-button class="mrglr add" icon="el-icon-plus" size="small" type="primary" @click="addSuper">新建</el-button>
</div>
<!-- 营销方案 -->
<div class="scheme-wrap">
<div class="scrm-ml6 scrm-c3 scrm-f14 weight-6">营销方案:</div>
<div class="scheme-list" v-infinite-scroll="scrollLoad">
<template v-for="(item, index) in schemeListData">
<div class="scheme-line scrm-c3 scrm-f14 flex" :class="{ select: item.hovering }" :key="index" @mouseenter="item.hovering = true" @mouseleave="item.hovering = false">
<div class="scheme-text one-line-ellipsis">{{ item.activityName }}</div>
<div class="flex txt-blue" v-show="item.hovering">
<span class="pointer" @click="getView(item)">预览</span>
<span class="scrm-ml6 pointer" @click="setActivity(item)">引用</span>
</div>
</div>
</template>
</div>
</div>
<!-- 营销日历 -->
<div class="calendar-market-wrap">
<div class="scrm-c3 scrm-f14 m-b-8 weight-6">营销日历:</div>
<glsx-calendar></glsx-calendar>
</div>
<!-- 营销主题 -->
<div class="theme-wrap">
<div class="scrm-c3 scrm-f14 m-b-8 weight-6">推荐近期营销主题:</div>
<div class="theme-list">
<template v-for="(item, index) in themeList">
<div class="theme-line scrm-c3 scrm-f12 flex" :class="{ select: item.hovering }" :key="index" @mouseenter="item.hovering = true" @mouseleave="item.hovering = false">
<div class="scheme-text">{{ index + 1 }}、{{ item.title }}</div>
<div class="flex txt-blue" v-show="item.hovering">
<span class="scrm-ml6 pointer" @click="setActivity(item)">引用</span>
</div>
</div>
</template>
</div>
</div>
<el-dialog title="预览" :append-to-body="true" :visible.sync="dialogVisible" width="30%">
<phone-view :activityInfo="activityInfo" :isSuper="isSuper"></phone-view>
</el-dialog>
</div>
</template>
<script>
import GlsxCalendar from './components/GlsxCalendar'
import PhoneView from './PhoneView'
import { mapState, mapActions } from 'vuex'
export default {
components: {
GlsxCalendar,
PhoneView
},
data() {
return {
activityInfo: {},
isSuper: true,
schemeListData: [],
total: 0,
dialogVisible: false,
themeList: [
{
text: '5月定保营销种草',
hovering: true
},
{
text: '5月特大活动定保营销种草活动即将开始',
hovering: false
},
{
text: '店庆7周年',
hovering: false
}
],
currentPage: 1,
merchantInfo: this.$globalState.session
}
},
computed: {
...mapState({
calendarData: state => state.marketing.calendarData,
schemeList: state => state.marketing.schemeList
})
},
watch: {
calendarData(newVal) {
this.getThemeData(newVal)
},
schemeList(val) {
this.getSchemeList(val)
}
},
mounted() {
this.getSchemeListData() //44211227 this.$globalState.session.merchantId
},
methods: {
...mapActions('marketing', ['setActivityInfo', 'setSchemeListData']),
getSchemeListData() {
this.setSchemeListData({ merchantId: this.$globalState.session.merchantId, pageSize: 5, currentPage: this.currentPage })
},
scrollLoad() {
if (this.schemeList.length == this.total) return
this.currentPage++
this.getSchemeListData()
},
getView(val) {
this.isSuper = true
let { subscribe, id } = val,
param = {
activityId: id
},
activityAPi = 'findActivityInfo'
if (subscribe != 8) {
param = {
id
}
activityAPi = 'activityDetail'
this.isSuper = false
}
this.$apis.activity[activityAPi](param).then(res => {
console.log(res)
if (res) {
const activityCoupon = res.activityCouponBaseInfoDTOS || res.couponList || [],
selectedGoodsList = activityCoupon.filter(i => i.discountType == 8),
couponList = activityCoupon.filter(i => i.discountType != 8)
this.activityInfo = { ...res, selectedEquityList: res.serviceMerchantPackageConfigDTOList, couponList, selectedGoodsList }
this.dialogVisible = true
}
})
},
getSchemeList(val) {
if (!val) return
const list = val.pageNum == 1 ? val.list : this.schemeListData.concat(val.list)
this.schemeListData = list.map(item => {
return {
hovering: false,
activityName: item.activityName,
id: item.id,
subscribe: item.subscribe,
type: 'programme' //方案
}
})
},
addSuper() {
this.$parent.handleShowCalendar(0)
this.setActivityInfo({})
},
//设置活动详情
setActivity(item) {
this.$parent.handleShowCalendar(0)
this.setActivityInfo(item)
},
getThemeData(data) {
this.themeList = data.map(item => {
return {
title: item.title,
id: item.id,
hovering: false,
type: 'calendar' //方案
}
})
}
}
}
</script>
<style lang="scss" scoped>
.left-wrap {
width: 246px;
height: 100%;
background: #ffffff;
box-sizing: border-box;
display: flex;
flex-direction: column;
.store-wrap {
height: 192px;
padding-top: 48px;
display: flex;
flex-direction: column;
border-bottom: 1px solid #e5e5e5;
box-sizing: border-box;
.merchantId {
margin: 8px auto 24px;
line-height: 20px;
}
.add{
margin-bottom:36px;
}
}
.scheme-wrap {
padding: 16px 10px;
.scheme-list {
margin: 8px 0;
display: flex;
flex-direction: column;
height: 190px;
overflow-y: scroll;
overflow-x: hidden;
.scheme-line {
margin-bottom: 4px;
align-items: center;
height: 36px;
line-height: 36px;
.scheme-text {
width: 182px;
margin-left: 6px;
}
}
.select {
width: 226px;
height: 36px;
background: #f2f1ff;
border-radius: 4px;
padding: 0 6px;
box-sizing: border-box;
.scheme-text {
width: 140px;
}
}
}
}
.calendar-market-wrap {
padding: 0 16px 32px;
}
.theme-wrap {
padding: 0 16px;
.theme-list {
height: 200px;
// overflow-x: hidden;
overflow-y: scroll;
margin: 8px 0;
display: flex;
flex-direction: column;
.theme-line {
margin-bottom: 6px;
align-items: center;
line-height: 32px;
.scheme-text {
width: 182px;
margin-left: 6px;
}
}
.select {
width: 206px;
height: auto;
background: #f2f1ff;
border-radius: 4px;
padding: 0 6px;
box-sizing: border-box;
.scheme-text {
width: 140px;
}
}
}
}
}
</style>
<template>
<div class="container">
<div class="main-head">
<chat-gpt></chat-gpt>
</div>
<GPTAnalysis></GPTAnalysis>
</div>
</template>
<script>
import ChatGpt from './ChatGPT'
import GPTAnalysis from './GPTAnalysis'
export default {
data() {
return {}
},
componentsName: 'marketingMiddle',
name: 'marketingMiddle',
components: {
ChatGpt,
GPTAnalysis
}
}
</script>
<style lang="scss" scoped></style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-30 14:27:42
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="review-box">
<div class="review-title">预览营销方案</div>
<phone-view :activityInfo="activityDetail"></phone-view>
<div class="review-refresh" @click="renewImg">更新预览图</div>
</div>
</template>
<script>
import PhoneView from './PhoneView'
import { mapState } from 'vuex'
export default {
data() {
return {
activityDetail: {},
getComponent: ''
}
},
components: {
PhoneView
},
computed: {
...mapState('marketing', ['activityInfo', 'mergeImg'])
},
watch: {
mergeImg: {
handler(val) {
const [backgroundImage = '', detailImage = '', merchantLog = '', mainColor, logoInfo, marketingTitle, marketingSubtitle,templateId] = val
this.activityDetail = { ...this.activityDetail, ...{ backgroundImage, detailImage, merchantLog, mainColor, logoInfo, marketingTitle, marketingSubtitle,templateId } }
},
deep: true
}
// activityInfo(val) {
// this.activityDetail = {}
// }
},
methods: {
findComponent(children) {
for (let i = 0; i < children.length; i++) {
if (children[i].$options.componentsName == 'analysis') {
this.activityDetail = children[i].getViewParams()
return
}
if (children[i].$children) {
this.findComponent(children[i].$children)
}
}
},
renewImg() {
let children = this.$parent.$children
this.findComponent(children)
}
}
}
</script>
<style lang="scss" scoped>
.review-box {
background: #fff;
margin-top: 10px;
padding: 8px;
height: calc(100vh - 100px);
overflow-y: auto;
overflow-x: hidden;
.review-title {
padding: 8px;
font-size: 16px;
color: #333333;
}
.review-refresh {
margin: 18px auto 0px;
width: 274px;
height: 36px;
line-height: 36px;
text-align: center;
background: #685bff;
font-size: 14px;
color: #ffffff;
border-radius: 4px;
cursor: pointer;
}
}
</style>
<template>
<div class="calendar-card">
<div class="calendar-bar">
<button class="button button-year-minus" @click="minusYear(true)">
&lt;
</button>
<button class="button button-month-minus" @click="minusMonth">
&lt;
</button>
<div class="calendar-date">{{ date.year }}-{{ date.month + 1 }}-{{ date.date }}</div>
<button class="button button-month-plus" @click="plusMonth">&gt;</button>
<button class="button button-year-plus" @click="plusYear(true)">
&gt;
</button>
</div>
<div class="calendar-content">
<ul class="ul-week">
<li class="li-week" v-for="(item, index) in week" :key="index">{{ item }}</li>
</ul>
<ul class="ul-day" @click="handleShowCalendar">
<li class="li-day" v-for="(item, index) in days" :key="index" :isThisMonth="item.isThisMonth">
{{ item.date }}
<img v-if="item.isStar" class="star-icon" src="@/assets/star.png" />
</li>
</ul>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'SimpleCalendar',
data() {
return {
date: {
year: '',
month: '',
date: ''
},
current: {
year: '',
month: '',
date: ''
},
curretIndex: 30,
week: ['日', '一', '二', '三', '四', '五', '六'],
days: [],
starList: []
}
},
computed: {
...mapState({
calendarData: state => state.marketing.calendarDataAll
})
},
watch: {
calendarData(newVal) {
this.handleSelectCalendar(newVal)
}
},
methods: {
handleSelectCalendar(data) {
this.starList = data.map(item => {
let dateArray = item.startTime.split('/')
return {
date: +dateArray[2],
month: dateArray[1] - 1,
year: +dateArray[0]
}
})
this.createCalendar(this.current.year, this.current.month)
},
handleShowCalendar() {
this.$parent.$parent.handleShowCalendar(1)
},
plusMonth: function() {
if (this.date.month == 11) {
this.date.month = 0
this.plusYear(false)
} else {
this.date.month++
}
this.createCalendar(this.date.year, this.date.month)
},
minusMonth: function() {
if (this.date.month == 0) {
this.date.month = 11
this.minusYear(false)
} else {
this.date.month--
}
this.createCalendar(this.date.year, this.date.month)
},
plusYear: function(create) {
if (this.date.year == 2049) {
this.date.year = 1970
} else {
this.date.year++
}
if (create) {
this.createCalendar(this.date.year, this.date.month)
}
},
minusYear: function(create) {
if (this.date.year == 1970) {
this.date.year = 2049
} else {
this.date.year--
}
if (create) {
this.createCalendar(this.date.year, this.date.month)
}
},
createCalendar: function(year, month) {
let d = new Date()
d.setFullYear(year)
d.setMonth(month)
d.setDate(1)
let dayOfFirstDay = d.getDay()
this.days = []
let i = 0
for (; i < 42; i++) {
d.setDate(1)
d.setMonth(month)
d.setDate(i - dayOfFirstDay + 1)
let isThisMonth = 1
if (d.getMonth() == month) {
isThisMonth = 2
} else {
isThisMonth = 1
}
if (this.current.date == d.getDate() && this.current.month == d.getMonth() && this.current.year == d.getFullYear()) {
isThisMonth = 3
let date = {
year: year,
month: month,
date: d.getDate(),
isThisMonth: isThisMonth
}
this.days.push(date)
} else {
let date = {
year: d.getFullYear(),
month: d.getMonth(),
date: d.getDate(),
isThisMonth: isThisMonth
}
this.days.push(date)
}
}
if (i == 42) this.selectStar()
},
selectStar() {
let { days, starList } = this
for (let i = 0; i < starList.length; i++) {
for (let j = 0; j < days.length; j++) {
if (starList[i].date == days[j].date && starList[i].year == days[j].year && starList[i].month == days[j].month) {
days[j].isStar = true
}
}
}
}
},
created() {
let d = new Date()
this.date.year = d.getFullYear()
this.date.month = d.getMonth()
this.date.date = d.getDate()
this.current.year = d.getFullYear()
this.current.month = d.getMonth()
this.current.date = d.getDate()
}
}
</script>
<style scoped>
.calendar-card {
/* width: 290px; */
height: 210px;
padding: 5px 5px 0px 5px;
border: 1px solid #e8e8ea;
border-radius: 1.53px;
}
/* .calendar-card:hover {
box-shadow: 0px 0px 5px 5px #cfcfcf;
} */
.calendar-bar {
height: 30px;
color: #727272;
line-height: 30px;
text-align: center;
border-bottom: 1px solid #e8e8ea;
font-size: 12px;
/* background-color: #ebeef5; */
}
.calendar-date {
display: inline-block;
width: 100px;
}
.button {
width: 20px;
height: 20px;
background-color: #fff;
color: #aaa;
border: 0;
border-radius: 5px;
}
.button:hover {
background-color: #eee;
cursor: pointer;
}
.ul-week {
display: grid;
width: 245px;
grid-template-rows: 20px;
grid-template-columns: repeat(7, 24px); /**/
list-style: none;
text-align: center;
font-size: 13px;
color: #aaa;
margin: 5px 18px 5px 18px;
padding-inline-start: 0px;
padding-inline-end: 0px;
}
.li-week {
display: inline-block;
}
.ul-day {
display: grid;
width: 245px;
grid-template-rows: repeat(6, 22px);
grid-template-columns: repeat(7, 24px);
list-style: none;
text-align: center;
margin: 5px 18px 5px 18px;
padding-inline-start: 0px;
padding-inline-end: 0px;
}
.li-day {
display: inline-block;
font-size: 10px;
line-height: 22px;
text-align: center;
border-radius: 5px;
margin: 1px;
color: rgb(91, 91, 91);
position: relative;
}
.li-day:hover {
background-color: #5850ff;
color: #fff;
font-size: 15px;
cursor: pointer;
}
.li-day[isThisMonth='1'] {
color: rgb(190, 190, 190);
font-size: 10px;
}
.li-day[isThisMonth='1']:hover {
background-color: #5850ff;
color: #fff;
font-size: 15px;
cursor: pointer;
}
.li-day[isThisMonth='3'] {
border-radius: 5px;
color: rgb(255, 255, 255);
background-color: #5850ff;
font-weight: 600;
}
.star-icon {
width: 8px;
position: absolute;
top: 17px;
left: 8px;
height: 8px;
}
</style>
<template>
<div class="calendar-wrap">
<div class="header">
<div class="header-rounded" @click="handlePrev('prev')">
<img src="@/assets/arrow.png" />
</div>
<span class="range">{{ currentDate }}</span>
<div class="header-rounded next" @click="handlePrev('next')"><img src="@/assets/arrow.png" /></div>
<div class="close scrm-c3 scrm-f12 " @click="close()">
<img src="@/assets/close.png" />
关闭日历
</div>
</div>
<div ref="calendar" class="calendar"></div>
<div class="footer">
<div class="title">
2023年度
<br />
营销计划概览:
</div>
<div class="described">
1、本年度共计可营销场次48+次
<br />
2、推荐营销场次16次,查看
<br />
3、定保、续保、节日关怀、店庆等
</div>
</div>
</div>
</template>
<script>
import Calendar from '@toast-ui/calendar'
import * as dayjs from 'dayjs'
import { mapState, mapActions } from 'vuex'
export default {
data() {
return {
calendar: '',
currentDate: '',
options: {
defaultView: 'month',
isReadOnly: true,
month: {
dayNames: ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
},
usageStatistics: false,
template: {
milestone(event) {
return `<span style="color: ${event.color};">${event.title}</span>`
},
aaa(event) {
return `<span style="color: ${event.color};">${event.title}</span>`
}
}
},
eventList: []
}
},
computed: {
...mapState({
calendarData: state => state.marketing.calendarData
})
},
mounted() {
let container = this.$refs.calendar
this.calendar = new Calendar(container, this.options)
this.calendar.on('clickEvent', e => {
this.$parent.handleShowCalendar(0)
this.setActivityInfo({
id: e.event.calendarId,
type: 'calendar'
})
})
this.getCalendarData()
},
methods: {
...mapActions('marketing', ['setActivityInfo']),
close() {
this.$parent.handleShowCalendar(0)
},
getCalendarData() {
let colors = ['#BFEFD5', '#FEE9CC', '#FEDCCF', '', '#CAF2F1', '#ECD0FF']
let { eventList, calendarData, calendar, currentDate } = this
eventList = calendarData.map(item => {
let obj = {
id: item.id,
calendarId: item.id,
title: item.title,
start: item.startTime.replace('/', '-'),
end: item.endTime.replace('/', '-'),
color: '#333333',
backgroundColor: colors[item.marketingType - 1],
borderColor: colors[item.marketingType - 1],
dragBackgroundColor: colors[item.marketingType - 1],
customStyle: {
fontSize: '12px;'
}
}
if (item.startTime == item.endTime) {
obj.category = 'milestone'
} else {
obj.category = 'aaa'
}
return obj
})
calendar.createEvents(eventList)
this.currentDate = dayjs(this.calendar.getDate()).format('YYYY年MM')
},
handlePrev(type) {
this.calendar[type]()
this.currentDate = dayjs(this.calendar.getDate()).format('YYYY年MM')
}
}
}
</script>
<style lang="scss" scoped>
.calendar-wrap {
width: auto;
height: 100%;
margin-bottom: 20px;
margin-right: 10px;
}
.header {
display: flex;
margin-top: 11px;
align-items: center;
justify-content: center;
height: 44px;
background: #ffffff;
border-bottom: 1px solid #c6c6c6;
position: relative;
.range {
font-weight: 600;
font-size: 16px;
color: #333333;
text-align: center;
margin: 0 8px;
}
.next {
img {
transform: rotate(270deg);
}
}
.close {
display: flex;
align-items: center;
position: absolute;
cursor: pointer;
right: 16px;
img {
width: 12px;
height: 12px;
margin-right: 4px;
}
}
}
.calendar {
width: 100%;
height: 83%;
}
.header-rounded {
width: 28px;
height: 28px;
background: #ffffff;
border: 1px solid #e8e8ea;
border-radius: 2px;
display: flex;
img {
width: 11px;
height: 9px;
margin: auto;
transform: rotate(90deg);
}
}
.footer {
width: 100%;
height: 10%x;
background: #ffffff;
margin-top: 8px;
display: flex;
padding: 16px;
box-sizing: border-box;
.title {
text-align: right;
margin-right: 36px;
font-weight: 600;
font-size: 20px;
color: #333333;
text-align: center;
line-height: 28px;
}
.described {
font-size: 14px;
color: #333333;
letter-spacing: 0;
line-height: 22px;
}
}
</style>
<template>
<GLDialog mode="small" :appendToBody="true" title="选择营销跟进专员" cancelText="跳过" :hasFooter="hasFooter" :before-close="handleEmpClose" @onOk="handleEmpConfirm" @onCancel="handleEmpClose" :visible.sync="isSelectEmpVisible">
<div class="config-header">
本次营销活动导入客户
<span>{{ importNum }}</span>
人,请选择跟进专员对以上客户进行跟进:
</div>
<div class="config-item">
<div class="market-title">
<label>*</label>
跟进专员:
</div>
<div class="market-content">
<el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i>
选择专员
</el-button>
<div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length">
<GLFull :label="tag.staffName" :identi="`${tag.staffId}`" labelWidth="110" textType="user" :haveClose="true" v-for="(tag, idx) in staffInfo" :key="idx" @handleRemove="removeStaff(idx)"></GLFull>
</div>
</div>
</div>
<div class="tips">1、未加企微客户将发送本营销活动信息邀请添加跟进专员企业微信</div>
<div class="tips">2、已加企微客户将指派任务由跟进专员1V1发送营销提醒给客户</div>
<div class="tips">3、如跳过选择营销跟进专员,则不进行营销任务指派</div>
<select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp>
</GLDialog>
</template>
<script>
import selectEmp from '@/components/selectEmp/emp'
export default {
data() {
return {
staffInfo: []
}
},
components: {
selectEmp
},
props: {
isSelectEmpVisible: {
type: Boolean,
default: true
},
importNum: {
type: Number,
default: 0
}
},
methods: {
handleAddEmp() {
this.staffStatus = false
this.$refs.selectEmpForm.init(this.staffInfo)
},
selectTable(item) {
this.staffInfo = item.map(item => {
return {
staffId: item.id,
staffName: item.staffName
}
})
},
handleEmpConfirm() {
if (this.staffInfo && this.staffInfo.length) {
this.$emit('handleEmpConfirm', this.staffInfo[0])
} else {
this.$message.error('请选择跟进专员')
}
},
handleEmpClose() {
this.$emit('handleEmpConfirm', {})
}
}
}
</script>
<style lang="scss" scoped>
.config-header {
padding-left: 40px;
color: #333333ff;
font-size: 14px;
span {
color: #5850ff;
}
}
.tips {
padding-left: 40px;
font-size: 12x;
color: #999999;
line-height: 24px;
}
.config-item {
display: flex;
margin: 15px;
.market-title {
width: 100px;
text-align: right;
font-size: 14px;
color: #333333;
text-align: right;
line-height: 20px;
font-weight: 400;
margin-right: 6px;
label {
color: #eb4e4e;
}
}
.market-content {
flex: 1;
.input-tag-wrapper {
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px;
max-height: 68px;
overflow: auto;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 450px;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
}
}
</style>
<!-- 选择礼包弹窗 -->
<template>
<GLDialog mode="big" :appendToBody="true" class="muti-gift" bigTitle="选择内容" :hasFooter="hasFooter" :before-close="handleEquityClose" @onOk="handleEquityConfirm" @onCancel="handleEquityClose" :visible.sync="isSelectEquityVisible">
<div class="flex">
<div class="gift-table">
<div>
<glsx-combi-form :isEdit="false" labelWidth="70px" class="p-16" style="padding-bottom: 0px;" ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
<GLTable :hasPage="false" ref="equityRef" v-loading="loading" :tableData="EquityList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList" @selectionTable="handleSelectionTable">
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="stock" slot-scope="scope">
<span>{{ scope.scope.limitStockFlag == 1 ? scope.scope.stock : '无限制' }}</span>
</span>
<span slot="useType" slot-scope="scope">
<span>{{ toRestrictLabelText(scope.scope) }}</span>
</span>
</GLTable>
</div>
</div>
<div class="selected-list">
<p class="list-title p-16">已选({{ selectedList.length }})</p>
<div class="list-gifts">
<div class="gift-box" v-if="selectedList.length">
<div class="gift-label">
<img class="muti-icon" :src="require(`@/assets/img/coupon/equity.png`)" />
</div>
<div class="gift-content">
<div class="gift-item" :key="subItem.id" v-for="subItem in selectedList">
<img class="muti-icon" src="@/assets/img/muti-selected.png" @click="deleteSelected(subItem)" />
{{ subItem.packageName }}
</div>
</div>
</div>
</div>
</div>
</div>
</GLDialog>
</template>
<script>
import url from '@/assets/img/empty.png'
// import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectEquityDialog',
data() {
return {
size: 'small',
// 表格组件
isMount: false,
userInfo: {},
EquityList: [],
fnCallBack: false,
url: url,
loading: true,
selectedSum: 0,
selectedList: [],
initSelected: '',
// 搜索
searchForm: {
packageName: ''
},
searchFormData: [
{
label: '权益名称',
name: 'packageName',
type: 'input',
maxlength: 30,
width: '185px',
placeholder: '请输入权益名称',
isClear: true
}
],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'packageCode',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '权益名称',
prop: 'packageName',
width: 300
},
{
label: '有效期',
prop: 'packageServicePeriod',
formatter: cellValue => {
return '一年'
}
}
]
},
tableParamsL: {}
}
},
props: {
isSelectEquityVisible: {
type: Boolean,
default: false
},
selectedEquityLists: {
type: Object,
default: () => []
}
},
// components: {
// glsxDialog
// },
mounted() {
this.getList()
},
methods: {
couponString(val) {
return val.packageName
},
handleSearch() {
this.getList()
},
getList() {
var params = {
...this.searchForm,
merchantId: this.$globalState.session.merchantId
}
this.loading = true
this.$apis.giftBag
.equityMerchant(params)
.then(res => {
this.EquityList = res.packageConfigs
this.$refs.equityRef.tableHeightValues = '52vh'
this.recoverySelected()
})
.finally(() => {
this.loading = false
})
},
recoverySelected() {
this.selectedEquityLists.forEach(item => {
var idx = this.EquityList.findIndex(k => k.packageCode == item.packageCode)
var index = this.selectedList.findIndex(k => k.packageCode == item.packageCode)
if (idx != -1 && index == -1) {
this.$refs.equityRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.EquityList[idx], true)
}
})
},
// 删除选中
deleteSelected(deleteList) {
this.$nextTick(() => {
var idx = this.EquityList.findIndex(k => k.packageCode == deleteList.packageCode)
if (idx != -1) {
this.$refs.equityRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.EquityList[idx], false)
}
})
},
// 选择/取消
handleSelectionTable(val) {
this.selectedList = val
},
handleEquityConfirm() {
if (this.selectedList.length == 0) {
this.$message.error('请选择权益')
return
}
this.$emit('handleEquityConfirm', this.selectedList)
},
handleEquityClose() {
this.$emit('handleEquityClose')
}
}
}
</script>
<style lang="scss">
.el-message {
z-index: 9999 !important;
}
.muti-gift .el-tabs__active-bar {
display: block;
}
.muti-gift .el-tabs__nav-scroll {
display: block;
border-bottom: 1px solid #eeeeee;
}
.muti-gift .el-tabs__item {
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px !important;
line-height: 36px !important;
}
.muti-gift .el-tabs__item:hover,
.muti-gift .el-tabs__item.is-active {
color: #5f5efb;
background: #fff !important;
border-width: 0px !important;
}
.muti-gift .m-t-10 {
margin-top: 10px;
}
.muti-gift .gift-table {
width: calc(100% - 280px);
border: 1px solid #eeeeee;
margin-right: 10px;
}
.muti-gift .p-16 {
padding: 16px;
}
.muti-gift .selected-list {
width: 280px;
border-radius: 2px;
border: 1px solid #eeeeee;
.list-title {
font-size: 16px;
border-bottom: 1px solid #f1f1f1;
}
.list-gifts {
height: 61vh;
overflow-y: scroll;
}
.gift-box {
padding: 16px;
.gift-label {
color: #999999;
margin-bottom: 14px;
}
.gift-content {
border-bottom: 1px solid #e5e5e5;
.gift-item {
margin-bottom: 20px;
display: flex;
align-items: flex-start;
line-height: 20px;
.muti-icon {
cursor: pointer;
margin-right: 4px;
}
.gift-coupon-name {
display: inline-block;
width: 109px;
margin: 0 5px 0 7px;
}
.gift-sum {
display: inline-block;
width: 82px;
text-align: right;
.el-input-number--mini .el-input__inner {
padding: 0 10px;
}
.sum-input {
display: inline-block;
width: 82px;
}
.el-input--mini .el-input__inner {
border: 0px;
}
.el-input-number--mini .el-input-number__decrease,
.el-input-number--mini .el-input-number__increase {
width: 20px !important;
border: 0px;
background-color: #fff;
}
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.gift-item:last-child {
margin-bottom: 0;
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-11 18:32:20
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-31 09:29:44
* @FilePath: \scrm-micro-home\src\views\home\marketing.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="full-box">
<div class="market-left">
<marketing-left></marketing-left>
</div>
<div class="market-m-r">
<div class="market-top">
<div class="market-header">
<div class="back-wrap" @click="goBack">
<i class="i i-back"></i>
<span class="back-text">返回</span>
<span class="sprator">|</span>
</div>
<div class="market-title">ChatGPT超级营销</div>
</div>
</div>
<div class="market-bottom" v-show="!showCalendar">
<!-- <template > -->
<div class="market-middle">
<marketing-middle></marketing-middle>
</div>
<div class="market-right">
<marketing-right></marketing-right>
</div>
<!-- </template> -->
</div>
<div v-if="showCalendar" class="calendar-panel">
<schedule-calendar ref="calendar"></schedule-calendar>
</div>
</div>
</div>
</template>
<script>
import ScheduleCalendar from './components/Marketing/components/ScheduleCalendar'
import MarketingLeft from './components/Marketing/MarketingLeft'
import MarketingMiddle from './components/Marketing/MarketingMiddle'
import MarketingRight from './components/Marketing/MarketingRight'
import { mapActions } from 'vuex'
export default {
components: {
MarketingLeft,
MarketingMiddle,
MarketingRight,
ScheduleCalendar
},
data() {
return {
showCalendar: false
}
},
mounted() {
this.getCalendarListData({ status: 1, recommendMonths: 3 })
this.getCalendarListDataAll()
this.getMerchantInfo({ merchantId: this.$globalState.session.merchantId })
},
methods: {
...mapActions({
getCalendarListData: 'marketing/getCalendarListData',
getCalendarListDataAll: 'marketing/getCalendarListDataAll',
getMerchantInfo: 'marketing/getMerchantInfo'
}),
handleShowCalendar(value) {
this.showCalendar = Boolean(value)
},
goBack() {
this.$router.push('/home/index')
}
}
}
</script>
<style lang="scss" scoped>
.full-box {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background: #f0f1f7;
z-index: 999;
display: flex;
.market-left {
width: 246px;
background: #fff;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
}
.market-m-r {
margin-left: 8px;
flex: 1;
position: relative;
.market-bottom {
display: flex;
margin-right: 10px;
height: calc(100% - 210px);
.market-middle {
flex: 1;
}
.market-right {
width: 303px;
margin-left: 8px;
}
}
.calendar-panel {
width: 100%;
height: calc(100% - 69px);
}
}
.market-top {
.market-header {
height: 56px;
background: #ffffff;
display: flex;
align-items: center;
padding-left: 20px;
color: #333;
.back-wrap {
font-size: 12px;
cursor: pointer;
.sprator {
margin: 0 8px;
color: #c3c3c3;
}
}
.market-title {
font-weight: 500;
font-size: 16px;
}
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!