Commit 6c9f0218 authored by wzy's avatar wzy

feat: 价格库页面接口对接

parent c7ef0a4d
......@@ -4,88 +4,93 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import StandardTable from '@/components/StandardTable';
import { ColumnType } from 'antd/lib/table/interface';
import { history } from 'umi';
import { getProductCommodityGetUnitPriceStrategyList } from '@/services/ProductV2Api';
import { getProductPriceManagementGetGoodsPriceHistory } from '@/services/ProductV2Api';
const DetailLibrary: React.FC<{}> = () => {
const ref = useRef<any>({});
const { goodsPriceId } = history.location.query;
const columns: ColumnType<any>[] = [
{
title: '物料编号',
dataIndex: 'id',
key: 'id',
dataIndex: 'goodsCode',
key: 'goodsCode',
},
{
title: '物料名称',
dataIndex: 'id',
key: 'id',
dataIndex: 'name',
key: 'name',
},
{
title: '规格型号',
dataIndex: 'id',
key: 'id',
dataIndex: 'type',
key: 'type',
},
{
title: '品类',
dataIndex: 'id',
key: 'id',
dataIndex: 'customerCategory',
key: 'customerCategory',
render: text => text?.name,
},
{
title: '品牌',
dataIndex: 'id',
key: 'id',
dataIndex: 'unitName',
key: 'unitName',
render: text => text?.name,
},
{
title: '单位',
dataIndex: 'id',
key: 'id',
dataIndex: 'unitName',
key: 'unitName',
},
{
title: '目录价',
dataIndex: 'id',
key: 'id',
dataIndex: 'costPrice',
key: 'costPrice',
},
{
title: '市场价',
dataIndex: 'id',
key: 'id',
dataIndex: 'marketPrice',
key: 'marketPrice',
},
{
title: '合同/订单价',
dataIndex: 'id',
key: 'id',
dataIndex: 'orderPrice',
key: 'orderPrice',
},
{
title: '合同/订单',
dataIndex: 'id',
key: 'id',
dataIndex: 'code',
key: 'code',
},
{
title: '供应会员ID',
dataIndex: 'id',
key: 'id',
dataIndex: 'upperMemberId',
key: 'upperMemberId',
},
{
title: '供应会员名称',
dataIndex: 'id',
key: 'id',
dataIndex: 'upperMemberName',
key: 'upperMemberName',
},
{
title: '价格有效从',
dataIndex: 'id',
key: 'id',
dataIndex: 'effectiveStartTime',
key: 'effectiveStartTime',
},
{
title: '价格有效到',
dataIndex: 'id',
key: 'id',
dataIndex: 'effectiveEndTime',
key: 'effectiveEndTime',
},
];
const fetchData = (params: any) => {
return new Promise(resolve => {
getProductCommodityGetUnitPriceStrategyList(params).then(res => {
getProductPriceManagementGetGoodsPriceHistory({
...params,
goodsPriceId,
}).then(res => {
const { data } = res;
resolve(data);
});
......
import React, { useRef } from 'react';
import { Button, Card, Input } from 'antd';
import { Button, Card, Input, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import StandardTable from '@/components/StandardTable';
import { ColumnType } from 'antd/lib/table/interface';
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { librarySearch } from '../schema';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { history, useIntl } from 'umi';
import { getProductCommodityGetUnitPriceStrategyList } from '@/services/ProductV2Api';
import {
getProductPriceManagementGetGoodsPriceList,
ProductPriceManagementAddGoodsPrice,
} from '@/services/ProductV2Api';
import AuthButton from '@/components/AuthButton';
const formActions = createFormActions();
......@@ -21,84 +22,91 @@ const PriceLibrary: React.FC<{}> = () => {
const columns: ColumnType<any>[] = [
{
title: '物料编号',
dataIndex: 'id',
key: 'id',
dataIndex: 'goodsCode',
key: 'goodsCode',
},
{
title: '物料名称',
dataIndex: 'id',
key: 'id',
dataIndex: 'name',
key: 'name',
},
{
title: '规格型号',
dataIndex: 'id',
key: 'id',
dataIndex: 'type',
key: 'type',
},
{
title: '品类',
dataIndex: 'id',
key: 'id',
dataIndex: 'customerCategory',
key: 'customerCategory',
render: text => text?.name,
},
{
title: '品牌',
dataIndex: 'id',
key: 'id',
dataIndex: 'unitName',
key: 'unitName',
render: text => text?.name,
},
{
title: '单位',
dataIndex: 'id',
key: 'id',
dataIndex: 'unitName',
key: 'unitName',
},
{
title: '目录价',
dataIndex: 'id',
key: 'id',
dataIndex: 'costPrice',
key: 'costPrice',
},
{
title: '市场价',
dataIndex: 'id',
key: 'id',
render: text => {
dataIndex: 'marketPrice',
key: 'marketPrice',
render: (text, record) => {
return (
<Input
prefix={intl.formatMessage({
id: 'priceManage.priceStrategy.columns.currency',
})}
defaultValue={text}
onPressEnter={(e: any)=>console.log(e.target.value,'eeeeeeeeeee')}
onPressEnter={(e: any) =>
updatePrice({
goodsPriceId: record.id,
marketPrice: e.target.value,
})
}
/>
);
},
},
{
title: '合同/订单价',
dataIndex: 'id',
key: 'id',
dataIndex: 'orderPrice',
key: 'orderPrice',
},
{
title: '合同/订单',
dataIndex: 'id',
key: 'id',
dataIndex: 'code',
key: 'code',
},
{
title: '供应会员ID',
dataIndex: 'id',
key: 'id',
dataIndex: 'upperMemberId',
key: 'upperMemberId',
},
{
title: '供应会员名称',
dataIndex: 'id',
key: 'id',
dataIndex: 'upperMemberName',
key: 'upperMemberName',
},
{
title: '价格有效从',
dataIndex: 'id',
key: 'id',
dataIndex: 'effectiveStartTime',
key: 'effectiveStartTime',
},
{
title: '价格有效到',
dataIndex: 'id',
key: 'id',
dataIndex: 'effectiveEndTime',
key: 'effectiveEndTime',
},
{
title: intl.formatMessage({
......@@ -106,7 +114,7 @@ const PriceLibrary: React.FC<{}> = () => {
}),
dataIndex: 'option',
width: 128,
render: (text: any, record: any) => {
render: (_text: any, record: any) => {
return (
<AuthButton btnCode="">
<Button
......@@ -124,7 +132,7 @@ const PriceLibrary: React.FC<{}> = () => {
const fetchData = (params: any) => {
return new Promise(resolve => {
getProductCommodityGetUnitPriceStrategyList(params).then(res => {
getProductPriceManagementGetGoodsPriceList(params).then(res => {
const { data } = res;
resolve(data);
});
......@@ -132,9 +140,24 @@ const PriceLibrary: React.FC<{}> = () => {
};
const handleModify = (record: any) => {
history.push(`${history.location.pathname}/detail?id=${record.id}`);
history.push(
`${history.location.pathname}/detail?goodsPriceId=${record.id}`,
);
};
const updatePrice = params => {
ProductPriceManagementAddGoodsPrice(params).then(res => {
if (res.code === 1000) {
message.success(res.message);
} else {
message.error(
intl.formatMessage({
id: `${res.code}`,
defaultMessage: res.message,
}),
);
}
});
};
return (
<PageHeaderWrapper>
<Card>
......
......@@ -488,25 +488,25 @@ export const librarySearch: ISchema = {
},
},
properties: {
wlbh: {
code: {
type: 'string',
'x-component-props': {
placeholder: '物料编号',
},
},
wlmc: {
name: {
type: 'string',
'x-component-props': {
placeholder: '物料名称',
},
},
pl: {
customerCategoryId: {
type: 'string',
'x-component-props': {
placeholder: '品类',
},
},
gyhymc: {
uppreMemberName: {
type: 'string',
'x-component-props': {
placeholder: '供应会员名称',
......
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