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

fix:处理仓位传参列表传参问题,处理销售订单修改价格和支付比例的价格同步

parent 1288f304
......@@ -72,7 +72,7 @@ export const productModalSchema: ISchema = {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '请输入商品名称/ID',
placeholder: '请输入商品名称',
align: 'flex-left',
},
},
......
......@@ -72,7 +72,7 @@ export const productModalSchema: ISchema = {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '请输入商品名称/ID',
placeholder: '请输入商品名称',
align: 'flex-left',
},
},
......
......@@ -47,4 +47,28 @@ export const useUnitPreview = (initValue, context) => {
context.setFieldValue('itemNo', initValue.itemNo)
}
}, [initValue])
}
// 高级筛选schema中用于输入搜索品牌的Effect
export const searchBrandOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
PublicApi.getProductSelectGetSelectBrand({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
// 高级筛选schema中用于输入搜索商品品类的Effect
export const searchCustomerCategoryOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
PublicApi.getProductSelectGetSelectCustomerCategory({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
\ No newline at end of file
......@@ -35,11 +35,25 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { repositSchema } from './schema';
import { PublicApi } from '@/services/api';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effects';
const formActions = createFormActions();
// 模拟请求
const fetchData = async (params: any) => {
console.log(params)
if(params?.category) {
formActions.getFieldState('category', state => {
let categorys = state.props['x-component-props'].dataoption
params.category = categorys.filter(i => i.id === params.category)[0].name
})
}
if(params?.brand) {
formActions.getFieldState('brand', state => {
let brands = state.props['x-component-props'].dataoption
params.brand = brands.filter(i => i.id === params.brand)[0].name
})
}
const res = await PublicApi.getWarehouseFreightSpaceList(params);
return res.data;
};
......@@ -190,6 +204,12 @@ const Repositories: React.FC<{}> = () => {
'name',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('brand').subscribe(state => {
searchBrandOptionEffect(actions, 'brand')
})
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'category')
})
}}
schema={repositSchema}
/>
......
......@@ -99,30 +99,60 @@ export const repositSchema: ISchema = padRequiredMessage({
placeholder: '商品名称'
}
},
category: {
brand: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
placeholder: '请选择品类',
style: {
width: 160,
}
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '160px' },
searchValue: null,
dataoption: [],
},
enum: []
},
brand: {
category: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
placeholder: '请选择品牌',
style: {
width: 160
}
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品类',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '160px' },
searchValue: null,
dataoption: []
},
enum: []
},
// category: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
// placeholder: '请选择品类',
// style: {
// width: 160,
// }
// },
// enum: []
// },
// brand: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// fetchSearch: PublicApi.getProductSelectGetSelectBrand,
// placeholder: '请选择品牌',
// style: {
// width: 160
// }
// },
// enum: []
// },
}
},
submit: {
......
......@@ -227,7 +227,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
}
const asyncGetMemberPrice = async (asyncData: any[]) => {
return await Promise.all(asyncData.filter(v => v.memberPrice === undefined).map(async v => {
return await Promise.all(asyncData.filter(v => v.memberPrice === undefined).map(async v => {
const {code, data} = await PublicApi.getMemberManageUpperCreditParamGet({
parentMemberId: v.memberId,
parentMemberRoleId: v.memberRoleId
......@@ -313,7 +313,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
dataIndex: 'memberPrice',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text + '%') : null
render: (text, record) => record.isMemberPrice ? (text * 100 + '%') : null
},
{
title: creditsCommodity ? '兑换数量' : '采购数量',
......
......@@ -85,6 +85,7 @@ const warehouseColumns: any[] = [
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => {
const { reloadFormData } = useContext(OrderDetailContext)
const { orderProductRequests = [], receiverAddressId, freight, amount, orderModel } = dataSource || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
......@@ -107,7 +108,11 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
useEffect(() => {
if(changeTotal){
// 执行修改订单运费
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2})
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2}).then(res => {
if(res.code === 1000) {
reloadFormData()
}
})
}
}, [amountMoney])
......@@ -291,7 +296,7 @@ const EditableCell: React.FC<EditableCellProps> = ({
};
const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const { ctl, data } = useContext(OrderDetailContext)
const { ctl, data, reloadFormData } = useContext(OrderDetailContext)
const { page_type } = usePageStatus()
const { orderProductRequests = [], orderModel } = data || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
......@@ -351,7 +356,11 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
...row,
});
// 执行修改订单价格
PublicApi.postOrderProductPriceUpdate({orderId: data.id, orderDetailsId: row.id, price: row.price, type: 1})
PublicApi.postOrderProductPriceUpdate({orderId: data.id, orderDetailsId: row.id, price: row.price, type: 1}).then(res => {
if(res.code === 1000) {
reloadFormData()
}
})
ctl.setData({
...data,
orderProductRequests: newData
......@@ -406,7 +415,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
dataIndex: 'memberPrice',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text + '%') : null
render: (text, record) => record.isMemberPrice ? (text * 100 + '%') : null
},
{
title: creditsCommodity ? '兑换数量' : '采购数量',
......@@ -485,6 +494,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
currentRef={warehouseRef}
confirm={() => setWarehouseVisible(false)}
fetchTableData={params => fetchWarehouseData(params)}
resetModal={{
destroyOnClose: true
}}
/>
</MellowCard>
)
......
......@@ -64,7 +64,7 @@ export const useSelfTable = () => {
},
{ title: '收货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 收货单号跳转
{ title: '收货单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> },
{ title: '入库单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> },
{
title: '订单类型',
align: 'center',
......
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