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,248 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="会员名称" prop="memberName">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="充值单号" prop="rechargeSn">
<Input
type="text"
v-model="searchForm.rechargeSn"
placeholder="请输入充值单号"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="支付时间">
<DatePicker
v-model="selectDate"
type="datetimerange"
format="yyyy-MM-dd HH:mm:ss"
clearable
@on-change="selectDateRange"
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="padding-row">
<Table
:loading="loading"
border
:columns="columns"
:data="data"
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="total"
: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>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import {
getUserRecharge,
} from "@/api/member";
export default {
name: "recharge",
components: {},
data() {
return {
loading: true, // 表单加载状态
drop: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
memberName:""
},
selectDate: null,
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "会员名称",
key: "memberName",
minWidth: 120,
tooltip: true
},
{
title: "订单号",
key: "rechargeSn",
minWidth: 180,
tooltip: true
},
{
title: "充值金额",
key: "rechargeMoney",
width: 160,
sortable: true,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.rechargeMoney, "¥")
);
},
},
{
title: "充值方式",
key: "rechargeWay",
width: 120,
},
{
title: "支付状态",
key: "payStatus",
align: "left",
width: 120,
sortable: false,
render: (h, params) => {
if (params.row.payStatus == "PAID") {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "已付款",
},
}),
]);
} else if (params.row.payStatus == "UNPAID") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "未付款",
},
}),
]);
}
},
},
{
title: "支付时间",
key: "payTime",
align: "left",
width: 190,
sortable: false,
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
this.searchForm.memberName = "";
// 重新加载数据
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
getUserRecharge(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -0,0 +1,201 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="会员名称" prop="memberName">
<Input type="text" v-model="searchForm.memberName" placeholder="请输入会员名称" clearable style="width: 200px" />
</Form-item>
<Form-item label="支付时间">
<DatePicker v-model="selectDate" type="datetimerange" format="yyyy-MM-dd HH:mm:ss" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 200px"></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="padding-row">
<Table :loading="loading" border :columns="columns" :data="data" 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="total" :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>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import { getUserWallet } from "@/api/member";
export default {
name: "walletLog",
components: {},
data() {
return {
loading: true, // 表单加载状态
drop: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
memberName: "",
},
selectDate: null,
// 表单验证规则
formValidate: {},
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
title: "会员名称",
key: "memberName",
minWidth: 100,
},
{
title: "变动金额",
key: "money",
width: 150,
render: (h, params) => {
if (params.row.money > 0) {
return h("div", [
h(
"span",
{
style: {
color: "green",
},
},
this.$options.filters.unitPrice(params.row.money, "¥")
),
]);
} else if (params.row.money < 0) {
return h("div", [
h(
"span",
{
style: {
color: "red",
},
},
this.$options.filters.unitPrice(params.row.money, "¥")
),
]);
}
},
},
{
title: "变更时间",
key: "createTime",
width: 200,
},
{
title: "业务类型",
key: "serviceType",
width: 200,
render: (h, params) => {
if (params.row.serviceType == "WALLET_WITHDRAWAL") {
return h("div", [h("span", {}, "余额提现")]);
} else if (params.row.serviceType == "WALLET_PAY") {
return h("div", [h("span", {}, "余额支付")]);
} else if (params.row.serviceType == "WALLET_REFUND") {
return h("div", [h("span", {}, "余额退款")]);
} else if (params.row.serviceType == "WALLET_RECHARGE") {
return h("div", [h("span", {}, "余额充值")]);
} else {
return h("div", [h("span", {}, "佣金提成")]);
}
},
},
{
title: "详细",
key: "detail",
minWidth: 300,
tooltip: true,
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
this.searchForm.memberName = "";
// 重新加载数据
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
getUserWallet(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -0,0 +1,417 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="会员名称" prop="memberName">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="审核状态" prop="applyStatus">
<Select
v-model="searchForm.memberName"
clearable
style="width: 200px"
>
<Option value="APPLY">申请中</Option>
<Option value="VIA_AUDITING">审核通过(提现成功)</Option>
<Option value="FAIL_AUDITING">审核拒绝</Option>
</Select>
</Form-item>
<Form-item label="申请时间">
<DatePicker
v-model="selectDate"
type="datetimerange"
format="yyyy-MM-dd HH:mm:ss"
clearable
@on-change="selectDateRange"
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
</Form-item>
<Form-item style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search"
>搜索
</Button
>
</Form-item>
</Form>
</Row>
<Row class="padding-row">
<Table
:loading="loading"
border
:columns="columns"
:data="data"
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="total"
: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>
</Card>
</Col>
</Row>
<Modal
:title="modalTitle"
v-model="roleModalVisible"
:mask-closable="false"
:width="500"
>
<Form
:label-width="80"
>
<FormItem label="申请编号">
<span>{{showList.sn}}</span>
</FormItem>
<FormItem label="用户名称">
<span>{{showList.memberName}}</span>
</FormItem>
<FormItem label="申请金额">
<span>{{showList.applyMoney}}</span>
</FormItem>
<FormItem label="提现状态">
<span>{{showList.applyStatus | paramTypeFilter}}</span>
</FormItem>
<FormItem label="申请时间">
<span>{{showList.createTime}}</span>
</FormItem>
<FormItem label="审核备注">
<Input v-model="audit"/>
</FormItem>
</Form>
<div slot="footer" v-if="showList.applyStatus == 'APPLY'">
<Button type="text" @click="submitRole(false)">拒绝</Button>
<Button type="primary" :loading="submitLoading" @click="submitRole(true)"
>通过
</Button
>
</div>
</Modal>
<Modal
:title="modalTitle"
v-model="queryModalVisible"
:mask-closable="false"
:width="500"
>
<Form
:label-width="80"
>
<FormItem label="申请编号">
<span>{{showList.sn}}</span>
</FormItem>
<FormItem label="用户名称">
<span>{{showList.memberName}}</span>
</FormItem>
<FormItem label="申请金额">
<span>{{showList.applyMoney}}</span>
</FormItem>
<FormItem label="提现状态">
<span>{{showList.applyStatus | paramTypeFilter}}</span>
</FormItem>
<FormItem label="申请时间">
<span>{{showList.createTime}}</span>
</FormItem>
<FormItem label="审核时间">
<span>{{showList.inspectTime}}</span>
</FormItem>
</Form>
<div slot="footer" v-if="showList.applyStatus == 'APPLY'">
<Button type="text" @click="submitRole(false)">拒绝</Button>
<Button type="primary" :loading="submitLoading" @click="submitRole(true)"
>通过
</Button
>
</div>
<div slot="footer" v-else>
<Button type="text" @click="queryModalVisible = false">取消</Button>
</div>
</Modal>
</div>
</template>
<script>
import {
getUserWithdrawApply,
withdrawApply
} from "@/api/member";
export default {
name: "withdrawApply",
components: {},
data() {
return {
modalTitle: "", //弹出框标题
openSearch: true, // 显示搜索
openTip: true, // 显示提示
loading: true, // 表单加载状态
drop: false,
audit: '', // 审核备注
roleModalVisible: false,
queryModalVisible: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
memberName: "",
applyStatus: ""
},
selectDate: null,
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
showList: {},
columns: [
{
title: "申请编号",
key: "sn",
align: "left",
tooltip: true
},
{
title: "用户名称",
key: "memberName",
align: "left",
tooltip: true
},
{
title: "申请金额",
key: "applyMoney",
align: "left",
width: 120,
},
{
title: "提现状态",
align: "left",
key: "applyStatus",
width: 120,
render: (h, params) => {
if (params.row.applyStatus == "APPLY") {
return h('div', [
h('span', {}, '申请中'),
]);
} else if (params.row.applyStatus == "VIA_AUDITING") {
return h('div', [
h('span', {}, '审核通过'),
]);
} else if (params.row.applyStatus == "SUCCESS") {
return h('div', [
h('span', {}, '提现成功'),
]);
} else {
return h('div', [
h('span', {}, '审核拒绝'),
]);
}
},
},
{
title: "申请时间",
key: "createTime",
align: "left",
width: 170
},
{
title: "审核时间",
key: "inspectTime",
align: "left",
width: 170
}, {
title: "操作",
key: "action",
width: 120,
align: "center",
fixed: "right",
render: (h, params) => {
if (params.row.applyStatus == 'APPLY') {
return h(
"Button",
{
props: {
type: "success",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.showList = {}
this.roleModalVisible = true;
this.showList = params.row
}
}
},
"审核"
);
} else {
return h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.showList = {}
this.queryModalVisible = true;
this.showList = params.row
this.modalTitle = "查看"
}
}
},
"查看"
);
}
}
}
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
filters: {
paramTypeFilter(val) {
if (val === 'APPLY') {
return '申请中'
} else if (val === 'VIA_AUDITING') {
return '审核通过(提现成功)'
} else if (val === 'FAIL_AUDITING') {
return '审核拒绝'
} else {
return '未知状态'
}
}
},
methods: {
submitRole(res) {
const params = {}
params.apply_id = this.showList.id
params.result = res
params.remark = this.audit
if (res === false && params.remark === '') {
this.$Message.error("审核备注不能为空");
return
}
withdrawApply(params).then((res) => {
this.loading = false;
if (res == true) {
this.$Message.success("操作成功");
this.roleModalVisible = false;
this.getDataList();
}
});
},
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
this.searchForm.memberName = "";
// 重新加载数据
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
getUserWithdrawApply(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -0,0 +1,493 @@
<template>
<div class="search">
<Row>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="会员名称" prop="username">
<Input type="text" v-model="searchForm.username" placeholder="请输入会员名称" clearable style="width: 200px" />
</Form-item>
<Form-item label="会员昵称" prop="nickName">
<Input type="text" v-model="searchForm.nickName" placeholder="请输入会员昵称" clearable style="width: 200px" />
</Form-item>
<Form-item label="联系方式" prop="mobile">
<Input type="text" v-model="searchForm.mobile" placeholder="请输入会员联系方式" clearable style="width: 200px" />
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search">搜索</Button>
</Form>
</Row>
<Row class="operation padding-row">
<Button @click="addMember" type="primary">添加会员</Button>
</Row>
<Row>
<Table :loading="loading" border :columns="columns" :data="data" 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="total" :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>
</Card>
</Row>
<!-- 添加用户模态框 -->
<Modal v-model="addFlag" title="添加用户">
<Form ref="addMemberForm" :model="addMemberForm" :rules="addRule" :label-width="100">
<FormItem label="手机号码" prop="mobile" style="width: 90%;">
<Input v-model="addMemberForm.mobile" maxlength="11" placeholder="请输入手机号码" />
</FormItem>
<FormItem label="会员名称" prop="username" style="width: 90%">
<Input v-model="addMemberForm.username" maxlength="15" placeholder="请输入会员名称" />
</FormItem>
<FormItem label="会员密码" prop="password" style="width: 90%">
<Input type="password" password v-model="addMemberForm.password" maxlength="20" placeholder="请输入会员密码" />
</FormItem>
</Form>
<div slot="footer">
<Button @click="
() => {
addFlag = false;
}
">
取消
</Button>
<Button type="primary" :loading="handleAddLoading" @click="addMemberSubmit">
确定
</Button>
</div>
</Modal>
<!-- 修改模态框 -->
<Modal v-model="descFlag" :title="descTitle" @on-ok="handleSubmitModal" width="500">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
<FormItem label="头像">
<img :src="formValidate.face" class="face" />
<Button type="text" class="upload" @click="
() => {
this.picModelFlag = true;
this.$refs.ossManage.selectImage = true;
}
">修改
</Button>
<input type="file" style="display: none" id="file" />
</FormItem>
<FormItem label="用户名" prop="name">
<Input v-model="formValidate.username" style="width: 200px" disabled />
</FormItem>
<FormItem label="用户昵称" prop="name">
<Input v-model="formValidate.nickName" style="width: 200px" />
</FormItem>
<FormItem label="性别" prop="sex">
<RadioGroup v-model="formValidate.sex">
<Radio :label="1">
<span></span>
</Radio>
<Radio :label="0">
<span></span>
</Radio>
</RadioGroup>
</FormItem>
<FormItem label="修改密码" prop="password">
<Input type="password" style="width: 220px" password v-model="formValidate.newPassword" />
</FormItem>
<FormItem label="生日" prop="birthday">
<DatePicker type="date" format="yyyy-MM-dd" v-model="formValidate.birthday" style="width: 220px"></DatePicker>
</FormItem>
<FormItem label="所在地" prop="mail">
<div class="form-item" v-if="!updateRegion">
<Input disabled style="width: 250px" :value="formValidate.region" />
<Button type="text" @click="
() => {
this.updateRegion = !this.updateRegion;
}
">修改
</Button>
</div>
<div class="form-item" v-else>
<region style="width: 250px" @selected="selectedRegion" />
</div>
</FormItem>
</Form>
</Modal>
<Modal width="1200px" v-model="picModelFlag">
<ossManage @callback="callbackSelected" ref="ossManage" />
</Modal>
</div>
</template>
<script>
import region from "@/views/lili-components/region";
import * as API_Member from "@/api/member.js";
import ossManage from "@/views/sys/oss-manage/ossManage";
import * as RegExp from "@/libs/RegExp.js";
export default {
name: "member",
components: {
region,
ossManage,
},
data() {
return {
selectedMember: false, //是否是其他组件调用
descTitle: "",
descFlag: false, //编辑查看框
openSearch: true, // 显示搜索
loading: true, // 表单加载状态
addFlag: false,
updateRegion: false,
addMemberForm: {
mobile: "",
username: "",
password: "",
},
searchForm: {
pageNumber: 1,
pageSize: 10,
order: "desc",
username: "",
mobile: "",
disabled: "OPEN",
},
picModelFlag: false,
// 表单验证规则
formValidate: {},
addRule: {
mobile: [
{ required: true, message: "请输入手机号码" },
{
pattern: RegExp.mobile,
message: "请输入正确的手机号",
},
],
username: [{ required: true, message: "请输入会员名称" }],
password: [{ required: true, message: "请输入密码" }],
},
ruleValidate: {}, //修改验证
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "会员名称",
key: "username",
tooltip: true,
},
{
title: "会员昵称",
key: "nickName",
tooltip: true,
},
{
title: "联系方式",
width: 130,
key: "mobile",
render: (h, params) => {
if (params.row.mobile == null) {
return h("div", [h("span", {}, "")]);
} else {
return h("div", [h("span", {}, params.row.mobile)]);
}
},
},
{
title: "注册时间",
key: "createTime",
width: 180,
},
{
title: "积分数量",
align: "left",
width: 100,
render: (h, params) => {
return h(
"div",
{},
params.row.point == void 0 ? "0" : params.row.point
);
},
},
{
title: "操作",
key: "action",
align: "center",
width: 200,
fixed: "right",
render: (h, params) => {
return h(
"div",
{
style: {
display: "flex",
justifyContent: "center",
},
},
[
h(
"Button",
{
props: {
size: "small",
},
style: {
marginRight: "5px",
display: this.selectedMember ? "block" : "none",
},
on: {
click: () => {
this.callback(params.row);
},
},
},
"选择"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px", display: this.selectedMember ? "none" : "block",
},
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
ghost: true,
},
style: {
marginRight: "5px", display: this.selectedMember ? "none" : "block",
},
on: {
click: () => {
this.editPerm(params.row);
},
},
},
"编辑"
),
h(
"Button",
{
props: {
size: "small",
type: "error",
},
style: {
marginRight: "5px",
display: this.selectedMember ? "none" : "block",
},
on: {
click: () => {
this.disabled(params.row);
},
},
},
"禁用"
),
]
);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
// 回调给父级
callback(val) {
this.$emit("callback", val);
},
init() {
this.getData();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getData();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getData();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getData();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getData();
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
//查看详情修改
editPerm(val) {
this.descTitle = `查看用户 ${val.username}`;
this.descFlag = true;
this.updateRegion = false;
this.getMemberInfo(val.id);
},
addMember() {
this.addFlag = true;
this.addMemberForm = {
mobile: "",
username: "",
password: "",
};
},
/**
* 查询查看会员详情
*/
getMemberInfo(id) {
API_Member.getMemberInfoData(id).then((res) => {
if (res.result) {
this.$set(this, "formValidate", res.result);
}
});
},
//查询会员列表
getData() {
API_Member.getMemberListData(this.searchForm).then((res) => {
if (res.result.records) {
this.loading = false;
this.data = res.result.records;
this.total = res.result.total;
}
});
},
// 选中的图片
callbackSelected(val) {
this.picModelFlag = false;
this.formValidate.face = val.url;
},
//添加会员提交
addMemberSubmit() {
this.addMemberForm.password = this.md5(this.addMemberForm.password);
this.$refs.addMemberForm.validate((valid) => {
if (valid) {
API_Member.addMember(this.addMemberForm).then((res) => {
if (res.result) {
this.getData();
this.$Message.success("添加成功!");
this.addFlag = false;
}
});
}
});
},
// 选中的地址
selectedRegion(val) {
this.region = val[1];
this.regionId = val[0];
},
//查看会员
detail(row) {
this.$router.push({ name: "member-detail", query: { id: row.id } });
},
//禁用会员
disabled(v) {
let params = {
memberIds: [v.id],
disabled: false,
};
this.$Modal.confirm({
title: "提示",
content: "<p>确认禁用此会员?</p>",
onOk: () => {
API_Member.updateMemberStatus(params).then((res) => {
if (res.code === 200) {
this.$Message.success("禁用成功");
this.getData();
} else {
this.$Message.error(res.message);
}
});
},
});
},
// 提交修改数据
handleSubmitModal() {
const { nickName, sex, username, face, newPassword } = this.formValidate;
let time = new Date(this.formValidate.birthday);
let birthday =
time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate();
let submit = {
regionId: this.formValidate.regionId,
region: this.formValidate.region,
nickName,
username,
sex,
birthday,
face,
};
if (this.region != "undefined") {
submit.regionId = this.regionId;
submit.region = this.region;
}
if (newPassword) {
submit.password = this.md5(newPassword);
}
API_Member.updateMember(submit).then((res) => {
if (res.result) {
this.$Message.success("修改成功!");
this.init();
}
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/table-common.scss";
/deep/ .ivu-table-wrapper {
width: 100%;
}
/deep/ .ivu-card{
width: 100%;
}
.face {
width: 60px;
height: 60px;
border-radius: 50%;
}
</style>

View File

@@ -0,0 +1,124 @@
.head-title {
font-size: 18px;
color: rgba(0, 0, 0, 0.85);
font-weight: 400;
}
.detail-body{
margin-top: 17px;
}
.head-info {
display: flex;
height: 100px;
background: #f56c1d;
padding: 12px;
border-radius: 4px;
align-items: center;
}
.ant-layout, .ant-layout * {
box-sizing: border-box;
}
.base-info {
background-color: #fff;
padding: 20px;
margin-bottom: 12px;
height: 250px;
}
.ant-col-md-6 {
display: block;
box-sizing: border-box;
width: 25%;
float: left;
}
.info-2{
float: left;
}
.ant-row {
position: relative;
height: auto;
margin-right: 0;
margin-left: 0;
zoom: 1;
display: block;
box-sizing: border-box;
}
.bottom-info {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 12px;
margin-top: 6px;
height: 36px;
background: #f5f5f5;
border-radius: 4px;
}
.ant-layout * {
box-sizing: border-box;
}
.name{
margin-left: 10px;
color: #fff;
font-size: 18px;
}
.phone{
margin-left: 20px;
font-size: 14px;
color: #fff;
}
.item {
display: flex;
align-items: flex-start;
line-height: 20px;
margin-bottom: 2px;
}
.label {
flex-basis: 130px;
text-align: right;
color: rgba(0, 0, 0, 0.4);
flex-shrink: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.info {
font-weight: 500;
padding-left: 0;
margin-bottom: 0;
width: 100%;
}
.pointsTitle {
background-color: #fafafa;
padding: 15px 20px;
display: flex;
font-size: 16px;
line-height: 1.8;
flex-direction: row;
justify-content: space-around;
color: #333;
text-align: center;
margin-bottom: 16px;
.points-top-title{
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.4);
line-height: 14px;
margin-bottom: 8px;
}
.points-top-text {
font-size: 16px;
font-weight: 500;
color: #F56C1D;
line-height: 16px;
}
}
.point-data{
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,500 @@
<template>
<div class="search">
<Row>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="会员名称" prop="username">
<Input
type="text"
v-model="searchForm.username"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="联系方式" prop="mobile">
<Input
type="text"
v-model="searchForm.mobile"
placeholder="请输入会员联系方式"
clearable
style="width: 200px"
/>
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search">搜索</Button >
</Form>
</Row>
<Row class="padding-row">
<Table
:loading="loading"
border
:columns="columns"
:data="data"
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="total"
: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>
</Card>
</Row>
<!-- 修改模态框 -->
<Modal v-model="descFlag" :title="descTitle" @on-ok="handleSubmitModal" width="500">
<Form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80"
>
<FormItem label="头像">
<img :src="formValidate.face" class="face"/>
<Button
type="text"
class="upload"
@click="
() => {
this.picModelFlag = true;
this.$refs.ossManage.selectImage = true;
}
"
>修改
</Button
>
<input
type="file"
style="display: none"
id="file"
/>
</FormItem>
<FormItem label="会员名称" prop="name">
<Input
v-model="formValidate.username"
style="width: 200px"
disabled
/>
</FormItem>
<FormItem label="用户昵称" prop="name">
<Input v-model="formValidate.nickName" style="width: 200px"/>
</FormItem>
<FormItem label="性别" prop="sex">
<RadioGroup v-model="formValidate.sex">
<Radio :label="1">
<span></span>
</Radio>
<Radio :label="0">
<span></span>
</Radio>
</RadioGroup>
</FormItem>
<FormItem label="修改密码" prop="password">
<Input
type="password"
style="width: 220px"
password
v-model="formValidate.newPassword"
/>
</FormItem>
<FormItem label="生日" prop="birthday">
<DatePicker
type="date"
format="yyyy-MM-dd"
v-model="formValidate.birthday"
style="width: 220px"
></DatePicker>
</FormItem>
<FormItem label="所在地" prop="mail">
<div class="form-item" v-if="!updateRegion">
<Input disabled style="width: 250px" :value="formValidate.region"/>
<Button
type="text"
@click="
() => {
this.updateRegion = !this.updateRegion;
}
"
>修改
</Button
>
</div>
<div class="form-item" v-else>
<region style="width: 250px" @selected="selectedRegion"/>
</div>
</FormItem>
</Form>
</Modal>
<Modal width="1200px" v-model="picModelFlag">
<ossManage @callback="callbackSelected" ref="ossManage"/>
</Modal>
</div>
</template>
<script>
import region from "@/views/lili-components/region";
import * as API_Member from "@/api/member.js";
import ossManage from "@/views/sys/oss-manage/ossManage";
export default {
name: "memberRecycle",
components: {
region,
ossManage,
},
data() {
return {
selectedMember: false, //是否是其他组件调用
descTitle: "",
descFlag: false, //编辑查看框
openSearch: true, // 显示搜索
loading: true, // 表单加载状态
updateRegion: false,
searchForm: {
pageNumber: 1,
pageSize: 10,
order: "desc",
username: "",
mobile: "",
disabled: "CLOSE"
},
picModelFlag: false,
// 表单验证规则
formValidate: {},
ruleValidate: {}, //修改验证
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "会员名称",
align: "left",
key: "username",
tooltip: true
},
{
title: "昵称",
align: "left",
key: "nickName",
tooltip: true
},
{
title: "联系方式",
width: 130,
key: "mobile",
render: (h, params) => {
if (params.row.mobile == null) {
return h('div', [h('span', {}, "")]);
} else {
return h('div', [h('span', {}, params.row.mobile)]);
}
}
},
{
title: "注册时间",
key: "createTime",
width: 180
},
{
title: "积分数量",
align: "left",
width: 120,
render: (h, params) => {
return h(
"div",
{},
params.row.point == void 0 ? "0" : params.row.point
);
},
},
{
title: "操作",
key: "action",
align: "center",
width: 200,
fixed: "right",
render: (h, params) => {
return h("div", {
style: {
display: "flex",
justifyContent: "center"
}
}, [
h(
"Button",
{
props: {
size: "small",
},
style: {
marginRight: "5px",
display: this.selectedMember ? "block" : "none",
},
on: {
click: () => {
this.callback(params.row);
},
},
},
"选择"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
),
h(
"Button",
{
props: {
size: "small",
type: "success"
},
style: {
marginRight: "5px",
display: this.selectedMember ? "none" : "block",
},
on: {
click: () => {
this.enable(params.row);
},
},
},
"启用"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
ghost:true
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.editPerm(params.row);
},
},
},
"编辑"
),
]);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
// 回调给父级
callback(val) {
this.$emit("callback", val);
},
init() {
this.getData();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getData();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getData();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getData();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getData();
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
//查看详情修改
editPerm(val) {
this.descTitle = `查看用户 ${val.username}`;
this.descFlag = true;
this.updateRegion = false
this.getMemberInfo(val.id);
},
/**
* 查询查看会员详情
*/
getMemberInfo(id) {
API_Member.getMemberInfoData(id).then((res) => {
if (res.result) {
this.$set(this, "formValidate", res.result);
}
});
},
//查询会员列表
getData() {
API_Member.getMemberListData(this.searchForm).then((res) => {
if (res.result.records) {
this.loading = false
this.data = res.result.records;
this.total = res.result.total;
}
});
},
// 选中的图片
callbackSelected(val) {
this.picModelFlag = false;
this.formValidate.face = val.url;
},
// 选中的地址
selectedRegion(val) {
this.region = val[1];
this.regionId = val[0];
},
//禁用会员
disabled(v) {
let params = {
memberIds: [v.id],
disabled: "CLOSE"
}
this.$Modal.confirm({
title: '提示',
content: '<p>确认禁用此会员?</p>',
onOk: () => {
API_Member.updateMemberStatus(params).then(res => {
if (res.code === 200) {
this.$Message.success('禁用成功');
this.getData()
} else {
this.$Message.error(res.message);
}
});
}
});
},
//详细
detail(row){
this.$router.push({ name: "member-detail", query: { id: row.id } });
},
//启用会员
enable(v) {
let params = {
memberIds: [v.id],
disabled: true
}
this.$Modal.confirm({
title: '提示',
content: '<p>启用用此会员?</p>',
onOk: () => {
API_Member.updateMemberStatus(params).then(res => {
if (res.code === 200) {
this.$Message.success('禁用成功');
this.getData()
} else {
this.$Message.error(res.message);
}
});
}
});
},
// 提交修改数据
handleSubmitModal() {
const {nickName, sex, username, face, newPassword} = this.formValidate;
let time = new Date(this.formValidate.birthday);
let birthday =
time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate();
let submit = {
regionId: this.regionId,
region: this.region,
nickName,
username,
sex,
birthday,
face,
};
if (newPassword) {
submit.password = this.md5(newPassword);
}
API_Member.updateMember(submit).then((res) => {
if (res.result) {
this.$Message.success("修改成功!");
this.init();
}
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/table-common.scss";
.face {
width: 60px;
height: 60px;
border-radius: 50%;
}
</style>

View File

@@ -0,0 +1,202 @@
<style lang="scss">
@import "./messageManage.scss";
</style>
<template>
<div>
<Card>
<p slot="title">
<span v-if="type==0">发送新消息</span>
<span v-else>编辑消息</span>
</p>
<Row>
<Form
ref="form"
:model="form"
:label-width="90"
:rules="formValidate"
style="position:relative"
>
<FormItem label="消息类型" prop="type">
<Select v-model="form.type" placeholder="请选择" style="width:250px">
<Option
v-for="(item, i) in dictMessageType"
:key="i"
:value="item.value"
>{{item.title}}</Option>
</Select>
</FormItem>
<FormItem label="标题" prop="title">
<Input v-model="form.title" style="width:600px" />
</FormItem>
<FormItem label="内容" prop="content" class="wangEditor">
<editor v-model="form.content"></editor>
</FormItem>
<FormItem label="新创建账号也推送" prop="createSend">
<i-switch size="large" v-model="form.createSend">
<span slot="open">开启</span>
<span slot="close">关闭</span>
</i-switch>
</FormItem>
<div v-if="type==0">
<FormItem label="发送范围">
<RadioGroup v-model="form.range">
<Radio :label="0">全体用户</Radio>
<Radio :label="1">指定用户成员</Radio>
</RadioGroup>
</FormItem>
<div>
<FormItem label="选择用户" v-if="form.range==1">
<user-choose text="选择发送用户" @on-change="handleSelectUser" ref="user"></user-choose>
</FormItem>
</div>
</div>
<Form-item class="br">
<Button
type="primary"
:loading="submitLoading"
@click="handelSubmit"
style="width:100px"
>提交</Button>
<Button @click="handelCancel">取消</Button>
</Form-item>
<Spin size="large" fix v-if="loading"></Spin>
</Form>
</Row>
</Card>
</div>
</template>
<script>
import { getMessageDataById, addMessage, editMessage } from "@/api/index";
import editor from "@/views/my-components/lili/editor";
import userChoose from "@/views/my-components/lili/user-choose";
export default {
name: "add_edit_message",
components: {
userChoose,
editor
},
data() {
return {
type: 0,
loading: false, // 表单加载状态
selectUsers: [],
userModalVisible: false,
modalTitle: "", // 添加或编辑标题
form: {
// 添加或编辑表单对象初始化数据
title: "",
content: "",
type: "",
range: 0
},
formValidate: {
// 表单验证规则
/* type: [
{ required: true, message: "消息类型不能为空", trigger: "blur" }
],*/
title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
content: [{ required: true, message: "内容不能为空", trigger: "blur" }]
},
submitLoading: false, // 添加或编辑提交状态
dictMessageType: this.$store.state.dict.messageType,
backRoute: ""
};
},
methods: {
init() {
this.type = this.$route.query.type;
this.backRoute = this.$route.query.backRoute;
if (this.type == 1) {
this.form.id = this.$route.query.id;
this.getData();
}
},
getData() {
this.loading = true;
getMessageDataById(this.form.id).then(res => {
this.loading = false;
if (res.success) {
// 转换null为""
let v = res.result;
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
}
});
},
handelSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.type == 0) {
// 添加 避免编辑后传入id等数据 记得删除
delete this.form.id;
// 用户id数据
let ids = [];
this.selectUsers.forEach(e => {
ids += e.id + ",";
});
if (ids.length > 0) {
ids = ids.substring(0, ids.length - 1);
}
this.form.userIds = ids;
addMessage(this.form).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.closeCurrentPage();
}
});
} else if (this.type == 1) {
// 编辑
editMessage(this.form).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.closeCurrentPage();
}
});
}
}
});
},
handleSelectUser(v) {
this.selectUsers = v;
},
handelCancel() {
this.closeCurrentPage();
},
// 关闭当前页面
closeCurrentPage() {
this.$store.commit("removeTag", "add_edit_message");
localStorage.pageOpenedList = JSON.stringify(
this.$store.state.app.pageOpenedList
);
this.$router.push({
name: this.backRoute
});
}
},
mounted() {
this.init();
},
watch: {
// 监听路由变化
$route(to, from) {
if (to.name == "add_edit_message") {
this.type = this.$route.query.type;
if (this.type == 1) {
this.form.id = this.$route.query.id;
this.getData();
}
}
}
}
};
</script>

View File

@@ -0,0 +1,730 @@
<style lang="scss">
@import "@/styles/table-common.scss";
</style>
<template>
<div>
<!--短信-->
<Modal v-model="smsModal" width="530">
<p slot="header">
<Icon type="edit"></Icon>
<span>短信设置</span>
</p>
<div>
<Form ref="smsFormData" :model="smsFormData" label-position="left" :label-width="100" :rules="smsFormValidate">
<FormItem label="模板名称" prop="templateName">
<Input v-model="templateName" size="large" maxlength="9" disabled></Input>
</FormItem>
<FormItem label="模板代码" prop="smsCode">
<Input v-model="smsFormData.smsCode" size="large" maxlength="30"></Input>
</FormItem>
<FormItem label="模板名称" prop="smsContent">
<Input class='textarea' :rows="5" :autosize="{maxRows:5,minRows: 5}" v-model="smsFormData.smsContent" type="textarea" maxlength="150"/>
</FormItem>
<FormItem label="是否开启" prop="smsState">
<i-switch v-model="smsFormData.smsState" size="large" :value="smsFormData.smsState">
<span slot="open">开启</span>
<span slot="close">关闭</span>
</i-switch>
</FormItem>
</Form>
</div>
<div slot="footer" style="text-align: right">
<Button type="success" size="large" @click="smsFormDataEdit">设置</Button>
</div>
</Modal>
<!--站内信-->
<Modal v-model="noticeModal" width="530">
<p slot="header">
<Icon type="edit"></Icon>
<span>站内信设置</span>
</p>
<div>
<Form ref="noticeFormData" :model="noticeFormData" label-position="left" :label-width="100" :rules="noticeFormValidate">
<FormItem label="模板名称" prop="templateName">
<Input v-model="templateName" size="large" maxlength="9" disabled></Input>
</FormItem>
<FormItem label="模板名称" prop="smsContent">
<Input class='textarea' :rows="5" :autosize="{maxRows:5,minRows: 5}" v-model="noticeFormData.noticeContent" type="textarea" maxlength="150"/>
</FormItem>
</Form>
</div>
<div slot="footer" style="text-align: right">
<Button type="success" size="large" @click="noticeFormDataEdit">设置</Button>
</div>
</Modal>
<!--微信模板-->
<Modal v-model="wechatModal" width="530">
<p slot="header">
<Icon type="edit"></Icon>
<span>微信设置</span>
</p>
<div>
<Form ref="wechatFormData" :model="wechatFormData" label-position="left" :label-width="100" :rules="wechatFormValidate">
<FormItem label="模板名称" prop="templateName">
<Input v-model="templateName" size="large" maxlength="9" disabled></Input>
</FormItem>
<FormItem label="头部信息" prop="first">
<Input v-model="wechatFormData.first" size="large" maxlength="50"></Input>
</FormItem>
<FormItem label="备注" prop="remark">
<Input class='textarea' :rows="5" :autosize="{maxRows:5,minRows: 5}" v-model="wechatFormData.remark" type="textarea" maxlength="150"/>
</FormItem>
<FormItem label="是否开启" prop="enable">
<i-switch v-model="wechatFormData.enable" size="large" :value="smsFormData.enable">
<span slot="open">开启</span>
<span slot="close">关闭</span>
</i-switch>
</FormItem>
</Form>
</div>
<div slot="footer" style="text-align: right">
<Button type="success" size="large" @click="wechatFormDataEdit">设置</Button>
</div>
</Modal>
<Tabs value="log" @on-click="tabPaneChange" v-model="tab">
<TabPane label="会员消息" name="MEMBER">
<div class="search">
<Card>
<Row class="operation">
<Button @click="getDataList" icon="md-refresh">刷新</Button>
<Button type="dashed" @click="openTip=!openTip">{{openTip ? "关闭提示" : "开启提示"}}</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择
<span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="showSelect"
ref="memberTable"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
: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>
</Card>
</div>
</TabPane>
<TabPane label="店铺消息" name="SHOP">
<div class="search">
<Card>
<Row class="operation">
<Button @click="getDataList" icon="md-refresh">刷新</Button>
<Button type="dashed" @click="openTip=!openTip">{{openTip ? "关闭提示" : "开启提示"}}</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择
<span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="showSelect"
ref="shopTable"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
: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>
</Card>
</div>
</TabPane>
<TabPane label="微信消息" name="WECHAT">
<div class="search">
<Card>
<Row class="operation">
<Button @click="weChatSync" type="primary" icon="md-add">同步微信消息</Button>
<Button @click="getDataList" icon="md-refresh">刷新</Button>
<Button type="dashed" @click="openTip=!openTip">{{openTip ? "关闭提示" : "开启提示"}}</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择
<span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="weChatColumns"
:data="weChatData"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="showSelect"
ref="weChatTable"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="weChatSearchForm.pageNumber"
:total="weChatTotal"
:page-size="weChatSearchForm.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>
</Card>
</div>
</TabPane>
<TabPane label="其他消息" name="OTHER">
<div class="search">
<Card>
<Row class="operation">
<Button @click="getDataList" icon="md-refresh">刷新</Button>
<Button type="dashed" @click="openTip=!openTip">{{openTip ? "关闭提示" : "开启提示"}}</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择
<span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="showSelect"
ref="otherTable"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
: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>
</Card>
</div>
</TabPane>
</Tabs>
</div>
</template>
<script>
import {
getMessageData,
editSmsMessageTemplate,
editNoticeMessageTemplate,
wechatMessageSync,
getWechatMessagePage,
editWechatMessageTemplate,
delWechatMessageTemplate
} from "@/api/setting";
export default {
title: "message-manage",
data() {
return {
messageTemplate:'',//当前消息模板
messageTemplateId:'',
templateName:'',
smsModal: false,//短信
smsFormData:{
smsState:'',
smsContent:'',
smsCode: ''
},
smsFormValidate:{
smsCode: [{ required: true, message: '请输入短信编码'}],
smsContent: [{ required: true, message: '请输入短信内容'}],
},
noticeModal: false,//站内信
noticeFormData:{
noticeContent:''
},
noticeFormValidate:{
noticeContent: [{ required: true, message: '请输入站内信内容'}],
},
wechatModal:false,//微信消息
wechatFormData:{
remark:'',
first:'',
enable:'',
},
wechatFormValidate:{
remark: [{ required: true, message: '请输入站内信内容'}],
first: [{ required: true, message: '请输入头部文字信息'}],
},
tab: "MEMBER",
openTip: true,
loading: true, // 表单加载状态
userLoading: true,
selectCount: 0, // 多选计数
selectList: [], // 多选数据
drop: false,
dropDownContent: "展开",
dropDownIcon: "ios-arrow-down",
searchForm: {
// 搜索框对应data对象
type: "MEMBER",
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "" // 终止时间
},
//微信消息查询
weChatSearchForm: {
// 搜索框对应data对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
},
selectDate: null, // 选择日期绑定modal
columns: [
// 表头
{
type: "selection",
width: 60,
align: "center"
},
{
title: "ID",
key: "id",
width: 180,
sortable: true
},
{
title: "模板名称",
key: "name",
width: 300,
sortable: true
},
{
title: "创建时间",
key: "createTime",
sortable: true,
sortType: "desc"
},
{
title: "操作",
key: "action",
width: 280,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.smsSettingAlert(params.row);
}
}
},
"短信设置"
),
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.noticeSettingAlert(params.row);
}
}
},
"站内信设置"
)
]);
}
}
],
data: [], // 表单数据
total: 0, // 表单数据总数
weChatColumns: [
// 表头
{
type: "selection",
width: 60,
align: "center"
},
{
title: "模板编号",
key: "code",
width: 500,
sortable: true
},
{
title: "是否开启",
key: "enable",
sortable: true,
width: 150,
render: (h, params) => {
if (params.row.enable == true) {
return h('div', [
h('span', {
}, '开启'),
]);
} else {
return h('div', [
h('span', {
}, '关闭'),
]);
}
},
},
{
title: "模板名称",
key: "name",
width: 200,
sortable: true
},
{
title: "创建时间",
key: "createTime",
sortable: true,
sortType: "desc",
},
{
title: "操作",
key: "action",
width: 200,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.wechatSettingAlert(params.row);
}
}
},
"编辑"
),
h(
"Button",
{
props: {
type: "error",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.delWeChat(params.row);
}
}
},
"删除"
)
]);
}
}
],
weChatData: [], // 表单数据
weChatTotal: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
dropDown() {
if (this.drop) {
this.dropDownContent = "展开";
this.dropDownIcon = "ios-arrow-down";
} else {
this.dropDownContent = "收起";
this.dropDownIcon = "ios-arrow-up";
}
this.drop = !this.drop;
},
changePage(v) {
this.searchForm.type = this.tab;
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.type = this.tab;
this.searchForm.pageSize = v;
this.getDataList();
},
//短信设置弹出框
smsSettingAlert(v){
this.smsFormData.smsState = v.smsState == 'OPEN' ? true:false
this.smsFormData.smsContent = v.smsContent
this.smsFormData.smsCode = v.smsCode
this.templateName = v.name
this.messageTemplateId = v.id
this.smsModal = true
},
//站内信弹出框
noticeSettingAlert(v){
this.noticeFormData.noticeContent = v.noticeContent
this.templateName = v.name
this.messageTemplateId = v.id
this.noticeModal = true
},
//微信弹出框
wechatSettingAlert(v){
this.wechatFormData.remark = v.remark
this.wechatFormData.first = v.first
this.wechatFormData.enable = v.enable
this.templateName = v.name
this.messageTemplateId = v.id
this.wechatModal = true
},
//短信设置保存
smsFormDataEdit(){
this.$refs['smsFormData'].validate((valid) => {
if (valid) {
if(this.smsFormData.smsState){
this.smsFormData.smsState = "OPEN"
}else{
this.smsFormData.smsState = "CLOSE"
}
editSmsMessageTemplate(this.messageTemplateId,this.smsFormData).then(res => {
if(res.message === 'success') {
this.$Message.success('短信模板修改成功');
this.smsModal = false;
this.getDataList();
}
});
}
})
},
//微信设置保存
wechatFormDataEdit(){
this.$refs['wechatFormData'].validate((valid) => {
if (valid) {
editWechatMessageTemplate(this.messageTemplateId,this.wechatFormData).then(res => {
if(res.message === 'success') {
this.$Message.success('微信模板修改成功');
this.wechatModal = false;
this.getWechatMessagePage();
}
});
}
})
},
//站内信设置保存
noticeFormDataEdit(){
this.$refs['noticeFormData'].validate((valid) => {
if (valid) {
editNoticeMessageTemplate(this.messageTemplateId,this.noticeFormData).then(res => {
if(res.message === 'success') {
this.$Message.success('站内信修改成功');
this.noticeModal = false;
this.getDataList();
}
});
}
})
},
//同步微信消息
weChatSync(){
this.$Modal.confirm({
title: "提示",
// 记得确认修改此处
content: "确认要同步微信消息模板?",
loading: true,
onOk: () => {
// 同步微信消息模板
wechatMessageSync().then(res => {
this.$Modal.remove();
if(res.success) {
this.$Message.success('微信消息模板同步成功');
}
});
}
});
},
//删除微信模消息
delWeChat(v){
this.$Modal.confirm({
title: "提示",
content: "确定删除此模板?",
loading: true,
onOk: () => {
// 删除微信消息模板
delWechatMessageTemplate(v.id).then(res => {
if(res.success) {
this.$Modal.remove();
this.$Message.success('微信模板删除成功');
this.getWechatMessagePage()
}
});
}
});
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
getMessageData(this.searchForm).then(res => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
},
//分页获取微信消息
getWechatMessagePage(){
getWechatMessagePage(this.weChatSearchForm).then(res => {
this.loading = false;
if (res.success) {
this.weChatData = res.result.records;
this.weChatTotal = res.result.total;
}
});
},
//tab切换事件
tabPaneChange(v) {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.searchForm.type = v;
//如果是微信消息则走单独的接口
if(v === "WECHAT"){
this.getWechatMessagePage();
}else{
this.getDataList();
}
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
// 重新加载数据
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order == "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
showSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
clearSelectAll() {
this.$refs.memberTable.selectAll(false);
this.$refs.weChatTable.selectAll(false);
this.$refs.shopTable.selectAll(false);
this.$refs.otherTable.selectAll(false);
}
},
mounted() {
this.init();
}
};
</script>

