请求头加入Content-Type
This commit is contained in:
parent
151ff2a3fe
commit
3c63397501
345
src/components/AiShopDetail/AiShopDetail.tsx
Normal file
345
src/components/AiShopDetail/AiShopDetail.tsx
Normal file
@ -0,0 +1,345 @@
|
||||
// import React from 'react'
|
||||
import {
|
||||
Modal,
|
||||
Spin,
|
||||
|
||||
Image,
|
||||
Button,
|
||||
Input,
|
||||
Checkbox
|
||||
} from 'antd';
|
||||
import { GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
|
||||
import { goodsDetail, createOrder, confirmPayment } from '../../request/api'
|
||||
import { showImage } from '../../request/request'
|
||||
import { useState, useEffect,useContext } from 'react';
|
||||
import useMessage from "antd/es/message/useMessage";
|
||||
const { TextArea } = Input;
|
||||
export default function AiShopDetail(props: any) {
|
||||
const globalDispatchContext = useContext(GlobalDispatchContext);
|
||||
const [isAgreed, setIsAgreed] = useState(false); // 新增状态,用于记录是否同意协议
|
||||
const [messageApi, messageContext] = useMessage();
|
||||
const [loading, setLoading] = useState(false) //加载中
|
||||
const [goodsDetailData, setGoodsDetailData] = useState<any>({}) // 商品详情数据
|
||||
const [buyTipsModal, setBuyTipsModal] = useState(false) //卖提示框
|
||||
const [showTips, setShowTips] = useState(false) // 提示框
|
||||
const [goodsId, setGoodsId] = useState<any>() //商品ID
|
||||
const getGoodsDetail = async (goodsId: string) => {
|
||||
try {
|
||||
setLoading(true)
|
||||
const res: any = await goodsDetail(goodsId)
|
||||
// console.log(res);
|
||||
setGoodsId(res.goodsId)
|
||||
setGoodsDetailData(res)
|
||||
setLoading(false)
|
||||
} catch (error: any) {
|
||||
// setLoading(false)
|
||||
if (error.response) {
|
||||
const data = error.response.data;
|
||||
messageApi.open({
|
||||
type: 'error',
|
||||
content: data.msg ? data.msg : `${data.path}(${data.status})`,
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
// 创建订单
|
||||
const createOrderFun = async (goodsId: string) => {
|
||||
try {
|
||||
// setPayLoading(true)
|
||||
const res: any = await createOrder(goodsId)
|
||||
// console.log(res);
|
||||
confirmPaymentFun(res.data)
|
||||
|
||||
} 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 confirmPaymentFun = async (orderId: string) => {
|
||||
try {
|
||||
// setLoading(true)
|
||||
const res: any = await confirmPayment(orderId)
|
||||
console.log(res);
|
||||
// setLoading(false)
|
||||
reloadUser(messageApi, globalDispatchContext).then(() => {
|
||||
messageApi.success('扣款成功');
|
||||
});
|
||||
} 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(() => {
|
||||
getGoodsDetail(props.goodsId)
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
{messageContext}
|
||||
<Spin tip="正在加载..." size="small" spinning={loading}>
|
||||
<div className='goodsDetail'>
|
||||
<div className='goodsDetailImg' style={{
|
||||
position: 'relative',
|
||||
}}>
|
||||
<Image src={showImage(goodsDetailData.goodsPhoto, false)} preview={{
|
||||
mask: '查看', // 设置点击放大时显示的文字
|
||||
}}
|
||||
height={'100%'}
|
||||
style={{ maxWidth: '100%' }}
|
||||
></Image>
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
bottom: '3px',
|
||||
left: '265px',
|
||||
color: 'rgb(160, 160, 160)',
|
||||
// backgroundColor: 'rgba(0, 0, 0, 0.5)', // 半透明背景色
|
||||
}}>点击查看</div>
|
||||
</div>
|
||||
<div className='goodsDetailInputBox'>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle'>软著名称</div>
|
||||
<Input value={goodsDetailData.goodsName} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle'>软著简称</div>
|
||||
<Input value={goodsDetailData.goodsSubName} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
<div className='detailBox detailBoxRight'>
|
||||
<div className='detailBoxTitle'>软著证号</div>
|
||||
<Input value={goodsDetailData.goodsNumber} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle'>软著版本</div>
|
||||
<Input value={goodsDetailData.goodsVersion} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle detailBoxRight'>取得时间</div>
|
||||
<Input value={goodsDetailData.goodsGetTime} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle'>开发语言</div>
|
||||
<Input value={goodsDetailData.goodsDevelop} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle detailBoxRight'>取得方式</div>
|
||||
<Input value={goodsDetailData.goodsGetType} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle'>售卖价格</div>
|
||||
<Input value={goodsDetailData.goodsOpenPrice} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
<div className='detailBox'>
|
||||
<div className='detailBoxTitle detailBoxRight'>上架时间</div>
|
||||
<Input value={goodsDetailData.goodsStatusTime} style={{
|
||||
// height: '40px',
|
||||
color: 'black',
|
||||
|
||||
}} disabled></Input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className='detailBoxText'>
|
||||
<div className='detailBoxTitle'>软著详情</div>
|
||||
<TextArea
|
||||
disabled
|
||||
style={{
|
||||
width: '100%',
|
||||
// width: 1100,
|
||||
height: 150,
|
||||
fontSize: 16,
|
||||
color: "#5C5C5C",
|
||||
resize: 'none',
|
||||
background: '#F5F5F9'
|
||||
}} value={goodsDetailData.goodsDescription}></TextArea>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style={{
|
||||
position: 'relative',
|
||||
// background:'pink'
|
||||
marginTop: 10,
|
||||
marginLeft: 20
|
||||
}}>
|
||||
<Checkbox checked={isAgreed} onChange={(value) => {
|
||||
setIsAgreed(!isAgreed)
|
||||
// if (value) {
|
||||
// setShowTips(false)
|
||||
// }
|
||||
// console.log(value.target.checked);
|
||||
if (value.target.checked) {
|
||||
setShowTips(false)
|
||||
}
|
||||
// else{
|
||||
// setShowTips(true)
|
||||
// }
|
||||
|
||||
}}>
|
||||
|
||||
</Checkbox>
|
||||
<span style={{
|
||||
marginLeft: 10,
|
||||
}}>我同意平台 <a onClick={() => {
|
||||
// window.open('https://www.aimzhu.com/Seda.html')
|
||||
}}>《购买协议》</a></span>
|
||||
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: '25px',
|
||||
left: '20px',
|
||||
color: 'red',
|
||||
// background:'skyblue',
|
||||
fontSize: 12,
|
||||
display: showTips ? 'unset' : 'none',
|
||||
|
||||
}}>请阅读并且勾选《购买协议》</div>
|
||||
</div>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
marginTop: 20
|
||||
}}>
|
||||
<Button style={{
|
||||
marginRight: 20,
|
||||
fontSize: 16,
|
||||
color: '#7C7C7C ',
|
||||
background: '#E9E9E9',
|
||||
fontWeight: '700',
|
||||
height: 40,
|
||||
width: 100,
|
||||
|
||||
}}
|
||||
onClick={() => {
|
||||
// setGoodsDetailModal(false)
|
||||
props.closeModal()
|
||||
}}
|
||||
|
||||
>返回</Button>
|
||||
<Button style={{
|
||||
fontSize: 16,
|
||||
// color: '#FFFFFF',
|
||||
// background: '#FFA800',
|
||||
fontWeight: '700',
|
||||
height: 40,
|
||||
width: 100,
|
||||
|
||||
}}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
// setBuyTipsModal(true)
|
||||
if (isAgreed) {
|
||||
setBuyTipsModal(true);
|
||||
} else {
|
||||
setShowTips(true)
|
||||
messageApi.open({
|
||||
type: 'warning',
|
||||
content: '请阅读并且勾选《购买协议》',
|
||||
});
|
||||
}
|
||||
}}
|
||||
>购买</Button>
|
||||
</div>
|
||||
</Spin>
|
||||
<Modal
|
||||
title="提示"
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
destroyOnClose={true}
|
||||
open={buyTipsModal}
|
||||
onCancel={() => {
|
||||
setBuyTipsModal(false)
|
||||
}}
|
||||
onOk={() => {
|
||||
// alert(goodsId)
|
||||
// alert(props.orderId)
|
||||
if (props.orderId) {
|
||||
confirmPaymentFun(props.orderId)
|
||||
|
||||
|
||||
} else {
|
||||
createOrderFun(goodsId)
|
||||
}
|
||||
}}
|
||||
// width={1200}
|
||||
centered
|
||||
>
|
||||
确定购买该商品吗?
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
.upFileBox {
|
||||
display: flex;
|
||||
margin-top: 20px;
|
||||
align-items: center;
|
||||
/* align-items: center; */
|
||||
}
|
||||
.phoneBoxLeft{
|
||||
display: flex;
|
||||
|
@ -1,14 +1,63 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Table, Space, Modal, Input, Form } from "antd"
|
||||
import { sellSupplementList, buySupplementList, supplementDetail } from '../../../../request/api'
|
||||
import { Table, Space, Modal, Input, Form, Upload, Button } from "antd"
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import { sellSupplementList, buySupplementList, supplementDetail, getFileTypeByIds, supplementData } from '../../../../request/api'
|
||||
import { showImage, uploadFileUrl } from '../../../../request/request'
|
||||
const { Column } = Table;
|
||||
import useMessage from "antd/es/message/useMessage";
|
||||
import './File.css'
|
||||
const { TextArea } = Input;
|
||||
export default function File(props: any) {
|
||||
// 自定义验证函数
|
||||
const validateContentOrFile = (_rule: any, _value: any, callback: (error?: string) => void, form: any) => {
|
||||
const { upCorrectionRemark, upFile } = form.getFieldsValue();
|
||||
if (upCorrectionRemark || (upFile && Array.isArray(upFile.fileList) && upFile.fileList.length > 0)) {
|
||||
callback();
|
||||
} else {
|
||||
callback('内容和附件至少需要填写或上传一项');
|
||||
}
|
||||
};
|
||||
// 点击上传资料确定
|
||||
const submitData = async (params: any) => {
|
||||
try {
|
||||
await supplementData({
|
||||
correctionParentId: correctionId,
|
||||
// correctionType: CorrectionType,
|
||||
orderId: props.orderId,
|
||||
correctionFiles: params.correctionFiles,
|
||||
correctionRemark: params.correctionRemark,
|
||||
})
|
||||
if (props.user == 'sell') {
|
||||
getSellSupplementList()
|
||||
} else if (props.user == 'buy') {
|
||||
getBuySupplementList()
|
||||
}
|
||||
messageApi.open({
|
||||
type: 'success',
|
||||
content: '已提交',
|
||||
})
|
||||
setIsModalVisible(false)
|
||||
// form.resetFields();
|
||||
|
||||
// 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 token = sessionStorage.getItem('token')
|
||||
const [form] = Form.useForm();
|
||||
const [messageApi, messageContext] = useMessage();
|
||||
const [correctionId, setCorrectionId] = useState('') // 点击查看内容选中的id
|
||||
// const [CorrectionType, setCorrectionType] = useState('')
|
||||
// 补充资料弹窗
|
||||
const [isModalVisible, setIsModalVisible] = useState(false)
|
||||
const [page, setPage] = useState(1) // 当前页码
|
||||
@ -68,13 +117,36 @@ export default function File(props: any) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const [fileList, setFileList] = useState<any>([]) // 上传文件列表
|
||||
// 获取文件类型
|
||||
const getFileTypeByIdsArray = async (ids: string) => {
|
||||
try {
|
||||
const res: any = await getFileTypeByIds({
|
||||
ids: ids
|
||||
})
|
||||
setFileList(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 [detailData, setDetailData] = useState<any>({})
|
||||
const getSupplementDetail = async (id: string) => {
|
||||
try {
|
||||
const res: any = await supplementDetail(id)
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
setDetailData(res)
|
||||
await getFileTypeByIdsArray(res.correctionFiles)
|
||||
|
||||
} catch (error: any) {
|
||||
|
||||
@ -120,7 +192,7 @@ export default function File(props: any) {
|
||||
}
|
||||
// pagination={false} // 不显示分页
|
||||
style={{ textAlign: 'center' }} // 设置表格内容居中显示
|
||||
rowKey="orderId" // 指定数据项的唯一标识符
|
||||
rowKey="correctionId" // 指定数据项的唯一标识符
|
||||
>
|
||||
<Column
|
||||
width={70}
|
||||
@ -180,7 +252,7 @@ export default function File(props: any) {
|
||||
setCorrectionId(record.correctionId)
|
||||
getSupplementDetail(record.correctionId)
|
||||
setIsModalVisible(true)
|
||||
|
||||
// setCorrectionType(record.correctionType)
|
||||
}}>查看内容</span>
|
||||
|
||||
</Space>
|
||||
@ -191,14 +263,17 @@ export default function File(props: any) {
|
||||
destroyOnClose={true}
|
||||
open={isModalVisible}
|
||||
footer={null} // 将 footer 设置为 null 来隐藏自带按钮
|
||||
width={1152}
|
||||
width={1000}
|
||||
onCancel={() => {
|
||||
setIsModalVisible(false);
|
||||
// 清空表单
|
||||
form.resetFields();
|
||||
}}
|
||||
centered
|
||||
>
|
||||
<div>
|
||||
{correctionId}
|
||||
{/* {correctionId}
|
||||
{CorrectionType} */}
|
||||
<div className='editModal-title'>
|
||||
<div className='editModal-title-box'></div>
|
||||
<div className='editModal-title-name'>平台需要您补充的内容说明</div>
|
||||
@ -224,10 +299,42 @@ export default function File(props: any) {
|
||||
</div>
|
||||
<div className='upFileBox'>
|
||||
<div className='correctionTitle'>附件</div>
|
||||
{detailData.correctionFile ? (
|
||||
<div>材料列表</div>
|
||||
{fileList.length > 0 ? (
|
||||
// <div>材料列表</div>
|
||||
<div>
|
||||
{
|
||||
fileList.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.fileId}
|
||||
style={{
|
||||
// background: 'pink',
|
||||
marginBottom: 5,
|
||||
maxWidth: 800,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
cursor: 'pointer',
|
||||
color: '#1B8BD2',
|
||||
//下划线
|
||||
textDecoration: 'underline',
|
||||
}}
|
||||
title={item.fileName}
|
||||
onClick={() => {
|
||||
|
||||
window.open(showImage(item.fileId, false))
|
||||
|
||||
}}
|
||||
>
|
||||
{item.fileName}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
|
||||
) : (
|
||||
<div style={{ fontSize: 18 }}>
|
||||
<div style={{ fontSize: 18, fontWeight: 700 }}>
|
||||
无
|
||||
</div>
|
||||
)}
|
||||
@ -244,12 +351,27 @@ export default function File(props: any) {
|
||||
onFinish={(value) => {
|
||||
|
||||
console.log(value);
|
||||
// if (value.upFile && Array.isArray(value.upFile.fileList)) {
|
||||
// const uids = value.upFile.fileList.map((file: any) => file.uid);
|
||||
// const uidString = uids.join(',');
|
||||
// console.log('提取的 uid 字符串:', uidString);
|
||||
// // 你可以在这里继续处理 uid 字符串,比如发送请求等
|
||||
|
||||
// }
|
||||
const uids = value.upFile ? (value.upFile.fileList.map((file: any) => file.uid)).join(',') : '';
|
||||
|
||||
// console.log('提取的 uid 字符串:', uids);
|
||||
|
||||
submitData({
|
||||
correctionFiles: uids,
|
||||
correctionRemark: value.upCorrectionRemark,
|
||||
})
|
||||
|
||||
}}
|
||||
onFinishFailed={() => {
|
||||
messageApi.open({
|
||||
type: 'error',
|
||||
content: '请填写完整信息',
|
||||
content: '内容和附件至少需要填写或上传一项',
|
||||
})
|
||||
}}
|
||||
autoComplete="off"
|
||||
@ -257,41 +379,80 @@ export default function File(props: any) {
|
||||
<div className='correctionRemarkBox'>
|
||||
<div className='correctionTitle'>内容</div>
|
||||
<Form.Item
|
||||
// label="软著名称"
|
||||
name="correctionRemark"
|
||||
rules={[{ required: true, message: '请输入软著名称' }]}
|
||||
|
||||
name="upCorrectionRemark"
|
||||
rules={[
|
||||
// { required: true, message: '请输入需要补充内容' },
|
||||
{
|
||||
validator: (rule, value, callback) => validateContentOrFile(rule, value, callback, form),
|
||||
},
|
||||
|
||||
]}
|
||||
>
|
||||
<TextArea value={detailData.correctionRemark} style={{
|
||||
<TextArea style={{
|
||||
height: 100,
|
||||
resize: 'none',
|
||||
width: 1050
|
||||
}}
|
||||
width: 900,
|
||||
|
||||
}}
|
||||
placeholder='请输入需要补充内容'
|
||||
></TextArea>
|
||||
</Form.Item>
|
||||
|
||||
</div>
|
||||
<div className='correctionRemarkBox' style={{
|
||||
marginTop:0
|
||||
marginTop: 0
|
||||
}}>
|
||||
<div className='correctionTitle'>附件</div>
|
||||
<div style={{
|
||||
maxWidth: 800,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
}}>
|
||||
<Form.Item
|
||||
// label="软著名称"
|
||||
name="correctionRemark"
|
||||
rules={[{ required: true, message: '请输入软著名称' }]}
|
||||
>
|
||||
<TextArea value={detailData.correctionRemark} style={{
|
||||
height: 100,
|
||||
resize: 'none',
|
||||
width: 1050
|
||||
}}
|
||||
|
||||
></TextArea>
|
||||
name="upFile"
|
||||
rules={[
|
||||
// { required: true, message: '请上传附件' },
|
||||
{
|
||||
validator: (rule, value, callback) => validateContentOrFile(rule, value, callback, form),
|
||||
},
|
||||
]}
|
||||
>
|
||||
|
||||
<Upload
|
||||
name="file"
|
||||
action={uploadFileUrl()}
|
||||
|
||||
headers={{ 'Auth': `Bearer ${token}` }}
|
||||
|
||||
>
|
||||
<Button icon={<UploadOutlined />}>上传附件</Button>
|
||||
</Upload>
|
||||
|
||||
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<Form.Item
|
||||
|
||||
>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
gap: 10,
|
||||
// marginTop: 20
|
||||
}}>
|
||||
<Button onClick={() => {
|
||||
setIsModalVisible(false)
|
||||
form.resetFields();
|
||||
}}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" >确定</Button>
|
||||
</div>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
</Form>
|
||||
|
@ -87,6 +87,11 @@ export const goodsDetail = (goodsId: string) => aiShopRequest.get(`/aishop/api/g
|
||||
export const createOrder = (goodsId: string) => aiShopRequest.post(`/aishop/api/order/save/${goodsId}`)
|
||||
// 确认付款
|
||||
export const confirmPayment = (orderId: string) => aiShopRequest.put(`/aishop/api/order/confirm-pay/${orderId}`)
|
||||
|
||||
// 通过ids获取文件类型
|
||||
export const getFileTypeByIds = (params:any) => aiShopRequest.get(`/aishop/api/file/list`, { params })
|
||||
// 补充资料
|
||||
export const supplementData = (params:any) => aiShopRequest.post(`/aishop/api/correction/save`, params)
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import axios from "axios";
|
||||
|
||||
|
||||
// 正式与测试环境
|
||||
import {
|
||||
operatorPluginBaseUrl,// 开票功能baseUrl
|
||||
@ -13,7 +14,7 @@ import {
|
||||
// const aiShopBaseUrl = 'http://192.168.0.115:8081'//买卖'
|
||||
// const operatorBaseUrl = 'http://192.168.0.15:8091' //绑定手机号
|
||||
|
||||
|
||||
// axios.defaults.headers['Content-Type'] = 'application/json'; // 设置默认请求头为 JSON 格式
|
||||
// 开票功能----------------------------------------------------------------------------
|
||||
const request = axios.create({
|
||||
baseURL: operatorPluginBaseUrl,
|
||||
@ -23,9 +24,11 @@ request.interceptors.request.use(
|
||||
(config) => {
|
||||
// 有token带token
|
||||
const token = sessionStorage.getItem('token')
|
||||
|
||||
config.headers = config.headers || {}
|
||||
config.headers['Auth'] = token ? `Bearer ${token}` : '';
|
||||
config.headers['Content-Type'] = 'application/json';
|
||||
config.data = { unused: 0 }
|
||||
|
||||
return config;
|
||||
},
|
||||
|
||||
@ -40,6 +43,7 @@ request.interceptors.response.use(
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// 买卖功能----------------------------------------------------------------------------
|
||||
const aiShopRequest = axios.create({
|
||||
baseURL: aiShopBaseUrl,
|
||||
@ -52,6 +56,24 @@ aiShopRequest.interceptors.request.use(
|
||||
|
||||
config.headers = config.headers || {}
|
||||
config.headers['Auth'] = token ? `Bearer ${token}` : '';
|
||||
config.headers['Content-Type'] = 'application/json';
|
||||
config.data = { unused: 0 }
|
||||
// if (config.method === 'get' ) {
|
||||
// if (!config.data) {
|
||||
// config.data = { unused: 0 }
|
||||
// }
|
||||
// }
|
||||
// if (config.method === 'put') {
|
||||
// if (!config.data) {
|
||||
// config.data = { unused: 0 }
|
||||
// }
|
||||
// }
|
||||
// if (config.method === 'post') {
|
||||
// if (!config.data) {
|
||||
// config.data = { unused: 0 }
|
||||
// }
|
||||
// }
|
||||
|
||||
return config;
|
||||
},
|
||||
|
||||
@ -74,9 +96,10 @@ phoneRequest.interceptors.request.use(
|
||||
(config) => {
|
||||
// 有token带token
|
||||
const token = sessionStorage.getItem('token')
|
||||
|
||||
config.headers = config.headers || {}
|
||||
config.headers['Auth'] = token ? `Bearer ${token}` : '';
|
||||
config.headers['Content-Type'] = 'application/json';
|
||||
config.data = { unused: 0 }
|
||||
return config;
|
||||
},
|
||||
|
||||
@ -123,7 +146,7 @@ export const downloadInvoice = (id: string) => {
|
||||
|
||||
|
||||
|
||||
// 显示图片 买卖功能
|
||||
// 显示图片 下载 预览文件 买卖功能
|
||||
export const showImage = (fileId: string, isDownload?: boolean) => {
|
||||
return `${aiShopBaseUrl}/aishop/route/file/download/${isDownload == false}/${fileId}`
|
||||
}
|
||||
@ -131,5 +154,14 @@ export const showImage = (fileId: string, isDownload?: boolean) => {
|
||||
export const uploadImageUrl = () => {
|
||||
return `${aiShopBaseUrl}/aishop/api/file/v2/upload-image`
|
||||
}
|
||||
// // 下载 预览文件 买卖功能
|
||||
// export const downloadUrl = (fileId: string, isDownload?: boolean) => {
|
||||
// return `${aiShopBaseUrl}/aishop/route/file/v2/download/${isDownload == false}/${fileId}`
|
||||
// }
|
||||
|
||||
// export default request
|
||||
// 上传文件 买卖功能
|
||||
export const uploadFileUrl = () => {
|
||||
return `${aiShopBaseUrl}/aishop/api/file/v2/upload-file`
|
||||
}
|
||||
export { request,aiShopRequest,phoneRequest,newRequest};
|
@ -8,14 +8,17 @@ import {
|
||||
// InputNumber
|
||||
Spin,
|
||||
Modal,
|
||||
Image,
|
||||
Button,
|
||||
Input
|
||||
// Image,
|
||||
// Button,
|
||||
// Input
|
||||
} from 'antd';
|
||||
import { showImage } from '../../request/request'
|
||||
// import { showImage } from '../../request/request'
|
||||
import AiShopDetail from '../../components/AiShopDetail/AiShopDetail'
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import dayjs, { } from 'dayjs';
|
||||
import { buyGoodsList, goodsDetail, createOrder, confirmPayment } from '../../request/api'
|
||||
import { buyGoodsList,
|
||||
// goodsDetail,
|
||||
createOrder, confirmPayment } from '../../request/api'
|
||||
// import type { InputNumberProps } from 'antd';
|
||||
// import type { TableColumnsType } from 'antd';
|
||||
// import { SearchOutlined, ClearOutlined } from '@ant-design/icons';
|
||||
@ -24,7 +27,7 @@ import { buyGoodsList, goodsDetail, createOrder, confirmPayment } from '../../re
|
||||
import { useState, useEffect } from 'react';
|
||||
import useMessage from "antd/es/message/useMessage";
|
||||
const { Column } = Table;
|
||||
const { TextArea } = Input;
|
||||
// const { TextArea } = Input;
|
||||
export default function CopyrightGgoods() {
|
||||
const [messageApi, messageContext] = useMessage();
|
||||
const height = window.innerHeight - 180;
|
||||
@ -130,32 +133,32 @@ export default function CopyrightGgoods() {
|
||||
} else {
|
||||
console.error(error)
|
||||
}
|
||||
}finally {
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
const [goodsDetailData, setGoodsDetailData] = useState<any>({}) // 商品详情数据
|
||||
const getGoodsDetail = async (goodsId: string) => {
|
||||
try {
|
||||
setLoading(true)
|
||||
const res: any = await goodsDetail(goodsId)
|
||||
// console.log(res);
|
||||
setGoodsId(res.goodsId)
|
||||
setGoodsDetailData(res)
|
||||
setLoading(false)
|
||||
} catch (error: any) {
|
||||
// const [goodsDetailData, setGoodsDetailData] = useState<any>({}) // 商品详情数据
|
||||
// const getGoodsDetail = async (goodsId: string) => {
|
||||
// try {
|
||||
// setLoading(true)
|
||||
// const res: any = await goodsDetail(goodsId)
|
||||
// // console.log(res);
|
||||
// setGoodsId(res.goodsId)
|
||||
// setGoodsDetailData(res)
|
||||
// setLoading(false)
|
||||
if (error.response) {
|
||||
const data = error.response.data;
|
||||
messageApi.open({
|
||||
type: 'error',
|
||||
content: data.msg ? data.msg : `${data.path}(${data.status})`,
|
||||
});
|
||||
}
|
||||
}finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
// } catch (error: any) {
|
||||
// // setLoading(false)
|
||||
// if (error.response) {
|
||||
// const data = error.response.data;
|
||||
// messageApi.open({
|
||||
// type: 'error',
|
||||
// content: data.msg ? data.msg : `${data.path}(${data.status})`,
|
||||
// });
|
||||
// }
|
||||
// } finally {
|
||||
// setLoading(false)
|
||||
// }
|
||||
// }
|
||||
useEffect(() => {
|
||||
// console.log('copyrightKeywords', copyrightKeywords);
|
||||
// console.log('minPrice', minPrice);
|
||||
@ -171,6 +174,9 @@ export default function CopyrightGgoods() {
|
||||
setPage(1)
|
||||
getBuyGoodsList(1)
|
||||
}, [state])
|
||||
useEffect(() => {
|
||||
getBuyGoodsList(page)
|
||||
},[page])
|
||||
|
||||
return (
|
||||
|
||||
@ -239,7 +245,8 @@ export default function CopyrightGgoods() {
|
||||
// console.log(record);
|
||||
|
||||
setGoodsDetailModal(true)
|
||||
getGoodsDetail(record.goodsId)
|
||||
// getGoodsDetail(record.goodsId)
|
||||
setGoodsId(record.goodsId)
|
||||
}}>查看详情</span>
|
||||
</Space>
|
||||
)}
|
||||
@ -275,7 +282,7 @@ export default function CopyrightGgoods() {
|
||||
width={1200}
|
||||
centered
|
||||
>
|
||||
<Spin tip="正在加载..." size="small" spinning={loading}>
|
||||
{/* <Spin tip="正在加载..." size="small" spinning={loading}>
|
||||
<div className='goodsDetail'>
|
||||
<div className='goodsDetailImg' style={{
|
||||
position: 'relative',
|
||||
@ -446,7 +453,10 @@ export default function CopyrightGgoods() {
|
||||
}}
|
||||
>购买</Button>
|
||||
</div>
|
||||
</Spin>
|
||||
</Spin> */}
|
||||
<AiShopDetail goodsId={goodsId} closeModal={() => {
|
||||
setGoodsDetailModal(false)
|
||||
}}></AiShopDetail>
|
||||
</Modal>
|
||||
|
||||
|
||||
|
@ -483,7 +483,7 @@ export default function EditModal(props: any) {
|
||||
wrapperCol={{ span: 24 }}
|
||||
// style={{ width: '600px' }}
|
||||
onFinish={(value) => {
|
||||
console.log('上传图片的 ID', logoImgArray)
|
||||
// console.log('上传图片的 ID', logoImgArray)
|
||||
// 打印form表单所有的值
|
||||
console.log(form.getFieldsValue())
|
||||
// console.log(form.getFieldValue('imageUrl'));
|
||||
|
@ -7,11 +7,12 @@ import {
|
||||
Modal,
|
||||
Spin
|
||||
} from 'antd';
|
||||
import AiShopDetail from '../../components/AiShopDetail/AiShopDetail'
|
||||
// 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 { getBuyOrderList, confirmPayment } from '../../request/api'
|
||||
import { getBuyOrderList } from '../../request/api'
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import File from '../../components/OrderDetailModal/components/File/File'
|
||||
@ -32,6 +33,8 @@ export default function TradingGoods() {
|
||||
const tradingEndTime = state ? state.tradingEndTime : ''
|
||||
const tradingStatus = state ? state.tradingStatus : ''
|
||||
const [orderId, setOrderId] = useState('') // 订单ID
|
||||
const [aiShopDetailModal, setAiShopDetailModal] = useState(false) // 商品详情弹窗
|
||||
const [goodsId, setGoodsId] = useState('') // 商品ID
|
||||
const [loading, setLoading] = useState(false) // 加载中
|
||||
const [fileModal, setFileModal] = useState(false) //补充资料弹窗
|
||||
const [data, setData] = useState<any[]>([]); // 表格数据
|
||||
@ -72,25 +75,25 @@ export default function TradingGoods() {
|
||||
|
||||
}
|
||||
// 确认支付
|
||||
const confirmPaymentFun = async (orderId: string) => {
|
||||
try {
|
||||
// const confirmPaymentFun = async (orderId: string) => {
|
||||
// try {
|
||||
|
||||
const res: any = await confirmPayment(orderId)
|
||||
console.log(res);
|
||||
// const res: any = await confirmPayment(orderId)
|
||||
// console.log(res);
|
||||
|
||||
} catch (error: any) {
|
||||
// } 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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(() => {
|
||||
// console.log('tradingKeywords', tradingKeywords);
|
||||
// console.log('tradingStartTime', tradingStartTime);
|
||||
@ -130,7 +133,7 @@ export default function TradingGoods() {
|
||||
// }}
|
||||
pagination={false} // 不显示分页
|
||||
style={{ textAlign: 'center' }} // 设置表格内容居中显示
|
||||
rowKey="order" // 指定数据项的唯一标识符
|
||||
rowKey="orderId" // 指定数据项的唯一标识符
|
||||
locale={{ emptyText: '暂无数据' }}
|
||||
>
|
||||
<Column title="序号"
|
||||
@ -152,17 +155,17 @@ export default function TradingGoods() {
|
||||
/>
|
||||
<Column title="订单价格" dataIndex="payMoney" align="center"
|
||||
width={110}
|
||||
fixed="left"
|
||||
// fixed="left"
|
||||
render={(text) => (
|
||||
<span style={{ color: '#FF5D15', fontSize: '24px', fontWeight: '700' }}>{text}</span>
|
||||
)} />
|
||||
<Column
|
||||
{/* <Column
|
||||
title="订单编号"
|
||||
dataIndex="orderNumber"
|
||||
align="center"
|
||||
width={210}
|
||||
|
||||
/>
|
||||
/> */}
|
||||
|
||||
<Column title="订单状态" dataIndex="orderStatus" align="center"
|
||||
width={120}
|
||||
@ -172,7 +175,7 @@ export default function TradingGoods() {
|
||||
}}>
|
||||
<span style={{ display: text == '0' ? 'unset' : 'none' }}>订单已取消</span>
|
||||
<span style={{ display: text == '1' ? 'unset' : 'none' }}>买家待付款</span>
|
||||
<span style={{ display: text == '2' ? 'unset' : 'none' }}>待填写资料</span>
|
||||
<span style={{ display: text == '2' ? 'unset' : 'none' ,color:'red'}}>待填写资料</span>
|
||||
<span style={{ display: text == '3' ? 'unset' : 'none' }}>过户进行中</span>
|
||||
<span style={{ display: text == '4' ? 'unset' : 'none' }}>过户已完成</span>
|
||||
<span style={{ display: text == '5' ? 'unset' : 'none' }}>买家已评价</span>
|
||||
@ -208,7 +211,11 @@ export default function TradingGoods() {
|
||||
</span>
|
||||
<span className='trading-goods-table-btn' onClick={() => {
|
||||
|
||||
confirmPaymentFun(record.orderId)
|
||||
// confirmPaymentFun(record.orderId)
|
||||
// alert(record.goodsId)
|
||||
setGoodsId(record.goodsId)
|
||||
setOrderId(record.orderId)
|
||||
setAiShopDetailModal(true)
|
||||
}}
|
||||
style={{
|
||||
display: record.orderStatus == '1' ? 'unset' : 'none'
|
||||
@ -231,7 +238,7 @@ export default function TradingGoods() {
|
||||
|
||||
}}
|
||||
style={{
|
||||
display: record.orderStatus == '0' || record.orderStatus == '1' || record.orderStatus == '2' ? 'unset' : 'none'
|
||||
display: record.orderStatus == '1' || record.orderStatus == '2' ? 'unset' : 'none'
|
||||
}}
|
||||
>
|
||||
取消订单
|
||||
@ -295,6 +302,27 @@ export default function TradingGoods() {
|
||||
>
|
||||
<File user={'buy'} orderId={orderId}></File>
|
||||
</Modal>
|
||||
<Modal
|
||||
title="著作权商品信息"
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
destroyOnClose={true}
|
||||
footer={null}
|
||||
open={aiShopDetailModal}
|
||||
// onOk={() => {
|
||||
// setOrderDetailModal(false)
|
||||
// }}
|
||||
onCancel={() => {
|
||||
setAiShopDetailModal(false)
|
||||
}}
|
||||
width={1200}
|
||||
centered
|
||||
>
|
||||
|
||||
<AiShopDetail goodsId={goodsId} orderId={orderId} closeModal={() => {
|
||||
setAiShopDetailModal(false)
|
||||
}}></AiShopDetail>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user