shenwu 7 hónapja
szülő
commit
2a6d27556d

+ 1 - 1
config/config.ts

@@ -1,6 +1,6 @@
 // https://umijs.org/config/
 import { defineConfig } from '@umijs/max';
-import { join } from 'path';
+import { join,resolve } from 'path';
 import defaultSettings from './defaultSettings';
 import proxy from './proxy';
 import routes from './routes';

+ 2 - 1
jsconfig.json

@@ -5,7 +5,8 @@
     "experimentalDecorators": true,
     "baseUrl": ".",
     "paths": {
-      "@/*": ["./src/*"]
+      "@/*": ["./src/*"],
+      "@p/*": ["./public/*"],
     }
   }
 }

+ 19 - 11
src/pages/MiniApp/ModuleConfig/formConfig.tsx → src/pages/MiniApp/ModuleConfig/coin/formConfig.tsx

@@ -1,14 +1,12 @@
 import { convertEnumArr } from "@/utils";
 import { ProFormColumnsType } from "@ant-design/pro-components";
+import { useModel } from "@umijs/max";
 
-function formConfig(enumList?: any): ProFormColumnsType<{
+function formConfig(): ProFormColumnsType<{
     name: string;
     state: string;
 }>[] {
-    let templateTypeEnum = enumList?.TEMPLATE_TYPE?.values || []
-    let ORDER_TYPEEnum = enumList?.ORDER_TYPE?.values || []
-    let COLOREnum = enumList?.COLOR?.values || []
-    let VIP_DAYSEnum = enumList?.VIP_DAYS?.values || []
+    let { getEnum } = useModel("global")
     return [
         {
             title: '模板名称',
@@ -67,6 +65,7 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                 span: 4
                             },
                             formItemProps: {
+                                initialValue:1,
                                 rules: [
                                     {
                                         required: true,
@@ -74,7 +73,11 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                     },
                                 ],
                             },
-                            valueEnum: new Map(ORDER_TYPEEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
+                            valueEnum: () => {
+                                let map = getEnum("GEAR_TYPE", "map")
+                                map.delete(2)
+                                return map
+                            }
                         },
                         {
                             valueType: 'dependency',
@@ -137,7 +140,7 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                                 },
                                             ],
                                         },
-                                        valueEnum: new Map(VIP_DAYSEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
+                                        valueEnum: getEnum("VIP_DAYS", "map")
                                     },
                                     {
                                         title: '价格',
@@ -184,7 +187,7 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                         colProps: {
                                             span: 4
                                         },
-                                        valueEnum: new Map(COLOREnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
+                                        valueEnum: getEnum("COLOR", "map")
                                     }
                                 ]
                             }
@@ -226,6 +229,7 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                 span: 4
                             },
                             formItemProps: {
+                                initialValue:1,
                                 rules: [
                                     {
                                         required: true,
@@ -233,7 +237,11 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                     },
                                 ],
                             },
-                            valueEnum: new Map(ORDER_TYPEEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
+                            valueEnum: () => {
+                                let map = getEnum("GEAR_TYPE", "map")
+                                map.delete(2)
+                                return map
+                            }
                         },
                         {
                             valueType: 'dependency',
@@ -296,7 +304,7 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                                 },
                                             ],
                                         },
-                                        valueEnum: new Map(VIP_DAYSEnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
+                                        valueEnum: getEnum("VIP_DAYS", "map")
                                     },
                                     {
                                         title: '价格',
@@ -343,7 +351,7 @@ function formConfig(enumList?: any): ProFormColumnsType<{
                                         colProps: {
                                             span: 4
                                         },
-                                        valueEnum: new Map(COLOREnum?.map((item: { value: any; description: any; }) => [item.value, item.description]))
+                                        valueEnum: getEnum("COLOR", "map")
                                     }
                                 ]
                             }

+ 215 - 0
src/pages/MiniApp/ModuleConfig/coin/index.tsx