View File

@@ -0,0 +1,5 @@
.wangEditor {
.ivu-form-item-content {
line-height: unset !important;
}
}

View File

@@ -0,0 +1,417 @@
<style lang="scss">
@import "@/styles/table-common.scss";
</style>
<template>
<div class="search">
<Card>
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70">
<Form-item label="消息标题" prop="title">
<Input
type="text"
v-model="searchForm.title"
placeholder="请输入消息标题"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="消息内容" prop="content">
<Input
type="text"
v-model="searchForm.content"
placeholder="请输入消息内容"
clearable
style="width: 200px"
/>
</Form-item>
<span v-if="drop">
<Form-item label="消息类型" prop="type">
<Select
v-model="searchForm.type"
placeholder="请选择消息类型"
clearable
style="width: 200px"
>
<Option
v-for="(item, i) in dictMessageType"
:key="i"
:value="item.value"
>{{item.title}}</Option>
</Select>
</Form-item>
<Form-item label="创建时间">
<DatePicker
v-model="selectDate"
type="daterange"
format="yyyy-MM-dd"
clearable
@on-change="selectDateRange"
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
</Form-item>
</span>
<Form-item style="margin-left:-35px;" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
<a class="drop-down" @click="dropDown">
{{dropDownContent}}
<Icon :type="dropDownIcon"></Icon>
</a>
</Form-item>
</Form>
</Row>
<Row class="operation">
<Button @click="add" type="primary" icon="md-add">发送新消息</Button>
<Button @click="delAll" icon="md-trash">批量删除撤回</Button>
<Button @click="getDataList" icon="md-refresh">刷新</Button>
<Button type="dashed" @click="openSearch=!openSearch">{{openSearch ? "关闭搜索" : "开启搜索"}}</Button>
<Button type="dashed" @click="openTip=!openTip">{{openTip ? "关闭提示" : "开启提示"}}</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择
<span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="showSelect"
ref="table"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
: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>
</Card>
</div>
</template>
<script>
import {
getMessageData,
addMessage,
editMessage,
deleteMessage
} from "@/api/index";
export default {
title: "message-manage",
data() {
return {
openSearch: true,
openTip: true,
loading: true, // 表单加载状态
userLoading: true,
selectCount: 0, // 多选计数
selectList: [], // 多选数据
drop: false,
dropDownContent: "展开",
dropDownIcon: "ios-arrow-down",
searchForm: {
// 搜索框对应data对象
title: "",
content: "",
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "" // 终止时间
},
selectDate: null, // 选择日期绑定modal
columns: [
// 表头
{
type: "selection",
width: 60,
align: "center"
},
{
type: "index",
width: 60,
align: "center"
},
{
title: "消息标题",
key: "title",
width: 200,
sortable: true
},
{
title: "消息内容",
key: "content",
minWidth: 275,
tooltip: true
},
{
title: "类型",
key: "type",
width: 120,
align: "center"
},
{
title: "新创建账号推送",
key: "createSend",
align: "center",
width: 135,
render: (h, params) => {
if (params.row.createSend) {
return h("div", [
h(
"Tag",
{
props: {
color: "blue"
}
},
"开启"
)
]);
} else {
return h("div", [
h(
"Tag",
{
props: {
color: "default"
}
},
"关闭"
)
]);
}
}
},
{
title: "创建时间",
key: "createTime",
width: 180,
sortable: true,
sortType: "desc"
},
{
title: "操作",
key: "action",
width: 280,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.edit(params.row);
}
}
},
"编辑"
),
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.sendDetail(params.row);
}
}
},
"查看发送详情"
),
h(
"Button",
{
props: {
type: "error",
size: "small"
},
on: {
click: () => {
this.remove(params.row);
}
}
},
"删除撤回"
)
]);
}
}
],
data: [], // 表单数据
total: 0, // 表单数据总数
dictMessageType: this.$store.state.dict.messageType
};
},
methods: {
init() {
this.getDataList();
},
dropDown() {
if (this.drop) {
this.dropDownContent = "展开";
this.dropDownIcon = "ios-arrow-down";
} else {
this.dropDownContent = "收起";
this.dropDownIcon = "ios-arrow-up";
}
this.drop = !this.drop;
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
getMessageData(this.searchForm).then(res => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
// 重新加载数据
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order == "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
add() {
let query = { type: 0, backRoute: this.$route.name };
this.$router.push({
name: "add_edit_message",
query: query
});
},
edit(v) {
let query = { type: 1, id: v.id, backRoute: this.$route.name };
this.$router.push({
name: "add_edit_message",
query: query
});
},
sendDetail(v) {
let query = { id: v.id };
this.$router.push({
name: "message_send_detail",
query: query
});
},
remove(v) {
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认要删除 " + v.title + " ?",
loading: true,
onOk: () => {
// 删除
deleteMessage(v.id).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
}
});
},
showSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
delAll() {
if (this.selectCount <= 0) {
this.$Message.warning("您还未选择要删除的数据");
return;
}
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除所选的 " + this.selectCount + " 条数据?",
loading: true,
onOk: () => {
let ids = "";
this.selectList.forEach(function(e) {
ids += e.id + ",";
});
ids = ids.substring(0, ids.length - 1);
// 批量删除
deleteMessage(ids).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.clearSelectAll();
this.getDataList();
}
});
}
});
}
},
mounted() {
this.init();
}
};
</script>

