Commit 231c59ed by 杨北旺

短信联调

1 parent 772478b6
......@@ -239,6 +239,47 @@ const getTypeListApi = params => {
})
}
/**
* 创建积分提醒短信
*/
const createSmsApi = params => {
params.method = 'scrm.api.shopmall.integral.remind.msg.create'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 积分提醒短信详情
*/
const getSmsDetailApi = params => {
params.method = 'scrm.api.shopmall.integral.remind.msg.detail'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 开关提醒短信
*/
const openSmsApi = params => {
params.method = 'scrm.api.shopmall.integral.remind.msg.onOff'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 触达客户
*/
const smsCustomerApi = params => {
params.method = 'scrm.api.shopmall.integral.remind.record.page'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
export default {
getList,
getOrderDetail,
......@@ -260,5 +301,9 @@ export default {
getIntegralDetail,
getCustomerIntegralList,
auditIntegral,
getTypeListApi
getTypeListApi,
createSmsApi,
getSmsDetailApi,
openSmsApi,
smsCustomerApi
}
......@@ -4,7 +4,7 @@
<glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
<template v-for="(item, index) in form_solt">
<div :key="index" :slot="item.name">
<el-switch v-model="formObj[item.attr].switch" :active-value="true" :inactive-value="false"></el-switch>
<el-switch @change="openSmsByHttp($event, formObj[item.attr])" v-model="formObj[item.attr].switch" :active-value="true" :inactive-value="false"></el-switch>
<div style="position: relative" class="wrapper">
<div class="topSet flex">
<span>发送时间:积分到账</span>
......@@ -85,7 +85,8 @@ export default {
time: null,
model: null,
text: '',
name: '短信一'
name: '短信一',
msgNo: 1
},
message_second: {
messageContext: '',
......@@ -93,7 +94,8 @@ export default {
time: null,
model: null,
text: '',
name: '短信二'
name: '短信二',
msgNo: 2
},
message_three: {
messageContext: '',
......@@ -101,7 +103,8 @@ export default {
time: null,
model: null,
text: '',
name: '短信三'
name: '短信三',
msgNo: 3
}
},
formData: [
......@@ -147,7 +150,9 @@ export default {
]
}
},
mounted() {},
mounted() {
this.getSMSDetail()
},
methods: {
// 信息文案处理高亮和字数限制
highText(title) {
......@@ -201,12 +206,25 @@ export default {
return
}
_refs.addTag(`#${textName}#`)
// this.formObj[type].messageContext = _refs.currentText
},
// 提交
handleSave() {
const params = this.handlerParams()
console.log(params)
if (Array.isArray(params)) {
this.$apis.points.createSmsApi({ msgList: params }).then(res => {
if (res) {
this.$message({
message: '提交成功',
type: 'success'
})
} else {
this.$message({
message: res.message,
type: 'error'
})
}
})
}
},
handleCancel() {
this.$router.back()
......@@ -258,14 +276,83 @@ export default {
if (isHaveTimeErr) return this.$message.error(`${errName2}发送时间需大于${errName}发送时间`)
needCheckList.forEach(el => {
let obj = {
open: el.switch,
time: el.time,
text: el.text
msgType: 1,
msgNo: el.msgNo,
msgSign: this.formObj.miniId,
delayTime: el.time,
msgContent: el.text,
openType: el.switch ? 1 : 2
}
if (el.id) obj.id = el.id
params.push(obj)
})
}
return params
},
// 处理详情回显标签内容
handlerDetailTagContent(tagContent) {
const shortLink = '#短链#',
customerJf = '#客户积分#',
customerName = '#客户姓名#'
if (tagContent.includes(shortLink)) {
const rid = `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
tagContent = tagContent.replace(shortLink, `<span></span><wise id="${rid}">${shortLink}</wise>`)
}
if (tagContent.includes(customerJf)) {
const rid = `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
tagContent = tagContent.replace(customerJf, `<span></span><wise id="${rid}">${customerJf}</wise>`)
}
if (tagContent.includes(customerName)) {
const rid = `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
tagContent = tagContent.replace(customerName, `<span></span><wise id="${rid}">${customerName}</wise>`)
}
return tagContent
},
// 获取短信详情
getSMSDetail() {
this.$apis.points.getSmsDetailApi({ msgType: 1 }).then(res => {
if (res && Array.isArray(res)) {
res.forEach(el => {
if (el.msgNo == 1) {
this.formObj.message_first.messageContext = this.handlerDetailTagContent(el.msgContent)
this.formObj.message_first.switch = el.openType == 1 ? true : false
this.formObj.message_first.time = el.delayTime
this.formObj.message_first.model = el.msgContent
this.formObj.message_first.text = el.msgContent
this.formObj.message_first.id = el.id
} else if (el.msgNo == 2) {
this.formObj.message_second.messageContext = this.handlerDetailTagContent(el.msgContent)
this.formObj.message_second.switch = el.openType == 1 ? true : false
this.formObj.message_second.time = el.delayTime
this.formObj.message_second.model = el.msgContent
this.formObj.message_second.text = el.msgContent
this.formObj.message_second.id = el.id
} else if (el.msgNo == 3) {
this.formObj.message_three.messageContext = this.handlerDetailTagContent(el.msgContent)
this.formObj.message_three.switch = el.openType == 1 ? true : false
this.formObj.message_three.time = el.delayTime
this.formObj.message_three.model = el.msgContent
this.formObj.message_three.text = el.msgContent
this.formObj.message_three.id = el.id
}
})
}
})
},
// 短信开关触发接口
openSmsByHttp(e, item) {
if (item && item.id) {
const { id, msgNo, name } = item
const str = e ? `${name}已打开` : `${name}已关闭`
this.$apis.points.openSmsApi({ id, msgType: 1, msgNo, openType: e ? 1 : 2 }).then(res => {
if (res) {
this.$message({
message: str,
type: 'success'
})
}
})
}
}
}
}
......
......@@ -14,7 +14,13 @@
</div>
</div>
<div class="table-box">
<GLTable ref="listRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf">></GLTable>
<GLTable ref="listRef" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf">>
<div class="sendTypeSlot" slot="sendTypeSlot" slot-scope="scope">
<div :class="[{colorSuccess:scope.scope.sendType==1,colorFail:scope.scope.sendType==2,colorWait:scope.scope.sendType==0}]"></div>
<span v-if="scope.scope.sendType!=2">{{scope.scope.sendType==1?'已发送':'待发送'}}</span>
<span v-if="scope.scope.sendType==2">发送失败</span>
</div>
</GLTable>
</div>
</div>
</div>
......@@ -27,20 +33,20 @@ export default {
data() {
return {
searchForm: {
customerPhone: '',
status: '',
userPhone: '',
sendType: '',
merchantName: ''
},
searchFormData: [
{
label: '手机号',
name: 'batchNo',
name: 'userPhone',
type: 'input',
maxlength: 11
},
{
label: '状态',
name: 'status',
name: 'sendType',
type: 'select',
maxlength: 100,
optionList: [
......@@ -62,36 +68,36 @@ export default {
currentIndex: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableSearchForm: {},
getListApi: null,
getListApi: this.$apis.points.smsCustomerApi,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '用户姓名',
prop: 'merchantName',
prop: 'userName',
},
{
label: '用户手机号',
prop: 'batchNo',
prop: 'userPhone',
},
{
label: '当前积分',
minWidth: 120,
prop: 'totalIntegral'
prop: 'currentIntegral'
},
{
label: '所属门店',
prop: 'totalIntegral'
prop: 'merchantName'
},
{
label: '发送状态',
prop: 'totalIntegral'
minWidth: 120,
addHtml:'sendTypeSlot'
},
{
label: '发送时间',
// formatter: cell => dayjs(cell.createdDate).format('YYYY/MM/DD hh:mm:ss')
prop:'sendTime'
}
]
}
......@@ -99,12 +105,28 @@ export default {
},
mounted() {},
methods: {
handleSearch() {},
handleSearch() {
this.$refs.listRef.refreshTable()
},
handleReset() {
this.searchForm = this.$options.data.call(this).searchForm
this.$refs.listRef.refreshTable()
},
tabClick(index) {
this.currentIndex = index
this.$refs.listRef.refreshTable()
},
beforeSearchFn(){
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
getParams(){
let params = JSON.parse(JSON.stringify(this.searchForm))
params.msgType = 1
params.msgNo = +this.currentIndex+1
return params
}
}
}
......@@ -157,4 +179,21 @@ export default {
border-radius: 0 4px 4px 4px;
background: white;
}
.sendTypeSlot{
display: flex;
align-items: center;
}
.colorWait,.colorFail,.colorSuccess{
background: #FDB757;
width: 6px;
height: 6px;
border-radius: 50%;
margin-right: 4px;
}
.colorSuccess{
background: #2CCA74;
}
.colorFail{
background: #EB4E4E;
}
</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!