@@ -0,0 +1,215 @@
+import { BetaSchemaForm, PageContainer, ProFormInstance, useToken } from "@ant-design/pro-components"
+import { useAjax } from "@/Hook/useAjax"
+import { useModel } from "@umijs/max"
+import React, { JSXElementConstructor, Key, ReactElement, ReactNode, ReactPortal, useEffect, useMemo, useRef, useState } from "react"
+import { appRechargeTemplateList, appRechargeTemplateSave, appRechargeTemplateSwitch, appRechargeTemplateRemove, appRechargeTemplateUpdate, appRechargeTemplateInfo } from "@/services/miniApp/moduleConfig"
+import { Button, Card, Col, Empty, message, Modal, Row, Space } from "antd"
+import { DeleteOutlined, EditOutlined, ExclamationCircleFilled, PlusOutlined } from "@ant-design/icons"
+import formConfig from "./formConfig"
+import { Template } from "./template"
+import { createStyles } from "antd-style";
+const useStyles = createStyles(({ token }) => {
+    return {
+        active: {
+            position: 'relative',
+            "&::after": {
+                content: '""', // 修正了这里的拼写错误
+                display: "block",
+                opacity: 1,
+                border: '15px solid #1890ff',
+                borderBlockEnd: '15px solid transparent',
+                borderInlineStart: '15px solid transparent', // 修正了多余的分号
+                borderStartEndRadius: '6px',
+                position: 'absolute',
+                top: 0,
+                right: 0
+            }
+        }
+    }
+})
+type DataItem = {
+    name: string;
+    state: string;
+};
+const ConiPage: React.FC = () => {
+    let { token } = useToken()
+    let { initialState } = useModel("@@initialState")
+    let [open, setOpen] = useState<any>(null)
+    let [editValues, setEditValues] = useState<any>({})
+    let [activeT, setActiveT] = useState<any>()
+    let { styles } = useStyles()
+    let getList = useAjax((params) => appRechargeTemplateList(params))//获取模板列表
+    let add = useAjax((params) => appRechargeTemplateSave(params))//新增模板
+    let switchT = useAjax((params) => appRechargeTemplateSwitch(params))//切换模板
+    let editT = useAjax((params) => appRechargeTemplateUpdate(params))//编辑模板
+    let delT = useAjax((params) => appRechargeTemplateRemove(params))//删除模板
+    let infoT = useAjax((id) => appRechargeTemplateInfo(id))//模板详情
+    const formRef = useRef<ProFormInstance>();
+    let publicData = useMemo(() => {
+        return {
+            appId: initialState?.selectApp?.id || "",
+            appType: initialState?.selectApp?.appType || ""
+        }
+    }, [initialState?.selectApp, initialState?.currentUser?.distributorId])
+    // 获取表单数据
+    useEffect(() => {
+        getList.run(publicData).then(res => {
+            if (res.data) {
+                let activeObj = res?.data?.find((item: { activateTemplate: any }) => item.activateTemplate)
+                activeObj && setActiveT(activeObj.id)
+            }
+        })
+    }, [publicData])
+    // 提交表单
+    const submit = async (values: any) => {
+        let api = editValues?.id ? editT : add
+        if (!values.activateTemplate) {
+            values.activateTemplate = false
+        }
+        if (editValues?.id) {
+            values.id = editValues?.id
+        }
+        values.rechargeConfigs = []
+        if (values.rechargeConfigList?.length > 0) {//首充
+            values.rechargeConfigs.push({
+                firstRecharge: true,//是否首充档位;true:首充 false:非首充
+                rechargeConfigList: values.rechargeConfigList,
+            })
+        }
+        if (values.rechargeConfigList1?.length > 0) {//非首充
+            values.rechargeConfigs.push(
+                {
+                    firstRecharge: false,//是否首充档位;true:首充 false:非首充
+                    rechargeConfigList: values.rechargeConfigList1,
+                }
+            )
+        }
+        delete values.rechargeConfigList
+        delete values.rechargeConfigList1
+        api.run({ ...values, ...publicData }).then(res => {
+            if (res.code === 200) {
+                getList.refresh()
+                message.success(values.id ? "编辑模板成功" : "新建模板成功!")
+                closeForm(false)
+            }
+        })
+    }
+    // 关闭表单弹窗和重置表单内容
+    const closeForm = (b: boolean, values?: any) => {
+        if (!b) {
+            setEditValues({})
+            formRef?.current?.resetFields?.()
+            setOpen(b)
+        } else {
+            setOpen(b)
+            if (values) {
+                infoT.run(values.id).then(res => {
+                    if (res.code === 200) {
+                        let data = res.data
+                        for (let item of data.rechargeConfigs) {
+                            if (item.firstRecharge) {
+                                data.rechargeConfigList = item.rechargeConfigList
+                            } else {
+                                data.rechargeConfigList1 = item.rechargeConfigList
+                            }
+                        }
+                        setEditValues(data)
+                        formRef?.current?.setFieldsValue(data)
+                    }
+                })
+            }
+        }
+    }
+    // 模板切换
+    const switchTemplate = (id: any) => {
+        let params = { ...publicData, id }
+        Modal.confirm({
+            title: '切换充值模板',
+            content: '是否要切换为当前充值模板?',
+            icon: <ExclamationCircleFilled />,
+            okText: "切换",
+            onOk: () => {
+                switchT.run(params).then(res => {
+                    if (res.code === 200) {
+                        setActiveT(id)
+                        getList.refresh()
+                        message.success("切换成功")
+                    }
+                })
+            }
+        });
+    }
+    // 模板删除
+    const delTemplate = (id: any) => {
+        Modal.confirm({
+            title: '删除充值模板',
+            content: '是否要删除当前充值模板?',
+            icon: <ExclamationCircleFilled />,
+            okType: 'danger',
+            okText: "删除",
+            onOk: () => {
+                delT.run(id).then(res => {
+                    if (res.code === 200) {
+                        getList.refresh()
+                        message.success("删除成功")
+                    }
+                })
+            }
+        });
+    }
+    return <PageContainer
+        title={false}
+        extra={getList?.data?.data?.length > 0 && <Button type="primary" onClick={() => { closeForm(true) }}><PlusOutlined />新增模板</Button>}
+    >
+        {/* 模板列表 */}
+        <Row gutter={[20, 20]}>
+            {
+                getList?.data?.data?.map((item: { id: Key | null | undefined; templateName: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; rechargeConfigs: any[]; templateType: number; templateDescription: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined }) => {
+                    return <Col key={item.id} style={{ cursor: 'pointer' }} onClick={() => { switchTemplate(item.id) }} xs={{ span: 24 }} sm={{ span: 8 }}>
+                        <Card className={activeT === item.id ? styles.active : ""} style={{ background: activeT === item.id ? token.colorPrimaryBgHover : token.colorFillAlter }} hoverable>
+                            <h3 style={{ fontSize: 16, fontWeight: 500, color: token.colorText, fontFamily: 'PingFang SC' }}>{item.templateName}</h3>
+                            {
+                                item.rechargeConfigs?.map((config, index) => {
+                                    return <React.Fragment key={index}>
+                                        <Template data={config} />
+                                    </React.Fragment>
+                                })
+                            }
+                            <p style={{ marginTop: 20, color: token.colorTextSecondary, fontSize: 12 }}>{item.templateDescription}</p>
+                            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'end' }}>
+                                <Space>
+                                    <Button size='small' type='primary' onClick={(e) => { e.stopPropagation(); closeForm(true, item) }}><EditOutlined /></Button>
+                                    <Button size='small' type="primary" danger onClick={(e) => { e.stopPropagation(); delTemplate(item.id) }}><DeleteOutlined /></Button>
+                                </Space>
+                            </div>
+                        </Card>
+                    </Col>
+                })
+            }
+            {
+                getList?.data?.data?.length === 0 && <div style={{ width: "100%", height: "100%", marginTop: "10%" }}><Empty description={<Space direction='vertical'><div>暂无模板数据</div><Button type="primary" onClick={() => { closeForm(true) }}><PlusOutlined />新增模板</Button></Space>} /></div>
+            }
+        </Row>
+        {/* 模板弹窗 */}
+        <BetaSchemaForm<DataItem>
+            title={editValues?.id ? "编辑模板" : '新建模板'}
+            formRef={formRef}
+            open={open}
+            onOpenChange={(b) => { !b && closeForm(b) }}
+            layoutType={"ModalForm"}
+            rowProps={{
+                gutter: [16, 16],
+            }}
+            colProps={{
+                span: 12,
+            }}
+            width={1000}
+            grid={true}
+            onFinish={submit}
+            columns={formConfig()}
+            loading={add?.loading}
+        />
+    </PageContainer>
+
+}
+export default ConiPage

+ 9 - 7
src/pages/MiniApp/ModuleConfig/template.tsx → src/pages/MiniApp/ModuleConfig/coin/template.tsx

@@ -1,12 +1,14 @@
 import { Card, Col, Row } from "antd";
-import jb from '../../../../public//jb.png';
-import vip from '../../../../public//vip.png';
-import top from '../../../../public//top-r1.png';
+import jb from '../../../../../public/jb.png';
+import vip from '../../../../../public/vip.png';
+import top from '../../../../../public/top-r1.png';
 import { createStyles } from "antd-style";
