commit message

This commit is contained in:
Chopper
2021-05-13 10:56:04 +08:00
commit ec3e958037
728 changed files with 132685 additions and 0 deletions

View File

@@ -0,0 +1,792 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Tabs value="MESSAGE" @on-click="paneChange">
<TabPane label="站内信列表" name="MESSAGE">
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchMessageForm" inline :label-width="70" class="search-form">
<Form-item label="消息标题" prop="title">
<Input
type="text"
v-model="searchMessageForm.title"
placeholder="请输入消息标题"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="消息内容" prop="content">
<Input
type="text"
v-model="searchMessageForm.content"
placeholder="请输入消息内容"
clearable
style="width: 200px"
/>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="operation" style="margin-top: 20px">
<Button @click="sendMessage" type="primary">发送消息</Button>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="messageColumns"
:data="messageData"
ref="table"
sortable="custom"
@on-sort-change="messageChangeSort"
@on-selection-change="messageChangeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchMessageForm.pageNumber"
:total="messageDataTotal"
:page-size="searchMessageForm.pageSize"
@on-change="messageChangePage"
@on-page-size-change="messageChangePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</TabPane>
<TabPane label="通知类站内信" name="SETTING">
<Row>
<Table
:loading="loading"
border
:columns="noticeColumns"
:data="noticeData"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="noticeDataTotal"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</TabPane>
</Tabs>
</Card>
</Col>
</Row>
<!-- 站内信模板编辑 -->
<Modal
:title="modalTitle"
v-model="modalVisible"
:mask-closable="false"
:width="800"
>
<div class="message-title">
<p>1左侧#{xxx}为消息变量</p>
<p>2如果要发送的消息包含消息变量则将消息变量复制到消息内容中即可注意格式</p>
<p>3比如消息变量为#{订单号}发送的内容为订单号为xxx的订单已经发货注意查收完整的消息内容应该为订单号为#{订单号}的订单已经发货注意查收</p>
</div>
<div class="send-setting">
<div class="left-show">
<div v-for="(item, index) in form.variables" >
#{<span>{{item}}</span>}
</div>
</div>
<div class="send-form">
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="通知节点" prop="noticeNode">
<Input v-model="form.noticeNode" clearable type="text" style="width: 90%" maxlength="20" disabled />
</FormItem>
<FormItem label="消息标题" prop="noticeTitle">
<Input v-model="form.noticeTitle" clearable type="text" style="width: 90%" maxlength="20"/>
</FormItem>
<FormItem label="消息内容" prop="noticeContent">
<Input v-model="form.noticeContent" clearable type="textarea" style="width: 90%" maxlength="50" :autosize="{maxRows:4,minRows: 4}" show-word-limit />
</FormItem>
</Form>
</div>
</div>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="handleSubmit">保存</Button>
</div>
</Modal>
<!-- 站内信发送 -->
<Modal
:title="messageModalTitle"
v-model="messageModalVisible"
:mask-closable="false"
:width="500"
>
<Form ref="messageSendForm" :model="messageSendForm" :label-width="100" :rules="messageFormValidate">
<FormItem label="消息标题" prop="title">
<Input v-model="messageSendForm.title" maxlength="15" clearable style="width: 90%"/>
</FormItem>
<FormItem label="消息内容" prop="content">
<Input
v-model="messageSendForm.content"
:rows="4"
type="textarea"
style="max-height:60vh;overflow:auto;width: 90%"
/>
</FormItem>
<FormItem label="发送范围">
<RadioGroup v-model="messageSendForm.messageRange" @on-change="selectShop">
<Radio label="ALL">全站</Radio>
<Radio label="APPOINT">指定商家</Radio>
</RadioGroup>
</FormItem>
<FormItem label="指定商家" v-if="shopShow">
<Select v-model="messageSendForm.userIds" filterable multiple style="width: 90%;"
label-in-value @on-change="getName">
<Option v-for="item in shopList" :value="item.id" :key="item.id" :lable="item.storeName">{{ item.storeName
}}
</Option>
</Select>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="messageModalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="sendMessageSubmit"
>发送
</Button
>
</div>
</Modal>
<!-- 站内信发送 -->
<Modal
:title="modalTitle"
v-model="messageDetailModalVisible"
:mask-closable="false"
:width="700"
>
<Form ref="messageSendForm" :model="messageSendForm" :label-width="100" :rules="messageFormValidate">
<FormItem label="消息标题" prop="title">
<Input v-model="messageSendForm.title" maxlength="15" clearable style="width: 50%" disabled/>
</FormItem>
<FormItem label="消息内容" prop="content">
<Input
disabled
v-model="messageSendForm.content"
:rows="4"
type="textarea"
style="max-height:60vh;overflow:auto;width: 50%"
/>
</FormItem>
<FormItem label="发送范围">
<RadioGroup v-model="messageSendForm.messageRange">
<Radio disabled label="ALL">全站</Radio>
<Radio disabled label="APPOINT">指定商家</Radio>
</RadioGroup>
</FormItem>
<FormItem label="指定商家">
<Row>
<Table
:loading="loading"
border
:columns="messageDetailColumns"
:data="shopMessageData"
ref="table"
sortable="custom"
@on-sort-change="messageChangeSort"
@on-selection-change="messageChangeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchShopMessageForm.pageNumber"
:total="shopMessageDataTotal"
:page-size="searchShopMessageForm.pageSize"
@on-change="messageChangePage"
@on-page-size-change="messageChangePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="messageDetailModalVisible = false">取消</Button>
</div>
</Modal>
</div>
</template>
<script>
import * as API_Setting from "@/api/setting.js";
import * as API_Other from "@/api/other.js";
import * as API_Shop from "@/api/shops.js";
export default {
name: "bill",
components: {},
data() {
return {
openSearch: true, // 显示搜索
openTip: true, // 显示提示
loading: true, // 表单加载状态
modalVisible: false, // 添加或编辑显示
modalTitle: "", // 添加或编辑标题
messageModalVisible: false, // 发送站内信模态框
messageModalTitle: "", // 发送站内信标题
messageDetailModalVisible: false, // 添加或编辑显示
shopShow: false, //指定商家是否出现
shopList: [],//店铺列表
drop: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
},
messageFormValidate: {
title: [
{required: true, message: '请输入消息标题', trigger: 'blur'},
],
content: [
{required: true, message: '请输入消息内容', trigger: 'blur'},
],
},
//管理端消息汇总
searchMessageForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
//发送给店铺的消息
searchShopMessageForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
selectDate: null,
form: {
noticeNode: "",
noticeTitle: ""
},
//消息发送表单
messageSendForm: {
messageRange: "ALL",
userIds: [],
userNames: [],
},
// 表单验证规则
formValidate: {
noticeNode: [
{required: true, message: '请输入通知节点', trigger: 'blur'},
],
noticeTitle: [
{required: true, message: '请输入通知标题', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '请输通知内容', trigger: 'blur'},
],
},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
messageSelectList: [], // 消息多选数据
messageSelectCount: 0, // 多选计数
selectCount: 0, // 多选计数
noticeColumns: [
{
title: "通知节点",
key: "noticeNode",
maxWidth: 270,
sortable: false,
},
{
title: "通知标题",
key: "noticeTitle",
minWidth: 200,
sortable: false,
},
{
title: "通知内容",
key: "noticeContent",
minWidth: 300,
sortable: false,
},
{
title: "状态",
key: "noticeStatus",
maxWidth: 100,
sortType: "desc",
render: (h, params) => {
if (params.row.noticeStatus == "OPEN") {
return h("Badge", {props: {status: "success", text: "开启"}})
} else if (params.row.noticeStatus == "CLOSE") {
return h("Badge", {props: {status: "processing", text: "关闭"}})
}
}
},
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 140,
render: (h, params) => {
let enableOrDisable = "";
if (params.row.noticeStatus == "OPEN") {
enableOrDisable = h(
"Button",
{
props: {
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.disable(params.row);
}
}
},
"关闭"
);
} else {
enableOrDisable = h(
"Button",
{
props: {
type: "success",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.enable(params.row);
}
}
},
"开启"
);
}
return h("div", [
enableOrDisable,
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.edit(params.row);
}
}
},
"编辑"
),
]);
}
},
],
noticeData: [], // 表单数据
noticeDataTotal: 0, // 表单数据总数
messageColumns: [
{
title: "消息标题",
key: "title",
minWidth: 150,
},
{
title: "消息内容",
key: "content",
minWidth: 350,
tooltip: true
},
{
title: "发送类型",
key: "messageRange",
width: 100,
render: (h, params) => {
if (params.row.messageRange == "ALL") {
return h('div', [
h('span', {}, '全站'),
]);
} else if (params.row.messageRange == "APPOINT") {
return h('div', [
h('span', {}, '指定用户'),
]);
}
}
},
{
title: "发送时间",
key: "createTime",
sortable: true,
width: 180,
sortable: false,
},
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 140,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.detail(params.row);
}
}
},
"详细"
),
h(
"Button",
{
props: {
type: "error",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.delete(params.row.id);
}
}
},
"删除"
),
]);
}
},
],
messageData: [], // 表单数据
messageDataTotal: 0, // 表单数据总数
messageDetailColumns: [
{
title: "店铺ID",
key: "storeId",
maxWidth: 300,
sortable: false,
},
{
title: "店铺名称",
key: "storeName",
sortable: false,
},
{
title: "是否已读",
key: "status",
render: (h, params) => {
if (params.row.status == "ALREADY_READY") {
return h( "Badge", {props: { status: "success",text: "已读" } })
} else if (params.row.status == "UN_READY") {
return h( "Badge", {props: { status: "processing",text: "未读" } })
}else{
return h( "Badge", {props: { status: "processing",text: "回收站" } })
}
}
},
],
shopMessageData: [], // 发送给店铺的消息数据
shopMessageDataTotal: 0, // 发送给店铺的消息数据总数
};
},
methods: {
init() {
this.getMessage();
},
//获取全部商家
getShopList() {
this.loading = true;
API_Shop.getShopList().then((res) => {
this.loading = false;
if (res.success) {
this.shopList = res.result;
}
});
this.loading = false;
},
paneChange(v) {
if (v == "SETTING") {
this.getNoticeMessage()
}
if (v == "MESSAGE") {
this.getMessage()
}
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getNoticeMessage();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getNoticeMessage();
},
handleSearch() {
this.searchMessageForm.pageNumber = 1;
this.searchMessageForm.pageSize = 10;
this.getMessage();
},
//消息每页条数发生变化
messageChangePageSize(v) {
this.searchMessageForm.pageSize = v;
this.getMessage();
},
//消息页数变化
messageChangePage(v) {
this.searchMessageForm.pageNumber = v;
this.getMessage();
this.clearSelectAll();
},
//消息
messageChangeSort(e) {
this.searchMessageForm.sort = e.key;
this.searchMessageForm.order = e.order;
this.getMessage();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getNoticeMessage();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
//消息
messageChangeSelect(e) {
this.messageSelectList = e;
this.messageSelectCount = e.length;
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
//获取发送段铺的名称
getName(value) {
this.messageSendForm.userNames = new Array()
value.forEach((item) => {
this.messageSendForm.userNames.push(item.label)
})
},
//删除站内信
delete(id){
console.warn(id)
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认删除此站内信 ?",
loading: true,
onOk: () => {
API_Setting.deleteMessage(id).then((res) => {
if (res.success) {
this.$Message.success("删除成功");
}
this.$Modal.remove();
this.getMessage();
});
}
});
},
//管理员发送消息
sendMessage() {
this.messageModalVisible = true
this.messageModalTitle = "发送站内信"
this.shopShow = false
this.messageSendForm =
{
messageRange: "ALL",
content: "",
title: "",
userIds: [],
userNames: [],
}
},
//管理员发送站内信提交
sendMessageSubmit() {
if (this.messageSendForm.userIds.length <= 0 && this.messageSendForm.messageRange == "APPOINT") {
this.$Message.error("请选择发送对象");
return
}
this.$refs["messageSendForm"].validate(valid => {
if (valid) {
API_Other.sendMessage(this.messageSendForm).then((res) => {
this.loading = false;
if (res.success) {
this.$Message.success("发送成功");
this.messageModalVisible = false
this.getMessage();
}
});
this.loading = false;
}
})
},
//弹出选择商家的框
selectShop(v) {
if (v == "APPOINT") {
this.getShopList()
this.shopShow = true
}
if (v == "ALL") {
this.shopShow = false
}
},
//获取管理员发送列表
getMessage() {
this.loading = true;
API_Other.getMessagePage(this.searchMessageForm).then((res) => {
this.loading = false;
if (res.success) {
this.messageData = res.result.records;
this.messageDataTotal = res.result.total;
}
});
this.loading = false;
},
getNoticeMessage() {
this.loading = true;
API_Setting.getNoticeMessageData(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.noticeData = res.result.records;
this.noticeDataTotal = res.result.total;
}
});
this.loading = false;
},
//保存通知类站内信
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
let params ={
noticeContent:this.form.noticeContent,
noticeTitle:this.form.noticeTitle
}
API_Setting.editNoticeMessage(this.form.id, params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
this.modalVisible = false;
this.getNoticeMessage();
}
});
}
});
},
//消息详情
detail(v) {
this.searchShopMessageForm.messageId = v.id
API_Other.getShopMessage(this.searchShopMessageForm).then((res) => {
if (res.success) {
this.messageDetailModalVisible = true;
this.modalTitle = "消息详情"
this.messageSendForm = v
this.shopMessageData = res.result.records;
this.shopMessageDataTotal = res.result.total;
}
});
},
edit(v) {
API_Setting.getNoticeMessageDetail(v.id).then((res) => {
if (res.success) {
this.modalTitle = "编辑通知类推送"
this.modalVisible = true
this.form = res.result
}
});
},
//禁用站内信模板
disable(v) {
API_Setting.updateMessageStatus(v.id,"CLOSE").then((res) => {
if (res.success) {
this.$Message.success("禁用成功");
this.getNoticeMessage();
}
});
},
//启用站内信模板
enable(v) {
API_Setting.updateMessageStatus(v.id,"OPEN").then((res) => {
if (res.success) {
this.$Message.success("启用成功");
this.getNoticeMessage();
}
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss">
@import "@/styles/table-common.scss";
@import "sms.scss";
</style>

View File

@@ -0,0 +1,151 @@
.card {
width: 100%;
height: 100%;
position: fixed;
}
.cardBox {
display: inline-block;
border-radius: 2px;
line-height: 1.5;
margin-right: 20px;
width: 300px;
border: 1px solid #eee;
padding: 10px;
}
.methodItem {
width: 100%;
border: 1px solid #f5f5f5;
text-align: center;
padding: 20px 0;
}
methodItem img {
width: 220px;
height: 86px;
}
methodItem h4 {
font-size: 14px;
color: #333;
margin-top: 5px;
}
.methodItem img {
width: 220px;
height: 86px;
}
.bar {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 10px 8px 0;
}
.send-setting .left-show {
width: 230px;
padding: 20px 30px 20px 10px;
border: 1px solid #eee;
background-color: #fafafa;
}
.send-form {
flex: 1;
padding: 10px;
border: 1px solid #eee;
margin-left: 24px;
background-color: #fafafa;
}
.send-setting {
display: flex;
margin: 20px 0 0 0;
.sms {
word-break: break-all;
display: inline-block;
background-color: #eee;
max-width: 220px;
padding: 10px;
margin-bottom: 10px;
border-radius: 6px;
}
}
.choose-member {
display: flex;
height: 400px;
border: 1px solid #eee;
margin-bottom: 20px;
}
.source-member {
width: 50%;
border-right: 1px solid #eee;
padding: 10px;
}
.btns {
> span {
display: flex;
align-items: center;
justify-content: space-between;
}
}
.mobile {
margin-right: 20px;
}
.nickname {
font-size: 12px;
color: #999;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.traget-member {
width: 50%;
padding: 10px;
}
.scroll-card {
margin: 5px 0;
}
.ivu-card-body {
padding: 1px;
margin-left: 7px;
}
.checkbox-tag {
height: 35px;
width: 100%;
}
.ivu-tag-border.ivu-tag-closable .ivu-icon-ios-close {
margin-right: 68px !important;
left: 7px;
top: 0px;
}
.ivu-tag-text {
line-height: 35px;
font-size: 14px;
}
.message-title{
background-color: #fff5eb;
border: 1px solid #ffc999;
box-sizing: border-box;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
padding: 8px 15px;
border-radius: 2px;
}

View File

@@ -0,0 +1,928 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Tabs value="LIST" @on-click="paneChange">
<TabPane label="发送任务列表" name="LIST">
<Row class="operation" style="margin-bottom: 10px">
<Button @click="sendBatchSmsModal" type="primary">发送短信</Button>
</Row>
<Row>
<Table :loading="loading" border :columns="smsColumns" :data="smsData" ref="table" sortable="custom" @on-sort-change="templateChangeSort">
</Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page :current="smsSearchForm.pageNumber" :total="smsTotal" :page-size="smsSearchForm.pageSize" @on-change="smsChangePage" @on-page-size-change="smsChangePageSize"
:page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</TabPane>
<TabPane label="短信模板" name="TEMPLATE">
<Row class="operation" style="margin-bottom: 10px">
<Button @click="addTemplate" type="primary">添加短信模板</Button>
<Button @click="syncTemplate" type="info">同步</Button>
</Row>
<Row>
<Table :loading="loading" border :columns="templateColumns" :data="templateData" ref="table" sortable="custom" @on-sort-change="smsChangeSort">
</Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page :current="templateSearchForm.pageNumber" :total="templateTotal" :page-size="templateSearchForm.pageSize" @on-change="templateChangePage"
@on-page-size-change="templateChangePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</TabPane>
<TabPane label="短信签名" name="SIGN">
<Row class="operation" style="margin-bottom: 10px">
<Button @click="addSign" type="primary">添加短信签名</Button>
<Button @click="syncSign" type="info">同步</Button>
</Row>
<Row>
<Table :loading="loading" border :columns="signColumns" :data="signData" ref="table" sortable="custom" @on-sort-change="signChangeSort">
<template slot="signStatus" slot-scope="scope">
<div v-if="scope.row.signStatus ==2 ">
审核拒绝
<Poptip trigger="hover" :content=scope.row.reason placement="top-start" transfer>
<span style="color: #ed3f14">原因</span>
</Poptip>
</div>
<div v-if="scope.row.signStatus ==0 ">
审核中
</div>
<div v-if="scope.row.signStatus ==1 ">
审核通过
</div>
</template>
</Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page :current="signSearchForm.pageNumber" :total="signTotal" :page-size="signSearchForm.pageSize" @on-change="signChangePage" @on-page-size-change="signChangePageSize"
:page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</TabPane>
</Tabs>
</Card>
</Col>
</Row>
<Modal :title="templateModalTitle" v-model="templateModalVisible" :mask-closable="false" :width="500">
<Form ref="templateForm" :model="templateForm" :label-width="100" :rules="templateFormValidate">
<FormItem label="模板名称" prop="templateName">
<Input v-model="templateForm.templateName" maxlength="30" clearable style="width: 90%" placeholder="请输入模板名称不超过30字符" />
</FormItem>
<FormItem label="模板内容" prop="templateContent">
<Input v-model="templateForm.templateContent" clearable type="textarea" style="width: 90%" maxlength="200" :autosize="{maxRows:5,minRows: 5}" show-word-limit
placeholder="请输入短信内容不超过500字符不支持【】、★、 ※、 →、 ●等特殊符号;" />
</FormItem>
<FormItem label="申请说明" prop="remark">
<Input v-model="templateForm.remark" clearable type="textarea" style="width: 90%" maxlength="150" :autosize="{maxRows:4,minRows: 4}" show-word-limit
placeholder="请描述您的业务使用场景不超过100字符用于春节集五福" />
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="templateModalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="templateSubmit">提交
</Button>
</div>
</Modal>
<Modal :title="sendSmsModalTitle" v-model="sendSmsModal" :mask-closable="false" :width="900">
<div class="send-setting">
<div class="left-show" v-html="smsContent">
<div class="sms">效果预览</div>
</div>
<div class="send-form">
<Form ref="smsForm" :model="smsForm" :label-width="100" :rules="smsFormValidate">
<FormItem label="短信签名" prop="signName">
<Select @on-change="selectSmsSign" v-model="smsForm.signName" style="width: 35%;">
<Option v-for="item in smsSigns" :value="item.signName" :key="item.signName">{{ item.signName }}
</Option>
</Select>
</FormItem>
<FormItem label="短信模板" prop="messageCode">
<Select @on-change="selectSmsTemplate" v-model="smsForm.messageCode" style="width: 35%;">
<Option v-for="(item,index) in smsTemplates" :key="index" :value="item.templateCode">{{
item.templateName }}
<input type="hidden"></input>
</Option>
</Select>
</FormItem>
<FormItem label="短信内容" prop="context">
<Input v-model="smsForm.context" clearable type="textarea" style="width: 90%" maxlength="50" :autosize="{maxRows:4,minRows: 4}" show-word-limit disabled />
</FormItem>
<FormItem label="接收人" prop="smsRange">
<p>
已选<span style="color: #f56c1d"> {{memberNum}}</span>预计耗费条数<span style="color: #f56c1d">{{this.smsForm.num}}</span>
</p>
<RadioGroup @on-change="smsRangeChange" v-model="smsForm.smsRange">
<Radio label="1">全部会员</Radio>
<Radio label="2">自定义选择</Radio>
</RadioGroup>
</FormItem>
<FormItem>
<div class="choose-member" v-if="customSms">
<div class="source-member">
<Input suffix="ios-search" @on-enter="memberSearch" v-model="memberSearchParam.mobile" @on-blur="memberSearch" placeholder="请输入手机号码" style="width: 92%" />
<div style="margin-top: 5px">
<Scroll :on-reach-bottom="memberSearchEdge">
<div dis-hover v-for="(item, index) in members" :key="index" class="scroll-card">
<Button class="btns" :class="{'active':item.___selected}" @click="moveMember(index,item)" style="width: 100%;text-align: left">
<span v-if="item.mobile" class="mobile">
{{item.mobile}}
</span>
<span class="nickname">
{{ item.nickName}}
</span>
</Button>
</div>
</Scroll>
</div>
</div>
<div class="traget-member" style="overflow:auto">
<div v-for="(item, index) in alreadyCheckShow" :key="index" >
<Tag class="checkbox-tag" closable @on-close="alreadyCheckClose(item,index)">{{item.mobile ||
item.nickName}}
</Tag>
</div>
</div>
</div>
</FormItem>
</Form>
</div>
</div>
<div slot="footer">
<Button type="text" @click="sendSmsModal = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="sendSms">发送</Button>
</div>
</Modal>
</div>
</template>
<script>
import * as API_Setting from "@/api/setting.js";
import * as API_Member from "@/api/member.js";
export default {
name: "sms",
components: {},
data() {
return {
customSms: false, //当选择自动发送对象 展示
isActive: false,
alreadyCheck: [], //已经选中的数据
alreadyCheckShow: [], //已经选择的值负责显示
memberPage: 0,
members: [], //所有会员
smsTemplateContent: "", //短信模板内容
memberNum: 0, //会员总数
smsNum: 0, //预计发送短信条数
smsContent: "<div class='sms'>效果预览</div>", //短信内容
smsTemplates: [], //短信模板
smsSigns: [], //短信签名
sendSmsModal: false, //弹出发送短信模态框
sendSmsModalTitle: "短信发送", //发送短信模态框标题
modalType: 0, // 添加或编辑标识
templateModalVisible: false, //添加短信模板弹出框
templateModalTitle: "", //添加短信模板弹出框标题
templateForm: {}, //短信模板添加form
submitLoading: false,
selected: "",
settingData: "",
modalTitle: "设置",
modalVisible: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
signSearchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
//短信模板查询form
templateSearchForm: {
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
//会员条数查询form
memberSearchFrom: {
disabled: "OPEN", // 会员状态
},
//会员查询条件
memberSearchParam: {
pageNumber: 1, // 当前页数
pageSize: 8, // 页面大小
disabled: "OPEN", // 会员状态
},
//短信记录查询form
smsSearchForm: {
sort: "createTime",
order: "desc",
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
smsForm: {
smsName: "",
signName: "",
context: "",
smsRange: "1",
num: 0,
messageCode: "",
}, //短信发送form
//短信发送参数校验
smsFormValidate: {
signName: [
{
required: true,
message: "请选择短信签名",
trigger: "blur",
},
],
messageCode: [
{
required: true,
message: "请选择短信模板",
trigger: "blur",
},
],
},
templateFormValidate: {
templateName: [
{
required: true,
message: "请输入短信模板名称",
trigger: "blur",
},
],
templateContent: [
{
required: true,
message: "请输入短信模板内容",
trigger: "blur",
},
],
remark: [
{
required: true,
message: "请输入短信模板申请说明",
trigger: "blur",
},
],
},
smsColumns: [
{
title: "模板名称",
key: "smsName",
width: 250,
},
{
title: "签名",
width: 150,
key: "signName",
},
{
title: "短信内容",
minWidth: 300,
key: "context",
tooltip: true,
},
{
title: "预计发送条数",
key: "num",
width: 140,
},
{
title: "操作",
key: "action",
align: "center",
width: 150,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "primary",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.detail(params.row);
},
},
},
"详细"
),
]);
},
},
],
smsData: [], // 表单数据
smsTotal: 0, // 表单数据总数
templateColumns: [
{
title: "模板code",
key: "templateCode",
},
{
title: "模板名称",
key: "templateName",
},
{
title: "模板内容",
key: "templateContent",
},
{
title: "状态",
key: "templateStatus",
headerAlign: "center",
Width: "100px",
render: (h, params) => {
if (params.row.templateStatus == 0) {
return h("div", {}, "审核中");
} else if(params.row.templateStatus == 1){
return h("div", {}, "审核通过");
} else {
return h("div", {}, "审核失败");
}
},
},
{
title: "操作",
key: "action",
fixed: "right",
width: 200,
align: "center",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small",
icon: "ios-create-outline",
},
style: {
marginRight: "5px",
},
attrs: {
disabled: params.row.templateStatus == 2 ? false : true,
},
on: {
click: () => {
this.editTemplate(params.row);
},
},
},
"编辑"
),
h(
"Button",
{
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px",
},
attrs: {
disabled: params.row.templateStatus == 0 ? true : false,
},
on: {
click: () => {
this.deleteSmsTemplate(params.row);
},
},
},
"删除"
),
]);
},
},
],
templateData: [], // 表单数据
templateTotal: 0, // 表单数据总数
signColumns: [
{
title: "签名名称",
key: "signName",
},
{
title: "申请说明",
key: "remark",
},
{
title: "状态",
key: "signStatus",
headerAlign: "center",
Width: "100px",
slot: "signStatus",
},
{
title: "操作",
key: "action",
fixed: "right",
width: 200,
align: "center",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small",
icon: "ios-create-outline",
},
attrs: {
disabled: params.row.signStatus == 2 ? false : true,
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.editSign(params.row);
},
},
},
"编辑"
),
h(
"Button",
{
props: {
type: "error",
size: "small",
icon: "ios-create-outline",
},
attrs: {
disabled: params.row.signStatus == 0 ? true : false,
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.deleteSmsSign(params.row);
},
},
},
"删除"
),
]);
},
},
],
signData: [], // 表单数据
signTotal: 0, // 表单数据总数
};
},
filters: {},
methods: {
init() {
this.getSms();
//查询会员总数
this.getMemberNum();
},
//查询会员条数
getMemberNum() {
API_Member.getMemberNum(this.memberSearchFrom).then((res) => {
this.loading = false;
if (res.success) {
this.memberNum = res.result;
this.smsForm.num = this.memberNum; //全部会员则会员数就等于条数
}
});
},
//已经选择的人取消选中
alreadyCheckClose(val,index) {
this.alreadyCheck.splice(index, 1);
this.alreadyCheckShow.splice(index, 1);
this.members.forEach((item,index)=>{
if(item.___selected && item.mobile == val.mobile){
item.___selected = false
}
})
this.smsForm.num--;
this.memberNum--;
},
//发送短信详细
detail(){
},
//选择接收人事件
smsRangeChange(v) {
this.memberNum = 0;
this.smsForm.num = 0;
if (v == 1) {
this.alreadyCheck = [];
this.alreadyCheckShow = [];
this.customSms = false;
this.getMemberNum();
}
if (v == 2) {
this.customSms = true;
this.getMembers();
}
},
//搜索会员
memberSearch() {
this.memberSearchParam.pageNumber = 1;
this.members = [];
this.getMembers();
},
//移动会员
moveMember(index, item) {
if (!item.mobile) {
this.$Message.error("当前用户暂无手机号绑定");
return false;
}
item.___selected = true;
if (this.alreadyCheck.length == 0) {
this.alreadyCheck.push(item.mobile);
this.alreadyCheckShow.push(item);
this.smsForm.num++;
this.memberNum++;
} else {
//如果已选择数组内存在此用户则不在进行选择
let result = this.alreadyCheck.indexOf(item.mobile);
if (result < 0) {
this.smsForm.num++;
this.memberNum++;
this.alreadyCheck.push(item.mobile);
this.alreadyCheckShow.push(item);
}
}
},
//底部滑动查询会员
memberSearchEdge() {
return new Promise((resolve) => {
setTimeout(() => {
if (this.memberPage != this.memberSearchParam.pageNumber) {
this.memberSearchParam.pageNumber++;
this.getMembers();
resolve();
} else {
resolve();
return false;
}
}, 1000);
});
},
//分页查询会员信息
getMembers() {
API_Member.getMemberListData(this.memberSearchParam).then((res) => {
this.loading = false;
if (res.success) {
res.result.records.forEach((item) => {
item.___selected = false;
this.members.push(item);
});
this.memberPage = res.result.pages;
}
});
},
//弹出发送短信模态框
sendBatchSmsModal() {
this.templateSearchForm.templateStatus = 1;
API_Setting.getSmsTemplatePage(this.templateSearchForm).then((res) => {
if (res.success) {
this.smsTemplates = res.result.records;
}
});
this.signSearchForm.signStatus = 1;
API_Setting.getSmsSignPage(this.signSearchForm).then((res) => {
if (res.success) {
this.smsSigns = res.result.records;
}
});
this.smsContent = "<div class='sms'>效果预览</div>";
//添加的时候将已经选过的手机号码置为空
this.alreadyCheck = [];
this.alreadyCheckShow = [];
this.smsTemplateContent = "效果预览";
// this.smsTemplateContent = "";
this.smsForm = {
smsName: "",
signName: "",
context: "",
smsRange: "1",
num: 0,
messageCode: "",
};
this.getMemberNum();
this.loading = false;
this.sendSmsModal = true;
},
setting() {
this.modalVisible = true;
},
//pane切换事件
paneChange(v) {
if (v == "TEMPLATE") {
this.getSmsTemplate();
}
if (v == "SIGN") {
this.getSmsSign();
}
},
//短信签名变化方法
selectSmsSign(v) {
if (v != void 0) {
//给预览赋值
this.smsContent =
"<div class='sms'>【" +
v +
"】" +
" " +
this.smsTemplateContent +
"</div>";
} else {
this.smsContent =
"<div class='sms'>效果预览" + this.smsTemplateContent + "</div>";
}
},
//短信模板变化方法
selectSmsTemplate(v) {
//循环短信模板 如果选择短信模板匹配则查询出当前模板的内容
this.smsTemplates.forEach((e) => {
if (this.smsForm.messageCode == e.templateCode) {
this.smsTemplateContent = e.templateContent;
this.smsForm.smsName = e.templateName;
}
});
if (this.smsForm.signName != "" && this.smsForm.signName != void 0) {
this.smsContent =
"<div class='sms'>【" +
this.smsForm.signName +
"】" +
this.smsTemplateContent +
"</div>";
} else {
this.smsContent =
"<div class='sms'>" + this.smsTemplateContent + "</div>";
}
this.smsForm.context = this.smsTemplateContent;
},
//查询方法
handleSearch() {},
//删除短信模板
deleteSmsTemplate(v) {
let params = {
templateCode: v.templateCode,
};
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除此短信模板?",
loading: true,
onOk: () => {
API_Setting.deleteSmsTemplatePage(params).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("删除成功");
this.getSmsTemplate();
}
});
},
});
},
//发送短信
sendSms() {
this.$refs.smsForm.validate((valid) => {
const mobile = JSON.stringify(this.alreadyCheck);
this.smsForm.mobile = mobile;
if (valid) {
API_Setting.sendSms(this.smsForm).then((res) => {
if (res.success) {
this.$Message.success("发送成功");
this.getSms();
this.sendSmsModal = false;
}
});
}
});
},
//添加短信签名
addSign() {
this.$router.push({ name: "add-sms-sign" });
},
//新增短信模板
addTemplate() {
this.templateModalVisible = true;
this.templateModalTitle = "添加短信模板";
this.templateForm = {};
},
//新增短信模板
editTemplate(v) {
this.templateModalVisible = true;
this.templateModalTitle = "修改短信模板";
this.templateForm = v;
this.modalType = 1;
},
//同步签名
syncSign() {
this.loading = true;
API_Setting.syncSign().then((res) => {
this.loading = false;
if (res.success) {
this.$Message.success("同步成功");
this.getSmsSign();
}
});
this.loading = false;
},
//短信模板添加提交
templateSubmit() {
this.$refs.templateForm.validate((valid) => {
if (valid) {
this.loading = true;
if (this.modalType == 0) {
API_Setting.addSmsTemplatePage(this.templateForm)
.then((res) => {
this.loading = false;
if (res.code === 200) {
this.$Message.success("添加成功");
this.loading = false;
this.templateModalVisible = false;
this.getSmsTemplate();
}
})
.catch(() => {
this.loading = false;
});
} else {
API_Setting.editSmsTemplatePage(this.templateForm)
.then((res) => {
this.loading = false;
if (res.code === 200) {
this.$Message.success("修改成功");
this.loading = false;
this.templateModalVisible = false;
this.getSmsTemplate();
}
})
.catch(() => {
this.loading = false;
});
}
}
});
},
//删除短信签名
deleteSmsSign(v) {
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除此短信签名?",
loading: true,
onOk: () => {
API_Setting.deleteSign(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("删除成功");
this.getSmsTemplate();
}
});
},
});
},
//短信模板同步
syncTemplate() {
this.loading = true;
API_Setting.syncTemplate().then((res) => {
this.loading = false;
if (res.success) {
this.$Message.success("同步成功");
this.getSmsTemplate();
}
});
this.loading = false;
},
//短信记录页数变化
smsChangePage(v) {
this.smsSearchForm.pageNumber = v;
this.getSms();
},
//短信记录页数变化
smsChangePageSize(v) {
this.smsSearchForm.pageSize = v;
this.getSms();
},
//短信模板页数变化
templateChangePage(v) {
this.templateSearchForm.pageNumber = v;
this.getSmsTemplate();
},
//短信模板页数变化
templateChangePageSize(v) {
this.templateSearchForm.pageSize = v;
this.getSmsTemplate();
},
templateChangeSort(e) {
this.templateSearchForm.sort = e.key;
this.templateSearchForm.order = e.order;
this.getSmsTemplate();
},
smsChangeSort(e) {
this.smsSearchForm.sort = e.key;
this.smsSearchForm.order = e.order;
this.getSms();
},
//分页获取短信模板数据
getSmsTemplate() {
this.loading = true;
API_Setting.getSmsTemplatePage(this.templateSearchForm).then((res) => {
this.loading = false;
if (res.success) {
this.templateData = res.result.records;
this.templateTotal = res.result.total;
}
});
this.loading = false;
},
//分页获取短信记录数据
getSms() {
this.loading = true;
API_Setting.getSmsPage(this.smsSearchForm).then((res) => {
this.loading = false;
if (res.success) {
this.smsData = res.result.records;
this.smsTotal = res.result.total;
}
});
this.loading = false;
},
//短信模板页数变化
signChangePage(v) {
this.signSearchForm.pageNumber = v;
this.getSmsSign();
},
//短信模板页数变化
signChangePageSize(v) {
this.signSearchForm.pageSize = v;
this.getSmsSign();
},
signChangeSort(e) {
this.signSearchForm.sort = e.key;
this.signSearchForm.order = e.order;
this.getSmsSign();
},
//修改短信签名
editSign(v) {
this.$router.push({ name: "add-sms-sign", query: { id: v.id } });
},
//分页获取短信签名数据
getSmsSign() {
this.loading = true;
API_Setting.getSmsSignPage(this.signSearchForm).then((res) => {
this.loading = false;
if (res.success) {
this.signData = res.result.records;
this.signTotal = res.result.total;
}
});
this.loading = false;
},
},
mounted() {
this.init();
},
watch: {},
};
</script>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
@import "sms.scss";
.split {
height: 200px;
border: 1px solid #dcdee2;
}
.split-pane {
padding: 10px;
}
</style>

View File

@@ -0,0 +1,195 @@
<template>
<Card>
<div style="margin-top: 0px">
<div class="sign-name" v-if="id == undefined">
新增签名
</div>
<div class="sign-name" v-else>
修改签名
</div>
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="签名" prop="signName">
<Input v-model="form.signName" maxlength="12" clearable style="width: 28%"
placeholder="仅限2-12个字符建议使用App应用名称或是网站名/公司名"/>
</FormItem>
<FormItem label="签名来源" prop="signSource">
<Select v-model="form.signSource" placeholder="请选择签名来源" style="width: 28%">
<Option :value="0">企事业单位的全称或简称</Option>
<Option :value="1">工信部备案网站的全称或简称</Option>
<Option :value="2">App应用的全称或简称</Option>
<Option :value="3">公众号或小程序的全称或简称</Option>
<Option :value="4">电商平台店铺名的全称或简称</Option>
<Option :value="5">商标名的全称或简称</Option>
</Select>
</FormItem>
<div class="div-remark div-remark-first">
签名来源选择工信部备案网站的全称或简称时请在说明中添加网站域名加快审核速度
</div>
<div class="div-remark div-remark-bottom">
如果选择APP应用的全称或简称或公众号或小程序的全称或简称则网站APP小程序或公众号必须已上线
</div>
<FormItem label="证明文件">
<div style="float: left">
<upload-pic-thumb
v-model="form.businessLicense"
:multiple="false"
:max-size="2048"
>
</upload-pic-thumb>
</div>
<div style="float: left;margin-left: 20px">
<upload-pic-thumb
v-model="form.license"
:max-size="2048"
:multiple="false"
></upload-pic-thumb>
</div>
</FormItem>
<div class="div-remark div-remark-first">
第一张为营业执照第二张为授权委托书请上传签名归属方的企事业单位的企业营业执照组织机构代码证税务登记证三证合一的证件及授权委托书
</div>
<div class="div-remark div-remark-bottom">
支持jpgpnggifjpeg格式的图片每张图片不大于2MB
</div>
<FormItem label="申请说明" prop="remark">
<Input v-model="form.remark" clearable type="textarea" style="width: 50%" maxlength="100"
:autosize="{maxRows:4,minRows: 4}" show-word-limit
placeholder="请描述您的业务使用场景不超过100字符验证码、双十一大促营销"/>
</FormItem>
</Form>
<div class="footer">
<Button type="primary" :loading="submitLoading" @click="addSignSubmit">提交
</Button
>
</div>
</div>
</Card>
</template>
<script>
import * as API_Setting from "@/api/setting.js";
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
export default {
name: "smsSign",
components: {
uploadPicThumb
},
data() {
return {
id: 0,
form: {
signName: "",
businessLicense: "",
license: "",
},
loading: false,
formValidate: {
signName: [{required: true, message: "签名名称不能为空", trigger: "blur"}],
remark: [{required: true, message: "申请说明不能为空", trigger: "blur"}],
businessLicense: [{required: true, message: " ", trigger: "blur"}],
},
submitLoading: false
}
},
filters: {},
methods: {
init() {
this.id = this.$route.query.id;
if (this.id != undefined) {
this.getSmsSignDetail();
}
},
//添加短信模板
addSignSubmit() {
//校验证件信息
if (this.form.businessLicense == "" || this.form.license == "") {
this.$Message.error("请完善证件信息");
return
}
//校验签名来源
if (this.form.signSource == "") {
this.$Message.error("请选择签名来源");
return
}
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
//新增
if (this.id == undefined) {
API_Setting.addSmsSign(this.form).then(res => {
this.loading = false;
if (res.code === 200) {
this.$Message.success('添加成功');
this.$router.back()
}
}).catch(() => {
this.loading = false;
});
} else {
API_Setting.editSmsSign(this.form).then(res => {
this.loading = false;
if (res.code === 200) {
this.$Message.success('修改成功');
this.$router.back()
}
}).catch(() => {
this.loading = false;
});
}
}
})
},
//查询短信签名详细
getSmsSignDetail() {
API_Setting.smsSignDetail(this.id).then(res => {
this.loading = false;
if (res.code === 200) {
this.form = res.result
}
})
}
},
mounted() {
this.init();
},
};
</script>
<style lang="scss">
.sign-name {
margin-top: 5px;
margin-left: 20px;
font-size: 16px;
margin-bottom: 30px;
color: #333;
}
.div-remark {
margin-left: 100px;
margin-bottom: 2px;
color: #999;
}
.div-remark-first {
margin-top: -17px;
}
.div-remark-bottom {
margin-bottom: 8px;
}
.footer {
margin-left: 100px;
}
</style>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>