Commit 231c59ed by 杨北旺

短信联调

1 parent 772478b6
...@@ -239,6 +239,47 @@ const getTypeListApi = params => { ...@@ -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 { export default {
getList, getList,
getOrderDetail, getOrderDetail,
...@@ -260,5 +301,9 @@ export default { ...@@ -260,5 +301,9 @@ export default {
getIntegralDetail, getIntegralDetail,
getCustomerIntegralList, getCustomerIntegralList,
auditIntegral, auditIntegral,
getTypeListApi getTypeListApi,
createSmsApi,
getSmsDetailApi,
openSmsApi,
smsCustomerApi
} }
...@@ -4,7 +4,7 @@ ...@@ -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"> <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"> <template v-for="(item, index) in form_solt">
<div :key="index" :slot="item.name"> <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 style="position: relative" class="wrapper">
<div class="topSet flex"> <div class="topSet flex">
<span>发送时间:积分到账</span> <span>发送时间:积分到账</span>
...@@ -85,7 +85,8 @@ export default { ...@@ -85,7 +85,8 @@ export default {
time: null, time: null,
model: null, model: null,
text: '', text: '',
name: '短信一' name: '短信一',
msgNo: 1
}, },
message_second: { message_second: {
messageContext: '', messageContext: '',
...@@ -93,7 +94,8 @@ export default { ...@@ -93,7 +94,8 @@ export default {
time: null, time: null,
model: null, model: null,
text: '', text: '',
name: '短信二' name: '短信二',
msgNo: 2
}, },
message_three: { message_three: {
messageContext: '', messageContext: '',
...@@ -101,7 +103,8 @@ export default { ...@@ -101,7 +103,8 @@ export default {
time: null, time: null,
model: null, model: null,
text: '', text: '',
name: '短信三' name: '短信三',
msgNo: 3
} }
}, },
formData: [ formData: [
...@@ -147,7 +150,9 @@ export default { ...@@ -147,7 +150,9 @@ export default {
] ]
} }
}, },
mounted() {}, mounted() {
this.getSMSDetail()
},
methods: { methods: {
// 信息文案处理高亮和字数限制 // 信息文案处理高亮和字数限制
highText(title) { highText(title) {
...@@ -201,12 +206,25 @@ export default { ...@@ -201,12 +206,25 @@ export default {
return return
} }
_refs.addTag(`#${textName}#`) _refs.addTag(`#${textName}#`)
// this.formObj[type].messageContext = _refs.currentText
}, },
// 提交 // 提交
handleSave() { handleSave() {
const params = this.handlerParams() 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() { handleCancel() {
this.$router.back() this.$router.back()
...@@ -258,14 +276,83 @@ export default { ...@@ -258,14 +276,83 @@ export default {
if (isHaveTimeErr) return this.$message.error(`${errName2}发送时间需大于${errName}发送时间`) if (isHaveTimeErr) return this.$message.error(`${errName2}发送时间需大于${errName}发送时间`)
needCheckList.forEach(el => { needCheckList.forEach(el => {
let obj = { let obj = {
open: el.switch, msgType: 1,
time: el.time, msgNo: el.msgNo,
text: el.text 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) params.push(obj)
}) })
} }
return params 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 @@ ...@@ -14,7 +14,13 @@
</div> </div>
</div> </div>
<div class="table-box"> <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> </div>
</div> </div>
...@@ -27,20 +33,20 @@ export default { ...@@ -27,20 +33,20 @@ export default {
data() { data() {
return { return {
searchForm: { searchForm: {
customerPhone: '', userPhone: '',
status: '', sendType: '',
merchantName: '' merchantName: ''
}, },
searchFormData: [ searchFormData: [
{ {
label: '手机号', label: '手机号',
name: 'batchNo', name: 'userPhone',
type: 'input', type: 'input',
maxlength: 11 maxlength: 11
}, },
{ {
label: '状态', label: '状态',
name: 'status', name: 'sendType',
type: 'select', type: 'select',
maxlength: 100, maxlength: 100,
optionList: [ optionList: [
...@@ -62,36 +68,36 @@ export default { ...@@ -62,36 +68,36 @@ export default {
currentIndex: 0, currentIndex: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableSearchForm: {}, tableSearchForm: {},
getListApi: null, getListApi: this.$apis.points.smsCustomerApi,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: false, tableOption: false,
tableColumns: [ tableColumns: [
{ {
label: '用户姓名', label: '用户姓名',
prop: 'merchantName', prop: 'userName',
}, },
{ {
label: '用户手机号', label: '用户手机号',
prop: 'batchNo', prop: 'userPhone',
}, },
{ {
label: '当前积分', label: '当前积分',
minWidth: 120, prop: 'currentIntegral'
prop: 'totalIntegral'
}, },
{ {
label: '所属门店', label: '所属门店',
prop: 'totalIntegral' prop: 'merchantName'
}, },
{ {
label: '发送状态', label: '发送状态',
prop: 'totalIntegral' minWidth: 120,
addHtml:'sendTypeSlot'
}, },
{ {
label: '发送时间', label: '发送时间',
// formatter: cell => dayjs(cell.createdDate).format('YYYY/MM/DD hh:mm:ss') prop:'sendTime'
} }
] ]
} }
...@@ -99,12 +105,28 @@ export default { ...@@ -99,12 +105,28 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
handleSearch() {}, handleSearch() {
this.$refs.listRef.refreshTable()
},
handleReset() { handleReset() {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
this.$refs.listRef.refreshTable()
}, },
tabClick(index) { tabClick(index) {
this.currentIndex = 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 { ...@@ -157,4 +179,21 @@ export default {
border-radius: 0 4px 4px 4px; border-radius: 0 4px 4px 4px;
background: white; 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> </style>
\ No newline at end of file \ 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!