+import { useModel } from "@umijs/max";
 
 
-export function Template(params: { data: any, enmuList: any }) {
-    let { data, enmuList } = params
+export function Template(params: { data: any }) {
+    let { data } = params
+    let { getEnum } = useModel("global")
     let { firstRecharge, rechargeConfigList } = data
     const useStyles = createStyles((props) => {
         let { token } = props
@@ -82,8 +84,8 @@ export function Template(params: { data: any, enmuList: any }) {
                                 </Card>
                             </Col>
                         case 2://vip
-                            let vipEnum = enmuList?.VIP_DAYS?.values;
-                            let vipStr = vipEnum?.find((i: { value: any; }) => i.value === vipDays)?.description || ""
+                            let vipEnum = getEnum("VIP_DAYS","map") 
+                            let vipStr = vipEnum?.find((i: { value: any; }) => i.value === vipDays)?.label || ""
                             return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
                                 <Card className={`${styles.cardBox} ${color && styles.bgVip}`} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
                                     {/* 右上角 */}

+ 24 - 214
src/pages/MiniApp/ModuleConfig/index.tsx

@@ -1,220 +1,30 @@
-import { BetaSchemaForm, PageContainer, ProFormInstance, useToken } from "@ant-design/pro-components"
-import { useAjax } from "@/Hook/useAjax"
-import { useModel } from "@umijs/max"
-import React, { JSXElementConstructor, Key, ReactElement, ReactNode, ReactPortal, useEffect, useMemo, useRef, useState } from "react"
-import { appRechargeTemplateList, appRechargeTemplateSave, appRechargeTemplateSwitch, appRechargeTemplateRemove, appRechargeTemplateUpdate, appRechargeTemplateInfo } from "@/services/miniApp/moduleConfig"
-import { Button, Card, Col, Empty, message, Modal, Row, Space } from "antd"
-import { DeleteOutlined, EditOutlined, ExclamationCircleFilled, PlusOutlined } from "@ant-design/icons"
-import formConfig from "./formConfig"
-import { Template } from "./template"
-import { createStyles } from "antd-style";
-const useStyles = createStyles(({ token }) => {
-    return {
-        active: {
-            position: 'relative',
-            "&::after": {
-                content: '""', // 修正了这里的拼写错误
-                display: "block",
-                opacity: 1,
-                border: '15px solid #1890ff',
-                borderBlockEnd: '15px solid transparent',
-                borderInlineStart: '15px solid transparent', // 修正了多余的分号
-                borderStartEndRadius: '6px',
-                position: 'absolute',
-                top: 0,
-                right: 0
-            }
-        }
-    }
-})
-type DataItem = {
-    name: string;
-    state: string;
-};
-const Page: React.FC = () => {
-    let { token } = useToken()
-    let { initialState } = useModel("@@initialState")
-    let { enumList } = useModel("global", (global) => {
-        return {
-            enumList: global.state.enumList
-        }
-    })
-    let [open, setOpen] = useState<any>(null)
-    let [editValues, setEditValues] = useState<any>({})
-    let [activeT, setActiveT] = useState<any>()
-    let { styles } = useStyles()
-    let getList = useAjax((params) => appRechargeTemplateList(params))//获取模板列表
-    let add = useAjax((params) => appRechargeTemplateSave(params))//新增模板
-    let switchT = useAjax((params) => appRechargeTemplateSwitch(params))//切换模板
-    let editT = useAjax((params) => appRechargeTemplateUpdate(params))//编辑模板
-    let delT = useAjax((params) => appRechargeTemplateRemove(params))//删除模板
-    let infoT = useAjax((id) => appRechargeTemplateInfo(id))//模板详情
-    const formRef = useRef<ProFormInstance>();
-    let publicData = useMemo(() => {
-        return {
-            appId: initialState?.selectApp?.id || "",
-            distributorId: initialState?.currentUser?.distributorId,
-            appType: initialState?.selectApp?.appType || ""
-        }
-    }, [initialState?.selectApp, initialState?.currentUser?.distributorId])
-    // 获取表单数据
-    useEffect(() => {
-        getList.run(publicData).then(res => {
-            if (res.data) {
-                let activeObj = res?.data?.find((item: { activateTemplate: any }) => item.activateTemplate)
-                activeObj && setActiveT(activeObj.id)
-            }
-        })
-    }, [publicData])
-    // 提交表单
-    const submit = async (values: any) => {
-        let api = editValues?.id ? editT : add
-        if (!values.activateTemplate) {
-            values.activateTemplate = false
-        }
-        if (editValues?.id) {
-            values.id = editValues?.id
-        }
-        values.rechargeConfigs = []
-        if (values.rechargeConfigList?.length > 0) {//首充
-            values.rechargeConfigs.push({
-                firstRecharge: true,//是否首充档位;true:首充 false:非首充
-                rechargeConfigList: values.rechargeConfigList,
-            })
-        }
-        if (values.rechargeConfigList1?.length > 0) {//非首充
-            values.rechargeConfigs.push(
-                {
-                    firstRecharge: false,//是否首充档位;true:首充 false:非首充
-                    rechargeConfigList: values.rechargeConfigList1,
-                }
-            )
-        }
-        delete values.rechargeConfigList
-        delete values.rechargeConfigList1
-        api.run({ ...values, ...publicData }).then(res => {
-            if (res.code === 200) {
-                getList.refresh()
-                message.success(values.id ? "编辑模板成功" : "新建模板成功!")
-                closeForm(false)
-            }
-        })
-    }
-    // 关闭表单弹窗和重置表单内容
-    const closeForm = (b: boolean, values?: any) => {
-        if (!b) {
-            setEditValues({})
-            formRef?.current?.resetFields?.()
-            setOpen(b)
-        } else {
-            setOpen(b)
-            if (values) {
-                infoT.run(values.id).then(res => {
-                    if (res.code === 200) {
-                        let data = res.data
-                        for (let item of data.rechargeConfigs) {
-                            if (item.firstRecharge) {
-                                data.rechargeConfigList = item.rechargeConfigList
-                            } else {
-                                data.rechargeConfigList1 = item.rechargeConfigList
-                            }
-                        }
-                        setEditValues(data)
-                        formRef?.current?.setFieldsValue(data)
-                    }
-                })
-            }
-        }
-    }
-    // 模板切换
-    const switchTemplate = (id: any) => {
-        let params = { ...publicData, id }
-        Modal.confirm({
-            title: '切换充值模板',
-            content: '是否要切换为当前充值模板?',
-            icon: <ExclamationCircleFilled />,
-            okText: "切换",
-            onOk: () => {
-                switchT.run(params).then(res => {
-                    if (res.code === 200) {
-                        setActiveT(id)
-                        getList.refresh()
-                        message.success("切换成功")
-                    }
-                })
-            }
-        });
-    }
-    // 模板删除
-    const delTemplate = (id: any) => {
-        Modal.confirm({
-            title: '删除充值模板',
-            content: '是否要删除当前充值模板?',
-            icon: <ExclamationCircleFilled />,
-            okType: 'danger',
-            okText: "删除",
-            onOk: () => {
-                delT.run(id).then(res => {
-                    if (res.code === 200) {
-                        getList.refresh()
-                        message.success("删除成功")
-                    }
-                })
-            }
-        });
-    }
+import { PageContainer } from "@ant-design/pro-components";
+import { useState } from "react";
+import ConiPage from "./coin";
+import VipPage from "./vip";
+
+
+function Page() {
+    let [key, setKey] = useState("coin")
     return <PageContainer
-        extra={getList?.data?.data?.length > 0 && <Button type="primary" onClick={() => { closeForm(true) }}><PlusOutlined />新增模板</Button>}
-    >
-        {/* 模板列表 */}
-        <Row gutter={[20, 20]}>
+        tabProps={{
+            type: 'card',
+            onChange: (e) => setKey(e),
+            activeKey: key
+        }}
+        tabList={[
             {
-                getList?.data?.data?.map((item: { id: Key | null | undefined; templateName: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; rechargeConfigs: any[]; templateType: number; templateDescription: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined }) => {
-                    return <Col key={item.id} style={{ cursor: 'pointer' }} onClick={() => { switchTemplate(item.id) }} xs={{span:24}} sm={{span:8}}>
-                        <Card className={activeT === item.id ? styles.active : ""} style={{ background: activeT === item.id ? token.colorPrimaryBgHover : token.colorFillAlter }} hoverable>
-                            <h3 style={{ fontSize: 16, fontWeight: 500, color: token.colorText, fontFamily: 'PingFang SC' }}>{item.templateName}</h3>
-                            {
-                                item.rechargeConfigs?.map((config, index) => {
-                                    return <React.Fragment key={index}>
-                                        <Template data={config} enmuList={enumList} />
-                                    </React.Fragment>
-                                })
-                            }
-                            <p style={{ marginTop: 20, color: token.colorTextSecondary, fontSize: 12 }}>{item.templateDescription}</p>
-                            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'end' }}>
-                                <Space>
-                                    <Button size='small' type='primary' onClick={(e) => { e.stopPropagation(); closeForm(true, item) }}><EditOutlined /></Button>
-                                    <Button size='small' type="primary" danger onClick={(e) => { e.stopPropagation(); delTemplate(item.id) }}><DeleteOutlined /></Button>
-                                </Space>
-                            </div>
-                        </Card>
-                    </Col>
-                })
-            }
+                tab: '书币充值',
+                key: 'coin',
+            },
             {
-                getList?.data?.data?.length === 0 && <div style={{ width: "100%", height: "100%", marginTop: "10%" }}><Empty description={<Space direction='vertical'><div>暂无模板数据</div><Button type="primary" onClick={() => { closeForm(true) }}><PlusOutlined />新增模板</Button></Space>} /></div>
-            }
-        </Row>
-        {/* 模板弹窗 */}
-        <BetaSchemaForm<DataItem>
-            title={editValues?.id ? "编辑模板" : '新建模板'}
-            formRef={formRef}
-            open={open}
-            onOpenChange={(b) => { !b && closeForm(b) }}
-            layoutType={"ModalForm"}
-            rowProps={{
-                gutter: [16, 16],
-            }}
-            colProps={{
-                span: 12,
-            }}
-            width={1000}
-            grid={true}
-            onFinish={submit}
-            columns={formConfig(enumList)}
-            loading={add?.loading}
-        />
+                tab: 'VIP充值',
+                key: 'vip',
+            },
+        ]}
+    >
+        {key === 'coin' ? <ConiPage /> : <VipPage />}
     </PageContainer>
-
 }
+
 export default Page

+ 374 - 0
src/pages/MiniApp/ModuleConfig/vip/formConfig.tsx

@@ -0,0 +1,374 @@
+import { convertEnumArr } from "@/utils";
+import { ProFormColumnsType } from "@ant-design/pro-components";
+import { useModel } from "@umijs/max";
+
+function formConfig(): ProFormColumnsType<{
+    name: string;
+    state: string;
+}>[] {
+    let {getEnum} = useModel("global")
+    return [
+        {
+            title: '模板名称',
+            dataIndex: 'templateName',
+            colProps: {
+                span: 24
+            },
+            formItemProps: {
+                rules: [
+                    {
+                        required: true,
+                        message: '此项为必填项',
+                    },
+                ],
+            }
+        },
+        {
+            title: '充值模板描述',
+            dataIndex: 'templateDescription',
+            valueType: 'textarea',
+        },
+        {
+            title: '备注',
+            dataIndex: 'remark',
+            valueType: 'textarea',
+        },
+        {
+            title: '首充档位',
+            dataIndex: 'rechargeConfigList',
+            valueType: 'formList',
+            fieldProps: {
+                min: 4,
+                max: 6,
+                creatorButtonProps: {
+                    creatorButtonText: "添加一个首充档位配置",
+                },
+            },
+            colProps: {
+                span: 24
+            },
+            columns: [
+                {
+                    valueType: 'group',
+                    colProps: {
+                        span: 24
+                    },
+                    columns: [
+                        {
+                            title: '类型',
+                            dataIndex: 'gearType',
+                            valueType: 'select',
+                            width: "100%",
+                            initialValue: 1,
+                            fieldProps: { placeholder: "请选择档位类型" },
+                            colProps: {
+                                span: 4
+                            },
+                            formItemProps: {
+                                initialValue:2,
+                                rules: [
+                                    {
+                                        required: true,
+                                        message: '此项为必填项',
+                                    },
+                                ],
+                            },
+                            valueEnum: () => {
+                                let map = getEnum("GEAR_TYPE", "map")
+                                map.delete(1)
+                                return map
+                            }
+                        },
+                        {
+                            valueType: 'dependency',
+                            name: ['gearType'],
+                            columns: ({ gearType }) => {
+                                return [
+                                    {
+                                        title: '价格',
+                                        dataIndex: 'price',
+                                        valueType: 'money',
+                                        width: "100%",
+                                        hideInForm: gearType === 3,
+                                        fieldProps: { placeholder: "输入价格" },
+                                        colProps: {
+                                            span: 5
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        }
+                                    },
+                                    {
+                                        title: '赠送',
+                                        dataIndex: 'gift',
+                                        valueType: 'digit',
+                                        width: "100%",
+                                        hideInForm: gearType !== 1,
+                                        fieldProps: { placeholder: "输入赠送书币数" },
+                                        colProps: {
+                                            span: 5
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        }
+                                    },
+                                    {
+                                        title: 'vip天数',
+                                        dataIndex: 'vipDays',
+                                        valueType: 'select',
+                                        width: "100%",
+                                        hideInForm: gearType !== 2,
+                                        fieldProps: { placeholder: "选择VIP天数" },
+                                        colProps: {
+                                            span: 4
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        },
+                                        valueEnum: getEnum("VIP_DAYS","map")
+                                    },
+                                    {
+                                        title: '价格',
+                                        width: "100%",
+                                        fieldProps: { placeholder: "价格在小说管理设置", disabled: true },
+                                        hideInForm: gearType !== 3,
+                                        colProps: {
+                                            span: 5
+                                        }
+                                    },
+                                    {
+                                        title: '文案',
+                                        dataIndex: 'description',
+                                        width: "100%",
+                                        fieldProps: { placeholder: "输入展示文案" },
+                                        hideInForm: gearType !== 3,
+                                        colProps: {
+                                            span: 5
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        }
+                                    },
+                                    {
+                                        title: '角标',
+                                        dataIndex: 'subscript',
+                                        width: "100%",
+                                        fieldProps: { placeholder: "右上角角标文案" },
+                                        colProps: {
+                                            span: 5
+                                        }
+                                    },
+                                    {
+                                        title: '底色',
+                                        dataIndex: "color",
+                                        valueType: "radioButton",
+                                        width: "100%",
+                                        initialValue: false,
+                                        colProps: {
+                                            span: 4
+                                        },
+                                        valueEnum:getEnum("COLOR","map")
+                                    }
+                                ]
+                            }
+
+                        },
+                    ]
+                }
+            ]
+        },
+        {
+            title: '非首充档位',
+            dataIndex: 'rechargeConfigList1',
+            valueType: 'formList',
+            fieldProps: {
+                min: 4,
+                max: 6,
+                creatorButtonProps: {
+                    creatorButtonText: "添加一个非首充档位配置",
+                },
+            },
+            colProps: {
+                span: 24
+            },
+            columns: [
+                {
+                    valueType: 'group',
+                    colProps: {
+                        span: 24
+                    },
+                    columns: [
+                        {
+                            title: '类型',
+                            dataIndex: 'gearType',
+                            valueType: 'select',
+                            width: "100%",
+                            initialValue: 1,
+                            fieldProps: { placeholder: "请选择档位类型" },
+                            colProps: {
+                                span: 4
+                            },
+                            formItemProps: {
+                                initialValue:2,
+                                rules: [
+                                    {
+                                        required: true,
+                                        message: '此项为必填项',
+                                    },
+                                ],
+                            },
+                            valueEnum: () => {
+                                let map = getEnum("GEAR_TYPE", "map")
+                                map.delete(1)
+                                return map
+                            }
+                        },
+                        {
+                            valueType: 'dependency',
+                            name: ['gearType'],
+                            columns: ({ gearType }) => {
+                                return [
+                                    {
+                                        title: '价格',
+                                        dataIndex: 'price',
+                                        valueType: 'money',
+                                        width: "100%",
+                                        hideInForm: gearType === 3,
+                                        fieldProps: { placeholder: "输入价格" },
+                                        colProps: {
+                                            span: 5
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        }
+                                    },
+                                    {
+                                        title: '赠送',
+                                        dataIndex: 'gift',
+                                        valueType: 'digit',
+                                        width: "100%",
+                                        hideInForm: gearType !== 1,
+                                        fieldProps: { placeholder: "输入赠送书币数" },
+                                        colProps: {
+                                            span: 5
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        }
+                                    },
+                                    {
+                                        title: 'vip天数',
+                                        dataIndex: 'vipDays',
+                                        valueType: 'select',
+                                        width: "100%",
+                                        hideInForm: gearType !== 2,
+                                        fieldProps: { placeholder: "选择VIP天数" },
+                                        colProps: {
+                                            span: 4
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        },
+                                        valueEnum:getEnum("VIP_DAYS","map")
+                                    },
+                                    {
+                                        title: '价格',
+                                        width: "100%",
+                                        fieldProps: { placeholder: "价格在小说管理设置", disabled: true },
+                                        hideInForm: gearType !== 3,
+                                        colProps: {
+                                            span: 5
+                                        }
+                                    },
+                                    {
+                                        title: '文案',
+                                        dataIndex: 'description',
+                                        width: "100%",
+                                        fieldProps: { placeholder: "输入展示文案" },
+                                        hideInForm: gearType !== 3,
+                                        colProps: {
+                                            span: 5
+                                        },
+                                        formItemProps: {
+                                            rules: [
+                                                {
+                                                    required: true,
+                                                    message: '此项为必填项',
+                                                },
+                                            ],
+                                        }
+                                    },
+                                    {
+                                        title: '角标',
+                                        dataIndex: 'subscript',
+                                        width: "100%",
+                                        fieldProps: { placeholder: "右上角角标文案" },
+                                        colProps: {
+                                            span: 5
+                                        }
+                                    },
+                                    {
+                                        title: '底色',
+                                        dataIndex: "color",
+                                        valueType: "radioButton",
+                                        width: "100%",
+                                        initialValue: false,
+                                        colProps: {
+                                            span: 4
+                                        },
+                                        valueEnum: getEnum("COLOR","map")
+                                    }
+                                ]
+                            }
+
+                        },
+                    ]
+                }
+            ]
+        },
+        {
+            title: '激活当前模板',
+            dataIndex: 'activateTemplate',
+            valueType: 'switch',
+            formItemProps: { layout: 'horizontal' },
+            colProps: { offset: 19 }
+        },
+    ]
+}
+
+export default formConfig

+ 215 - 0
src/pages/MiniApp/ModuleConfig/vip/index.tsx

@@ -0,0 +1,215 @@
+import { BetaSchemaForm, PageContainer, ProFormInstance, useToken } from "@ant-design/pro-components"
+import { useAjax } from "@/Hook/useAjax"
+import { useModel } from "@umijs/max"
+import React, { JSXElementConstructor, Key, ReactElement, ReactNode, ReactPortal, useEffect, useMemo, useRef, useState } from "react"
+import { appVipRechargeTemplateInfo, appVipRechargeTemplateList, appVipRechargeTemplateRemove, appVipRechargeTemplateSave, appVipRechargeTemplateSwitch, appVipRechargeTemplateUpdate } from "@/services/miniApp/moduleConfig"
+import { Button, Card, Col, Empty, message, Modal, Row, Space } from "antd"
+import { DeleteOutlined, EditOutlined, ExclamationCircleFilled, PlusOutlined } from "@ant-design/icons"
+import formConfig from "./formConfig"
+import { Template } from "./template"
+import { createStyles } from "antd-style";
+const useStyles = createStyles(({ token }) => {
+    return {
+        active: {
+            position: 'relative',
+            "&::after": {
+                content: '""', // 修正了这里的拼写错误
+                display: "block",
+                opacity: 1,
+                border: '15px solid #1890ff',
+                borderBlockEnd: '15px solid transparent',
+                borderInlineStart: '15px solid transparent', // 修正了多余的分号
+                borderStartEndRadius: '6px',
+                position: 'absolute',
+                top: 0,
+                right: 0
+            }
+        }
+    }
+})
+type DataItem = {
+    name: string;
+    state: string;
+};
+const VipPage: React.FC = () => {
+    let { token } = useToken()
+    let { initialState } = useModel("@@initialState")
+    let [open, setOpen] = useState<any>(null)
+    let [editValues, setEditValues] = useState<any>({})
+    let [activeT, setActiveT] = useState<any>()
+    let { styles } = useStyles()
+    let getList = useAjax((params) => appVipRechargeTemplateList(params))//获取模板列表
+    let add = useAjax((params) => appVipRechargeTemplateSave(params))//新增模板
+    let switchT = useAjax((params) => appVipRechargeTemplateSwitch(params))//切换模板
+    let editT = useAjax((params) => appVipRechargeTemplateUpdate(params))//编辑模板
+    let delT = useAjax((params) => appVipRechargeTemplateRemove(params))//删除模板
+    let infoT = useAjax((id) => appVipRechargeTemplateInfo(id))//模板详情
+    const formRef = useRef<ProFormInstance>();
+    let publicData = useMemo(() => {
+        return {
+            appId: initialState?.selectApp?.id || "",
+            appType: initialState?.selectApp?.appType || ""
+        }
+    }, [initialState?.selectApp, initialState?.currentUser?.distributorId])
+    // 获取表单数据
+    useEffect(() => {
+        getList.run(publicData).then(res => {
+            if (res.data) {
+                let activeObj = res?.data?.find((item: { activateTemplate: any }) => item.activateTemplate)
+                activeObj && setActiveT(activeObj.id)
+            }
+        })
+    }, [publicData])
+    // 提交表单
+    const submit = async (values: any) => {
+        let api = editValues?.id ? editT : add
+        if (!values.activateTemplate) {
+            values.activateTemplate = false
+        }
+        if (editValues?.id) {
+            values.id = editValues?.id
+        }
+        values.rechargeConfigs = []
+        if (values.rechargeConfigList?.length > 0) {//首充
+            values.rechargeConfigs.push({
+                firstRecharge: true,//是否首充档位;true:首充 false:非首充
+                rechargeConfigList: values.rechargeConfigList,
+            })
+        }
+        if (values.rechargeConfigList1?.length > 0) {//非首充
+            values.rechargeConfigs.push(
+                {
+                    firstRecharge: false,//是否首充档位;true:首充 false:非首充
+                    rechargeConfigList: values.rechargeConfigList1,
+                }
+            )
+        }
+        delete values.rechargeConfigList
+        delete values.rechargeConfigList1
+        api.run({ ...values, ...publicData }).then(res => {
+            if (res.code === 200) {
+                getList.refresh()
+                message.success(values.id ? "编辑模板成功" : "新建模板成功!")
+                closeForm(false)
+            }
+        })
+    }
+    // 关闭表单弹窗和重置表单内容
+    const closeForm = (b: boolean, values?: any) => {
+        if (!b) {
+            setEditValues({})
+            formRef?.current?.resetFields?.()
+            setOpen(b)
+        } else {
+            setOpen(b)
+            if (values) {
+                infoT.run(values.id).then(res => {
+                    if (res.code === 200) {
+                        let data = res.data
+                        for (let item of data.rechargeConfigs) {
+                            if (item.firstRecharge) {
+                                data.rechargeConfigList = item.rechargeConfigList
+                            } else {
+                                data.rechargeConfigList1 = item.rechargeConfigList
+                            }
+                        }
+                        setEditValues(data)
+                        formRef?.current?.setFieldsValue(data)
+                    }
+                })
+            }
+        }
+    }
+    // 模板切换
+    const switchTemplate = (id: any) => {
+        let params = { ...publicData, id }
+        Modal.confirm({
+            title: '切换充值模板',
+            content: '是否要切换为当前充值模板?',
+            icon: <ExclamationCircleFilled />,
+            okText: "切换",
+            onOk: () => {
+                switchT.run(params).then(res => {
+                    if (res.code === 200) {
+                        setActiveT(id)
+                        getList.refresh()
+                        message.success("切换成功")
+                    }
+                })
+            }
+        });
+    }
+    // 模板删除
+    const delTemplate = (id: any) => {
+        Modal.confirm({
+            title: '删除充值模板',
+            content: '是否要删除当前充值模板?',
+            icon: <ExclamationCircleFilled />,
+            okType: 'danger',
+            okText: "删除",
+            onOk: () => {
+                delT.run(id).then(res => {
+                    if (res.code === 200) {
+                        getList.refresh()
+                        message.success("删除成功")
+                    }
+                })
+            }
+        });
+    }
+    return <PageContainer
+        title={false}
+        extra={getList?.data?.data?.length > 0 && <Button type="primary" onClick={() => { closeForm(true) }}><PlusOutlined />新增模板</Button>}
+    >
+        {/* 模板列表 */}
+        <Row gutter={[20, 20]}>
+            {
+                getList?.data?.data?.map((item: { id: Key | null | undefined; templateName: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; rechargeConfigs: any[]; templateType: number; templateDescription: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined }) => {
+                    return <Col key={item.id} style={{ cursor: 'pointer' }} onClick={() => { switchTemplate(item.id) }} xs={{span:24}} sm={{span:8}}>
+                        <Card className={activeT === item.id ? styles.active : ""} style={{ background: activeT === item.id ? token.colorPrimaryBgHover : token.colorFillAlter }} hoverable>
+                            <h3 style={{ fontSize: 16, fontWeight: 500, color: token.colorText, fontFamily: 'PingFang SC' }}>{item.templateName}</h3>
+                            {
+                                item.rechargeConfigs?.map((config, index) => {
+                                    return <React.Fragment key={index}>
+                                        <Template data={config} />
+                                    </React.Fragment>
+                                })
+                            }
+                            <p style={{ marginTop: 20, color: token.colorTextSecondary, fontSize: 12 }}>{item.templateDescription}</p>
+                            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'end' }}>
+                                <Space>
+                                    <Button size='small' type='primary' onClick={(e) => { e.stopPropagation(); closeForm(true, item) }}><EditOutlined /></Button>
+                                    <Button size='small' type="primary" danger onClick={(e) => { e.stopPropagation(); delTemplate(item.id) }}><DeleteOutlined /></Button>
+                                </Space>
+                            </div>
+                        </Card>
+                    </Col>
+                })
+            }
+            {
+                getList?.data?.data?.length === 0 && <div style={{ width: "100%", height: "100%", marginTop: "10%" }}><Empty description={<Space direction='vertical'><div>暂无模板数据</div><Button type="primary" onClick={() => { closeForm(true) }}><PlusOutlined />新增模板</Button></Space>} /></div>
+            }
+        </Row>
+        {/* 模板弹窗 */}
+        <BetaSchemaForm<DataItem>
+            title={editValues?.id ? "编辑模板" : '新建模板'}
+            formRef={formRef}
+            open={open}
+            onOpenChange={(b) => { !b && closeForm(b) }}
+            layoutType={"ModalForm"}
+            rowProps={{
+                gutter: [16, 16],
+            }}
+            colProps={{
+                span: 12,
+            }}
+            width={1000}
+            grid={true}
+            onFinish={submit}
+            columns={formConfig()}
+            loading={add?.loading}
+        />
+    </PageContainer>
+
+}
+export default VipPage

