diff --git a/src/api/modules/activities.ts b/src/api/modules/activities.ts index 3635e02..517726b 100644 --- a/src/api/modules/activities.ts +++ b/src/api/modules/activities.ts @@ -125,4 +125,12 @@ export const deteleGiftPackData = data => { return http.request("post", "/adminapi/Activities/gift_bag_list_del", { data }); -} \ No newline at end of file +} +// 礼盒发放记录 +export const queryBoxGiftSendList = params => { + return http.request( + "get", + "/adminapi/Activities/daily_tasks_box_gift_send_list", + { params } + ); +}; diff --git a/src/views/dailyTasksBox/sendList/hook.tsx b/src/views/dailyTasksBox/sendList/hook.tsx new file mode 100644 index 0000000..27a92a4 --- /dev/null +++ b/src/views/dailyTasksBox/sendList/hook.tsx @@ -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 + }; +} diff --git a/src/views/dailyTasksBox/sendList/index.vue b/src/views/dailyTasksBox/sendList/index.vue new file mode 100644 index 0000000..5493b33 --- /dev/null +++ b/src/views/dailyTasksBox/sendList/index.vue @@ -0,0 +1,43 @@ + + +