View File

@@ -0,0 +1,327 @@
<style lang="scss">
@import "@/styles/table-common.scss";
</style>
<template>
<div class="search">
<Card>
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" inline :label-width="90">
<Form-item label="发送用户ID" prop="userId">
<Input
type="text"
v-model="userId"
placeholder="请输入发送用户完整ID"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="发送状态" prop="status">
<Select v-model="status" placeholder="请选择" style="width: 200px" clearable>
<Option value="0">未读</Option>
<Option value="1">已读</Option>
<Option value="2">回收站</Option>
</Select>
</Form-item>
<Form-item style="margin-left:-35px;" class="br">
<Button @click="getDataList" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</Form-item>
</Form>
</Row>
<Row class="operation">
<Button v-hasRole="'ROLE_ADMIN'" @click="delAll" icon="md-trash">批量删除</Button>
<Button @click="getDataList" icon="md-refresh">刷新</Button>
<Button type="dashed" @click="openSearch=!openSearch">{{openSearch ? "关闭搜索" : "开启搜索"}}</Button>
<Button type="dashed" @click="openTip=!openTip">{{openTip ? "关闭提示" : "开启提示"}}</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择
<span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="pageNumber"
:total="total"
:page-size="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>
</Card>
</div>
</template>
<script>
import { getMessageSendData, deleteMessageSend } from "@/api/index";
export default {
name: "message_send_detail",
data() {
return {
openSearch: true,
openTip: true,
loading: true, // 表单加载状态
messageId: "",
sortColumn: "createTime", // 排序字段
sortType: "desc", // 排序方式
status: "", // 发送状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
type: "selection",
width: 60,
align: "center"
},
{
type: "index",
width: 60,
align: "center"
},
{
title: "发送消息标题",
key: "title"
},
{
title: "发送用户",
key: "username",
sortable: true
},
{
title: "状态",
key: "status",
align: "center",
sortable: true,
render: (h, params) => {
if (params.row.status == 0) {
return h("div", [
h(
"Tag",
{
props: {
color: "default"
}
},
"未读"
)
]);
} else if (params.row.status == 1) {
return h("div", [
h(
"Tag",
{
props: {
color: "green"
}
},
"已读"
)
]);
} else if (params.row.status == 2) {
return h("div", [
h(
"Tag",
{
props: {
color: "orange"
}
},
"回收站"
)
]);
}
}
},
{
title: "创建时间",
key: "createTime",
sortable: true,
sortType: "desc"
},
{
title: "更新时间",
key: "updateTime",
sortable: true
},
{
title: "操作",
key: "action",
align: "center",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "error",
size: "small",
icon: "md-trash"
},
on: {
click: () => {
this.remove(params.row);
}
}
},
"删除"
)
]);
}
}
],
data: [], // 表单数据
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
total: 0, // 表单数据总数
userId: ""
};
},
methods: {
init() {
this.messageId = this.$route.query.id;
this.getDataList();
},
changePage(v) {
this.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.pageSize = v;
this.getDataList();
},
changeSort(e) {
this.sortColumn = e.key;
this.sortType = e.order;
if (e.order == "normal") {
this.sortType = "";
}
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
getDataList(v) {
this.loading = true;
if (v == 0) {
this.userId = "";
}
let params = {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
sort: this.sortColumn,
order: this.sortType,
messageId: this.messageId,
status: this.status,
userId: this.userId
};
// 避免后台默认值
if (!params.status) {
params.status = "";
}
getMessageSendData(params).then(res => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
},
handleReset() {
this.userId = "";
this.status = "";
this.getDataList();
},
remove(v) {
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认要删除该条数据?",
loading: true,
onOk: () => {
// 删除
deleteMessageSend(v.id).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
}
});
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
delAll() {
if (this.selectCount <= 0) {
this.$Message.warning("您还未选择要删除的数据");
return;
}
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除所选的 " + this.selectCount + " 条数据?",
loading: true,
onOk: () => {
let ids = "";
this.selectList.forEach(function(e) {
ids += e.id + ",";
});
ids = ids.substring(0, ids.length - 1);
// 批量删除
deleteMessageSend(ids).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.clearSelectAll();
this.getDataList();
}
});
}
});
}
},
watch: {
// 监听路由变化通过id获取数据
$route(to, from) {
if (to.name == "message_send_detail") {
this.messageId = this.$route.query.id;
this.getDataList();
}
}
},
mounted() {
this.init();
this.$Modal.info({
title: "提示",
content: "该页面已根据用户角色隐藏操作按钮"
});
}
};
</script>

