diff --git a/src/pages/plan/defineButton/index.jsx b/src/pages/plan/defineButton/index.jsx index 3e6926db..02e2b46d 100644 --- a/src/pages/plan/defineButton/index.jsx +++ b/src/pages/plan/defineButton/index.jsx @@ -1,4 +1,4 @@ -import { getDefineButtons, handelResponse, postClientPrompt } from "@/assets/api.js" +import { getDefineButtons, handelResponse, updateDefineButtons } from "@/assets/api.js" import Grid from "@/components/gird/main.js" import Ipt from "@/components/input/main" import TabPage from "@/components/tabPage/main.js" @@ -13,9 +13,9 @@ export default function DefineButton() { const Column = [ { title: "范围", - prop: "type", - name: "type", - type: "slot", + prop: "text", + name: "text", + type: "normal", width: "400px" }, { @@ -27,8 +27,8 @@ export default function DefineButton() { }, { title: "更新文案", - prop: "updateCustomize", - name: "updateCustomize", + prop: "custom", + name: "custom", type: "slot", width: "auto" } @@ -36,7 +36,6 @@ export default function DefineButton() { const [state, setState] = useSetState({ tableData: [], - backupTableData: [], tabs: [{ title: "文案列表" }], planId: sessionStorage.getItem("plan_id") }) @@ -47,8 +46,7 @@ export default function DefineButton() { res, (req, msg) => { setState({ - tableData: cloneDeep(req), - backupTableData: cloneDeep(req) + tableData: cloneDeep(req) }) }, (error) => { @@ -58,39 +56,9 @@ export default function DefineButton() { }) }, []) - /* 区分类型 */ - function typeFn(va) { - switch (va) { - case 0: - return "通用" - case 1: - return "兑换码" - case 2: - return "立减金" - case 3: - return "红包" - default: - break - } - } - /* 提交 */ function submit() { - const submitData = [] - state.tableData.map((item) => { - state.backupTableData.map((items) => { - if (item.message_index === items.message_index && item.customize !== items.customize) { - const { message_index, uuid, customize } = item - submitData.push({ - message_index, - uuid, - customize - }) - } - }) - }) - - postClientPrompt(submitData, state.planId).then((res) => { + updateDefineButtons(state.planId, { button_conf: state.tableData }).then((res) => { handelResponse( res, (req, msg) => { @@ -117,25 +85,22 @@ export default function DefineButton() { Column={Column} maxheight={670} ComponentHandler={(com, rowData) => { - if (com === "type") { - return
{typeFn(rowData.type)}
- } - if (com === "updateCustomize") { + if (com === "custom") { return (- {item.name}: {item.index} -
- )) - : "-"} -