diff --git a/package-lock.json b/package-lock.json index 07a6876..700f8b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,12 @@ "dependencies": { "@ant-design/cssinjs": "^1.19.1", "antd": "^5.20.3", + "antd-img-crop": "^4.24.0", "axios": "^1.6.7", "event-source-polyfill": "^1.0.31", "localforage": "^1.10.0", "match-sorter": "^6.3.4", + "moment": "^2.30.1", "pinyin-pro": "^3.19.6", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -1919,6 +1921,20 @@ "react-dom": ">=16.9.0" } }, + "node_modules/antd-img-crop": { + "version": "4.24.0", + "resolved": "https://registry.npmmirror.com/antd-img-crop/-/antd-img-crop-4.24.0.tgz", + "integrity": "sha512-RqY/XqvmUnHlj7oLV2kN/ytdZdHUFAZyM3TN+QlTlLrze1Q74isAePgG+QTkLAbrkR9L/IgVRpjsuH/nevpU7Q==", + "dependencies": { + "react-easy-crop": "^5.2.0", + "tslib": "^2.8.1" + }, + "peerDependencies": { + "antd": ">=4.0.0", + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -3131,6 +3147,14 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/moment": { + "version": "2.30.1", + "resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3167,6 +3191,11 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, + "node_modules/normalize-wheel": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/normalize-wheel/-/normalize-wheel-1.0.1.tgz", + "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==" + }, "node_modules/object-path": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/object-path/-/object-path-0.6.0.tgz", @@ -3968,6 +3997,19 @@ "react": "^18.2.0" } }, + "node_modules/react-easy-crop": { + "version": "5.4.1", + "resolved": "https://registry.npmmirror.com/react-easy-crop/-/react-easy-crop-5.4.1.tgz", + "integrity": "sha512-Djtsi7bWO75vkKYkVxNRrJWY69pXLahIAkUN0mmt9cXNnaq2tpG59ctSY6P7ipJgBc7COJDRMRuwb2lYwtACNQ==", + "dependencies": { + "normalize-wheel": "^1.0.1", + "tslib": "^2.0.1" + }, + "peerDependencies": { + "react": ">=16.4.0", + "react-dom": ">=16.4.0" + } + }, "node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -4380,6 +4422,11 @@ "typescript": ">=4.2.0" } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index e4e4d2a..7e148b4 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,12 @@ "dependencies": { "@ant-design/cssinjs": "^1.19.1", "antd": "^5.20.3", + "antd-img-crop": "^4.24.0", "axios": "^1.6.7", "event-source-polyfill": "^1.0.31", "localforage": "^1.10.0", "match-sorter": "^6.3.4", + "moment": "^2.30.1", "pinyin-pro": "^3.19.6", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/src/App.css b/src/App.css index e69de29..be41e41 100644 --- a/src/App.css +++ b/src/App.css @@ -0,0 +1,14 @@ +.phoneBox{ + display: flex; + justify-content: center; + margin-top: 20px; +} +.phoneBoxInput{ + display: flex; +} +.phoneBoxTitle{ + font-size: 16px; + margin-right: 10px; + line-height: 42px; + /* color: #929292; */ +} \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 68150cf..f31718c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,7 @@ // 引入Provider import { Provider } from 'react-redux'; // 引入仓库 +import './App.css' import store from './store'; import Head from './layout/head/Head.tsx'; import Body from './layout/body/Body.tsx'; @@ -14,13 +15,19 @@ import { GlobalDispatchContext, } from "./context/GlobalContext.ts"; import React, { Reducer, useReducer, useState, useEffect } from "react"; - +import { getCode, checkPhone,updatePhone } from './request/api.ts' import { - message + message, + Modal, + Form, + Button, + Input } from 'antd'; import { get } from "./util/AjaxUtils.ts"; const App: React.FC = () => { const [isTokenFetched, setIsTokenFetched] = useState(false); + const [isUpdateWxUsernamePhone, setIsUpdateWxUsernamePhone] = useState(false); // 绑定手机号号弹窗 + const [form] = Form.useForm(); const globalDataReducer = (state: GlobalData, action: GlobalDataAction) => { if (action.type == GlobalDataActionType.REFRESH_SELF) { if (action.user) { @@ -44,7 +51,98 @@ const App: React.FC = () => { hasUserInfo: false } }); - const [messageApi] = message.useMessage(); + const [userId, setUserId] = useState(''); // 验证码ID + const [messageApi, messageContext] = message.useMessage(); + const submit = async(phone:any,code:any) => { + try{ + const formData = new URLSearchParams(); + formData.append('userId', userId); + formData.append('phone', phone); + formData.append('smsCode', code); + + const res = await updatePhone(formData.toString()); + console.log(res); + + }catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + const onFinish = async (values: any) => { + // console.log('Success:', values); + try { + const res = await checkPhone(values.phone) + console.log(res); + if(res.data == 'SUCCESS'){ + submit(values.phone,values.smsCode) + }else{ + + messageApi.open({ + type: 'error', + content: '手机号已被绑定,请更换手机号', + }); + } + + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + + }; + const [countdown, setCountdown] = useState(0); // 倒计时状态 + + const sendCode = async () => { + try { + // 验证手机号输入项 + await form.validateFields(['phone']); + + setCountdown(120); + console.log('发送验证码'); + const timer = setInterval(() => { + setCountdown((prevCountdown) => { + if (prevCountdown > 0) { + return prevCountdown - 1; + } else { + clearInterval(timer); + return 0; + } + }); + }, 1000); + // 获取表单phone的值 + // const phone = form.getFieldValue('phone'); + await getCode(form.getFieldValue('phone')) + + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + + } + // const nav = useNavigate(); useEffect(() => { @@ -52,6 +150,13 @@ const App: React.FC = () => { messageApi, url: '/api/user-info/get-user-self', onSuccess({ data }: any) { + console.log('嘻嘻嘻', data); + // setIsUpdateWxUsernamePhone(data.isUpdateWxUsernamePhone); + // if (data.isUpdateWxUsernamePhone == 1) { + if (data.isUpdateWxUsernamePhone == 1) { + setIsUpdateWxUsernamePhone(true); + } + setUserId(data.userId); // const currentToken = sessionStorage.getItem('token'); sessionStorage.setItem('token', data.accessToken); const token = sessionStorage.getItem('token'); @@ -82,7 +187,7 @@ const App: React.FC = () => { if (isTokenFetched) { return (
- + {messageContext} @@ -92,7 +197,106 @@ const App: React.FC = () => { + { + // setOrderDetailModal(false) + // }} + onCancel={() => { + setIsUpdateWxUsernamePhone(false); + }} + width={500} + centered + + > +
+
+
+
手机号*
+ + + +
+
+
验证码*
+ + + + {countdown === 0 ? ( +
+ 发送验证码 +
+ ) : ( +
+ 倒计时 {countdown} 秒 +
+ )} +
+
+ + + +
+ +
+
+
+ ); } diff --git a/src/components/OrderDetailModal/OrderDetailModal.tsx b/src/components/OrderDetailModal/OrderDetailModal.tsx index 80903d1..fa43c5b 100644 --- a/src/components/OrderDetailModal/OrderDetailModal.tsx +++ b/src/components/OrderDetailModal/OrderDetailModal.tsx @@ -1,15 +1,75 @@ import { useState, useEffect } from 'react' +import { + Spin +} from 'antd'; import './order-detail-modal.css' import OrderInfo from '../../components/OrderDetailModal/components/OrderInfo/OrderInfo' import GoodsInfo from '../../components/OrderDetailModal/components/GoodsInfo/GoodsInfo' import Copyright from '../../components/OrderDetailModal/components/Copyright/Copyright' import Authorize from '../../components/OrderDetailModal/components/Authorize/Authorize' import File from '../../components/OrderDetailModal/components/File/File' -import Result from '../../components/OrderDetailModal/components/Result/Result' -export default function OrderDetailModal() { +import useMessage from "antd/es/message/useMessage"; +import { orderDetail } from '../../request/api' +// import Result from '../../components/OrderDetailModal/components/Result/Result' +export default function OrderDetailModal(props: any) { + const [messageApi, messageContext] = useMessage(); const height = window.innerHeight - 180; const [activeKey, setActiveKey] = useState('roder') //tap栏选项 默认选第一个 + const [loading, setLoading] = useState(false) + // 订单信息 + // const orderInfo = { + // orderPrice: '11', //订单金额 + // orderStatus: '过户已完成', //订单状态 + // orderTime: '2024-04-25 15:34:10', //下单时间 + // payTime: '2024-04-25 15:34:10', //付款时间 + // cardTime: '2024-04-25 15:34:10', //下证时间 + // evaluateTime: '2024-04-25 15:34:10',//评价时间 + // orderRate: 3, //评价星级 + // rateText: '喜喜喜喜喜喜喜喜喜喜哈哈哈哈' //评价内容 + // } + const [orderInfo, setOrderInfo] = useState({ + payMoney: 0, //金额 + orderStatus: '', //订单状态 + createTime: '',//下单时间 + payTime: '',//付款时间 + produceTime: '',//下证时间 + successTime: '',//评价时间 + evaluateLevel: 0,//评价星级 + evaluateRemark: ''//评价内容 + }) + const [goodsInfo, setGoodsInfo] = useState({ + goodsPhoto: '',//软著图片 + goodsName: '',//软著名称 + goodsNumber: '',//软著编号 + goodsSubName: '',//软著简称 + goodsVersion: '',//软著版本 + goodsGetTime: '',//取得时间 + goodsDevelop: '',//开发语言 + goodsGetType: '',//获取方式 + goodsOpenPrice: '',//售卖价格 + goodsStatusTime: '',//上架时间 + goodsDescription: ''//软著说明 + }) + // 著作权人信息 + const [copyrightInfo, setCopyrightInfo] = useState({ + type: '',//类型 + name: '',//姓名 + city: '',//城市 + phone: '',//电话 + idcardType: '',//证件类型 + idcard: '',//证件号码 + + }) + // 受让人信息 + const [authorizeInfo, setAuthorizeInfo] = useState({ + type: '',//类型 + name: '',//姓名 + city: '',//城市 + phone: '',//电话 + idcardType: '',//证件类型 + idcard: '',//证件号码 + }) // tab栏 标题数组 const tapTitleArray = [ { @@ -22,75 +82,107 @@ export default function OrderDetailModal() { title: '著作权商品信息', className: activeKey == 'goodsInfo' ? 'orderDetailTop-title tapActive' : 'orderDetailTop-title' }, - { - key: 'copyright', - title: ' 著作权人信息', - className: activeKey == 'copyright' ? 'orderDetailTop-title tapActive' : 'orderDetailTop-title' - }, - { - key: 'authorize', - title: '受权人信息', - className: activeKey == 'authorize' ? 'orderDetailTop-title tapActive' : 'orderDetailTop-title' - }, + (props.user == 'sell' ? + { + key: 'copyright', + title: '著作权人信息 ', + className: activeKey === 'copyright' ? 'orderDetailTop-title tapActive' : 'orderDetailTop-title' + } + : {}), + ( + props.user == 'buy' ? + { + key: 'authorize', + title: '受让人信息', + className: activeKey == 'authorize' ? 'orderDetailTop-title tapActive' : 'orderDetailTop-title' + } + : {} + ), + { key: 'file', title: '资料补充', - className: activeKey == 'file' ? 'orderDetailTop-title tapActive' : 'orderDetailTop-title' - }, - { - key: 'result', - title: '过户结果', - className: activeKey == 'result' ? 'orderDetailTop-title tapActive borderRight' : 'orderDetailTop-title borderRight' + className: activeKey == 'file' ? 'orderDetailTop-title tapActive borderRight' : 'orderDetailTop-title borderRight' }, + // { + // key: 'result', + // title: '过户结果', + // className: activeKey == 'result' ? 'orderDetailTop-title tapActive borderRight' : 'orderDetailTop-title borderRight' + // }, ] - // 订单信息 - const orderInfo = { - orderPrice: '11', //订单金额 - orderStatus: '过户已完成', //订单状态 - orderTime: '2024-04-25 15:34:10', //下单时间 - payTime: '2024-04-25 15:34:10', //付款时间 - cardTime: '2024-04-25 15:34:10', //下证时间 - evaluateTime: '2024-04-25 15:34:10',//评价时间 - orderRate: 3, //评价星级 - rateText: '喜喜喜喜喜喜喜喜喜喜哈哈哈哈' //评价内容 + const getOrderDetail = async () => { + try { + setLoading(true) + const res: any = await orderDetail(props.orderId) + setLoading(false) + // console.log(res) + setOrderInfo({ + ...res + }) + setGoodsInfo({ + ...res.goodsDTO + }) + setCopyrightInfo({ + ...res.sellUserDTO + }) + setAuthorizeInfo({ + ...res.buyUserDTO + }) + + + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } } useEffect(() => { // 发起请求获取订单信息 发送给其他组件 - + getOrderDetail() }, []) return ( -
-
- {tapTitleArray.map((item) => { - return ( -
{ - setActiveKey(item.key) - }}> - {item.title} -
- ) - })} -
-
-
- + +
+ {messageContext} +
+ {tapTitleArray.map((item:any) => { + return ( +
{ + setActiveKey(item.key) + }}> + {item.title} +
+ ) + })}
-
- -
-
- -
-
- -
-
- -
-
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ {/*
+
*/}
-
+
) } diff --git a/src/components/OrderDetailModal/components/Authorize/Authorize.tsx b/src/components/OrderDetailModal/components/Authorize/Authorize.tsx index 8f72de9..9d98a1f 100644 --- a/src/components/OrderDetailModal/components/Authorize/Authorize.tsx +++ b/src/components/OrderDetailModal/components/Authorize/Authorize.tsx @@ -1,6 +1,7 @@ import { Input } from "antd"; -export default function Authorize() { +export default function Authorize(props:any) { + const authorizeInfo = props.authorizeInfo return (
@@ -8,7 +9,7 @@ export default function Authorize() { 类别
@@ -9,7 +12,7 @@ export default function Copyright() { 类别
{ + try { + const res: any = await sellSupplementList({ + orderId: props.orderId, + page: page, + rows: 10 + }) + setPage(res.page) + setTotal(res.total) + console.log(res); + setData(res.rows) + // let newData:any = []; + // for (let i = 0; i < 10; i++) { + // newData = newData.concat(res.rows); + // } + // setData(newData); + } catch (error: any) { - ] + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + const getBuySupplementList = async () => { + try { + const res: any = await buySupplementList({ + orderId: props.orderId, + page: page, + rows: 10 + }) + setPage(res.page) + setTotal(res.total) + // console.log(res); + setData(res.rows) + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + const getSupplementDetail = async (id: string) => { + try { + const res: any = await supplementDetail(id) + console.log(res); + + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + useEffect(() => { + if (props.user == 'sell') { + getSellSupplementList() + } else if (props.user == 'buy') { + getBuySupplementList() + } + }, [page]) return (
+ {messageContext} { + setPage(currentPage); + }, + showSizeChanger: false, + current: page + + } + } // pagination={false} // 不显示分页 style={{ textAlign: 'center' }} // 设置表格内容居中显示 - rowKey="fileTitle" // 指定数据项的唯一标识符 + rowKey="orderId" // 指定数据项的唯一标识符 > ( +
{text}
+ )} // render={(text) => ( // {text} // )} /> ( +
{text}
+ )} /> ( - {text} + <> + 待补充 + 已补充 + )} /> @@ -106,16 +166,35 @@ export default function File() { ( { - console.log(record); + console.log(record.correctionId); + setCorrectionId(record.correctionId) + getSupplementDetail(record.correctionId) + setIsModalVisible(true) + }}>查看内容 )} />
+ { + setIsModalVisible(false); + }} + centered + > +
+ {correctionId} +
+
) } diff --git a/src/components/OrderDetailModal/components/GoodsInfo/GoodsInfo.tsx b/src/components/OrderDetailModal/components/GoodsInfo/GoodsInfo.tsx index 9c2b9b9..31ef6f3 100644 --- a/src/components/OrderDetailModal/components/GoodsInfo/GoodsInfo.tsx +++ b/src/components/OrderDetailModal/components/GoodsInfo/GoodsInfo.tsx @@ -1,14 +1,16 @@ import './GoodsInfo.css' import { Input, Image } from "antd"; -import testImg from '../../../../static/test.jpg' +// import testImg from '../../../../static/test.jpg' +import { showImage } from '../../../../request/request' const { TextArea } = Input; -export default function GoodsInfo() { +export default function GoodsInfo(props: any) { + const goodsInfo = props.goodsInfo return (
- 点击放大软著证书
, }}>
@@ -22,7 +24,7 @@ export default function GoodsInfo() { 软著名称
- +
软著详情
+ }} value={orderInfo.evaluateRemark}>
) diff --git a/src/components/OrderDetailModal/components/OrderInfo/Orderinfo.css b/src/components/OrderDetailModal/components/OrderInfo/Orderinfo.css index c59bd1a..9e26042 100644 --- a/src/components/OrderDetailModal/components/OrderInfo/Orderinfo.css +++ b/src/components/OrderDetailModal/components/OrderInfo/Orderinfo.css @@ -1,7 +1,7 @@ .orderDetailBot-order { display: flex; justify-content: space-between; - width: 1100px; + width: 1150px; /* background-color: red; */ flex-wrap: wrap; /* margin-top: 42px; */ @@ -11,6 +11,7 @@ .orderInfo { display: flex; margin-bottom: 29px; + /* position: relative; */ /* align-items: center; */ } diff --git a/src/components/menu/MenuWithBottomButton.tsx b/src/components/menu/MenuWithBottomButton.tsx index 88ce3ae..7ed9512 100644 --- a/src/components/menu/MenuWithBottomButton.tsx +++ b/src/components/menu/MenuWithBottomButton.tsx @@ -19,7 +19,7 @@ export default function MenuWithTopButton(props: IMenuWithTopButton) { setMenuItem( props.list.map((m) => { if (getMenuActive()) { - if (getMenuActive() == m.path) { + if (getMenuActive() == m.id) { m['active'] = true } else { m['active'] = false @@ -33,14 +33,57 @@ export default function MenuWithTopButton(props: IMenuWithTopButton) { const list = menuItem.map((item, index) => ( // 创建项目下三个选项
  • { - props.handleListItem(e, index, item); - if (item.path) { - setMenuActive(item.path) + props.handleListItem(e, index, item); + // if (item.path) { + // setMenuActive(item.id) - navigate(item.path); + // navigate(item.path); + // } + setMenuActive(item.id) + if (item.id == 'PRODUCT') { + navigate('/product-release', { + state: { + sellKeywords: props.sellKeywords, + sellBelongType: props.sellBelongType, + sellDate: props.sellDate, + language: props.language, + sellBoxtype: props.sellBoxtype + } + }) + } + if (item.id == 'TRABSACTION') { + navigate('/transaction-order', { + state: { + sellStatrtTime: props.sellStatrtTime, + sellEndTime: props.sellEndTime, + sellOrderStatus: props.sellOrderStatus, + sellOrderKeywords: props.sellOrderKeywords, + } + }) + } + if (item.id == 'COPYRIGHT') { + navigate('/copyright-goods', { + state: { + copyrightKeywords: props.copyrightKeywords, + minPrice: props.minPrice, + maxPrice: props.maxPrice, + sort: props.sort, + copyrightDate: props.copyrightDate, + copyrightLanguage: props.copyrightLanguage, + copyrightType: props.copyrightType, + } + }) + } + if (item.id == 'TRADING') { + navigate('/trading-goods', { + state: { + tradingKeywords: props.tradingKeywords, + tradingStartTime: props.tradingStartTime, + tradingEndTime: props.tradingEndTime, + tradingStatus: props.tradingStatus, + } + }) } - - // navigate('/home'); }}> @@ -57,9 +100,7 @@ export default function MenuWithTopButton(props: IMenuWithTopButton) { return (
    {/* button 是三个黄色按钮 */} -
    { - props.button.handle(e); - }}> +
    {/* */}
    diff --git a/src/interfaces/menu/IMenuWithTopButton.ts b/src/interfaces/menu/IMenuWithTopButton.ts index e4c0837..e9e5ad7 100644 --- a/src/interfaces/menu/IMenuWithTopButton.ts +++ b/src/interfaces/menu/IMenuWithTopButton.ts @@ -1,11 +1,11 @@ -import {MouseEvent} from "react"; +import { MouseEvent } from "react"; export interface IMenuListItem { id: string; icon?: string; name: string; active?: boolean; - path?:string + path?: string } export interface IMenuButton { @@ -19,19 +19,44 @@ export interface IMenuWithTopButton { list: Array; handleListItem(e: MouseEvent, index: number, item: IMenuListItem): void; - keywords?:string; - type?:string ; - chargeAdditionals?:string; - tagDataId?:string; - authorId?:string; - refunKeywords?:string - applyStatus?:string - payStatus?:string - correctionKeywords?:string - correctionNumType?:string - correctionType?:string - correctionApplyStatus?:string - tagCor?:string + keywords?: string; + type?: string; + chargeAdditionals?: string; + tagDataId?: string; + authorId?: string; + refunKeywords?: string + applyStatus?: string + payStatus?: string + correctionKeywords?: string + correctionNumType?: string + correctionType?: string + correctionApplyStatus?: string + tagCor?: string // disableBelongpeople?:any // enableBelongpeople?:any + sellBelongType?: any, + sellDate?: any, + language?: any, + sellBoxtype?: any, + sellKeywords?: any, + sellStatrtTime?: any, + sellEndTime?: any, + sellOrderStatus?: any, + sellOrderKeywords?: any, + + + + copyrightKeywords?: any, + minPrice?: any, + maxPrice?: any, + sort?: any, + copyrightDate?: any, + copyrightLanguage?: any, + copyrightType?: any, + + tradingKeywords?: any, + tradingStartTime?: any, + tradingEndTime?: any, + tradingStatus?: any, + } \ No newline at end of file diff --git a/src/request/api.ts b/src/request/api.ts index 1803829..c1a57f5 100644 --- a/src/request/api.ts +++ b/src/request/api.ts @@ -1,25 +1,26 @@ -import request from './request' +import {request,newRequest} from './request' +// import newRequest from './request' // 获取登录标志 -export const getLoginflag = (userId:string) => request.get(`/operator-plugin/app/contentcensusrelease/log?requestUrl=网页USER${userId}`) +export const getLoginflag = (userId: string) => request.get(`/operator-plugin/app/contentcensusrelease/log?requestUrl=网页USER${userId}`) // 获取开票记录列表 -export const getInvoiceRecordList = (userId:string,params: any) => request.get(`/operator-plugin/api/invoicerecharge/listpage/${userId}`,{params}) +export const getInvoiceRecordList = (userId: string, params: any) => request.get(`/operator-plugin/api/invoicerecharge/listpage/${userId}`, { params }) // 获取开票信息数组 -export const getInvoiceList = (userId:string,params: any) => request.get(`/operator-plugin/api/invoice-config/listpage/${userId}`,{params}) +export const getInvoiceList = (userId: string, params: any) => request.get(`/operator-plugin/api/invoice-config/listpage/${userId}`, { params }) // 新增开票信息 -export const addInvoiceInfo = (userId:string,params:any) => request.post(`/operator-plugin/api/invoice-config/save/${userId}`,params) +export const addInvoiceInfo = (userId: string, params: any) => request.post(`/operator-plugin/api/invoice-config/save/${userId}`, params) // 获取开票信息 export const getInvoiceInfo = (invoiceId: string) => request.get(`/operator-plugin/api/invoice-config/get/${invoiceId}`) //更新开票信息 -export const updateInvoiceInfo = (invoiceId: string,params:any) => request.put(`/operator-plugin/api/invoice-config/update/${invoiceId}`,params) +export const updateInvoiceInfo = (invoiceId: string, params: any) => request.put(`/operator-plugin/api/invoice-config/update/${invoiceId}`, params) // 删除开票信息 export const deleteInvoiceInfo = (invoiceId: string) => request.delete(`/operator-plugin/api/invoice-config/remove/${invoiceId}`) // 获取可申请开票的充值记录列表 -export const getRechargeRecordList = (userId:string,params: any) => request.get(`/operator-plugin/api/invoicerecharge/recharge-listpage/${userId}/not`,{params}) +export const getRechargeRecordList = (userId: string, params: any) => request.get(`/operator-plugin/api/invoicerecharge/recharge-listpage/${userId}/not`, { params }) //获取开票的充值记录(点击查看开票的充值记录) -export const getInvoiceRechargeList = (invoiceRechargeId:string,params:any) => request.get(`/operator-plugin/api/invoicerecharge/listpage-byid/${invoiceRechargeId}`,{params}) +export const getInvoiceRechargeList = (invoiceRechargeId: string, params: any) => request.get(`/operator-plugin/api/invoicerecharge/listpage-byid/${invoiceRechargeId}`, { params }) // 提交开票申请 -export const submitInvoiceApply = (userId:string,params:any) => request.post(`/operator-plugin/api/invoicerecharge/save/${userId}`,params) +export const submitInvoiceApply = (userId: string, params: any) => request.post(`/operator-plugin/api/invoicerecharge/save/${userId}`, params) // 查看开票信息 export const getInvoiceInfoById = (invoiceRechargeId: string) => request.get(`/operator-plugin/api/invoicerecharge/get/${invoiceRechargeId}`) // 取消开票 @@ -27,4 +28,63 @@ export const cancelInvoice = (invoiceRechargeId: string) => request.put(`/operat // 获取开票信息 export const getInvoiceInfoByinvoiceRechargeId = (invoiceRechargeId: string) => request.get(`/operator-plugin/api/invoicerecharge/get/${invoiceRechargeId}`) // 修改开票信息 -export const updateInvoiceInfoByinvoiceRechargeId = (invoiceRechargeId: string,params:any) => request.put(`/operator-plugin/api/invoicerecharge/update/${invoiceRechargeId}`,params) \ No newline at end of file +export const updateInvoiceInfoByinvoiceRechargeId = (invoiceRechargeId: string, params: any) => request.put(`/operator-plugin/api/invoicerecharge/update/${invoiceRechargeId}`, params) + + + +// 买卖商品接口 +// 获取商品列表 +export const getGoodsList = (params: any) => request.get(`/aishop/api/goods/listpage`, { params }) +// 获取开发语言 +export const getLanguageList = () => request.get(`/aishop/api/data/listbyparentid/f8bf7112-623c-494c-ad29-ccef5cfe2e1f`) +// 获取软著类型 +export const getSoftTypeList = () => request.get(`/aishop/api/data/listbyparentid/0b00884a-f7a2-425f-93e5-599fbaad4bde`) +// 获取商品详情 +export const getGoodsDetail = (goodsId: string) => request.get(`/aishop/api/goods/get/${goodsId}`) +// 获取证件类型 +export const getCertificateTypeList = () => request.get(`/aishop/api/data/listbyparentid/ce3ded65-68ed-4f42-89da-de1b813b8f7e`) +// 获取省份 +export const getProvinceList = () => request.get(`/aishop/api/area/listbyparentid/0`) +// 获取市 +export const getCityList = (provinceId: string) => request.get(`/aishop/api/area/listbyparentid/${provinceId}`) + +// 新增商品 +export const addGoods = (params: any) => request.post(`/aishop/api/goods/save`, params) +// 修改商品 +export const updateGoods = (goodsId: string, params: any) => request.put(`/aishop/api/goods/update/${goodsId}`, params) + +// 提交审核 +export const submitAudit = (goodsId: string) => request.put(`/aishop/api/goods/sub-check/${goodsId}`) + +// 商品上架 +export const putOnShelf = (goodsId: string) => request.put(`/aishop/api/goods/publish/${goodsId}`) +// 商品下架 +export const putOffShelf = (goodsId: string) => request.put(`/aishop/api/goods/no-publish/${goodsId}`) +// 删除商品 +export const deleteGoods = (goodsId: string) => request.delete(`/aishop/api/goods/remove/${goodsId}`) +// 我要卖订单分页列表 +export const getSellOrderList = (params: any) => request.get(`/aishop/api/order/listpage-sell`, { params }) +// 我要买订单分页列表 +export const getBuyOrderList = (params: any) => request.get(`/aishop/api/order/listpage-buy`, { params }) +// 获取订单详情 +export const orderDetail = (orderId: string) => request.get(`/aishop/api/order/get/${orderId}`) + +// 获取卖家补充资料列表 +export const sellSupplementList = (params: any) => request.get(`/aishop/api/correction/listpage-sell`, { params }) + +// 获取买家补充资料列表 +export const buySupplementList = (params: any) => request.get(`/aishop/api/correction/listpage-buy`, { params }) +// 获取补充资料详情 +export const supplementDetail = (correctionId: string) => request.get(`/aishop/api/correction/get/${correctionId}`) +// 获取可以买的商品列表 +export const buyGoodsList = (params: any) => request.get(`/aishop/api/goodsonline/listpage`, { params }) + + + +// 绑定手机号接口 +// 获取验证码 +export const getCode = (phone: number) => request.get(`/operator/api/verify/code/send/${phone}`) +// 验证手机号是否可用 +export const checkPhone = (phone: number) => request.get(`/operator/api/user-wx-update-username/check-phone/${phone}`) +// 更新手机号 +export const updatePhone = (params:any) => newRequest.post(`/operator/oauth/wx/update/phone`, params) diff --git a/src/request/request.ts b/src/request/request.ts index 049d746..80f7deb 100644 --- a/src/request/request.ts +++ b/src/request/request.ts @@ -1,6 +1,11 @@ import axios from "axios"; -const baseURL = 'http://192.168.0.115:8099'; +// const baseURL = 'http://192.168.0.115:8099'; // 开票功能baseUrl +// const baseURL = 'http://192.168.0.115:8081'; //买卖功能baseUrl + +const baseURL = 'http://192.168.0.15:8091'; //绑定手机号baseUrl + // const baseURL = 'https://www.aimzhu.com'; + const request = axios.create({ baseURL: baseURL, timeout: 5000, @@ -23,10 +28,37 @@ request.interceptors.response.use( }, (err) => Promise.reject(err) ); +const newRequest = axios.create({ + baseURL: baseURL, + timeout: 5000, +}); +newRequest.interceptors.request.use( + (config) => { + // 有token带token + + return config; + }, + + (err) => Promise.reject(err) +); +newRequest.interceptors.response.use( + (res) => { + return res.data; + }, + (err) => Promise.reject(err) +); // 下载发票 export const downloadInvoice = (id: string) => { return `${baseURL}/operator-plugin/route/file/download/false/${id}` }; - -export default request \ No newline at end of file +// 显示图片 +export const showImage = (fileId: string, isDownload?: boolean) => { + return `${baseURL}/aishop/route/file/download/${isDownload == false}/${fileId}` +} +// 上传图片 +export const uploadImageUrl = () => { + return `${baseURL}/aishop/api/file/v2/upload-image` +} +// export default request +export { newRequest ,request}; \ No newline at end of file diff --git a/src/route/CopyrightGgoods/CopyrightGgoods.tsx b/src/route/CopyrightGgoods/CopyrightGgoods.tsx index 9280b5e..217fc9b 100644 --- a/src/route/CopyrightGgoods/CopyrightGgoods.tsx +++ b/src/route/CopyrightGgoods/CopyrightGgoods.tsx @@ -1,347 +1,221 @@ import './copyrightG-goods.css' import { - Select, DatePicker, Button, Table, + // Select, DatePicker, Button, + Table, // message, - Space, Empty, Pagination, InputNumber + Space, + Pagination, + // InputNumber + Spin, + Modal, + Image } from 'antd'; -import type { InputNumberProps } from 'antd'; +import { useLocation } from 'react-router-dom'; +import dayjs, { } from 'dayjs'; +import { buyGoodsList } from '../../request/api' +// import type { InputNumberProps } from 'antd'; // import type { TableColumnsType } from 'antd'; -import { SearchOutlined, ClearOutlined } from '@ant-design/icons'; -import type { DatePickerProps } from 'antd'; -import locale from 'antd/es/date-picker/locale/zh_CN'; -import { useState } from 'react'; +// import { SearchOutlined, ClearOutlined } from '@ant-design/icons'; +// import type { DatePickerProps } from 'antd'; +// import locale from 'antd/es/date-picker/locale/zh_CN'; +import { useState, useEffect } from 'react'; +import useMessage from "antd/es/message/useMessage"; const { Column } = Table; export default function CopyrightGgoods() { + const [messageApi, messageContext] = useMessage(); const height = window.innerHeight - 180; + const [goodsId, setGoodsId] = useState() //商品ID + const [goodsDetailModal, setGoodsDetailModal] = useState(false) //订单详情 + // const [messageApi, contextHolder] = message.useMessage(); - const dateFormat = 'YYYY年MM月DD日'; - const [minPrice, setMinPrice] = useState() //最低价格 - const [maxPrice, setMaxPrice] = useState() //最高价格 - const [date, setDate] = useState() //获取时间 - const [sort, setSort] = useState() //排序 - const [language, setLanguage] = useState() //开发语言 - const [type, setType] = useState() //软著类型 - const [page, setPage] = useState(1) //分页 - // 更改最低价格 - const minPriceChange: InputNumberProps['onChange'] = (value) => { - console.log('changed', value); - setMinPrice(value) - }; - // 更改最高价格 - const maxPriceChange: InputNumberProps['onChange'] = (value) => { - console.log('changed', value); - setMaxPrice(value) - }; - // 更改价格排序 - const sortChange = (value: string) => { - console.log(`selected ${value}`) - setSort(value) + // const dateFormat = 'YYYY-MM-DD'; + // const [minPrice, setMinPrice] = useState() //最低价格 + // const [maxPrice, setMaxPrice] = useState() //最高价格 + // const [date, setDate] = useState() //获取时间 + // const [sort, setSort] = useState() //排序 + // const [language, setLanguage] = useState() //开发语言 + // const [type, setType] = useState() //软著类型 + const [page, setPage] = useState(1) //页 + const [total, setTotal] = useState(0) //总条数 + const [loading, setLoading] = useState(false) //加载中 + const { state } = useLocation() + const copyrightKeywords = state ? state.copyrightKeywords : ''; // 版权关键字 + const minPrice = state ? state.minPrice : ''; // 最低价格 + const maxPrice = state ? state.maxPrice : ''; // 最高价格 + const sort = state ? state.sort : ''; // 排序 + const copyrightDate = state ? state.copyrightDate : ''; // 版权日期 + const copyrightLanguage = state ? state.copyrightLanguage : ''; // 开发语言 + const copyrightType = state ? state.copyrightType : ''; // 软著类型 + + + const [data, setData] = useState([]); // 表格数据 + const getBuyGoodsList = async (page: number) => { + try { + setLoading(true) + const res: any = await buyGoodsList({ + page: page, + rows: 10, + keywords: copyrightKeywords ? copyrightKeywords : '', // 版权关键字 + priceRangeStart: minPrice ? minPrice : '', // 最低价格 + priceRangeEnd: maxPrice ? maxPrice : '', // 最高价格 + priceOrder: sort ? sort : '', // 排序 + goodsGetTime: copyrightDate ? dayjs(copyrightDate).year() : '', // 版权日期 + goodsDevelop: copyrightLanguage ? copyrightLanguage : '', // 开发语言 + goodsType: copyrightType ? copyrightType.join(',') : '', // 软著类型 + }) + console.log(res); + + setLoading(false) + setPage(res.page) + setData(res.rows) + setTotal(res.total) + setLoading(false) + + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } } - // 更改开发语言 - const languageChange = (value: string) => { - console.log(`selected ${value}`) - setLanguage(value) - } - // 软著类型更改 - const typeChange = (value: string) => { - console.log(`selected ${value}`); - setType(value) - } - // 获取时间更改 - const dateChange: DatePickerProps['onChange'] = (date, dateString) => { - console.log(date, dateString); - setDate(date) - }; - // 点击搜索 - const onSearch = () => { + + useEffect(() => { + console.log('copyrightKeywords', copyrightKeywords); + console.log('minPrice', minPrice); + console.log('maxPrice', maxPrice); + console.log('sort', sort); + console.log('copyrightDate', copyrightDate); + console.log('copyrightLanguage', copyrightLanguage); + console.log('copyrightType', copyrightType); + + if (copyrightDate) { + console.log('sellDate', dayjs(copyrightDate).year()); + } setPage(1) - console.log(minPrice, maxPrice, date, sort, language, type); - - } - // 初始化搜索条件 - const init = () => { - setMinPrice(undefined) - setMaxPrice(undefined) - setDate(undefined) - setSort(undefined) - setLanguage(undefined) - setType(undefined) - } - // 点击清除 - const clearKeyWords = () => { - setPage(1) - init() - } - interface DataType { - name: string - short: string - number: string - price: string - version: string - time: string - language: string - } - - const data: DataType[] = [ - { - name: '智能管理系统', - short: '简称', - number: '312345678912345617891', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: '商城管理系统', - short: '简称', - number: '11234567891234567892', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567893', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567894', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567895', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567896', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567897', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567898', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567899', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - { - name: 'xx系统', - short: '简称', - number: '21234567891234567890', - price: '5.00', - version: '1-1-1', - time: '2020-04-19 15:42:21', - language: 'java' - }, - ]; - - + getBuyGoodsList(1) + }, [state]) return (
    + {messageContext} {/* {contextHolder} */} -
    - - 至 - - - - - - {/* */} -
    +
    */}
    {/* 表格 */} -
    - {data.length == 0 ? ( -
    - -
    ) : ( -
    - - - - - - - - - - - - - - - - {data.map((item: any, index: any) => { - return ( - - - - - - - - - - - - - - - - - - - + +
    + {data.length <= 0 ? ( +
    + +
    ) : ( +
    序号软著名称软著版本售卖价格截止售卖时间著作权上架平台审核操作
    +
    -
    - {/* checkChange(event, item) - }> */} - - 编号: {item.order} - - - 软著取得时间: {item.time1} - -
    {index + 1} -
    - {item.img} -
    -
    -
    - {item.name} -
    -
    - (接口软著) -
    -
    {item.v}{item.price}{item.time2} - { opneChange(e, item) }} defaultChecked={item.open == 0 ? false : true} /> - {item.status} - { - edit(item) - }}>编辑 - del(item)}>删除 - sell(item)}>出售 - submit(item)}>提交审核 -
    + + + + + + + + + {/* */} + + + + + + {data.map((item: any, index: any) => { + return ( + + + + + + + + + + + + + + + {/* */} + + + + + + + ) + })} + + +
    序号软著名称软著版本售卖价格截止售卖时间著作权上架平台审核操作
    + +
    + {/* checkChange(event, item) + }> */} + + 编号 : {item.goodsNumber} + + + 软著取得时间 : {item.goodsGetTime} + +
    {index + 1} +
    + +
    +
    + + {item.goodsName} + {/* {item.goodsName} + {item.goodsName} + {item.goodsName} + {item.goodsName} + {item.goodsName} */} + + {/*
    + (接口软著) +
    */} +
    {item.goodsVersion}{item.goodsPrice}{item.goodsLastTime} + { opneChange(e, item) }} defaultChecked={item.open == 0 ? false : true} /> + + {item.goodsCheckStatus == '0' ? + 未通过 + : item.goodsCheckStatus == '1' ? + 审核中 + : item.goodsCheckStatus == '2' ? + 已通过 + : '未提交'} +
    + { + edit(item) + }}>编辑 + submit(item)}>提交审核 + del(item)}>删除 + sell(item)}>上架 + off(item)}>下架 +
    +
    + ) + } - ) - })} - - - {/*
    */}
    + - )} + {/* )} */}
    @@ -340,7 +485,7 @@ export default function ProductRelease() {
    { + current={page} total={total} defaultPageSize={10} onChange={(page) => { // console.log(page) setPage(page) }} /> @@ -356,10 +501,14 @@ export default function ProductRelease() { onCancel={() => { setEditModalOpen(false); }} + centered > -
    - { setEditModalOpen(false) }} > -
    + {/*
    */} + { setEditModalOpen(false) }} + getGoodsDate={getGoodsDate} + id={id} + > + {/*
    */} {/* 删除弹窗 */} { - setDelModalOpen(false) + // setDelModalOpen(false) + delOk() }} onCancel={() => { setDelModalOpen(false) @@ -384,17 +534,18 @@ export default function ProductRelease() { width: 700, marginTop: 20 }}> - 删除后这条信息将不被保存,确定删除吗? + 删除后这条信息将不被保存,确定删除{delName}吗?
    {/* 出售弹窗 */} - { - setSellModalOpen(false) + // setSellModalOpen(false) + sellOk() }} onCancel={() => { setSellModalOpen(false) @@ -410,7 +561,60 @@ export default function ProductRelease() { width: 700, marginTop: 20 }}> - 确定出售接口管理系统的软件著作权证吗? + 确定将{sellName}上架吗? +
    + + { + // setSellModalOpen(false) + offOk() + }} + onCancel={() => { + setOffModalOpen(false) + }} + okButtonProps={{ style: { background: '#28915A', color: 'white' } }} + style={{ + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + height: `${height}px`, + }}> +
    + 确定将{offName}下架吗? +
    +
    + { + submitAuditOk() + + }} + onCancel={() => { + + setSubmitModalOpen(false) + }} + // okButtonProps={{ style: { background: 'red', color: 'white' } }} + style={{ + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + height: `${height}px`, + }}> +
    + 确定将{submitName}提交审核吗?
    diff --git a/src/route/ProductRelease/components/EditModal/EditModal.css b/src/route/ProductRelease/components/EditModal/EditModal.css index 017e6e8..caede2a 100644 --- a/src/route/ProductRelease/components/EditModal/EditModal.css +++ b/src/route/ProductRelease/components/EditModal/EditModal.css @@ -26,12 +26,14 @@ .editModal-img-box { width: 489px; - height: 50px; + height: 154px; background: #F8F8F8; border-radius: 5px; display: flex; justify-content: space-between; align-items: center; + padding: 0 20px; + box-sizing: border-box; } .css-dev-only-do-not-override-1ae8k9u.ant-select-outlined.ant-select-multiple .ant-select-selection-item { @@ -52,4 +54,4 @@ border: 0; background: #E1E1E1; border-radius: 0; -} \ No newline at end of file +} diff --git a/src/route/ProductRelease/components/EditModal/EditModal.tsx b/src/route/ProductRelease/components/EditModal/EditModal.tsx index b07134f..8b4a59f 100644 --- a/src/route/ProductRelease/components/EditModal/EditModal.tsx +++ b/src/route/ProductRelease/components/EditModal/EditModal.tsx @@ -10,47 +10,84 @@ import { Cascader, message, Upload, - UploadFile + UploadFile, + Image } from "antd"; +import { + ArrowRightOutlined +} from '@ant-design/icons'; +import dayjs, { } from 'dayjs'; +// import ImgCrop from 'antd-img-crop'; +import moment from 'moment'; +import ruanzhu from '../../../../static/ruanzhu.jpg' import type { GetProp, UploadProps } from 'antd'; import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'; import { useEffect, useState } from "react"; -import { get ,uploadImageUrl,DevUserId,downloadUrl} from "../../../../util/AjaxUtils"; +import { + // get, + // DevUserId, + // downloadUrl +} from "../../../../util/AjaxUtils"; // import type { InputNumberProps } from 'antd'; import locale from 'antd/es/date-picker/locale/zh_CN'; import './EditModal.css' -import { ITree } from "../../../../interfaces/dict/IDict"; -const dateFormat = 'YYYY年MM月DD日'; +// import { ITree } from "../../../../interfaces/dict/IDict"; +import { getGoodsDetail, getLanguageList, getSoftTypeList, getCertificateTypeList, getProvinceList, getCityList, addGoods, updateGoods } from '../../../../request/api' +import { showImage, uploadImageUrl } from '../../../../request/request' +const dateFormat = 'YYYY-MM-DD'; const { TextArea } = Input; interface Option { value?: string | number | null; label: React.ReactNode; children?: Option[]; isLeaf?: boolean; - id: string; - pId: string; + // id: string; + // pId: string; } type FileType = Parameters>[0]; export default function EditModal(props: any) { + const token = sessionStorage.getItem('token') + const [startTime, setStartTime] = useState(undefined); + useEffect(() => { + // 当startTime发生改变时清空截止时间 + form.setFieldsValue({ + time2: undefined, + }) + }, [startTime]) + const defaultPickerValue = () => { + if (startTime) { + const oneMonthLater = startTime.clone().add(1, 'month'); + const now = moment(); + // 比较 oneMonthLater 和 now,返回较晚的日期 + + if (oneMonthLater.isAfter(now)) { + return oneMonthLater; + } + } + + } + const [isDatePickerOpen, setIsDatePickerOpen] = useState(false); const [messageApi, contextHolder] = message.useMessage(); const height = window.innerHeight - 180; const [areaArray, setAreaArray] = useState([]); - const listArea = (pId: string) => { - return new Promise((resolve) => { - get({ - messageApi, - url: '/api/area/list-area-ztree', - config: { - params: { - id: pId - } - }, - onSuccess({ data }) { - resolve(data); - } - }) - }) - } + // const listArea = (pId: string) => { + // return new Promise((resolve) => { + // get({ + // messageApi, + // url: '/api/area/list-area-ztree', + // config: { + // params: { + // id: pId + // } + // }, + // onSuccess({ data }) { + // resolve(data); + // console.log('这个是啥',data); + + // } + // }) + // }) + // } const [form] = Form.useForm(); const [promptModal, setPromptModal] = useState(false) // 上传图片 @@ -68,20 +105,44 @@ export default function EditModal(props: any) { // return isJpgOrPng && isLt2M; return isJpgOrPng; }; - + const [loading, setLoading] = useState(false); // const [imageUrl, setImageUrl] = useState(); - - + const [date, setDate] = useState({ + goodsDescription: '', //软著说明 + goodsDevelop: '', //软著开发语言 + goodsGetTime: '',//软著取得时间 + goodsGetType: '',//软著获取方式(1平台申请,2自主研发,3交易取得) + goodsLastTime: '',// 软件截止售卖时间 + goodsLeader: '',// 软著所有者姓名 + goodsLeaderCity1: '',// 软著所有者所在省 + goodsLeaderCity2: '',// 软著所有者所在市 + goodsLeaderIdcard: '',// 软著所有者证件号 + goodsLeaderIdcardType: '',//软著所有者证件类型 + goodsLeaderPhone: '',// 软著所有者手机号 + goodsLeaderType: '',// 软著所有者类型(1企业,2个人) + goodsName: '',// 软件名称 + goodsNumber: '',// 软著编号 + goodsPrice: 0,// 软著价格 + goodsPhoto: '',// 软著图片 + goodsSubName: '',// 软著简称 + goodsType: '',// 软著类型 + goodsVersion: '',// 软著版本 + }); + const handleChange: UploadProps['onChange'] = (info) => { + if (info.file.status === 'uploading') { setLoading(true); return; } if (info.file.status === 'done') { setLoading(false); + const fileId = info.file.response.data.fileId; - const url = downloadUrl(fileId); + // console.log(downloadUrl(fileId)); + + const url = showImage(fileId, false); logoImgArray.splice(0, 1, { uid: info.file.response.data.fileId, name: 'xixi.png', @@ -101,28 +162,313 @@ export default function EditModal(props: any) { {loading ? : } ); - useEffect(() => { - listArea('0').then(data => { - // console.log('省市1', data); - // data.slice(0, 2).map - const options: Option[] = data.map(item => { - return { - value: item.name, - label: item.name, - isLeaf: !item.isParent, - id: item.id, - pId: item.pId - } - }) + const getProvinceListDate = async () => { + try { + const res: any = await getProvinceList() + // console.log('省', res); + const provinces = res.map((province: any) => ({ + value: province.areaId, + label: province.areaName, + isLeaf: false, + // id: province.areaId, + children: [], // 初始化 children 属性为空数组 + })); + setAreaArray(provinces); + + } catch (error: any) { + + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + useEffect(() => { + // listArea('0').then(data => { + // console.log('省市1', data); + // data.slice(0, 2).map + // const options: Option[] = data.map(item => { + // return { + // value: item.name, + // label: item.name, + // isLeaf: !item.isParent, + // id: item.id, + // pId: item.pId + // } + // }) + + // setAreaArray(options); + // console.log('省市2', options); + // }); + getProvinceListDate() + }, []) + // 加载城市列表 + const loadCityList = async (selectedOptions: Option[]) => { + const targetOption = selectedOptions[selectedOptions.length - 1]; + // console.log('targetOption', targetOption.children); + try { + const res: any = await getCityList(targetOption.value as string); + // console.log('城市列表', res); + + const cities = res.map((city: any) => ({ + value: city.areaId, + label: city.areaName, + + })); + targetOption.children = cities; + // 更新 areaArray 状态 + setAreaArray([...areaArray]); + } catch (error: any) { + + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + }; + + const goodsDetail = async (id: string) => { + try { + + const res: any = await getGoodsDetail(id) + console.log('商品详情', res); + const cityChildren: any = await getCityList(res.goodsLeaderCity1 as string) + const cityOptions = cityChildren.map((city: any) => ({ + value: city.areaId, + label: city.areaName, + })) + const newRes: any = await getProvinceList() + const provinces = newRes.map((province: any) => ({ + value: province.areaId, + label: province.areaName, + isLeaf: false, + children: [], + })); + // 找到provinces睡得value是res.goodsLeaderCity1的那个对象把children赋值为cityOptions + const provinceIndex = provinces.findIndex((province: any) => province.value === res.goodsLeaderCity1) + provinces[provinceIndex].children = cityOptions + setAreaArray(provinces) + + + + // 给form表单赋值 + form.setFieldsValue({ + name: res.goodsName, + smallname: res.goodsSubName, + imageUrl: res.goodsPhoto, + number: res.goodsNumber, + sv: res.goodsVersion, + textArea: res.goodsDescription, + // time:moment(res.goodsGetTime) + time: dayjs(res.goodsGetTime, 'YYYY-MM-DD'), + // dayjs(data.projDevCompleteDate, 'YYYY-MM-DD') + use: res.goodsGetType, + language: res.goodsDevelop, + class: res.goodsType.split(','), + price: res.goodsPrice, + goodsLastTime: dayjs(res.goodsLastTime, 'YYYY-MM-DD'), + peopleClass: res.goodsLeaderType, + peopleName: res.goodsLeader, + peoplePhone: res.goodsLeaderPhone, + papersType: res.goodsLeaderIdcardType, + papersNum: res.goodsLeaderIdcard, + authorProvince: [res.goodsLeaderCity1, res.goodsLeaderCity2], + + }) + setStartTime(moment(res.goodsGetTime)) + // 给logoImgArray赋值 + logoImgArray.splice(0, 1, { + uid: res.goodsPhoto, + name: 'xixi.png', + status: 'done', + url: showImage(res.goodsPhoto, false), + thumbUrl: showImage(res.goodsPhoto, false), + }) + } catch (error: any) { + + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + // 新增商品 + const clickAddGoods = async () => { + try { + await addGoods(date) + messageApi.open({ + type: 'success', + content: '保存成功', + }) + setPromptModal(false) + + // 过几秒在关闭弹窗 + setTimeout(() => { + props.closeModal() + props.nav() + }, 500); + + } catch (error: any) { + + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + //修改商品 + const clickUpdateGoods = async () => { + try { + await updateGoods(props.id, date) + // props.onCancel() + messageApi.open({ + type: 'success', + content: '修改成功', + }) + setPromptModal(false) + // 过几秒在关闭弹窗 + setTimeout(() => { + props.closeModal() + props.getGoodsDate() + }, 500); + + } catch (error: any) { + + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + const [languageList, setLanguageList] = useState([]) // 开发者语言列表 + // 获取语言列表 + const getLanguageListDate = async () => { + try { + const res: any = await getLanguageList() + // console.log('语言列表',res); + setLanguageList(res.map((item: any) => { + return { + value: item.dataId, + label: item.dataName, + } + })) + + + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + const [softTypeList, setSoftTypeList] = useState([]) // 软著类型列表 + // 获取软著类型列表 + const getSoftTypeListDate = async () => { + try { + const res: any = await getSoftTypeList() + // console.log('软著类型列表', res); + setSoftTypeList(res.map((item: any) => { + return { + value: item.dataId, + label: item.dataName, + } + })) + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + const [certificateTypeList, setCertificateTypeList] = useState([]) // 证书类型列表 + // 获取证书类型列表 + const getCertificateTypeListDate = async () => { + try { + const res: any = await getCertificateTypeList() + setCertificateTypeList(res.map((item: any) => { + return { + value: item.dataId, + label: item.dataName, + } + })) + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + } + useEffect(() => { + getLanguageListDate() + getSoftTypeListDate() + getCertificateTypeListDate() - setAreaArray(options); - // console.log('省市2', options); - }); }, []) + useEffect(() => { + if (props.id) { + console.log('props.id', props.id); + goodsDetail(props.id) + } + }, [props.id]) return ( -
    +
    {contextHolder}
    @@ -136,12 +482,46 @@ export default function EditModal(props: any) { labelCol={{ span: 8 }} wrapperCol={{ span: 24 }} // style={{ width: '600px' }} - onFinish={() => { + onFinish={(value) => { + console.log('上传图片的 ID', logoImgArray) + // 打印form表单所有的值 + console.log(form.getFieldsValue()) + // console.log(form.getFieldValue('imageUrl')); + // console.log(logoImgArray); + const formattedTime = dayjs(value.time).format('YYYY-MM-DD'); + console.log('嘻嘻', formattedTime); setPromptModal(true); + setDate({ + goodsDescription: value.textArea, //软著说明 + goodsDevelop: value.language, //软著开发语言 + goodsGetTime: dayjs(value.time).format('YYYY-MM-DD'),//软著取得时间 + goodsGetType: value.use,//软著获取方式(1平台申请,2自主研发,3交易取得) + goodsLastTime: dayjs(value.goodsLastTime).format('YYYY-MM-DD'),// 软件截止售卖时间 + goodsLeader: value.peopleName,// 软著所有者姓名 + goodsLeaderCity1: value.authorProvince[0],// 软著所有者所在省 + goodsLeaderCity2: value.authorProvince[1],// 软著所有者所在市 + goodsLeaderIdcard: value.papersNum,// 软著所有者证件号 + goodsLeaderIdcardType: value.papersType,//软著所有者证件类型 + goodsLeaderPhone: value.peoplePhone,// 软著所有者手机号 + goodsLeaderType: value.peopleClass,// 软著所有者类型(1企业,2个人) + goodsName: value.name,// 软件名称 + goodsNumber: value.number,// 软著编号 + goodsPrice: value.price,// 软著价格 + goodsPhoto: logoImgArray[0].uid,// 软著图片 + goodsSubName: value.smallname,// 软著简称 + goodsType: value.class.join(','),// 软著类型 + goodsVersion: value.sv,// 软著版本 + }) + }} + onFinishFailed={() => { + messageApi.open({ + type: 'error', + content: '请填写完整信息', + }) }} autoComplete="off" > - + {/* @@ -182,12 +562,12 @@ export default function EditModal(props: any) { ]) }} > - {logoImgArray.length > 0 ? avatar : uploadButton} + {logoImgArray.length > 0 ? avatar : uploadButton}
    -
    - {logoImgArray.length > 0 ?'点击图片更换':'点击+上传图片'} - +
    + {logoImgArray.length > 0 ? '点击图片更换' : '点击+上传图片'} +
    @@ -197,6 +577,7 @@ export default function EditModal(props: any) { +
    @@ -300,9 +681,7 @@ export default function EditModal(props: any) { name="java" rules={[{ required: true, message: '请选择开发语言' }]} > - {/* */} + - {/* */} @@ -395,6 +771,387 @@ export default function EditModal(props: any) { + */} + + + {/*
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    */} +
    +
    + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    + {/* */} + { + logoImgArray.splice(0) + setLogoImgArray([ + ...logoImgArray + ]) + }} + disabled={logoImgArray.length > 0} + > + {/* {logoImgArray.length > 0 ? avatar : uploadButton} */} + {/* {logoImgArray.length > 0 ? avatar : uploadButton} */} + {logoImgArray.length > 0 ? ( +
    + avatar + + +
    + ) : ( + uploadButton + )} +
    + {/*
    */} +
    {logoImgArray.length > 0 ? '' : '点击上传图片'}
    + +
    +
    +
    +
    +
    示例图片
    +
    点击图片放大查看
    +
    +
    + + + +
    + + + +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +