新增 礼包配置中心 / 礼包发放记录 / 礼包使用记录
This commit is contained in:
82
src/api/giftPackCenter/giftPackCenter.js
Normal file
82
src/api/giftPackCenter/giftPackCenter.js
Normal file
@@ -0,0 +1,82 @@
|
||||
import request from '@/utils/request';
|
||||
// 礼包配置中心
|
||||
// 礼包配置列表
|
||||
export const getConfigList = query => {
|
||||
return request({
|
||||
url: '/admin/packCenter/configList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 礼包配置保存更新
|
||||
export const configSave = query => {
|
||||
return request({
|
||||
url: '/admin/packCenter/configSave',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 奖品列表
|
||||
export const getItemList = query => {
|
||||
return request({
|
||||
url: '/admin/packCenter/itemList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 奖品列表 - 删除奖品
|
||||
export const deleteReward = query => {
|
||||
return request({
|
||||
url: '/admin/packCenter/itemDel',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 添加奖品
|
||||
export const addReward = query => {
|
||||
return request({
|
||||
url: '/admin/packCenter/itemAdd',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 奖励列表
|
||||
export const getAwardsList = query => {
|
||||
return request({
|
||||
url: '/admin/packCenter/awards',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 赠送礼包
|
||||
export const sendPackCenter = query => {
|
||||
return request({
|
||||
url: '/admin/userPack/send',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 奖励列表
|
||||
export const getRecordList = query => {
|
||||
return request({
|
||||
url: '/admin/userPack/recordList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 撤回礼包
|
||||
export const optionPackRecall = query => {
|
||||
return request({
|
||||
url: '/admin/userPack/packRecall',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
//礼包使用记录
|
||||
export const getUseRecordList = query => {
|
||||
return request({
|
||||
url: '/admin/userUsePack/recordList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
200
src/views/giftPackCenter/distributionRecord.vue
Normal file
200
src/views/giftPackCenter/distributionRecord.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="inquire">
|
||||
<span>用户ID:</span>
|
||||
<el-input v-model="formData.erbanNo" placeholder="" class="input" />
|
||||
</div>
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-table
|
||||
v-loading="tableData.loading"
|
||||
:data="tableData.data"
|
||||
ref="multipleTable"
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="packId" align="center" label="礼包ID" />
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-华语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "zh")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-英语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "en")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-阿语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "ar")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-土耳其区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "tr")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="erbanNo" align="center" label="用户ID" />
|
||||
<el-table-column prop="packNum" align="center" label="数量" />
|
||||
<el-table-column prop="remark" align="center" label="理由" />
|
||||
<el-table-column prop="createTime" align="center" label="发放时间">
|
||||
<template v-slot="scope">{{
|
||||
convertTimestamp(scope.row.createTime)
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="adminUser" align="center" label="操作人" />
|
||||
<el-table-column align="center" label="操作" width="220">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
@click="packRecall(scope.row.id)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
v-if="scope.row.status == 1"
|
||||
>
|
||||
撤回
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
style="margin-top: 10px"
|
||||
class="paginationClass"
|
||||
:current-page="formData.pageNo"
|
||||
:page-size="formData.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
layout="sizes, prev, pager, next"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, reactive, computed } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import {
|
||||
getRecordList,
|
||||
optionPackRecall,
|
||||
} from "@/api/giftPackCenter/giftPackCenter";
|
||||
export default {
|
||||
name: "distributionRecord",
|
||||
setup() {
|
||||
const formData = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
erbanNo: "",
|
||||
});
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
});
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getRecordList(formData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data.rows;
|
||||
tableData.total = res.data.total;
|
||||
tableData.loading = false;
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
// 撤回礼包
|
||||
const packRecall = (recordId) => {
|
||||
optionPackRecall({ recordId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success("撤回成功");
|
||||
getData();
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
const // 解析json字段
|
||||
getJsonField = (jsonStr, field) => {
|
||||
try {
|
||||
if (!jsonStr) return "";
|
||||
const obj = JSON.parse(jsonStr);
|
||||
return obj?.[field] || "";
|
||||
} catch (e) {
|
||||
console.error("JSON 解析失败:", jsonStr);
|
||||
return "";
|
||||
}
|
||||
};
|
||||
const convertTimestamp = (time) => {
|
||||
let date = new Date(time);
|
||||
return date.format("yyyy-MM-dd hh:mm:ss");
|
||||
};
|
||||
const handleSizeChange = (val) => {
|
||||
formData.pageSize = val;
|
||||
getData();
|
||||
};
|
||||
const handleCurrentChange = (val) => {
|
||||
formData.pageNo = val;
|
||||
getData();
|
||||
};
|
||||
return {
|
||||
formData,
|
||||
tableData,
|
||||
getData,
|
||||
getJsonField,
|
||||
convertTimestamp,
|
||||
packRecall,
|
||||
handleSizeChange,
|
||||
handleCurrentChange
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dialogTableVisibleBut {
|
||||
display: block;
|
||||
margin: 30px 0 0 830px;
|
||||
}
|
||||
|
||||
.paginationClass {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
.selectBox {
|
||||
display: flex;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
662
src/views/giftPackCenter/giftPackageConfiguration.vue
Normal file
662
src/views/giftPackCenter/giftPackageConfiguration.vue
Normal file
@@ -0,0 +1,662 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-button style="" type="primary" @click="addDialog = true;resetaddFormData()"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-table
|
||||
v-loading="tableData.loading"
|
||||
:data="tableData.data"
|
||||
ref="multipleTable"
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="packId" align="center" label="礼包ID" />
|
||||
<el-table-column prop="partitionDesc" align="center" label="分区" />
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-华语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "zh")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-英语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "en")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-阿语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "ar")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-土耳其区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "tr")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" align="center" label="礼包状态">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.status == 1 ? "有效" : "无效" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="imgUrl" align="center" label="礼包样式">
|
||||
<template v-slot="scope">
|
||||
<el-image
|
||||
style="width: 100px; height: 100px"
|
||||
:src="scope.row.imgUrl"
|
||||
:zoom-rate="1.1"
|
||||
:preview-src-list="[scope.row.imgUrl ?? '']"
|
||||
fit="scale-down"
|
||||
preview-teleported="true"
|
||||
hide-on-click-modal="true"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" align="center" label="创建时间">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.createTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="expireDay" align="center" label="礼包过期时间" />
|
||||
<el-table-column align="center" label="操作" width="220">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
@click="detailPageFun(scope.row)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
>
|
||||
编辑礼包
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="getRewardList(scope.row.packId)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
>
|
||||
奖品列表
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="getAwardsFun(scope.row.partitionId);addFormData.packId = scope.row.packId"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
style="margin-left: 0;margin-top: 10px;"
|
||||
>
|
||||
添加奖品
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="addFormData.packId = scope.row.packId;sendPackCenterDialog = true"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
style="margin-top: 10px;"
|
||||
>
|
||||
赠送礼包
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
style="margin-top: 10px"
|
||||
class="paginationClass"
|
||||
:current-page="formData.pageNo"
|
||||
:page-size="formData.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
layout="sizes, prev, pager, next"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
<el-dialog
|
||||
v-model="addDialog"
|
||||
:title="addFormData.packId == '' ? '新增' : '编辑'"
|
||||
width="28%"
|
||||
center
|
||||
>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>礼包名称-华语</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.packNameZh"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>礼包名称-英语</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.packNameEn"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>礼包名称-阿语</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.packNameAr"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>礼包名称-土耳其</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.packNameTr"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div class="selectBox selectBoxImg">
|
||||
<span
|
||||
class="left"
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
>礼包样式</span
|
||||
>
|
||||
<!-- action="/admin/tencent/cos/upload/file" -->
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
action="/admin/tencent/cos/upload/file"
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
:on-error="handleAvatarError"
|
||||
>
|
||||
<img
|
||||
v-if="addFormData.imgUrl"
|
||||
:src="addFormData.imgUrl"
|
||||
class="avatar"
|
||||
/>
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>状态</span
|
||||
>
|
||||
<el-select v-model="addFormData.status" placeholder="请选择">
|
||||
<el-option label="有效" :value="1"></el-option>
|
||||
<el-option label="无效" :value="0"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>分区</span
|
||||
>
|
||||
<partition-select v-model:partition-id="addFormData.partitionId" />
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>礼包过期时间</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.expireDay"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="addDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="addFun()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 详情表格 -->
|
||||
<el-dialog v-model="detailsDialog" title="奖品列表" width="50%" center>
|
||||
<!-- 内表格 -->
|
||||
<el-table
|
||||
v-loading="tableDetailData.loading"
|
||||
:data="tableDetailData.data"
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="awardTypeName" align="center" label="类型" >
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.awardTypeName + '-' + scope.row.awardName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="awardId" align="center" label="ID" />
|
||||
<el-table-column prop="awardNum" align="center" label="天数/数量" />
|
||||
<el-table-column prop="awardPic" align="center" label="样式">
|
||||
<template v-slot="scope">
|
||||
<el-image
|
||||
style="width: 100px; height: 100px"
|
||||
:src="scope.row.awardPic"
|
||||
:zoom-rate="1.1"
|
||||
:preview-src-list="[scope.row.awardPic ?? '']"
|
||||
fit="scale-down"
|
||||
preview-teleported="true"
|
||||
hide-on-click-modal="true"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="220">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
@click="delPageFun(scope.row.itemId)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="addRewardDialog"
|
||||
title="添加奖品"
|
||||
width="28%"
|
||||
center
|
||||
>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>添加奖品</span
|
||||
>
|
||||
<el-select v-model="addFormData.awardId"
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in awardsList"
|
||||
:key="item.awardId"
|
||||
:label="item.awardTypeName + '-' + item.awardName"
|
||||
:value="item.awardId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="addRewardDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="addRewardFun()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="sendPackCenterDialog"
|
||||
title="赠送礼包"
|
||||
width="28%"
|
||||
center
|
||||
>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>平台ID</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.erbanNo"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>礼包数量</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.packNum"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
></el-input>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px; width: 100px"
|
||||
class="col-sm-2 control-label"
|
||||
>赠送理由</span
|
||||
>
|
||||
<el-input
|
||||
v-model="addFormData.remark"
|
||||
style="width: 50%"
|
||||
class="input"
|
||||
:rows="5"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="sendPackCenterDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="sendPackCenterFun()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, reactive, computed } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import {
|
||||
getConfigList,
|
||||
configSave,
|
||||
getItemList,
|
||||
deleteReward,
|
||||
addReward,
|
||||
getAwardsList,
|
||||
sendPackCenter
|
||||
} from "@/api/giftPackCenter/giftPackCenter";
|
||||
import PartitionSelect from "@/views/common/partitionSelect.vue";
|
||||
export default {
|
||||
name: "giftPackageConfiguration",
|
||||
components: {
|
||||
PartitionSelect,
|
||||
},
|
||||
setup() {
|
||||
const formData = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const addFormData = reactive({
|
||||
expireDay: "",
|
||||
imgUrl: "",
|
||||
packId: "",
|
||||
status: "",
|
||||
partitionId: undefined,
|
||||
packNameZh: "",
|
||||
packNameEn: "",
|
||||
packNameAr: "",
|
||||
packNameTr: "",
|
||||
awardId:'',
|
||||
erbanNo:'',
|
||||
packNum:'',
|
||||
remark:'',
|
||||
});
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
});
|
||||
const tableDetailData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
});
|
||||
const awardsList = ref([]);
|
||||
const addRewardDialog = ref(false);
|
||||
const addDialog = ref(false);
|
||||
const detailsDialog = ref(false);
|
||||
const sendPackCenterDialog = ref(false);
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getConfigList(formData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data.rows;
|
||||
tableData.total = res.data.total;
|
||||
tableData.loading = false;
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
// 增加
|
||||
const addFun = () => {
|
||||
const obj = {
|
||||
expireDay: addFormData.expireDay,
|
||||
imgUrl: addFormData.imgUrl,
|
||||
status: addFormData.status,
|
||||
packName: JSON.stringify({
|
||||
zh: addFormData.packNameZh,
|
||||
en: addFormData.packNameEn,
|
||||
ar: addFormData.packNameAr,
|
||||
tr: addFormData.packNameTr,
|
||||
}),
|
||||
partitionId: addFormData.partitionId,
|
||||
};
|
||||
if (addFormData.packId) {
|
||||
obj.packId = addFormData.packId;
|
||||
}
|
||||
configSave(obj).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (addFormData.packId) {
|
||||
ElMessage.success("修改成功");
|
||||
} else {
|
||||
ElMessage.success("添加成功");
|
||||
}
|
||||
resetaddFormData();
|
||||
addDialog.value = false;
|
||||
getData();
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
addDialog.value = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
// 重置
|
||||
const resetaddFormData = () => {
|
||||
Object.assign(addFormData, {
|
||||
expireDay: "",
|
||||
imgUrl: "",
|
||||
packId: "",
|
||||
status: "",
|
||||
partitionId: undefined,
|
||||
packNameZh: "",
|
||||
packNameEn: "",
|
||||
packNameAr: "",
|
||||
packNameTr: "",
|
||||
awardId:''
|
||||
});
|
||||
};
|
||||
// 编辑
|
||||
const detailPageFun = (row) => {
|
||||
Object.assign(addFormData, row);
|
||||
if (row.packName) {
|
||||
addFormData.packNameZh = JSON.parse(row.packName).zh;
|
||||
addFormData.packNameEn = JSON.parse(row.packName).en;
|
||||
addFormData.packNameAr = JSON.parse(row.packName).ar;
|
||||
addFormData.packNameTr = JSON.parse(row.packName).tr;
|
||||
}
|
||||
addDialog.value = true;
|
||||
};
|
||||
// 奖品列表
|
||||
const getRewardList = (packId) => {
|
||||
tableDetailData.loading = true;
|
||||
getItemList({ packId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
tableDetailData.data = res.data;
|
||||
tableDetailData.total = res.data.total;
|
||||
tableDetailData.loading = false;
|
||||
detailsDialog.value = true;
|
||||
} else {
|
||||
tableDetailData.loading = false;
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
// 奖品列表 - 删除奖品
|
||||
const delPageFun = (itemId) => {
|
||||
deleteReward({ itemId }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage.success("删除成功");
|
||||
detailsDialog.value = false;
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
const getAwardsFun = (partitionId) => {
|
||||
getAwardsList({ partitionId}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
awardsList.value = res.data;
|
||||
addRewardDialog.value = true;
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
// 添加奖品
|
||||
const addRewardFun = () => {
|
||||
const {awardId,packId} = addFormData
|
||||
addReward({awardId,packId}).then((res=>{
|
||||
if(res.code == 200){
|
||||
ElMessage.success('添加成功');
|
||||
addRewardDialog.value = false;
|
||||
addFormData.awardId = '';
|
||||
addFormData.packId = '';
|
||||
}else{
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
}))
|
||||
};
|
||||
// 赠送礼包
|
||||
const sendPackCenterFun = () => {
|
||||
let obj = {
|
||||
erbanNo:addFormData.erbanNo,
|
||||
packId :addFormData.packId,
|
||||
packNum:addFormData.packNum,
|
||||
remark:addFormData.remark,
|
||||
}
|
||||
sendPackCenter(obj).then((res=>{
|
||||
if(res.code == 200){
|
||||
ElMessage.success('赠送成功');
|
||||
sendPackCenterDialog.value = false;
|
||||
resetaddFormData();
|
||||
}else{
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
}))
|
||||
};
|
||||
const // 解析json字段
|
||||
getJsonField = (jsonStr, field) => {
|
||||
try {
|
||||
if (!jsonStr) return "";
|
||||
const obj = JSON.parse(jsonStr);
|
||||
return obj?.[field] || "";
|
||||
} catch (e) {
|
||||
console.error("JSON 解析失败:", jsonStr);
|
||||
return "";
|
||||
}
|
||||
};
|
||||
const handleSizeChange = (val) => {
|
||||
formData.pageSize = val;
|
||||
getData();
|
||||
};
|
||||
const handleCurrentChange = (val) => {
|
||||
formData.pageNo = val;
|
||||
getData();
|
||||
};
|
||||
const beforeAvatarUpload = () => {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传中~",
|
||||
type: "warning",
|
||||
});
|
||||
};
|
||||
const handleAvatarError = () => {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传失败!",
|
||||
type: "error",
|
||||
});
|
||||
};
|
||||
const handleAvatarSuccess = (res, file) => {
|
||||
addFormData.imgUrl = file.response.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传成功!",
|
||||
type: "success",
|
||||
});
|
||||
};
|
||||
return {
|
||||
formData,
|
||||
tableData,
|
||||
getData,
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
getJsonField,
|
||||
addDialog,
|
||||
addFormData,
|
||||
addFun,
|
||||
beforeAvatarUpload,
|
||||
handleAvatarError,
|
||||
handleAvatarSuccess,
|
||||
detailPageFun,
|
||||
tableDetailData,
|
||||
detailsDialog,
|
||||
getRewardList,
|
||||
delPageFun,
|
||||
addRewardFun,
|
||||
addRewardDialog,
|
||||
getAwardsFun,
|
||||
awardsList,
|
||||
resetaddFormData,
|
||||
sendPackCenterDialog,
|
||||
sendPackCenterFun
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dialogTableVisibleBut {
|
||||
display: block;
|
||||
margin: 30px 0 0 830px;
|
||||
}
|
||||
|
||||
.paginationClass {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
.selectBox {
|
||||
display: flex;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
165
src/views/giftPackCenter/usageRecord.vue
Normal file
165
src/views/giftPackCenter/usageRecord.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="inquire">
|
||||
<span>用户ID:</span>
|
||||
<el-input v-model="formData.erbanNo" placeholder="" class="input" />
|
||||
</div>
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-table
|
||||
v-loading="tableData.loading"
|
||||
:data="tableData.data"
|
||||
ref="multipleTable"
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="packId" align="center" label="礼包ID" />
|
||||
<el-table-column prop="partitionDesc" align="center" label="分区" />
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-华语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "zh")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-英语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "en")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-阿语区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "ar")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packName" align="center" label="礼包名称-土耳其区">
|
||||
<template v-slot="scope">{{
|
||||
getJsonField(scope.row.packName, "tr")
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="erbanNo" align="center" label="用户ID" />
|
||||
<el-table-column prop="nick" align="center" label="用户昵称" />
|
||||
<el-table-column prop="targeErbanNo" align="center" label="赠送用户ID" />
|
||||
<el-table-column prop="targeNick" align="center" label="赠送用户昵称" />
|
||||
<el-table-column prop="packNum" align="center" label="赠送/使用数量" />
|
||||
<el-table-column prop="packNum" align="center" label="赠送/使用数量" />
|
||||
<el-table-column prop="createTime" align="center" label="使用时间">
|
||||
<template v-slot="scope">{{
|
||||
convertTimestamp(scope.row.createTime)
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
style="margin-top: 10px"
|
||||
class="paginationClass"
|
||||
:current-page="formData.pageNo"
|
||||
:page-size="formData.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
layout="sizes, prev, pager, next"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, reactive, computed } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { getUseRecordList } from "@/api/giftPackCenter/giftPackCenter";
|
||||
export default {
|
||||
name: "usageRecord",
|
||||
setup() {
|
||||
const formData = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
erbanNo: "",
|
||||
});
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
});
|
||||
const getData = () => {
|
||||
tableData.loading = true;
|
||||
getUseRecordList(formData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data.rows;
|
||||
tableData.total = res.data.total;
|
||||
tableData.loading = false;
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
const // 解析json字段
|
||||
getJsonField = (jsonStr, field) => {
|
||||
try {
|
||||
if (!jsonStr) return "";
|
||||
const obj = JSON.parse(jsonStr);
|
||||
return obj?.[field] || "";
|
||||
} catch (e) {
|
||||
console.error("JSON 解析失败:", jsonStr);
|
||||
return "";
|
||||
}
|
||||
};
|
||||
const convertTimestamp = (time) => {
|
||||
let date = new Date(time);
|
||||
return date.format("yyyy-MM-dd hh:mm:ss");
|
||||
};
|
||||
return {
|
||||
formData,
|
||||
tableData,
|
||||
getData,
|
||||
getJsonField,
|
||||
convertTimestamp
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dialogTableVisibleBut {
|
||||
display: block;
|
||||
margin: 30px 0 0 830px;
|
||||
}
|
||||
|
||||
.paginationClass {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
.selectBox {
|
||||
display: flex;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user