Commit 5d48e5bd by 前端

短信营销

1 parent eff56cec
......@@ -26,9 +26,7 @@
</div>
<img src="./assets/logo.png" alt="" srcset="" />
</div>-->
<keep-alive exclude="details">
<router-view />
</keep-alive>
</div>
</template>
......
......@@ -45,8 +45,8 @@ const findDetailById = params => {
returnAll: true
})
}
// 查询短信营销客户列表
const getMessageInfoStatus = params => {
// 删除
const updateMessageInfoStatus = params => {
params.method = 'entmicro.api.message.updateMessageInfoStatus'
return http({
url,
......@@ -56,4 +56,4 @@ const getMessageInfoStatus = params => {
})
}
export default { createMessageInfo,getMessageInfoStatus,getMessageList, findDetailById, findAllCustomerByPage}
export default { createMessageInfo,updateMessageInfoStatus,getMessageList, findDetailById, findAllCustomerByPage}
import { Message } from 'element-ui'
let util = {}
util.cloneText = function(message) {
let input = document.createElement('input')
input.value = message
document.body.appendChild(input)
input.select()
input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
document.body.removeChild(input)
Message.success('复制成功')
}
util.getBeforeDate = function(sign = '-') {
let day = new Date()
let month = day.getMonth() + 1
let date = day.getDate()
if (month < 10) month = '0' + month
if (date < 10) date = '0' + date
var s = day.getFullYear() + sign + month + sign + date
return s
}
util.getTimeFomat = function(time, sign = '-') {
let day = new Date(time)
let month = day.getMonth() + 1
let date = day.getDate()
let hour = day.getHours()
let mm = day.getMinutes()
if (month < 10) month = '0' + month
if (date < 10) date = '0' + date
if (hour < 10) hour = '0' + hour
if (mm < 10) mm = '0' + mm
var s = day.getFullYear() + sign + month + sign + date + ' ' + hour + ':' + mm
return s
}
util.getBetweenDate = function(day, num, str = '-') {
var today = new Date(day)
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * (num - 1)
today.setTime(parseInt(nowTime - ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
}
util.getBeforeMonth = function(days) {
let month = new Date().getMonth() + 1
let year = new Date().getFullYear()
let arr = new Array()
for (let i = 0; i < days; i++) {
if (month <= 0) {
year = year - 1
month = month + 12
}
if (month < 10) month = '0' + month
arr[i] = year + '年' + month + '月'
month--
}
return arr
}
util.getPrevMonth = function() {
let month = new Date().getMonth()
let year = new Date().getFullYear()
if (month == 0) {
year = year - 1
month = 12
}
return year + '年' + month + '月'
}
util.getCurrentMonthLast = function(date) {
var endDate = new Date(date)
var month = endDate.getMonth()
var nextMonth = ++month
var nextMonthFirstDay = new Date(endDate.getFullYear(), nextMonth, 1)
var oneDay = 1000 * 60 * 60 * 24
var dateString = new Date(nextMonthFirstDay - oneDay)
return dateString.toLocaleDateString().replace(new RegExp('/', 'g'), '-') //toLocaleDateString() 返回 如:2018/8/31
}
util.openUrl = function(url) {
const link = document.createElement('a')
link.href = url
link.click()
}
util.openTab = function(url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
util.isShowBtn = function(value, permissions) {
let isShowStatus = false
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menuLevel(menu)
function menuLevel(item) {
item.forEach(itm => {
if (value && itm.path == value) {
isShowStatus = true
}
if (
!value &&
itm.path ==
'/' +
location.pathname
.split('/')
.slice(-2)
.join('/') &&
itm.meta && itm.meta.permissions.includes(permissions)
){isShowStatus = true}
if (itm.children) {
menuLevel(itm.children)
}
})
}
return isShowStatus
}
export default util
......@@ -3,12 +3,19 @@
<div class="container">
<GLCombiForm :rowNumber="1" ref="formSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<GLTable ref="clientRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<GLTable ref="clientRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<template slot="delFlag" slot-scope="scope">
<div :class="['task_icon', scope.scope.delFlag == 0 ? 'task_icon1' : 'task_icon2']">{{ scope.scope.delFlag == 0 ? '待发送' : '已发送' }}</div>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleContent(scope.scope)">短信内容</el-button>
</div>
</GLTable>
</div>
<!-- 外呼短信 -->
<GLDialog mode="small" title="短信内容" :visible.sync="messageVisible" cancelText="取消" okText="确定" @onOk="handleMessageConfirm">
<div class="market-note">{{ messageContext }}</div>
</GLDialog>
</div>
</template>
<script>
......@@ -16,11 +23,14 @@ import url from '@/assets/empty.png'
export default {
data() {
return {
messageVisible: false,
messageContext: '',
url: url,
searchForm: {
phone: '',
imStatus: '',
merchantName: ''
delFlag: '',
merchantName: '',
imId: ''
},
// 搜索
searchFormData: [
......@@ -31,12 +41,11 @@ export default {
},
{
label: '状态',
name: 'imStatus',
name: 'delFlag',
type: 'select',
optionList: [
{ text: '待发送', id: 1 },
{ text: '已处理', id: 2 },
{ text: '删除', id: 3 }
{ text: '待发送', id: 0 },
{ text: '已发送', id: 1 }
],
optionId: 'id',
optionLabel: 'text'
......@@ -48,9 +57,9 @@ export default {
type: 'input'
}
],
getListApi: this.$apis.outbound.getTaskList,
getListApi: this.$apis.marketing.findAllCustomerByPage,
tableParams: {
listName: 'data',
listName: 'data.data',
tableOption: true,
tableColumns: [
{
......@@ -59,29 +68,49 @@ export default {
},
{
label: '客户姓名',
prop: 'customerCount '
prop: 'customerName'
},
{
label: '所属门店',
prop: 'merchantName '
prop: 'merchantName'
},
{
label: '发送状态',
prop: 'createdTime'
label: '状态',
prop: 'delFlag',
addHtml: 'delFlag'
},
{
label: '发送时间',
prop: 'createdName'
prop: 'sendTime'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
}
},
props: {
imId: {
type: String,
default: ''
}
},
methods: {
handleContent() {
this.$router.push({
path: '/client/add'
handleContent(data) {
this.messageContext = data.messageContext
this.messageVisible = true
},
handleMessageConfirm() {
this.messageVisible = false
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.imId = this.imId
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
resolve()
})
},
setTableFinishFun() {
......@@ -95,8 +124,9 @@ export default {
handleReset() {
this.searchForm = {
phone: '',
imStatus: '',
merchantName: ''
delFlag: '',
merchantName: '',
imId: ''
}
this.handleSearch()
}
......@@ -105,7 +135,7 @@ export default {
</script>
<style lang="scss" scoped>
.client {
margin-top: 16px;
margin: 16px 0;
.head-info {
font-weight: 400;
font-size: 14px;
......@@ -121,5 +151,42 @@ export default {
display: inline-block;
}
}
.task_icon {
position: relative;
&::after {
content: '';
position: absolute;
top: 4px;
left: -10px;
width: 6px;
height: 6px;
border-radius: 4px;
}
&.task_icon1 {
&::after {
background: #fdb757;
}
}
&.task_icon2 {
&::after {
background: #2cca74;
}
}
}
.market-note {
font-weight: 400;
font-size: 16px;
color: #333333;
line-height: 24px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
width: 448px;
white-space: wrap;
}
}
</style>
\ No newline at end of file
......@@ -8,7 +8,7 @@
<template v-for="(item, index) in configList">
<div class="flex-top line-text" :key="index">
<div class="type-text">{{ item.text }}</div>
<div class="type-value">【嘀加智慧车生活】尊敬的顾客,赠送您一张专属权益卡。加油8折起,更有星巴克、喜茶、麦当劳等惊喜折扣优惠。请添加门店顾问企微领取 https://t.hk.uy/bscB</div>
<div class="type-value">{{detailData[item.key]?detailData[item.key]:'--'}}</div>
</div>
</template>
</div>
......@@ -16,14 +16,14 @@
<img src="@/images/phone.png" />
<div class="preview-content">
<div class="preview-info">
<div class="preview-text text" v-for="(item, index) in content" :key="index">{{ item }}</div>
<div class="preview-text text" :key="index">{{ detailData.messageContext }}</div>
</div>
</div>
</div>
</div>
</div>
<template v-else>
<client></client>
<client :imId="id"></client>
</template>
<GLFooter>
<el-button @click="handleCancel" type="primary">返回</el-button>
......@@ -38,6 +38,7 @@ export default {
},
data() {
return {
id: this.$route.query.id ? this.$route.query.id : 0,
activeName: 'first',
tabPaneList: [
{
......@@ -49,6 +50,7 @@ export default {
name: 'second'
}
],
detailData:'',
content: [],
configList: [
{
......@@ -65,7 +67,7 @@ export default {
},
{
text: '有效数据:',
key: 'imName'
key: 'customerCount'
},
{
text: '营销内容:',
......@@ -74,10 +76,23 @@ export default {
]
}
},
created() {
this.congifDetails()
},
methods: {
handleCancel() {},
congifDetails() {
let params = {
id: this.id
}
this.$apis.marketing.findDetailById(params).then(res => {
if (res.code == 0) this.detailData = res.data
})
},
handleCancel() {
this.$router.go(-1)
},
handleClick() {
this.handleSearch()
console.log(this.activeName)
}
}
}
......
......@@ -13,6 +13,9 @@
<GLCombiForm :rowNumber="1" ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<GLTable ref="marketingRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<template slot="imStatus" slot-scope="scope">
<div :class="['task_icon', scope.scope.imStatus == 1 ? 'task_icon1' : 'task_icon2']">{{ scope.scope.imStatus==1?'待处理':scope.scope.imStatus==2?'已完成':'删除' }}</div>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetails(scope.scope)">详情</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
......@@ -47,8 +50,7 @@ export default {
type: 'select',
optionList: [
{ text: '待发送', id: 1 },
{ text: '已处理', id: 2 },
{ text: '删除', id: 3 }
{ text: '已完成', id: 2 }
],
optionId: 'id',
optionLabel: 'text'
......@@ -60,7 +62,7 @@ export default {
type: 'input'
}
],
getListApi: this.$apis.outbound.getTaskList,
getListApi: this.$apis.marketing.getMessageList,
tableParams: {
listName: 'data',
tableOption: true,
......@@ -71,15 +73,16 @@ export default {
},
{
label: '营销客户数',
prop: 'customerCount '
prop: 'customerCount'
},
{
label: '状态',
prop: 'imStatus '
prop: 'imStatus',
addHtml:'imStatus'
},
{
label: '创建时间',
prop: 'createdTime'
prop: 'sendTime'
},
{
label: '创建人',
......@@ -104,22 +107,22 @@ export default {
}
})
},
handleDelete() {
handleDelete(data) {
this.$confirm('删除后数据将无法恢复,是否确认删除??', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
// this.$apis.channel.deleteChannelCode({ id: scope.id }).then(res => {
// if (res) {
// this.$message({
// type: 'success',
// message: '删除成功!'
// })
// }
// this.handleSearch()
// })
this.$apis.marketing.updateMessageInfoStatus({ id: data.id }).then(res => {
if (res) {
this.$message({
type: 'success',
message: '删除成功!'
})
}
this.handleSearch()
})
})
.catch(() => {})
},
......@@ -181,5 +184,29 @@ export default {
display: inline-block;
}
}
.task_icon {
position: relative;
&::after {
content: '';
position: absolute;
top: 4px;
left: -10px;
width: 6px;
height: 6px;
border-radius: 4px;
}
&.task_icon1 {
&::after {
background: #FDB757;
}
}
&.task_icon2 {
&::after {
background: #2cca74;
}
}
}
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!