Commit 5d48e5bd by 前端

短信营销

1 parent eff56cec
...@@ -26,9 +26,7 @@ ...@@ -26,9 +26,7 @@
</div> </div>
<img src="./assets/logo.png" alt="" srcset="" /> <img src="./assets/logo.png" alt="" srcset="" />
</div>--> </div>-->
<keep-alive exclude="details">
<router-view /> <router-view />
</keep-alive>
</div> </div>
</template> </template>
......
...@@ -45,8 +45,8 @@ const findDetailById = params => { ...@@ -45,8 +45,8 @@ const findDetailById = params => {
returnAll: true returnAll: true
}) })
} }
// 查询短信营销客户列表 // 删除
const getMessageInfoStatus = params => { const updateMessageInfoStatus = params => {
params.method = 'entmicro.api.message.updateMessageInfoStatus' params.method = 'entmicro.api.message.updateMessageInfoStatus'
return http({ return http({
url, url,
...@@ -56,4 +56,4 @@ const getMessageInfoStatus = params => { ...@@ -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
...@@ -6,59 +6,71 @@ ...@@ -6,59 +6,71 @@
<div class="gl-form-page"> <div class="gl-form-page">
<el-form ref="configForm" label-width="154px" :model="addForm" :rules="addRules"> <el-form ref="configForm" label-width="154px" :model="addForm" :rules="addRules">
<el-form-item label="营销名称:" prop="imName"> <el-form-item label="营销名称:" prop="imName">
<el-input type="text" size="small" placeholder="请输入营销名称" v-model.trim="addForm.imName" maxlength="30"></el-input> <el-input type="text" size="small" placeholder="请输入营销名称" v-model.trim="addForm.imName" maxlength="50"></el-input>
</el-form-item> </el-form-item>
<!-- <div class="flex"> --> <div class="config-form-item el-form-item">
<el-form-item label="营销时间:" class="sendTime"> <label class="is-require">营销时间:</label>
<el-col :span="11"> <div style="position: relative">
<el-date-picker type="date" placeholder="选择日期" v-model="addForm.date1" style="width: 100%"></el-date-picker> <el-col :span="11">
</el-col> <el-date-picker type="date" :picker-options="pickerOptions" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd" v-model="addForm.date1" style="width: 100%"></el-date-picker>
<el-col class="line" :span="1">-</el-col> </el-col>
<el-col :span="11"> <el-col class="line" :span="1">-</el-col>
<el-time-picker placeholder="选择时间" v-model="addForm.date2" style="width: 100%"></el-time-picker> <el-col :span="11">
</el-col> <el-time-picker placeholder="选择时间" value-format="HH:mm" format="HH:mm" v-model="addForm.date2" style="width: 100%"></el-time-picker>
</el-form-item> </el-col>
<el-form-item label="导入客户:" prop="exportUrl"> <div class="el-form-item__error" v-if="isTime">请选择营销时间</div>
<div class="upload-box"> </div>
<div class="upload-file-panel flex"> </div>
<div> <div class="config-form-item el-form-item">
<div class="upload-btn"> <label class="is-require">导入客户:</label>
<i class="el-icon-plus"></i> <div style="position: relative">
上传文件 <div class="upload-box">
<div class="upload-file-panel flex">
<div class="image-uploader">
<div class="upload-btn">
<i class="el-icon-plus"></i>
上传文件
</div>
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</div> </div>
<!-- <input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" /> --> <el-popover placement="bottom" width="452" trigger="hover">
</div> <img src="@/images/table.png" class="preview" />
<el-popover placement="bottom" width="452" trigger="hover"> <span slot="reference" class="download-url">模板预览</span>
<img src="@/images/table.png" class="preview" /> </el-popover>
<span slot="reference" class="download-url">模板预览</span>
</el-popover>
<a class="download-url" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/客户信息导入模板.xlsx">下载模版</a> <a class="download-url" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/营销短信客户模板.xlsx">下载模版</a>
</div> </div>
<div class="upload-result" v-if="importName"> <div class="upload-result" v-if="importName">
<div class="upload-result-input">{{ importName }}</div> <div class="upload-result-input">{{ importName }}</div>
<i class="el-icon-delete" @click="clearFile"></i> <i class="el-icon-delete" @click="clearFile"></i>
</div>
</div> </div>
<div class="el-form-item__error" v-if="isUplaod">请上传客户</div>
</div> </div>
</el-form-item> </div>
<el-form-item label="短信内容:" prop="messageContext"> <div class="config-form-item el-form-item">
<el-input type="textarea" v-model="addForm.messageContext" rows="5" maxlength="280" show-word-limit></el-input> <label class="is-require">短信内容:</label>
<div class="select-panel"> <div style="position: relative">
<div @click="handleSelectMessage" class="flex"> <wTextarea ref="textContent" class="textarea" v-model="textValue" @updateText="updateText" :style="{ 'min-height': boxHeight + 'px' }"></wTextarea>
<img src="@/images/link.png" class="link" /> <div class="select-panel">
<span class="">短链</span> <div @click="handleSelectMessage" class="flex">
<img src="@/images/link.png" class="link" />
<span class="">短链</span>
</div>
</div> </div>
<div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div>
<div class="form-tips">提示:当前短信已有0字,按0条短信发送且计费。</div>
<div class="el-form-item__error" v-if="isLink">请填写短信内容</div>
<div class="el-form-item__error" v-if="isLink && count > 1">只允许插入一次短链</div>
</div> </div>
<div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div> </div>
<div class="form-tips">提示:当前短信已有0字,按0条短信发送且计费。</div>
</el-form-item>
</el-form> </el-form>
</div> </div>
<div class="form-image"> <div class="form-image">
<img src="@/images/phone.png" /> <img src="@/images/phone.png" />
<div class="preview-content"> <div class="preview-content">
<div class="preview-info"> <div class="preview-info">
<div class="preview-text text" v-for="(item, index) in content" :key="index">{{ item }}</div> <div class="preview-text text" v-if="addForm.messageContext">【短信签名】{{ addForm.messageContext }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -68,9 +80,36 @@ ...@@ -68,9 +80,36 @@
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSave">提交</el-button> <el-button type="primary" @click="handleSave">提交</el-button>
</GLFooter> </GLFooter>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisible = false" type="warning" content="当前有内容信息未保存,是否继续返回?" :visible.sync="dialogVisible" mode="small"></GLDialog>
<GLDialog title="导入数据失败" :hasFooter="true" mode="small" :visible.sync="importVisible">
<div class="dialog-body-panel">
<div class="import-result">
<div class="success">
<div class="number">{{ ImportResult.totalCount }}</div>
<div>有效数据</div>
</div>
<div class="fail">
<div class="number">{{ ImportResult.failCount }}</div>
<div>异常数据</div>
</div>
</div>
<div class="import-reason">
<div class="import-tips">数据异常的可能原因:</div>
<div class="import-reason-content">1、存在格式不正确的手机号数据</div>
<div class="import-reason-content">2、存在重复的手机号数据</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="importVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="handleImport">导出错误数据</el-button>
</span>
</GLDialog>
</div> </div>
</template> </template>
<script> <script>
import wTextarea from './tag-textarea'
import util from '@/utils/util'
export default { export default {
data() { data() {
return { return {
...@@ -79,31 +118,118 @@ export default { ...@@ -79,31 +118,118 @@ export default {
sendTime: '', sendTime: '',
exportUrl: '', exportUrl: '',
messageContext: '', messageContext: '',
date: '', date1: '',
time: '' date2: ''
}, },
addRules: { addRules: {
imName: [{ required: true, message: '请输入营销名称', trigger: 'blur' }], imName: [{ required: true, message: '请输入营销名称', trigger: 'blur' }]
exportUrl: [{ required: true, message: '请上传客户', trigger: 'change' }], },
sendTime: [ textValue: '',
// { required: true, message: '请选择营销时间' } importName: '',
// { validator: validateTime, trigger: 'change' } isTime: false,
], isUplaod: false,
messageContext: [ isLink: false,
{ required: true, message: '请输入营销内容', trigger: 'change' } dialogVisible: false,
// { validator: validateContent, trigger: 'blur' } importVisible: false,
] count: 0,
ImportResult: {},
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
}
} }
} }
}, },
props: {
boxHeight: {
type: Number,
default: 200
}
},
components: {
wTextarea
},
watch: {
addForm: {
handler() {
this.saveStatus = true
},
deep: true
}
},
methods: { methods: {
handleSave() {}, updateText(html) {
handleCancel() {}, this.addForm.messageContext = html
},
handleSelectMessage() {
if (this.$refs.textContent.currentText.indexOf('#短链#') != -1) {
return
}
this.$refs.textContent.addTag('#短链#')
this.addForm.messageContext = this.$refs.textContent.currentText
},
clearFile() {
this.importName = null
this.exportUrl = null
this.$refs.file.value = ''
},
handleSave() {
this.isUplaod = false
this.isTime = false
this.isLink = false
this.count = 0
if (this.addForm.date1 == '' || this.addForm.date2 == '') {
this.isTime = true
return
}
if (this.addForm.exportUrl == '') {
this.isUplaod = true
return
}
if (this.addForm.messageContext == '') {
this.isLink = true
return
} else {
let array = this.addForm.messageContext.match(/#短链#/g).length
this.count = array ? array.length : 0
}
if (this.count > 1) {
this.isLink = true
}
this.$refs.configForm.validate(valid => {
if (valid) {
let params = {
imName: this.addForm.imName,
messageContext: this.addForm.messageContext,
exportUrl: this.addForm.exportUrl,
sendTime: this.addForm.date1 + this.addForm.date2
}
this.$apis.marketing.createMessageInfo(params).then(res => {
this.$message({
message: res.code == '0' ? '创建成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == 0) {
this.$router.go(-1)
}
})
}
})
},
handleSure() {
this.$router.push('/marketing/index')
},
handleCancel() {
if (this.saveStatus) {
this.dialogVisible = true
} else {
this.$router.push('/marketing/index')
}
},
uploadFile(e) { uploadFile(e) {
const file = e.srcElement.files[0] const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx' let AllImgExt = '.xls|.xlsx'
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase() let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
console.log(extName)
if (AllImgExt.indexOf(extName) === -1) { if (AllImgExt.indexOf(extName) === -1) {
this.$message.error('上传格式不正确') this.$message.error('上传格式不正确')
return false return false
...@@ -116,11 +242,27 @@ export default { ...@@ -116,11 +242,27 @@ export default {
const fileUrl = file.name.split('.')[1] + '@' + arrBase64[1] const fileUrl = file.name.split('.')[1] + '@' + arrBase64[1]
this.$apis.common.pictureUpload({ file: fileUrl }).then(res => { this.$apis.common.pictureUpload({ file: fileUrl }).then(res => {
this.importName = file.name this.importName = file.name
this.exportUrl = res this.addForm.exportUrl = res
this.$refs.file.value = '' this.$refs.file.value = ''
this.handleSaveImport() this.handleSaveImport()
}) })
} }
},
handleSaveImport() {
this.loading = true
let params = {
exportUrl: this.addForm.exportUrl
}
this.$apis.marketing.createMessageInfo(params).then(res => {
console.log(res)
if (res.code == 0) {
this.importVisible = true
this.ImportResult = res.data
}
})
},
handleImport() {
util.openUrl(this.ImportResult.errorUrl.replace(/https?:/, ''))
} }
} }
} }
...@@ -128,7 +270,7 @@ export default { ...@@ -128,7 +270,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
background: #ffffff; background: #ffffff;
margin-bottom:16px; margin-bottom: 16px;
.title { .title {
height: 56px; height: 56px;
line-height: 56px; line-height: 56px;
...@@ -139,8 +281,35 @@ export default { ...@@ -139,8 +281,35 @@ export default {
.gl-form-page { .gl-form-page {
flex: 1; flex: 1;
padding: 20px; padding: 20px;
/deep/.el-form-item__content {
width: 460px; .config-form-item {
display: flex;
margin-top: 20px;
/deep/.el-form-item__content {
width: 460px;
}
label {
font-size: 14px;
text-align: right;
color: #666;
width: 154px;
// margin-right: 12px;
height: 36px;
line-height: 36px;
img {
width: 14px;
height: 14px;
vertical-align: middle;
margin-left: 5px;
}
&.is-require {
&::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
}
}
} }
.line { .line {
color: #fff; color: #fff;
...@@ -158,7 +327,7 @@ export default { ...@@ -158,7 +327,7 @@ export default {
margin-right: 4px; margin-right: 4px;
} }
.upload-box { .upload-box {
margin-bottom: 10px; // margin-bottom: 10px;
.upload-btn { .upload-btn {
background: #ffffff; background: #ffffff;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
...@@ -199,6 +368,9 @@ export default { ...@@ -199,6 +368,9 @@ export default {
line-height: 20px; line-height: 20px;
} }
} }
.textarea {
width: 580px !important;
}
.select-panel { .select-panel {
padding-left: 20px; padding-left: 20px;
background: #fafbfe; background: #fafbfe;
...@@ -214,6 +386,25 @@ export default { ...@@ -214,6 +386,25 @@ export default {
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
cursor: pointer; cursor: pointer;
} }
.image-uploader {
display: inline-block;
margin-bottom: 6px;
width: 120px;
position: relative;
input {
cursor: pointer;
position: absolute;
top: 0px;
width: 100%;
height: 100%;
font-size: 0px;
}
/deep/ {
.el-upload-list {
display: none;
}
}
}
.form-tips { .form-tips {
font-size: 12px; font-size: 12px;
color: #999999; color: #999999;
...@@ -225,7 +416,7 @@ export default { ...@@ -225,7 +416,7 @@ export default {
.form-image { .form-image {
width: 280px; width: 280px;
height: 546px; height: 546px;
margin: 20px 10px; margin: 20px 80px 20px 0;
position: relative; position: relative;
.preview-content { .preview-content {
position: absolute; position: absolute;
...@@ -251,4 +442,50 @@ export default { ...@@ -251,4 +442,50 @@ export default {
} }
} }
} }
.dialog-body-panel {
.import-result {
font-size: 14px;
font-weight: 600;
color: #333333;
line-height: 22px;
display: flex;
align-items: center;
.success {
text-align: center;
flex: 1;
border-right: 1px solid #e7e7e7;
.number {
color: #2cca74;
}
}
.fail {
text-align: center;
flex: 1;
.number {
color: #eb4e4e;
}
}
}
.import-reason {
height: 80px;
background: #f5f5f5;
padding: 8px 16px;
box-sizing: border-box;
margin-top: 16px;
.import-tips {
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
margin-bottom: 4px;
}
&-content {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
}
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,19 @@ ...@@ -3,12 +3,19 @@
<div class="container"> <div class="container">
<GLCombiForm :rowNumber="1" ref="formSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <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"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleContent(scope.scope)">短信内容</el-button> <el-button type="text" @click="handleContent(scope.scope)">短信内容</el-button>
</div> </div>
</GLTable> </GLTable>
</div> </div>
<!-- 外呼短信 -->
<GLDialog mode="small" title="短信内容" :visible.sync="messageVisible" cancelText="取消" okText="确定" @onOk="handleMessageConfirm">
<div class="market-note">{{ messageContext }}</div>
</GLDialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -16,11 +23,14 @@ import url from '@/assets/empty.png' ...@@ -16,11 +23,14 @@ import url from '@/assets/empty.png'
export default { export default {
data() { data() {
return { return {
messageVisible: false,
messageContext: '',
url: url, url: url,
searchForm: { searchForm: {
phone: '', phone: '',
imStatus: '', delFlag: '',
merchantName: '' merchantName: '',
imId: ''
}, },
// 搜索 // 搜索
searchFormData: [ searchFormData: [
...@@ -31,12 +41,11 @@ export default { ...@@ -31,12 +41,11 @@ export default {
}, },
{ {
label: '状态', label: '状态',
name: 'imStatus', name: 'delFlag',
type: 'select', type: 'select',
optionList: [ optionList: [
{ text: '待发送', id: 1 }, { text: '待发送', id: 0 },
{ text: '已处理', id: 2 }, { text: '已发送', id: 1 }
{ text: '删除', id: 3 }
], ],
optionId: 'id', optionId: 'id',
optionLabel: 'text' optionLabel: 'text'
...@@ -48,9 +57,9 @@ export default { ...@@ -48,9 +57,9 @@ export default {
type: 'input' type: 'input'
} }
], ],
getListApi: this.$apis.outbound.getTaskList, getListApi: this.$apis.marketing.findAllCustomerByPage,
tableParams: { tableParams: {
listName: 'data', listName: 'data.data',
tableOption: true, tableOption: true,
tableColumns: [ tableColumns: [
{ {
...@@ -59,29 +68,49 @@ export default { ...@@ -59,29 +68,49 @@ export default {
}, },
{ {
label: '客户姓名', label: '客户姓名',
prop: 'customerCount ' prop: 'customerName'
}, },
{ {
label: '所属门店', label: '所属门店',
prop: 'merchantName ' prop: 'merchantName'
}, },
{ {
label: '发送状态', label: '状态',
prop: 'createdTime' prop: 'delFlag',
addHtml: 'delFlag'
}, },
{ {
label: '发送时间', label: '发送时间',
prop: 'createdName' prop: 'sendTime'
} }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' } pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
} }
}, },
props: {
imId: {
type: String,
default: ''
}
},
methods: { methods: {
handleContent() { handleContent(data) {
this.$router.push({ this.messageContext = data.messageContext
path: '/client/add' 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() { setTableFinishFun() {
...@@ -95,8 +124,9 @@ export default { ...@@ -95,8 +124,9 @@ export default {
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
phone: '', phone: '',
imStatus: '', delFlag: '',
merchantName: '' merchantName: '',
imId: ''
} }
this.handleSearch() this.handleSearch()
} }
...@@ -105,7 +135,7 @@ export default { ...@@ -105,7 +135,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.client { .client {
margin-top: 16px; margin: 16px 0;
.head-info { .head-info {
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 14px;
...@@ -121,5 +151,42 @@ export default { ...@@ -121,5 +151,42 @@ export default {
display: inline-block; 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> </style>
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<template v-for="(item, index) in configList"> <template v-for="(item, index) in configList">
<div class="flex-top line-text" :key="index"> <div class="flex-top line-text" :key="index">
<div class="type-text">{{ item.text }}</div> <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> </div>
</template> </template>
</div> </div>
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
<img src="@/images/phone.png" /> <img src="@/images/phone.png" />
<div class="preview-content"> <div class="preview-content">
<div class="preview-info"> <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> </div>
</div> </div>
</div> </div>
<template v-else> <template v-else>
<client></client> <client :imId="id"></client>
</template> </template>
<GLFooter> <GLFooter>
<el-button @click="handleCancel" type="primary">返回</el-button> <el-button @click="handleCancel" type="primary">返回</el-button>
...@@ -38,6 +38,7 @@ export default { ...@@ -38,6 +38,7 @@ export default {
}, },
data() { data() {
return { return {
id: this.$route.query.id ? this.$route.query.id : 0,
activeName: 'first', activeName: 'first',
tabPaneList: [ tabPaneList: [
{ {
...@@ -49,6 +50,7 @@ export default { ...@@ -49,6 +50,7 @@ export default {
name: 'second' name: 'second'
} }
], ],
detailData:'',
content: [], content: [],
configList: [ configList: [
{ {
...@@ -65,7 +67,7 @@ export default { ...@@ -65,7 +67,7 @@ export default {
}, },
{ {
text: '有效数据:', text: '有效数据:',
key: 'imName' key: 'customerCount'
}, },
{ {
text: '营销内容:', text: '营销内容:',
...@@ -74,10 +76,23 @@ export default { ...@@ -74,10 +76,23 @@ export default {
] ]
} }
}, },
created() {
this.congifDetails()
},
methods: { 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() { handleClick() {
this.handleSearch() console.log(this.activeName)
} }
} }
} }
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
<GLCombiForm :rowNumber="1" ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <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"> <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"> <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="handleDetails(scope.scope)">详情</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
...@@ -47,8 +50,7 @@ export default { ...@@ -47,8 +50,7 @@ export default {
type: 'select', type: 'select',
optionList: [ optionList: [
{ text: '待发送', id: 1 }, { text: '待发送', id: 1 },
{ text: '已处理', id: 2 }, { text: '已完成', id: 2 }
{ text: '删除', id: 3 }
], ],
optionId: 'id', optionId: 'id',
optionLabel: 'text' optionLabel: 'text'
...@@ -60,7 +62,7 @@ export default { ...@@ -60,7 +62,7 @@ export default {
type: 'input' type: 'input'
} }
], ],
getListApi: this.$apis.outbound.getTaskList, getListApi: this.$apis.marketing.getMessageList,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
tableOption: true, tableOption: true,
...@@ -71,15 +73,16 @@ export default { ...@@ -71,15 +73,16 @@ export default {
}, },
{ {
label: '营销客户数', label: '营销客户数',
prop: 'customerCount ' prop: 'customerCount'
}, },
{ {
label: '状态', label: '状态',
prop: 'imStatus ' prop: 'imStatus',
addHtml:'imStatus'
}, },
{ {
label: '创建时间', label: '创建时间',
prop: 'createdTime' prop: 'sendTime'
}, },
{ {
label: '创建人', label: '创建人',
...@@ -104,22 +107,22 @@ export default { ...@@ -104,22 +107,22 @@ export default {
} }
}) })
}, },
handleDelete() { handleDelete(data) {
this.$confirm('删除后数据将无法恢复,是否确认删除??', '提示', { this.$confirm('删除后数据将无法恢复,是否确认删除??', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
// this.$apis.channel.deleteChannelCode({ id: scope.id }).then(res => { this.$apis.marketing.updateMessageInfoStatus({ id: data.id }).then(res => {
// if (res) { if (res) {
// this.$message({ this.$message({
// type: 'success', type: 'success',
// message: '删除成功!' message: '删除成功!'
// }) })
// } }
// this.handleSearch() this.handleSearch()
// }) })
}) })
.catch(() => {}) .catch(() => {})
}, },
...@@ -181,5 +184,29 @@ export default { ...@@ -181,5 +184,29 @@ export default {
display: inline-block; 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> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="w-textarea" ref="wTextarea" v-bind="$attr">
<div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @keydown="textareaKeydown($event)" @click="inputClick($event)" @focus="onFocus" @blur="onBlur" @keydown.delete="handleDelete($event)" @input="handleInput($event.target)"></div>
</div>
</template>
<script>
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)
},
textareaKeydown(event) {
if (event.keyCode == 13) {
this.insertHtml('<br>')
let nn = document.createElement('br')
document.querySelector('.w-textarea_input').appendChild(nn)
return false
}
},
/*换行*/
insertHtml(html) {
var sel, range
if (window.getSelection) {
// IE9 或 非IE浏览器
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
// Range.createContextualFragment() would be useful here but is
// non-standard and not supported in all browsers (IE9, for one)
var el = document.createElement('div')
el.innerHTML = html
var frag = document.createDocumentFragment(),
node,
lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
// Preserve the selection
if (lastNode) {
range = range.cloneRange()
range.setStartAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
} else if (document.selection && document.selection.type != 'Control') {
// IE < 9
document.selection.createRange().pasteHTML(html)
}
const htm = document.querySelector('.w-textarea_input').innerHTML
this.subText(htm)
},
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)
},
addNode() {
let target = this.$refs.wTextareaContent
this.updateData(target.innerHTML)
},
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)
}
},
subText(htm) {
const cutImg = htm.replace(/<wise.+?>(.+?)(?:<\/wise>)/g, '$1').replace(/<span>([\s\S]*?)<\/span>/g, '$1')
this.currentText = cutImg
this.$emit('updateText', this.currentText)
},
insertNodeFirst(node) {
this.savedRange.deleteContents()
// 插入链接
if (this.isInsert) {
this.savedRange.insertNode(node)
} else {
document.querySelector('.w-textarea_input').appendChild(node)
}
if (navigator.userAgent.indexOf('Chrome') != -1) {
this.savedRange.insertNode(document.createElement('span'))
}
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
this.subText(htm)
},
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
this.subText(htm)
},
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 1
// 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">
.w-textarea {
wise {
user-select: none;
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 0px;
margin: 0 2px;
color: #26a2ff;
// padding: 0 1px;
white-space: nowrap;
cursor: default;
-webkit-user-modify: read-only !important;
}
img {
width: 18px;
height: 18px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
vertical-align: middle;
}
.active {
background: #dcdfe6;
}
}
</style>
<style lang="scss" scoped>
$borderColor: #e5e5e5;
$bgColor: #f5f7fa;
$textColor: #666;
.w-textarea {
width: 100%;
box-sizing: border-box;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border: 1px solid $borderColor;
position: relative;
overflow-y: auto;
&_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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!