shenwu 6 kuukautta sitten
vanhempi
commit
d42a08b62e

+ 1 - 1
src/components/DraggableButton.tsx

@@ -3,7 +3,7 @@ import React, { useState, useImperativeHandle, forwardRef } from "react";
 // DraggableButton 组件
 const DraggableButton = forwardRef<HTMLDivElement, { children: React.ReactNode }>(({ children }, ref) => {
     let homePos = localStorage.getItem("homePos");
-    let initPos = homePos ? JSON.parse(homePos) : { right: 25, top: 100 };
+    let initPos = homePos ? JSON.parse(homePos) : { right: 200, top: 0 };
     const [position, setPosition] = useState(initPos);
     const [offset, setOffset] = useState({ x: 0, y: 0 });
 

+ 15 - 0
src/models/global.tsx

@@ -82,6 +82,21 @@ export default (): { state: State, init: () => void, getEnum: (enumName: string,
                 { value: 5, description: "已资质认证通过、还未通过名称认证,但通过了腾讯微博认证" },
             ]
         }
+        //VIP回传策略
+        enumList["VIP_CALLBACK"] = {
+            values: [
+                { value: 1, description: "不回传" },
+                { value: 2, description: "全部回传" },
+                { value: 3, description: "走书币的回传策略" },
+            ]
+        }
+        //回传类型
+        enumList["CALLBACK_TYPE"] = {
+            values: [
+                { value: 1, description: "首单/次单" },
+                { value: 2, description: "首日/次日" },
+            ]
+        }
         dispatch({ type: "setAll", params: { enumList, authList } })
         isLoding = false
     }

+ 11 - 0
src/pages/MiniApp/AdBack/configModal.tsx

@@ -0,0 +1,11 @@
+import { Button } from "antd"
+import { useState } from "react"
+
+function ConfigModal() {
+    let [open, setOpen] = useState<boolean>(false)
+    return <div>
+        <Button type="primary">编辑</Button>
+        
+    </div>
+}
+export default ConfigModal

+ 341 - 0
src/pages/MiniApp/AdBack/formConfig.tsx

@@ -0,0 +1,341 @@
+import { ProFormColumnsType } from "@ant-design/pro-components";
+import { useModel } from "@umijs/max";
+
+function formConfig(): ProFormColumnsType<{
+}>[] {
+    let { getEnum } = useModel("global")
+    return [
+        {
+            valueType: 'digit',
+            dataIndex: "regPayIntervalTime",
+            title: "注册充值回传的最大间隔时间",
+            tooltip: "(超时不回传)",
+            formItemProps: {
+                style: { marginBottom: 10 },
+                rules: [
+                    {
+                        required: true,
+                        message: '此项为必填项',
+                    },
+                ],
+            },
+            fieldProps: {
+                placeholder: '请输入数字',
+                style: { width: "70%" },
+                addonAfter: "分钟"
+            },
+        },
+        {
+            valueType: 'radioButton',
+            dataIndex: "vipOrderBackType",
+            title: "VIP回传策略",
+            initialValue: 1,
+            formItemProps: {
+                style: { marginBottom: 10 },
+                rules: [
+                    {
+                        required: true,
+                        message: '此项为必填项',
+                    },
+                ],
+            },
+            valueEnum: getEnum("VIP_CALLBACK", "map")
+        },
+        {
+            valueType: 'radioButton',
+            dataIndex: "backUnit",
+            title: "回传类型",
+            initialValue: 1,
+            formItemProps: {
+                style: { marginBottom: 10 },
+                rules: [
+                    {
+                        required: true,
+                        message: '此项为必填项',
+                    },
+                ],
+            },
+            valueEnum: getEnum("CALLBACK_TYPE", "map")
+        },
+        {
+            valueType: 'dependency',
+            name: ["backUnit"],
+            columns({ backUnit }) {
+                console.log("backUnit", backUnit)
+                return [
+                    {
+                        valueType: 'divider',
+                        fieldProps: {
+                            children: backUnit === 1 ? "首单" : "首日",
+                            orientation: "left"
+                        }
+                    },
+                    {
+                        dataIndex: 'firstBackRate',
+                        valueType: 'formList',
+                        fieldProps: {
+                            creatorButtonProps: {
+                                creatorButtonText: "添加一个档位配置",
+                            },
+                        },
+                        colProps: {
+                            span: 24
+                        },
+                        columns: [
+                            {
+                                valueType: 'group',
+                                colProps: {
+                                    span: 24
+                                },
+                                columns: [
+                                    {
+                                        dataIndex: 'minAmount',
+                                        valueType: 'digit',
+                                        title: "最小金额",
+                                        tooltip: "最小金额(大于等于)",
+                                        fieldProps: {
+                                            placeholder: "最小金额",
+                                            style: { width: "100%" },
+                                        },
+                                        colProps: { span: 5 },
+                                        formItemProps: {
+                                            style: { marginBottom: 10 },
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        },
+                                    },
+                                    {
+                                        dataIndex: 'maxAmount',
+                                        valueType: 'digit',
+                                        title: "最大金额",
+                                        tooltip: "最大金额(小于)",
+                                        colProps: { span: 5 },
+                                        fieldProps: {
+                                            placeholder: "最大金额",
+                                            style: { width: "100%" },
+                                        },
+                                        formItemProps: {
+                                            style: { marginBottom: 10 },
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        },
+                                    },
+                                    {
+                                        dataIndex: 'type',
+                                        valueType: 'radioButton',
+                                        title: "回传方式",
+                                        colProps: { span: 7 },
+                                        initialValue: "2",
+                                        formItemProps: {
+                                            style: { marginBottom: 10 },
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        },
+                                        valueEnum: {1:{text:"比例"},2:{text:"概率"}},
+                                    },
+                                    {
+                                        valueType:"dependency",
+                                        name:["type"],
+                                        columns(values) {
+                                            console.log(values)
+                                            let {type} = values
+                                            return []
+                                        },
+                                    }
+                                ]
+                            }
+                        ]
+                    },
+                ]
+            },
+        },
+
+
+        // {
+        //     title: '付费方式',
+        //     dataIndex: 'paymentType',
+        //     valueType: 'radio',
+        //     fieldProps: {
+        //         onChange: (e) => {
+        //             let value = e.target.value
+        //             paymentType[1](value)
+        //         }
+        //     },
+        //     formItemProps: {
+        //         style: { marginBottom: 10 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        //     valueEnum: () => {
+        //         let arr = enumList?.PAYMENT_TYPE?.values
+        //         return new Map(arr?.map(({ value, description }: any) => [value, description]))
+        //     }
+        // },
+        // {
+        //     title: '收费类型',
+        //     dataIndex: 'paymentOption',
+        //     valueType: 'radio',
+        //     formItemProps: {
+        //         style: { marginBottom: 10 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        //     hideInForm: paymentType[0] != 2,
+        //     valueEnum: () => {
+        //         let arr = enumList?.PAYMENT_OPTION?.values
+        //         return new Map(arr?.map(({ value, description }: any) => [value, description]))
+        //     }
+        // },
+        // {
+        //     title: '收费货币',
+        //     dataIndex: 'paymentCategory',
+        //     valueType: 'radio',
+        //     fieldProps: {
+        //         onChange: (e) => {
+        //             let value = e.target.value
+        //             paymentCategory[1](value)
+        //         },
+        //     },
+        //     formItemProps: {
+        //         style: { marginBottom: 10 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        //     hideInForm: paymentType[0] == 0,
+        //     valueEnum: () => {
+        //         let arr = [{ value: 0, description: "现金" }, { value: 1, description: "书币" }]
+        //         return new Map(arr?.map(({ value, description }: any) => [value, description]))
+        //     }
+        // },
+        // {//单本
+        //     title: '付费起始段落',
+        //     dataIndex: 'beginPayParagraphNo',
+        //     valueType: 'select',
+        //     fieldProps: {
+        //         showSearch: true, placeholder: '请选择开始收费段落'
+        //     },
+        //     formItemProps: {
+        //         style: { marginBottom: 15 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        //     hideInForm: paymentType[0] === 0 || isGlobalConfig,//单本书
+        //     valueEnum: () => {
+        //         return new Map(paragraphList?.map(item => [item.paragraphNo, item.content]))
+        //     }
+        // },
+        // {//全局
+        //     title: '付费起始段落',
+        //     dataIndex: 'beginPayNo',
+        //     valueType: 'digit',
+        //     fieldProps: {
+        //         placeholder: '请输入收费段落'
+        //     },
+        //     width: 200,
+        //     formItemProps: {
+        //         style: { marginBottom: 15 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        //     hideInForm: paymentType[0] != 2 || !isGlobalConfig,//单本书
+        // },
+        // {
+        //     title: 'VIP阅读',
+        //     dataIndex: 'vipFree',
+        //     valueType: 'segmented',
+        //     formItemProps: {
+        //         style: { marginBottom: 15 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        //     hideInForm: paymentType[0] == 0 || isGlobalConfig,
+        //     valueEnum: () => {
+        //         let arr = enumList?.VIP_FREE?.values
+        //         return new Map(arr?.map(({ value, description }: any) => [value, description]))
+        //     }
+        // },
+        // {
+        //     title: '收费金额',
+        //     dataIndex: 'paymentAmount',
+        //     valueType: 'money',
+        //     hideInForm: paymentType[0] === 0 || paymentCategory[0] == 1,
+        //     fieldProps: {
+        //         addonAfter: "元",
+        //     },
+        //     formItemProps: {
+        //         style: { marginBottom: 15 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        // },
+        // {
+        //     title: '收费书币',
+        //     dataIndex: 'paymentCoin',
+        //     valueType: 'digit',
+        //     hideInForm: paymentType[0] === 0 || paymentCategory[0] == 0,
+        //     fieldProps: {
+        //         addonAfter: "书币"
+        //     },
+        //     formItemProps: {
+        //         style: { marginBottom: 15 },
+        //         rules: [
+        //             {
+        //                 required: true,
+        //                 message: '此项为必填项',
+        //             },
+        //         ],
+        //     },
+        // },
+        // {
+        //     title: '备注',
+        //     dataIndex: 'remark',
+        //     valueType: 'textarea',
+        //     hideInForm: isGlobalConfig,
+        //     formItemProps: {
+        //         style: { marginBottom: 15 },
+        //     },
+        // }
+    ]
+}
+
+export default formConfig

+ 25 - 2
src/pages/MiniApp/AdBack/index.tsx

@@ -1,9 +1,10 @@
 import { useAjax } from "@/Hook/useAjax"
 import { getAppAccountConfig, tencentAdAccountDoAuth, tencentAdAccountToAuth } from "@/services/miniApp/adBack"
-import { PageContainer, ProCard, ProForm, ProFormRadio, ProFormSelect, ProFormText } from "@ant-design/pro-components"
+import { BetaSchemaForm, PageContainer, ProCard, ProForm, ProFormRadio, ProFormSelect, ProFormText } from "@ant-design/pro-components"
 import { history, useModel } from "@umijs/max"
 import { Button, Divider, Space } from "antd"
 import { useEffect, useRef, useState } from "react"
+import formConfig from "./formConfig"
 
 function Auth() {
     let { getEnum } = useModel('global')
@@ -36,6 +37,10 @@ function Auth() {
             }
         })
     }
+    // submit
+    const submit = async (values: any) => {
+        console.log("values",values)
+    }
     return <PageContainer
         tabList={getEnum("ADVERTISING_CHANNEL", "arr")?.map((item: { label: any; key: any }, index: number) => {
             if (index === 0 && !key) {
@@ -88,7 +93,7 @@ function Auth() {
                 </Space>}
             >
                 <ProForm
-                    readonly={!isEdit}
+                    readonly={true}
                     formRef={formRef}
                     submitter={false}
                     colProps={{ span: 2 }}
@@ -103,6 +108,24 @@ function Auth() {
                 </ProForm>
             </ProCard>
         </ProCard>
+        {/* 回传配置 */}
+        <BetaSchemaForm<any>
+            title={"回传策略配置"}
+            formRef={formRef}
+            open={isEdit}
+            onOpenChange={(b) => { !b && setIsEdit(b) }}
+            layoutType={"ModalForm"}
+            labelCol={{ span: 24 }}
+            colProps={{ span: 12 }}
+            grid={true}
+            layout="vertical"
+            onFinish={submit}
+            columns={formConfig()}
+            modalProps={{
+                destroyOnClose:true
+            }}
+        // loading={add?.loading || globaleAddOrEdit?.loading}
+        />
     </PageContainer>
 }