View File

@@ -0,0 +1,404 @@
<style lang="less">
@import "@/styles/table-common.scss";
</style>
<template>
<div>
<!--微信模板-->
<Modal v-model="wechatModal" width="530">
<p slot="header">
<Icon type="edit"></Icon>
<span>微信设置</span>
</p>
<div>
<Form ref="wechatFormData" :model="wechatFormData" label-position="left" :label-width="100">
<FormItem v-if="tab === 'WECHAT'" label="模板名称">
<Input v-model="wechatFormData.name" size="large" maxlength="9" disabled></Input>
</FormItem>
<FormItem v-if="tab === 'WECHAT'" label="头部信息" prop="first">
<Input v-model="wechatFormData.first" size="large" maxlength="50"></Input>
</FormItem>
<FormItem v-if="tab === 'WECHAT'" label="备注" prop="remark">
<Input class='textarea' :rows="5" :autosize="{maxRows:5,minRows: 5}" v-model="wechatFormData.remark"
type="textarea" maxlength="150"/>
</FormItem>
<FormItem label="是否开启" prop="enable">
<i-switch v-model="wechatFormData.enable" size="large">
<span slot="open">开启</span>
<span slot="close">关闭</span>
</i-switch>
</FormItem>
</Form>
</div>
<div slot="footer" style="text-align: right">
<Button v-if="tab === 'WECHAT'" type="success" size="large" @click="wechatFormDataEdit">保存</Button>
<Button v-else type="success" size="large" @click="wechatMPFormDataEdit">保存</Button>
</div>
</Modal>
<Tabs @on-click="tabPaneChange" v-model="tab">
<TabPane label="微信消息" name="WECHAT">
<div class="search">
<Card>
<Row class="operation">
<Button @click="weChatSync" type="primary">同步微信消息</Button>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="weChatColumns"
:data="weChatData"
ref="weChatTable"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="weChatSearchForm.pageNumber"
:total="weChatTotal"
:page-size="weChatSearchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10,20,50]"
size="small"
></Page>
</Row>
</Card>
</div>
</TabPane>
<TabPane label="微信小程序订阅消息" name="WECHATMP">
<div class="search">
<Card>
<Row class="operation">
<Button @click="weChatSync('mp')" type="primary">同步微信小程序订阅消息</Button>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="weChatColumns"
:data="weChatMPData"
sortable="custom"
ref="weChatMPTable"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="weChatMPSearchForm.pageNumber"
:total="weChatMPTotal"
:page-size="weChatMPSearchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10,20,50]"
size="small"
></Page>
</Row>
</Card>
</div>
</TabPane>
</Tabs>
</div>
</template>
<script>
import {
wechatMessageSync,
getWechatMessagePage,
editWechatMessageTemplate,
delWechatMessageTemplate,
wechatMPMessageSync,
getWechatMPMessagePage,
editWechatMPMessageTemplate,
delWechatMPMessageTemplate
} from "@/api/setting";
export default {
title: "wechat-message-manage",
data() {
return {
wechatModal: false,//微信消息
wechatFormData: {},
wechatMPModal: false,//微信消息
wechatMPFormData: {},
tab: "WECHAT",
searchForm: {
type: "WECHAT"
},
openTip: true,
loading: true, // 表单加载状态
name: '',
id: '',
userLoading: true,
selectCount: 0, // 多选计数
selectList: [], // 多选数据
drop: false,
dropDownContent: "展开",
dropDownIcon: "ios-arrow-down",
//微信消息查询
weChatSearchForm: {
// 搜索框对应data对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
weChatMPSearchForm: {
// 搜索框对应data对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
weChatColumns: [
{
title: "模板编号",
key: "code",
width: 500,
sortable: true
},
{
title: "是否开启",
key: "enable",
sortable: true,
width: 150,
render: (h, params) => {
if (params.row.enable == true) {
return h('div', [
h('span', {}, '开启'),
]);
} else {
return h('div', [
h('span', {}, '关闭'),
]);
}
},
},
{
title: "模板名称",
key: "name",
width: 200,
sortable: true
},
{
title: "创建时间",
key: "createTime",
sortable: true,
sortType: "desc",
},
{
title: "操作",
key: "action",
width: 200,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.wechatSettingAlert(params.row);
}
}
},
"编辑"
),
h(
"Button",
{
props: {
type: "error",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.delWeChat(params.row);
}
}
},
"删除"
)
]);
}
}
],
weChatData: [], // 表单数据
weChatMPData: [], // 表单数据
weChatTotal: 0, // 表单数据总数
weChatMPTotal: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.type = this.tab;
this.getDataList();
},
changePageSize(v) {
this.searchForm.type = this.tab;
this.getDataList();
},
//微信弹出框
wechatSettingAlert(v) {
this.wechatFormData = v
this.id = v.id
this.wechatModal = true
},
//同步微信消息
weChatSync(mp) {
this.$Modal.confirm({
title: "提示",
// 记得确认修改此处
content: "确认要初始化微信小程序消息订阅?",
loading: true,
onOk: () => {
// 同步微信消息模板
if (mp === "mp") {
wechatMPMessageSync().then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success('微信小程序消息订阅初始化');
}
});
} else {
// 同步微信消息模板
wechatMessageSync().then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success('微信消息模板初始化成功');
}
});
}
}
});
},
//微信设置保存
wechatFormDataEdit() {
this.$refs['wechatFormData'].validate((valid) => {
if (valid) {
editWechatMessageTemplate(this.id, this.wechatFormData).then(res => {
if (res.message === 'success') {
this.$Message.success('微信模板修改成功');
this.wechatModal = false;
this.getWechatMessagePage();
}
});
}
})
},
wechatMPFormDataEdit() {
this.$refs['wechatFormData'].validate((valid) => {
if (valid) {
editWechatMPMessageTemplate(this.id, this.wechatMPFormData).then(res => {
if (res.message === 'success') {
this.$Message.success('微信消息订阅模板修改成功');
this.wechatModal = false;
this.getWechatMessagePage();
}
});
}
})
},
//删除微信模消息
delWeChat(v) {
this.$Modal.confirm({
title: "提示",
content: "确定删除此模板?",
loading: true,
onOk: () => {
// 删除微信消息模板
if (this.tab === "WECHAT") {
delWechatMessageTemplate(v.id).then(res => {
if (res.success) {
this.$Modal.remove();
this.$Message.success('微信模板删除成功');
this.getWechatMessagePage()
}
});
} else {
delWechatMPMessageTemplate(v.id).then(res => {
if (res.success) {
this.$Modal.remove();
this.$Message.success('微信消息订阅删除成功');
this.getWechatMessagePage()
}
});
}
}
});
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
getWechatMessagePage(this.searchWe).then(res => {
this.loading = false;
if (res.success) {
this.weChatData = res.result.records;
this.weChatTotal = res.result.total;
}
});
},
//分页获取微信消息
getWechatMessagePage() {
getWechatMessagePage(this.weChatSearchForm).then(res => {
this.loading = false;
if (res.success) {
this.weChatData = res.result.records;
this.weChatTotal = res.result.total;
}
});
},
//分页获取微信小程序消息订阅
getWechatMPMessagePage() {
getWechatMPMessagePage(this.weChatMPSearchForm).then(res => {
this.loading = false;
if (res.success) {
this.weChatMPData = res.result.records;
this.weChatMPTotal = res.result.total;
}
});
},
//tab切换事件
tabPaneChange(v) {
this.searchForm.type = v;
//如果是微信消息则走单独的接口
if (v === "WECHAT") {
this.getWechatMessagePage();
} else if (v === "WECHATMP") {
this.getWechatMPMessagePage();
}
}
},
mounted() {
this.init();
}
};
</script>

