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

Merge branch 'fix0218' into fix418

parents c3aa0556 add545db
#!groovy
// http://183.3.136.70:33973/project/linkseeks-design/platform/v2-220318
// http://183.3.136.70:33973/project/linkseeks-design/platform/v2
pipeline {
......
......@@ -108,8 +108,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
}, [])
useEffect(() => {
const { id } = history.location.query
if (id && getBasicFormParamsByEdit?.name) {
const { id, draftId } = history.location.query
if ((id || draftId) && getBasicFormParamsByEdit?.name) {
handleBrandSearch(getBasicFormParamsByEdit.brandName)
onCustomerCategoryChange(getBasicFormParamsByEdit.customerCategoryId)
// 赋[]初值 显示一行区域选择
......@@ -157,7 +157,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setSelectCategoryId(seletCategoryId)
setSendCycle(data?.sendCycle || 0)
})
} else {
}
else {
setShowCategory(null)
}
}
......
......@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
const [banCarriageType, setBanCarriageType] = useState(false)
const [template, setTemplate] = useState(false) // 是否必填运费模板
const { productInfoByEdit, selectCategoryId, productPriceType, isCrossBorder, sendCycle } = ProductStore
const { productInfoByEdit, selectCategoryId, productPriceType, isCrossBorder, sendCycle, isCrossBorder } = ProductStore
useEffect(() => {
//传入ref给父级
......@@ -89,13 +89,13 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
}
}, [productPriceType])
useEffect(() => { logisticsForm.setFieldsValue({ sendCycle: sendCycle }) }, [sendCycle])
useEffect(() => {
if(isCrossBorder) {
logisticsForm.setFieldsValue({ deliveryType: 1 })
changeDeliveryType({target: { value: 1 }})
}
}, [isCrossBorder])
useEffect(() => { logisticsForm.setFieldsValue({ sendCycle: sendCycle }) }, [sendCycle])
const changeDeliveryType = (e) => {
setDeliveryType(e.target.value)
......
......@@ -67,7 +67,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productName,
selectedGoods,
productSelectAttribute,
setProductSelectAttribute,
tableDataSource,
setTableDataSource,
clearData,
......@@ -75,8 +74,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productInfoByEdit,
getPriceAttributeFormParamsByEdit,
selectCategoryId,
productAttributeAndImageParams,
tabClickItem,
setProductPriceType,
isRecombination,
isCrossBorder,
......@@ -304,8 +301,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
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>
{/* @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) => {
:
_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;同理,不存在单价就置为{}
if (isRecombination) {
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' })] = selectedGoods.length > 0 ? selectedGoods[0].id : 0
......
......@@ -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 {
@computed
public get getBasicFormParamsByEdit(): IBasicFormParam {
return {
brandId: this.productInfoByEdit?.brand?.id,
brandId: this.productInfoByEdit?.brandId,
brandName: this.productInfoByEdit?.brand?.name,
name: this.productInfoByEdit?.name,
slogan: this.productInfoByEdit?.slogan,
sellingPoint: this.productInfoByEdit?.sellingPoint,
commodityAreaList: this.productInfoByEdit?.commodityAreaList.map(item => [item.provinceCode, item.cityCode, item.regionCode]),
customerCategoryId: this.productInfoByEdit?.customerCategory.fullId.split('.').map(item => Number(item) + ''),
customerCategoryName: this.productInfoByEdit?.customerCategory.fullName
commodityAreaList: this.productInfoByEdit?.commodityAreaList.map(item => [item.provinceCode, item.cityCode]),
// 兼容草稿
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 {
this.selectBrandId = null;
this.productPriceType = null;
this.isRecombination = false;
this.sendCycle = null;
this.isCrossBorder = false;
}
......@@ -237,17 +239,16 @@ class ProductStore implements IProductModule {
this.isRecombination = data
}
@action.bound
public setSendCycle(data: number) {
this.sendCycle = data
}
// 是否跨境商品
@action.bound
public setIsCrossBorder(data: boolean) {
this.isCrossBorder = data
}
@action.bound
public setSendCycle(data: number) {
this.sendCycle = data
}
}
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