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

fix: 暂存商品保存草稿的修改

parent 055dc11b
module.exports = [
{ name: 'LogisticsV2', token: '732fb8e33970ff5dee830423a630e8e85c3ef3293abba7581b16749dfce8608b', categoryIds: [0], }, // 物流能力v2
{ name: 'ProductV2', token: 'df37f2a0e3829c4288708ae211920bdbdee55e5e2f48b1e8cf7d1925ac618d9a', categoryIds: [0], }, // 商品服务V2
{ name: 'TemplateV2', token: '7bb5578bc50e4e7935cbc146a2192e978053d5380cc96fcfdc0a754cfe885ec5', categoryIds: [0], }, // 页面模板服务V2
{ name: 'PayV2', token: '4b5f2f2d42f0774b61074d69d5d756c725ba067d9dafe2c3785f592ae85d1696', categoryIds: [0], }, // 支付服务
{ name: 'SearchV2', token: 'f3e6ec26764f54d06ba33f487ff42d7debeaef397e51dc395040447737eb2e66', categoryIds: [0], }, // 搜索服务V2
{ name: 'PurchaseV2', token: '84c81ef877863ad4e2c0ebb2c3b3e80f9539420f2fc0828ef33f5159e8423b2c', categoryIds: [0] }, // 采购服务V2
{ name: 'SettleV2', token: 'fed8d45aa92e7f0e382a3dcc5e0ef63f13f0badeabab76d6a6e2db49aa403346', categoryIds: [0] },
{ name: 'TransactionV2', token: '3ad04435494d01c359b9f07948338e019133a3e6c0fccdbe1bc3adc19cf1e0b1', categoryIds: [0] }, // 交易服务V2
{ name: 'ContractV2', token: 'bbf1f327cfe7c59d1e7fd9c5d25119829dd79d238b1f1c79ed97331e220721a4', categoryIds: [0] }, // 合同能力V2
{ name: 'OrderNewV2', token: '89202a7986a86e7306925203d7eea0d999af8bb98d70a210d217a470d44b2dba', categoryIds: [0], }, //订单服务V2 New
{ name: 'MemberV2', token: 'be87c2732cb1253f82fe6c27d6cca9982c7dca9b384e46cc2e797b5835846834', categoryIds: [0]}, //会员服务 V2
{ name: 'ReportV2', token: 'dab50c384c27f1c981a03f2c44ad76d1e7e1f60b4520bd279cea67f5cf146cee', categoryIds: [0]}, // 报表服务v2 首页
{ name: 'EnhanceV2', token: '71b97616a81866ade2731437ca121e288b1dd8331dce4b5c1ccaacb176c16580', categoryIds: [0], }, // 加工服务v2
{ name: 'MessageV2', token: '69a667ec9861e8bdc25b89238d0b908a2123d9fce26e72fec3cdf6cd0b1f2681', categoryIds: [0], }, // 消息中心v2
{ name: 'MarketingV2', token: 'f6d5cee2383ca203dfa2882b84dfa02a1d79de3c3ad892b42f030437fdc5ea21', categoryIds: [0], }, // 营销能力
{ name: 'AfterServiceV2', token: '58748fc89dcdb33ec5cac520c00293ba92abca362a8ddb979df589effd0db9bd', categoryIds: [0], }, // 售后能力V2
{ name: 'ManageV2', token: '9ee3a1cb5a73ca02935e70debeda5bde0464f2fe1eb32c25855fd8acff9f68f2', categoryIds: [0] }, // 平台后台v2
{ name: 'LogisticsV2', token: 'd41aad1407040953cd8b3bf5c168fd5844efc11bbad276ef9d0fa11f18fe020e', categoryIds: [0], }, // 物流能力v2
{ name: 'ProductV2', token: 'c5ae8a687961fa2d4774be448f2bdfafcdf1d3711606c503b5a464b48ec9b284', categoryIds: [0], }, // 商品服务V2
{ name: 'TemplateV2', token: 'd2195d8b07f8b92cb093b46c5134ed2e8a388aeba4a50dcf5ab2291648c51fc6', categoryIds: [0], }, // 页面模板服务V2
{ name: 'PayV2', token: 'be269e58d88c3a39893fa240e0cdd6bb33c3024a4eb540b73a89acd06e046a9d', categoryIds: [0], }, // 支付服务
{ name: 'SearchV2', token: '07f6ffdc8839fd490a4d91368bfeb3e64aa0e482a2ec6f140dedbb05132e4b46', categoryIds: [0], }, // 搜索服务V2
{ name: 'PurchaseV2', token: 'ad23a5656edba68778283171dab7db72996e255c0f641078b9a306e311a69a7b', categoryIds: [0] }, // 采购服务V2
{ name: 'SettleV2', token: '3a5020a0b7193d25324a269f857140ae605627fbb60d0cdc1758c49cbf924e9d', categoryIds: [0] }, // 结算服务
{ name: 'TransactionV2', token: '44534d9d7fcced951ee37007326d320a5d7a126a935764489ef7830ce6023b1a', categoryIds: [0] }, // 交易服务V2
{ name: 'ContractV2', token: '63a046f33fe25262505d046e591fcf7b0bbd5dbd0463b633aaecc2d7e1b8e2c8', categoryIds: [0] }, // 合同能力V2
{ name: 'OrderNewV2', token: '8f0b8e35c954254f204f61626be668cbb2f8986f35fc10722d53b1363e7097da', categoryIds: [0], }, //订单服务V2
{ name: 'MemberV2', token: '596ac70489e083241edce79cc1da8a0a181ac3cb1cb9bb71cf0618ef11b70adf', categoryIds: [0]}, //会员服务 V2
{ name: 'ReportV2', token: '2436ccbe5c04c685adbb91742e79077128eb5874c023eeb39af8439931b940da', categoryIds: [0]}, // 报表服务v2 首页
{ name: 'EnhanceV2', token: '0b11ea89018df65b84a08aa077248d8b38506ccbb8c93c3cff4d8dc0d9caa6b7', categoryIds: [0], }, // 加工服务v2
{ name: 'MessageV2', token: 'fc0791ae75c9de60813e69b581d7ec70f302237e1a7d9bb1937a98eec403c69c', categoryIds: [0], }, // 消息中心v2
{ name: 'MarketingV2', token: '4d2a4cc5b8cb2d028dc707667a5f25297e63083376aa8d565f03e25d7f9eaf09', categoryIds: [0], }, // 营销能力
{ name: 'AfterServiceV2', token: 'eaea8b931eb1ba4bdccc3edb2e6853ac3ea41c1c2d3003dfce23a9dc9d21dc71', categoryIds: [0], }, // 售后能力V2
{ name: 'ManageV2', token: 'edc3141ad4ce4ff3e1fc084214cf6547986263d8d4415e57d6f3b866015ac87a', categoryIds: [0] }, // 平台后台v2
]
......@@ -101,8 +101,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)
// 赋[]初值 显示一行区域选择
......
......@@ -66,7 +66,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productName,
selectedGoods,
productSelectAttribute,
setProductSelectAttribute,
tableDataSource,
setTableDataSource,
clearData,
......@@ -74,8 +73,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productInfoByEdit,
getPriceAttributeFormParamsByEdit,
selectCategoryId,
productAttributeAndImageParams,
tabClickItem,
setProductPriceType,
isRecombination
} = ProductStore
......@@ -316,7 +313,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
......
......@@ -317,3 +317,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.
......@@ -38,14 +38,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]),
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
}
}
......@@ -162,6 +163,7 @@ class ProductStore implements IProductModule {
this.selectBrandId = null;
this.productPriceType = null;
this.isRecombination = false;
this.sendCycle = null;
}
// 编辑时 品类变更 清空部分数据
......
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