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

fix:处理新增采购订单采购数量变动清空原有支付信息

parent 93d8fd62
...@@ -77,8 +77,8 @@ const AddBrand: React.FC<{}> = () => { ...@@ -77,8 +77,8 @@ const AddBrand: React.FC<{}> = () => {
setFormValues(data) setFormValues(data)
form.setFieldsValue(data) form.setFieldsValue(data)
setlogoUrl(data.logoUrl) setlogoUrl(data.logoUrl)
if(data.status === 4) // if(data.status === 4)
setBanSomeField(true) // setBanSomeField(true)
// 多图回显 // 多图回显
let proveImgs = Object.values(data.proveUrl) let proveImgs = Object.values(data.proveUrl)
let files = []; let files = [];
...@@ -123,7 +123,7 @@ const AddBrand: React.FC<{}> = () => { ...@@ -123,7 +123,7 @@ const AddBrand: React.FC<{}> = () => {
}; };
const handleChange = ({ fileList }) =>setFileList(fileList) const handleChange = ({ fileList }) =>setFileList(fileList)
const handleSave = () => { const handleSave = () => {
form.validateFields().then((values:any) => { form.validateFields().then((values:any) => {
console.log(values,'vvv') console.log(values,'vvv')
......
...@@ -8,7 +8,6 @@ import { useUpdate } from '@umijs/hooks'; ...@@ -8,7 +8,6 @@ import { useUpdate } from '@umijs/hooks';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { filterProductDataById } from '../components/productModalTable' import { filterProductDataById } from '../components/productModalTable'
import { getUnitPriceTotal } from '../model/useProductTable'; import { getUnitPriceTotal } from '../model/useProductTable';
import { toPercent } from '@/utils/type';
// 异步填充表格字段 // 异步填充表格字段
const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => { const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => {
...@@ -86,7 +85,7 @@ export const useEditHideField = () => { ...@@ -86,7 +85,7 @@ export const useEditHideField = () => {
}) })
} }
export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update, editData) => { export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => { FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
...@@ -157,7 +156,6 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn ...@@ -157,7 +156,6 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
// } // }
return assign return assign
}).sort((prev, next) => prev.disabled ? prev.value : next.value - prev.value) }).sort((prev, next) => prev.disabled ? prev.value : next.value - prev.value)
console.log(state.props.enum)
}) })
......
...@@ -5,7 +5,7 @@ import ReutrnEle from '@/components/ReturnEle' ...@@ -5,7 +5,7 @@ import ReutrnEle from '@/components/ReturnEle'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus' import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { Button, Card, Row, Col, Drawer, message } from 'antd' import { Button, Card, Row, Col, Drawer, message } from 'antd'
import { createFormActions, registerVirtualBox, useFormSpy, createAsyncFormActions } from '@formily/antd' import { createFormActions, registerVirtualBox, useFormSpy, createAsyncFormActions } from '@formily/antd'
import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons' import { SaveOutlined, LinkOutlined, PlusOutlined, CodeSandboxCircleFilled } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
import { orderDetailSchema, orderAddSchema, mergeAllSchemas } from './schema' import { orderDetailSchema, orderAddSchema, mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects' import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects'
...@@ -30,7 +30,6 @@ import { changeRouterTitleByStatus } from '../../_public/order/utils' ...@@ -30,7 +30,6 @@ import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { ReadyAddOrderDetailContext } from '../context' import { ReadyAddOrderDetailContext } from '../context'
import AuditProcess from '@/components/AuditProcess' import AuditProcess from '@/components/AuditProcess'
import styles from './index.less' import styles from './index.less'
import { toPoint } from '@/utils/type'
export interface PurchaseOrderDetailProps {} export interface PurchaseOrderDetailProps {}
...@@ -208,7 +207,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -208,7 +207,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// theInvoiceInfo: (value.typeof value.theInvoiceId === 'object' ? value.theInvoiceId : null // theInvoiceInfo: (value.typeof value.theInvoiceId === 'object' ? value.theInvoiceId : null
// theInvoiceInfo: value.theInvoiceInfo // theInvoiceInfo: value.theInvoiceInfo
} }
console.log(params, 'params')
// 校验是否选择支付渠道 // 校验是否选择支付渠道
let judgementByPay = params.paymentInformationResponses.map(item => { let judgementByPay = params.paymentInformationResponses.map(item => {
if(item.channel && item.payWay){ if(item.channel && item.payWay){
...@@ -244,7 +242,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -244,7 +242,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
break; break;
} }
} }
console.log(fnResult, 'fnResult')
if (fnResult.code === 1000) { if (fnResult.code === 1000) {
// 跳转至待新增列表 // 跳转至待新增列表
window.sessionStorage.removeItem(spam_id) window.sessionStorage.removeItem(spam_id)
...@@ -379,7 +376,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -379,7 +376,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// } // }
}) })
} }
console.log(initFormValue, 'init')
}) })
// 监听商品总价的变更, 此处逻辑需优化 // 监听商品总价的变更, 此处逻辑需优化
$('sumPrice').subscribe(payload => { $('sumPrice').subscribe(payload => {
...@@ -452,7 +448,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -452,7 +448,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}) })
useEditHideField() useEditHideField()
// 商品信息的改动 驱动支付信息变化 // 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update, initFormValue) useProductTableChangeForPay(ctx, update)
}} }}
expressionScope={{ expressionScope={{
orderNoPrice, orderNoPrice,
......
...@@ -5,7 +5,6 @@ import { productInfoColumns } from '../constant'; ...@@ -5,7 +5,6 @@ import { productInfoColumns } from '../constant';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell'; import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
import { useModalTable } from './useModalTable'; import { useModalTable } from './useModalTable';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'; import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { toPoint } from '@/utils/type';
// 对象按key排序(运用于商城传过来的阶梯价格排序) // 对象按key排序(运用于商城传过来的阶梯价格排序)
export const sortByKey = (params) => { export const sortByKey = (params) => {
...@@ -100,6 +99,9 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -100,6 +99,9 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
} }
const handleSave = row => { const handleSave = row => {
// 商品采购数量变动 清空之前的支付信息
ctx.setFieldValue('paymentInformationResponses', [])
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('orderProductRequests')]; const newData = [...ctx.getFieldValue('orderProductRequests')];
const index = newData.findIndex(item => row.id === item.id); const index = newData.findIndex(item => row.id === item.id);
......
...@@ -321,6 +321,9 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -321,6 +321,9 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
visible={visibleChannelRroduct} visible={visibleChannelRroduct}
columns={columnsSetProduct} columns={columnsSetProduct}
rowSelection={productRowSelection} rowSelection={productRowSelection}
resetModal={{
destroyOnClose: true
}}
fetchTableData={params => fetchProductList(params)} fetchTableData={params => fetchProductList(params)}
formilyProps={ formilyProps={
{ {
......
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