Commit bb9144f8 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 7d54e0c7 3555a3d1
import React, { useRef } from 'react';
import Table from '@/pages/transaction/components/TableLayout';
import { history } from 'umi';
import { Tag, Badge } from 'antd';
import { Tag, Badge, Button } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
import moment from 'moment';
......@@ -70,6 +70,7 @@ const OfferSearch = () => {
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (_, record) => record.isShowPurchaseOrder && <Button type='link' onClick={() => history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/b2b/add?modelType=3`)}>创建采购订单</Button>
}
];
......
......@@ -8,6 +8,7 @@ import moment from 'moment';
import { PublicApi } from '@/services/api';
import { INQUIRYSEARCHSCHEMA } from './schema';
import { EXTERNALSTATE_COLOR } from '@/pages/transaction/components/stateColor';
import { setAuth, setRouters } from '@/utils/auth';
const InquirySearch = () => {
......@@ -17,6 +18,22 @@ const InquirySearch = () => {
return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
}
/** 二次询价 */
const secondInquiry = (id) => {
PublicApi.postMemberLoginSwitchrole({
memberRoleId: 11,
}).then(res => {
if (res.code !== 1000) {
return;
}
setAuth(res.data);
setRouters(res.data.urls);
setTimeout(() => {
window.location.replace(`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/add?id=${id}`);
}, 800);
}).catch(err => {})
}
const columns: ColumnType<any>[] = [
{
title: '询价单号',
......@@ -63,9 +80,13 @@ const InquirySearch = () => {
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => <>
<Button disabled={record.isQuoted === 1} onClick={() => history.push(`/memberCenter/tranactionAbility/inquiryOffer/waitAddOffer/offer?id=${record.id}`)} type='link'>报价</Button>
<Button disabled={record.isQuoted === 1} type='link'>二次询价</Button>
render: (_text: any, record: any) => <>
{record.isShowQuote && (
<Button onClick={() => history.push(`/memberCenter/tranactionAbility/inquiryOffer/waitAddOffer/offer?id=${record.id}`)} type='link'>报价</Button>
)}
{record.isShowSecondInquiry && (
<Button type='link' onClick={() => secondInquiry(record.id)}>二次询价</Button>
)}
</>
}
];
......
import React from 'react';
import AddForm from './addForm';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
const AddEnquiryOrder = (props: any) => {
const { id } = history.location.query;
return(
<AddForm
id={id}
isEdit={id && true}
title={props.route.name}
fetchRequest={PublicApi.postTransactionInquiryListAdd}
/>
......
......@@ -143,6 +143,9 @@ const InquiryProductLayout: React.FC<InquiryProductLayoutProps> = (props: any) =
memberRoleId: v.memberRoleId,
imgUrl: v.mainPic,
taxRate: v.taxRate,
upperCommoditySkuId: v.commodityUnitPriceAndPicId,
upperMemberId: v.upperMemberId,
upperMemberRoleId: v.upperMemberRoleId,
})
})
resolve({
......
......@@ -47,6 +47,19 @@ export const setLocalAuth = (info: AuthInfo) => {
window.localStorage.setItem(AUTH_KEY, JSON.stringify(info))
}
export const getCookieAuth = (): AuthInfo => {
try {
const cookieAuth: AuthInfo = getCookie(AUTH_KEY) as unknown as AuthInfo
// return (localAuth || {}) as AuthInfo
if (cookieAuth) {
return cookieAuth
}
return null
} catch (error) {
return null as AuthInfo
}
}
export const getAuth = (): AuthInfo => {
try {
const cookieAuth: AuthInfo = getCookie(AUTH_KEY) as unknown as AuthInfo
......
......@@ -3,7 +3,7 @@ import responseCode from '@/constants/responseCode'
import { IRequestError, IRequestSuccess } from '..';
import { history } from 'umi'
import { message } from 'antd'
import { getAuth, removeAuth } from './auth';
import { getCookieAuth, removeAuth } from './auth';
import { GlobalConfig } from '@/global/config';
import qs from 'qs'
......@@ -80,7 +80,7 @@ const cache = {}
// 请求拦截器
baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit): { url: string, options: RequestOptionsInit } => {
// 判断是否有权限
const { userId, memberId, token } = getAuth() || {}
const { userId, memberId, token } = getCookieAuth() || {}
const headers: any = {
...options.headers
}
......@@ -121,8 +121,8 @@ class ApiRequest {
baseRequest<IRequestSuccess<T>>(url, options).then(res => {
// 登录验证
if (res.code === 1101) {
removeAuth()
window.location.replace(`/user/login?redirect=${btoa(encodeURIComponent(String(window.location)))}`)
// removeAuth()
// window.location.replace(`/user/login?redirect=${btoa(encodeURIComponent(String(window.location)))}`)
message.destroy()
message.error(res.message)
reject(res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment