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

fix: 对接待审核品牌相关功能

parent efa7a23a
......@@ -6,13 +6,13 @@ import { StandardTable } from '@linkseeks/god'
import { ColumnType } from 'antd/lib/table/interface'
import moment from 'moment'
import EyePreview from '@/components/EyePreview'
import { getProductBrandGetPlatformBrandList } from '@/services/ProductV2Api'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import Submit from '@/components/NiceForm/components/Submit'
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'
import { getProductBrandGetUnCheckBrandList } from '@/services/ProductV2Api'
const formActions = createFormActions();
......@@ -52,7 +52,7 @@ const CheckBrand: React.FC<{}> = () => {
status: 2,
}
return new Promise((resolve, reject) => {
getProductBrandGetPlatformBrandList(postData).then(res => {
getProductBrandGetUnCheckBrandList(postData).then(res => {
const { data } = res
resolve(data)
})
......
......@@ -10,7 +10,7 @@ import { ColumnType } from 'antd/lib/table/interface'
import ReutrnEle from '@/components/ReturnEle'
import moment from 'moment'
import styles from './index.less'
import { getProductBrandGetBrandCheckRecord, getProductBrandGetPlatformBrand, postProductBrandCheckBrand } from '@/services/ProductV2Api'
import { getProductBrandGetBrandCheckRecord, getProductBrandGetBrand, postProductBrandCheckBrand } from '@/services/ProductV2Api'
const { Step } = Steps
const { TextArea } = Input
......@@ -94,7 +94,7 @@ const CheckBrandDetail: React.FC<{}> = () => {
];
const loadPageData = (id) => {
getProductBrandGetPlatformBrand({id: id}).then(res => {
getProductBrandGetBrand({id: id}).then(res => {
if(res.code===1000){
setBrandInfo(res.data)
if(res.data.status===1)
......
......@@ -28,14 +28,12 @@ export const procurementRenderField = (data) => {
})
}
/** 新增销售发货单 字段转换 */
/** 新增销售发货单提交 字段转换 */
export const procurementProcessField = (value) => {
value.products = value.products.map(item => {
value.detailList = value.detailList.map(item => {
return {
...item,
productId: item.id,
productNo: item.code,
spec: item.type,
}
})
return value
......
......@@ -6,17 +6,14 @@ import { createFormActions } 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 { useUpdate } from '@umijs/hooks'
import { help } from '../../common'
import { useProductTable } from './model/useProductTable'
import FormDetailHeader from '@/components/FormDetailHeader'
import FormDetailWrapper from '@/components/FormDetailWrapper'
import { FormDetailContext } from '@/formSchema/context'
import { useFormDetail } from '@/formSchema/effects/useFormDetail'
import { postPurchaseRequisitionCreate, postPurchaseRequisitionUpdate } from '@/services/PurchaseV2Api'
import { getOrderVendorDetail } from '@/services/OrderNewV2Api'
import { getOrderVendorDetail, postOrderVendorCreateSellDelivery } from '@/services/OrderNewV2Api'
const addSchemaAction = createFormActions()
......@@ -24,7 +21,6 @@ const addSchemaAction = createFormActions()
const AddSaleDelevedOrder:React.FC<{}> = () => {
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
const { id, preview = null } = usePageStatus()
const [initFormValue, setInitFormValue] = useState<any>({})
const { formContext } = useFormDetail()
......@@ -41,7 +37,7 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests)
addSchemaAction.setFieldValue('detailList', _orderProductRequests)
}, 1000)
setFormLoading(false)
})
......@@ -51,8 +47,7 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
const handleSubmit = async (value) => {
try {
let fnResult = null
// 新增发货单/编辑发货单
// 新增发货单
const params = { ...value }
if(formContext.innerFormErrors) {
throw new Error(intl.formatMessage({ id: 'saleOrder.qingwanshanfahuodan', defaultMessage: '请完善发货单明细数据' }))
......@@ -61,18 +56,14 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
const _params = procurementProcessField(params)
console.log(_params)
// if(id) {
// fnResult = await postPurchaseRequisitionUpdate({..._params, id})
// } else {
// fnResult = await postPurchaseRequisitionCreate(_params)
// }
// if (fnResult.code === 1000) {
// setTimeout(() => {
// history.push("/memberCenter/procurementAbility/purchaseRequisition/readyAddBill")
// }, 1000)
// } else {
const fnResult = await postOrderVendorCreateSellDelivery({..._params, id})
if (fnResult.code === 1000) {
setTimeout(() => {
history.push("/memberCenter/tranactionAbility/saleOrder/readyAddDelevedOrder")
}, 1000)
} else {
setBtnLoading(false)
// }
}
} catch (error) {
setBtnLoading(false)
error?.message && message.error(error.message)
......
......@@ -18,17 +18,16 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const intl = useIntl()
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('products')]
const newData = [...ctx.getFieldValue('detailList')]
// 删除formvalue
const colIndex = newData.findIndex(v => v.id === record.id)
newData.splice(colIndex, 1)
ctx.setFieldValue('products', newData)
ctx.setFieldValue('detailList', newData)
}
const [productColumns, setProductColumns] = useState(() => {
// 渲染操作
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({ id: 'saleOrder.shanchu', defaultMessage: '删除' })}</Button>
// productInfoColumns[productInfoColumns.length - 2].render = (t, r) => r.amount && <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.amount).toFixed(2)}</span>
return productInfoColumns
})
......@@ -41,7 +40,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const handleSave = row => {
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')];
const newData = [...ctx.getFieldValue('detailList')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
// 算单行价格
......@@ -50,7 +49,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
...item,
...row,
});
ctx.setFieldValue('products', newData)
ctx.setFieldValue('detailList', newData)
resolve({item, newData})
})
};
......
......@@ -50,7 +50,7 @@ const basicInfo: ISchema = {
span: 1
}
},
deliverTime: {
orderTime: {
type: 'string',
"x-component": 'date',
title: intl.formatMessage({ id: 'saleOrder.danjushijian', defaultMessage: '单据时间' }),
......@@ -172,7 +172,7 @@ const material: ISchema = {
id: 'orderMaterial',
},
properties: {
products: {
detailList: {
type: 'array',
"x-component": 'MultTable',
required: true,
......
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