会员营销
This commit is contained in:
parent
12bdfea200
commit
11cfa6169e
53
src/api/member/active/index.js
Normal file
53
src/api/member/active/index.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建营销活动
|
||||
export function createActiveMain(data) {
|
||||
return request({
|
||||
url: '/member/active-main/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新营销活动
|
||||
export function updateActiveMain(data) {
|
||||
return request({
|
||||
url: '/member/active-main/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除营销活动
|
||||
export function deleteActiveMain(id) {
|
||||
return request({
|
||||
url: '/member/active-main/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得营销活动
|
||||
export function getActiveMain(id) {
|
||||
return request({
|
||||
url: '/member/active-main/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得营销活动分页
|
||||
export function getActiveMainPage(params) {
|
||||
return request({
|
||||
url: '/member/active-main/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 导出营销活动 Excel
|
||||
export function exportActiveMainExcel(params) {
|
||||
return request({
|
||||
url: '/member/active-main/export-excel',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
53
src/api/member/coupon/index.js
Normal file
53
src/api/member/coupon/index.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建基础卡券
|
||||
export function createCoupon(data) {
|
||||
return request({
|
||||
url: '/member/coupon/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新基础卡券
|
||||
export function updateCoupon(data) {
|
||||
return request({
|
||||
url: '/member/coupon/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除基础卡券
|
||||
export function deleteCoupon(id) {
|
||||
return request({
|
||||
url: '/member/coupon/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得基础卡券
|
||||
export function getCoupon(id) {
|
||||
return request({
|
||||
url: '/member/coupon/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得基础卡券分页
|
||||
export function getCouponPage(params) {
|
||||
return request({
|
||||
url: '/member/coupon/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 导出基础卡券 Excel
|
||||
export function exportCouponExcel(params) {
|
||||
return request({
|
||||
url: '/member/coupon/export-excel',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
53
src/api/member/level/index.js
Normal file
53
src/api/member/level/index.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建会员等级
|
||||
export function createLevel(data) {
|
||||
return request({
|
||||
url: '/member/level/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新会员等级
|
||||
export function updateLevel(data) {
|
||||
return request({
|
||||
url: '/member/level/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除会员等级
|
||||
export function deleteLevel(id) {
|
||||
return request({
|
||||
url: '/member/level/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得会员等级
|
||||
export function getLevel(id) {
|
||||
return request({
|
||||
url: '/member/level/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得会员等级分页
|
||||
export function getLevelPage(params) {
|
||||
return request({
|
||||
url: '/member/level/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 导出会员等级 Excel
|
||||
export function exportLevelExcel(params) {
|
||||
return request({
|
||||
url: '/member/level/export-excel',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
@ -202,6 +202,18 @@ export const DICT_TYPE = {
|
||||
REPAIR_WARES_ATTRIBUTE: 'wares_attribute',
|
||||
//配件来源
|
||||
REPAIR_WARES_DATA_FORM: 'wares_data_form',
|
||||
|
||||
// ---------会员相关---------member_coupon_type,member_coupon_out_rule,member_car,member_active
|
||||
//卡券类型
|
||||
MEMBER_COUPON_TYPE:"member_coupon_type",
|
||||
//核销规则
|
||||
MEMBER_COUPON_OUT_RULE:"member_coupon_out_rule",
|
||||
//适用车型
|
||||
MEMBER_CAR:"member_car",
|
||||
//活动类型
|
||||
MEMBER_ACTIVE:"member_active",
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
160
src/views/member/active/ActiveMainForm.vue
Normal file
160
src/views/member/active/ActiveMainForm.vue
Normal file
@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="50%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="活动名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入活动名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="活动类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择活动类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_ACTIVE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="活动开始时间" prop="beginTime">
|
||||
<el-date-picker clearable v-model="formData.beginTime" type="date" value-format="timestamp"
|
||||
placeholder="选择活动开始时间"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="活动结束时间" prop="endTime">
|
||||
<el-date-picker clearable v-model="formData.endTime" type="date" value-format="timestamp"
|
||||
placeholder="选择活动结束时间"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="活动状态" prop="status">
|
||||
<el-switch
|
||||
v-model="formData.status"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="01"
|
||||
inactive-value="02">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12">-->
|
||||
<!-- <el-form-item label="是否区分会员等级" prop="isMember">-->
|
||||
<!-- <el-switch-->
|
||||
<!-- v-model="formData.isMember"-->
|
||||
<!-- active-color="#13ce66"-->
|
||||
<!-- inactive-color="#ff4949"-->
|
||||
<!-- active-value="0"-->
|
||||
<!-- inactive-value="1">-->
|
||||
<!-- </el-switch>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="活动描述" prop="remark">
|
||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入活动描述"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as ActiveMainApi from '@/api/member/active';
|
||||
|
||||
export default {
|
||||
name: "ActiveMainForm",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
beginTime: undefined,
|
||||
endTime: undefined,
|
||||
status: '01',
|
||||
remark: undefined,
|
||||
isMember: '0',
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await ActiveMainApi.getActiveMain(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改营销活动";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增营销活动";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await ActiveMainApi.updateActiveMain(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await ActiveMainApi.createActiveMain(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
beginTime: undefined,
|
||||
endTime: undefined,
|
||||
status: '01',
|
||||
remark: undefined,
|
||||
isMember: '0',
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
170
src/views/member/active/index.vue
Normal file
170
src/views/member/active/index.vue
Normal file
@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="活动名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入活动名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择卡券类型" @keyup.enter.native="handleQuery">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_ACTIVE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['member:active-main:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="活动名称" align="center" prop="name"/>
|
||||
<el-table-column label="活动类型" align="center" prop="type">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.MEMBER_ACTIVE" :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动开始时间" align="center" prop="beginTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.beginTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动结束时间" align="center" prop="endTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.endTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动状态" align="center" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag v-if="scope.row.status == '01'" type="success">启用</el-tag>
|
||||
<el-tag v-if="scope.row.status == '02'" type="danger">停用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动描述" show-overflow-tooltip align="center" prop="remark"/>
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['member:active-main:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:active-main:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<ActiveMainForm ref="formRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as ActiveMainApi from '@/api/member/active';
|
||||
import ActiveMainForm from './ActiveMainForm.vue';
|
||||
|
||||
export default {
|
||||
name: "ActiveMain",
|
||||
components: {
|
||||
ActiveMainForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 营销活动列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
type: null,
|
||||
beginTime: [],
|
||||
endTime: [],
|
||||
status: null,
|
||||
remark: null,
|
||||
isMember: null,
|
||||
createTime: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await ActiveMainApi.getActiveMainPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除营销活动名称为"' + row.name + '"的数据项?')
|
||||
try {
|
||||
await ActiveMainApi.deleteActiveMain(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有营销活动数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await ActiveMainApi.exportActiveMainExcel(this.queryParams);
|
||||
this.$download.excel(data, '营销活动.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
188
src/views/member/coupon/CouponForm.vue
Normal file
188
src/views/member/coupon/CouponForm.vue
Normal file
@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="卡券名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入卡券名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="卡券类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择卡券类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="适用车型" prop="carModel">
|
||||
<el-select v-model="formData.carModel" placeholder="请选择卡券类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_CAR)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="核销规则" prop="outRule">
|
||||
<el-select v-model="formData.outRule" placeholder="请选择卡券类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_OUT_RULE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始有效期" prop="beginTime">
|
||||
<el-date-picker clearable v-model="formData.beginTime" type="date" value-format="timestamp"
|
||||
placeholder="选择开始有效期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结束有效期" prop="endTime">
|
||||
<el-date-picker clearable v-model="formData.endTime" type="date" value-format="timestamp"
|
||||
placeholder="选择结束有效期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="面额" prop="amount">
|
||||
<el-input-number v-model="formData.amount" :precision="2" :step="0.1" ></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input-number v-model="formData.unitPrice" :precision="2" :step="0.1" ></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="效果图片">
|
||||
<ImageUpload v-model="formData.image" :limit="1"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- <el-form-item label="适用子公司" prop="corpIds">-->
|
||||
<!-- <el-input v-model="formData.corpIds" placeholder="请输入适用子公司"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as CouponApi from '@/api/member/coupon';
|
||||
import ImageUpload from '@/components/ImageUpload';
|
||||
|
||||
export default {
|
||||
name: "CouponForm",
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
carModel: undefined,
|
||||
beginTime: undefined,
|
||||
endTime: undefined,
|
||||
corpIds: undefined,
|
||||
amount: undefined,
|
||||
image: undefined,
|
||||
remark: undefined,
|
||||
outRule: undefined,
|
||||
unitPrice: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await CouponApi.getCoupon(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改基础卡券";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增基础卡券";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await CouponApi.updateCoupon(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await CouponApi.createCoupon(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
carModel: undefined,
|
||||
beginTime: undefined,
|
||||
endTime: undefined,
|
||||
corpIds: undefined,
|
||||
amount: undefined,
|
||||
image: undefined,
|
||||
remark: undefined,
|
||||
outRule: undefined,
|
||||
unitPrice: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
183
src/views/member/coupon/index.vue
Normal file
183
src/views/member/coupon/index.vue
Normal file
@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="卡券名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入卡券名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="卡券类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择卡券类型" @keyup.enter.native="handleQuery">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="核销规则" prop="outRule">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择核销规则" @keyup.enter.native="handleQuery">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MEMBER_COUPON_OUT_RULE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['member:coupon:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['member:coupon:export']">导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="卡券名称" width="200" align="left" prop="name"/>
|
||||
<el-table-column label="卡券类型" width="100" align="left" prop="type">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_TYPE" :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="适用车型" width="100" align="center" prop="carModel">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.MEMBER_CAR" :value="scope.row.carModel"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="核销规则" width="100" align="center" prop="outRule">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.MEMBER_COUPON_OUT_RULE" :value="scope.row.outRule"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始有效期" align="center" prop="beginTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.beginTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束有效期" align="center" prop="endTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.endTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="面额" width="100" align="right" prop="amount"/>
|
||||
<el-table-column label="备注" show-overflow-tooltip align="left" prop="remark"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['member:coupon:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:coupon:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<CouponForm ref="formRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as CouponApi from '@/api/member/coupon';
|
||||
import CouponForm from './CouponForm.vue';
|
||||
|
||||
export default {
|
||||
name: "Coupon",
|
||||
components: {
|
||||
CouponForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 基础卡券列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
type: null,
|
||||
carModel: null,
|
||||
outRule: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await CouponApi.getCouponPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除基础卡券名称为"' + row.name + '"的数据项?')
|
||||
try {
|
||||
await CouponApi.deleteCoupon(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有基础卡券数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await CouponApi.exportCouponExcel(this.queryParams);
|
||||
this.$download.excel(data, '基础卡券.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
155
src/views/member/level/LevelForm.vue
Normal file
155
src/views/member/level/LevelForm.vue
Normal file
@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="等级名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入等级名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="等级排序" prop="sort">
|
||||
<el-input-number v-model="formData.sort" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-switch
|
||||
v-model="formData.status"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="01"
|
||||
inactive-value="02">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="升级所需积分" prop="growthValue">
|
||||
<el-input-number v-model="formData.growthValue" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="折扣" prop="discount">
|
||||
<el-input-number v-model="formData.discount" :precision="2" :step="0.1" :max="10"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="等级说明" prop="remark">
|
||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入等级说明"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="等级权益" prop="userEquity">
|
||||
<el-input type="textarea" v-model="formData.userEquity" placeholder="请输入等级权益"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as LevelApi from '@/api/member/level';
|
||||
export default {
|
||||
name: "LevelForm",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
sort: undefined,
|
||||
name: undefined,
|
||||
status: '01',
|
||||
growthValue: undefined,
|
||||
remark: undefined,
|
||||
userEquity: undefined,
|
||||
discount: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
name: [{ required: true, message: '等级名称不能为空', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '等级排序不能为空', trigger: 'blur' }],
|
||||
userEquity: [{ required: true, message: '等级权益不能为空', trigger: 'blur' }],
|
||||
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await LevelApi.getLevel(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改会员等级";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增会员等级";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await LevelApi.updateLevel(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await LevelApi.createLevel(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
sort: undefined,
|
||||
name: undefined,
|
||||
status: '01',
|
||||
growthValue: undefined,
|
||||
remark: undefined,
|
||||
userEquity: undefined,
|
||||
discount: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,15 +1,150 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<doc-alert title="会员等级、积分、签到" url="https://doc.iocoder.cn/member/level/" />
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="等级名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入等级名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['member:level:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-link type="danger" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3">
|
||||
该功能支持 Vue3 + element-plus 版本!
|
||||
</el-link>
|
||||
<br />
|
||||
<el-text>
|
||||
可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/member/level/index.vue 代码,pull request 贡献给我们!
|
||||
</el-text>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="等级名称" align="center" prop="name"/>
|
||||
<el-table-column label="升级所需积分" align="center" prop="growthValue"/>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag v-if="scope.row.status == '01'" type="success">启用</el-tag>
|
||||
<el-tag v-if="scope.row.status == '02'" type="danger">停用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="折扣" align="center" prop="discount"/>
|
||||
<el-table-column label="等级说明" align="center" prop="remark"/>
|
||||
<el-table-column label="等级权益" align="center" prop="userEquity"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['member:level:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:level:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<LevelForm ref="formRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as LevelApi from '@/api/member/level';
|
||||
import LevelForm from './LevelForm.vue';
|
||||
|
||||
export default {
|
||||
name: "Level",
|
||||
components: {
|
||||
LevelForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 会员等级列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
sort: null,
|
||||
name: null,
|
||||
status: null,
|
||||
growthValue: null,
|
||||
remark: null,
|
||||
userEquity: null,
|
||||
createTime: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await LevelApi.getLevelPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除会员等级名称为"' + row.name + '"的数据项?')
|
||||
try {
|
||||
await LevelApi.deleteLevel(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有会员等级数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await LevelApi.exportLevelExcel(this.queryParams);
|
||||
this.$download.excel(data, '会员等级.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user