This commit is contained in:
yziiy
2026-01-14 15:04:01 +08:00
parent 555fe5c4d7
commit 4e1d7a60ae
11 changed files with 591 additions and 581 deletions

View File

@@ -1,8 +1,9 @@
import { ref, h } from "vue";
import editForm from "./form.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import recordList from "./record.vue";
import giftPackView from '../giftPack/index.vue';
import giftPackView from "../giftPack/index.vue";
import {
queryFirstCharge,
addChargeTypeData,
@@ -80,6 +81,8 @@ export function useData() {
onSearch();
};
const handleDelete = async rowData => {
// 删除需要二级密码验证
verifyPassword(async () => {
const { code } = await deteleChargeTypeData({ id: rowData.id });
if (code) {
message(`您删除了名称为${rowData.name}的这条数据`, {
@@ -87,6 +90,7 @@ export function useData() {
});
onSearch();
}
});
};
const DistributionRecord = () => {
addDialog({
@@ -94,10 +98,10 @@ export function useData() {
width: "60%",
closeOnClickModal: false,
hideFooter: true,
contentRenderer: () => h(recordList, { ref: formRef, formInline: null }),
contentRenderer: () => h(recordList, { ref: formRef, formInline: null })
});
};
// 新增
// 新增/编辑首充分类
const openDialog = (title = "新增", rowData: any) => {
addDialog({
title: `${title}首充分类`,
@@ -117,8 +121,14 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addChargeTypeData(form);
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 增加首充类型 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await addChargeTypeData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch();
@@ -126,10 +136,12 @@ export function useData() {
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
});
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editChargeTypeData({
...form,
...curData,
id: rowData.id
});
if (code) {
@@ -139,18 +151,7 @@ export function useData() {
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
@@ -166,9 +167,9 @@ export function useData() {
props: {
rowData
},
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }),
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null })
});
}
};
return {
onSearch,
isShow,

View File

@@ -1,6 +1,7 @@
import { ref, h, nextTick } from "vue";
import editForm from "./form.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import {
queryGiftPack,
addGiftPackData,
@@ -10,7 +11,7 @@ import {
import { addDialog } from "@/components/ReDialog";
export function useData() {
const formRef = ref();
const propRowData = ref(null)
const propRowData = ref(null);
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
@@ -66,8 +67,8 @@ export function useData() {
slot: "operation"
}
]);
const onSearch = async (rowData) => {
propRowData.value = { ...rowData }
const onSearch = async rowData => {
propRowData.value = { ...rowData };
loading.value = true;
const { data, code } = await queryGiftPack({
gift_bag_id: propRowData.value.id,
@@ -78,7 +79,7 @@ export function useData() {
tableList.value = data.lists.map(ele => {
return {
...ele
}
};
});
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
@@ -93,7 +94,7 @@ export function useData() {
pagination.value.currentPage = val;
onSearch(propRowData.value);
};
// 新增
// 新增/编辑礼物
const openDialog = (title = "新增", rowData: any) => {
addDialog({
title: `${title}礼物`,
@@ -102,8 +103,7 @@ export function useData() {
type: rowData?.type ?? "",
num: rowData?.num ?? "",
gift_id: rowData?.gift_id ?? "",
gift_bag_id: propRowData.value.id ?? "",
gift_bag_id: propRowData.value.id ?? ""
}
},
width: "40%",
@@ -112,8 +112,13 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addGiftPackData(form);
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 新增操作
const { code } = await addGiftPackData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch(propRowData.value);
@@ -121,10 +126,11 @@ export function useData() {
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editGiftPackData({
...form,
...curData,
id: rowData.id
});
if (code) {
@@ -134,24 +140,15 @@ export function useData() {
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
});
};
const handleDelete = async rowData => {
// 删除需要二级密码验证
verifyPassword(async () => {
const { code } = await deteleGiftPackData({ id: rowData.id });
if (code) {
message(`您删除了名称为${rowData.name}的这条数据`, {
@@ -159,6 +156,7 @@ export function useData() {
});
onSearch(propRowData.value);
}
});
};
return {
onSearch,

View File

@@ -1,6 +1,7 @@
import { ref, h, nextTick } from "vue";
import { ref, h } from "vue";
import editForm from "./form.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import {
queryGiftPack,
addGiftPackData,
@@ -10,7 +11,7 @@ import {
import { addDialog } from "@/components/ReDialog";
export function useData() {
const formRef = ref();
const propRowData = ref(null)
const propRowData = ref(null);
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
@@ -66,8 +67,8 @@ export function useData() {
slot: "operation"
}
]);
const onSearch = async (rowData) => {
propRowData.value = { ...rowData }
const onSearch = async rowData => {
propRowData.value = { ...rowData };
loading.value = true;
const { data, code } = await queryGiftPack({
gift_bag_id: propRowData.value.id,
@@ -78,7 +79,7 @@ export function useData() {
tableList.value = data.lists.map(ele => {
return {
...ele
}
};
});
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
@@ -93,7 +94,7 @@ export function useData() {
pagination.value.currentPage = val;
onSearch(propRowData.value);
};
// 新增
// 新增/编辑礼物
const openDialog = (title = "新增", rowData: any) => {
addDialog({
title: `${title}礼物`,
@@ -102,8 +103,7 @@ export function useData() {
type: rowData?.type ?? "",
num: rowData?.num ?? "",
gift_id: rowData?.gift_id ?? "",
gift_bag_id: propRowData.value.id,
gift_bag_id: propRowData.value.id
}
},
width: "40%",
@@ -112,8 +112,13 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addGiftPackData(form);
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 新增操作
const { code } = await addGiftPackData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch(propRowData.value);
@@ -121,10 +126,11 @@ export function useData() {
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editGiftPackData({
...form,
...curData,
id: rowData.id
});
if (code) {
@@ -134,24 +140,15 @@ export function useData() {
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
});
};
const handleDelete = async rowData => {
// 删除需要二级密码验证
verifyPassword(async () => {
const { code } = await deteleGiftPackData({ id: rowData.id });
if (code) {
message(`您删除了名称为${rowData.name}的这条数据`, {
@@ -159,6 +156,7 @@ export function useData() {
});
onSearch(propRowData.value);
}
});
};
return {
onSearch,

View File

@@ -1,12 +1,10 @@
import { ref, h, nextTick } from "vue";
import editForm from "./form.vue";
import { message } from "@/utils/message";
import recordList from "./record.vue"
import giftPackView from './giftPack/index.vue';
import {
getGoodGiftInfo,
setGoodGiftConfig
} from "@/api/modules/activities";
import { verifyPassword } from "@/utils/passwordVerify";
import recordList from "./record.vue";
import giftPackView from "./giftPack/index.vue";
import { getGoodGiftInfo, setGoodGiftConfig } from "@/api/modules/activities";
import { addDialog } from "@/components/ReDialog";
export function useData() {
const formRef = ref();
@@ -37,8 +35,10 @@ export function useData() {
label: "状态",
prop: "status",
cellRenderer: ({ row }) => (
<el-tag type={row.status === 1 ? 'success' : 'info'}>{row.status === 1 ? '正常' : '隐藏'}</el-tag>
),
<el-tag type={row.status === 1 ? "success" : "info"}>
{row.status === 1 ? "正常" : "隐藏"}
</el-tag>
)
},
{
label: "介绍内容",
@@ -58,6 +58,7 @@ export function useData() {
},
{
label: "操作",
width: 220,
fixed: "right",
slot: "operation"
}
@@ -84,9 +85,9 @@ export function useData() {
onSearch();
};
const setConfig = async () => {
let rowData = {}
const { data, code } = await getGoodGiftInfo({})
rowData = code ? data : null
let rowData = {};
const { data, code } = await getGoodGiftInfo({});
rowData = code ? data : null;
nextTick(() => {
addDialog({
title: `设置配置`,
@@ -99,7 +100,7 @@ export function useData() {
money: rowData?.money ?? "",
money_str: rowData?.money_str ?? "",
diamond: rowData?.diamond ?? "",
activity_end_time: rowData?.activity_end_time ?? "",
activity_end_time: rowData?.activity_end_time ?? ""
}
},
width: "40%",
@@ -108,26 +109,25 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await setGoodGiftConfig(form);
FormRef.validate(async valid => {
if (!valid) return;
// 设置配置需要二级密码验证
verifyPassword(async () => {
const { code } = await setGoodGiftConfig(curData);
if (code) {
message("新增成功", { type: "success" });
message("设置成功", { type: "success" });
onSearch();
done();
} else {
message("新增失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
// console.log("curData", curData);
saveData(curData);
message("设置失败", { type: "error" });
}
});
});
}
});
})
});
};
const DistributionRecord = () => {
addDialog({
@@ -135,10 +135,10 @@ export function useData() {
width: "60%",
closeOnClickModal: false,
hideFooter: true,
contentRenderer: () => h(recordList, { ref: formRef, formInline: null }),
contentRenderer: () => h(recordList, { ref: formRef, formInline: null })
});
};
const openGiftPark = (rowData) => {
const openGiftPark = rowData => {
addDialog({
title: `礼包列表`,
width: "60%",
@@ -147,9 +147,9 @@ export function useData() {
props: {
rowData
},
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }),
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null })
});
}
};
return {
onSearch,
isShow,

View File

@@ -1,8 +1,9 @@
import { ref, h } from "vue";
import editForm from "./form.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import recordList from "./record.vue";
import giftPackView from '../giftPack/index.vue';
import giftPackView from "../giftPack/index.vue";
import {
queryFirstCharge,
addChargeTypeData,
@@ -95,10 +96,10 @@ export function useData() {
width: "60%",
closeOnClickModal: false,
hideFooter: true,
contentRenderer: () => h(recordList, { ref: formRef, formInline: null }),
contentRenderer: () => h(recordList, { ref: formRef, formInline: null })
});
};
// 新增
// 新增/编辑新人礼包
const openDialog = (title = "新增", rowData: any) => {
addDialog({
title: `${title}首充分类`,
@@ -118,8 +119,16 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addChargeTypeData({ ...form, activities_id: 7 });
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 新增操作
const { code } = await addChargeTypeData({
...curData,
activities_id: 7
});
if (code) {
message("新增成功", { type: "success" });
onSearch();
@@ -127,10 +136,11 @@ export function useData() {
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editChargeTypeData({
...form,
...curData,
id: rowData.id,
activities_id: 7
});
@@ -141,18 +151,7 @@ export function useData() {
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
@@ -168,9 +167,9 @@ export function useData() {
props: {
rowData
},
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }),
contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null })
});
}
};
return {
onSearch,
isShow,

View File

@@ -1,6 +1,7 @@
import { ref, h } from "vue";
import editForm from "./form.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import {
queryDecList,
deleteDecData,
@@ -44,7 +45,7 @@ export function useData() {
preview-src-list={Array.of(row.decorate_image)}
class="w-[24px] h-[24px] rounded-full align-middle"
/>
),
)
},
{
label: "时长(天数)",
@@ -59,8 +60,7 @@ export function useData() {
]);
const onSearch = async () => {
loading.value = true;
const { data, code } = await queryDecList
({
const { data, code } = await queryDecList({
lid: detailData.value.lid,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize
@@ -81,6 +81,7 @@ export function useData() {
onSearch();
};
const handleDelete = async rowData => {
verifyPassword(async () => {
const { code } = await deleteDecData({ id: rowData.id });
if (code) {
message(`您删除了名称为${rowData.decorate_name}的这条数据`, {
@@ -88,6 +89,7 @@ export function useData() {
});
onSearch();
}
});
};
// 新增
const openDialog = (title = "新增", rowData: any) => {
@@ -105,23 +107,20 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code, msg } = await addDecData({
FormRef.validate(async valid => {
if (valid) {
verifyPassword(async () => {
const { code } = await addDecData({
lid: detailData.value.lid,
dpid: form.dpid
dpid: curData.dpid
});
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
saveData(curData);
});
}
});
}

View File

@@ -1,7 +1,8 @@
import { ref, h } from "vue";
import editForm from "./form.vue";
import attireList from './List/index.vue'
import attireList from "./List/index.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import {
queryList,
addNobilityData,
@@ -41,7 +42,7 @@ export function useData() {
preview-src-list={Array.of(row.image)}
class="w-[24px] h-[24px] rounded-full align-middle"
/>
),
)
},
{
label: "购买价格",
@@ -92,6 +93,7 @@ export function useData() {
onSearch();
};
const handleDelete = async rowData => {
verifyPassword(async () => {
const { code } = await deleteRobotData({ lid: rowData.lid });
if (code) {
message(`您删除了名称为${rowData.name}的这条数据`, {
@@ -99,6 +101,7 @@ export function useData() {
});
onSearch();
}
});
};
const openList = (title = "爵位装扮", rowData: any) => {
addDialog({
@@ -111,7 +114,7 @@ export function useData() {
closeOnClickModal: false,
contentRenderer: () => h(attireList)
});
}
};
// 新增
const openDialog = (title = "新增", rowData: any) => {
addDialog({
@@ -127,10 +130,10 @@ export function useData() {
renew_coin: rowData?.renew_coin ?? "",
day: rowData?.day ?? "",
nick_name_color: rowData?.nick_name_color ?? "",
power_ids: rowData?.power_ids ?? '',
nick_name_color_name: rowData?.nick_name_color_name ?? '',
play_image: rowData?.play_image ?? '',
enter_image: rowData?.enter_image ?? '',
power_ids: rowData?.power_ids ?? "",
nick_name_color_name: rowData?.nick_name_color_name ?? "",
play_image: rowData?.play_image ?? "",
enter_image: rowData?.enter_image ?? ""
}
},
width: "40%",
@@ -139,39 +142,30 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code, msg } = await addNobilityData(form);
FormRef.validate(async valid => {
if (valid) {
if (title === "新增") {
// 新增操作,不需要二级密码
const { code } = await addNobilityData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch();
done();
} else {
message(msg, { type: "error" });
}
};
const updateData = async form => {
const { code, msg } = await editNobilityData({
...form,
} else {
// 编辑操作,需要二级密码验证
verifyPassword(async () => {
const { code } = await editNobilityData({
...curData,
lid: rowData.lid
});
if (code) {
message("修改成功", { type: "success" });
onSearch();
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
});
}
}
});

View File

@@ -1,7 +1,5 @@
import { ref, h } from "vue";
import {
queryBoxTypeList
} from "@/api/modules/blindBox";
import { queryBoxTypeList } from "@/api/modules/blindBox";
import {
queryList,
addActivitiesBox,
@@ -11,9 +9,10 @@ import {
setConfig
} from "@/api/modules/activities";
import editForm from "./form.vue";
import settingRuleView from './settingRule.vue'
import settingRuleView from "./settingRule.vue";
import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
export function useData() {
const formRef = ref();
const loading = ref(true);
@@ -29,8 +28,8 @@ export function useData() {
const searchForm = ref({
user_id: ""
});
const activeName = ref(0)
const typeList = ref([])
const activeName = ref(0);
const typeList = ref([]);
const statisticsList = ref([
{ label: "抽奖人数总计", prop: "total_count" },
{ label: "抽奖价格总计", prop: "total_price" },
@@ -40,8 +39,8 @@ export function useData() {
// { label: "高级礼盒收入总计", prop: "" },
{ label: "今日抽奖价格", prop: "today_total_price" },
{ label: "今日抽奖次数", prop: "today_total_count" }
])
const statisticsData = ref({})
]);
const statisticsData = ref({});
const searchLabel = ref([
{ label: "用户ID", prop: "user_id", type: "input" }
]);
@@ -98,23 +97,23 @@ export function useData() {
slot: "operation"
}
]);
const onSearch = async (formData) => {
const onSearch = async formData => {
loading.value = true;
searchForm.value = { ...formData }
searchForm.value = { ...formData };
const { data, code } = await queryList({
...formData,
gift_bag_id: activeName.value,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
page_limit: pagination.value.pageSize
});
if (code) {
tableList.value = data.lists.map(ele => {
return {
...ele, ...data.total
}
...ele,
...data.total
};
});
statisticsData.value = data.total_data
statisticsData.value = data.total_data;
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
}
@@ -129,19 +128,21 @@ export function useData() {
onSearch(searchForm.value);
};
const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 2 })
typeList.value = code ? data.map(ele => {
const { code, data } = await queryBoxTypeList({ activities_id: 2 });
typeList.value = code
? data.map(ele => {
return {
label: ele.name,
value: ele.id
}
}) : []
if (code) handleClick(data[0].id)
}
const handleClick = (id) => {
activeName.value = id
};
})
: [];
if (code) handleClick(data[0].id);
};
const handleClick = id => {
activeName.value = id;
onSearch(searchForm.value);
}
};
//
const resetSetting = async () => {
// const { data, code } = await deletectivitiesBox({
@@ -153,9 +154,10 @@ export function useData() {
// });
// handleClick(activeName.value);
// }
}
};
const handleDelete = async rowData => {
// 删除需要二级密码验证
verifyPassword(async () => {
const { code } = await deletectivitiesBox({ id: rowData.id });
if (code) {
message(`您删除了这条数据`, {
@@ -163,6 +165,7 @@ export function useData() {
});
onSearch(searchForm.value);
}
});
};
const openDialog = async (title = "新增", rowData: any) => {
addDialog({
@@ -172,7 +175,7 @@ export function useData() {
type: rowData?.gift_type ?? "",
num: rowData?.quantity ?? "",
gift_id: rowData?.gift_id ?? "",
gift_bag_id: rowData?.gift_bag_id ?? "",
gift_bag_id: rowData?.gift_bag_id ?? ""
}
},
width: "40%",
@@ -181,10 +184,15 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 新增操作
const { code } = await addActivitiesBox({
...form,
gift_bag_id: activeName.value,
...curData,
gift_bag_id: activeName.value
});
if (code) {
message("新增成功", { type: "success" });
@@ -193,10 +201,11 @@ export function useData() {
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code, msg } = await editActivitiesBox({
...form,
...curData,
gift_bag_id: activeName.value,
id: rowData.id
});
@@ -207,25 +216,16 @@ export function useData() {
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
});
};
const setting = async () => {
const { data, code } = await getActivitiesBoxInfo({ gift_bag_id: activeName.value })
const { data, code } = await getActivitiesBoxInfo({
gift_bag_id: activeName.value
});
addDialog({
title: `设置礼盒规则`,
props: {
@@ -235,12 +235,19 @@ export function useData() {
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }),
contentRenderer: () =>
h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await setConfig({ ...form });
FormRef.validate(async valid => {
if (!valid) return;
// 设置规则需要二级密码验证
verifyPassword(async () => {
curData.gift_bag_id = activeName.value;
const { code } = await setConfig({ ...curData });
if (code) {
message("设置成功", { type: "success" });
onSearch(searchForm.value);
@@ -248,17 +255,11 @@ export function useData() {
} else {
message("设置失败", { type: "error" });
}
});
});
}
});
};
FormRef.validate(valid => {
if (valid) {
// console.log(curData)
curData.gift_bag_id = activeName.value
saveData(curData)
}
});
}
});
}
return {
searchForm,
searchLabel,

View File

@@ -9,9 +9,10 @@ import {
settingXunLeRule
} from "@/api/modules/blindBox";
import editForm from "./form.vue";
import settingRuleView from './settingRule.vue'
import settingRuleView from "./settingRule.vue";
import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
export function useData() {
const formRef = ref();
const loading = ref(true);
@@ -26,19 +27,20 @@ export function useData() {
});
const searchForm = ref({
gift_id: "",
gift_name: "",
gift_name: ""
});
const activeName = ref(13)
const typeList = ref([])
const activeName = ref(13);
const typeList = ref([]);
const statisticsList = ref([
{ label: "每期总次数", prop: "total_count" },
{ label: "每期总礼物价值(收入)", prop: "total_price" },
{
label: "每期总抽奖花费(支出)", prop: "total_cost"
label: "每期总抽奖花费(支出)",
prop: "total_cost"
},
{ label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" }
])
const statisticsData = ref({})
]);
const statisticsData = ref({});
const searchLabel = ref([
{ label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "礼物名称", prop: "gift_name", type: "input" }
@@ -85,21 +87,27 @@ export function useData() {
label: "公屏",
prop: "is_public_screen",
cellRenderer: ({ row }) => (
<el-tag type={row.is_public_screen === 1 ? 'success' : 'error'}>{row.is_public_screen === 1 ? '显示' : '隐藏'}</el-tag>
<el-tag type={row.is_public_screen === 1 ? "success" : "error"}>
{row.is_public_screen === 1 ? "显示" : "隐藏"}
</el-tag>
)
},
{
label: "全服显示",
prop: "is_public_server",
cellRenderer: ({ row }) => (
<el-tag type={row.is_public_server === 1 ? 'success' : 'error'}>{row.is_public_server === 1 ? '显示' : '隐藏'}</el-tag>
<el-tag type={row.is_public_server === 1 ? "success" : "error"}>
{row.is_public_server === 1 ? "显示" : "隐藏"}
</el-tag>
)
},
{
label: "榜单显示",
prop: "is_world_show",
cellRenderer: ({ row }) => (
<el-tag type={row.is_world_show === 1 ? 'success' : 'error'}>{row.is_world_show === 1 ? '显示' : '隐藏'}</el-tag>
<el-tag type={row.is_world_show === 1 ? "success" : "error"}>
{row.is_world_show === 1 ? "显示" : "隐藏"}
</el-tag>
)
},
{
@@ -113,23 +121,23 @@ export function useData() {
slot: "operation"
}
]);
const onSearch = async (formData) => {
const onSearch = async formData => {
loading.value = true;
searchForm.value = { ...formData }
searchForm.value = { ...formData };
const { data, code } = await queryBlindBoxList({
...formData,
gift_bag_id: activeName.value,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
page_limit: pagination.value.pageSize
});
if (code) {
tableList.value = data.lists.map(ele => {
return {
...ele, ...data.total
}
...ele,
...data.total
};
});
statisticsData.value = data.total_data
statisticsData.value = data.total_data;
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
}
@@ -144,18 +152,22 @@ export function useData() {
onSearch(searchForm.value);
};
const resetSetting = async () => {
const { data, code } = await resetBlindBoxRule({
// 重置数量需要二级密码验证
verifyPassword(async () => {
const { code } = await resetBlindBoxRule({
gift_bag_id: activeName.value
})
});
if (code) {
message(`重置成功`, {
type: "success"
});
onSearch(searchForm.value);
}
}
});
};
const handleDelete = async rowData => {
// 删除需要二级密码验证
verifyPassword(async () => {
const { code } = await removeBlindBoxData({ id: rowData.id });
if (code) {
message(`您删除了这条数据`, {
@@ -163,6 +175,7 @@ export function useData() {
});
onSearch(searchForm.value);
}
});
};
const openDialog = async (title = "新增", rowData: any) => {
addDialog({
@@ -172,7 +185,7 @@ export function useData() {
gift_id: rowData?.gift_id ?? "",
quantity: rowData?.quantity ?? 1,
weight: rowData?.weight ?? 1,
is_world_show: rowData?.is_world_show ?? 1,
is_world_show: rowData?.is_world_show ?? 1
}
},
width: "40%",
@@ -181,10 +194,16 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 添加操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await addBlindBoxData({
...form,
gift_bag_id: activeName.value,
...curData,
gift_bag_id: activeName.value
});
if (code) {
message("新增成功", { type: "success" });
@@ -193,10 +212,12 @@ export function useData() {
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
});
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code, msg } = await editBlindBoxData({
...form,
...curData,
gift_bag_id: activeName.value,
id: rowData.id
});
@@ -207,28 +228,17 @@ export function useData() {
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
});
};
const addGiftData = async () => {
}
const addGiftData = async () => {};
const setting = async () => {
const { data, code } = await getXunLeRule({ gift_bag_id: activeName.value })
const { data, code } = await getXunLeRule({
gift_bag_id: activeName.value
});
addDialog({
title: `设置巡乐会规则`,
props: {
@@ -239,7 +249,8 @@ export function useData() {
start_num: data.open_condition.start_num,
selected_gift_id: +data.locking_condition.selected_gift_id,
locking_gift_id: +data.locking_condition.locking_gift_id,
give_homeowner_gift_id: +data.locking_condition.give_homeowner_gift_id,
give_homeowner_gift_id:
+data.locking_condition.give_homeowner_gift_id,
end_time: data.locking_time.end_time,
tow_no_locking_time: data.locking_time.tow_no_locking_time,
next_time: data.locking_time.next_time,
@@ -248,12 +259,18 @@ export function useData() {
},
width: "60%",
closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }),
contentRenderer: () =>
h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await settingXunLeRule({ ...form });
FormRef.validate(async valid => {
if (!valid) return;
// 设置规则需要二级密码验证
verifyPassword(async () => {
const { code } = await settingXunLeRule({ ...curData });
if (code) {
message("设置成功", { type: "success" });
onSearch(searchForm.value);
@@ -261,16 +278,11 @@ export function useData() {
} else {
message("设置失败", { type: "error" });
}
});
});
}
});
};
FormRef.validate(valid => {
if (valid) {
// console.log("curData", curData);
saveData(curData)
}
});
}
});
}
return {
searchForm,
searchLabel,

View File

@@ -3,8 +3,9 @@ import editForm from "./form.vue";
import { ElMessageBox } from "element-plus";
import memberListView from "./memberList.vue";
import roomListView from "./roomList.vue";
import mergeFormView from './mergeForm.vue'
import mergeFormView from "./mergeForm.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
import {
queryUnionList,
addUnionData,
@@ -71,7 +72,7 @@ export function useData() {
preview-src-list={Array.of(row.guild_logo)}
class="w-[24px] h-[24px] align-middle"
/>
),
)
},
{
label: "今日流水",
@@ -85,15 +86,17 @@ export function useData() {
label: "公会状态",
prop: "status_str",
cellRenderer: ({ row }) => (
<el-tag type={row.status_str === '正常' ? 'success' : 'error'}>{row.status_str}</el-tag>
),
<el-tag type={row.status_str === "正常" ? "success" : "error"}>
{row.status_str}
</el-tag>
)
},
{
label: "显示状态",
prop: "is_show",
cellRenderer: ({ row }) => (
<div>{row.status_str === '正常' ? row.is_show_str : '-'}</div>
),
<div>{row.status_str === "正常" ? row.is_show_str : "-"}</div>
)
},
{
label: "创建时间",
@@ -106,9 +109,9 @@ export function useData() {
slot: "operation"
}
]);
const onSearch = async (formData) => {
const onSearch = async formData => {
loading.value = true;
searchForm.value = { ...formData }
searchForm.value = { ...formData };
const { data, code } = await queryUnionList({
...formData,
page: pagination.value.currentPage,
@@ -130,7 +133,10 @@ export function useData() {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
// 解散工会
const handleDelete = async rowData => {
// 解散需要二级密码验证
verifyPassword(async () => {
const { code } = await dissolveUnionData({ id: rowData.id });
if (code === "0") {
message(`您删除了公会名称为【${rowData.guild_name}】的这条数据`, {
@@ -138,8 +144,9 @@ export function useData() {
});
onSearch(searchForm.value);
}
});
};
// 新增
// 新增/编辑工会
const openDialog = (title = "新增", rowData: any) => {
addDialog({
title: `${title}工会`,
@@ -161,8 +168,13 @@ export function useData() {
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code, msg } = await addUnionData(form);
FormRef.validate(async valid => {
if (!valid) return;
if (title === "新增") {
// 新增操作
const { code, msg } = await addUnionData(curData);
if (code) {
message("新增成功", { type: "success" });
onSearch(searchForm.value);
@@ -170,10 +182,11 @@ export function useData() {
} else {
message(msg, { type: "error" });
}
};
const updateData = async form => {
} else {
// 编辑操作 - 需要二级密码验证
verifyPassword(async () => {
const { code } = await editUnionData({
...form,
...curData,
id: rowData.id
});
if (code) {
@@ -183,24 +196,14 @@ export function useData() {
} else {
message("修改失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
});
}
});
}
});
};
// 查看成员 roomListView memberListView
const viewMember = (rowData) => {
const viewMember = rowData => {
addDialog({
title: `查看成员列表`,
props: {
@@ -209,13 +212,13 @@ export function useData() {
width: "60%",
closeOnClickModal: false,
contentRenderer: () => h(memberListView),
beforeSure: (done) => {
done()
beforeSure: done => {
done();
}
});
}
};
// 查看房间列表
const viewRoomList = (rowData) => {
const viewRoomList = rowData => {
addDialog({
title: `查看房间列表`,
props: {
@@ -224,11 +227,11 @@ export function useData() {
width: "60%",
closeOnClickModal: false,
contentRenderer: () => h(roomListView),
beforeSure: (done) => {
done()
beforeSure: done => {
done();
}
});
}
};
// 合并公会
const mergeData = async () => {
addDialog({
@@ -236,50 +239,54 @@ export function useData() {
props: {
formInline: {
guild_id: "",
merge_guild_id: "",
merge_guild_id: ""
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(mergeFormView, { ref: formRef, formInline: null }),
contentRenderer: () =>
h(mergeFormView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
FormRef.validate(valid => {
if (valid) {
ElMessageBox.confirm(
`此操作不可更改,是否继续?`,
"提示",
{
FormRef.validate(async valid => {
if (!valid) return;
// 合并公会需要二级密码验证
verifyPassword(async () => {
ElMessageBox.confirm(`此操作不可更改,是否继续?`, "提示", {
type: "warning"
}
)
})
.then(async () => {
const { code, msg } = await guildUnionData(curData)
const { code, msg } = await guildUnionData(curData);
if (code) {
message("操作成功", { type: "success" });
onSearch(searchForm.value);
done()
done();
} else {
message(msg, { type: "error" });
}
})
.catch(() => { });
}
.catch(() => {});
});
});
}
});
}
// 更改工会状态 隐藏 显示
const changeShowStatus = async (rowData) => {
const { data, code, msg } = await changeStatus({ id: rowData.id })
};
// 更改工会状态 隐藏/显示
const changeShowStatus = async rowData => {
// 更改状态需要二级密码验证
verifyPassword(async () => {
const { code, msg } = await changeStatus({ id: rowData.id });
if (code) {
message("操作成功", { type: "success" });
onSearch(searchForm.value);
} else {
message(msg, { type: "error" });
}
}
});
};
return {
searchForm,
searchLabel,

View File

@@ -2,13 +2,11 @@
import SearchForm from "@/components/SearchForm/index.vue";
import { ref, onMounted } from "vue";
import { message } from "@/utils/message";
import {
queryUnionMemberList,
kickUnionMember
} from "@/api/modules/union";
import { verifyPassword } from "@/utils/passwordVerify";
import { queryUnionMemberList, kickUnionMember } from "@/api/modules/union";
const props = defineProps(["rowData"]);
const loading = ref(false)
const tableList = ref([])
const loading = ref(false);
const tableList = ref([]);
const searchForm = ref({
user_id: "",
search_stime: "",
@@ -56,9 +54,14 @@ const dynamicColumns = ref([
width: 300,
slot: "operation"
}
])
const kickMember = async (rowData) => {
const { code, msg } = await kickUnionMember({ user_id: rowData.user_id, guild_id: props.rowData.id });
]);
const kickMember = async rowData => {
// 踢出成员需要二级密码验证
verifyPassword(async () => {
const { code, msg } = await kickUnionMember({
user_id: rowData.user_id,
guild_id: props.rowData.id
});
if (code) {
message(`您已踢出昵称为【${rowData.nickname}】的用户`, {
type: "success"
@@ -69,7 +72,8 @@ const kickMember = async (rowData) => {
type: "error"
});
}
}
});
};
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
onSearch(searchForm.value);
@@ -78,9 +82,9 @@ const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
const onSearch = async (formData) => {
const onSearch = async formData => {
loading.value = true;
searchForm.value = { ...formData }
searchForm.value = { ...formData };
const { data, code } = await queryUnionMemberList({
...formData,
guild_id: props.rowData.id,
@@ -93,10 +97,10 @@ const onSearch = async (formData) => {
pagination.value.currentPage = data.page;
}
loading.value = false;
}
};
onMounted(() => {
onSearch(searchForm.value)
})
onSearch(searchForm.value);
});
</script>
<template>
@@ -112,12 +116,9 @@ onMounted(() => {
<!-- v-if="row.status_str === '正常'" -->
<el-popconfirm :title="`是否确认踢出名称为【${row.nickname}】的用户`" @confirm="kickMember(row)">
<template #reference>
<el-button link type="primary">
踢出成员
</el-button>
<el-button link type="primary"> 踢出成员 </el-button>
</template>
</el-popconfirm>
</template>
</pure-table>
</div>