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

Merge branch 'fix0218' into fix418

parents c3aa0556 add545db
#!groovy #!groovy
// http://183.3.136.70:33973/project/linkseeks-design/platform/v2-220318
// http://183.3.136.70:33973/project/linkseeks-design/platform/v2 // http://183.3.136.70:33973/project/linkseeks-design/platform/v2
pipeline { pipeline {
......
...@@ -108,8 +108,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => { ...@@ -108,8 +108,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
}, []) }, [])
useEffect(() => { useEffect(() => {
const { id } = history.location.query const { id, draftId } = history.location.query
if (id && getBasicFormParamsByEdit?.name) { if ((id || draftId) && getBasicFormParamsByEdit?.name) {
handleBrandSearch(getBasicFormParamsByEdit.brandName) handleBrandSearch(getBasicFormParamsByEdit.brandName)
onCustomerCategoryChange(getBasicFormParamsByEdit.customerCategoryId) onCustomerCategoryChange(getBasicFormParamsByEdit.customerCategoryId)
// 赋[]初值 显示一行区域选择 // 赋[]初值 显示一行区域选择
...@@ -157,7 +157,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => { ...@@ -157,7 +157,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setSelectCategoryId(seletCategoryId) setSelectCategoryId(seletCategoryId)
setSendCycle(data?.sendCycle || 0) setSendCycle(data?.sendCycle || 0)
}) })
} else { }
else {
setShowCategory(null) setShowCategory(null)
} }
} }
......
...@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
const [banCarriageType, setBanCarriageType] = useState(false) const [banCarriageType, setBanCarriageType] = useState(false)
const [template, setTemplate] = useState(false) // 是否必填运费模板 const [template, setTemplate] = useState(false) // 是否必填运费模板
const { productInfoByEdit, selectCategoryId, productPriceType, isCrossBorder, sendCycle } = ProductStore const { productInfoByEdit, selectCategoryId, productPriceType, isCrossBorder, sendCycle, isCrossBorder } = ProductStore
useEffect(() => { useEffect(() => {
//传入ref给父级 //传入ref给父级
...@@ -89,13 +89,13 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -89,13 +89,13 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
} }
}, [productPriceType]) }, [productPriceType])
useEffect(() => { logisticsForm.setFieldsValue({ sendCycle: sendCycle }) }, [sendCycle])
useEffect(() => { useEffect(() => {
if(isCrossBorder) { if(isCrossBorder) {
logisticsForm.setFieldsValue({ deliveryType: 1 }) logisticsForm.setFieldsValue({ deliveryType: 1 })
changeDeliveryType({target: { value: 1 }}) changeDeliveryType({target: { value: 1 }})
} }
}, [isCrossBorder]) }, [isCrossBorder])
useEffect(() => { logisticsForm.setFieldsValue({ sendCycle: sendCycle }) }, [sendCycle])
const changeDeliveryType = (e) => { const changeDeliveryType = (e) => {
setDeliveryType(e.target.value) setDeliveryType(e.target.value)
......
...@@ -67,7 +67,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -67,7 +67,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productName, productName,
selectedGoods, selectedGoods,
productSelectAttribute, productSelectAttribute,
setProductSelectAttribute,
tableDataSource, tableDataSource,
setTableDataSource, setTableDataSource,
clearData, clearData,
...@@ -75,8 +74,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -75,8 +74,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productInfoByEdit, productInfoByEdit,
getPriceAttributeFormParamsByEdit, getPriceAttributeFormParamsByEdit,
selectCategoryId, selectCategoryId,
productAttributeAndImageParams,
tabClickItem,
setProductPriceType, setProductPriceType,
isRecombination, isRecombination,
isCrossBorder, isCrossBorder,
...@@ -304,8 +301,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -304,8 +301,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
return ( return (
<> <>
<Button type='link' onClick={() => clickSetPrice(record)}>{planPrice === 3 ? intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.1' }) : intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.2' })}</Button> <Button type='link' onClick={() => clickSetPrice(record)}>{planPrice === 3 ? intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.1' }) : intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.2' })}</Button>
{/* @todo 删除一行 */} <Button type='link' onClick={() => deleteSetPrice(record)}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.3' })}</Button>
{/* <Button type='link' onClick={() => deleteSetPrice(record)}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.3' })}</Button> */}
</> </>
) )
} }
...@@ -333,7 +329,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -333,7 +329,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
: :
_tempObj[_attributeNameArr[i] || _attributeNameArr[0]] = _rowArr // 当一项变动的时候 找_attributeNameArr可能会找不到 找不到的情况下置为索引0的那项 _tempObj[_attributeNameArr[i] || _attributeNameArr[0]] = _rowArr // 当一项变动的时候 找_attributeNameArr可能会找不到 找不到的情况下置为索引0的那项
if (history.location.query?.id) { if (history.location.query?.id || history.location.query?.draftId) {
// 编辑的时候,先指定数据中的货品id,如果是重新组合的不存在id就使用选择的货品中的第一个,如果没有置为0;同理,不存在单价就置为{} // 编辑的时候,先指定数据中的货品id,如果是重新组合的不存在id就使用选择的货品中的第一个,如果没有置为0;同理,不存在单价就置为{}
if (isRecombination) { if (isRecombination) {
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' })] = selectedGoods.length > 0 ? selectedGoods[0].id : 0 _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' })] = selectedGoods.length > 0 ? selectedGoods[0].id : 0
......
...@@ -318,3 +318,78 @@ export const upperCommoditySchema: ISchema = { ...@@ -318,3 +318,78 @@ export const upperCommoditySchema: ISchema = {
} }
} }
} }
export const filterUsefulData = (data) => {
// 仅获取表单所需要的字段数据
return {
name: data.name,
brand: data.brand,
customerCategory: data.customerCategory,
slogan: data.slogan,
sellingPoint: data.sellingPoint || [],
commodityAreaList: data.commodityAreaList,
isUpdateAttribute: data.isUpdateAttribute,
unitId: data.unitId,
unitName: data.unitName,
subUnitId: data.subUnitId,
subUnitName: data.subUnitName,
minOrder: data.minOrder,
isMemberPrice: data.isMemberPrice,
priceType: data.priceType,
commodityAttributeList: data.commodityAttributeList,
unitPriceAndPicList: data.unitPriceAndPicList,
isAllAttributePic: data.isAllAttributePic,
commodityRemark: data.commodityRemark,
logistics: data.logistics,
isInvoice: data.isInvoice,
marks: data.marks,
packing: data.packing,
afterService: data.afterService,
isTax: true,
taxRate: data.taxRate,
title: data.title,
keywords: data.keywords,
description: data.description,
type: data.type,
createTime: data.createTime,
}
}
export const filterUsefulDraftData = (data) => {
console.log(data, 'data')
return {
name: data.name,
brandId: data.brandId,
customerCategoryId: data.customerCategoryId,
slogan: data.slogan,
sellingPoint: data.sellingPoint || [],
commodityAreaList: data.commodityAreaList || [],
isUpdateAttribute: data.isUpdateAttribute,
unitId: data.unitId,
unitName: data.unitName,
subUnitId: data.subUnitId,
subUnitName: data.subUnitName,
minOrder: data.minOrder,
isMemberPrice: data.isMemberPrice,
priceType: data.priceType,
commodityAttributeList: data.commodityAttributeList || [],
unitPriceAndPicList: data.unitPriceAndPicList || [],
isAllAttributePic: data.isAllAttributePic,
commodityRemark: data.commodityRemark,
logistics: data.logistics,
isInvoice: data.isInvoice,
marks: data.marks,
packing: data.packing,
afterService: data.afterService,
isTax: true,
taxRate: data.taxRate,
title: data.title,
keywords: data.keywords,
description: data.description,
type: data.type,
createTime: data.createTime,
// 是否草稿
draft: data.draft,
}
}
This diff is collapsed.
...@@ -39,14 +39,15 @@ class ProductStore implements IProductModule { ...@@ -39,14 +39,15 @@ class ProductStore implements IProductModule {
@computed @computed
public get getBasicFormParamsByEdit(): IBasicFormParam { public get getBasicFormParamsByEdit(): IBasicFormParam {
return { return {
brandId: this.productInfoByEdit?.brand?.id, brandId: this.productInfoByEdit?.brandId,
brandName: this.productInfoByEdit?.brand?.name, brandName: this.productInfoByEdit?.brand?.name,
name: this.productInfoByEdit?.name, name: this.productInfoByEdit?.name,
slogan: this.productInfoByEdit?.slogan, slogan: this.productInfoByEdit?.slogan,
sellingPoint: this.productInfoByEdit?.sellingPoint, sellingPoint: this.productInfoByEdit?.sellingPoint,
commodityAreaList: this.productInfoByEdit?.commodityAreaList.map(item => [item.provinceCode, item.cityCode, item.regionCode]), commodityAreaList: this.productInfoByEdit?.commodityAreaList.map(item => [item.provinceCode, item.cityCode]),
customerCategoryId: this.productInfoByEdit?.customerCategory.fullId.split('.').map(item => Number(item) + ''), // 兼容草稿
customerCategoryName: this.productInfoByEdit?.customerCategory.fullName customerCategoryId: this.productInfoByEdit?.draft ? this.productInfoByEdit?.customerCategoryId : this.productInfoByEdit?.customerCategory.fullId.split('.').map(item => Number(item) + ''),
customerCategoryName: this.productInfoByEdit?.customerCategory?.fullName
} }
} }
...@@ -163,6 +164,7 @@ class ProductStore implements IProductModule { ...@@ -163,6 +164,7 @@ class ProductStore implements IProductModule {
this.selectBrandId = null; this.selectBrandId = null;
this.productPriceType = null; this.productPriceType = null;
this.isRecombination = false; this.isRecombination = false;
this.sendCycle = null;
this.isCrossBorder = false; this.isCrossBorder = false;
} }
...@@ -237,17 +239,16 @@ class ProductStore implements IProductModule { ...@@ -237,17 +239,16 @@ class ProductStore implements IProductModule {
this.isRecombination = data this.isRecombination = data
} }
@action.bound
public setSendCycle(data: number) {
this.sendCycle = data
}
// 是否跨境商品 // 是否跨境商品
@action.bound @action.bound
public setIsCrossBorder(data: boolean) { public setIsCrossBorder(data: boolean) {
this.isCrossBorder = data this.isCrossBorder = data
} }
@action.bound
public setSendCycle(data: number) {
this.sendCycle = data
}
} }
export default ProductStore export default ProductStore
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