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

fix: 处理编辑积分商品副单价显示异常

parent 222212b7
...@@ -530,7 +530,7 @@ export default { ...@@ -530,7 +530,7 @@ export default {
'saleOrder.xuanze': '选择', 'saleOrder.xuanze': '选择',
'saleOrder.danjumingxi': '单据明细', 'saleOrder.danjumingxi': '单据明细',
'saleOrder.xiangguanxinxi': '相关信息', 'saleOrder.xiangguanxinxi': '相关信息',
'saleOrder.dinggoushuliang': '订数量', 'saleOrder.dinggoushuliang': '订数量',
'saleOrder.danjia(yuan)': '单价(元)', 'saleOrder.danjia(yuan)': '单价(元)',
'saleOrder.fahuoshuliang': '发货数量', 'saleOrder.fahuoshuliang': '发货数量',
'saleOrder.fahuojine': '发货金额(元)', 'saleOrder.fahuojine': '发货金额(元)',
......
...@@ -349,7 +349,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -349,7 +349,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if (updateFlag.current) { // 初次渲染tab 再次进入tab采用缓存数据 if (updateFlag.current) { // 初次渲染tab 再次进入tab采用缓存数据
if (productInfoByEdit.unitPriceAndPicList[i]?.unitPrice) { if (productInfoByEdit.unitPriceAndPicList[i]?.unitPrice) {
let unitPric = productInfoByEdit.unitPriceAndPicList[i]?.unitPrice let unitPric = productInfoByEdit.unitPriceAndPicList[i]?.unitPrice
// _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = orderlyLadderPrice(unitPric)
const _price = orderlyLadderPrice(unitPric) const _price = orderlyLadderPrice(unitPric)
const _priceRate = productInfoByEdit.unitPriceAndPicList[i]?.priceRate const _priceRate = productInfoByEdit.unitPriceAndPicList[i]?.priceRate
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _price _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _price
...@@ -363,13 +362,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -363,13 +362,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
} else { } else {
if (_tableDataSource[i] && tableDataSource[i] && tableDataSource[i][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })]) { if (_tableDataSource[i] && tableDataSource[i] && tableDataSource[i][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })]) {
let unitPric = _tableDataSource[i] && tableDataSource[i] && tableDataSource[i][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] let unitPric = _tableDataSource[i] && tableDataSource[i] && tableDataSource[i][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })]
// _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = orderlyLadderPrice(unitPric)
const _price = orderlyLadderPrice(unitPric) const _price = orderlyLadderPrice(unitPric)
const _priceRate = _tableDataSource[i] && tableDataSource[i] && tableDataSource[i][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })] const _priceRate = _tableDataSource[i] && tableDataSource[i] && tableDataSource[i][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })]
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _price _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _price
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })] = _priceRate _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })] = _priceRate
setAssistantUniquePriceRate(_priceRate) setAssistantUniquePriceRate(_priceRate)
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = (Number(_price) * Number(_priceRate) / 100).toFixed(2) const _priceNumber = Object.keys(_price)[0] === '0-0' ? Object.values(_price)[0] : Object.values(_price)
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = Array.isArray(_priceNumber) ? _priceNumber.map(_p => (Number(_p) * Number(_priceRate) / 100).toFixed(2)) : (Number(_priceNumber) * Number(_priceRate) / 100).toFixed(2)
// _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = (Number(_price) * Number(_priceRate) / 100).toFixed(2)
} else { } else {
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {} _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {}
} }
...@@ -412,6 +412,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -412,6 +412,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {}) _tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {})
} }
} }
console.log(_tableDataSource, '_tableDataSource')
setTableDataSource(productName ? _tableDataSource : []) // 通过商品名称来判断是否显示表格数据 setTableDataSource(productName ? _tableDataSource : []) // 通过商品名称来判断是否显示表格数据
constructedPrarams() constructedPrarams()
......
...@@ -3,9 +3,6 @@ import { getIntl } from "umi" ...@@ -3,9 +3,6 @@ import { getIntl } from "umi"
/** 新增销售发货单 初始值转换 */ /** 新增销售发货单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => { export const procurmentRenderInit = (initValue: any) => {
return { return {
vendorMemberId: initValue.vendorMemberId,
vendorMemberName: initValue.vendorMemberName,
vendorRoleId: initValue.vendorRoleId,
product: initValue.product, product: initValue.product,
receipts: getIntl().formatMessage({ id: 'saleOrder.dingdan', defaultMessage: '订单' }), receipts: getIntl().formatMessage({ id: 'saleOrder.dingdan', defaultMessage: '订单' }),
receiptsType: getIntl().formatMessage({ id: 'saleOrder.xiaoshoufahuodan', defaultMessage: '销售发货单' }), receiptsType: getIntl().formatMessage({ id: 'saleOrder.xiaoshoufahuodan', defaultMessage: '销售发货单' }),
...@@ -17,7 +14,7 @@ export const procurmentRenderInit = (initValue: any) => { ...@@ -17,7 +14,7 @@ export const procurmentRenderInit = (initValue: any) => {
} }
} }
/** 新增销售发货单 回显物料字段转换 */ /** 新增销售发货单 回显物料/商品字段转换 */
export const procurementRenderField = (data) => { export const procurementRenderField = (data) => {
const _orderProductRequests = data.product.products const _orderProductRequests = data.product.products
return _orderProductRequests.map(item => { return _orderProductRequests.map(item => {
...@@ -26,8 +23,7 @@ export const procurementRenderField = (data) => { ...@@ -26,8 +23,7 @@ export const procurementRenderField = (data) => {
id: item.productId, id: item.productId,
code: item.productNo, code: item.productNo,
type: item.spec, type: item.spec,
memberId: data.vendorMemberId, orderQuantity: item.quantity,
memberRoleId: data.vendorRoleId,
} }
}) })
} }
...@@ -80,10 +76,10 @@ export const productInfoColumns: any[] = [ ...@@ -80,10 +76,10 @@ export const productInfoColumns: any[] = [
key: 'unit', key: 'unit',
}, },
{ {
title: intl.formatMessage({ id: 'saleOrder.dinggoushuliang', defaultMessage: '订数量' }), title: intl.formatMessage({ id: 'saleOrder.dinggoushuliang', defaultMessage: '订数量' }),
dataIndex: 'quantity', dataIndex: 'orderQuantity',
align: 'center', align: 'center',
key: 'quantity', key: 'orderQuantity',
}, },
{ {
title: intl.formatMessage({ id: 'saleOrder.danjia(yuan)', defaultMessage: '单价(元)' }), title: intl.formatMessage({ id: 'saleOrder.danjia(yuan)', defaultMessage: '单价(元)' }),
...@@ -94,9 +90,9 @@ export const productInfoColumns: any[] = [ ...@@ -94,9 +90,9 @@ export const productInfoColumns: any[] = [
}, },
{ {
title: intl.formatMessage({ id: 'saleOrder.fahuoshuliang', defaultMessage: '发货数量' }), title: intl.formatMessage({ id: 'saleOrder.fahuoshuliang', defaultMessage: '发货数量' }),
dataIndex: 'count', dataIndex: 'deliveryQuantity',
align: 'center', align: 'center',
key: 'count', key: 'deliveryQuantity',
formItem: 'input', formItem: 'input',
editable: true, editable: true,
}, },
......
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { getProductCustomerGetCustomerCategoryTree, getProductSelectGetSelectBrand } from '@/services/ProductV2Api'; import { getProductCustomerGetCustomerCategoryTree, getProductSelectGetSelectBrand } from '@/services/ProductV2Api';
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
export const useMaterialTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('products').subscribe(state => {
// 强制渲染一次, 用于触发金额总数
update()
})
}
export const useInitShowField = () => {
const { pageStatus } = usePageStatus()
const utils = useLinkageUtils()
FormEffectHooks.onFormInit$().subscribe(() => {
// 初始化一些详情数据
// if (pageStatus === PageStatus.ADD) {
// utils.hide('orderNo')
// utils.hide('createTime')
// }
})
}
// 高级筛选schema中用于输入搜索品牌的Effect // 高级筛选schema中用于输入搜索品牌的Effect
export const searchBrandOptionEffect = (context: any, fieldName: string) => { export const searchBrandOptionEffect = (context: any, fieldName: string) => {
......
...@@ -6,7 +6,7 @@ import { createFormActions } from '@formily/antd' ...@@ -6,7 +6,7 @@ import { createFormActions } from '@formily/antd'
import { SaveOutlined } from '@ant-design/icons' import { SaveOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
import { increaseSchema } from './schema' import { increaseSchema } from './schema'
import { useMaterialTableChangeForAmount } from './effects' // import { useMaterialTableChangeForAmount } from './effects'
import { procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant' import { procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { useUpdate } from '@umijs/hooks' import { useUpdate } from '@umijs/hooks'
import { help } from '../../common' import { help } from '../../common'
...@@ -60,18 +60,19 @@ const AddSaleDelevedOrder:React.FC<{}> = () => { ...@@ -60,18 +60,19 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
setBtnLoading(true) setBtnLoading(true)
const _params = procurementProcessField(params) const _params = procurementProcessField(params)
if(id) { console.log(_params)
fnResult = await postPurchaseRequisitionUpdate({..._params, id}) // if(id) {
} else { // fnResult = await postPurchaseRequisitionUpdate({..._params, id})
fnResult = await postPurchaseRequisitionCreate(_params) // } else {
} // fnResult = await postPurchaseRequisitionCreate(_params)
if (fnResult.code === 1000) { // }
setTimeout(() => { // if (fnResult.code === 1000) {
history.push("/memberCenter/procurementAbility/purchaseRequisition/readyAddBill") // setTimeout(() => {
}, 1000) // history.push("/memberCenter/procurementAbility/purchaseRequisition/readyAddBill")
} else { // }, 1000)
// } else {
setBtnLoading(false) setBtnLoading(false)
} // }
} catch (error) { } catch (error) {
setBtnLoading(false) setBtnLoading(false)
error?.message && message.error(error.message) error?.message && message.error(error.message)
...@@ -114,8 +115,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => { ...@@ -114,8 +115,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
onSubmit={handleSubmit} onSubmit={handleSubmit}
effects={($, ctx) => { effects={($, ctx) => {
$('onFormMount').subscribe(() => { }) $('onFormMount').subscribe(() => { })
// 物料信息的改动 渲染总额
useMaterialTableChangeForAmount(ctx, update)
// 注入表单完成进度 // 注入表单完成进度
formContext.useAttachmentChangeForContext(ctx) formContext.useAttachmentChangeForContext(ctx)
......
...@@ -6,7 +6,8 @@ import { useIntl } from 'umi'; ...@@ -6,7 +6,8 @@ import { useIntl } from 'umi';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell'; import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
export const getUnitPriceTotal = (record) => { export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['quantity']) || 0 console.log(record, 'rrr')
const purchaseCount = Number(record['deliveryQuantity']) || 0
return Number(((record.price || 0) * purchaseCount).toFixed(2)) return Number(((record.price || 0) * purchaseCount).toFixed(2))
} }
......
...@@ -59,13 +59,14 @@ const basicInfo: ISchema = { ...@@ -59,13 +59,14 @@ const basicInfo: ISchema = {
disabledDate: current => { disabledDate: current => {
return current && current < moment().startOf('day') return current && current < moment().startOf('day')
}, },
showTime: true,
style: { width: '100%' } style: { width: '100%' }
}, },
"x-mega-props": { "x-mega-props": {
span: 1 span: 1
} }
}, },
purpose: { inventoryName: {
type: 'string', type: 'string',
title: intl.formatMessage({ id: 'saleOrder.duiyingcangku', defaultMessage: '对应仓库' }), title: intl.formatMessage({ id: 'saleOrder.duiyingcangku', defaultMessage: '对应仓库' }),
"x-rules": [ "x-rules": [
...@@ -78,7 +79,7 @@ const basicInfo: ISchema = { ...@@ -78,7 +79,7 @@ const basicInfo: ISchema = {
span: 1 span: 1
} }
}, },
purpose1: { inventoryRole: {
type: 'string', type: 'string',
title: intl.formatMessage({ id: 'saleOrder.cangkurenyuan', defaultMessage: '仓库人员' }), title: intl.formatMessage({ id: 'saleOrder.cangkurenyuan', defaultMessage: '仓库人员' }),
"x-rules": [ "x-rules": [
......
...@@ -9,18 +9,17 @@ import { FORM_FILTER_PATH } from '@/formSchema/const' ...@@ -9,18 +9,17 @@ import { FORM_FILTER_PATH } from '@/formSchema/const'
import Submit from '@/components/NiceForm/components/Submit' import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix' import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import '../index.less' import '../index.less'
import { getOrderVendorPage, getOrderVendorSellDeliveryPage } from '@/services/OrderNewV2Api'; import { getOrderVendorSellDeliveryPage } from '@/services/OrderNewV2Api';
export interface AddSaleDelevedOrderProps {} export interface ReadyAddSaleDelevedOrderProps {}
const fetchTableData = async (params) => { const fetchTableData = async (params) => {
params.outerStatus = 100 const { data } = await getOrderVendorSellDeliveryPage(params)
const { data } = await getOrderVendorPage(params)
return data return data
} }
/** 待新增销售发货单 */ /** 待新增销售发货单 */
const AddSaleDelevedOrder:React.FC<AddSaleDelevedOrderProps> = (props) => { const ReadyAddSaleDelevedOrder:React.FC<ReadyAddSaleDelevedOrderProps> = (props) => {
const { const {
columns, columns,
ref ref
...@@ -59,6 +58,6 @@ const AddSaleDelevedOrder:React.FC<AddSaleDelevedOrderProps> = (props) => { ...@@ -59,6 +58,6 @@ const AddSaleDelevedOrder:React.FC<AddSaleDelevedOrderProps> = (props) => {
</PageHeaderWrapper> </PageHeaderWrapper>
} }
AddSaleDelevedOrder.defaultProps = {} ReadyAddSaleDelevedOrder.defaultProps = {}
export default AddSaleDelevedOrder export default ReadyAddSaleDelevedOrder
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