View File

@@ -0,0 +1,213 @@
<style lang="scss" scoped>
@import "../message-manage/messageManage.scss";
</style>
<template>
<div>
<Card>
<p slot="title">
<span v-if="type==0">发送新消息</span>
<span v-else>编辑消息</span>
</p>
<Row>
<Form
ref="form"
:model="form"
:label-width="90"
:rules="formValidate"
style="position:relative"
>
<FormItem label="标题" prop="title">
<Input v-model="form.title" style="width:600px" />
</FormItem>
<FormItem label="内容" prop="content" class="wangEditor">
<editor v-model="form.content"></editor>
</FormItem>
<div v-if="type==0">
<FormItem label="发送范围">
<RadioGroup v-model="form.sendType" >
<Radio label="ALL">全部会员</Radio>
<Radio label="SELECT">指定会员</Radio>
</RadioGroup>
</FormItem>
<div>
<FormItem label="选择用户" v-if="form.sendType==='SELECT'">
<member-choose text="选择发送用户" @on-change="handleSelectUser"></member-choose>
</FormItem>
</div>
</div>
<Form-item class="br">
<Button
type="primary"
:loading="submitLoading"
@click="handleSubmit"
style="width:100px"
>提交</Button>
<Button @click="handelCancel">取消</Button>
</Form-item>
<Spin size="large" fix v-if="loading"></Spin>
</Form>
</Row>
</Card>
</div>
</template>
<script>
import editor from "@/views/my-components/lili/editor";
import memberChoose from "@/views/my-components/lili/member-choose";
export default {
name: "add_message",
components: {
memberChoose,
editor
},
data() {
return {
type: 0,
loading: false, // 表单加载状态
selectUsers: [],
userModalVisible: false,
modalTitle: "", // 添加或编辑标题
form: {
// 添加或编辑表单对象初始化数据
title: "",
content: "",
sendType: "ALL",
memberIds: ""
},
formValidate: {
// 表单验证规则
title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
content: [{ required: true, message: "内容不能为空", trigger: "blur" }]
},
submitLoading: false, // 添加或编辑提交状态
dictMessageType: this.$store.state.dict.messageType,
backRoute: ""
};
},
methods: {
init() {
this.type = this.$route.query.type;
this.backRoute = this.$route.query.backRoute;
if (this.type == 1) {
this.form.id = this.$route.query.id;
this.getData();
}
},
getData() {
this.loading = true;
getMessageDataById(this.form.id).then(res => {
this.loading = false;
if (res.success) {
// 转换null为""
let v = res.result;
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
}
});
},
handleSubmit() {
this.$refs.form.validate(valid => {
let ids = [];
this.selectUsers.forEach(e => {
ids += e.id + ",";
});
if (ids.length > 0) {
ids = ids.substring(0, ids.length - 1);
}
this.form.memberIds = ids;
if (valid) {
this.submitLoading = true;
if (this.modalType === 0) {
// 添加 避免编辑后传入id等数据 记得删除
this.postRequest("/memberNoticeSenter/insertOrUpdate", this.form).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.modalVisible = false;
}
});
} else {
// 编辑
this.postRequest("/memberNoticeSenter/insertOrUpdate", this.form).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.modalVisible = false;
}
});
}
}
});
},
handelSubmit() {
console.log()
this.$refs.form.validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.type == 0) {
// 添加 避免编辑后传入id等数据 记得删除
delete this.form.id;
// 用户id数据
addMessage(this.form).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.closeCurrentPage();
}
});
} else if (this.type == 1) {
// 编辑
editMessage(this.form).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.closeCurrentPage();
}
});
}
}
});
},
handleSelectUser(v) {
this.selectUsers = v;
},
handelCancel() {
this.closeCurrentPage();
},
// 关闭当前页面
closeCurrentPage() {
this.$store.commit("removeTag", "add_message");
localStorage.pageOpenedList = JSON.stringify(
this.$store.state.app.pageOpenedList
);
this.$router.push({
name: this.backRoute
});
}
},
mounted() {
this.init();
},
watch: {
// 监听路由变化
$route(to, from) {
if (to.name == "member-notice-sender") {
this.type = this.$route.query.type;
if (this.type == 1) {
this.form.id = this.$route.query.id;
this.getData();
}
}
}
}
};
</script>

