Commit 5d7382d2 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 仓位区块添加上游供应商品相关信息

parent 43e733cf
import React, {useState, useRef, useEffect} from 'react'
import { history, Prompt } from 'umi'
import moment from 'moment'
import { Button, Card, Row, Tabs, Tag } from 'antd'
import { Button, Card, Row, Tabs, Tag, Col } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
......@@ -204,11 +204,11 @@ const AddRepository:React.FC<{}> = (props) => {
backIcon={<ReutrnEle description="返回"/>}
className='addRepository'
title="仓位库存调拨"
extra={[
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
保存
</Button>,
]}
// extra={[
// <Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
// 保存
// </Button>,
// ]}
>
<Card className=''>
<FormProvider>
......@@ -216,6 +216,13 @@ const AddRepository:React.FC<{}> = (props) => {
<Tabs type='card' defaultActiveKey='tab1' onChange={topTableChange}>
<Tabs.TabPane key='tab1' tab='仓位设置'>
<PositionSetting onFieldChange={onPublicFieldChange} addSchemaAction={addSchemaAction} schema={repositTabOneSchema} formSubmit={formSubmit}/>
<Row>
<Col offset={6} style={{marginTop: 40}}>
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
保存
</Button>
</Col>
</Row>
</Tabs.TabPane>
<Tabs.TabPane key='tab2' tab='库存调入\调出'>
<Tabs defaultActiveKey='tab2-1' tabPosition='left'>
......
......@@ -315,6 +315,18 @@ const BatchPositionSetting:React.FC<BatchPositionSettingProps> = (props) => {
align: 'center',
key: 'unitName',
},
{
title: '供应会员',
dataIndex: 'upperMemberName',
align: 'center',
key: 'upperMemberName',
},
{
title: '供应库存',
dataIndex: 'upperStockCount',
align: 'center',
key: 'upperStockCount',
},
]
const formSearch: ISchema = {
......@@ -513,75 +525,75 @@ const BatchPositionSetting:React.FC<BatchPositionSettingProps> = (props) => {
schema={schema}
/>
<ModalTable
modalTitle='选择会员'
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
visible={visibleChannelMember}
columns={columnsSetMember}
rowSelection={memberRowSelection}
fetchTableData={params => fetchMemberList(params)}
formilyProps={
{
ctx: {
schema: formSearch,
components: { ModalSearch: Search, SearchSelect, Submit, Select } ,
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
}
modalTitle='选择会员'
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
visible={visibleChannelMember}
columns={columnsSetMember}
rowSelection={memberRowSelection}
fetchTableData={params => fetchMemberList(params)}
formilyProps={
{
ctx: {
schema: formSearch,
components: { ModalSearch: Search, SearchSelect, Submit, Select } ,
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
}
}
}
resetModal={{
destroyOnClose: true
}}
tableProps={{
rowKey: 'memberId'
}}
/>
<ModalTable
modalTitle='选择商品'
confirm={handleOkAddProduct}
cancel={handleCancelAddProduct}
visible={visibleChannelRroduct}
columns={columnsSetProduct}
rowSelection={productRowSelection}
fetchTableData={params => fetchProductList(params)}
formilyProps={
{
ctx: {
schema: formProduct,
components: { ModalSearch: Search, SearchSelect, Submit } ,
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
}
}
resetModal={{
destroyOnClose: true
}}
tableProps={{
rowKey: 'memberId'
}}
/>
<ModalTable
modalTitle='选择商品'
confirm={handleOkAddProduct}
cancel={handleCancelAddProduct}
visible={visibleChannelRroduct}
columns={columnsSetProduct}
rowSelection={productRowSelection}
fetchTableData={params => fetchProductList(params)}
formilyProps={
{
ctx: {
schema: formProduct,
components: { ModalSearch: Search, SearchSelect, Submit } ,
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
}
}
}
resetModal={{
destroyOnClose: true
}}
tableProps={{
rowKey: 'id',
// onRow: (record) => ({
// onClick: () => {
// productRowCtl.setSelectRow([record]);
// productRowCtl.setSelectedRowKeys([record.id]);
// },
// })
}}
/>
}
resetModal={{
destroyOnClose: true
}}
tableProps={{
rowKey: 'id',
// onRow: (record) => ({
// onClick: () => {
// productRowCtl.setSelectRow([record]);
// productRowCtl.setSelectedRowKeys([record.id]);
// },
// })
}}
/>
</>
)
......
......@@ -220,6 +220,8 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
addSchemaAction.setFieldValue('brand', selectResult.brandName)
addSchemaAction.setFieldValue('unit', selectResult.unitName)
addSchemaAction.setFieldValue('productId', selectResult.id)
addSchemaAction.setFieldValue('upperMemberName', selectResult.upperMemberName)
addSchemaAction.setFieldValue('upperStockCount', selectResult.upperStockCount)
addSchemaAction.setFieldState('inventory', state => {
state.props["x-props"] = {
addonAfter: <div style={{marginLeft: 4}}>{selectResult.unitName}</div>
......@@ -332,6 +334,18 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
align: 'center',
key: 'unitName',
},
{
title: '供应会员',
dataIndex: 'upperMemberName',
align: 'center',
key: 'upperMemberName',
},
{
title: '供应库存',
dataIndex: 'upperStockCount',
align: 'center',
key: 'upperStockCount',
}
]
const formSearch: ISchema = {
......
......@@ -85,11 +85,26 @@ const Repositories: React.FC<{}> = () => {
key: 'unit',
},
{
title: '库存',
title: '现有库存',
dataIndex: 'inventory',
key: 'inventory',
},
{
title: '已用库存',
dataIndex: 'alreadyiInventory',
key: 'alreadyiInventory',
},
{
title: '供应会员',
dataIndex: 'upperMemberName',
key: 'upperMemberName',
},
{
title: '供应库存',
dataIndex: 'upperStockCount',
key: 'upperStockCount',
},
{
title: '仓位状态',
dataIndex: 'status',
key: 'status',
......
......@@ -295,7 +295,19 @@ export const repositMoreSchema: ISchema = padRequiredMessage({
// }
],
default: 1
}
},
upperMemberName: {
type: 'string',
title: '供应会员',
"x-component": 'Text',
default: '暂无'
},
upperStockCount: {
type: 'number',
title: '供应库存',
"x-component": 'Text',
default: '暂无'
},
}
}
}
......@@ -527,7 +539,19 @@ export const repositDetailSchema: ISchema = padRequiredMessage({
// }
],
default: 1
}
},
upperMemberName: {
type: 'string',
title: '供应会员',
"x-component": 'Text',
default: '暂无'
},
upperStockCount: {
type: 'number',
title: '供应库存',
"x-component": 'Text',
default: '暂无'
},
}
}
}
......@@ -925,7 +949,19 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
// }
],
default: 1
}
},
upperMemberName: {
type: 'string',
title: '供应会员',
"x-component": 'Text',
default: '暂无'
},
upperStockCount: {
type: 'number',
title: '供应库存',
"x-component": 'Text',
default: '暂无'
},
}
}
}
......
......@@ -37,7 +37,7 @@ export const fetchOrderApi = {
},
/** 获取支付信息列表 */
async getPayInfoList(params) {
const { data } = await PublicApi.postOrderBuyerCreateB2bPaymentFind(params)
const { data } = await PublicApi.postOrderBuyerCreateB2bPaymentFind(params, { ctlType: 'none' })
return data
},
......
......@@ -23,7 +23,7 @@ export const PriceComp = (props) => {
</div>
}
/** 修改合同下单 初始值转换 */
/** 修改b2b询价报价下单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
......@@ -42,29 +42,23 @@ export const procurmentRenderInit = (initValue: any) => {
digest: initValue.digest,
deliverDate: initValue.consignee.deliverDate,
theInvoiceId: initValue.invoice?.invoiceId || null,
hasContract: initValue.hasContract,
contractNo: initValue.contract.contractNo,
contract: {...initValue.contract},
quoteNo: initValue.quoteNo,
}
}
/** 修改采购合同下单 回显商品字段转换 */
/** 修改b2b询价报价下单 回显商品字段转换 */
export const procurementRenderField = (data) => {
const _orderProductRequests = data.product.products
return _orderProductRequests.map(item => {
return {
...item,
// 此id为sukId
relevanceProductId: item.quotedSkuId,
// relevanceSkuId: item.quotedSkuId,
relevanceProductName: item.quotedName,
relevanceProductBrand: item.quotedBrand,
relevanceProductCategory: item.quotedCategory,
relevanceProductSpec: item.quotedSpec,
productId: item.skuId,
productName: item.name,
logistics: item.deliverType,
id: item.productId,
code: item.productNo,
type: item.spec,
unitPrice: item.price,
purchaseCount: item.quantity,
taxInclusive: item.tax,
money: item.amount,
// 冗余memberId memberRoleId查询自提地址使用
memberId: data.vendorMemberId,
memberRoleId: data.vendorRoleId,
......@@ -316,11 +310,10 @@ export const productInfoColumns: any[] = [
key: 'unitPrice',
},
{
title: '会员折扣',
dataIndex: 'memberPrice',
title: '库存',
dataIndex: 'stock',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice && text ? text * 100 + '%' : null
key: 'stock',
},
{
title: '采购数量',
......@@ -358,11 +351,11 @@ export const productInfoColumns: any[] = [
align: 'center',
key: 'logistics',
render: (t, r) => {
if(r.logistics?.deliveryType === 1)
if(r.logistics === 1)
return "物流(默认)"
else if(r.logistics?.deliveryType === 2)
return <AddressPop pickInfo={t}>{DELIVERY_TYPE[t.deliveryType]}</AddressPop>
else if(r.logistics?.deliveryType === 3)
else if(r.logistics === 2)
return <AddressPop pickInfo={t}>{DELIVERY_TYPE[t]}</AddressPop>
else if(r.logistics === 3)
return "无需配送"
}
},
......
......@@ -9,7 +9,7 @@ import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay, useOrderUpdateChangeOther } from './effects'
import { orderCombination, orderTypeLabelMap, procurementProcessField } from './constant'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { OrderModalType } from '@/constants/order'
import ProductModalTable from './components/productModalTable'
import InquiryModalTable from './components/inquiryModalTable'
......@@ -143,18 +143,14 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
useEffect(() => {
if (id) {
setFormLoading(true)
// @ts-ignore
PublicApi.getOrderProcurementOrderDetails({
id
PublicApi.getOrderBuyerCreateDetail({
orderId: id
}).then(res => {
const { data } = res
setInitFormValue({
...data,
products: [],
deliveryTime: formatTimeString(data.deliveryTime)
})
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('products', data.orderProductRequests)
addSchemaAction.setFieldValue('products', _orderProductRequests)
}, 1000)
setFormLoading(false)
})
......
......@@ -4,7 +4,7 @@ import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useEffect, useState, useRef } from 'react'
import { PublicApi } from '@/services/api'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => {
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any = []): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
// const { schemaActions, detailData } = useContext(ReadyAddOrderDetailContext)
......@@ -58,7 +58,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
const handleSave = row => {
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('payments')];
const index = newData.findIndex(item => row.payCount === item.payCount);
const index = newData.findIndex(item => row.batchNo === item.batchNo);
const item = newData[index];
newData.splice(index, 1, {
...item,
......
......@@ -96,7 +96,7 @@ const basicInfo: ISchema = {
"x-linkages": [
{
type: 'value:schema',
target: "supplyMembersName",
target: "vendorMemberName",
condition: `{{$self.editable && !!$value}}`,
schema: {
"x-component-props": {
......
......@@ -22,8 +22,8 @@ export const useSelfTable = () => {
}
const handleEdit = (record: any) => {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/srm/edit?id=${record.orderId}${record.type === 4 ? '&type=4' : ''}`)
// history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/edit?id=${record.id}${record.type === 4 ? '&type=4' : ''}`)
const { orderType } = record
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/${orderType === 1 ? 'b2b' : 'srm'}/edit?id=${record.orderId}`)
}
/** 参照后台数据生成 */
......
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