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

fix: 处理编辑导入商品数据物流区块数据回显异常

parent 301e07c5
......@@ -21,6 +21,7 @@ import { store } from '@/store'
import { CommodityType, filterUsefulData, filterUsefulDraftData } from './constant';
import { getProductCommodityGetCommodity, getProductCommodityGetCommodityDraftById, getProductCustomerGetCustomerCategoryById, postProductCommodityApplyCheckCommodity, postProductCommoditySaveOrUpdateCommodity, postProductCommoditySaveOrUpdateCommodityDraft } from '@/services/ProductV2Api';
import { getTemplateWebPageTemplateWebFindGoodsDescribeTemplate } from '@/services/TemplateV2Api';
import { postProductCommodityDeleteCommodityDraftBatch } from '@/services/ProductV2Api/id13772';
const { TabPane } = Tabs
......@@ -151,7 +152,7 @@ const AddProducts: React.FC<{}> = (props) => {
const onSave = () => {
setIsDisableSaveBtn(true)
const { id } = history.location.query
const { id, draftId } = history.location.query
if (childFormRefs.current.length > 0) {
try {
let data = childFormRefs.current.map(async __ => {
......@@ -364,6 +365,10 @@ const AddProducts: React.FC<{}> = (props) => {
setIsDisableSaveBtn(false)
}
})
// 存在草稿即删除草稿
if(draftId) {
postProductCommodityDeleteCommodityDraftBatch({idList: [draftId]}, {ctlType: "none"})
}
}).then(e => {
if (e) {
setIsDisableSaveBtn(false)
......@@ -559,6 +564,7 @@ const AddProducts: React.FC<{}> = (props) => {
numberKeys.map(item => delete _params[item])
}
console.log(_params, 'params')
_params.sendCycle = _params.logistics.sendCycle
postProductCommoditySaveOrUpdateCommodityDraft(draftId ? {id: draftId, draft: _params} : {draft: _params}).then(({code}) => {
if(code === 1000) {
setIsDisableSaveDrate(false)
......
......@@ -39,7 +39,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
//传入ref给父级
onRef(logisticsFormRef)
if (history.location.query?.id) {
if (history.location.query?.id || history.location.query?.draftId) {
const {
deliveryType,
carriageType,
......@@ -49,7 +49,9 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
setCarriageType(carriageType)
setIsTemplate(useTemplate)
setTemplate(useTemplate)
logisticsForm.setFieldsValue(productInfoByEdit.logistics)
setTimeout(() => {
logisticsForm.setFieldsValue(productInfoByEdit.logistics)
}, 500)
} else {
logisticsForm.setFieldsValue({ deliveryType: 1, carriageType: 1 })
}
......
......@@ -340,7 +340,7 @@ export const filterUsefulData = (data) => {
unitPriceAndPicList: data.unitPriceAndPicList,
isAllAttributePic: data.isAllAttributePic,
commodityRemark: data.commodityRemark,
logistics: data.logistics,
logistics: {...data.logistics, sendCycle: data.sendCycle},
isInvoice: data.isInvoice,
marks: data.marks,
packing: data.packing,
......@@ -352,6 +352,7 @@ export const filterUsefulData = (data) => {
description: data.description,
type: data.type,
createTime: data.createTime,
isCrossBorder: data.isCrossBorder,
}
}
......@@ -377,7 +378,7 @@ export const filterUsefulDraftData = (data) => {
unitPriceAndPicList: data.unitPriceAndPicList || [],
isAllAttributePic: data.isAllAttributePic,
commodityRemark: data.commodityRemark,
logistics: data.logistics,
logistics: {...data.logistics, sendCycle: data.sendCycle},
isInvoice: data.isInvoice,
marks: data.marks,
packing: data.packing,
......@@ -389,6 +390,7 @@ export const filterUsefulDraftData = (data) => {
description: data.description,
type: data.type,
createTime: data.createTime,
isCrossBorder: data.isCrossBorder,
// 是否草稿
draft: data.draft,
}
......
......@@ -463,7 +463,7 @@ const Products: React.FC<{}> = () => {
const step1DescripSuccess = <div className={styles.step1Description}>
<h4>{intl.formatMessage({ id: 'commodity.products.step1DescripSuccess.text.1' })}</h4>
<p>{intl.formatMessage({ id: 'commodity.products.step1DescripSuccess.text.2' })}</p>
<Button type="primary" onClick={modalImportData}>{intl.formatMessage({ id: 'commodity.products.step1DescripSuccess.button' })}</Button>
<Button type="primary" style={{width: '100%'}} onClick={modalImportData}>{intl.formatMessage({ id: 'commodity.products.step1DescripSuccess.button' })}</Button>
</div>
const step1Exception = <div className={styles.step1Description}>
......@@ -1032,7 +1032,7 @@ const Products: React.FC<{}> = () => {
<Result
icon={<Progress type="circle" percent={100} status="exception" />}
title={step1Exception}
extra={<Button onClick={exportErrorLog}>{intl.formatMessage({ id: 'commodity.products.modal.button.2' })}</Button>}
extra={<Button onClick={exportErrorLog} style={{width: '100%'}}>{intl.formatMessage({ id: 'commodity.products.modal.button.2' })}</Button>}
/>
</>
}
......
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