View File

@@ -0,0 +1,342 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="标题" prop="title">
<Input type="text" v-model="searchForm.title" placeholder="请输入标题" clearable style="width: 200px"/>
</Form-item>
<Form-item label="消息内容" prop="content">
<Input type="text" v-model="searchForm.content" placeholder="请输入消息内容" clearable style="width: 200px"/>
</Form-item>
<span v-if="drop">
<Form-item label="发送类型" prop="sendType">
<Select v-model="searchForm.sendType" placeholder="请选择" clearable style="width: 200px">
<Option value="ALL">全站会员</Option>
<Option value="SELECT">指定会员</Option>
</Select>
</Form-item>
<Form-item label="创建人" prop="createBy">
<Input type="text" v-model="searchForm.createBy" placeholder="请输入创建人" clearable style="width: 200px"/>
</Form-item>
</span>
<Form-item style="margin-left:-35px;" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
<a class="drop-down" @click="dropDown">
{{dropDownContent}}
<Icon :type="dropDownIcon"></Icon>
</a>
</Form-item>
</Form>
</Row>
<Row class="operation">
<Button @click="add" type="primary" icon="md-add">发送新消息</Button>
<Button @click="delAll" icon="md-trash">批量删除</Button>
<Button @click="getDataList" icon="md-refresh">刷新</Button>
</Row>
<Row v-show="openTip">
<Alert show-icon>
已选择 <span class="select-count">{{selectCount}}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
</Row>
<Row>
<Table :loading="loading" border :columns="columns" :data="data" 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="total" :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>
</Card>
</Col>
</Row>
</div>
</template>
<script>
export default {
name: "member-notice-sender",
components: {
},
data() {
return {
openSearch: true, // 显示搜索
openTip: true, // 显示提示
loading: true, // 表单加载状态
modalType: 0, // 添加或编辑标识
modalVisible: false, // 添加或编辑显示
modalTitle: "", // 添加或编辑标题
drop: false,
dropDownContent: "展开",
dropDownIcon: "ios-arrow-down",
searchForm: { // 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
type: "selection",
width: 60,
align: "center"
},
{
type: "index",
width: 60,
align: "center"
},
{
title: "标题",
key: "title",
minWidth: 120,
sortable: false,
},
{
title: "发送类型",
key: "sendType",
minWidth: 120,
sortable: false,
render: (h, params) => {
if (params.row.sendType == "ALL") {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "全部会员"
}
})
]);
}else{
return h("div", [
h("Badge", {
props: {
status: "success",
text: "指定会员"
}
})
]);
}
}
},
{
title: "创建人",
key: "createBy",
minWidth: 120,
sortable: false,
},
{
title: "创建时间",
key: "createTime",
minWidth: 120,
sortable: true,
},
{
title: "操作",
key: "action",
align: "center",
width: 200,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "error",
size: "small",
icon: "md-trash"
},
on: {
click: () => {
this.remove(params.row);
}
}
},
"删除"
)
]);
}
}
],
data: [], // 表单数据
total: 0 // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
// 重新加载数据
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
dropDown() {
if (this.drop) {
this.dropDownContent = "展开";
this.dropDownIcon = "ios-arrow-down";
} else {
this.dropDownContent = "收起";
this.dropDownIcon = "ios-arrow-up";
}
this.drop = !this.drop;
},
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
this.getRequest("/memberNoticeSenter/getByPage", this.searchForm).then(res => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
// 以下为模拟数据
//this.data = [
//];
this.total = this.data.length;
this.loading = false;
},
add() {
let query = { type: 0, backRoute: this.$route.name };
this.$router.push({
name: "add_message",
query: query
});
},
edit(v) {
this.modalType = 1;
this.modalTitle = "编辑";
this.$refs.form.resetFields();
// 转换null为""
for (let attr in v) {
if (v[attr] === null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
this.modalVisible = true;
},
remove(v) {
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认要删除么?",
loading: true,
onOk: () => {
// 删除
this.deleteRequest("/memberNoticeSenter/delByIds/" + v.id).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
// 模拟请求成功
//this.$Message.success("操作成功");
//this.$Modal.remove();
//this.getDataList();
}
});
},
delAll() {
if (this.selectCount <= 0) {
this.$Message.warning("您还未选择要删除的数据");
return;
}
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除所选的 " + this.selectCount + " 条数据?",
loading: true,
onOk: () => {
let ids = "";
this.selectList.forEach(function(e) {
ids += e.id + ",";
});
ids = ids.substring(0, ids.length - 1);
// 批量删除
this.deleteRequest("/memberNoticeSenter/delByIds/" + ids).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.clearSelectAll();
this.getDataList();
}
});
// 模拟请求成功
//this.$Message.success("操作成功");
//this.$Modal.remove();
//this.clearSelectAll();
//this.getDataList();
}
});
}
},
mounted() {
this.init();
}
};
</script>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
// @import "@/styles/table-common.scss";
.search {
.operation {
margin-bottom: 2vh;
}
.select-count {
font-weight: 600;
color: #40a9ff;
}
.select-clear {
margin-left: 10px;
}
.page {
margin-top: 2vh;
}
.drop-down {
margin-left: 5px;
}
}
</style>

