增加礼盒发放记录

This commit is contained in:
yziiy
2026-01-26 18:27:04 +08:00
parent d398e2b6b4
commit d777122b74
3 changed files with 170 additions and 1 deletions

View File

@@ -125,4 +125,12 @@ export const deteleGiftPackData = data => {
return http.request<Result>("post", "/adminapi/Activities/gift_bag_list_del", {
data
});
}
}
// 礼盒发放记录
export const queryBoxGiftSendList = params => {
return http.request<Result>(
"get",
"/adminapi/Activities/daily_tasks_box_gift_send_list",
{ params }
);
};

View File

@@ -0,0 +1,118 @@
import { ref } from "vue";
import { queryBoxGiftSendList } from "@/api/modules/activities";
export function useData() {
const loading = ref(true);
const tableList = ref([]);
const giftBagOptions = ref([]);
const searchForm = ref({
user_id: "",
gift_bag_id: "",
begin_time: "",
end_time: ""
});
const searchLabel = ref([
{
label: "用户ID",
prop: "user_id",
type: "input"
},
{
label: "礼盒类型",
prop: "gift_bag_id",
type: "select",
optionList: []
},
{ label: "开始时间", prop: "begin_time", type: "date" },
{ label: "结束时间", prop: "end_time", type: "date" }
]);
const pagination = ref({
total: 0,
pageSize: 10,
pageSizes: [10, 20, 50, 100, 500, 1000, 2000],
currentPage: 1,
background: true
});
const tableLabel = ref([
{
label: "ID",
prop: "id"
},
{
label: "用户ID-昵称",
prop: "user_name"
},
{
label: "礼物",
prop: "gift"
},
{
label: "礼物价格",
prop: "gift_price"
},
{
label: "礼盒类型",
prop: "gift_bag_type"
},
{
label: "发放时间",
prop: "createtime"
}
]);
// 获取礼盒类型列表
const fetchGiftBagList = async () => {
const options = [
{ label: "初级礼盒", value: 1 },
{ label: "高级礼盒", value: 2 }
];
searchLabel.value[1].optionList = options;
giftBagOptions.value = options;
onSearch(searchForm.value);
};
const onSearch = async formData => {
loading.value = true;
const params: any = {
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
user_id: formData?.user_id,
gift_bag_id: formData?.gift_bag_id,
begin_time: formData?.begin_time,
end_time: formData?.end_time
};
searchForm.value = { ...formData };
const { data, code } = await queryBoxGiftSendList(params);
if (code) {
tableList.value = data.lists || [];
pagination.value.total = data.count || 0;
pagination.value.currentPage = data.page || 1;
pagination.value.pageSize = data.page_limit || 10;
}
loading.value = false;
};
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
onSearch(searchForm.value);
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
return {
searchForm,
searchLabel,
onSearch,
tableList,
tableLabel,
pagination,
handleSizeChange,
handleCurrentChange,
loading,
fetchGiftBagList
};
}

View File

@@ -0,0 +1,43 @@
<script setup lang="ts">
import { onMounted } from "vue";
import { useData } from "./hook";
import SearchForm from "@/components/SearchForm/index.vue";
import { PureTableBar } from "@/components/RePureTableBar";
const {
searchLabel,
searchForm,
onSearch,
tableList,
pagination,
tableLabel,
handleSizeChange,
handleCurrentChange,
loading,
fetchGiftBagList
} = useData();
onMounted(() => {
fetchGiftBagList();
});
defineOptions({
name: "BoxGiftSendList"
});
</script>
<template>
<div class="main">
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
<PureTableBar title="礼盒发放记录" :columns="tableLabel" @refresh="onSearch(searchForm)">
<template v-slot="{ size, dynamicColumns }">
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" :size="size" adaptive
:adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" :columns="dynamicColumns"
:pagination="{ ...pagination, size }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange" />
</template>
</PureTableBar>
</div>
</template>