Commit 3e21eee1 by 张权

专家设置

1 parent 8734e0c0
...@@ -43,4 +43,15 @@ const getZoneList = params => { ...@@ -43,4 +43,15 @@ const getZoneList = params => {
}) })
} }
export { getGoodsList, uploadImg, getMerchantList, getZoneList } const pictureUpload = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http({
url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
export { getGoodsList, uploadImg, getMerchantList, getZoneList, pictureUpload }
import { http, http2 } from '@/main'
const path = 'entmicro.api.mass.'
const URL = 'rop-scrm-entmicro/router'
const customerList = params => {
params.type = 1
params.method = `${path}page`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const customerGroupList = params => {
params.type = 2
params.method = `${path}page`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const insert = params => {
params.method = `${path}insert`
return http({
url: URL,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const detail = params => {
params.type = 2
params.method = `${path}detail`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const listDepartmentTree = params => {
params.method = 'entmicro.api.department.listDepartmentTree'
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const findLordGroup = params => {
params.method = 'entmicro.api.staff.findLordGroup'
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const querylabeltree = params => {
// params.method = 'scrm.api.datahub.label.querylabeltree'
params.method = 'scrm.api.datahub.labelgroup.queryLabelTree'
return http2({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
const groupList = params => {
params.method = 'entmicro.api.customer.group.list.by.merchant'
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const customerCount = params => {
params.method = 'entmicro.api.mass.detail.customer.filter.count'
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
// 客户群发、客户群群发基本信息详情
const customerDetail = params => {
params.method = `${path}detail`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 客户群发统计
const detailStatistic = params => {
params.method = `${path}detail.statistic`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 客户群群发统计
const groupDetailStatistic = params => {
params.method = `${path}group.detail.statistic`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 客户群发员工列表
const staffList = params => {
params.method = `${path}staff.list`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 客户群发客户列表
const customerDetailList = params => {
params.method = `${path}customer.list`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 客户群群发列表
const groupDetailList = params => {
params.method = `${path}group.detail.sender.list`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 根据id提醒用户 ,列表
const listRemindOperate = params => {
params.method = `${path}listRemindOperate`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
// 详情页客户群提醒
const remindUserGroup = params => {
params.method = `${path}remindUserGroup`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const getMerchant = params => {
params.method = 'scrm.api.coupon.list.merchant'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
const getCard = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const merchant = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const merchantOpen = params => {
params.method = 'scrm.api.equity.service.merchant.config.get'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getCoupon = params => {
params.method = 'scrm.api.boutiquecoupon.coupon.page'
return http({
url: '/rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
const getPackage = params => {
params.method = 'scrm.api.equity.package.info.list.with.page'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getActivity = params => {
params.method = 'scrm.api.shopmall.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
const nameVaild = params => {
params.method = 'entmicro.api.one.template.name.valid'
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const getStatus = params => {
params.method = 'scrm.api.work.wechat.access.status'
return http({
url: '/rop-scrm-wechat/router',
method: 'POST',
data: params,
sign: true
})
}
const templatePage = params => {
params.method = `${path}template.page.search`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const templateSave = params => {
params.method = `${path}template.save`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const templateUpdate = params => {
params.method = `${path}template.update`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const createdNameList = params => {
params.method = `${path}template.created.name.list`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const templateDetail = params => {
params.method = `${path}template.detail`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const groupDetailUpdate = params => {
params.method = `${path}update.group.detail`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const followerType = params => {
params.method = 'entmicro.api.staff.listEntFollowerType'
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
export default {
customerList,
customerGroupList,
insert,
detail,
remindUserGroup,
listRemindOperate,
listDepartmentTree,
querylabeltree,
groupList,
customerCount,
customerDetail,
detailStatistic,
groupDetailStatistic,
staffList,
customerDetailList,
groupDetailList,
getMerchant,
getCard,
getCoupon,
merchant,
merchantOpen,
getPackage,
getActivity,
nameVaild,
getStatus,
templatePage,
templateSave,
templateUpdate,
createdNameList,
templateDetail,
groupDetailUpdate,
findLordGroup,
followerType
}
const staticRoutes = Object.freeze([{ const staticRoutes = Object.freeze([
{
name: 'index', name: 'index',
path: '/inSale/index', path: '/inSale/index',
component: resolve => require([`@/views/inSale/index.vue`], resolve), component: resolve => require([`@/views/inSale/index.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'upgrade', name: 'upgrade',
path: '/inSale/upgrade', path: '/inSale/upgrade',
component: resolve => require([`@/views/inSale/upgrade.vue`], resolve), component: resolve => require([`@/views/inSale/upgrade.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'guestComments', name: 'guestComments',
path: '/inSale/guestComments', path: '/inSale/guestComments',
component: resolve => require([`@/views/inSale/guestComments.vue`], resolve), component: resolve => require([`@/views/inSale/guestComments.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'accountRules', name: 'accountRules',
path: '/inSale/accountRules', path: '/inSale/accountRules',
component: resolve => require([`@/views/inSale/accountRules.vue`], resolve), component: resolve => require([`@/views/inSale/accountRules.vue`], resolve),
...@@ -30,17 +34,20 @@ const staticRoutes = Object.freeze([{ ...@@ -30,17 +34,20 @@ const staticRoutes = Object.freeze([{
path: '/beforeSale/equityList', path: '/beforeSale/equityList',
component: resolve => require([`@/views/beforeSale/equityList.vue`], resolve), component: resolve => require([`@/views/beforeSale/equityList.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'introduct', name: 'introduct',
path: '/inSale/introduct', path: '/inSale/introduct',
component: resolve => require([`@/views/inSale/introduct.vue`], resolve), component: resolve => require([`@/views/inSale/introduct.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'afterSales', name: 'afterSales',
path: '/afterSales/index', path: '/afterSales/index',
component: resolve => require([`@/views/afterSales/index.vue`], resolve), component: resolve => require([`@/views/afterSales/index.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'index', name: 'index',
path: '/beforeSale/index', path: '/beforeSale/index',
component: resolve => require([`@/views/beforeSale/index.vue`], resolve), component: resolve => require([`@/views/beforeSale/index.vue`], resolve),
...@@ -64,5 +71,17 @@ const staticRoutes = Object.freeze([{ ...@@ -64,5 +71,17 @@ const staticRoutes = Object.freeze([{
component: resolve => require([`@/views/ghPreSale/index.vue`], resolve), component: resolve => require([`@/views/ghPreSale/index.vue`], resolve),
meta: {} meta: {}
}, },
{
name: 'index',
path: '/expert/index',
component: resolve => require([`@/views/expert/index.vue`], resolve),
meta: {}
},
{
name: 'detail',
path: '/expert/detail/:id',
component: resolve => require([`@/views/expert/detail.vue`], resolve),
meta: {}
}
]) ])
export default staticRoutes
\ No newline at end of file \ No newline at end of file
export default staticRoutes
const emoji = [
['微笑', '撇嘴', '色', '发呆', '得意', '流泪', '害羞', '闭嘴'],
['睡', '大哭', '尴尬', '发怒', '调皮', '呲牙', '惊讶', '难过'],
['酷', '囧', '抓狂', '吐', '微笑', '愉快', '白眼', '傲慢'],
['饥饿', '困', '惊恐', '流汗', '憨笑', '大兵', '奋斗', '咒骂'],
['疑问', '嘘', '晕', '折磨', '衰', '骷髅', '敲打', '再见'],
['擦汗', '抠鼻', '鼓掌', '糗大了', '坏笑', '左哼哼', '右哼哼', '哈欠'],
['鄙视', '委屈', '快哭了', '阴险', '亲亲', '吓', '可怜', '菜刀'],
['西瓜', '啤酒', '篮球', '乒乓', '咖啡', '饭', '猪头', '玫瑰'],
['凋谢', '示爱', '爱心', '心碎', '蛋糕', '闪电', '炸弹', '刀'],
['足球', '瓢虫', '便便', '月亮', '太阳', '礼物', '拥抱', '强'],
['弱', '握手', '胜利', '抱拳', '勾引', '拳头', '差劲', '爱你'],
['NO', 'OK', '爱情', '飞吻', '跳跳', '发抖', '怄火', '转圈'],
['磕头', '回头', '跳绳', '投降', '挥手', '激动', '街舞', '左太极'],
['右太极', '嘿哈', '捂脸', '奸笑', '机智', '皱眉', '耶', '社会社会'],
['让我看看', '666', '红包', '蜡烛', '烟花', '福', '庆祝', '爆竹']
]
export default emoji
...@@ -38,44 +38,51 @@ util.getDateStr = function(num) { ...@@ -38,44 +38,51 @@ util.getDateStr = function(num) {
let now = new Date() let now = new Date()
now.setDate(now.getDate() + num) now.setDate(now.getDate() + num)
util.dateFormat(now) util.dateFormat(now)
// let y = now.getFullYear() // let y = now.getFullYear()
// let m = (now.getMonth() + 1) < 10 ? '0' + (now.getMonth() + 1) : (now.getMonth() + 1) // let m = (now.getMonth() + 1) < 10 ? '0' + (now.getMonth() + 1) : (now.getMonth() + 1)
// let d = now.getDate() < 10 ? '0' + now.getDate() : now.getDate() // let d = now.getDate() < 10 ? '0' + now.getDate() : now.getDate()
// return y + "-" + m + "-" + d // return y + "-" + m + "-" + d
return util.dateFormat(now) return util.dateFormat(now)
} }
util.getExplorer = function() { util.getExplorer = function() {
var ua = navigator.userAgent.toLocaleLowerCase(); var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null; var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) { if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = "IE"; browserType = 'IE'
} else if (ua.match(/firefox/) != null) { } else if (ua.match(/firefox/) != null) {
browserType = "火狐"; browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) { } else if (ua.match(/ubrowser/) != null) {
browserType = "UC"; browserType = 'UC'
} else if (ua.match(/opera/) != null) { } else if (ua.match(/opera/) != null) {
browserType = "欧朋"; browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) { } else if (ua.match(/bidubrowser/) != null) {
browserType = "百度"; browserType = '百度'
} else if (ua.match(/metasr/) != null) { } else if (ua.match(/metasr/) != null) {
browserType = "搜狗"; browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) { } else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = "QQ"; browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) { } else if (ua.match(/maxthon/) != null) {
browserType = "遨游"; browserType = '遨游'
} else { } else {
browserType = '谷歌' browserType = '谷歌'
} }
return browserType return browserType
} }
util.debounce=(fn,timer)=> { util.debounce = (fn, timer) => {
let timeout = null; let timeout = null
return function () { return function() {
clearTimeout(timeout); clearTimeout(timeout)
timeout = setTimeout(() => { timeout = setTimeout(() => {
fn.apply(this, arguments); fn.apply(this, arguments)
}, timer); }, timer)
}; }
}
util.openUrl = function(url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
} }
export default util
\ No newline at end of file \ No newline at end of file
export default util
<template>
<div class="ly-emotion">
<slot></slot>
</div>
</template>
<script>
import emoji from '@/util/emo'
export default {
name: 'ly-emotion',
mounted() {
const name = this.$el.innerHTML
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(name)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
let imgHTML = `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
this.$nextTick(() => {
this.$el.innerHTML = imgHTML
})
}
}
</script>
<style scoped>
.ly-emotion {
display: inline-block;
}
.ly-static-emotion {
width: 24px;
height: 24px;
display: inline-block;
}
</style>
<template>
<div class="square-main">
<el-dialog title="选择活动" :visible.sync="dialogVisible" width="1088px" :before-close="handleClose">
<div class="model-panel">
<div class="model-panel-tab">
<label>活动类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane label="权益卡试用" name="3"></el-tab-pane>
<el-tab-pane label="权益套餐" name="4"></el-tab-pane>
<el-tab-pane label="商城券" name="2"></el-tab-pane>
<el-tab-pane label="秒杀活动" name="5"></el-tab-pane>
<el-tab-pane label="无忧服务" name="6" v-if="openFlag"></el-tab-pane>
</el-tabs>
</div>
<div class="model-item-panel" v-if="modelList.length > 0" v-loading="loading">
<div class="model-item" :class="{ checked: selectItem == item }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<div class="model-item-title" :title="item.equityName" v-show="activeName == 3">{{ item.equityName }}</div>
<div class="model-item-title" :title="item.couponName" v-show="activeName == 2">{{ item.couponName }}</div>
<div class="model-item-title" :title="item.couponName" v-show="activeName == 6">{{ item.equityName }}</div>
<div class="model-item-title" :title="item.packageName" v-show="activeName == 4">{{ item.packageName }}</div>
<div class="model-item-title" :title="item.activityName" v-show="activeName == 5">{{ item.activityName }}</div>
<div class="model-item-content" v-show="activeName == 3">领取方式:免费领用</div>
<div class="model-item-content" v-show="activeName == 4">领取方式:付费购买</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 6">有效期:{{ item.effectiveDays }}天</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 3">有效期:无限制</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 2">有效期:{{ item.effectiveStartTime ? item.effectiveStartTime.split(' ')[0] : '' }}~{{ item.effectiveEndTime ? item.effectiveEndTime.split(' ')[0] : '' }}</div>
<div class="model-item-content" v-show="activeName == 6">获取方式:需先购买无忧服务套餐</div>
<div class="model-item-content" v-show="activeName == 6">获取限制:每个服务套餐限领一次</div>
<div class="model-item-content" v-show="activeName == 3"></div>
<div class="model-item-content model-item-contents" v-show="activeName == 3">
试用天数:
<span>{{ item.freeDay }}天</span>
</div>
<div class="model-item-content" v-show="activeName == 2">
使用途径:
{{ item.useChannel == 1 ? '线上商品' : '到店核销' }}
</div>
<div class="model-item-content model-item-weight" v-show="activeName == 6">
赠送天数:
<span>{{ item.effectiveType == 2 ? item.effectivedDay + '天' : '永久有效' }}</span>
</div>
<div class="model-item-content" v-show="activeName == 4 || activeName == 5"></div>
<div class="model-item-content model-item-contents" v-show="activeName == 4">
销售价格:
<span>{{ item.packagePrice }}元</span>
</div>
<div class="model-item-content" v-if="activeName == 5">
开始时间:
{{ item.startTime }}
</div>
<div class="model-item-content" v-if="activeName == 5">
结束时间:
{{ item.endTime }}
</div>
<div class="model-item-content model-item-contents" v-show="activeName == 2">
数量:
<span>{{ item.residueAmount }}</span>
</div>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination v-if="activeName != 3" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect" v-show="modelList.length">确 定</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 2 && memberMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 4 && couponMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 5 && activityMenu">立即添加</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import util from '@/util/util'
export default {
name: 'ActivityModel',
data() {
return {
dialogVisible: false,
couponMenu: false,
loading: false,
activeName: '3',
modelList: [],
pageNum: 1,
pageSize: 12,
tableTotal: 0,
openFlag: 0,
selectItem: {
id: ''
}
}
},
methods: {
handleSelectItem(item) {
this.selectItem = item
if (item.equityClassId) {
this.selectItem.id = item.equityClassId
}
console.log(this.selectItem)
},
handleSelect() {
if (!this.selectItem.id) {
this.$message({
type: 'error',
message: '请选择活动'
})
return
}
this.dialogVisible = false
this.$emit('selectActivity', { marketingId: this.selectItem.id ? this.selectItem.id : this.selectItem.equityClassId, marketingType: this.activeName, marketingName: this.activeName == 3 ? this.selectItem.equityName : this.activeName == 4 ? this.selectItem.packageName : this.activeName == 5 ? this.selectItem.activityName : this.activeName == 2 ? this.selectItem.couponName : this.selectItem.equityName })
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
handleOpen() {
let url
switch (this.activeName) {
case '2':
url = '/marketing/couponManage/index'
break
case '4':
url = '/marketing/memberCenter/setmealAddUpdate?%24title=%25E5%2588%259B%25E5%25BB%25BA%25E5%25A5%2597%25E9%25A4%2590'
break
case '5':
url = '/marketing/seckillActivity/editActivity/1'
break
}
util.openUrl(location.origin + url)
this.dialogVisible = false
},
getModelList() {
this.modelList = []
this.loading = true
let market = ''
switch (this.activeName) {
case '6':
market = 'merchant'
break
case '2':
market = 'getMerchant'
break
case '3':
market = 'getCard'
break
case '4':
market = 'getPackage'
break
case '5':
market = 'getActivity'
break
}
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum
}
if (this.activeName == 3) {
params.tryAble = 1
params.merchantId = this.$globalState.session.merchantId
}
if (this.activeName == 2) {
params.discountTypes = [2, 3, 4]
params.validType = 'valid'
}
if (this.activeName == 5) {
params.currentPage = this.pageNum
params.activityStatus = 2
}
if (this.activeName == 6) {
params.merchantId = this.$globalState.session.merchantId
}
this.$apis.customerTransform[market](params)
.then(res => {
if (this.activeName == 3 || this.activeName == 6) {
this.modelList = res
} else {
this.modelList = res.list ? res.list : res.data
this.tableTotal = res.total
}
this.loading = false
})
.catch(() => {
this.loading = false
})
},
merchantOpen() {
let channel = null
if (location.host == 'scrm.cgacar.com') {
channel = 2
}
this.$apis.customerTransform.merchantOpen({ merchantId: this.$globalState.session.merchantId, channel }).then(res => {
this.openFlag = res.openFlag
})
},
init() {
this.merchantOpen()
this.couponMenu = false
this.activityMenu = false
this.memberMenu = false
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menu.forEach(item => {
if (item.name == 'marketing') {
if (!item.children) {
return
}
item.children.forEach(itm => {
console.log(itm.path)
if (itm.path == '/couponManage/index') {
this.couponMenu = true
}
if (itm.path == '/seckillActivity/index') {
this.activityMenu = true
}
if (itm.path == '^') {
this.memberMenu = true
}
})
}
})
this.dialogVisible = true
this.getModelList()
this.selectItem = {}
},
handleClick() {
this.getModelList()
}
}
}
</script>
<style lang="scss" scoped>
.square-main {
/deep/ {
.el-dialog__footer {
text-align: center;
}
}
}
.model-panel {
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
font-weight: 600;
}
}
}
.model-item-empty {
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
.model-item-panel {
// display: grid;
// grid-template-columns: repeat(4, 25%);
// grid-row-gap: 10px;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 240px;
margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative;
height: 128px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
background: rgba(88, 80, 255, 0.1);
border: 1px solid #5850ff;
}
&-qrcode {
position: absolute;
right: 10px;
bottom: 10px;
width: 60px;
height: 60px;
border: 1px solid #979797;
}
&-title {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
</style>
<template>
<div>
<div class="emotion-box" :style="{ height: height + 'px' }">
<div class="emotion-box-line" v-for="(line, i) in list" :key="i">
<emotion class="emotion-item" v-for="(item, i) in line" :key="i" @click.native="clickHandler(item)">{{ item }}</emotion>
</div>
</div>
</div>
</template>
<script>
import emoji from '@/util/emo'
import Emotion from './Emotion'
export default {
props: {
height: {
type: Number,
default: 200
}
},
data() {
return {
list: emoji
}
},
methods: {
clickHandler(i) {
let emotion = `${i}`
this.$emit('emotion', emotion)
}
},
components: {
Emotion
}
}
</script>
<style scoped lang="scss">
.emotion-box {
z-index: 2004;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
width: 300px;
box-sizing: border-box;
padding: 5px;
overflow: hidden;
overflow-y: auto;
}
.emotion-box-line {
display: flex;
}
.emotion-item {
flex: 1;
text-align: center;
cursor: pointer;
line-height: 23px;
/deep/ {
img {
width: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
}
}
</style>
<template>
<div class="square-main">
<el-dialog title="选择模板" :visible.sync="dialogVisible" width="1142px" :before-close="handleClose" :close-on-click-modal="false">
<div class="model-panel">
<el-form :inline="true" class="message-form" :model="searchForm" ref="searchForm">
<el-form-item label="模板标题">
<el-input v-model="searchForm.title" :size="size" placeholder="请输入模板名称搜索"></el-input>
</el-form-item>
<el-form-item label="创建者">
<el-select v-model="searchForm.createdBy" :size="size" placeholder="全部">
<el-option v-for="item in createdList" :key="item.id" :label="item.createdName" :value="item.createdBy"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :size="size" @click="search">查询</el-button>
</el-form-item>
<el-form-item style="float: right;margin-right: 0;">
<el-button :size="size" icon="el-icon-plus" @click="createModel">新增模板</el-button>
</el-form-item>
</el-form>
<!-- <div class="model-panel-tab">
<label>模板类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane label="售前" name="1"></el-tab-pane>
<el-tab-pane label="售中" name="2"></el-tab-pane>
<el-tab-pane label="售后" name="3"></el-tab-pane>
</el-tabs>
</div>-->
<div class="model-item-panel" v-if="!loading && modelList.length > 0" v-loading="loading">
<div class="model-item" v-for="item in modelList" :key="item.id">
<div class="model-item-radio">
<el-radio v-model="messageRadio" :label="item"></el-radio>
</div>
<div class="model-item-title">
<div class="model-title-h1">{{ item.title }}</div>
<div class="model-title-h2">{{ item.content }}</div>
</div>
<div class="model-item-content">
<div class="model-content">创建人:{{ item.createdName }}</div>
<div class="model-content">创建日期:{{ item.createdTime }}</div>
</div>
<div class="model-item-btn">
<el-button v-if="item.createdBy == userId" type="text" :size="size" @click="editModel(item.id)">编辑</el-button>
</div>
</div>
</div>
<div class="model-item-panel" v-else>
<img src="@/assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[10, 20, 30, 40]" :page-size="pageSize" :total="tableTotal" :layout="layout"></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleClose">取 消</el-button>
<el-button size="small" type="primary" @click="selectModelItem">复制文本</el-button>
</span>
</el-dialog>
<el-dialog :title="modelTitle" :visible.sync="createVisible" width="547px" :before-close="handleCreateClose" :close-on-click-modal="false">
<el-form :model="templateForm" :rules="templateRules" ref="templateForm" label-width="100px" class="templateForm">
<el-form-item label="标题" prop="title">
<el-input v-model="templateForm.title" maxlength="10" show-word-limit placeholder="输入10个字以内的标题,如活动促销"></el-input>
</el-form-item>
<el-form-item label="内容说明" prop="content">
<el-input type="textarea" v-model="templateForm.content" maxlength="600" :rows="7" show-word-limit placeholder="输入不超过600字内的文字说明"></el-input>
</el-form-item>
</el-form>
<div class="template-footer">
<el-button size="small" @click="createModel">取 消</el-button>
<el-button size="small" type="primary" :loading="createLoading" @click="handleCreate">立即创建</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'MessageModel',
data() {
return {
dialogVisible: false,
createVisible: false,
loading: false,
activeName: '1',
messageRadio: {},
modelList: [
// {
// title: '121',
// content: 'jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开',
// createdTime: '2022-01-04'
// }
],
pageNum: 1,
pageSize: 10,
tableTotal: 0,
layout: '',
searchForm: {},
templateForm: {},
templateRules: {
title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
content: [{ required: true, message: '请输入标题', trigger: 'blur' }]
},
createLoading: false,
createdList: [],
modelTitle: '创建群发模板',
userId: ''
}
},
mounted() {
console.log(this.$globalState, '222323')
if (this.$globalState) {
this.userId = this.$globalState.session.id
}
},
methods: {
init() {
this.pageNum = 1
this.messageRadio = {}
this.dialogVisible = true
this.dracImMessage()
this.getCreatedList()
},
selectModelItem() {
this.dialogVisible = false
this.$emit('selectItem', this.messageRadio)
},
handleClick() {
this.dracImMessage()
},
search() {
this.dracImMessage(this.searchForm)
},
handleClose() {
this.dialogVisible = false
this.modelList = []
this.tableTotal = 0
},
dracImMessage(searcher) {
this.modelList = []
this.loading = true
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum
}
if (searcher) {
params.title = searcher.title
params.createdBy = searcher.createdBy
}
this.$apis.customerTransform.templatePage(params).then(res => {
console.log(res)
if (res) {
this.modelList = res.data
this.tableTotal = res.count
if (res.count > 10) {
this.layout = 'pager'
}
}
this.loading = false
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
},
handleCurrentChange(val) {
this.pageNum = val
this.dracImMessage()
console.log(`当前页: ${val}`)
},
createModel() {
this.createVisible = !this.createVisible
if (!this.createVisible) {
this.templateForm = {}
}
},
handleCreate() {
this.$refs.templateForm.validate(valid => {
if (valid) {
console.log(this.templateForm)
this.createLoading = true
const params = {
title: this.templateForm.title,
content: this.templateForm.content
}
let api = 'templateSave'
if (this.templateForm.id) {
api = 'templateUpdate'
params.id = this.templateForm.id
}
console.log(params)
this.$apis.customerTransform[api](params).then(res => {
console.log(res)
this.createLoading = false
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.pageNum = 1
this.createModel()
this.dracImMessage()
}
})
}
})
},
editModel(id) {
this.createModel()
this.modelTitle = '编辑群发模板'
this.getTemplateDetail(id)
},
getCreatedList() {
this.$apis.customerTransform.createdNameList({}).then(res => {
this.createdList = res
})
},
getTemplateDetail(id) {
this.$apis.customerTransform.templateDetail({ id }).then(res => {
console.log(res)
if (res) {
this.templateForm = res
}
})
}
}
}
</script>
<style lang="scss" scoped>
.model-panel {
padding: 0 20px;
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
}
}
}
.model-item-panel {
max-height: 400px;
overflow: auto;
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
.model-item {
display: flex;
padding: 20px;
border-bottom: 1px solid #e9e9e9;
&:last-child {
border-bottom: none;
}
&-radio {
width: 60px;
/deep/ {
.el-radio__input {
margin-top: 10px;
}
.el-radio__label {
display: none;
}
}
}
&-content {
min-width: 210px;
margin-right: 50px;
.model-content {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
}
&-title {
flex: 1;
.model-title-h1 {
font-size: 14px;
font-weight: 400;
max-width: 658px;
color: #333333;
line-height: 20px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.model-title-h2 {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
max-width: 658px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
&-btn {
width: 30px;
height: 40px;
}
}
}
}
.message-form .el-form-item {
margin-bottom: 0 !important;
}
/deep/ .el-pager {
height: 30px;
}
.el-pagination {
margin-top: 21px;
}
.templateForm {
padding: 0 20px;
/deep/ {
.el-textarea__inner {
background-color: #fff;
}
.el-textarea .el-input__count {
background-color: #fff;
}
}
}
.template-footer {
text-align: center;
border-top: 1px solid #e6e6e6;
padding-top: 16px;
margin-bottom: -14px;
}
/deep/ {
.el-dialog__body {
padding: 30px 0;
}
}
</style>
<template>
<div class="member-wrapper">
<div class="member-left">
<div class="member-title">
预选
<span>仅筛选有外部客户联系人的成员</span>
</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;">
<el-popover ref="popover" placement="bottom" width="215" trigger="click" v-model="popoverVisible" @show="onShowPopover" @hide="onHidePopover">
<el-tree class="select-tree" :data="treeData" :props="defaultProps" default-expand-all @node-click="handleNodeClick"></el-tree>
<el-input v-model="searchForm.department" slot="reference" :size="size" readonly placeholder="请选择所在门店/部门" :class="{ rotate: popoverVisible }" suffix-icon="el-icon-arrow-down" @keyup.enter.native="search"></el-input>
</el-popover>
</el-form-item>
<el-form-item label="姓名" style="margin-bottom: 0;">
<el-input :size="size" v-model.trim="searchForm.name" @keyup.enter.native="search" clearable placeholder="请输入姓名搜索"></el-input>
</el-form-item>
<!-- <el-form-item>
<el-checkbox v-model="searchForm.checked">仅看跟进专员</el-checkbox>
</el-form-item>-->
<el-form-item style="margin-bottom: 0;">
<el-button type="primary" :size="size" @click="search">查询</el-button>
</el-form-item>
</el-form>
<div class="table-content" style="max-height: 456px;">
<GLTable v-loading="loading" ref="empTable" :tableData="tableEmpData" :tableParams="tableParams" :hasNum="false" :hasPage="false" :noDataImg="url" @row-click="rowClick">
<div slot="radio" slot-scope="scope">
<el-radio v-model="selectPerson" :label="scope.scope">&nbsp;</el-radio>
</div>
<div slot="staffName" slot-scope="scope">
<span>{{ scope.scope.staffName }}</span>
<span class="staff-title" v-show="scope.scope.staffTitle">{{ scope.scope.staffTitle }}</span>
</div>
</GLTable>
</div>
</div>
<div class="member-checked">
<span class="name">已选择:{{ selectPerson && selectPerson.staffName }}{{ selectPerson && selectPerson.staffTitle }}</span>
<el-checkbox v-model="checked" @change="checkChange">仅看跟进专员</el-checkbox>
</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)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
</div>
</div> -->
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'SelectMember',
props: ['selectData'],
data() {
return {
url: url,
selectPerson: null,
searchForm: {},
checked: '',
treeData: [],
defaultProps: {
children: 'children',
label: 'departmentName'
},
popoverVisible: false,
loading: false,
// 表格参数
tableParams: {
checkSelectKey: 'id',
checkSelectVal: [],
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// // 多选ref的名称
// mutiSelectName: 'salelist',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '',
prop: 'radio',
addHtml: 'radio',
width: '50'
},
{
label: '姓名',
prop: 'staffName',
addHtml: 'staffName'
},
{
label: '所在门店/部门',
prop: 'departmentName'
},
{
label: '跟进专员类型',
prop: 'followerName',
formatter: cellValue => {
return cellValue.followerName ? cellValue.followerName : '-'
}
}
]
},
tableEmpData: [],
allTreeData: [],
currentTreeData: [],
innerTags: []
}
},
mounted() {
console.log(123456)
this.listDepartmentTree(false)
},
methods: {
selectionTable(val) {
console.log(456)
this.innerTags = val
// this.$emit('selectTable', val)
},
// 清空搜索条件
resetSearch() {
this.searchForm = {}
this.tableEmpData = this.allTreeData
},
// 显示时触发
onShowPopover() {
this.popoverVisible = true
},
// 隐藏时触发
onHidePopover() {
this.popoverVisible = false
},
listDepartmentTree(isFollowerStaff) {
const params = { addChildrensFlag: true }
this.loading = true
params.isHavCustomer = true
params.isFollowerStaff = isFollowerStaff
this.$apis.customerTransform.listDepartmentTree(params).then(res => {
console.log(res)
this.loading = false
if (res) {
this.tableEmpData = this.getEmployee(res)
this.allTreeData = this.getEmployee(res)
this.currentTreeData = this.getEmployee(res)
this.treeData = res
this.$refs.empTable.tableHeightValues = this.tableEmpData.length ? '' : '230px'
if (this.selectData && this.selectData.length) {
this.selectData.forEach(item => {
this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(item)
})
}
} else {
this.treeData = []
}
})
},
handleNodeClick(data) {
console.log(data)
this.searchForm.department = data.departmentName
this.currentTreeData = data
this.onHidePopover()
},
getEmployee(d, arr = []) {
d.reverse().forEach(i => {
if (i.entmicroStaffResponses) {
i.entmicroStaffResponses.forEach(j => {
const flag = arr.find(m => m.id == j.id)
if (!flag) {
arr.push(j)
}
})
}
if (i.children) {
this.getEmployee(i.children, arr)
}
})
return arr
},
search() {
this.tableEmpData = []
const data = this.currentTreeData
const keyword = this.searchForm.name
let arr = []
// this.loading = true
console.log(keyword, data, this.tableEmpData)
if (data instanceof Array) {
if (keyword) {
data.forEach(i => {
if (i.staffName.indexOf(keyword) != -1) {
this.tableEmpData.push(i)
}
})
} else {
console.log(this.allTreeData, '---')
this.tableEmpData = this.allTreeData
}
} else if (data instanceof Object) {
if (data.entmicroStaffResponses) {
if (keyword) {
data.entmicroStaffResponses.forEach(i => {
if (i.staffName.indexOf(keyword) != -1) {
this.tableEmpData.push(i)
}
})
} else {
this.tableEmpData = this.tableEmpData.concat(data.entmicroStaffResponses)
}
}
if (data.children) {
data.children.forEach(i => {
if (i.entmicroStaffResponses) {
i.entmicroStaffResponses.forEach(j => {
if (keyword) {
if (j.staffName.indexOf(keyword) != -1) {
const flag = this.tableEmpData.find(m => m.id == j.id)
if (!flag) {
this.tableEmpData.push(j)
}
}
} else {
const flag = this.tableEmpData.find(m => m.id == j.id)
if (!flag) {
this.tableEmpData.push(j)
}
}
})
}
})
}
}
},
remove(item) {
this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(item)
},
rowClick(row) {
console.log(row)
// this.$refs.empTable.$refs.salelistMutiTable.toggleRowSelection(row)
this.selectPerson = row
},
checkChange(val) {
console.log(val)
this.searchForm = {}
this.listDepartmentTree(val)
}
}
}
</script>
<style lang="scss" scoped>
.el-input.el-input--suffix.rotate .el-input__suffix .el-icon-arrow-down {
transform: rotate(-180deg);
}
.select-tree {
max-height: 400px;
overflow-y: scroll;
}
.staff-title {
position: relative;
font-size: 12px;
padding: 0 10px;
line-height: 12px;
color: #999;
&::before {
content: '';
position: absolute;
top: 50%;
left: 5px;
transform: translateY(-50%);
display: inline-block;
width: 1px;
height: 12px;
background-color: #999;
}
}
.member-wrapper {
display: flex;
.member-title {
font-size: 16px;
font-weight: 600;
line-height: 22px;
margin-bottom: 6px;
span {
display: inline-block;
padding-left: 5px;
font-size: 12px;
color: #999;
font-size: 500;
}
}
.member-left {
width: 800px;
.member-content {
border: 1px solid #eee;
.member-form {
padding: 10px 20px;
}
.table-content {
max-height: 456px;
overflow: auto;
border: 1px solid #eee;
}
}
.member-checked {
display: flex;
justify-content: space-between;
font-size: 14px;
.name {
color: #5850ff;
}
/deep/ .el-checkbox__label {
font-size: 14px;
color: #333333;
}
}
}
.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%;
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
border: 1px solid #eee;
border-top: none;
box-sizing: border-box;
color: #606266;
display: inline-block;
padding: 8px 10px;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
height: calc(100% - 86px);
display: flex;
align-items: center;
max-height: 500px;
overflow: auto;
// margin-bottom: 10px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
/deep/ input {
/* input { */
/* background-color: red!important; 调试用的样式 */
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
}
.el-tag {
margin-right: 10px;
line-height: 22px;
margin-bottom: 5px;
height: 24px;
}
</style>
<template>
<div class="w-textarea" ref="wTextarea">
<div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @click="inputClick($event)" @focus="onFocus" @blur="onBlur" @keydown.delete="handleDelete($event)" @input="handleInput($event.target)"></div>
<!-- <div class="w-textarea_tools" v-if="tools.length > 0 || maxlength">
<button
class="w-textarea_tools__item"
v-for="item in tools"
:key="item.type"
@click="openTagDialog(item.type)"
>{{item.text}}</button>
<span
:class="['w-textarea_tools__text',
count.num < 0 ? '__danger' : '']"
v-if="maxlength"
>{{count.text}}</span>
</div>-->
<!-- <div class="w-textarea_dialog">
<slot></slot>
</div>-->
</div>
</template>
<script>
import emoji from '@/util/emo'
export default {
name: 'wTextarea',
data() {
return {
// 记录currentText以计算长度
currentText: this.value,
// 为input区域生成随机id,当在页面上有多个组件时,用于监听光标的变化
contentId: `content${this.getGuid()}`,
// 输入的时候锁定,禁止更新innerHTML
isLocked: false,
isInsert: false,
// 记录当前选中tag的ID
currentTagId: null,
// 当前光标位置
savedRange: {}
}
},
props: {
value: {
type: String,
default: ''
},
tag: {
// 自定义模版标签的标签名
type: String,
// 默认使用wise作为标签名,并添加了默认样式
// 当使用其他标签名的时候,需要另写标签样式
default: 'wise'
},
tools: {
// 自定义扩展功能:超链接'link',模版标签'tag'
type: Array,
default() {
return [
{ type: 'link', text: '添加超链接' },
{ type: 'tag', text: '添加模版标签' }
]
}
},
maxlength: {
// 最大输入长度
type: [String, Number],
default: ''
}
},
computed: {
count() {
// 字符长度记数
let num = this.maxlength - this.currentText.length
let text = num < 0 ? `已超出${Math.abs(num)}个字符` : `还可以输入${num}个字符`
return { num, text }
}
},
mounted() {
// 初始化数据
this.currentText && (this.$refs.wTextareaContent.innerHTML = this.currentText)
// 创建模版标签的style
this.createStyle()
// 每次光标变化的时候,保存 range
document.addEventListener('selectionchange', this.selectHandler)
},
beforeDestroy() {
// 卸载事件
document.removeEventListener('selectionchange', this.selectHandler)
},
methods: {
updateData(text) {
this.$emit('input', text)
},
createStyle() {
// 为自定义的模版标签添加样式,使之不可编辑
let style = document.createElement('style')
style.innerHTML = `.w-textarea ${this.tag} {
cursor: default;
-webkit-user-modify: read-only !important;
}`
this.$refs.wTextarea.appendChild(style)
},
closeModal() {
this.form.text = ''
this.showModal = false
},
openTagDialog(type) {
// if (addLink)
// 将事件抛给父组件处理
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
this.$emit('add', type)
},
addTag(text) {
// // 创建模版标签
// let node = document.createElement(this.tag)
// if (navigator.userAgent.indexOf('Firefox') > 0) {
// node.setAttribute('contenteditable', 'false')
// }
// node.innerText = text
// // 添加id便于删除
// node.id = this.getGuid()
// this.insertNode(node)
let textarea = document.getElementsByClassName('w-textarea_input')
console.log(textarea[0].childNodes, textarea[0]?.childNodes?.length)
},
addCardLink() {
let textarea = document.getElementsByClassName('w-textarea_input')
console.log(textarea[0].childNodes, textarea[0]?.childNodes?.length)
let pnode = document.createElement('span')
let arr = ['车主朋友,您好!\n我是您的福利官,欢迎您领取电子质保卡,\n请点击下方链接进行领取及查看:\n', 'https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/', '\n祝您用车愉快!']
if (textarea[0]?.childNodes?.length && (textarea[0]?.childNodes?.length != 1 || textarea[0]?.childNodes[0]?.nodeName != 'BR')) {
arr[0] = '\n' + arr[0]
}
arr.forEach((item, index) => {
let node = document.createElement('span')
node.innerText = item
if (index == 1) node.setAttribute('style', 'color:#409eff;')
pnode.appendChild(node)
})
this.insertNode(pnode)
},
addNode() {
let target = this.$refs.wTextareaContent
this.updateData(target.innerHTML)
},
promiseAdd(item, num) {
return new Promise((resolve, reject) => {
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML += item
document.querySelector('.w-textarea_input').focus()
resolve()
}, num * 100)
})
},
promiseAddNode(item, num) {
return new Promise((resolve, reject) => {
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML += item
document.querySelector('.w-textarea_input').focus()
resolve()
}, num * 100)
})
},
addContent(attContent) {
attContent.forEach(async (item, index) => {
await this.promiseAdd(item, index)
this.addTag('@昵称')
// await this.promiseAddNode(item, index)
// this.addNode()
// t2(item)
})
// for (let i = 0; i < attContent.length; i++) {
// if (attContent[i] || (i == 0 && !attContent[i])) {
// document.querySelector('.w-textarea_input').innerHTML += attContent[i]
// document.querySelector('.w-textarea_input').focus()
// document.querySelector('.w-textarea_input').click()
// this.$nextTick(()=>{
// this.addTag('@昵称')
// })
// }
// // 代码格式
// // (function(a) {})(b)
// }
},
addLink(text, url) {
// 创建a标签
let node = document.createElement('a')
node.innerText = text
node.href = url
node.target = 'blank'
this.insertNode(node)
},
addImg(url) {
// 创建a标签
let node = document.createElement('img')
node.src = url
// node.setAttribute('ondragstart', 'return false;')
this.insertNode(node)
},
onFocus() {
this.isLocked = true
this.isInsert = true
},
onBlur() {
this.isLocked = false
},
insertNode(node) {
// 在内容中插入标签
// 删掉选中的内容(如有)
if (this.savedRange.startContainer) {
this.insertNodeFirst(node)
} else {
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
this.insertNodeFirst(node)
document.querySelector('.w-textarea_input').blur()
}, 100)
}
},
insertNodeFirst(node) {
this.savedRange.deleteContents()
// 插入链接
if (this.isInsert) {
this.savedRange.insertNode(node)
} else {
document.querySelector('.w-textarea_input').appendChild(node)
}
this.isInsert = false
// 更新双向绑定数据
let target = this.$refs.wTextareaContent
if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) {
this.updateData(target.innerHTML + '&nbsp;')
} else {
this.updateData(target.innerHTML)
}
let htm = target.innerHTML
const list = emoji.flat(Infinity)
const cutImg = htm.replaceAll('<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/', '')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
console.log(replaceImg)
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = Textnode.innerText.substring(0, 600)
this.$emit('updateText', this.currentText)
},
placeCaretAtEnd(el) {
//传入光标要去的jq节点对象
el.focus()
if (typeof window.getSelection != 'undefined' && typeof document.createRange != 'undefined') {
var range = document.createRange()
range.selectNodeContents(el)
range.collapse(false)
var sel = window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
} else if (typeof document.body.createTextRange != 'undefined') {
var textRange = document.body.createTextRange()
textRange.moveToElementText(el)
textRange.collapse(false)
textRange.select()
}
},
handleInput(target) {
// 即时更新数据
this.updateData(target.innerHTML)
let htm = target.innerHTML
console.log(htm)
const list = emoji.flat(Infinity)
const cutImg = htm.replaceAll('<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/', '')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = Textnode.innerText.substring(0, 600)
this.$emit('updateText', this.currentText)
},
handleDelete(e) {
// 监听“删除”事件
if (this.currentTagId) {
// 若已选中模版标签,直接删除dom节点
let t = document.getElementById(this.currentTagId)
this.$refs.wTextareaContent.removeChild(t)
this.currentTagId = null
// 阻止浏览器默认的删除事件,并手动更新数据
e.preventDefault()
this.handleInput(e.target)
}
},
inputClick(e) {
// 监听点击事件
this.isLocked = true
const TAG_NAME = e.target.nodeName
if (TAG_NAME === this.tag.toUpperCase()) {
// 点击模版标签时,记录id
this.currentTagId = e.target.id
e.target.className = 'active'
} else if (this.currentTagId) {
// 清空active样式
let target = document.getElementById(this.currentTagId)
target.className = ''
this.currentTagId = null
} else {
this.currentTagId = null
}
},
getGuid() {
// 生成随机ID
return `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
},
selectHandler() {
// 监听选定文本的变动
let sel = window.getSelection()
let range = sel.rangeCount > 0 ? sel.getRangeAt(0) : null
if (range && range.commonAncestorContainer.ownerDocument.activeElement.id === this.contentId) {
this.savedRange = range
}
}
},
watch: {
value(val) {
// 非锁定状态下,实时更新innerHTML
if (!this.isLocked) {
this.$refs.wTextareaContent.innerHTML = val
}
}
}
}
</script>
<style lang="scss">
// 给标签默认样式,不可scoped
.w-textarea {
wise {
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 2px;
margin: 0 5px;
color: #26a2ff;
// padding: 0 1px;
white-space: nowrap;
cursor: default;
-webkit-user-modify: read-only !important;
}
img {
width: 24px;
height: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
.active {
background: #dcdfe6;
}
}
</style>
<style lang="scss" scoped>
$borderColor: #dcdfe6;
$bgColor: #f5f7fa;
$textColor: #666;
.w-textarea {
width: 100%;
box-sizing: border-box;
// border-radius: 4px;
border: 1px solid $borderColor;
overflow: hidden;
min-height: 200px;
// margin-bottom: 15px;
overflow: hidden;
position: relative;
&_input {
width: 100%;
height: 200px;
min-height: 100px;
box-sizing: border-box;
padding: 10px;
line-height: 1.5;
word-break: break-word;
// 允许编辑,禁止富文本
-webkit-user-modify: read-write-plaintext-only !important;
&:focus {
outline: none;
}
}
&_tools {
padding: 0 10px;
height: 40px;
line-height: 40px;
border-top: 1px solid $borderColor;
background-color: $bgColor;
color: $textColor;
font-size: 12px;
&__item {
display: inline-block;
line-height: 1;
padding: 5px 8px;
margin-right: 8px;
color: $textColor;
cursor: pointer;
border: 1px solid $borderColor;
border-radius: 4px;
background: #fff;
transition: all 0.3s;
&:hover {
background: $bgColor;
opacity: 0.7;
}
&:focus {
outline: none;
}
}
&__text {
display: inline-block;
line-height: 40px;
padding: 0 8px;
float: right;
color: $textColor;
cursor: default;
transition: all 0.3s;
&:hover {
opacity: 1;
}
&.__danger {
color: red;
}
}
}
}
</style>
<template>
<div class="welcome-box">
<!-- <div class="required">入群欢迎语</div> -->
<div class="content">
<div class="content-bg">
<!-- <div id="nick" contenteditable="false" class="nickname">
@昵称
<i class="el-icon-error"></i>
</div>-->
<!-- <div id="toolbar-container" style="display: none;"></div>
<div id="text-container" class="editor-container"></div>-->
<wTextarea ref="textContent" v-model="textValue" @updateText="updateText"></wTextarea>
<!-- <el-input
type="textarea"
:rows="9"
maxlength="600"
show-word-limit
v-model="guestForm.name"
@input="textInput"
style="-webkit-user-modify: read-write-plaintext-only !important;"
placeholder="请输入内容"
></el-input>-->
<div v-for="(itm, index) in previewList" :key="itm.id">
<div class="welcome-file" v-if="itm.attType != 1">
<template v-if="itm.attType == 2">
<i v-show="index == previewList.length - 1 && loading" class="el-icon-loading"></i>
<img v-show="!loading" src="@/assets/guestCustom/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 3">
<img src="@/assets/guestCustom/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 7">
<img src="@/assets/guestCustom/icon-applet.png" alt />
<span :title="itm.attContent.marketingName">{{ itm.attContent.marketingName }}</span>
</template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/guestCustom/icon-applet.png" alt />
<span :title="itm.attContent.title">{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</div>
<div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.id">
<!-- <i class="el-icon-circle-plus-outline"></i> -->
<img :src="require(`@/assets/guestCustom/add-${item.type}.png`)" alt v-if="item.id == 1" @click="selectEmotion" />
<img :src="require(`@/assets/guestCustom/add-${item.type}.png`)" v-else alt />
<span v-if="item.id == 1" @click.stop="selectEmotion">{{ item.name }}</span>
<span v-else>{{ item.name }}</span>
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input upload-img" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<input v-else-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" />
<el-link v-else-if="item.type == 'link' || item.type == 'nickname' || item.type == 'acivity'" style="opacity: 0" @click="handleFun(item.funName)">{{ item.name }}</el-link>
</div>
</div>
</div>
<div v-show="emotionStatus" class="emotion-panel">
<emotion class="emotion-panel-box" @emotion="handleEmotion" :height="280"></emotion>
</div>
<!-- <div class="tips-text">
<p>当「精品升级」小程序提交升级订单时,</p>
<p>
客户扫描订单质保码添加
<span style="color:#409eff">&nbsp;待选择</span>
,
</p>
<p>客户添加成功自动推送欢迎语,建议插入质保链接。</p>
</div> -->
</div>
<ActivityModel ref="activity" @selectActivity="selectActivity"></ActivityModel>
<MessageModel ref="message" @selectItem="selectMessage"></MessageModel>
</div>
</template>
<script>
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6,
ACTIVITY: 7
}
import emoji from '@/util/emo'
import ActivityModel from './activityModel'
import MessageModel from './messageModel'
import Emotion from './emotionWords'
import wTextarea from './tag-textarea'
import { utils } from 'glsx-common'
import { pictureUpload } from '@/api/modules/common'
export default {
name: 'WelcomeWords',
components: {
ActivityModel,
Emotion,
wTextarea,
MessageModel
},
props: { eventBus: Object, btnList: Array, form: String },
data() {
return {
loading: false,
emotionStatus: false,
// btnList: [
// {
// id: 1,
// name: '表情',
// funcName: '',
// type: 'expression',
// limitSize: 10
// },
// {
// id: 2,
// name: '图片',
// funcName: '',
// type: 'img',
// limitSize: 10
// },
// {
// id: 3,
// name: '昵称',
// type: 'nickname',
// funName: 'nickname'
// },
// {
// id: 4,
// name: '活动',
// type: 'acivity',
// funName: 'activity'
// }
// ],
guestForm: {},
previewList: [],
sendType: '',
sendTime: '',
sendDate: '',
editor: {},
textValue: ''
}
},
mounted() {
// const _this = this
// this.editor = new E('#toolbar-container', '#text-container')
// this.editor.config.zIndex = 100
// this.editor.config.height = 165
// this.editor.config.colors = ['#000000', '#f7f7f7']
// this.editor.config.focus = false
// this.editor.config.onchange = function(newHtml) {
// console.log('change 之后最新的 html', newHtml)
// console.log(_this.editor.txt.text())
// const val = _this.editor.txt.text()
// _this.textInput(val)
// }
// this.editor.config.onchangeTimeout = 500
// this.editor.create()
this.eventBus.$emit('update', this.previewList)
},
methods: {
selectEmotion() {
this.emotionStatus = !this.emotionStatus
},
handleEmotion(i) {
this.emotionStatus = false
const list = emoji.flat(Infinity)
let index = list.indexOf(i) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
this.$refs.textContent.addImg(`https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png`)
},
updateText(val) {
this.textInput(val)
},
// 上传图片
handleImgChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
this.loading = true
reader.readAsDataURL(file)
this.previewList.push({
attType: ATT_TYPE.IMAGE,
attContent: ''
})
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
console.log(this.$apis, 789789)
pictureUpload({ file: base64 }).then(res => {
if (res) {
let len = this.previewList.length - 1
this.previewList[len].attContent = res
document.querySelector('.upload-img').value = ''
} else {
let len = this.previewList.length - 1
this.previewList.splice(len, 1)
}
this.loading = false
})
}
}
},
// 上传视频
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
pictureUpload({ file: base64 }).then(res => {
if (res) {
this.previewList.push({
attType: ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
},
handleFun(name) {
if (name == 'nickname') {
this.$refs.textContent.addTag('@昵称')
} else if (name == 'activity') {
this.$refs.activity.init()
} else if (name == 'message') {
this.$refs.message.init()
} else if (name == 'link') {
// 车主朋友,您好!
// 我是您的福利官,欢迎您领取电子质保卡,
// 请点击下方链接进行领取及查看:https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/祝您用车愉快!
this.$refs.textContent.addCardLink('@昵称')
}
},
close(index) {
this.previewList.splice(index, 1)
this.eventBus.$emit('update', this.previewList)
},
textInput(val) {
const hasText = this.previewList.some(item => item.attType == 1)
if (val) {
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: ATT_TYPE.TEXT
})
}
} else {
this.previewList.shift(0)
}
},
selectActivity(val) {
let idx
const hasActivity = this.previewList.some((item, index) => {
if (item.attType == 7) {
idx = index
return item
}
})
if (val) {
if (hasActivity) {
this.$set(this.previewList, idx, {
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
} else {
this.previewList.push({
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
}
}
},
selectMessage(val) {
console.log(val)
const content = val.content
this.updateText(content)
this.textValue = content
// this.previewList[0] = {
// attContent: content,
// attType: ATT_TYPE.TEXT
// }
},
insertHtmlAtCaret(html) {
var sel, range, frag
if (window.getSelection) {
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
var el = document.createElement('span')
el.innerHTML = '<span contenteditable="false" class="nickname">@昵称<i class="el-icon-error"></i></span>'
// var el = document.createElement('div')
// el.innerHTML = html
frag = document.createDocumentFragment()
var node
var lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
if (lastNode) {
range = range.cloneRange()
range.setEndAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
}
},
changeInput: utils.debounce(function() {
var allNodes = document.getElementById('editor').childNodes
var str = ''
allNodes.forEach(item => {
if (item.className == 'nickname') {
str += item.innerText
} else if (item.data) {
str += item.data
}
})
this.textInput(str)
}, 300),
updateList(val) {
console.log(val)
this.previewList = val
this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == 1)
let attContent = obj.attContent.replaceAll('[@昵称]', '<wise id="1">@昵称</wise>')
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
})
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML = htm
}, 100)
}
}
}
</script>
<style lang="scss" scoped>
/deep/.w-textarea_input {
background-color: #fff;
}
.welcome-box {
}
.emotion-panel {
position: relative;
height: 0px;
&-box {
position: absolute;
top: -320px;
}
}
.content-bg {
background-color: #f7f7f7;
}
.content {
display: inline-block;
vertical-align: text-top;
// width: calc(100% - 103px);
width: 640px;
// margin-left: 12px;
.welcome-file {
display: flex;
align-items: center;
color: #999;
line-height: 20px;
padding: 10px;
margin-bottom: 10px;
border-left: 1px solid #dcdfe6;
border-right: 1px solid #dcdfe6;
img {
width: 20px;
height: 20px;
margin-right: 5px;
}
span {
display: inline-block;
margin-right: 20px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 14px;
}
i {
font-size: 16px;
cursor: pointer;
}
.el-icon-loading {
font-size: 24px;
}
&:last-child {
margin-bottom: 0;
}
}
.btn-group {
background-color: #fff;
padding: 6px 0 6px 20px;
border: 1px solid #dcdfe6;
border-top: 0;
.add-btn {
display: inline-flex;
position: relative;
align-items: center;
padding-right: 25px;
font-size: 16px;
color: #666;
cursor: pointer;
span {
font-size: 14px;
margin-left: 5px;
cursor: pointer;
}
input {
position: absolute;
width: 100%;
cursor: pointer;
font-size: 0;
height: 40px;
}
img {
width: 16px;
height: 16px;
cursor: pointer;
}
.el-link {
position: absolute;
width: 100%;
}
}
}
.date-picker {
margin-top: 10px;
font-size: 14px;
color: #999;
}
}
.required {
display: inline-block;
line-height: 40px;
text-align: right;
width: 90px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
.form-tips {
font-size: 12px;
color: #999;
}
.form-upload {
position: absolute;
top: 0;
width: 140px;
// width: 100%;
height: 100%;
cursor: pointer;
z-index: 1;
}
/deep/ {
.el-textarea__inner {
background-color: #f7f7f7;
border-radius: 0;
}
.el-textarea__inner:focus {
border-color: #dcdfe6;
}
.el-textarea .el-input__count {
background-color: #f7f7f7;
}
}
.upload {
position: relative;
}
.upload-bg {
position: relative;
width: 140px;
height: 140px;
background-color: #f7f7f7;
color: #999;
border: 1px dashed #dcdfe6;
i {
position: absolute;
top: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 30px;
}
.upload-text {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
}
}
.tips-text {
margin-top: 8px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 24px;
}
// .tips-text {
// display: flex;
// align-items: center;
// justify-self: center;
// color: #000;
// font-size: 14px;
// padding: 0 16px;
// margin-top: 10px;
// background-color: rgba(230, 233, 255, 0.49);
// border: 1px solid rgba(88, 80, 255, 0.49);
// border-radius: 4px;
// .tips-icon {
// width: 14px;
// height: 14px;
// margin-right: 8px;
// }
// }
// 编辑器
.editor-container {
border: 1px solid #dcdfe6;
min-height: 165px;
/deep/ {
.w-e-text {
background-color: #f7f7f7;
}
}
}
.text-editor {
outline: 0;
width: 100%;
min-height: 200px;
max-height: 200px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
padding: 5px;
line-height: 20px;
font-size: 12px;
word-wrap: break-word;
overflow-x: hidden;
overflow-y: auto;
_overflow-y: visible;
}
/deep/.nickname {
display: inline;
// width: 64px;
// height: 20px;
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 2px;
margin: 0 5px;
i {
font-size: 10px;
}
}
</style>
<template>
<div class="expert-detail">
<div class="header">
<span class="title">基础信息</span>
<span class="tip">该配置页面用于配置「精品升级」小程序质保卡客户拉新,配置订单类型后,客户扫码质保卡活码即可添加员工企微号。</span>
</div>
<div class="detail-wrap">
<el-form class="form" ref="form" :model="basicForm" label-width="128px">
<el-form-item label="客户类型">
<el-select v-model="basicForm.condition" placeholder="请选择客户类型">
<el-option v-for="item in menberType" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="轻改专家">
<el-button size="small" icon="el-icon-plus" @click="openMembers">
选择成员
</el-button>
<span>所属商户:xx门店</span>
</el-form-item>
<el-form-item label="欢迎语">
<!-- <label slot="label" class="required">群发内容</label> -->
<WelcomeWords ref="welcome" :btnList="btnList" :eventBus="eventBus"></WelcomeWords>
<div class="tips-text">
<p>当「精品升级」小程序提交升级订单时,</p>
<p>
客户扫描订单质保码添加
<span style="color:#409eff">&nbsp;{{ (selectPerson && selectPerson.staffName) || '待选择' }}</span>
,
</p>
<p>客户添加成功自动推送欢迎语,建议插入质保链接。</p>
</div>
</el-form-item>
</el-form>
</div>
<glsx-dialog :title="'选择成员'" :width="'1142px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible">
<SelectMember ref="membersForm" v-if="membersVisible" :selectData="selectData"></SelectMember>
</glsx-dialog>
</div>
</template>
<script>
import Vue from 'vue'
import emoji from '@/util/emo'
import WelcomeWords from './components/welcomeWords.vue'
import SelectMember from './components/selectMember.vue'
import glsxDialog from '@/components/glsx-dialog/index.vue'
// import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'expert_detail',
components: {
WelcomeWords,
SelectMember,
glsxDialog
},
data() {
return {
size: 'small',
eventBus: new Vue(),
menberType: [
{
value: '1',
label: '升级客户'
},
{
value: '2',
label: '战败客户'
}
],
btnList: [
{
id: 1,
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
id: 2,
name: '图片',
funcName: '',
type: 'img',
limitSize: 10
},
{
id: 3,
name: '昵称',
type: 'nickname',
funName: 'nickname'
},
{
id: 4,
name: '活动',
type: 'acivity',
funName: 'activity'
},
// {
// id: 5,
// name: '模板',
// type: 'nickname',
// funName: 'message'
// },
{
id: 6,
name: '插入质保链接',
type: 'link',
funName: 'link'
}
],
membersVisible: false,
selectData: [],
basicForm: {},
selectPerson: null
}
},
methods: {
addConfig() {},
// 成员弹窗
handleConfirm() {
console.log(this.$refs.membersForm.selectPerson)
if (this.$refs.membersForm.selectPerson) {
this.selectPerson = this.$refs.membersForm.selectPerson
this.openMembers()
} else {
this.$message({
type: 'error',
message: '请选择成员'
})
}
},
openMembers() {
this.membersVisible = !this.membersVisible
}
}
}
</script>
<style lang="scss" scoped>
.expert-detail {
background-color: #fff;
height: calc(100vh - 80px);
.header {
height: 56px;
font-size: 16px;
color: #333;
font-weight: 600;
border-bottom: 1px solid #d8d8d8;
line-height: 56px;
padding: 0 24px;
.tip {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
margin-left: 8px;
}
}
.detail-wrap {
padding: 40px;
.form {
/deep/.el-form-item {
& > .el-form-item__label {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
}
}
}
.tips-text {
margin-top: 8px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 24px;
}
}
}
</style>
<template>
<div class="expert-container">
<div>
<GLButton :size="size" fn="新增配置" icon="el-icon-plus" type="primary" @click="addConfig(1)">新增配置</GLButton>
<span class="btnTip">配置轻改专家,形成业务活码,客户通过「精品升级」订单扫码后添加该员工。</span>
</div>
<div class="expert-wrap">
<glsx-combi-form ref="expertRef" labelWidth="120px" defaultWidth="215px" :formObj="batchListSearch" :formData="expertForm">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" class="resetBtn" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
<GLTable ref="userDetailTable" :searchForm="batchListSearch" :tableParams="batchTableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="table-btns" slot-scope="scope">
<GLButton fn="编辑" type="text" @click="addConfig(2)">编辑</GLButton>
<el-button type="text" @click="addConfig(3)">{{ scope.scope.status == 1 ? '禁用' : '启用' }}</el-button>
<GLButton fn="编辑" type="text" @click="addConfig(2)">删除</GLButton>
</div>
</GLTable>
<div class="default-box">
<img class="default-img" :src="imagBaseURL + 'serviceser.png'" alt="" />
<span class="tip">用于「精品升级」客户线上化,配置轻改专家成员,可通过精品升级的质保卡活码拉新。</span>
<GLButton :size="size" fn="新增配置" icon="el-icon-plus" type="primary" @click="addConfig(1)">配置门店轻改专家</GLButton>
</div>
</div>
</div>
</template>
<script>
const imagBaseURL = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/'
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'expert_index',
data() {
return {
imagBaseURL,
size: 'small',
getListApi: '',
batchListSearch: {
merchantName: '',
name: '',
type: ''
},
expertForm: [
{
label: '选择门店',
name: 'mobile',
type: 'input'
},
{
label: '员工姓名',
name: 'merchantName',
type: 'input',
maxlength: 15
},
{
label: '选择客户类型',
name: 'memberType',
type: 'select',
optionList: [
{
memberId: '',
memberName: '全部'
},
{
memberId: 1,
memberName: '正式会员'
},
{
memberId: 2,
memberName: '试用会员'
}
],
optionId: 'memberId',
optionLabel: 'memberName',
optionsName: 'memberType'
}
],
batchTableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '编号',
prop: 'mobile'
},
{
label: '所属门店/部门',
prop: 'merchantName',
formatter: cellValue => {
return cellValue.memberType || '--'
}
},
{
label: '添加成员',
prop: 'sdadsa'
},
{
label: '客户类型',
prop: 'activeTypeDescList'
},
{
label: '欢迎语',
prop: 'status'
}
]
}
}
},
components: {
glsxCombiForm
},
methods: {
addConfig() {
this.$router.push({ path: '/expert/detail/5' })
}
}
}
</script>
<style lang="scss" scoped>
.btnTip,
.tip {
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
}
.btnTip {
font-size: 14px;
line-height: 22px;
margin-left: 16px;
}
.expert-wrap {
position: relative;
margin-top: 16px;
padding: 20px 20px 0;
background-color: #fff;
height: calc(100vh - 148px);
.default-box {
width: 624px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
.default-img {
width: 400px;
height: 174px;
}
.tip {
font-size: 16px;
line-height: 24px;
white-space: nowrap;
margin: 24px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!