Compare commits
5 Commits
f2d6896282
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bdad9b4f0 | |||
|
|
fd7617b09f | ||
|
|
0e676e5737 | ||
| 27c2eaa52d | |||
| 84bddcf81f |
50
src/api/common/commonLotteryPrize.js
Normal file
50
src/api/common/commonLotteryPrize.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/axios';
|
||||||
|
|
||||||
|
export const getList = (current, size, params) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryPrize/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDetail = (id) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryPrize/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const remove = (ids) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryPrize/remove',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
ids,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryPrize/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const update = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryPrize/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
50
src/api/common/commonLotteryRecord.js
Normal file
50
src/api/common/commonLotteryRecord.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/axios';
|
||||||
|
|
||||||
|
export const getList = (current, size, params) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryRecord/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDetail = (id) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryRecord/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const remove = (ids) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryRecord/remove',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
ids,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryRecord/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const update = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-lotteryprize/lotteryRecord/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@@ -51,11 +51,11 @@ export const update = (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function doGivePack(row) {
|
export function allocatePackage(row) {
|
||||||
return request({
|
return request({
|
||||||
url: '/market/benefit-package-template/doGivePack',
|
url: '/market/benefit-package-template/allocate-benefit-package',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: row
|
data: row,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
126
src/option/common/commonLotteryPrize.js
Normal file
126
src/option/common/commonLotteryPrize.js
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
export default {
|
||||||
|
height:'auto',
|
||||||
|
calcHeight: 30,
|
||||||
|
tip: false,
|
||||||
|
searchShow: true,
|
||||||
|
searchMenuSpan: 6,
|
||||||
|
border: true,
|
||||||
|
index: true,
|
||||||
|
viewBtn: true,
|
||||||
|
selection: true,
|
||||||
|
dialogClickModal: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "主键",
|
||||||
|
prop: "id",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "奖品名称",
|
||||||
|
prop: "prizeName",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "奖品类型",
|
||||||
|
prop: "prizeType",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "奖品内容",
|
||||||
|
prop: "prizeValue",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "中奖概率(如 0.05 = 5%)",
|
||||||
|
prop: "probability",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "总库存(-1 表示无限)",
|
||||||
|
prop: "stock",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "每日发放上限",
|
||||||
|
prop: "dailyLimit",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "排序(用于前端展示顺序)",
|
||||||
|
prop: "sortOrder",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注",
|
||||||
|
prop: "remark",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建人",
|
||||||
|
prop: "createUser",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建部门",
|
||||||
|
prop: "createDept",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改人",
|
||||||
|
prop: "updateUser",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态:0=下架 1=上架",
|
||||||
|
prop: "status",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否已删除",
|
||||||
|
prop: "isDeleted",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
106
src/option/common/commonLotteryRecord.js
Normal file
106
src/option/common/commonLotteryRecord.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
export default {
|
||||||
|
height:'auto',
|
||||||
|
calcHeight: 30,
|
||||||
|
tip: false,
|
||||||
|
searchShow: true,
|
||||||
|
searchMenuSpan: 6,
|
||||||
|
border: true,
|
||||||
|
index: true,
|
||||||
|
viewBtn: true,
|
||||||
|
selection: true,
|
||||||
|
dialogClickModal: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "主键",
|
||||||
|
prop: "id",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户id",
|
||||||
|
prop: "userId",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "中奖奖品ID(null 表示未中奖/谢谢参与)",
|
||||||
|
prop: "prizeId",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "消耗积分",
|
||||||
|
prop: "pointsUsed",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注",
|
||||||
|
prop: "remark",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建人",
|
||||||
|
prop: "createUser",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建部门",
|
||||||
|
prop: "createDept",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改人",
|
||||||
|
prop: "updateUser",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "0=未发放 1=已发放 2=发放失败",
|
||||||
|
prop: "status",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否已删除",
|
||||||
|
prop: "isDeleted",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ export default {
|
|||||||
label: "下单账号",
|
label: "下单账号",
|
||||||
prop: "account",
|
prop: "account",
|
||||||
type: "input",
|
type: "input",
|
||||||
|
search: true,
|
||||||
overHidden: true,
|
overHidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
225
src/views/common/commonLotteryPrize.vue
Normal file
225
src/views/common/commonLotteryPrize.vue
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<basic-container>
|
||||||
|
<avue-crud :option="option"
|
||||||
|
v-model:search="search"
|
||||||
|
v-model:page="page"
|
||||||
|
v-model="form"
|
||||||
|
:table-loading="loading"
|
||||||
|
:data="data"
|
||||||
|
:permission="permissionList"
|
||||||
|
:before-open="beforeOpen"
|
||||||
|
ref="crud"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
@row-save="rowSave"
|
||||||
|
@row-del="rowDel"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@search-reset="searchReset"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@on-load="onLoad">
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
plain
|
||||||
|
v-if="permission.lotteryPrize_delete"
|
||||||
|
@click="handleDelete">删 除
|
||||||
|
</el-button>
|
||||||
|
<!-- <el-button type="warning"-->
|
||||||
|
<!-- plain-->
|
||||||
|
<!-- icon="el-icon-download"-->
|
||||||
|
<!-- @click="handleExport">导 出-->
|
||||||
|
<!-- </el-button>-->
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
</basic-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {getList, getDetail, add, update, remove} from "@/api/common/commonLotteryPrize";
|
||||||
|
import option from "@/option/common/commonLotteryPrize";
|
||||||
|
import {mapGetters} from "vuex";
|
||||||
|
import {exportBlob} from "@/api/common";
|
||||||
|
import {getToken} from '@/utils/auth';
|
||||||
|
import {downloadXls} from "@/utils/util";
|
||||||
|
import {dateNow} from "@/utils/date";
|
||||||
|
import NProgress from 'nprogress';
|
||||||
|
import 'nprogress/nprogress.css';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {},
|
||||||
|
query: {},
|
||||||
|
search: {},
|
||||||
|
loading: true,
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
selectionList: [],
|
||||||
|
option: option,
|
||||||
|
data: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["permission"]),
|
||||||
|
permissionList() {
|
||||||
|
return {
|
||||||
|
addBtn: this.validData(this.permission.lotteryPrize_add, false),
|
||||||
|
viewBtn: this.validData(this.permission.lotteryPrize_view, false),
|
||||||
|
delBtn: this.validData(this.permission.lotteryPrize_delete, false),
|
||||||
|
editBtn: this.validData(this.permission.lotteryPrize_edit, false)
|
||||||
|
};
|
||||||
|
},
|
||||||
|
ids() {
|
||||||
|
let ids = [];
|
||||||
|
this.selectionList.forEach(ele => {
|
||||||
|
ids.push(ele.id);
|
||||||
|
});
|
||||||
|
return ids.join(",");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
rowSave(row, done, loading) {
|
||||||
|
add(row).then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
}, error => {
|
||||||
|
loading();
|
||||||
|
window.console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowUpdate(row, index, done, loading) {
|
||||||
|
update(row).then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
}, error => {
|
||||||
|
loading();
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowDel(row) {
|
||||||
|
this.$confirm("确定将选择数据删除?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return remove(row.id);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete() {
|
||||||
|
if (this.selectionList.length === 0) {
|
||||||
|
this.$message.warning("请选择至少一条数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$confirm("确定将选择数据删除?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return remove(this.ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
this.$refs.crud.toggleSelection();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// handleExport() {
|
||||||
|
// let downloadUrl = `/blade-lotteryprize/lotteryPrize/export-lotteryPrize?${this.website.tokenHeader}=${getToken()}`;
|
||||||
|
// const {
|
||||||
|
// } = this.query;
|
||||||
|
// let values = {
|
||||||
|
// };
|
||||||
|
// this.$confirm("是否导出数据?", "提示", {
|
||||||
|
// confirmButtonText: "确定",
|
||||||
|
// cancelButtonText: "取消",
|
||||||
|
// type: "warning"
|
||||||
|
// }).then(() => {
|
||||||
|
// NProgress.start();
|
||||||
|
// exportBlob(downloadUrl, values).then(res => {
|
||||||
|
// downloadXls(res.data, `奖品配置表${dateNow()}.xlsx`);
|
||||||
|
// NProgress.done();
|
||||||
|
// })
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
beforeOpen(done, type) {
|
||||||
|
if (["edit", "view"].includes(type)) {
|
||||||
|
getDetail(this.form.id).then(res => {
|
||||||
|
this.form = res.data.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
searchReset() {
|
||||||
|
this.query = {};
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
searchChange(params, done) {
|
||||||
|
this.query = params;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page, params);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
selectionChange(list) {
|
||||||
|
this.selectionList = list;
|
||||||
|
},
|
||||||
|
selectionClear() {
|
||||||
|
this.selectionList = [];
|
||||||
|
this.$refs.crud.toggleSelection();
|
||||||
|
},
|
||||||
|
currentChange(currentPage){
|
||||||
|
this.page.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize){
|
||||||
|
this.page.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
refreshChange() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
onLoad(page, params = {}) {
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
const {
|
||||||
|
} = this.query;
|
||||||
|
|
||||||
|
let values = {
|
||||||
|
};
|
||||||
|
|
||||||
|
getList(page.currentPage, page.pageSize, values).then(res => {
|
||||||
|
const data = res.data.data;
|
||||||
|
this.page.total = data.total;
|
||||||
|
this.data = data.records;
|
||||||
|
this.loading = false;
|
||||||
|
this.selectionClear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
225
src/views/common/commonLotteryRecord.vue
Normal file
225
src/views/common/commonLotteryRecord.vue
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<basic-container>
|
||||||
|
<avue-crud :option="option"
|
||||||
|
v-model:search="search"
|
||||||
|
v-model:page="page"
|
||||||
|
v-model="form"
|
||||||
|
:table-loading="loading"
|
||||||
|
:data="data"
|
||||||
|
:permission="permissionList"
|
||||||
|
:before-open="beforeOpen"
|
||||||
|
ref="crud"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
@row-save="rowSave"
|
||||||
|
@row-del="rowDel"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@search-reset="searchReset"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@on-load="onLoad">
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
plain
|
||||||
|
v-if="permission.lotteryRecord_delete"
|
||||||
|
@click="handleDelete">删 除
|
||||||
|
</el-button>
|
||||||
|
<el-button type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
@click="handleExport">导 出
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
</basic-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {getList, getDetail, add, update, remove} from "@/api/common/commonLotteryRecord";
|
||||||
|
import option from "@/option/common/commonLotteryRecord";
|
||||||
|
import {mapGetters} from "vuex";
|
||||||
|
import {exportBlob} from "@/api/common";
|
||||||
|
import {getToken} from '@/utils/auth';
|
||||||
|
import {downloadXls} from "@/utils/util";
|
||||||
|
import {dateNow} from "@/utils/date";
|
||||||
|
import NProgress from 'nprogress';
|
||||||
|
import 'nprogress/nprogress.css';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {},
|
||||||
|
query: {},
|
||||||
|
search: {},
|
||||||
|
loading: true,
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
selectionList: [],
|
||||||
|
option: option,
|
||||||
|
data: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["permission"]),
|
||||||
|
permissionList() {
|
||||||
|
return {
|
||||||
|
addBtn: this.validData(this.permission.lotteryRecord_add, false),
|
||||||
|
viewBtn: this.validData(this.permission.lotteryRecord_view, false),
|
||||||
|
delBtn: this.validData(this.permission.lotteryRecord_delete, false),
|
||||||
|
editBtn: this.validData(this.permission.lotteryRecord_edit, false)
|
||||||
|
};
|
||||||
|
},
|
||||||
|
ids() {
|
||||||
|
let ids = [];
|
||||||
|
this.selectionList.forEach(ele => {
|
||||||
|
ids.push(ele.id);
|
||||||
|
});
|
||||||
|
return ids.join(",");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
rowSave(row, done, loading) {
|
||||||
|
add(row).then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
}, error => {
|
||||||
|
loading();
|
||||||
|
window.console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowUpdate(row, index, done, loading) {
|
||||||
|
update(row).then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
}, error => {
|
||||||
|
loading();
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowDel(row) {
|
||||||
|
this.$confirm("确定将选择数据删除?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return remove(row.id);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete() {
|
||||||
|
if (this.selectionList.length === 0) {
|
||||||
|
this.$message.warning("请选择至少一条数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$confirm("确定将选择数据删除?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return remove(this.ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!"
|
||||||
|
});
|
||||||
|
this.$refs.crud.toggleSelection();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleExport() {
|
||||||
|
let downloadUrl = `/blade-lotteryprize/lotteryRecord/export-lotteryRecord?${this.website.tokenHeader}=${getToken()}`;
|
||||||
|
const {
|
||||||
|
} = this.query;
|
||||||
|
let values = {
|
||||||
|
};
|
||||||
|
this.$confirm("是否导出数据?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
NProgress.start();
|
||||||
|
exportBlob(downloadUrl, values).then(res => {
|
||||||
|
downloadXls(res.data, `抽奖记录表${dateNow()}.xlsx`);
|
||||||
|
NProgress.done();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeOpen(done, type) {
|
||||||
|
if (["edit", "view"].includes(type)) {
|
||||||
|
getDetail(this.form.id).then(res => {
|
||||||
|
this.form = res.data.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
searchReset() {
|
||||||
|
this.query = {};
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
searchChange(params, done) {
|
||||||
|
this.query = params;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page, params);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
selectionChange(list) {
|
||||||
|
this.selectionList = list;
|
||||||
|
},
|
||||||
|
selectionClear() {
|
||||||
|
this.selectionList = [];
|
||||||
|
this.$refs.crud.toggleSelection();
|
||||||
|
},
|
||||||
|
currentChange(currentPage){
|
||||||
|
this.page.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize){
|
||||||
|
this.page.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
refreshChange() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
onLoad(page, params = {}) {
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
const {
|
||||||
|
} = this.query;
|
||||||
|
|
||||||
|
let values = {
|
||||||
|
};
|
||||||
|
|
||||||
|
getList(page.currentPage, page.pageSize, values).then(res => {
|
||||||
|
const data = res.data.data;
|
||||||
|
this.page.total = data.total;
|
||||||
|
this.data = data.records;
|
||||||
|
this.loading = false;
|
||||||
|
this.selectionClear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@@ -51,13 +51,13 @@
|
|||||||
:option="givePackOption"
|
:option="givePackOption"
|
||||||
:data="givePackData"
|
:data="givePackData"
|
||||||
v-model="givePackFrom"
|
v-model="givePackFrom"
|
||||||
@submit="givePackSubmit"
|
@submit="allocatePackageSubmit"
|
||||||
ref="stateCrud"
|
ref="stateCrud"
|
||||||
/>
|
/>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog title="用户福利包导入" append-to-body v-model="excelBox" width="555px">
|
<el-dialog title="用户福利包导入" append-to-body v-model="excelBox" width="555px">
|
||||||
<avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
|
<avue-form :option="excelOption" v-model="excelForm" :upload-after="excelUploadAfter">
|
||||||
<template #excelTemplate>
|
<template #excelTemplate>
|
||||||
<el-button type="primary" @click="handleTemplate">
|
<el-button type="primary" @click="handleTemplate">
|
||||||
点击下载<i class="el-icon-download el-icon--right"></i>
|
点击下载<i class="el-icon-download el-icon--right"></i>
|
||||||
@@ -75,7 +75,7 @@ import {
|
|||||||
add,
|
add,
|
||||||
update,
|
update,
|
||||||
remove,
|
remove,
|
||||||
doGivePack,
|
allocatePackage,
|
||||||
} from '@/api/market/marketBenefitPackageTemplate';
|
} from '@/api/market/marketBenefitPackageTemplate';
|
||||||
import option from '@/option/market/marketBenefitPackageTemplate';
|
import option from '@/option/market/marketBenefitPackageTemplate';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
@@ -320,7 +320,7 @@ export default {
|
|||||||
this.givePackFrom.id = row.id;
|
this.givePackFrom.id = row.id;
|
||||||
},
|
},
|
||||||
|
|
||||||
givePackSubmit(form, done) {
|
allocatePackageSubmit(form, done) {
|
||||||
const data = {
|
const data = {
|
||||||
packId: form.id,
|
packId: form.id,
|
||||||
phone: form.userPhone,
|
phone: form.userPhone,
|
||||||
@@ -328,7 +328,7 @@ export default {
|
|||||||
remark: form.remark,
|
remark: form.remark,
|
||||||
};
|
};
|
||||||
|
|
||||||
doGivePack(data).then(
|
allocatePackage(data).then(
|
||||||
() => {
|
() => {
|
||||||
this.onLoad(this.page);
|
this.onLoad(this.page);
|
||||||
this.$message({
|
this.$message({
|
||||||
@@ -355,8 +355,40 @@ export default {
|
|||||||
importBenefitPackage() {
|
importBenefitPackage() {
|
||||||
this.excelBox = true;
|
this.excelBox = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
excelUploadAfter(res, done, loading, column) {
|
||||||
|
console.log('上结束:::');
|
||||||
|
window.console.log(column);
|
||||||
|
console.log('打印:::', res);
|
||||||
|
|
||||||
|
if (res.length) {
|
||||||
|
const errMsg = res
|
||||||
|
.map(
|
||||||
|
(item, idx) =>
|
||||||
|
`${idx + 1}. ${item.errorMsg} 账户: ${item.account} 福利包: ${item.benefitPackage}`
|
||||||
|
)
|
||||||
|
.join('<br><br>');
|
||||||
|
|
||||||
|
this.$alert(errMsg, '导入失败', {
|
||||||
|
confirmButtonText: '我知道了',
|
||||||
|
type: 'error',
|
||||||
|
dangerouslyUseHTMLString: true, //
|
||||||
|
customClass: 'alert-error-list', //
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
.alert-error-list .el-message-box__message {
|
||||||
|
max-height: 450px; /* 最大高度 */
|
||||||
|
overflow-y: auto; /* 超出时显示滚动条 */
|
||||||
|
padding: 12px 20px; /* 增加内边距,更美观 */
|
||||||
|
line-height: 1.6; /* 行高更舒适 */
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user