Commit 3fffd890 authored by 前端-许佳敏's avatar 前端-许佳敏

仓位bug修复

parent 95c8f37e
......@@ -144,7 +144,8 @@ const AddRepository:React.FC<{}> = (props) => {
inventory: values.inventory,
inventoryDeductWay: values.inventoryDeductWay,
shopIds: values.shopIds,
isAllMemberShare: values.isAllMemberShare
isAllMemberShare: values.isAllMemberShare,
shopType: values.shopType
}
if (values['applyMember']) {
params['applyMember'] = values['applyMember'].map(v => v.memberId)
......
export enum OrderModalType {
/**
* 进货单下单
*/
PURCHASE_ORDER = 5,
/**
* 手工下单
*/
HAND_ORDER,
/**
* 询价报价下单
*/
INQUIRY_QUOTATION_ORDER,
/**
* 需求报价下单
*/
DEMAND_QUOTATION_ORDER = 206,
DEMAND_QUOTATION_ORDER,
/**
* 合并订单下单
*/
......@@ -28,19 +42,15 @@ export enum OrderModalType {
* 渠道现货手工下单
*/
CHANNEL_SPOT_MANUAL_ORDER,
}
/**
* 询价报价下单
*/
INQUIRY_QUOTATION_ORDER,
/**
* 进货单下单
*/
PURCHASE_ORDER,
/**
* 手工下单
*/
HAND_ORDER
}
\ No newline at end of file
export const orderTypeLabel = ['',
'询价采购',
'需求采购',
'现货采购',
'集采',
'积分兑换',
'渠道直采',
'渠道现货',
'渠道积分兑换'
]
\ No newline at end of file
......@@ -10,15 +10,19 @@ import NiceForm from '@/components/NiceForm'
import { orderDetailSchema } from './schema'
import { useDetailOrder } from './model/useDetailOrder'
import ModalTable from '@/components/ModalTable'
import { useModelTypeChange } from './effects'
import { OrderModalType, orderTypeLabel } from './constant'
export interface PurchaseOrderDetailProps {}
const addSchemaAction = createFormActions()
// 采购订单详情页. 包含新增和编辑
const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const { productColumns } = useDetailOrder()
// 页面进入时, 当前所处的下单模式
const { orderModel } = history.location.query
const { productColumns, setShowProBtn, showProBtn } = useDetailOrder({
orderModel
})
// 页面进入时, 当前所处的下单模式
const { pageStatus } = usePageStatus()
const handleOrderNo = () => {}
......@@ -27,7 +31,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const orderNoPrice = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderNo}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const orderMember = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const productAddButton = <Button block type='default' style={{margin: '24px auto'}}>选择订单商品</Button>
const productAddButton = showProBtn && <Button block type='default' style={{margin: '24px auto'}}>选择订单商品</Button>
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -45,6 +49,28 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
actions={addSchemaAction}
schema={orderDetailSchema}
className='useConnectBtnWrapper'
effects={($, ctx) => {
useModelTypeChange(state => {
const { value } = state
// 报价单的值 等同于是否填写过报价单
const quotationOrderValue = ctx.getFieldValue('quotationNo')
// 当选择了手工下单、渠道直采手工下单、渠道现货手工下单、或者选择了合并订单下单并未选择报价单则需要显示商品列表添加接口
if (
value === OrderModalType.HAND_ORDER ||
value === OrderModalType.CHANNEL_DIRECT_MINING_ORDER ||
value === OrderModalType.CHANNEL_SPOT_MANUAL_ORDER ||
(value === OrderModalType.CONSOLIDATED_ORDER && quotationOrderValue)
) {
setShowProBtn(true)
} else {
setShowProBtn(false)
}
// 选择某种类型时, 需显示对应的订单类型
ctx.setFieldValue('type', orderTypeLabel[value - 4]) // -4 获得对应的数组下标, 由于id是固定的
})
}}
expressionScope={{
orderNoPrice,
orderMember,
......
import { ISchemaFormActions, FormEffectHooks } from '@formily/antd';
export const useModelTypeChange = (callback) => {
// 下单模式发生改变时
FormEffectHooks.onFieldValueChange$('orderModel').subscribe(state => {
callback(state)
})
}
\ No newline at end of file
import React, { useState } from 'react'
import { OrderModalType } from '../constant'
export const useDetailOrder = () => {
export const useDetailOrder = (options) => {
// const [productDataSource, setProductDataSource] = useState
const [showProBtn, setShowProBtn] = useState(options.orderModel)
const [showMemberType, setShowMemberType] = useState(false)
const productColumns: any[] = [
{
title: '商品ID',
......@@ -30,6 +34,10 @@ export const useDetailOrder = () => {
]
return {
productColumns
productColumns,
showProBtn,
setShowProBtn,
showMemberType,
setShowMemberType
}
}
\ No newline at end of file
......@@ -103,7 +103,29 @@ const basicInfo: ISchema = {
disabled: true,
addonAfter: "{{orderMember}}"
},
}
},
orderNo: {
type: 'string',
title: '订单编号',
"x-component": 'text'
},
type: {
type: 'string',
title: '订单类型',
"x-component": 'text'
},
createTime: {
type: 'string',
title: '下单时间'
},
interiorState: {
type: 'string',
title: '内部状态'
},
externalState: {
type: 'string',
title: '外部状态'
},
}
},
......
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