Commit 7e60ccfd authored by caimeng's avatar caimeng

短信发送功能开发完成

parent 280d68fb
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
this.onCancel && this.onCancel() this.onCancel && this.onCancel()
}, },
handleSubmit() { handleSubmit() {
this.$emit('update:visible', false) // this.$emit('update:visible', false)
this.onSubmit && this.onSubmit() this.onSubmit && this.onSubmit()
}, },
......
...@@ -89,31 +89,34 @@ ...@@ -89,31 +89,34 @@
<!-- 短信发送 --> <!-- 短信发送 -->
<template v-if="MessageDialogVisible"> <template v-if="MessageDialogVisible">
<BaseDialog width="45%" :footer="true" :visible.sync="MessageDialogVisible" title="发短信" <BaseDialog width="45%" @onCancel="handleMsgCancel" :visible.sync="MessageDialogVisible" title="发短信">
@onSubmit="handleMessageSubmit">
<el-form size="small" :model="MessageForm" :rules="MessageRules" ref="MessageForm" label-width="120px"> <el-form size="small" :model="MessageForm" :rules="MessageRules" ref="MessageForm" label-width="120px">
<el-row> <el-row>
<el-col :span="18"> <el-col :span="18">
<el-form-item label="短信模板:" prop="template"> <el-form-item label="短信模板:" prop="templateCode">
<el-select style="width: 100%;" v-model="MessageForm.template" placeholder="请选择"> <el-select style="width: 100%;" @change="handleSelectMsgTemplate" v-model="MessageForm.templateCode"
<el-option label="label" value="value"> placeholder="请选择">
<el-option v-for="(item, index) in msgTemplateEnmu" :key="index" :label="item.templateName"
:value="item.templateCode">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="投诉渠道:" prop="channel"> <template v-if="MessageForm.templateCode === 'COMPLAINT_RETURN_SMS'">
<el-select style="width: 100%;" v-model="MessageForm.channel" placeholder="请选择"> <el-form-item label="投诉渠道:" prop="complaintChannel">
<el-option label="label" value="value"> <el-input v-model="MessageForm.complaintChannel" @blur="handleInput" placeholder="请填写短信渠道" />
</el-option>
</el-select>
</el-form-item> </el-form-item>
</template>
<el-form-item label="短信内容:"> <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>
<el-form-item label="发送号码:"> <el-form-item label="发送号码:">
<el-input placeholder="请输入发送号码" v-model="MessageForm.mobile" disabled /> <el-input placeholder="请输入发送号码" v-model="MessageForm.mobile" disabled />
</el-form-item> </el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="handleMessageSubmit">提 交</el-button>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -155,14 +158,21 @@ export default { ...@@ -155,14 +158,21 @@ export default {
zyItem: "", zyItem: "",
data: [], data: [],
// 短信模板
msgTemplateEnmu: [],
// 短信发送 // 短信发送
MessageForm: { MessageForm: {
template: '', templateCode: '',
channel: '', complaintChannel: '',
context: 'asdfsaf', loanNo: '',
mobile: '13588322792' operator: '',
context: '',
mobile: ''
},
MessageRules: {
templateCode: [{ required: true, message: "请选择短信模板", trigger: 'change' }],
complaintChannel: [{ required: true, message: "请输入短信渠道", trigger: 'blur' }],
}, },
MessageRules: {},
MessageDialogVisible: false, MessageDialogVisible: false,
} }
}, },
...@@ -221,18 +231,83 @@ export default { ...@@ -221,18 +231,83 @@ export default {
this.mcTitle = title; this.mcTitle = title;
this.ActiveCom = com; 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) { handleMessageSend(row) {
const { loanNo, clientCell } = row;
this.initMsgTemplate();
this.MessageDialogVisible = true; 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() { handleMessageSubmit() {
this.$refs['MessageForm'].validate((valid) => { this.$refs['MessageForm'].validate(async (valid) => {
console.log(valid,'xx')
if (!valid) { if (!valid) {
return false 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 @@ ...@@ -15,44 +15,46 @@
<el-table-column <el-table-column
align="center" align="center"
prop="bizNo" prop="bizNo"
width="160" width="180"
label="ID/编号" label="ID/编号"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" align="center"
width="100px"
prop="smsType" prop="smsType"
label="短信类型" label="短信类型"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center"
prop="content" prop="content"
width="350" width="350"
label="短信内容" label="短信内容"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="content" width="78px"
prop="sendChannelStr"
label="短信通道" label="短信通道"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="content" width="78px"
prop="operator"
label="提交人" label="提交人"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="sendStateStr" prop="sendStateStr"
label="提交结果" label="发送结果"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="sendStateStr" prop="sendResultStatusStr"
label="发送结果" label="短信发送结果"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="memo" prop="memo"
label="备注" label="发送结果备注"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
align="center" 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