wjx 6 months ago
parent
commit
85f29c9669

+ 11 - 10
src/pages/gameDataStatistics/roleOperate/codeSender/enabledSwitch.tsx

@@ -1,11 +1,11 @@
 import { useAjax } from "@/Hook/useAjax"
 import { updatePackLinkCodeApi } from "@/services/gameData/roleOperate"
-import { Switch } from "antd"
+import { Button, message, Popconfirm } from "antd"
 import React from "react"
 
 interface Props {
     id: number
-    value?: boolean
+    linkId?: number
     onChange?: () => void
 }
 
@@ -13,24 +13,25 @@ interface Props {
  * 修改状态
  * @returns 
  */
-const EnabledSwitch: React.FC<Props> = ({ id, value, onChange }) => {
+const EnabledSwitch: React.FC<Props> = ({ id, linkId, onChange }) => {
 
     /************************************/
     const updatePackLinkCode = useAjax((params) => updatePackLinkCodeApi(params))
     /************************************/
 
-    return <Switch
-        checked={value}
-        loading={updatePackLinkCode.loading}
-        size="small"
-        onChange={(checked) => {
-            updatePackLinkCode.run({ ids: [id], enabled: checked }).then(res => {
+    return <Popconfirm
+        title="确定删除?"
+        onConfirm={() => {
+            updatePackLinkCode.run({ ids: [id], linkId }).then(res => {
                 if (res) {
                     onChange?.()
+                    message.success('删除成功')
                 }
             })
         }}
-    />
+    >
+        <Button loading={updatePackLinkCode.loading} danger type="link" style={{ padding: 0, fontSize: 12 }}>删除</Button>
+    </Popconfirm>
 }
 
 export default React.memo(EnabledSwitch)

+ 14 - 9
src/pages/gameDataStatistics/roleOperate/codeSender/linkCode.tsx

@@ -1,6 +1,6 @@
 import { useAjax } from "@/Hook/useAjax"
 import { getPackLinkCodeListApi, GetPackLinkCodeListProps, updatePackLinkCodeApi } from "@/services/gameData/roleOperate"
-import { Button, Col, DatePicker, Form, Input, message, Modal, Row, Select, Space } from "antd"
+import { Button, Col, DatePicker, Form, Input, message, Modal, Popconfirm, Row, Space } from "antd"
 import React, { useEffect, useState } from "react"
 import style from '../../components/TableData/index.less'
 import moment from "moment"
@@ -56,10 +56,10 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
     }, [queryFrom])
 
 
-    const handleEnabled = (checked: boolean) => {
-        updatePackLinkCode.run({ ids: selectedRows.map(item => item.id), enabled: checked }).then(res => {
+    const handleEnabled = () => {
+        updatePackLinkCode.run({ ids: selectedRows.map(item => item.id), linkId: data.id }).then(res => {
             if (res) {
-                message.success('修改成功')
+                message.success('删除成功')
                 getPackLinkCodeList.refresh()
                 setSelectedRows([])
             }
@@ -71,8 +71,13 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
             <strong>{data?.gameName}({data?.codeTypeName}) 链接礼包码</strong>
             <a onClick={() => { setaddCodeVisible(true); }}>新增礼包码</a>
             {selectedRows?.length > 0 && <>
-                <a style={{ color: '#52C41A' }} onClick={() => handleEnabled(true)}>修改为可用</a>
-                <a style={{ color: 'red' }} onClick={() => handleEnabled(false)}>修改为不可用</a>
+                
+                <Popconfirm
+                    title="确定删除?"
+                    onConfirm={() => handleEnabled()}
+                >
+                    <a style={{ color: 'red' }}>删除</a>
+                </Popconfirm>
             </>}
         </Space>}
         visible={visible}
@@ -86,7 +91,7 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
                     <Col><Form.Item name='code'>
                         <Input placeholder="礼包码" allowClear style={{ width: 120 }} />
                     </Form.Item></Col>
-                    <Col><Form.Item name='enabled'>
+                    {/* <Col><Form.Item name='enabled'>
                         <Select
                             showSearch
                             style={{ width: 120 }}
@@ -99,7 +104,7 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
                             <Select.Option value={1}>是</Select.Option>
                             <Select.Option value={0}>否</Select.Option>
                         </Select>
-                    </Form.Item></Col>
+                    </Form.Item></Col> */}
                     <Col><Form.Item name='createTime'>
                         <DatePicker.RangePicker style={{ width: 250 }} placeholder={['创建时间开始', '创建时间结束']} />
                     </Form.Item></Col>
@@ -122,7 +127,7 @@ const LinkCode: React.FC<Props> = ({ data, visible, onClose }) => {
                     sortDirections={['ascend', 'descend', null]}
                     current={queryFrom.pageNum}
                     pageSize={queryFrom.pageSize}
-                    columns={columnsPosCode(() => getPackLinkCodeList.refresh())}
+                    columns={columnsPosCode(data.id, () => getPackLinkCodeList.refresh())}
                     dataSource={getPackLinkCodeList?.data?.records}
                     scroll={{ x: 900, y: 600 }}
                     onChange={(pagination: any, filters: any, sortData: any) => {

+ 4 - 3
src/pages/gameDataStatistics/roleOperate/codeSender/modifyLink.tsx

@@ -62,6 +62,7 @@ const ModifyLink: React.FC<Props> = ({ configData, visible, onChange, onClose, i
         visible={visible}
         onCancel={onClose}
         onOk={handleOk}
+        confirmLoading={updatePackLink.loading || addPackLink.loading}
     >
         <Form
             name="basicPackLink"
@@ -130,7 +131,7 @@ const ModifyLink: React.FC<Props> = ({ configData, visible, onChange, onClose, i
                                 { required: !!payMin ? true : false, message: '请填写最大值' },
                                 () => ({
                                     validator(_, value) {
-                                        if (value && payMin && value > payMin) {
+                                        if (value && payMin && value < payMin) {
                                             return Promise.reject(new Error('最大值必须大于等于最小值'));
                                         }
                                         return Promise.resolve();
@@ -169,7 +170,7 @@ const ModifyLink: React.FC<Props> = ({ configData, visible, onChange, onClose, i
                                 { required: !!regTimeMin ? true : false, message: '请填写最大值' },
                                 () => ({
                                     validator(_, value) {
-                                        if (value && regTimeMin && value > regTimeMin) {
+                                        if (value && regTimeMin && value < regTimeMin) {
                                             return Promise.reject(new Error('最大值必须大于等于最小值'));
                                         }
                                         return Promise.resolve();
@@ -208,7 +209,7 @@ const ModifyLink: React.FC<Props> = ({ configData, visible, onChange, onClose, i
                                 { required: !!unLoginMin ? true : false, message: '请填写最大值' },
                                 () => ({
                                     validator(_, value) {
-                                        if (value && unLoginMin && value > unLoginMin) {
+                                        if (value && unLoginMin && value < unLoginMin) {
                                             return Promise.reject(new Error('最大值必须大于等于最小值'));
                                         }
                                         return Promise.resolve();

+ 17 - 5
src/pages/gameDataStatistics/roleOperate/codeSender/tableConfigCode.tsx

@@ -2,9 +2,10 @@
 
 import WidthEllipsis from "@/components/widthEllipsis"
 import React from "react"
+import { Tag } from "antd"
 import EnabledSwitch from "./enabledSwitch"
 
-function columnsPosCode(refresh: () => void) {
+function columnsPosCode(linkId: number, refresh: () => void) {
 
     let newArr: any = [
         {
@@ -15,12 +16,14 @@ function columnsPosCode(refresh: () => void) {
             render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
         },
         {
-            title: '可用',
-            dataIndex: 'enabled',
-            key: 'enabled',
+            title: '是否领取?',
+            dataIndex: 'isSend',
+            key: 'isSend',
             align: 'center',
             width: 70,
-            render: (a: boolean, b: any) => (<EnabledSwitch value={a} id={b.id} onChange={refresh}/>)
+            render: (a: boolean, b: any) => {
+                return a ? <Tag color="success">已经领取</Tag> : <Tag color="default">待领取</Tag>
+            }
         },
         {
             title: '创建人',
@@ -53,6 +56,15 @@ function columnsPosCode(refresh: () => void) {
             align: 'center',
             width: 135,
             render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '操作',
+            dataIndex: 'cz',
+            key: 'cz',
+            align: 'center',
+            width: 90,
+            fixed: 'right',
+            render: (_: string, b: any) => (<EnabledSwitch linkId={linkId} id={b.id} onChange={refresh}/>)
         }
     ]
     return newArr

+ 55 - 6
src/pages/gameDataStatistics/roleOperate/codeSender/tableConfigLog.tsx

@@ -10,30 +10,79 @@ function columnsPosLog() {
             title: '企业ID',
             dataIndex: 'corpId',
             key: 'corpId',
-            width: 100,
+            width: 90,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
         },
         {
             title: '客服号ID',
             dataIndex: 'corpUserId',
             key: 'corpUserId',
-            width: 100,
+            width: 90,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
         },
         {
             title: '企微用户ID',
             dataIndex: 'externalUserId',
             key: 'externalUserId',
-            width: 100,
+            width: 90,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
+        },
+        {
+            title: '角色名称',
+            dataIndex: 'roleName',
+            key: 'roleName',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a}/>)
+        },
+        {
+            title: '角色ID',
+            dataIndex: 'roleId',
+            key: 'roleId',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a}/>)
+        },
+        {
+            title: '区服名称',
+            dataIndex: 'serverName',
+            key: 'serverName',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '区服ID',
+            dataIndex: 'serverId',
+            key: 'serverId',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '玩家ID',
+            dataIndex: 'userId',
+            key: 'userId',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '礼包领取记录ID',
+            dataIndex: 'codeLogId',
+            key: 'codeLogId',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
         },
         {
             title: '创建时间',
             dataIndex: 'createTime',
             key: 'createTime',
+            width: 140,
             render: (a: string) => (<WidthEllipsis value={a} />)
         }
     ]

+ 44 - 4
src/pages/gameDataStatistics/roleOperate/codeSender/tableConfigLqLog.tsx

@@ -12,7 +12,7 @@ function columnsPosLqLog() {
             key: 'code',
             width: 100,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
         },
         {
             title: '企业ID',
@@ -20,7 +20,7 @@ function columnsPosLqLog() {
             key: 'corpId',
             width: 100,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
         },
         {
             title: '客服号ID',
@@ -28,7 +28,7 @@ function columnsPosLqLog() {
             key: 'corpUserId',
             width: 100,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
         },
         {
             title: '企微用户ID',
@@ -36,7 +36,7 @@ function columnsPosLqLog() {
             key: 'externalUserId',
             width: 100,
             align: 'center',
-            render: (a: string) => (<WidthEllipsis value={a} isCopy/>)
+            render: (a: string) => (<WidthEllipsis value={a}/>)
         },
         {
             title: '角色名称',
@@ -62,10 +62,50 @@ function columnsPosLqLog() {
             align: 'center',
             render: (a: string) => (<WidthEllipsis value={a}/>)
         },
+        {
+            title: '区服名称',
+            dataIndex: 'serverName',
+            key: 'serverName',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '区服ID',
+            dataIndex: 'serverId',
+            key: 'serverId',
+            width: 90,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '用户手机号',
+            dataIndex: 'userPhone',
+            key: 'userPhone',
+            width: 120,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a} />)
+        },
+        {
+            title: '关联访问记录ID',
+            dataIndex: 'linkLogId',
+            key: 'linkLogId',
+            width: 100,
+            align: 'center',
+            render: (a: string) => (<WidthEllipsis value={a}/>)
+        },
+        {
+            title: '领取结果',
+            dataIndex: 'msg',
+            key: 'msg',
+            width: 150,
+            render: (a: string) => (<WidthEllipsis value={a}/>)
+        },
         {
             title: '创建时间',
             dataIndex: 'createTime',
             key: 'createTime',
+            width: 140,
             render: (a: string) => (<WidthEllipsis value={a} />)
         }
     ]

+ 2 - 2
src/services/gameData/roleOperate.ts

@@ -796,11 +796,11 @@ export async function AddPackLinkCodeApi(data: AddPackLinkCodeProps) {
 }
 
 /**
- * 修改礼包码状态
+ * 删除礼包码
  * @param data 
  * @returns 
  */
-export async function updatePackLinkCodeApi(data: { ids: number[], enabled: boolean }) {
+export async function updatePackLinkCodeApi(data: { ids: number[], linkId: number }) {
     return request(apiManage + `/game/gift/pack/link/code/update`, {
         method: 'POST',
         data