update
This commit is contained in:
parent
4c04dff48e
commit
87ec1f9508
@ -12,18 +12,19 @@ const proxy = {
|
|||||||
proxyRes.headers['Access-Control-Allow-Credentials'] = 'true';
|
proxyRes.headers['Access-Control-Allow-Credentials'] = 'true';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/kaipiao': {
|
// '/kaipiao': {
|
||||||
target: 'https://cosmic-sandbox.piaozone.com/xhcamzchwbgonerr/',
|
// // target: 'https://cosmic-sandbox.piaozone.com/xhcamzchwbgonerr/',
|
||||||
changeOrigin: true,
|
// target: 'https://cosmic.piaozone.com/ynjtjtjykf/',
|
||||||
secure: false,
|
// changeOrigin: true,
|
||||||
pathRewrite: { '^/kaipiao': '' },
|
// secure: false,
|
||||||
onProxyRes: function (proxyRes) {
|
// pathRewrite: { '^/kaipiao': '' },
|
||||||
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
|
// onProxyRes: function (proxyRes) {
|
||||||
proxyRes.headers['Access-Control-Allow-Methods'] = 'GET,PUT,POST,DELETE,OPTIONS';
|
// proxyRes.headers['Access-Control-Allow-Origin'] = '*';
|
||||||
proxyRes.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization, X-Requested-With';
|
// proxyRes.headers['Access-Control-Allow-Methods'] = 'GET,PUT,POST,DELETE,OPTIONS';
|
||||||
proxyRes.headers['Access-Control-Allow-Credentials'] = 'true';
|
// proxyRes.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization, X-Requested-With';
|
||||||
}
|
// proxyRes.headers['Access-Control-Allow-Credentials'] = 'true';
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export default proxy;
|
export default proxy;
|
||||||
|
|||||||
@ -18,6 +18,16 @@ export default [
|
|||||||
name: '开票管理',
|
name: '开票管理',
|
||||||
component: "@/pages/DigitalElectronics/index",
|
component: "@/pages/DigitalElectronics/index",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/redReversal/index',
|
||||||
|
name: '红冲管理',
|
||||||
|
component: "@/pages/redReversal/index",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/InvoiceInquiry/index',
|
||||||
|
name: '开票查询',
|
||||||
|
component: "@/pages/InvoiceInquiry/index",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/InvoiceSearch/index',
|
path: '/InvoiceSearch/index',
|
||||||
name: '开票查询',
|
name: '开票查询',
|
||||||
|
|||||||
@ -233,6 +233,18 @@ const UserModel: UserModelType = {
|
|||||||
name: '开票管理',
|
name: '开票管理',
|
||||||
component: "@/pages/DigitalElectronics/index",
|
component: "@/pages/DigitalElectronics/index",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/redReversal/index',
|
||||||
|
redirect: '',
|
||||||
|
name: '红冲管理',
|
||||||
|
component: "@/pages/redReversal/index",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/InvoiceInquiry/index',
|
||||||
|
redirect: '',
|
||||||
|
name: '开票查询',
|
||||||
|
component: "@/pages/InvoiceInquiry/index",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/InvoiceSearch/index',
|
path: '/InvoiceSearch/index',
|
||||||
redirect: '',
|
redirect: '',
|
||||||
@ -310,6 +322,8 @@ const UserModel: UserModelType = {
|
|||||||
'/cloudMenu/test/index',
|
'/cloudMenu/test/index',
|
||||||
"/Invoicing/index",
|
"/Invoicing/index",
|
||||||
"/DigitalElectronics/index",
|
"/DigitalElectronics/index",
|
||||||
|
"/InvoiceInquiry/index",
|
||||||
|
"/redReversal/index",
|
||||||
"/InvoiceSearch/index"
|
"/InvoiceSearch/index"
|
||||||
// '/examine/index',
|
// '/examine/index',
|
||||||
// '/examine/modal',
|
// '/examine/modal',
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { FormInstance, Button, message, Tag, Popconfirm, Modal } from "antd";
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { connect } from "umi";
|
import { connect } from "umi";
|
||||||
import { Datum } from "@/types/invoice";
|
import { Datum } from "@/types/invoice";
|
||||||
import { handleGetAppToken, handleGetBILLDETAILList, handleGetBILLList, handleGetInvoiceSearch, handleGetKaiPiao, handleGetPassportInfoById, handleGetSDToken, handleSynchroAPPLYAPPROVE, handleSynchroBILLInterface } from "./service";
|
import { handleGetAppToken, handleGetBILLDETAILList, handleGetBILLList, handleGetForwardJDPJInterface, handleGetInvoiceSearch, handleGetKaiPiao, handleGetPassportInfoById, handleGetSDToken, handleSynchroAPPLYAPPROVE, handleSynchroBILLInterface } from "./service";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { encryptAES } from "@/utils/handleAes";
|
import { encryptAES } from "@/utils/handleAes";
|
||||||
import { ProForm, ProFormSelect, ProFormTextArea } from "@ant-design/pro-components";
|
import { ProForm, ProFormSelect, ProFormTextArea } from "@ant-design/pro-components";
|
||||||
@ -15,6 +15,30 @@ interface ConnectState {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const publicParams: any = {
|
||||||
|
// // 沙盒环境
|
||||||
|
// baseUrl: 'https://cosmic-sandbox.piaozone.com/xhcamzchwbgonerr/',
|
||||||
|
// user: '18620126214',
|
||||||
|
// appId: 'FPY001',
|
||||||
|
// appSecret: 'FPY001fpy@2023***',
|
||||||
|
// accountId: '2280459335882518528',
|
||||||
|
// tenantId: 'xhcamzchwbgonerr',
|
||||||
|
// businessSystemCode: 'BUSINESS_YCIC',
|
||||||
|
// sellerTaxpayerId: '91530112MA7MQ2JR9U',
|
||||||
|
// sellerName: '云南交投集团经营开发有限公司彩云驿商业管理分公司',
|
||||||
|
|
||||||
|
// 正式环境
|
||||||
|
baseUrl: 'https://cosmic.piaozone.com/ynjtjtjykf',
|
||||||
|
user: '18788526867',
|
||||||
|
appId: 'FPY001',
|
||||||
|
appSecret: 'FPY001fpy@2023***',
|
||||||
|
accountId: '2311767813217320960',
|
||||||
|
tenantId: 'ynjtjtjykf',
|
||||||
|
businessSystemCode: 'BUSINESS_YCIC',
|
||||||
|
sellerTaxpayerId: '91530000336622209K',
|
||||||
|
sellerName: '云南交投集团经营开发有限公司',
|
||||||
|
}
|
||||||
|
|
||||||
const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const formRef = useRef<FormInstance>();
|
const formRef = useRef<FormInstance>();
|
||||||
@ -29,6 +53,8 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
const [showModal, setShowModal] = useState<boolean>(false)
|
const [showModal, setShowModal] = useState<boolean>(false)
|
||||||
// 当前选择的票据信息
|
// 当前选择的票据信息
|
||||||
const [currentRow, setCurrentRow] = useState<any>()
|
const [currentRow, setCurrentRow] = useState<any>()
|
||||||
|
// 红冲悬浮框点击的加载效果
|
||||||
|
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
|
||||||
const columns: any = [
|
const columns: any = [
|
||||||
{
|
{
|
||||||
title: '服务区名称',
|
title: '服务区名称',
|
||||||
@ -62,6 +88,19 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '票据类型',
|
||||||
|
dataIndex: 'BILL_TYPE',
|
||||||
|
width: 100,
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {
|
||||||
|
1000: { text: '专票', status: 'warning' },
|
||||||
|
2000: { text: '普票', status: 'default' },
|
||||||
|
3000: { text: '红票', status: 'error' },
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '含税标识',
|
title: '含税标识',
|
||||||
dataIndex: 'ACCOUNTED_TYPE',
|
dataIndex: 'ACCOUNTED_TYPE',
|
||||||
@ -123,7 +162,14 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
valueType: 'select',
|
valueType: 'select',
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
options: [{ label: "填写中", value: 1000 }, { label: "待审核", value: 2000 }, { label: "开票中", value: 9000 }, { label: "已开票", value: 9200 }]
|
options: [
|
||||||
|
{ label: "填写中", value: 1000 },
|
||||||
|
{ label: "待审核", value: 2000 },
|
||||||
|
{ label: "开票中", value: 9000 },
|
||||||
|
{ label: "已开票", value: 9200 },
|
||||||
|
{ label: "红冲申请中", value: 9990 },
|
||||||
|
{ label: "已红冲", value: 9999 }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
// 申请填写 1000 2000 待审核 9000 开票中 9200 已开票
|
// 申请填写 1000 2000 待审核 9000 开票中 9200 已开票
|
||||||
},
|
},
|
||||||
@ -135,10 +181,10 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
render: (text: any, record: Datum) => (
|
render: (text: any, record: Datum) => (
|
||||||
record?.BILL_STATE === 2000 ?
|
record?.BILL_STATE === 2000 || record?.BILL_STATE === 9000 ?
|
||||||
<div>
|
<div>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确认同意开票?"
|
title={record?.BILL_STATE === 9000 ? '确认重新开票?' : '确认同意开票?'}
|
||||||
onConfirm={
|
onConfirm={
|
||||||
() => {
|
() => {
|
||||||
handleInvoice(record)
|
handleInvoice(record)
|
||||||
@ -149,9 +195,10 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
okText="确认"
|
okText="确认"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button type="primary" size="small">同意开票</Button >
|
<Button type="primary" size="small">{record?.BILL_STATE === 9000 ? '重新开票' : '同意开票'}</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
|
{
|
||||||
|
record?.BILL_STATE === 2000 ?
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确认退回开票?"
|
title="确认退回开票?"
|
||||||
onConfirm={
|
onConfirm={
|
||||||
@ -166,9 +213,10 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button danger style={{ marginLeft: "8px" }} type="primary" size="small">退回开票</Button>
|
<Button danger style={{ marginLeft: "8px" }} type="primary" size="small">退回开票</Button>
|
||||||
</Popconfirm>
|
</Popconfirm> : ""
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
: record?.BILL_STATE === 9200 ?
|
: record?.BILL_TYPE === 2000 && record?.BILL_STATE >= 9200 && record?.BILL_STATE !== 9999 ?
|
||||||
<div>
|
<div>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确认红冲发票?"
|
title="确认红冲发票?"
|
||||||
@ -188,15 +236,23 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
// 红冲发票
|
// 红冲发票
|
||||||
const handleRedGoBill = async (record?: any) => {
|
const handleRedGoBill = async (record?: any) => {
|
||||||
|
// 这个方法 比较复杂 我做一下注释
|
||||||
|
// 先拿到表单数据 里面有 红冲类型和 红冲原因
|
||||||
|
// 红冲原因是给自己的同步接口 红冲类型 是给金飘云那边的
|
||||||
|
// 然后再去查询一下 这张票在金飘云那边的数据 拿到这张票对应的蓝票id
|
||||||
|
// 因为我们自己的票据信息里面 没有票据明细的内容 所以要调用自己的票据明细拿到详细的信息之后 就可以拿到这张票子里面的商品 可以传给金飘云
|
||||||
|
// 红冲 就是 重新开一张票 然后开这张票的时候带上之前需要红冲那张票的蓝票id 即可
|
||||||
|
// 红冲申请发出去之后 按照红冲的编码 用我们自己的接口 开一张新的票据记录 其他数据保持一致 编码为红冲编码 状态为 9000 开票中
|
||||||
|
// 然后还有原的票同步 状态变为 9990 红冲中
|
||||||
|
// 最后同步开票流程变为 红冲中
|
||||||
|
|
||||||
// 拿到表单数据
|
// 拿到表单数据
|
||||||
const formData: any = modalFormRef.current?.getFieldsValue()
|
const formData: any = modalFormRef.current?.getFieldsValue()
|
||||||
console.log('formData', formData);
|
console.log('formData', formData);
|
||||||
|
|
||||||
console.log('recordrecord', record);
|
console.log('recordrecord', record);
|
||||||
|
|
||||||
// 拿个票据明细
|
// 拿个票据明细
|
||||||
const billDetail = await handleGetBILLDETAILList({
|
const billDetail = await handleGetBILLDETAILList({
|
||||||
SearchParameter: {
|
SearchParameter: {
|
||||||
@ -207,12 +263,11 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
SortStr: "BILLDETAIL_ID"
|
SortStr: "BILLDETAIL_ID"
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('billDetailbillDetailbillDetailbillDetail', billDetail);
|
|
||||||
|
|
||||||
// 调用金票云那里的列表接口
|
// 调用金票云那里的列表接口
|
||||||
// 构造查询数据
|
// 构造查询数据
|
||||||
const queryData = {
|
const queryData = {
|
||||||
sellerTaxpayerId: "91530112MA7MQ2JR9U",
|
// sellerTaxpayerId: "91530112MA7MQ2JR9U",
|
||||||
|
sellerTaxpayerId: publicParams.sellerTaxpayerId,
|
||||||
serialNo: record?.BILL_NO,
|
serialNo: record?.BILL_NO,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -227,12 +282,16 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
requestId: Date.now().toString(),
|
requestId: Date.now().toString(),
|
||||||
data: encryptedDataOld
|
data: encryptedDataOld
|
||||||
};
|
};
|
||||||
|
let responseOld = await handleGetForwardJDPJInterface({
|
||||||
console.log('最终请求参数:', requestParams);
|
ReqUrl: `https://cosmic.piaozone.com/ynjtjtjykf/kapi/app/sim/openApi?access_token=${accessToken}`,
|
||||||
|
Access_token: accessToken,
|
||||||
// 调用查询接口 (这里需要传入正确的code参数)
|
data: JSON.stringify(requestParams)
|
||||||
const responseOld = await handleGetInvoiceSearch(requestParams, accessToken);
|
})
|
||||||
console.log('responseresponseresponseresponse', responseOld);
|
responseOld = JSON.parse(responseOld as any)
|
||||||
|
// console.log('最终请求参数:', requestParams);
|
||||||
|
// // 调用查询接口 (这里需要传入正确的code参数)
|
||||||
|
// const responseOld = await handleGetInvoiceSearch(requestParams, accessToken);
|
||||||
|
// console.log('responseresponseresponseresponse', responseOld);
|
||||||
let result: any = []
|
let result: any = []
|
||||||
if (responseOld && responseOld.success) {
|
if (responseOld && responseOld.success) {
|
||||||
let res = JSON.parse(decodeURIComponent(escape(atob(responseOld.data))))
|
let res = JSON.parse(decodeURIComponent(escape(atob(responseOld.data))))
|
||||||
@ -242,9 +301,6 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('最终请求结果:', result);
|
console.log('最终请求结果:', result);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let billDetailReq: any = []
|
let billDetailReq: any = []
|
||||||
if (billDetail && billDetail.length > 0) {
|
if (billDetail && billDetail.length > 0) {
|
||||||
billDetail.forEach((item: any) => {
|
billDetail.forEach((item: any) => {
|
||||||
@ -274,8 +330,10 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
buyerTaxpayerId: record?.TAXPAYER_IDENTIFYCODE,// 购方税号
|
buyerTaxpayerId: record?.TAXPAYER_IDENTIFYCODE,// 购方税号
|
||||||
buyerName: record?.MERCHANTS_NAME, // 购买方名称
|
buyerName: record?.MERCHANTS_NAME, // 购买方名称
|
||||||
buyerProperty: "0", // 购买方性质 0-企业,1-个人,2-非企业单位
|
buyerProperty: "0", // 购买方性质 0-企业,1-个人,2-非企业单位
|
||||||
sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死
|
// sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死
|
||||||
sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死
|
sellerTaxpayerId: publicParams.sellerTaxpayerId, // 销方税号 写死
|
||||||
|
// sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死
|
||||||
|
sellerName: publicParams.sellerName, // 销方名称 写死
|
||||||
sellerBankAndAccount: "13710884704", // 销方银行和账号 写死
|
sellerBankAndAccount: "13710884704", // 销方银行和账号 写死
|
||||||
sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传
|
sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传
|
||||||
drawer: record?.BILL_PERSON,// 开票人
|
drawer: record?.BILL_PERSON,// 开票人
|
||||||
@ -285,14 +343,13 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
redReason: formData?.redReasonSelect || "",
|
redReason: formData?.redReasonSelect || "",
|
||||||
autoMerge: "0",
|
autoMerge: "0",
|
||||||
// blueinvoiceNo: '23249322851717775360',
|
// blueinvoiceNo: '23249322851717775360',
|
||||||
blueinvoiceNo: result[0].originalInvoiceNumber,
|
blueinvoiceNo: result[0].invoiceNumber,
|
||||||
// originalIssueTime: record?.originalIssueTime,
|
// originalIssueTime: record?.originalIssueTime,
|
||||||
// blueInvoiceType: record?.blueInvoiceType,
|
// blueInvoiceType: record?.blueInvoiceType,
|
||||||
blueinvoiceCode: "",
|
blueinvoiceCode: "",
|
||||||
billDetail: billDetailReq
|
billDetail: billDetailReq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 构造原始数据
|
// 构造原始数据
|
||||||
const originalData = [obj]; // 将record作为data数组的一项
|
const originalData = [obj]; // 将record作为data数组的一项
|
||||||
// 将data字段进行base64加密
|
// 将data字段进行base64加密
|
||||||
@ -316,16 +373,53 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
console.log('Base64加密后:', encryptedData);
|
console.log('Base64加密后:', encryptedData);
|
||||||
console.log('最终请求数据:', invoiceData);
|
console.log('最终请求数据:', invoiceData);
|
||||||
console.log('访问令牌:', accessToken);
|
console.log('访问令牌:', accessToken);
|
||||||
const response = await handleGetKaiPiao(invoiceData, accessToken);
|
// const response = await handleGetKaiPiao(invoiceData, accessToken);
|
||||||
|
|
||||||
|
let response = await handleGetForwardJDPJInterface({
|
||||||
|
ReqUrl: `https://cosmic.piaozone.com/ynjtjtjykf/kapi/app/sim/openApi?access_token=${accessToken}`,
|
||||||
|
Access_token: accessToken,
|
||||||
|
data: JSON.stringify(invoiceData)
|
||||||
|
})
|
||||||
|
response = JSON.parse(response as any)
|
||||||
console.log('开票响应:', response);
|
console.log('开票响应:', response);
|
||||||
|
|
||||||
setShowModal(false)
|
setShowModal(false)
|
||||||
setCurrentRow(null)
|
setCurrentRow(null)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
message.success('红冲成功!')
|
message.success('红冲成功!')
|
||||||
|
// 同步流程的 加上红冲中的状态
|
||||||
|
await handleSynchroAPPLYAPPROVEFun(3, record)
|
||||||
|
let redReasonObj: any = {
|
||||||
|
"1": "销货退回",
|
||||||
|
"2": "开票有误",
|
||||||
|
"3": "开票中止",
|
||||||
|
"4": "销售折让",
|
||||||
|
}
|
||||||
|
// 同步旧票子 变为 红冲申请中
|
||||||
|
await handleSynchroBILL(2, {
|
||||||
|
...record,
|
||||||
|
billDetail: billDetail
|
||||||
|
})
|
||||||
|
// 针对这个红冲 开一张新票子 编码为新的红冲编码 状态为9000 开票中 且票据类型变为 3000 红票 BILL_TYPE
|
||||||
|
await handleUpdateOldBill({
|
||||||
|
...record,
|
||||||
|
billDetail: billDetail,
|
||||||
|
BILL_TYPE: 3000,
|
||||||
|
BILL_STATE: 9000,
|
||||||
|
BILL_NO: `HC-${record?.BILL_NO}`,
|
||||||
|
BILL_DATE: moment().format('YYYY-MM-DD'),
|
||||||
|
BILL_DESC: formData?.redReasonSelect ? redReasonObj[formData?.redReasonSelect] : "",
|
||||||
|
BILL_ID: "",
|
||||||
|
BILL_TAXAMOUNT: -record?.BILL_TAXAMOUNT,
|
||||||
|
BILL_AMOUNT: -record?.BILL_AMOUNT,
|
||||||
|
INVOICE_TAXAMOUNT: -record?.INVOICE_TAXAMOUNT,
|
||||||
|
INVOICE_AMOUNT: -record?.INVOICE_AMOUNT,
|
||||||
|
})
|
||||||
|
actionRef.current?.reload()
|
||||||
} else {
|
} else {
|
||||||
message.error(response.message)
|
message.error(response.message)
|
||||||
}
|
}
|
||||||
|
setConfirmLoading(false)
|
||||||
}
|
}
|
||||||
// 开票处理函数
|
// 开票处理函数
|
||||||
const handleInvoice = async (record: Datum) => {
|
const handleInvoice = async (record: Datum) => {
|
||||||
@ -382,14 +476,17 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
buyerName: record?.MERCHANTS_NAME, // 购买方名称
|
buyerName: record?.MERCHANTS_NAME, // 购买方名称
|
||||||
buyerProperty: "0", // 购买方性质 0-企业,1-个人,2-非企业单位
|
buyerProperty: "0", // 购买方性质 0-企业,1-个人,2-非企业单位
|
||||||
|
|
||||||
sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死
|
// sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死
|
||||||
sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死
|
sellerTaxpayerId: publicParams.sellerTaxpayerId, // 销方税号 写死
|
||||||
|
// sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死
|
||||||
|
sellerName: publicParams.sellerName, // 销方名称 写死
|
||||||
sellerBankAndAccount: "13710884704", // 销方银行和账号 写死
|
sellerBankAndAccount: "13710884704", // 销方银行和账号 写死
|
||||||
sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传
|
sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传
|
||||||
|
|
||||||
drawer: record?.BILL_PERSON,// 开票人
|
drawer: record?.BILL_PERSON,// 开票人
|
||||||
buyerRecipientPhone: record?.RECEIVE_PHONENUMBER,// 购方收票手机号
|
buyerRecipientPhone: record?.RECEIVE_PHONENUMBER,// 购方收票手机号
|
||||||
buyerRecipientMail: record?.RECEIVE_EMAIL,// 购方收件邮箱
|
buyerRecipientMail: record?.RECEIVE_EMAIL,// 购方收件邮箱
|
||||||
|
remark: record?.BILL_DESC,
|
||||||
|
|
||||||
// redReason: record?.BILL_DESC,
|
// redReason: record?.BILL_DESC,
|
||||||
|
|
||||||
@ -425,7 +522,15 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
console.log('最终请求数据:', invoiceData);
|
console.log('最终请求数据:', invoiceData);
|
||||||
console.log('访问令牌:', accessToken);
|
console.log('访问令牌:', accessToken);
|
||||||
|
|
||||||
const response = await handleGetKaiPiao(invoiceData, accessToken);
|
// const response = await handleGetKaiPiao(invoiceData, accessToken);
|
||||||
|
|
||||||
|
let response = await handleGetForwardJDPJInterface({
|
||||||
|
ReqUrl: `https://cosmic.piaozone.com/ynjtjtjykf/kapi/app/sim/openApi?access_token=${accessToken}`,
|
||||||
|
Access_token: accessToken,
|
||||||
|
data: JSON.stringify(invoiceData)
|
||||||
|
})
|
||||||
|
|
||||||
|
response = JSON.parse(response as any)
|
||||||
console.log('开票响应:', response);
|
console.log('开票响应:', response);
|
||||||
|
|
||||||
if (response && response.success) {
|
if (response && response.success) {
|
||||||
@ -435,7 +540,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
message.success({ content: `单据 ${record.BILL_NO} 开票申请已提交成功`, key: 'invoice' });
|
message.success({ content: `单据 ${record.BILL_NO} 开票申请已提交成功`, key: 'invoice' });
|
||||||
actionRef.current?.reload()
|
actionRef.current?.reload()
|
||||||
// 他们的调用成功了 再调用我们自己的 同步票据信息表 的接口
|
// 他们的调用成功了 再调用我们自己的 同步票据信息表 的接口
|
||||||
handleSynchroBILL(record)
|
handleSynchroBILL(1, record)
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -464,30 +569,119 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}
|
}
|
||||||
// 在这个页面获取token
|
// 在这个页面获取token
|
||||||
const handleGetTokenInPage = async () => {
|
const handleGetTokenInPage = async () => {
|
||||||
|
// 老
|
||||||
|
// let req: any = {
|
||||||
|
// appId: publicParams.appId,
|
||||||
|
// appSecret: publicParams.appSecret,
|
||||||
|
// accountId: publicParams.accountId,
|
||||||
|
// tenantid: publicParams.tenantId,
|
||||||
|
// language: ""
|
||||||
|
|
||||||
|
// // appId: "FPY001",
|
||||||
|
// // appSecret: "FPY001fpy@2023***",
|
||||||
|
// // accountId: "2280459335882518528",
|
||||||
|
// // tenantid: "xhcamzchwbgonerr",
|
||||||
|
// // language: ""
|
||||||
|
// }
|
||||||
|
// const token = await handleGetAppToken(req)
|
||||||
|
|
||||||
|
// 新
|
||||||
let req: any = {
|
let req: any = {
|
||||||
appId: "FPY001",
|
ReqUrl: "https://cosmic.piaozone.com/ynjtjtjykf/api/getAppToken.do",
|
||||||
appSecret: "FPY001fpy@2023***",
|
Access_token: "",
|
||||||
accountId: "2280459335882518528",
|
data: JSON.stringify({
|
||||||
tenantid: "xhcamzchwbgonerr",
|
appId: publicParams.appId,
|
||||||
|
appSecret: publicParams.appSecret,
|
||||||
|
accountId: publicParams.accountId,
|
||||||
|
tenantid: publicParams.tenantId,
|
||||||
language: ""
|
language: ""
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const token = await handleGetAppToken(req)
|
let token = await handleGetForwardJDPJInterface(req)
|
||||||
|
let tokenData = token ? JSON.parse(token as any) : ""
|
||||||
|
console.log('tokenDatatokenDatatokenDatatokenDatadasdsa', tokenData);
|
||||||
|
|
||||||
let appToken: any = token.data.app_token
|
|
||||||
|
|
||||||
|
let appToken: any = tokenData.data.app_token
|
||||||
|
// 老
|
||||||
|
// let tokenReq: any = {
|
||||||
|
// // user: "18620126214",
|
||||||
|
// user: publicParams.user,
|
||||||
|
// apptoken: appToken,
|
||||||
|
// tenantid: publicParams.tenantId,
|
||||||
|
// accountId: publicParams.accountId,
|
||||||
|
// usertype: ""
|
||||||
|
// // apptoken: appToken,
|
||||||
|
// // tenantid: "xhcamzchwbgonerr",
|
||||||
|
// // accountId: "2280459335882518528",
|
||||||
|
// // usertype: ""
|
||||||
|
// }
|
||||||
|
// const accessToken: any = await handleGetSDToken(tokenReq)
|
||||||
|
|
||||||
|
// 新
|
||||||
let tokenReq: any = {
|
let tokenReq: any = {
|
||||||
user: "18620126214",
|
ReqUrl: "https://cosmic.piaozone.com/ynjtjtjykf/api/login.do",
|
||||||
|
Access_token: "",
|
||||||
|
data: JSON.stringify({
|
||||||
|
user: publicParams.user,
|
||||||
apptoken: appToken,
|
apptoken: appToken,
|
||||||
tenantid: "xhcamzchwbgonerr",
|
tenantid: publicParams.tenantId,
|
||||||
accountId: "2280459335882518528",
|
accountId: publicParams.accountId,
|
||||||
usertype: ""
|
usertype: ""
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
let accessTokenData = await handleGetForwardJDPJInterface(tokenReq)
|
||||||
const accessToken: any = await handleGetSDToken(tokenReq)
|
let accessToken = JSON.parse(accessTokenData as any)
|
||||||
|
|
||||||
setAppToken(appToken)
|
setAppToken(appToken)
|
||||||
setAccessToken(accessToken.data.access_token)
|
setAccessToken(accessToken.data.access_token)
|
||||||
|
|
||||||
|
|
||||||
|
// const queryData = {
|
||||||
|
// // sellerTaxpayerId: "91530112MA7MQ2JR9U",
|
||||||
|
// sellerTaxpayerId: publicParams.sellerTaxpayerId,
|
||||||
|
// serialNo: '202509-401206-0014',
|
||||||
|
// };
|
||||||
|
// console.log('queryDataqueryData', queryData);
|
||||||
|
|
||||||
|
// // 将data字段进行base64加密
|
||||||
|
// const dataStringOld = JSON.stringify(queryData);
|
||||||
|
// const encryptedDataOld = btoa(unescape(encodeURIComponent(dataStringOld)));
|
||||||
|
|
||||||
|
// // 构造最终请求参数
|
||||||
|
// const requestParams = {
|
||||||
|
// businessSystemCode: "BUSINESS_YCIC",
|
||||||
|
// interfaceCode: "BILL.INVOICE.QUERY",
|
||||||
|
// requestId: Date.now().toString(),
|
||||||
|
// data: encryptedDataOld
|
||||||
|
// };
|
||||||
|
|
||||||
|
// console.log('最终请求参数:', requestParams);
|
||||||
|
|
||||||
|
// let reqResult: any = {
|
||||||
|
// ReqUrl: `https://cosmic.piaozone.com/ynjtjtjykf/kapi/app/sim/openApi?access_token=${accessToken.data.access_token}`,
|
||||||
|
// Access_token: accessToken.data.access_token,
|
||||||
|
// data: JSON.stringify(requestParams)
|
||||||
|
// }
|
||||||
|
// let responseOld = await handleGetForwardJDPJInterface(reqResult)
|
||||||
|
// console.log('responseOldresponseOldresponseOld', responseOld);
|
||||||
|
// responseOld = JSON.parse(responseOld as any)
|
||||||
|
|
||||||
|
// 老
|
||||||
|
// // 调用查询接口 (这里需要传入正确的code参数)
|
||||||
|
// const responseOld = await handleGetInvoiceSearch(requestParams, accessToken.data.access_token);
|
||||||
|
// console.log('responseresponseresponseresponse', responseOld);
|
||||||
|
// let result: any = []
|
||||||
|
// if (responseOld && responseOld.success) {
|
||||||
|
// let res = JSON.parse(decodeURIComponent(escape(atob(responseOld.data))))
|
||||||
|
// result = res[0].invoiceList
|
||||||
|
// } else {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
const handleSynchroBILL = async (obj: any) => {
|
const handleSynchroBILL = async (type: number, obj: any) => {
|
||||||
|
// type 1 开票的同步状态 即 9000 2 开票的红冲状态 即 9990
|
||||||
// 发票明细列表
|
// 发票明细列表
|
||||||
let detailList: any = []
|
let detailList: any = []
|
||||||
if (obj?.billDetail && obj?.billDetail.length > 0) {
|
if (obj?.billDetail && obj?.billDetail.length > 0) {
|
||||||
@ -542,7 +736,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
DOWNLOAD_URL: obj?.DOWNLOAD_URL,// 下载地址
|
DOWNLOAD_URL: obj?.DOWNLOAD_URL,// 下载地址
|
||||||
RECEIVE_PHONENUMBER: obj?.RECEIVE_PHONENUMBER,// 收票方手机
|
RECEIVE_PHONENUMBER: obj?.RECEIVE_PHONENUMBER,// 收票方手机
|
||||||
RECEIVE_EMAIL: obj?.RECEIVE_EMAIL,// 收票方邮箱
|
RECEIVE_EMAIL: obj?.RECEIVE_EMAIL,// 收票方邮箱
|
||||||
BILL_STATE: 9000,// 票据状态
|
BILL_STATE: type === 1 ? 9000 : type === 2 ? '9990' : '',// 票据状态
|
||||||
DetailList: obj?.DetailList,// 发票明细列表
|
DetailList: obj?.DetailList,// 发票明细列表
|
||||||
}
|
}
|
||||||
const data = await handleSynchroBILLInterface(req)
|
const data = await handleSynchroBILLInterface(req)
|
||||||
@ -560,16 +754,16 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}
|
}
|
||||||
// 同步操作的流程信息 审核通过 和 审核驳回 都要去调用一下 同步流程的方法
|
// 同步操作的流程信息 审核通过 和 审核驳回 都要去调用一下 同步流程的方法
|
||||||
const handleSynchroAPPLYAPPROVEFun = async (type: number, obj: any) => {
|
const handleSynchroAPPLYAPPROVEFun = async (type: number, obj: any) => {
|
||||||
// type 1 审核通过 2 拒绝审核
|
// type 1 审核通过 2 拒绝审核 3 红冲中
|
||||||
// obj 当前票据信息
|
// obj 当前票据信息
|
||||||
const req: any = {
|
const req: any = {
|
||||||
ACTINST_NAME: type === 1 ? '审核开票申请' : type === 2 ? '驳回开票申请' : "",// 状态名称 审核开票申请 || 驳回开票申请
|
ACTINST_NAME: type === 1 ? '审核开票申请' : type === 2 ? '驳回开票申请' : type === 3 ? "红冲发票申请" : "",// 状态名称 审核开票申请 || 驳回开票申请
|
||||||
APPROVE_TYPE: obj?.BILL_ID,// 票的id
|
APPROVE_TYPE: obj?.BILL_ID,// 票的id
|
||||||
APPROVE_INFO: type === 1 ? '同意开票' : type === 2 ? '驳回开票' : "",// 同意开票 || 驳回开票
|
APPROVE_INFO: type === 1 ? '同意开票' : type === 2 ? '驳回开票' : type === 3 ? "红冲发票" : "",// 同意开票 || 驳回开票
|
||||||
STAFF_ID: currentUser?.ID,
|
STAFF_ID: currentUser?.ID,
|
||||||
STAFF_NAME: currentUser?.Name,
|
STAFF_NAME: currentUser?.Name,
|
||||||
APPROVE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
APPROVE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
APPROVE_STATE: type === 1 ? 9000 : type === 2 ? 1000 : "",
|
APPROVE_STATE: type === 1 ? 9000 : type === 2 ? 1000 : type === 3 ? '9990' : "",
|
||||||
APPROVE_DESC: "T_BILL"
|
APPROVE_DESC: "T_BILL"
|
||||||
}
|
}
|
||||||
let reqData: any = {
|
let reqData: any = {
|
||||||
@ -581,6 +775,15 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
console.log('datadatadata312321', data);
|
console.log('datadatadata312321', data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 红冲的时候 同步原先的票子 传入红冲原因
|
||||||
|
const handleUpdateOldBill = async (record: any) => {
|
||||||
|
let req: any = {
|
||||||
|
...record,
|
||||||
|
}
|
||||||
|
const data = await handleSynchroBILLInterface(req)
|
||||||
|
console.log('新票子', data);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(async () => {
|
useEffect(async () => {
|
||||||
// 先调用token 后续这个页面用得到
|
// 先调用token 后续这个页面用得到
|
||||||
await handleGetTokenInPage()
|
await handleGetTokenInPage()
|
||||||
@ -607,12 +810,14 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
const search = window.location.search;
|
const search = window.location.search;
|
||||||
const addressParams = Object.fromEntries(new URLSearchParams(search).entries());
|
const addressParams = Object.fromEntries(new URLSearchParams(search).entries());
|
||||||
console.log('addressParamsaddressParamsaddressParams', addressParams);
|
console.log('addressParamsaddressParamsaddressParams', addressParams);
|
||||||
const userInfo = await handleGetUserInfo(addressParams.id)
|
const userInfo = await handleGetUserInfo(addressParams.UserIdEncrypted)
|
||||||
|
|
||||||
// 获取票据信息表列表
|
// 获取票据信息表列表
|
||||||
const req: any = {
|
const req: any = {
|
||||||
SearchParameter: {
|
SearchParameter: {
|
||||||
SERVERPART_IDS: userInfo?.ServerpartIds,
|
SERVERPART_IDS: userInfo?.ServerpartIds,
|
||||||
|
BILL_STATES: "2000,9000",
|
||||||
|
BILL_TYPES: ""
|
||||||
},
|
},
|
||||||
PageIndex: 1,
|
PageIndex: 1,
|
||||||
PageSize: 999999
|
PageSize: 999999
|
||||||
@ -885,12 +1090,12 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
{/* 用来输入红冲原因的 */}
|
{/* 用来输入红冲原因的 */}
|
||||||
<Modal
|
<Modal
|
||||||
title={"红冲原因"}
|
title={"红冲原因"}
|
||||||
open={showModal}
|
open={showModal}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
|
confirmLoading={confirmLoading}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setShowModal(false)
|
setShowModal(false)
|
||||||
setCurrentRow(null)
|
setCurrentRow(null)
|
||||||
@ -907,6 +1112,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
formRef={modalFormRef}
|
formRef={modalFormRef}
|
||||||
submitter={false}
|
submitter={false}
|
||||||
onFinish={() => {
|
onFinish={() => {
|
||||||
|
setConfirmLoading(true)
|
||||||
handleRedGoBill(currentRow)
|
handleRedGoBill(currentRow)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -928,7 +1134,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ProFormTextArea
|
{/* <ProFormTextArea
|
||||||
label={"红冲原因"}
|
label={"红冲原因"}
|
||||||
name={"redReason"}
|
name={"redReason"}
|
||||||
rules={[
|
rules={[
|
||||||
@ -937,7 +1143,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
message: '请输入红冲原因'
|
message: '请输入红冲原因'
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/> */}
|
||||||
</ProForm>
|
</ProForm>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -108,3 +108,18 @@ export async function handleGetBILLDETAILList(params: any) {
|
|||||||
|
|
||||||
return data.Result_Data.List
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 包一层的中转接口 用来解决金飘云的跨域问题
|
||||||
|
export async function handleGetForwardJDPJInterface(params: any) {
|
||||||
|
const data = await requestKaiPiao(`/Invoice/ForwardJDPJInterface`, {
|
||||||
|
method: 'POST',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
1092
src/pages/InvoiceInquiry/index.tsx
Normal file
1092
src/pages/InvoiceInquiry/index.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@ -264,7 +264,7 @@ const InvoiceSearch: React.FC = () => {
|
|||||||
buyerRecipientMail: "",
|
buyerRecipientMail: "",
|
||||||
autoMerge: "0",
|
autoMerge: "0",
|
||||||
blueinvoiceCode: "", // 红冲时 blueinvoiceCode 不传的
|
blueinvoiceCode: "", // 红冲时 blueinvoiceCode 不传的
|
||||||
blueinvoiceNo: "23249322851717775360",
|
blueinvoiceNo: "22951444153138083840",
|
||||||
redReason: "2",
|
redReason: "2",
|
||||||
billDetail: [
|
billDetail: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,8 @@ const authority: PageAuthority = {
|
|||||||
'/test/index': ['/test/index'],
|
'/test/index': ['/test/index'],
|
||||||
'/Invoicing/index': ['/Invoicing/index'],
|
'/Invoicing/index': ['/Invoicing/index'],
|
||||||
'/DigitalElectronics/index': ['/DigitalElectronics/index'],
|
'/DigitalElectronics/index': ['/DigitalElectronics/index'],
|
||||||
|
'/InvoiceInquiry/index': ['/InvoiceInquiry/index'],
|
||||||
|
'/redReversal/index': ['/redReversal/index'],
|
||||||
'/InvoiceSearch/index': ['/InvoiceSearch/index'],
|
'/InvoiceSearch/index': ['/InvoiceSearch/index'],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1153
src/pages/redReversal/index.tsx
Normal file
1153
src/pages/redReversal/index.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ const { UMI_APP_BASEURL } = process.env;
|
|||||||
// const instance = axios.create({ baseURL: 'https://cosmic-sandbox.piaozone.com/jdpjykjyxgs' });
|
// const instance = axios.create({ baseURL: 'https://cosmic-sandbox.piaozone.com/jdpjykjyxgs' });
|
||||||
|
|
||||||
// 改为使用代理路径
|
// 改为使用代理路径
|
||||||
const instance = axios.create({ baseURL: '/kaipiao' });
|
const instance = axios.create({ baseURL: 'http://api.eshangtech.com/EShangApiMain' });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user