+ 144 - 0
src/pages/MiniApp/ModuleConfig/vip/template.tsx

@@ -0,0 +1,144 @@
+import { Card, Col, Row } from "antd";
+import jb from '../../../../../public/jb.png';
+import vip from '../../../../../public/vip.png';
+import top from '../../../../../public/top-r1.png';
+import { createStyles } from "antd-style";
+import { useModel } from "@umijs/max";
+
+
+export function Template(params: { data: any }) {
+    let { data } = params
+    let { getEnum } = useModel("global")
+    let { firstRecharge, rechargeConfigList } = data
+    const useStyles = createStyles((props) => {
+        let { token } = props
+        let navTheme = localStorage.getItem("navTheme")//全局 2亮色 3黑色
+        return {
+            cardBox: {
+                position: 'relative'
+            },
+            bgVip: {
+                backgroundImage: "linear-gradient(180deg, #fff1dc 60%, #fffdfa 100%)",
+                color: navTheme == "3" ? "#000" : "unset"
+            },
+            bg: {
+                backgroundImage: 'linear-gradient(180deg, #ffeced 60%, #fffafa 100%)',
+                color: navTheme == "3" ? "#000" : "unset"
+            },
+            topRight: {
+                lineHeight: '20px',
+                background: "#ff2441",
+                position: 'absolute',
+                top: 0,
+                right: 0,
+                fontSize: 12,
+                borderRadius: "0px 8px 0 8px",
+            },
+            topRightVip: {
+                background: "#ffd89d !important",
+            },
+            // 
+            topRightSpan1: { display: 'inline-block', background: `url(${top}) no-repeat`, minWidth: 40, height: 20, padding: "0 10px 0 6px", backgroundSize: "100% 100%", color: "#fff" },
+            topRightSpan2: { color: "#fff", display: 'inline-block', padding: "0 5px" },
+            del: { fontSize: 14, textDecoration: 'line-through', marginLeft: 7, color: token.colorTextTertiary, fontWeight: "500" }
+        }
+    });
+    let { styles } = useStyles()
+
+    return <Card bordered={false} >
+        <Row gutter={[0, 15]}>
+            {
+                rechargeConfigList?.map((item: any, index: any) => {
+                    let {
+                        color,//背景色
+                        description,//整数购买文案
+                        extra,//右上角描述值
+                        gearType,//充值类型
+                        gift,//赠送
+                        obtain,//获得书币/vip每天价格
+                        price,//价格
+                        subscript,//右上角文案 首充|超值等
+                        vipDays,//vip天数
+                    } = item
+                    switch (gearType) {
+                        case 1://充值
+                            return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
+                                <Card className={`${styles.cardBox} ${color && styles.bg}`} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
+                                    {/* 右上角 */}
+                                    <div className={`${styles.topRight}`} style={subscript ? { borderRadius: "8px 8px 0 8px", } : {}} >
+                                        {
+                                            <>
+                                                {subscript && <span className={styles.topRightSpan1}>{subscript}</span>}
+                                                <span className={styles.topRightSpan2} style={subscript ? { transform: 'translateX(-4px)' } : {}}>多送{extra}元</span>
+                                            </>
+                                        }
+                                    </div>
+                                    <div style={{ display: 'flex', flexFlow: 'column' }}>
+                                        <strong >
+                                            <span style={{ fontSize: '20px', marginRight: 3 }} >¥</span>
+                                            <span style={{ fontSize: 22, fontFamily: 'Yuewen Font' }}>{price}</span>
+                                        </strong>
+                                        <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>{obtain}书币 送{gift}书券</span>
+                                    </div>
+                                    {color && <img src={jb} style={{ position: 'absolute', right: 0, bottom: 0, width: 50 }} />}
+                                </Card>
+                            </Col>
+                        case 2://vip
+                            let vipEnum = getEnum("VIP_DAYS","arr") 
+                            let vipStr = vipEnum?.find((i: { value: any; }) => i.value === vipDays)?.label || ""
+                            return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
+                                <Card className={`${styles.cardBox} ${color && styles.bgVip}`} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
+                                    {/* 右上角 */}
+                                    <div className={`${styles.topRight} ${styles.topRightVip}`} style={subscript ? { borderRadius: "8px 8px 0 8px", } : {}}>
+                                        {
+                                            <>
+                                                {subscript && <span className={styles.topRightSpan1}>{subscript}</span>}
+                                                <span className={styles.topRightSpan2}>{vipStr}</span>
+                                            </>
+                                        }
+                                    </div>
+                                    <div style={{ display: 'flex', flexFlow: 'column' }}>
+                                        <strong >
+                                            <span style={{ fontSize: '20px', marginRight: 3 }} >¥</span>
+                                            <span style={{ fontSize: 22, fontFamily: 'Yuewen Font' }}>{price}</span>
+                                        </strong>
+                                        <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>¥{obtain}元/天</span>
+                                    </div>
+                                    {color && <img src={vip} style={{ position: 'absolute', right: 0, bottom: 0, width: 30 }} />}
+                                </Card>
+                            </Col>
+                        case 3://整本
+                            return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
+                                <Card className={`${styles.cardBox} `} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
+                                    {/* 右上角 */}
+                                    <div className={styles.topRight}>
+                                        {
+                                            subscript ? <> <span>{item.description}</span></> : <>
+                                                <span className={styles.topRightSpan1}>{subscript}</span>
+                                                <span className={styles.topRightSpan2}>{item.description}</span>
+                                            </>
+                                        }
+                                    </div>
+                                    <div style={{ display: 'flex', flexFlow: 'column' }}>
+                                        <strong >
+                                            <span style={{ fontSize: '20px', marginRight: 3 }} >¥</span>
+                                            <span style={{ fontSize: 22, fontFamily: 'Yuewen Font' }}>{price}</span>
+                                            {/* {isVip && item.gift && <span className={styles.del}>¥{item.gift}</span>} */}
+                                        </strong>
+                                        {/* {isVip ?
+                                    <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>{isOne ? "仅" : "¥"}{item.extra}元/天</span>
+                                    :
+                                    <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>{item.gift}书币 送{item.extra}书券</span>} */}
+                                    </div>
+                                    {/* {isOne && <img src={isVip ? vip : jb} style={{ position: 'absolute', right: 0, bottom: 0, width: isVip ? 30 : 50 }} />} */}
+                                </Card>
+                            </Col>
+                        default:
+                            break;
+                    }
+
+                })
+            }
+        </Row>
+    </Card >
+}

