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

fix: 对接新增物流单

parent 0efdc615
......@@ -178,45 +178,18 @@ export const addOrderModalSchema: ISchema = {
},
},
properties: {
customerCategoryId: {
category: {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'components.shangpinpinlei' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
brandId: {
brand: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'components.shangpinpinpai' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
},
},
// brandId: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// placeholder: '请选择品牌',
// fetchSearch: getProductSelectGetMemberBrand,
// style: {
// width: 160
// },
// queryParams: {},
// }
// },
submit: {
"x-component": 'Submit',
"x-mega-props": {
......
......@@ -145,9 +145,9 @@ const AddProducts: React.FC<{}> = (props) => {
// 切换模板
const renderTemplate = () => {
// if(currentTemplateName === 'science')
// return <ProductDescFormDefualt />
// return <ProductDescFormDefualt />
// else if(currentTemplateName === 'cloud')
// return <ProductDescFormCloud />
// return <ProductDescFormCloud />
return <ProductDescFormYang />
}
......
......@@ -318,7 +318,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 生成表格dataSource
let combineArray = SKUCombine(_attributeValueArr)
console.log(combineArray, 'combineArray')
// console.log(combineArray, 'combineArray')
setCombineAttributeArray(combineArray)
setAttributeObjArr(_temp_attributeObjArr)
setAttributeValObjArr(_temp_attributeValObjArr)
......@@ -412,7 +412,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {})
}
}
console.log(_tableDataSource, '_tableDataSource')
// console.log(_tableDataSource, '_tableDataSource')
setTableDataSource(productName ? _tableDataSource : []) // 通过商品名称来判断是否显示表格数据
constructedPrarams()
......@@ -478,7 +478,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
id: _tableDataSource[0] && _tableDataSource[0][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.id' })],
}) /*带上货品id 带上单价*/ /* code1 end */
setPriceAttributeParams(_paramsArray)
console.log(_paramsArray, '_paramsArray')
// console.log(_paramsArray, '_paramsArray')
}
/**
......
......@@ -25,7 +25,10 @@ const ISalePlaceholder = [
getIntl().formatMessage({ id: 'commodity.products.addProductsItem.productDescFormCloud.ISalePlaceholder.5' }),
]
const ProductDescFormCloud: React.FC<{}> = (props) => {
/**
* YunXianCai式商品模板
*/
const ProductDescFormCloud: React.FC<{}> = () => {
const intl = useIntl();
const { token } = getAuth() || {}
// 初始商品特色4个input值和3*4个image值
......
......@@ -19,6 +19,9 @@ import { postContractContractSignSaleSignContractCreate } from '@/services/Contr
const schemaActions = createFormActions()
/**
* 商品 默认模板
*/
const ProductDescFormDefualt: React.FC<{}> = () => {
const intl = useIntl();
const [fileImageList, setFileImageList] = useState<any>([])
......
......@@ -22,7 +22,10 @@ const schemaActions = createFormActions()
const imagesTypeKeyValue = ['', 'descriptionImages', 'certificationImages', 'reportImages']
const ProductDescFormDefualt: React.FC<{}> = () => {
/**
* YangLian式商品模板
*/
const ProductDescFormYang: React.FC<{}> = () => {
const intl = useIntl();
const [fileImageList, setFileImageList] = useState<any>({
descriptionImages: [], // 商品描述
......@@ -430,4 +433,4 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
</div>)
}
export default observer(ProductDescFormDefualt)
export default observer(ProductDescFormYang)
import { getOrderBuyerCreatePageItems, getOrderBuyerPageItems, GetOrderBuyerPageItemsResponse, getOrderBuyerTakePageItems, getOrderBuyerValidatePageItems, getOrderVendorPageItems, getOrderVendorTakePageItems, getOrderVendorValidatePageItems } from '@/services/OrderNewV2Api'
import {
getOrderBuyerCreatePageItems,
getOrderBuyerPageItems,
GetOrderBuyerPageItemsResponse,
getOrderBuyerTakePageItems,
getOrderBuyerValidatePageItems,
getOrderVendorPageItems,
getOrderVendorTakePageItems,
getOrderVendorValidatePageItems,
getOrderVendorOrderTypeAll,
getOrderBuyerOrderTypeAll
} from '@/services/OrderNewV2Api'
import { getProductSelectGetSelectCategory } from '@/services/ProductV2Api'
import { getPurchaseRequisitionFindInnerStatusEnum } from '@/services/PurchaseV2Api'
import { useEffect, useState } from 'react'
......@@ -151,3 +162,35 @@ export const getSaleOrderReadyDistributionPageSelectOption = () => {
return state
}
/** 销售订单 通用 订单类型下拉框列表 */
export const getSaleOrderPublicUsePageSelectOption = () => {
const [state, setstate] = useState<any>([])
useEffect(() => {
getOrderVendorOrderTypeAll({}).then(res => {
const { code, data } = res
if (code === 1000) {
setstate(data)
}
})
}, [])
return state
}
/** 采购订单 通用 订单类型下拉框列表 */
export const getPurchaseOrderPublicUsePageSelectOption = () => {
const [state, setstate] = useState<any>([])
useEffect(() => {
getOrderBuyerOrderTypeAll({}).then(res => {
const { code, data } = res
if (code === 1000) {
setstate(data)
}
})
}, [])
return state
}
import { getProductCommodityCommonGetCommodityListByBuyer } from "@/services/ProductV2Api"
import { getOrderVendorLogisticsProductPage } from "@/services/OrderNewV2Api"
export const fetchOrderApi = {
/** 弹窗获取商品列表 */
/** 弹窗获取 发货单 商品明细 */
async getProductList(params) {
const { data } = await getProductCommodityCommonGetCommodityListByBuyer(params, { useCache: true, ttl: 10 * 1000 })
const { data } = await getOrderVendorLogisticsProductPage(params, { useCache: true, ttl: 10 * 1000 })
return data
},
......
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis'
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { DELIVERY_TYPE, OrderModalType } from '@/constants/order'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { addOrderModalSchema } from '@/components/ModalTable/schema'
......@@ -10,11 +9,9 @@ import Search from '@/components/NiceForm/components/Search'
import SearchSelect from '@/components/NiceForm/components/SearchSelect';
import Submit from '@/components/NiceForm/components/Submit';
import DateSelect from '@/components/NiceForm/components/DateSelect';
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from '../../effects'
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch'
import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearch'
import { getLogisticsShipperAddressGet } from '@/services/LogisticsV2Api'
import { getIntl } from 'umi'
import { getIntl, history } from 'umi'
export interface ProductModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
......@@ -27,9 +24,9 @@ export interface ProductModalTableProps extends ModalTableProps {
export const productColumns: any[] = [
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.id'}),
dataIndex: 'id',
dataIndex: 'productId',
align: 'center',
key: 'id',
key: 'productId',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.name'}),
......@@ -39,62 +36,33 @@ export const productColumns: any[] = [
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.customerCategoryName'}),
dataIndex: 'customerCategoryName',
dataIndex: 'category',
align: 'center',
key: 'customerCategoryName',
key: 'category',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.brandName'}),
dataIndex: 'brandName',
dataIndex: 'brand',
align: 'center',
key: 'brandName',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.unitName'}),
dataIndex: 'unitName',
align: 'center',
key: 'unitName'
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.stockCount'}),
dataIndex: 'stockCount',
align: 'center',
key: 'stockCount'
key: 'brand',
},
]
// 下单类型->商城类型映射
const orderProductShopTypeMaps = {
[OrderModalType.PURCHASE_ORDER]: 1,
[OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER]: 3,
[OrderModalType.CHANNEL_EXISTING_PURCHASE_ORDER]: 4
}
export const filterProductDataById = (data, targetData) => {
return targetData.reduce(async (prev: any[], next) => {
const { logistics } = next
// 由于自选商品和进货单商品字段不一致,需手动同步
// 由于自选发货单商品和物流单单商品字段不一致,需手动同步
next.id = next.id || next.productId
next.productId = next.id || next.productId
next.brand = next.brand || next.brandName
next.category = next.category || next.customerCategoryName
next.unit = next.unit || next.unitName
next.productName = next.productName || next.name
next.deliverType = next.logistics.sendAddress // 保证和详情编辑字段一致
if (logistics.deliveryType === 2 && logistics.sendAddress) {
const { code, data } = await getLogisticsShipperAddressGet({
id: logistics.sendAddress
}, { ttl: 60 * 1000, useCache: true })
logistics.render = {...data, deliveryType: logistics.deliveryType}
} else {
logistics.render = DELIVERY_TYPE[logistics.deliveryType]
}
// 配送方式外置, 用于接口字段冗余
next.deliveryType = logistics.deliveryType
next.amount = next.quantity || next.amount
next.weight = next.weight || null
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const findResult = data.find(v => v.id === next.id)
const findResult = data.find(v => v.productId === next.productId)
// 由于迭代时,会出现promise的 已完成状态, 需转换一下,实现异步转同步化
if (!Array.isArray(prev)) {
......@@ -126,29 +94,16 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
}, [])
const handleConfirmProduct = async () => {
const newData = rowSelectionCtl.selectRow.map(v => {
v.orderMode = schemaAction.getFieldValue('orderMode')
v.shopId = schemaAction.getFieldValue('shopId')
v.buyerMemberId = schemaAction.getFieldValue('buyerMemberId')
v.buyerRoleId = schemaAction.getFieldValue('buyerRoleId')
return v
})
schemaAction.setFieldValue('products', await filterProductDataById([], newData))
const newData = [...rowSelectionCtl.selectRow]
schemaAction.setFieldValue('detailList', await filterProductDataById([], newData))
confirmModal && confirmModal()
setVisible(false)
}
const fetchProductList = (values) => {
const modelType = schemaAction.getFieldValue('orderMode')
const buyerMembersId = schemaAction.getFieldValue('buyerMemberId')
const shopId = schemaAction.getFieldValue('shopId')
const params = {
...values,
shopType: orderProductShopTypeMaps[modelType],
environment: 1,
memberId: buyerMembersId,
priceTypeList: [1],
shopId: schemaAction.getFieldValue('shopId')
orderId: history.location.query.id
}
return fetchOrderApi.getProductList(params)
}
......@@ -156,7 +111,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
return (
<ModalTable
modalTitle={getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.title'})}
modalTitle={getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.title'})}
width={900}
columns={productColumns}
visible={visible}
......@@ -167,11 +122,11 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
resetModal={{destroyOnClose: true, forceRender: true}}
modalType='none'
tableProps={{
rowKey: 'id',
rowKey: 'productId',
onRow: (record) => ({
onClick: () => {
rowSelectionCtl.appendSelectRow(record);
rowSelectionCtl.appendSelectRowKeys(record.id);
rowSelectionCtl.appendSelectRowKeys(record.productId);
},
})
}}
......@@ -186,12 +141,6 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
'name',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(() => {
searchCustomerCategoryOptionEffect(schemaAction, actions, 'customerCategoryId')
})
FormEffectHooks.onFieldChange$('brandId').subscribe(() => {
searchBrandOptionEffect(schemaAction, actions, 'brandId')
})
}
}
}}
......
......@@ -22,7 +22,8 @@ export const PriceComp = (props) => {
/**新增物流单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
shipmentOrderId: initValue.deliveryNo,
// shipmentOrderId: initValue.deliveryNo,
shipmentOrderCode: initValue.deliveryNo,
relevanceOrderId: initValue.orderId,
relevanceOrderCode: initValue.orderNo,
memberName: initValue.buyerMemberName,
......
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { getProductCustomerGetMemberCustomerCategoryTree, getProductSelectGetMemberBrand } from '@/services/ProductV2Api';
export const useMaterialTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('detailList').subscribe(state => {
export const useDetailTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('detailList').subscribe(() => {
// 强制渲染一次, 用于统计总数
update()
})
}
/**
* 高级筛选schema中用于获取供应商 商品品类Effect
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export const searchCustomerCategoryOptionEffect = (ctx: any, mctx: any, fieldName: string) => {
const params: any = {}
params['memberId'] = ctx.getFieldValue('vendorMemberId')
params['memberRoleId'] = ctx.getFieldValue('vendorRoleId')
mctx.getFieldState(fieldName, state => {
// params['name'] = state.props['x-component-props'].searchValue
getProductCustomerGetMemberCustomerCategoryTree(params).then(res => {
mctx.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
/**
* 高级筛选schema中用于获取供应商 商品品牌Effect
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export const searchBrandOptionEffect = (ctx: any, mctx: any, fieldName: string) => {
const params: any = {}
params['memberId'] = ctx.getFieldValue('vendorMemberId')
params['memberRoleId'] = ctx.getFieldValue('vendorRoleId')
mctx.getFieldState(fieldName, state => {
params['name'] = state.props['x-component-props'].searchValue
getProductSelectGetMemberBrand(params).then(res => {
mctx.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
......@@ -6,8 +6,8 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd
import { SaveOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { increaseSchema } from './schema'
import { useMaterialTableChangeForAmount } from './effects'
import { procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { useDetailTableChangeForAmount } from './effects'
import { procurementProcessField, procurmentRenderInit } from './constant'
import { useUpdate } from '@umijs/hooks'
import { help } from '../../common'
import styled from 'styled-components'
......@@ -17,7 +17,7 @@ import { FormDetailContext } from '@/formSchema/context'
import { useProductTable } from './model/useProductTable'
import { useFormDetail } from '@/formSchema/effects/useFormDetail'
import ProductModalTable from './components/productModalTable'
import { getOrderVendorCreateLogisticsDetail, getOrderVendorSellDeliveryDetail } from '@/services/OrderNewV2Api'
import { getOrderVendorCreateLogisticsDetail } from '@/services/OrderNewV2Api'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { getLogisticsCompanyPage, getLogisticsShipperAddressPage,postLogisticsOrderWaitSubmitAdd } from '@/services/LogisticsV2Api'
import addressText from '../../components/addressText'
......@@ -42,7 +42,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const intl = useIntl()
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'detailList']], reducer: v => v })
const data = form.getFieldValue('detailList')
console.log(data, 'data')
const totalCarton = data.reduce((prev, next) => (prev*1000 + (next.carton || 0)*1000)/1000, 0)
const totalWeight = data.reduce((prev, next) => (prev*1000 + (next.weight || 0)*1000)/1000, 0)
const totalVolume = data.reduce((prev, next) => (prev*1000 + (next.volume || 0)*1000)/1000, 0)
......@@ -77,13 +77,9 @@ const AddLogisticsOrder:React.FC<{}> = () => {
useEffect(() => {
if (id) {
setFormLoading(true)
getOrderVendorCreateLogisticsDetail({ orderId: '5870' }).then(res => {
getOrderVendorCreateLogisticsDetail({ orderId: id }).then(res => {
const { data } = res
setInitFormValue(() => procurmentRenderInit(data))
// const _orderProductRequests = procurementRenderField(data)
// setTimeout(() => {
// addSchemaAction.setFieldValue('detailList', _orderProductRequests)
// }, 1000)
setFormLoading(false)
})
getSettleAccountsPlatformConfigGetSettlementWay({memberId: memberId + '', roleId: memberRoleId + ''}).then(res => {
......@@ -97,7 +93,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
const handleSubmit = async (value) => {
try {
// let fnResult = null
// 新增物流单/编辑物流单
const params = { ...value }
console.log(value)
......@@ -107,11 +102,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
setBtnLoading(true)
const _params = procurementProcessField(params)
// if(id) {
// fnResult = await postPurchaseRequisitionUpdate({..._params, id})
// } else {
// fnResult = await postPurchaseRequisitionCreate(_params)
// }
const fnResult = await postLogisticsOrderWaitSubmitAdd(_params)
if (fnResult.code === 1000) {
setTimeout(() => {
......@@ -145,10 +135,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
}
const renderTitle = () => {
// intl.formatMessage({ id: 'saleOrder.xiugaiwuliudan', defaultMessage: '修改物流单' })
// if(preview) {
// return intl.formatMessage({ id: 'saleOrder.chakanwuliudan', defaultMessage: '查看物流单' })
// }
return intl.formatMessage({ id: 'saleOrder.xinzengwuliudan', defaultMessage: '新增物流单' })
}
......@@ -176,7 +162,7 @@ const AddLogisticsOrder:React.FC<{}> = () => {
effects={($, ctx) => {
$('onFormMount').subscribe(() => { })
// 物流明细信息的改动 渲染总额
useMaterialTableChangeForAmount(ctx, update)
useDetailTableChangeForAmount(ctx, update)
// 注入表单完成进度
formContext.useAttachmentChangeForContext(ctx)
......
import { useRef, useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { Button, message } from 'antd';
import { Button } from 'antd';
import { PriceComp, productInfoColumns } from '../constant';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
import { useModalTable } from './useModalTable';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useIntl } from 'umi';
// 对象按key排序(运用于商城传过来的阶梯价格排序)
export const sortByKey = (params) => {
let keys = Object.keys(params).sort((x,y)=> parseInt(x) - parseInt(y));
let newParams = {};
keys.forEach((key) => {
newParams[key] = params[key];
});
return newParams;
}
export const getUnitPriceTotal = (record) => {
const { pageStatus } = usePageStatus()
const purchaseCount = Number(record['purchaseCount']) || 0
// fix 当没有传递unitPrice字段时 自动容错, 单价显示为0
// fix 编辑订单取price
record.unitPrice = pageStatus === PageStatus.EDIT ? record.price : record.unitPrice || record.price || 0
if (typeof record.unitPrice === 'number') {
return record.isMemberPrice ?
Number((record.unitPrice * purchaseCount * record.memberPrice).toFixed(2))
:
Number((record.unitPrice * purchaseCount).toFixed(2))
}
if(record.unitPrice) {
record.unitPrice = sortByKey(record.unitPrice)
}
// fix 当没有传递unitPrice字段时 但有price字段时 补全unitPrice字段
if(record.price && JSON.stringify(record.unitPrice) === "{}") {
record.unitPrice = {'0-0': record.price}
}
// fix 当有unitPrice字段时 没有price字段时 补全price字段
if(!record?.price && JSON.stringify(record.unitPrice) !== "{}") {
if(Object.keys(record.unitPrice)[0] === '0-0') record.price = record.unitPrice['0-0']
}
let unitPrice = 0
Object.entries(record.unitPrice).forEach(([key, value]) => {
const [min, max] = key.split('-').map(v => Number(v))
if (min === 0 && max === 0) {
unitPrice = Number(value)
return false
}
if ((purchaseCount >= min && purchaseCount <= max) || (purchaseCount > max)) {
// 处于该区间或者大于该区间
unitPrice = Number(value)
return false
}
})
// 考虑会员折扣
let memberPrice = record.memberPrice
if(record.isMemberPrice) {
return Number((unitPrice * purchaseCount * memberPrice).toFixed(2))
} else {
return Number((unitPrice * purchaseCount).toFixed(2))
}
}
/**
* @param ctx schemaAction
*/
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const { pageStatus, preview = null } = usePageStatus()
const productRef = useRef<any>({})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox', customKey: 'productId'})
const intl = useIntl()
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('detailList')]
// 删除formvalue
......@@ -82,47 +27,26 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
rowSelectionCtl.setSelectedRowKeys(newData.map(v => v.id))
ctx.setFieldValue('detailList', newData)
// 商品行数变动 清空之前的支付信息
if (pageStatus === PageStatus.ADD) {
ctx.setFieldValue('payments', [])
}
}
const [productColumns, setProductColumns] = useState(() => {
// if (pageStatus === PageStatus.ADD) {
// 渲染操作
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'saleOrder.delete'})}</Button>
// 渲染单价
productInfoColumns[5].render = (t, r) => {
return r.price ? <span style={{color: 'red'}}>{r.price}</span> : <PriceComp priceSection={r.unitPrice}/>
}
// 渲染商品ID
productInfoColumns[0].render = (t, r) => {
return r.id
}
// 渲染操作
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'saleOrder.delete'})}</Button>
// } else {
// // 渲染单价
// productInfoColumns[5].render = (t, r) => <span style={{color: 'red'}}>¥ {r.price}</span>
// // 渲染商品ID
// productInfoColumns[0].render = (t, r) => r.productId
// return [...productInfoColumns].slice(0, productInfoColumns.length - 1)
// }
// 渲染单价
productInfoColumns[5].render = (t, r) => {
return r.price ? <span style={{color: 'red'}}>{r.price}</span> : <PriceComp priceSection={r.unitPrice}/>
}
// 渲染商品ID
productInfoColumns[0].render = (t, r) => {
return r.id
}
return productInfoColumns
})
const handleShowProduct = () => {
const buyerMemberId = ctx.getFieldValue('buyerMemberId')
const shopId = ctx.getFieldValue('shopId')
if (buyerMemberId && shopId) {
productRef.current.setVisible(true)
} else {
message.error(intl.formatMessage({id: 'purchaseOrder.orderCollect.model.message'}))
}
productRef.current.setVisible(true)
}
const productAddButton = !preview && <Button onClick={handleShowProduct} block type='default' style={{margin: '24px auto'}}>{intl.formatMessage({ id: 'saleOrder.xuanzeshangpin', defaultMessage: '选择商品' })}</Button>
......@@ -144,8 +68,6 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const newData = [...ctx.getFieldValue('detailList')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
row['money'] = getUnitPriceTotal(row)
row['productId'] = row.commodityId
newData.splice(index, 1, {
...item,
...row,
......
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { getSaleOrderReadyDistributionPageSelectOption } from '@/pages/transaction/effect';
import { getSaleOrderPublicUsePageSelectOption } from '@/pages/transaction/effect';
import { useIntl } from 'umi';
export const tableListSchema: any = () => {
const intl = useIntl()
const data = getSaleOrderReadyDistributionPageSelectOption()
const data = getSaleOrderPublicUsePageSelectOption()
if(data) {
return {
......
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