View File

@@ -0,0 +1,235 @@
<template>
<div class="search">
<Row>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="会员名称" prop="username">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Button @click="handleSearch" class="search-btn" type="primary" icon="ios-search">搜索</Button >
</Form>
</Row>
<Row class="padding-row">
<Table
:loading="loading"
border
:columns="columns"
:data="data"
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="total"
: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>
</Card>
</Row>
</div>
</template>
<script>
import region from "@/views/lili-components/region";
import * as API_Member from "@/api/member.js";
import ossManage from "@/views/sys/oss-manage/ossManage";
import * as RegExp from '@/libs/RegExp.js';
export default {
name: "point",
components: {
region,
ossManage,
},
data() {
return {
descFlag: false, //编辑查看框
loading: true, // 表单加载状态
addFlag: false,
updateRegion: false,
addMemberForm:{
mobile: "",
username: "",
password: "",
},
searchForm: {
pageNumber: 1,
pageSize: 10,
},
picModelFlag: false,
// 表单验证规则
formValidate: {},
addRule:{
mobile: [
{ required: true, message: '请输入手机号码' },
{
pattern: RegExp.mobile,
message: '请输入正确的手机号'
}
],
username: [
{ required: true, message: '请输入会员名称' },
],
password: [
{ required: true, message: '请输入密码' },
],
},
ruleValidate: {}, //修改验证
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "会员名称",
key: "memberName",
minWidth: 120,
tooltip: true
},
{
title: "操作内容",
key: "content",
minWidth: 180,
tooltip: true
},
{
title: "之前积分",
key: "beforePoint",
width: 110,
},
{
title: "变动积分",
key: "point",
width: 110,
render: (h, params) => {
if (params.row.pointType == 1) {
return h('div', [
h('span', {
style: {
color: 'green'
}
}, "+" + params.row.point),
]);
} else {
return h('div', [
h('span', {
style: {
color: 'red'
}
}, "-" + params.row.point),
]);
}
}
},
{
title: "当前积分",
key: "point",
width: 110,
},
{
title: "操作时间",
key: "createTime",
width: 170
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
// 回调给父级
callback(val) {
this.$emit("callback", val);
},
init() {
this.getData();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getData();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getData();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getData();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getData();
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
//查新积分列表
getData() {
this.loading = true;
API_Member.getHistoryPointData(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.loading = false;
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/table-common.scss";
.face {
width: 60px;
height: 60px;
border-radius: 50%;
}
</style>