+ 79 - 6
src/services/miniApp/moduleConfig/index.tsx

@@ -12,20 +12,20 @@ interface PublicParams{
 export interface Params extends Page,PublicParams{}
 /**书币充值模板列表 */
 export async function appRechargeTemplateList(params: Params) {
-    return request(api + '/admin/appRechargeTemplate/list', {
+    return request(api + '/admin/appCoinRechargeTemplate/list', {
         method: 'GET',
         params
     });
 }
 /**书币充值模板详情 */
 export async function appRechargeTemplateInfo(id: string) {
-    return request(api + `/admin/appRechargeTemplate/getInfo/${id}`, {
+    return request(api + `/admin/appCoinRechargeTemplate/getInfo/${id}`, {
         method: 'GET',
     });
 }
 /**书币充值模板删除 */
 export async function appRechargeTemplateRemove(id: string) {
-    return request(api + `/admin/appRechargeTemplate/remove/${id}`, {
+    return request(api + `/admin/appCoinRechargeTemplate/remove/${id}`, {
         method: 'DELETE',
     });
 }
@@ -45,7 +45,7 @@ interface Data extends PublicParams {
 }
 /**书币充值模板新增*/
 export async function appRechargeTemplateSave(data: Data) {
-    return request(api + `/admin/appRechargeTemplate/save`, {
+    return request(api + `/admin/appCoinRechargeTemplate/save`, {
         method: 'POST',
         data
     });
@@ -53,7 +53,7 @@ export async function appRechargeTemplateSave(data: Data) {
 /**书币充值模板修改*/
 export async function appRechargeTemplateUpdate(params: Data) {
     let { id, ...data } = params
-    return request(api + `/admin/appRechargeTemplate/update/${id}`, {
+    return request(api + `/admin/appCoinRechargeTemplate/update/${id}`, {
         method: 'PUT',
         data
     });
@@ -63,7 +63,80 @@ interface DataSwitch extends PublicParams{
 }
 /**书币充值模板修改*/
 export async function appRechargeTemplateSwitch(data: DataSwitch) {
-    return request(api + `/admin/appRechargeTemplate/updateTemplate`, {
+    return request(api + `/admin/appCoinRechargeTemplate/updateTemplate`, {
+        method: 'PUT',
+        data
+    });
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/**===========================================Vip充值模板列表 ===========================================*/
+export async function appVipRechargeTemplateList(params: Params) {
+    return request(api + '/admin/appVipRechargeTemplate/list', {
+        method: 'GET',
+        params
+    });
+}
+/**Vip充值模板详情 */
+export async function appVipRechargeTemplateInfo(id: string) {
+    return request(api + `/admin/appVipRechargeTemplate/getInfo/${id}`, {
+        method: 'GET',
+    });
+}
+/**Vip充值模板删除 */
+export async function appVipRechargeTemplateRemove(id: string) {
+    return request(api + `/admin/appVipRechargeTemplate/remove/${id}`, {
+        method: 'DELETE',
+    });
+}
+interface RechargeConfig {
+    price: string,//价格
+    gift: string,//赠送
+    extra: string,//额外赠送
+    description: string,//额外描述
+}
+interface Data extends PublicParams {
+    id?: string,//编辑时的ID
+    templateName: string,//模板名称
+    templateDescription: string,//充值模板描述
+    rechargeConfigJson: RechargeConfig,//充值挡位配置
+    activateTemplate: boolean,//当前激活的充值模板;true :已激活 false :未激活
+    remark?: string,//备注
+}
+/**Vip充值模板新增*/
+export async function appVipRechargeTemplateSave(data: Data) {
+    return request(api + `/admin/appVipRechargeTemplate/save`, {
+        method: 'POST',
+        data
+    });
+}
+/**Vip充值模板修改*/
+export async function appVipRechargeTemplateUpdate(params: Data) {
+    let { id, ...data } = params
+    return request(api + `/admin/appVipRechargeTemplate/update/${id}`, {
+        method: 'PUT',
+        data
+    });
+}
+interface DataSwitch extends PublicParams{
+    id:string,//模板ID
+}
+/**Vip充值模板修改*/
+export async function appVipRechargeTemplateSwitch(data: DataSwitch) {
+    return request(api + `/admin/appVipRechargeTemplate/updateTemplate`, {
         method: 'PUT',
         data
     });

+ 1 - 0
tsconfig.json

@@ -16,6 +16,7 @@
     "paths": {
       "@/*": ["./src/*"],
       "@@/*": ["./src/.umi/*"],
+      "@p/*": ["./public/*"],
       "@@test/*": ["./src/.umi-test/*"]
     }
   },