Commit 7e60ccfd authored by caimeng's avatar caimeng

短信发送功能开发完成

parent 280d68fb
......@@ -45,7 +45,7 @@ export default {
this.onCancel && this.onCancel()
},
handleSubmit() {
this.$emit('update:visible', false)
// this.$emit('update:visible', false)
this.onSubmit && this.onSubmit()
},
......
......@@ -89,31 +89,34 @@
<!-- 短信发送 -->
<template v-if="MessageDialogVisible">
<BaseDialog width="45%" :footer="true" :visible.sync="MessageDialogVisible" title="发短信"
@onSubmit="handleMessageSubmit">
<BaseDialog width="45%" @onCancel="handleMsgCancel" :visible.sync="MessageDialogVisible" title="发短信">
<el-form size="small" :model="MessageForm" :rules="MessageRules" ref="MessageForm" label-width="120px">
<el-row>
<el-col :span="18">
<el-form-item label="短信模板:" prop="template">
<el-select style="width: 100%;" v-model="MessageForm.template" placeholder="请选择">
<el-option label="label" value="value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="投诉渠道:" prop="channel">
<el-select style="width: 100%;" v-model="MessageForm.channel" placeholder="请选择">
<el-option label="label" value="value">
<el-form-item label="短信模板:" prop="templateCode">
<el-select style="width: 100%;" @change="handleSelectMsgTemplate" v-model="MessageForm.templateCode"
placeholder="请选择">
<el-option v-for="(item, index) in msgTemplateEnmu" :key="index" :label="item.templateName"
:value="item.templateCode">
</el-option>
</el-select>
</el-form-item>
<template v-if="MessageForm.templateCode === 'COMPLAINT_RETURN_SMS'">
<el-form-item label="投诉渠道:" prop="complaintChannel">
<el-input v-model="MessageForm.complaintChannel" @blur="handleInput" placeholder="请填写短信渠道" />
</el-form-item>
</template>
<el-form-item label="短信内容:">
<el-input type="textarea" v-model="MessageForm.context" placeholder="请输入发送号码" :row="4" disabled />
<el-input type="textarea" v-model="MessageForm.context" placeholder="请输入发送号码" :rows="4" disabled />
</el-form-item>
<el-form-item label="发送号码:">
<el-input placeholder="请输入发送号码" v-model="MessageForm.mobile" disabled />
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="handleMessageSubmit">提 交</el-button>
</el-form-item>
</el-col>
</el-row>
......@@ -155,14 +158,21 @@ export default {
zyItem: "",
data: [],
// 短信模板
msgTemplateEnmu: [],
// 短信发送
MessageForm: {
template: '',
channel: '',
context: 'asdfsaf',
mobile: '13588322792'
templateCode: '',
complaintChannel: '',
loanNo: '',
operator: '',
context: '',
mobile: ''
},
MessageRules: {
templateCode: [{ required: true, message: "请选择短信模板", trigger: 'change' }],
complaintChannel: [{ required: true, message: "请输入短信渠道", trigger: 'blur' }],
},
MessageRules: {},
MessageDialogVisible: false,
}
},
......@@ -221,18 +231,83 @@ export default {
this.mcTitle = title;
this.ActiveCom = com;
},
// 获取短信模板
async initMsgTemplate() {
try {
const { data, status } = await this.$$get('/detail/getSmsTemplate', {});
if (status === 200 && data.success) {
this.msgTemplateEnmu = data.result;
}
} catch (err) {
console.log(err, '初始化短信模板异常')
}
},
// 根据短信模板获取短信内容
async initMsgContext() {
try {
const params = this.MessageForm
const { data, status } = await this.$$post('/detail/getSmsTemplateContent', { ...params });
if (status === 200 && data.success) {
this.MessageForm.context = decodeURIComponent(data.result.smsContent);
this.MessageForm.mobile = data.result.sendPhone;
}
} catch (err) {
console.log(err, '初始化短信模板异常')
}
},
// 短信发送弹框
handleMessageSend(row) {
const { loanNo, clientCell } = row;
this.initMsgTemplate();
this.MessageDialogVisible = true;
this.MessageForm.loanNo = loanNo
this.MessageForm.mobile = clientCell
this.MessageForm.operator = localStorage.getItem('userName')
},
// 短信下拉
async handleSelectMsgTemplate(val) {
if (val !== 'COMPLAINT_RETURN_SMS') {
this.initMsgContext()
} else {
this.MessageForm.context = '';
this.MessageForm.mobile = '';
}
},
// 暗示法
handleInput(e) {
const value = e.target.value;
this.MessageForm.complaintChannel = value
this.initMsgContext();
},
// 重置
handleMsgCancel() {
this.$refs['MessageForm'].resetFields();
},
// 发送短信提交
handleMessageSubmit() {
this.$refs['MessageForm'].validate((valid) => {
console.log(valid,'xx')
this.$refs['MessageForm'].validate(async (valid) => {
if (!valid) {
return false
}
try {
const params = this.MessageForm
const { data, status } = await this.$$post('/detail/sendSms', { ...params });
if (status === 200 && data.success) {
this.$message({
message: '短信发送,操作成功',
type: 'success'
});
this.MessageDialogVisible = false;
this.handleMsgCancel();
}
} catch (err) {
console.log(err, '短信发送失败')
}
})
}
......
......@@ -15,44 +15,46 @@
<el-table-column
align="center"
prop="bizNo"
width="160"
width="180"
label="ID/编号"
></el-table-column>
<el-table-column
align="center"
width="100px"
prop="smsType"
label="短信类型"
></el-table-column>
<el-table-column
align="center"
prop="content"
width="350"
label="短信内容"
></el-table-column>
<el-table-column
align="center"
prop="content"
width="78px"
prop="sendChannelStr"
label="短信通道"
></el-table-column>
<el-table-column
align="center"
prop="content"
width="78px"
prop="operator"
label="提交人"
></el-table-column>
<el-table-column
align="center"
prop="sendStateStr"
label="提交结果"
label="发送结果"
></el-table-column>
<el-table-column
align="center"
prop="sendStateStr"
label="发送结果"
prop="sendResultStatusStr"
label="短信发送结果"
></el-table-column>
<el-table-column
align="center"
prop="memo"
label="备注"
label="发送结果备注"
></el-table-column>
<el-table-column
align="center"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment