Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
5a52f256
Commit
5a52f256
authored
Mar 30, 2022
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 暂存商品草稿,处理仓位列表不能修改仓位库存的问题,修复品类关联属性无法显示页面的问题
parent
8958df8f
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
261 additions
and
116 deletions
+261
-116
.gitignore
.gitignore
+1
-0
index.ts
config/routes/index.ts
+4
-4
package.json
package.json
+1
-2
commodity.ts
src/locales/en-US/commodity.ts
+3
-0
commodity.ts
src/locales/ko-KR/commodity.ts
+3
-0
commodity.ts
src/locales/zh-CN/commodity.ts
+5
-0
index.tsx
src/pages/classAndProperty/categoryAttributes/index.tsx
+1
-1
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+59
-32
logisticsForm.tsx
...ages/commodity/products/addProductsItem/logisticsForm.tsx
+1
-1
otherForm.tsx
src/pages/commodity/products/addProductsItem/otherForm.tsx
+3
-3
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+4
-8
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+3
-28
productDescFormYang.tsx
...ommodity/products/addProductsItem/productDescFormYang.tsx
+2
-2
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+4
-4
selectGoodsForm.tsx
...es/commodity/products/addProductsItem/selectGoodsForm.tsx
+2
-2
index.tsx
...es/commodity/products/components/circleCheckbox/index.tsx
+2
-2
index.tsx
src/pages/commodity/products/index.tsx
+19
-8
index.tsx
src/pages/repositories/index.tsx
+144
-19
No files found.
.gitignore
View file @
5a52f256
...
...
@@ -34,6 +34,7 @@ src/global/config/navigation.config.ts
src/services/*Api.ts
src/services/*Api
config/routes/index.ts
config/router.config.json
# 忽略yapi生成的文件
...
...
config/routes/index.ts
View file @
5a52f256
...
...
@@ -8,10 +8,10 @@ import CommodityRoute from './commodityRoute' // 商品能力路由
import
MemberRoute
from
'./memberRoute'
// 会员能力路由
// import ShopRoute from './shopRoute' // 店铺能力路由
// import ChannelRoute from './channelRoute' // 渠道能力路由
import
TranactionRoute
from
'./tranactionRoute'
// 交易能力路由
//
import TranactionRoute from './tranactionRoute' // 交易能力路由
// import LogisticsRoute from './logisticsRoutes' // 物流能力路由
// import PayandSettleRoute from './payandSettle' //支付与结算
import
AuthConfigRoute
from
'./authConfigRoute'
//
import AuthConfigRoute from './authConfigRoute'
// import AfterService from './afterServiceRoute' // 售后
// import HandlingRoute from './handlingRoute'; // 加工能力
// import DealAbilityRoute from './dealAbilityRoute'; //
...
...
@@ -26,7 +26,7 @@ import ProcurementRoute from './procurementRoute'; // todo wuting
// import contracRoute from './contracRoute';
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
const
isDev
=
process
.
env
.
NODE_ENV
===
"development"
;
const
isDev
=
false
;
const
homeRoute
=
{
path
:
`/memberCenter/home`
,
name
:
'home'
,
...
...
@@ -34,7 +34,7 @@ const homeRoute = {
key
:
'home'
,
component
:
'@/pages/home'
,
};
const
routes
=
isDev
?
[
homeRoute
,
Order
Route
]
:
asyncRoutes
;
const
routes
=
isDev
?
[
Commodity
Route
]
:
asyncRoutes
;
// const routes = isDev ? [ CommodityRoute ] : asyncRoutes;
const
memberCenterRoute
=
{
...
...
package.json
View file @
5a52f256
...
...
@@ -13,7 +13,7 @@
"upload:v2scm"
:
"cross-env PRO_ENV=v2scm taskName=upload yarn scripts:build"
,
"upload:v2Test"
:
"cross-env PRO_ENV=v2Test taskName=upload yarn scripts:build"
,
"api"
:
"god-ytt"
,
"testApi"
:
"cross-env PRO_ENV=v2 god-ytt"
,
"testApi"
:
"cross-env PRO_ENV=v2
-220418
god-ytt"
,
"scripts:build"
:
"node scripts/run"
,
"scripts:build-test"
:
"cross-env PRO_ENV=v2 node scripts/run"
,
"start:dev"
:
"cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev"
,
...
...
@@ -56,7 +56,6 @@
"start:v2scm"
:
"cross-env PRO_ENV=v2scm yarn start"
,
"start:v2-220318"
:
"cross-env PRO_ENV=v2-220318 yarn start"
,
"start:v2-220418"
:
"cross-env PRO_ENV=v2-220418 yarn start"
},
"lint-staged"
:
{
"*.{js,jsx,less,md,json}"
:
[
...
...
src/locales/en-US/commodity.ts
View file @
5a52f256
...
...
@@ -209,6 +209,9 @@ export default {
'commodity.products.addDirectChannel.tab.3'
:
'Logistics information'
,
'commodity.products.addDirectChannel.tab.4'
:
'Applicable channels'
,
'commodity.products.addProducts.onSave.error.draft.1'
:
'Please upload at least one product picture for each item to save the draft!'
,
'commodity.products.addProducts.onSave.error.draft.2'
:
'Please re-upload the product picture to save the draft!'
,
'commodity.products.addProducts.onSave.error.draft.3'
:
'Please upload the product picture to save the draft!'
,
'commodity.products.addProducts.onSave.error.1'
:
'Please upload at least one product image for each item! '
,
'commodity.products.addProducts.onSave.error.2'
:
'Please complete other product information! '
,
'commodity.products.addProducts.onSave.error.3'
:
'Commodity price is required! '
,
...
...
src/locales/ko-KR/commodity.ts
View file @
5a52f256
...
...
@@ -211,6 +211,9 @@ export default {
'commodity.products.addDirectChannel.tab.3'
:
'물류 정보'
,
'commodity.products.addDirectChannel.tab.4'
:
'적용 경로'
,
'commodity.products.addProducts.onSave.error.draft.1'
:
'품목별로 상품 사진을 한 장씩 올려주셔야 초고를 저장할 수 있습니다!'
,
'commodity.products.addProducts.onSave.error.draft.2'
:
'상품 사진 다시 올려주세요!'
,
'commodity.products.addProducts.onSave.error.draft.3'
:
'상품 사진 올려주셔야 초고 저장 가능합니다!'
,
'commodity.products.addProducts.onSave.error.1'
:
'항목마다 최소한 상품 사진 한 장씩 올려주세요!'
,
'commodity.products.addProducts.onSave.error.2'
:
'상품 기타 정보를 보완해 주세요!'
,
'commodity.products.addProducts.onSave.error.3'
:
'상품 가격은 필수입니다!'
,
...
...
src/locales/zh-CN/commodity.ts
View file @
5a52f256
...
...
@@ -128,6 +128,7 @@ export default {
'commodity.products.buttonGroup.5'
:
'上架'
,
'commodity.products.buttonGroup.6'
:
'下架'
,
'commodity.products.buttonGroup.7'
:
'查看供应商品'
,
'commodity.products.buttonGroup.8'
:
'查看上游商品'
,
'commodity.products.operationHandler.1'
:
'复制'
,
'commodity.products.operationHandler.2'
:
'提交审核'
,
'commodity.products.operationHandler.3'
:
'修改'
,
...
...
@@ -135,6 +136,7 @@ export default {
'commodity.products.operationHandler.5'
:
'上架'
,
'commodity.products.operationHandler.6'
:
'下架'
,
'commodity.products.operationHandler.7'
:
'查看供应商品'
,
'commodity.products.operationHandler.8'
:
'查看上游商品'
,
'commodity.products.step0Description.text.1'
:
'点击下载 EXCEL文件模板'
,
'commodity.products.step0Description.text.2'
:
'按照模板整理货品资料'
,
'commodity.products.step0Description.text.3'
:
'点击导入按钮,导入整理好的货品资料'
,
...
...
@@ -207,6 +209,9 @@ export default {
'commodity.products.addDirectChannel.tab.3'
:
'物流信息'
,
'commodity.products.addDirectChannel.tab.4'
:
'适用渠道'
,
'commodity.products.addProducts.onSave.error.draft.1'
:
'每项请至少上传一张商品图片才能保存草稿!'
,
'commodity.products.addProducts.onSave.error.draft.2'
:
'请重新上传商品图片才能保存草稿!'
,
'commodity.products.addProducts.onSave.error.draft.3'
:
'请上传商品图片才能保存草稿!'
,
'commodity.products.addProducts.onSave.error.1'
:
'每项请至少上传一张商品图片!'
,
'commodity.products.addProducts.onSave.error.2'
:
'请完善商品其他信息!'
,
'commodity.products.addProducts.onSave.error.3'
:
'商品价格为必填项!'
,
...
...
src/pages/classAndProperty/categoryAttributes/index.tsx
View file @
5a52f256
...
...
@@ -19,7 +19,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import
Submit
from
'@/components/NiceForm/components/Submit'
import
{
getProductCustomerGetCustomerCategoryAttributeList
,
getProductCustomerGetCustomerCategoryTree
,
postProductCustomerDeleteCustomerCategoryAttribute
,
postProductCustomerSaveCustomerCategoryAttribute
,
postProductCustomerSaveCustomerCategoryAttributeSort
}
from
'@/services/ProductV2Api'
;
import
{
ISchema
}
from
'@formily/antd'
;
import
{
Sortable
,
SortableEvent
}
from
'react-sortablejs'
;
import
Sortable
,
{
SortableEvent
}
from
"sortablejs"
;
import
{
arrayMoveImmutable
}
from
'@/utils'
;
import
AuthButton
from
'@/components/AuthButton'
;
import
{
AuthUrl
}
from
'@/components/AuthButton/AuthUrl'
;
...
...
src/pages/commodity/products/addProducts.tsx
View file @
5a52f256
...
...
@@ -91,6 +91,7 @@ const AddProducts: React.FC<{}> = (props) => {
const
{
data
:
_data
}:
any
=
await
getProductCommodityGetCommodityDraftById
({
commodityDraftId
:
draftId
})
const
{
draft
:
data
}
=
_data
// @todo 草稿数据复制表单
console
.
log
(
data
,
'draft data'
)
setProductInfoByEdit
(
filterUsefulDraftData
(
data
))
setProductName
(
data
?.
name
)
setProductPriceType
(
data
?.
priceType
)
...
...
@@ -454,47 +455,72 @@ const AddProducts: React.FC<{}> = (props) => {
if
(
clickTabIndex
.
indexOf
(
"5"
)
!==
-
1
)
{
let
_productAttributeAndImageParams
=
[...
productAttributeAndImageParams
]
if
(
_productAttributeAndImageParams
.
length
>
0
)
{
_productAttributeAndImageParams
.
map
(
_item
=>
{
try
{
if
(
_productAttributeAndImageParams
.
length
>
0
)
{
_productAttributeAndImageParams
.
map
(
_item
=>
{
_item
.
goods
=
{
id
:
_item
.
goodsId
}
// id为0表示无货品
delete
_item
.
goodsId
_item
.
goods
=
{
id
:
_item
.
goodsId
}
// id为0表示无货品
delete
_item
.
goodsId
if
(
_item
.
commodityPic
.
length
>
0
)
{
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
||
__item
)
if
(
_item
.
commodityPic
.
filter
(
Boolean
).
length
===
0
)
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'commodity.products.addProducts.onSave.error
.1'
}))
}
if
(
_item
.
commodityPic
.
length
>
0
)
{
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
||
__item
)
if
(
_item
.
commodityPic
.
filter
(
Boolean
).
length
===
0
)
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'commodity.products.addProducts.onSave.error.draft
.1'
}))
}
if
(
isAllAttributePic
)
{
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
}
}
else
{
if
(
isAllAttributePic
&&
_productAttributeAndImageParams
[
0
].
commodityPic
.
length
>
0
&&
_productAttributeAndImageParams
[
0
].
commodityPic
.
filter
(
Boolean
).
length
>
0
)
{
//处理所有属性共用
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
if
(
isAllAttributePic
)
{
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
}
}
else
{
if
(
isAllAttributePic
&&
_productAttributeAndImageParams
[
0
].
commodityPic
.
length
>
0
&&
_productAttributeAndImageParams
[
0
].
commodityPic
.
filter
(
Boolean
).
length
>
0
)
{
//处理所有属性共用
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
}
else
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'commodity.products.addProducts.onSave.error.draft.1'
}))
}
}
}
})
})
}
else
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'commodity.products.addProducts.onSave.error.draft.1'
}))
}
}
catch
(
error
)
{
console
.
log
(
error
)
message
.
error
(
error
.
message
)
setIsDisableSaveDrate
(
false
)
return
error
}
_params
.
unitPriceAndPicList
=
_productAttributeAndImageParams
}
else
{
if
(
productInfoByEdit
)
{
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
_params
.
isAllAttributePic
=
productInfoByEdit
.
isAllAttributePic
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
)
{
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
const
pic
=
productInfoByEdit
.
unitPriceAndPicList
[
index
]?.
commodityPic
return
{
id
:
item
.
id
,
goods
:
{
id
:
item
.
goodsId
},
attributeAndValueList
:
item
.
attributeAndValueList
,
unitPrice
:
item
.
unitPrice
,
priceRate
:
item
.
priceRate
,
commodityPic
:
pic
}
})
try
{
if
(
productInfoByEdit
)
{
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
_params
.
isAllAttributePic
=
productInfoByEdit
.
isAllAttributePic
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
)
{
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
const
pic
=
productInfoByEdit
.
unitPriceAndPicList
[
index
]?.
commodityPic
if
(
!
pic
)
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'commodity.products.addProducts.onSave.error.draft.2'
}))
}
return
{
id
:
item
.
id
,
goods
:
{
id
:
item
.
goodsId
},
attributeAndValueList
:
item
.
attributeAndValueList
,
unitPrice
:
item
.
unitPrice
,
priceRate
:
item
.
priceRate
,
commodityPic
:
pic
}
})
}
}
else
{
throw
new
Error
(
intl
.
formatMessage
({
id
:
'commodity.products.addProducts.onSave.error.draft.3'
}))
}
}
catch
(
error
)
{
console
.
log
(
error
)
message
.
error
(
error
.
message
)
setIsDisableSaveDrate
(
false
)
return
error
}
}
if
(
productInfoByEdit
)
{
...
...
@@ -537,6 +563,7 @@ const AddProducts: React.FC<{}> = (props) => {
})
}
catch
(
error
)
{
console
.
log
(
error
)
message
.
error
(
error
.
message
)
setIsDisableSaveDrate
(
false
)
}
}
...
...
src/pages/commodity/products/addProductsItem/logisticsForm.tsx
View file @
5a52f256
...
...
@@ -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
,
isCrossBorder
}
=
ProductStore
const
{
productInfoByEdit
,
selectCategoryId
,
productPriceType
,
isCrossBorder
,
sendCycle
}
=
ProductStore
useEffect
(()
=>
{
//传入ref给父级
...
...
src/pages/commodity/products/addProductsItem/otherForm.tsx
View file @
5a52f256
...
...
@@ -28,12 +28,12 @@ const OtherForm: React.FC<Iprops> = (props) => {
const
{
getOtherFormParamsByEdit
,
selectCategoryId
,
productPriceType
,
productInfoByEdit
}
=
ProductStore
const
[
disabledInvoice
,
setDisabledInvoice
]
=
useState
(
false
)
const
{
id
}
=
history
.
location
.
query
const
{
id
,
draftId
}
=
history
.
location
.
query
useEffect
(()
=>
{
//传入ref给父级
onRef
(
otherFormRef
)
if
(
id
)
{
if
(
id
||
draftId
)
{
console
.
log
(
getOtherFormParamsByEdit
,
'getOtherFormParamsByEdit'
)
otherForm
.
setFieldsValue
(
getOtherFormParamsByEdit
)
}
...
...
@@ -41,7 +41,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
// 品类 变动清空form
if
(
history
.
location
.
query
?.
id
&&
!
flagRef
.
current
)
{
if
(
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
&&
!
flagRef
.
current
)
{
flagRef
.
current
=
true
}
else
{
otherForm
.
resetFields
()
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
5a52f256
...
...
@@ -104,7 +104,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
onRef
(
priceFormRef
)
if
(
history
.
location
.
query
?.
id
)
{
// 编辑情况下 用于判断价格类型和显示单位
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
// 编辑情况下 用于判断价格类型和显示单位
setPlanPrice
(
productInfoByEdit
?.
priceType
)
handleUnitSearch
(
getPriceAttributeFormParamsByEdit
.
unitName
)
handleAssistUnitSearch
(
getPriceAttributeFormParamsByEdit
.
subUnitName
)
...
...
@@ -121,7 +121,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
// 品类 变动清空form和属性组合
if
(
history
.
location
.
query
?.
id
&&
!
flagRef
.
current
)
{
if
(
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
&&
!
flagRef
.
current
)
{
flagRef
.
current
=
true
}
else
{
// setProductSelectAttribute([])
...
...
@@ -167,7 +167,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_temp_attributeValObjArr
.
push
(
_tempObjArr
)
}
})
}
else
if
(
history
.
location
.
query
?.
id
)
{
// 此时没有属性并且处于编辑状态 取接口返回的数据 [0]? (也有可能编辑情况下切换到无规格的品类)
}
else
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
// 此时没有属性并且处于编辑状态 取接口返回的数据 [0]? (也有可能编辑情况下切换到无规格的品类)
_attributeNameArr
=
productInfoByEdit
.
unitPriceAndPicList
[
0
]?.
attributeAndValueList
.
map
(
_
=>
_
.
customerAttribute
.
name
)
_attributeValueArr
=
[
productInfoByEdit
.
unitPriceAndPicList
.
map
(
item
=>
item
.
attributeAndValueList
.
map
(
_
=>
_
.
customerAttributeValue
.
value
))]
_temp_attributeObjArr
=
productInfoByEdit
.
unitPriceAndPicList
[
0
]?.
attributeAndValueList
.
map
(
item
=>
{
...
...
@@ -366,7 +366,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
setAssistantUniquePriceRate
(
_priceRate
)
const
_priceNumber
=
Object
.
keys
(
_price
)[
0
]
===
'0-0'
?
Object
.
values
(
_price
)[
0
]
:
Object
.
values
(
_price
)
_tempObj
[
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.planPrice'
})]
=
Array
.
isArray
(
_priceNumber
)
?
_priceNumber
.
map
(
_p
=>
(
Number
(
_p
)
*
Number
(
_priceRate
)
/
100
).
toFixed
(
2
))
:
(
Number
(
_priceNumber
)
*
Number
(
_priceRate
)
/
100
).
toFixed
(
2
)
// _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = (Number(_price) * Number(_priceRate) / 100).toFixed(2)
}
else
{
_tempObj
[
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.unitPrice'
})]
=
{}
}
...
...
@@ -405,9 +404,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if
(
updateFlag
.
current
)
{
updateFlag
.
current
=
false
}
else
{
// if(!(history.location.query?.id && planPrice === 3)){
// _tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {})
// }
if
(
isChangePriceType
)
{
// 价格类型变动 清空价格
_tableDataSource
.
map
(
item
=>
item
[
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.unitPrice'
})]
=
{})
}
...
...
@@ -889,7 +885,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// initialValue={planPrice}
>
{
history
.
location
.
query
?.
id
?
<
Radio
.
Group
onChange=
{
handlePlanPriceChange
}
disabled=
{
!
productInfoByEdit
.
isUpdateAttribute
}
>
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
?
<
Radio
.
Group
onChange=
{
handlePlanPriceChange
}
disabled=
{
!
productInfoByEdit
.
isUpdateAttribute
}
>
<
Radio
value=
{
1
}
>
{
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.1'
})
}
</
Radio
>
<
Radio
value=
{
2
}
disabled=
{
isCrossBorder
}
>
{
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.2'
})
}
</
Radio
>
<
Radio
value=
{
3
}
disabled=
{
isCrossBorder
}
>
{
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.3'
})
}
</
Radio
>
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
5a52f256
...
...
@@ -51,7 +51,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
onRef
(
productAttributeFormRef
)
// 编辑情况下 构建选中属性数据 给paramsArray初始化数据用于编辑 设置表单数据
if
(
history
.
location
.
query
?.
id
)
{
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
constructProductSelectAttribute
()
attributeForm
.
setFieldsValue
(
getProductAttributeFormParamsByEdit
)
}
...
...
@@ -63,7 +63,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
// 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效)
if
(
history
.
location
.
query
?.
id
)
{
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
// 编辑第一次执行不清空,之后的变动需要清空
if
(
isClearFormAndDataInEdit
)
{
paramsArray
=
[]
...
...
@@ -229,7 +229,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
let
_isPrice
=
null
let
_isUpdateAttribute
=
null
let
_isDisabled
=
false
if
(
history
.
location
.
query
?.
id
)
{
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
_isPrice
=
attrItem
.
isPrice
_isUpdateAttribute
=
productInfoByEdit
.
isUpdateAttribute
_isDisabled
=
_isPrice
&&
!
_isUpdateAttribute
...
...
@@ -278,9 +278,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}
</
Select
>
</
Col
>
{
/* <Col span={4}>
<Button type="link" onClick={() => addAtttributeValue(attrItem)}>新增属性值</Button>
</Col> */
}
</
Row
>
</
Form
.
Item
>
}
...
...
@@ -314,28 +311,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
options=
{
attrItem
.
customerAttributeValueList
}
expandOperation=
{
<
Button
style=
{
{
marginLeft
:
8
}
}
type=
"dashed"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
addAtttributeValue
(
attrItem
)
}
>
新增
</
Button
>
}
/>
{
/* <Row>
<Col span={20}>
<Checkbox.Group
onChange={(v) => onChange(v, attrItem)}
disabled={_isDisabled}
style={{ width: "100%" }}
>
<Row>
{
attrItem?.customerAttributeValueList.length > 0 && attrItem.customerAttributeValueList.map((item: any, index: string) => (
<Col span={6} key={item.id}>
<Checkbox value={item.id}>{item.value}</Checkbox>
</Col>
))
}
</Row>
</Checkbox.Group>
</Col>
<Col span={4}>
<Button type="link" onClick={() => addAtttributeValue(attrItem)}>新增属性值</Button>
</Col>
</Row> */
}
</
Form
.
Item
>
)
}
...
...
src/pages/commodity/products/addProductsItem/productDescFormYang.tsx
View file @
5a52f256
...
...
@@ -44,7 +44,7 @@ const ProductDescFormYang: React.FC<{}> = () => {
const
{
run
,
loading
}
=
useHttpRequest
(
postContractContractSignSaleSignContractCreate
,
{
ctlType
:
'none'
})
useEffect
(()
=>
{
if
(
history
.
location
.
query
?.
id
)
{
// 编辑状态下
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
// 编辑状态下
setFileImageList
(()
=>
{
const
images
=
productInfoByEdit
.
commodityRemark
?.
imageList
return
{
...
...
@@ -65,7 +65,7 @@ const ProductDescFormYang: React.FC<{}> = () => {
useEffect
(()
=>
{
// 品类 变动清空数据
// 编辑下 flag为false 不清空;编辑下 flag为true 新建清空
if
(
history
.
location
.
query
?.
id
&&
!
flagRef
.
current
)
{
if
(
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
&&
!
flagRef
.
current
)
{
flagRef
.
current
=
true
}
else
{
setFileImageList
({
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
5a52f256
...
...
@@ -50,7 +50,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
},
[
tabClickItem
])
useEffect
(()
=>
{
if
(
history
.
location
.
query
?.
id
)
{
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
setSetImageType
(
productInfoByEdit
.
isAllAttributePic
)
let
o
=
productInfoByEdit
.
unitPriceAndPicList
.
map
((
_item
,
_index
)
=>
{
// 编辑初始图片数据缓存(手动生成供图片回显数据)
...
...
@@ -91,7 +91,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
useEffect
(()
=>
{
// 品类 变动清空数据
// 编辑下 flag为false 不清空;编辑下 flag为true 新建清空
if
(
history
.
location
.
query
?.
id
&&
!
flagRef
.
current
)
{
if
(
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
&&
!
flagRef
.
current
)
{
flagRef
.
current
=
true
}
else
{
onChangeSetImageType
({
target
:
{
value
:
true
}
})
...
...
@@ -101,7 +101,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
useEffect
(()
=>
{
if
(
priceAttributeParams
.
length
>
0
)
{
constructImageListByRender
(
priceAttributeParams
)
}
else
if
(
history
.
location
.
query
?.
id
)
{
// 不点击前面 直接进入图片tab
}
else
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
// 不点击前面 直接进入图片tab
constructImageListByRender
(
productInfoByEdit
.
unitPriceAndPicList
)
}
},
[
priceAttributeParams
,
maintainImageData
])
...
...
@@ -110,7 +110,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
/* 直接进入商品图片编辑的时候 参数为空数组 但是没有价格属性的时候 也可能为空数组 区别在于是否有url id */
const
constructImageListByRender
=
(
priceAttributeParams
?:
any
)
=>
{
let
_priceAttributeParams
:
any
=
[]
if
(
history
.
location
.
query
?.
id
)
{
// id判断是否新增还是编辑
if
(
history
.
location
.
query
?.
id
||
history
.
location
.
query
?.
draftId
)
{
// id判断是否新增还是编辑
setIsAllAttributePic
(
setImageType
)
_priceAttributeParams
=
priceAttributeParams
.
map
((
_item
,
_index
)
=>
{
...
...
src/pages/commodity/products/addProductsItem/selectGoodsForm.tsx
View file @
5a52f256
...
...
@@ -35,8 +35,8 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
},
[
selectCategoryId
,
selectBrandId
])
useEffect
(()
=>
{
const
{
id
}
=
history
.
location
.
query
if
(
id
)
{
const
{
id
,
draftId
}
=
history
.
location
.
query
if
(
id
||
draftId
)
{
let
_goodsArr
:
any
=
productInfoByEdit
?.
unitPriceAndPicList
.
map
(
_
=>
_
.
goods
)
let
goodsArr
:
any
=
_goodsArr
&&
_goodsArr
.
indexOf
(
null
)
===
-
1
&&
_goodsArr
.
length
>
0
&&
Object
.
values
(
_goodsArr
.
reduce
((
item
,
next
)
=>
{
item
[
next
.
id
]
=
next
;
...
...
src/pages/commodity/products/components/circleCheckbox/index.tsx
View file @
5a52f256
...
...
@@ -35,7 +35,7 @@ const CircleCheckbox: React.FC<PriceInputProps> = ({ value = [], options = [], o
}
}
return
(
options
.
length
&&
<
div
className=
{
styles
.
circleCheckbox
}
>
return
(
options
.
length
?
<
div
className=
{
styles
.
circleCheckbox
}
>
<
ul
className=
{
styles
.
circleCheckboxUl
}
>
{
options
.
map
((
item
:
any
,
index
:
string
)
=>
(
<
li
...
...
@@ -53,7 +53,7 @@ const CircleCheckbox: React.FC<PriceInputProps> = ({ value = [], options = [], o
expandOperation
}
</
ul
>
</
div
>
</
div
>
:
null
)
}
...
...
src/pages/commodity/products/index.tsx
View file @
5a52f256
...
...
@@ -29,7 +29,7 @@ import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'
import
{
priceTypeLabel
,
productStatusColor
,
productStatusLabel
}
from
'./constant'
import
EyePreview
from
'@/components/EyePreview'
import
UpperProductModalTable
from
'./components/upperProductModalTable'
import
{
getProductCommodityGetCommodityList
,
getProductCommodityGetShop
,
GetProductCommodityGetShopResponse
,
postProductCommodityApplyCheckCommodity
,
postProductCommodityCopyCommodity
,
postProductCommodityDeleteBatchCommodity
,
postProductCommodityExportCommodityQrCode
,
postProductCommodityExportCommoditySkuByCommodityIdList
,
postProductCommodityGetCommodityIsExistStock
,
postProductCommodityGetCommoditySkuIdList
,
postProductCommodityGetShopBatch
,
postProductCommodityOffPublishCommodity
,
postProductCommodityOffPublishCommodityBatch
,
postProductCommodityPublishCommodity
,
postProductCommodityPublishCommodityBatch
}
from
'@/services/ProductV2Api'
import
{
getProductCommodity
ExportCommodityTemplate
,
getProductCommodity
GetCommodityList
,
getProductCommodityGetShop
,
GetProductCommodityGetShopResponse
,
postProductCommodityApplyCheckCommodity
,
postProductCommodityCopyCommodity
,
postProductCommodityDeleteBatchCommodity
,
postProductCommodityExportCommodityQrCode
,
postProductCommodityExportCommoditySkuByCommodityIdList
,
postProductCommodityGetCommodityIsExistStock
,
postProductCommodityGetCommoditySkuIdList
,
postProductCommodityGetShopBatch
,
postProductCommodityOffPublishCommodity
,
postProductCommodityOffPublishCommodityBatch
,
postProductCommodityPublishCommodity
,
postProductCommodityPublishCommodityBatch
}
from
'@/services/ProductV2Api'
import
{
getTemplateWebMemberShopWebFindCurrMemberShop
}
from
'@/services/TemplateV2Api'
import
PutawayGuide
,
{
GuideMenu
}
from
'./components/putawayGuide'
import
{
useRowSelectionTable
,
useRowSelectionTableCtl
}
from
'@/hooks/useRowSelectionTable'
...
...
@@ -219,9 +219,9 @@ const Products: React.FC<{}> = () => {
className
:
'commonPickColor'
,
width
:
240
,
ellipsis
:
true
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/detail?id=${record.id}`
}
>
{
text
}
</
EyePreview
>
//
render: (text: any, record: any) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/detail?id=${record.id}`}>
//
{text}
//
</EyePreview>
},
{
title
:
intl
.
formatMessage
({
id
:
'commodity.products.columns.customerCategory'
}),
...
...
@@ -417,6 +417,19 @@ const Products: React.FC<{}> = () => {
const
modalLoadTemplate
=
()
=>
{
console
.
log
(
'模板下载!'
)
let
a
:
any
=
document
.
createElement
(
"a"
)
document
.
body
.
appendChild
(
a
)
a
.
style
=
"display: none"
getProductCommodityExportCommodityTemplate
({
},
{
responseType
:
'blob'
,
getResponse
:
true
}).
then
((
res
:
any
)
=>
{
const
{
data
,
response
}
=
res
const
filename
=
response
.
headers
.
get
(
'content-disposition'
).
split
(
'='
)[
1
]
let
blob
=
new
Blob
([
data
],
{
type
:
"application/vnd.ms-excel"
})
const
url
=
window
.
URL
.
createObjectURL
(
blob
);
a
.
href
=
url
;
a
.
download
=
filename
.
replaceAll
(
'"'
,
''
);
a
.
click
();
window
.
URL
.
revokeObjectURL
(
url
);
})
}
const
modalUpload
=
()
=>
{
...
...
@@ -941,9 +954,7 @@ const Products: React.FC<{}> = () => {
<
PlusOutlined
/>
{
intl
.
formatMessage
({
id
:
'commodity.products.controllerBtns.button.1'
})
}
</
Button
>
</
AuthButton
>
{
/* <Button style={{margin:'0 16px'}} onClick={()=>setImportModal(true)}>导入数据</Button> */
}
<
Button
style=
{
{
margin
:
'0 16px'
}
}
onClick=
{
()
=>
setImportModal
(
true
)
}
>
导入数据
</
Button
>
<
AuthButton
btnCode=
'products.batch'
>
<
Dropdown
overlay=
{
menuMore
}
trigger=
{
[
'click'
]
}
>
<
Button
>
...
...
@@ -1005,7 +1016,7 @@ const Products: React.FC<{}> = () => {
<
StandardTable
columns=
{
draftColumns
}
currentRef=
{
refDraft
}
rowSelection=
{
rowSelection
}
//
rowSelection={rowSelection}
tableProps=
{
{
rowKey
:
'id'
,
}
}
...
...
src/pages/repositories/index.tsx
View file @
5a52f256
import
React
,
{
use
Ref
}
from
'react'
;
import
{
history
,
useIntl
}
from
'umi'
;
import
{
Button
,
Card
,
message
,
Modal
,
Space
,
Tooltip
}
from
'antd'
;
import
React
,
{
use
Context
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
{
getIntl
,
history
,
useIntl
}
from
'umi'
;
import
{
Button
,
Card
,
Form
,
Input
,
message
,
Modal
,
Space
,
Tooltip
}
from
'antd'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PlusOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
EditOutlined
,
PlusOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
StandardTable
from
'@/components/StandardTable'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
EyePreview
from
'@/components/EyePreview'
;
...
...
@@ -20,6 +20,98 @@ import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import
{
getProductFreightSpaceList
,
postProductFreightSpaceStopStart
,
postProductFreightSpaceUpdateBatch
}
from
'@/services/ProductV2Api'
;
import
AuthButton
from
'@/components/AuthButton'
;
import
{
AuthUrl
}
from
'@/components/AuthButton/AuthUrl'
;
import
{
postProductFreightSpaceUpdateInventory
}
from
'@/services/ProductV2Api/id13787'
;
const
intl
=
getIntl
();
// table编辑控件
const
EditableContext
=
React
.
createContext
<
any
>
({});
interface
EditableRowProps
{
index
:
number
;
}
const
EditableRow
:
React
.
FC
<
EditableRowProps
>
=
({
index
,
...
props
})
=>
{
console
.
log
(
0
)
const
[
form
]
=
Form
.
useForm
();
return
(
<
Form
form=
{
form
}
component=
{
false
}
>
<
EditableContext
.
Provider
value=
{
form
}
>
<
tr
{
...
props
}
/>
</
EditableContext
.
Provider
>
</
Form
>
);
};
interface
EditableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
dataIndex
:
string
;
record
:
any
;
handleSave
:
(
record
:
any
)
=>
void
;
formItemProps
:
any
,
}
const
EditableCell
:
React
.
FC
<
EditableCellProps
>
=
({
title
,
editable
,
children
,
dataIndex
,
record
,
formItemProps
=
{},
handleSave
,
...
restProps
})
=>
{
const
[
editing
,
setEditing
]
=
useState
(
false
);
const
inputRef
=
useRef
<
any
>
({});
const
form
=
useContext
(
EditableContext
);
useEffect
(()
=>
{
if
(
editing
)
{
inputRef
.
current
.
focus
();
}
},
[
editing
]);
const
toggleEdit
=
()
=>
{
setEditing
(
!
editing
);
form
.
setFieldsValue
({
[
dataIndex
]:
record
[
dataIndex
]
});
};
const
save
=
async
()
=>
{
try
{
const
values
=
await
form
.
validateFields
();
toggleEdit
();
handleSave
({
...
record
,
...
values
});
}
catch
(
errInfo
)
{
console
.
log
(
'Save failed:'
,
errInfo
);
}
};
let
childNode
=
children
;
if
(
editable
)
{
childNode
=
editing
?
(
<
Form
.
Item
style=
{
{
margin
:
0
,
width
:
record
.
width
||
80
}
}
name=
{
dataIndex
}
rules=
{
[
{
required
:
true
,
message
:
intl
.
formatMessage
({
id
:
'transaction_components.cixiangweibitianxiang'
}),
},
{
pattern
:
/^
\d
+
(\.\d
{1,3}
)?
$/
,
message
:
intl
.
formatMessage
({
id
:
'transaction_components.zhifubilijinxianliangwei'
}),
}
]
}
>
<
Input
type=
'number'
ref=
{
inputRef
}
onBlur=
{
save
}
onPressEnter=
{
save
}
{
...
formItemProps
}
/>
</
Form
.
Item
>
)
:
(
<
div
className=
"editable-cell-value-wrap"
style=
{
{
paddingRight
:
24
}
}
onClick=
{
toggleEdit
}
>
{
children
}
<
EditOutlined
/>
</
div
>
);
}
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
};
const
formActions
=
createFormActions
();
const
modalSchemaAction
=
createFormActions
()
...
...
@@ -48,7 +140,7 @@ const Repositories: React.FC<{}> = () => {
const
[
rowSelection
,
RowCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
});
const
{
run
,
loading
}
=
useHttpRequest
(
postProductFreightSpaceUpdateBatch
,
{
ctlType
:
'none'
})
const
columns
:
ColumnType
<
any
>
[]
=
[
const
columns
:
any
[]
=
[
{
title
:
intl
.
formatMessage
({
id
:
'repositories.columns.id'
}),
dataIndex
:
'id'
,
...
...
@@ -58,6 +150,8 @@ const Repositories: React.FC<{}> = () => {
title
:
intl
.
formatMessage
({
id
:
'repositories.columns.name'
}),
dataIndex
:
'name'
,
key
:
'name'
,
width
:
240
,
ellipsis
:
true
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
EyePreview
type=
{
AuthUrl
(
'repositories.see'
)
?
'link'
:
'button'
}
...
...
@@ -71,6 +165,8 @@ const Repositories: React.FC<{}> = () => {
title
:
intl
.
formatMessage
({
id
:
'repositories.columns.productName'
}),
dataIndex
:
'productName'
,
key
:
'productName'
,
width
:
200
,
ellipsis
:
true
,
},
{
title
:
intl
.
formatMessage
({
id
:
'repositories.columns.category'
}),
...
...
@@ -91,22 +187,15 @@ const Repositories: React.FC<{}> = () => {
title
:
intl
.
formatMessage
({
id
:
'repositories.columns.inventory'
}),
dataIndex
:
'inventory'
,
key
:
'inventory'
,
formItem
:
'input'
,
editable
:
true
,
width
:
200
,
},
{
title
:
intl
.
formatMessage
({
id
:
'repositories.columns.alreadyiInventory'
}),
dataIndex
:
'alreadyiInventory'
,
key
:
'alreadyiInventory'
,
},
// {
// title: intl.formatMessage({ id: 'repositories.columns.upperMemberName' }),
// dataIndex: 'upperMemberName',
// key: 'upperMemberName',
// },
// {
// title: intl.formatMessage({ id: 'repositories.columns.upperStockCount' }),
// dataIndex: 'upperStockCount',
// key: 'upperStockCount',
// },
{
title
:
<
span
>
上游商品库存
 
...
...
@@ -300,8 +389,45 @@ const Repositories: React.FC<{}> = () => {
console
.
log
(
value
)
}
const
controllerBtns
=
<
Space
>
const
handleSave
=
row
=>
{
console
.
log
(
row
)
const
{
id
,
inventory
}
=
row
// // 执行修改库存
postProductFreightSpaceUpdateInventory
({
id
,
inventory
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
}
})
};
const
editColumns
=
columns
.
map
(
col
=>
{
if
(
!
col
.
editable
)
{
return
col
;
}
return
{
...
col
,
onCell
:
record
=>
({
record
,
editable
:
col
.
editable
,
dataIndex
:
col
.
dataIndex
,
title
:
col
.
title
,
formItemProps
:
col
.
formItemProps
,
handleSave
:
handleSave
,
}),
};
});
const
editComponents
=
{
body
:
{
row
:
EditableRow
,
cell
:
EditableCell
}
}
const
controllerBtns
=
<
Space
>
<
AuthButton
btnCode=
'repositories.add'
>
<
Button
type=
"primary"
...
...
@@ -318,16 +444,15 @@ const Repositories: React.FC<{}> = () => {
<
AuthButton
btnCode=
'repositories.batchedit'
>
<
Button
onClick=
{
()
=>
modalRef
.
current
.
setVisible
(
true
)
}
>
{
intl
.
formatMessage
({
id
:
'repositories.controllerBtns.button.3'
})
}
</
Button
>
</
AuthButton
>
</
Space
>
return
(
<
PageHeaderWrapper
>
<
Card
>
<
StandardTable
columns=
{
c
olumns
}
columns=
{
editC
olumns
}
currentRef=
{
ref
}
tableProps=
{
{
rowKey
:
'id'
}
}
tableProps=
{
{
rowKey
:
'id'
,
components
:
editComponents
}
}
rowSelection=
{
rowSelection
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
controlRender=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment