<template>
|
<div class="content">
|
<header>
|
<div class="headerContent">
|
<div class="find">
|
<div class="search-item">
|
<span>输入查询:</span>
|
<el-input
|
|
style="flex: 1;margin-left: 15px"
|
:placeholder="
|
isStorePage() ? '店铺(门店)名称' : '请输入店铺编号'
|
"
|
v-model="storeCode"
|
/>
|
</div>
|
<div class="search-item">
|
<span>店铺状态:</span>
|
<el-select v-model="storeStatus" style="margin-left: 15px" placeholder="选择店铺状态">
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</div>
|
<div class="findBtn">
|
<el-button type="primary" @click="search" icon="el-icon-search"
|
>查询</el-button
|
>
|
<el-button icon="el-icon-delete-solid" @click="handleReset"
|
>重置</el-button
|
>
|
</div>
|
</div>
|
<el-button
|
v-if="isStorePage()"
|
type="primary"
|
icon="el-icon-plus"
|
class="button-addition"
|
@click="handleView(null, 'create')"
|
>添加</el-button
|
>
|
</div>
|
</header>
|
<main>
|
<!-- 数据展示 -->
|
<el-table
|
border
|
stripe
|
ref="multipleTable"
|
:header-cell-style="{
|
background: '#F5F5F5',
|
'font-weight': '650',
|
'line-height': '45px',
|
}"
|
:data="tableData"
|
style="width: 100%"
|
:row-class-name="tableRowClassName"
|
>
|
<el-table-column type="selection" min-width="5"> </el-table-column>
|
<el-table-column prop="storeNumber" label="店铺编号" min-width="10">
|
</el-table-column>
|
<el-table-column prop="storeName" label="店铺名称" min-width="10">
|
</el-table-column>
|
<el-table-column prop="owner" label="店铺联系人" min-width="10">
|
</el-table-column>
|
<el-table-column prop="contact" label="店铺联系电话" min-width="10">
|
</el-table-column>
|
<el-table-column
|
prop="storeAddress"
|
label="店铺详细地址"
|
min-width="10"
|
>
|
</el-table-column>
|
<el-table-column prop="storeScore" label="店铺积分" min-width="10">
|
</el-table-column>
|
<el-table-column prop="videoPoint" label="关联摄像机" min-width="10">
|
<template v-if="scope.row.videoId" slot-scope="scope">
|
<span>{{ scope.row.videoPoint.name }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="status" label="状态" min-width="10">
|
<template slot-scope="scope">
|
<span>{{ scope.row.status == 1 ? "经营" : "倒闭" }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="operation" label="操作" min-width="20">
|
<template slot-scope="scope">
|
<div v-if="!isStorePage()" class="operation">
|
<el-link
|
icon="el-icon-edit"
|
:underline="false"
|
@click="handleView(scope.row, 'update')"
|
>编辑</el-link
|
>
|
<el-link
|
class="leftPx"
|
icon="el-icon-delete-solid"
|
:underline="false"
|
@click="handleDelete(scope.row.id)"
|
>删除</el-link
|
>
|
<el-link
|
class="leftPx"
|
icon="el-icon-edit"
|
:underline="false"
|
@click="sendMessage(scope.row.contact)"
|
>推送信息</el-link
|
>
|
<el-link
|
class="leftPx"
|
icon="el-icon-edit"
|
:underline="false"
|
@click="handleScoreView(scope.row, 'view')"
|
>查看</el-link
|
>
|
</div>
|
<div v-else class="operation">
|
<el-link
|
icon="el-icon-edit"
|
:underline="false"
|
@click="handleView(scope.row, 'update')"
|
>编辑</el-link
|
>
|
<el-link
|
class="leftPx"
|
icon="el-icon-delete-solid"
|
:underline="false"
|
@click="handleDelete(scope.row.id)"
|
>删除</el-link
|
>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- 查看修改页面 -->
|
<el-dialog
|
:visible.sync="dialogUpdate"
|
width="45%"
|
:destroy-on-close="true"
|
:title="dialogType === 'view' ? '查看店铺信息' : '修改店铺信息'"
|
:before-close="handleClose"
|
>
|
<updateUser
|
v-if="dialogUpdate"
|
:dialogType="dialogType"
|
:storeInfo="storeInfo"
|
:isStorePage="isStorePage()"
|
@closeDialog="closeDialog"
|
/>
|
</el-dialog>
|
<!-- 查看修改页面 -->
|
<el-dialog
|
:visible.sync="dialogScore"
|
width="60%"
|
:destroy-on-close="true"
|
title="查看积分"
|
:before-close="handleCloseScoreView"
|
>
|
<scoreView v-if="dialogScore" :storeInfo="storeInfoScoreView" />
|
</el-dialog>
|
<!-- 新建消息 -->
|
<el-dialog
|
title="新建消息"
|
:destroy-on-close="true"
|
:key="dialogType"
|
:visible.sync="isShowDialog"
|
width="80%"
|
:before-close="handleConfirmClose"
|
>
|
<div class="mainContent">
|
<el-form
|
ref="user"
|
label-width="140px"
|
autoComplete="on"
|
:model="role"
|
:rules="rules"
|
label-position="right"
|
>
|
<!-- 消息栏目 -->
|
<el-form-item
|
class="optionItem"
|
label="短信模板:"
|
prop="messageType"
|
>
|
<div class="message-item">
|
<div class="message-item__left">
|
<el-select
|
v-model="role.messageType"
|
placeholder="请选择短信模板"
|
@change="setTemplateValue"
|
>
|
<el-option
|
v-for="item in colList"
|
:key="item.id"
|
:label="item.title"
|
:value="item.id"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-form-item>
|
<!-- 消息标题 -->
|
<el-form-item class="optionItems" label="短信标题:" prop="head">
|
<div class="message-item__left">
|
<el-input
|
v-model="role.head"
|
placeholder="请选择短信标题"
|
></el-input>
|
</div>
|
</el-form-item>
|
<!-- 接收对象 -->
|
<el-form-item
|
class="optionItem"
|
label="接收手机号:"
|
prop="targetTo"
|
>
|
<!-- <div class="message-item__left">
|
<el-select v-model="role.targetTo" placeholder="请选择接收接收手机号" >
|
<el-option :value="role.targetTo">
|
<el-tree ref="tree" :data="departList" :props="defaultProps" show-checkbox
|
@check="handleCheck" default-expand-all node-key="id">
|
</el-tree>
|
</el-option>
|
</el-select> -->
|
<!-- </div> -->
|
<div class="message-item__left">
|
<el-input v-model="role.phoneNumber"></el-input>
|
</div>
|
</el-form-item>
|
<!-- 消息内容 -->
|
<el-form-item class="optionItem" label="消息内容:" prop="body">
|
<MyEditor ref="edit"></MyEditor>
|
</el-form-item>
|
|
<el-form-item>
|
<div class="optionBtn">
|
<el-button
|
type="primary"
|
@click.native.prevent="handleSubmit(2)"
|
class="btn submit"
|
>发布</el-button
|
>
|
<el-button
|
class="btn cancel"
|
@click.native.prevent="handleResetq"
|
>重置</el-button
|
>
|
</div>
|
</el-form-item>
|
</el-form>
|
</div>
|
</el-dialog>
|
<div class="tools">
|
<div class="funs">
|
<div class="funsItem">
|
<el-checkbox v-model="all" @change="selectAll()">全选</el-checkbox>
|
</div>
|
<div class="funsItem">
|
<el-checkbox v-model="unsame" @change="disSame(tableData)">反选</el-checkbox>
|
</div>
|
<div class="funsItem">
|
<el-select v-model="myIdx" placeholder="批量操作" @change="selectChange">
|
<el-option v-for="item in options" :key="item.value" :label="item.label"
|
:value="item.value" :disabled="item.disabled">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="pagination">
|
<el-pagination
|
background
|
:current-page="currentPage"
|
layout="prev, pager, next"
|
:total="totalNum"
|
:page-size="pageSize"
|
@current-change="changeCurrentPage"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
<!-- 分页 -->
|
<!-- <div class="pagination">-->
|
<!-- <el-pagination-->
|
<!-- background-->
|
<!-- :current-page="currentPage"-->
|
<!-- layout="prev, pager, next"-->
|
<!-- :total="totalNum"-->
|
<!-- :page-size="pageSize"-->
|
<!-- @current-change="changeCurrentPage"-->
|
<!-- >-->
|
<!-- </el-pagination>-->
|
<!-- </div>-->
|
</main>
|
</div>
|
</template>
|
<script>
|
import updateUser from "@/views/operate/fivepack/threepack/components/updateUser";
|
import scoreView from "@/views/operate/fivepack/threepack/components/score";
|
import {
|
getStoreInfoList,
|
deleteStoreInfo,
|
} from "@/api/operate/storeManagement";
|
import { sendMessageByMobileNumber } from "@/api/operate/messageManagement";
|
import MyEditor from "@/components/edit";
|
import SMS from "@/api/operate/SMS";
|
|
export default {
|
components: { updateUser, scoreView, MyEditor },
|
created() {
|
this.search();
|
this.getSMSTemplateList();
|
},
|
|
props: ["model"],
|
|
data() {
|
const validateMessageContent = (rule, value, callback) => {
|
if (!value) {
|
callback(new Error("请输入短信内容"));
|
} else {
|
callback();
|
}
|
};
|
return {
|
storeCode: null,
|
storeStatus: null,
|
options: [
|
{ label: "全部", value: 0 },
|
{ label: "经营", value: 1 },
|
{ label: "倒闭", value: 2 },
|
],
|
tableData: [],
|
dialogUpdate: false,
|
dialogScore: false,
|
currentPage: 1,
|
totalNum: 0,
|
pageSize: 10,
|
userInfo: null,
|
dialogType: "",
|
isShowDialog: false,
|
storeInfo: null,
|
storeInfoScoreView: {},
|
role: {
|
messageType: "",
|
head: "",
|
targetTo: "",
|
targetFrom: null,
|
body: "",
|
channelCode: "02",
|
phoneNumber: null,
|
},
|
rules: {
|
messageType: [
|
{
|
required: true,
|
trigger: ["blur", "change"],
|
message: "请选择短信模板",
|
},
|
],
|
head: [{ required: true, trigger: "blur", message: "请输入短信标题" }],
|
body: [
|
{
|
required: true,
|
trigger: ["blur", "change"],
|
validator: validateMessageContent,
|
},
|
],
|
},
|
colList: [],
|
departList: [],
|
typeList: [],
|
dialogCreate: false,
|
dialogView: false,
|
defaultProps: {
|
children: "children",
|
label: "departName",
|
},
|
checkedList: [],
|
tempNameArr: [],
|
info: {},
|
sendUser: "",
|
};
|
},
|
|
methods: {
|
// 批量删除
|
mulDelete(idArr) {
|
this.$axios({
|
method: "delete",
|
url: "sccg/illegal_building/batch_delete?ids=" + idArr,
|
}).then((res) => {
|
this.getUserList();
|
this.$message({
|
message: res.message,
|
type: res.code === 200 ? "success" : "warning",
|
});
|
});
|
},
|
// 执行下拉框操作
|
selectChange(val) {
|
let ids = [];
|
this.tempList.forEach((item) => {
|
ids.push(item.number);
|
});
|
if (ids.length !== 0) {
|
if (val === 3) {
|
this.mulDelete(ids);
|
}
|
} else {
|
this.$message({
|
type: "warning",
|
message: "您还没选中任何数据",
|
});
|
}
|
},
|
// 全选
|
selectAll() {
|
this.$refs.multipleTable.toggleAllSelection();
|
},
|
// 反选
|
disSame(list) {
|
list.forEach((row) => {
|
this.$refs.multipleTable.toggleRowSelection(row);
|
});
|
},
|
// 新建/保存消息(1:新建,0保存消息)
|
handleSubmit(mystatus) {
|
this.role.body = this.$refs.edit.editor.txt.html();
|
this.$refs.user.validate((valid) => {
|
if (valid) {
|
const params = Object.assign({}, this.role);
|
params.targetTo = this.checkedList.join(",");
|
params.status = mystatus;
|
sendMessageByMobileNumber(params)
|
.then(() => {
|
this.$message({ type: "success", message: "操作成功" });
|
this.isShowDialog = false;
|
this.role.body = "";
|
this.role.head = "";
|
this.$refs.edit.editor.txt.clear();
|
this.search();
|
this.$refs.user.resetFields();
|
})
|
.catch((err) => this.$message({ type: "error", message: err }));
|
} else {
|
this.$message.warning("请检查必填项");
|
}
|
});
|
},
|
setTemplateValue(obj) {
|
var _this = this;
|
SMS.getSMSTemplateById(obj).then((result) => {
|
_this.role.head = result.title;
|
_this.role.body = result.body;
|
_this.$refs.edit.editor.txt.html(result.body);
|
});
|
},
|
getSMSTemplateList() {
|
SMS.getSMSTemplateList({ current: 1, pageSize: 100 })
|
.then(({ records }) => {
|
this.colList = records;
|
})
|
.catch((err) => this.$message.error(err));
|
},
|
// 确认关闭弹窗
|
handleConfirmClose(done) {
|
this.$confirm("确认关闭?").then(() => {
|
done();
|
this.search();
|
this.role.body = "";
|
this.role.head = "";
|
this.$refs.edit.editor.txt.clear();
|
this.search();
|
this.$refs.user.resetFields();
|
});
|
},
|
// 重置表单
|
handleResetq() {
|
this.$refs.edit.editor.txt.clear();
|
this.search();
|
this.$refs.user.resetFields();
|
this.role.body = "";
|
this.role.head = "";
|
},
|
sendMessage(val) {
|
this.isShowDialog = true;
|
this.role.phoneNumber = val;
|
},
|
search() {
|
const status = this.storeStatus === 0 ? null : this.storeStatus;
|
getStoreInfoList({ keyword: this.storeCode, status })
|
.then(({ list, pageSize, totalPage }) => {
|
this.tableData = list;
|
console.log(list);
|
this.pageSize = pageSize;
|
this.totalNum = totalPage;
|
})
|
.catch((err) => this.$message({ type: "error", message: err }));
|
},
|
|
handleReset() {
|
this.storeCode = "";
|
this.storeStatus = null;
|
this.search();
|
},
|
|
handleView(row, type) {
|
this.dialogUpdate = true;
|
this.storeInfo = row;
|
this.dialogType = type;
|
},
|
handleScoreView(row) {
|
this.storeInfoScoreView = row;
|
this.dialogScore = true;
|
},
|
|
handleDelete(id) {
|
deleteStoreInfo(id)
|
.then(() => {
|
this.$message({ type: "success", message: "操作成功" });
|
this.search();
|
})
|
.catch((err) => this.$message({ type: "error", message: err }));
|
},
|
handleCloseScoreView() {
|
this.dialogScore = false;
|
},
|
handleClose() {
|
this.dialogUpdate = false;
|
},
|
|
closeDialog() {
|
this.dialogUpdate = false;
|
this.search();
|
},
|
|
changeCurrentPage(currentPage) {
|
this.currentPage = currentPage;
|
this.search();
|
},
|
|
tableRowClassName({ row, rowIndex }) {
|
if ((rowIndex + 1) % 2 === 0) {
|
return "warning-row";
|
} else {
|
return "success-row";
|
}
|
},
|
|
isStorePage() {
|
return this.model === "store";
|
},
|
},
|
};
|
</script>
|
<style lang="scss" scoped>
|
.content {
|
flex: 1;
|
height: 100%;
|
margin-left: 5px;
|
padding-left: 20px;
|
border: 1px solid #ccc;
|
.headerContent {
|
display: flex;
|
line-height: 100px;
|
justify-content: space-between;
|
align-items: center;
|
|
.find {
|
display: flex;
|
}
|
|
.search-item {
|
display: flex;
|
padding: 10px;
|
}
|
|
.findBtn {
|
line-height: 100px;
|
margin-left: 15px;
|
display: flex;
|
align-items: center;
|
|
.el-button {
|
padding: 12px 25px;
|
}
|
}
|
|
.addBtn {
|
padding: 12px 30px;
|
margin-left: 20%;
|
}
|
}
|
|
main {
|
// background-color: #09152f;
|
margin-top: 20px;
|
padding-bottom: 50px;
|
|
.mainContent {
|
display: flex;
|
justify-content: center;
|
padding-top: 50px;
|
//&:deep(.el-dialog__title) {
|
// color: #4b9bb7;
|
//}
|
//&::v-deep .el-form-item__label {
|
// color: #4b9bb7;
|
//}
|
//
|
//&::v-deep .el-input__inner {
|
// width: 400px;
|
// background-color: #09152f;
|
// border: 1px solid #17324c;
|
//}
|
|
.message-item__left {
|
width: 400px;
|
}
|
|
.message-add {
|
&:hover {
|
cursor: pointer;
|
}
|
}
|
|
.el-form-item__content :deep(.el-select) {
|
width: 400px;
|
}
|
|
//:deep(.el-input) {
|
// width: 400px;
|
//}
|
|
.message-item {
|
display: flex;
|
|
span {
|
margin-left: 20px;
|
color: #4b9bb7;
|
}
|
}
|
|
.message-tip {
|
margin-left: 20px;
|
}
|
|
//:deep(.el-input--suffix) {
|
// width: 400px;
|
//}
|
//
|
//&::v-deep .el-textarea__inner {
|
// background-color: #09152f;
|
// border: 1px solid #17324c;
|
//}
|
|
.el-form-item__content {
|
width: 400px;
|
|
.el-select {
|
width: 100%;
|
}
|
}
|
|
.optionHandleSp {
|
display: flex;
|
|
.areaNumber,
|
.moreNumber {
|
flex: 1;
|
}
|
|
.telNumber {
|
flex: 2;
|
}
|
}
|
|
.optionBtn {
|
display: flex;
|
margin-top: 20px;
|
|
.btn {
|
padding: 12px 50px;
|
}
|
}
|
}
|
|
.mainTitle {
|
line-height: 60px;
|
}
|
.tools {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding: 0 20px;
|
|
.funs {
|
display: flex;
|
|
.funsItem {
|
line-height: 28px;
|
display: flex;
|
align-items: center;
|
border: 1px solid #ccc;
|
border-radius: 4px;
|
font-size: 12px;
|
margin-left: 10px;
|
|
.el-checkbox {
|
width: 80px;
|
padding: 0 10px;
|
}
|
|
.el-select {
|
width: 120px;
|
}
|
&::v-deep .el-input__inner {
|
border: none;
|
// background-color: #09152f;
|
}
|
&:hover {
|
border: 1px solid #4b9bb7;
|
}
|
|
&:hover .el-checkbox {
|
color: #4b9bb7;
|
}
|
}
|
}
|
|
.pagination {
|
margin-top: 50px;
|
display: flex;
|
line-height: 50px;
|
justify-content: center;
|
|
.el-pagination {
|
&::v-deep li,
|
&::v-deep .btn-prev,
|
&::v-deep .btn-next {
|
// background-color: #071f39;
|
color: #4b9bb7;
|
}
|
|
&::v-deep .active {
|
background-color: #409eff;
|
color: #fff;
|
}
|
}
|
}
|
}
|
.el-link {
|
color: #4b9bb7;
|
}
|
|
.leftPx {
|
margin-left: 10px;
|
}
|
|
.pagination {
|
margin-top: 50px;
|
display: flex;
|
line-height: 50px;
|
justify-content: right;
|
|
.el-pagination {
|
&::v-deep li,
|
&::v-deep .btn-prev,
|
&::v-deep .btn-next {
|
// background-color: #071f39;
|
color: #4b9bb7;
|
}
|
}
|
}
|
|
.el-table {
|
// color: #4b9bb7;
|
// font-size: 10px;
|
|
&::v-deep .el-table__empty-block {
|
// background-color: #09152f;
|
color: #4b9bb7;
|
}
|
|
.operation {
|
display: flex;
|
color: var(--operation-color);
|
.el-button {
|
border: none;
|
}
|
|
span:hover {
|
cursor: pointer;
|
}
|
}
|
}
|
}
|
}
|
</style>
|