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
linweijiong
jinfa-platform
Commits
3d5b83d4
Commit
3d5b83d4
authored
Dec 18, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
f0e03866
a63820dd
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1048 additions
and
939 deletions
+1048
-939
.npmrc
.npmrc
+1
-1
index.ts
src/constants/index.ts
+3
-0
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+59
-35
fastModifyPrice.tsx
src/pages/commodity/products/fastModifyPrice.tsx
+30
-6
viewProducts.tsx
src/pages/commodity/products/viewProducts.tsx
+30
-30
index.tsx
src/pages/lxMall/order/payway/index.tsx
+2
-0
index.tsx
src/pages/transaction/components/orderPayModal/index.tsx
+0
-2
index.ts
...s/transaction/purchaseOrder/orderCollect/effects/index.ts
+245
-243
index.tsx
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
+1
-1
usePaymentInfo.tsx
...ction/purchaseOrder/orderCollect/model/usePaymentInfo.tsx
+63
-21
index.ts
...es/transaction/purchaseOrder/orderCollect/schema/index.ts
+606
-600
useSelfTable.tsx
...n/saleOrder/readyAddLogisticsOrder/model/useSelfTable.tsx
+8
-0
No files found.
.npmrc
View file @
3d5b83d4
registry
= "http://10.0.0.19:7001
"
registry
="http://10.0.0.19:4873
"
# registry = "https://registry.npmjs.org/"
src/constants/index.ts
View file @
3d5b83d4
...
...
@@ -978,6 +978,7 @@ export enum DeliverySideState {
// 订单外部显示文案
export
const
PurchaseOrderOutWorkStateTexts
=
{
"-1"
:
"取消订单"
,
0
:
'订单完成'
,
1
:
'待提交订单'
,
2
:
'待确认订单'
,
3
:
'待确认电子合同'
,
...
...
@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = {
// 订单流转记录外部状态
export
const
OrderTransformOutWorkStateTexts
=
{
"-1"
:
'取消订单'
,
0
:
'订单完成'
,
1
:
'待确认'
,
2
:
'待确认电子合同'
,
3
:
'待支付'
,
...
...
@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = {
// 采购订单流转记录内部状态
export
const
PurchaseOrderTransformInsideWorkStateTexts
=
{
"-1"
:
'取消订单'
,
0
:
'订单完成'
,
1
:
'待提交审核'
,
2
:
'提交审核通过'
,
3
:
'审核通过'
,
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
3d5b83d4
...
...
@@ -33,7 +33,7 @@ const { Option } = Select
let
_tableDataSource
:
any
=
[]
const
PriceAttributeForm
:
React
.
FC
<
Iprops
>
=
(
props
)
=>
{
const
PriceAttributeForm
:
React
.
FC
<
Iprops
>
=
(
props
)
=>
{
const
{
onRef
}
=
props
const
priceFormRef
=
useRef
()
const
updateFlag
=
useRef
(
true
)
// 是否第一次构建
...
...
@@ -58,15 +58,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const
[
colums
,
setColumns
]
=
useState
<
ColumnType
<
any
>
[]
>
()
const
{
ProductStore
}
=
store
const
{
productName
,
selectedGoods
,
productSelectAttribute
,
setProductSelectAttribute
,
tableDataSource
,
setTableDataSource
,
clearData
,
setPriceAttributeParams
,
const
{
productName
,
selectedGoods
,
productSelectAttribute
,
setProductSelectAttribute
,
tableDataSource
,
setTableDataSource
,
clearData
,
setPriceAttributeParams
,
productInfoByEdit
,
getPriceAttributeFormParamsByEdit
,
selectCategoryId
,
...
...
@@ -136,7 +136,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
// 品类 变动清空form和属性组合
if
(
history
.
location
.
query
?.
id
&&
!
flagRef
.
current
)
{
flagRef
.
current
=
true
flagRef
.
current
=
true
}
else
{
// setProductSelectAttribute([])
priceForm
.
resetFields
()
...
...
@@ -147,7 +147,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/**
* 添加clearPrice.current依赖,处理在未渲染价格属性前已经变动了价格属性组合,此时需要清空价格数据
* bug: 在不改变那价格属性组合情况下修改价格可以保留,当属性组合变动之后,修改价格再做其他修改时会清空价格(原因:clearPrice.current始终为true)
* 添加 tabClickItem
* 添加 tabClickItem
* 价格属性变动引发的构建,清空价格(仅清空一次)之后置为false
*/
useEffect
(()
=>
{
...
...
@@ -170,7 +170,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if
(
hasAttribute
.
length
){
// 提取价格属性 属性名数组 属性值SKU数组 /*编辑情况下直接进入此页面length为空 此时需获取调用接口返回的数据生成*/
hasAttribute
.
map
(
_item
=>
{
_attributeNameArr
.
push
(
_item
.
attributeName
)
// 用于列header
_temp_attributeObjArr
.
push
({
attributeName
:
_item
.
attributeName
,
customerAttributeId
:
_item
.
customerAttributeId
})
_temp_attributeObjArr
.
push
({
attributeName
:
_item
.
attributeName
,
customerAttributeId
:
_item
.
customerAttributeId
})
let
_tempArr
=
[]
let
_tempObjArr
=
[]
// 取id备用 //....若为日期属性,此处应获取日期段的每一天 进行特殊处理....//
// if(_item.isDate){
...
...
@@ -273,14 +273,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if
(
_attributeNameArr
?.
length
>
0
){
_attributeNameArr
.
map
(
_attr
=>
{
_col
.
push
({
title
:
_attr
,
dataIndex
:
_attr
,
title
:
_attr
,
dataIndex
:
_attr
,
key
:
_attr
})
})
}
_col
.
push
({
title
:
planPrice
===
3
?
'所需积分'
:
'单价(元)'
,
title
:
planPrice
===
3
?
'所需积分'
:
'单价(元)'
,
dataIndex
:
'单价'
,
key
:
'单价'
,
width
:
200
,
...
...
@@ -389,21 +389,21 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let
_tempArr
:
any
=
[]
Array
.
isArray
(
item
)
?
item
.
map
((
_item
,
_index
)
=>
{
/* code2 */
let
_tempObject
:
any
=
{};
_tempObject
.
customerAttribute
=
{
id
:
attributeObjArr
[
_index
].
customerAttributeId
,
id
:
attributeObjArr
[
_index
].
customerAttributeId
,
name
:
attributeObjArr
[
_index
].
attributeName
}
_tempObject
.
customerAttributeValue
=
{
id
:
attributeValObjArr
.
map
(
__item
=>
__item
.
find
(
_
=>
_
.
value
===
_item
)).
filter
(
__
=>
__
)[
0
].
id
,
id
:
attributeValObjArr
.
map
(
__item
=>
__item
.
find
(
_
=>
_
.
value
===
_item
)).
filter
(
__
=>
__
)[
0
].
id
,
value
:
item
[
_index
]
}
_tempArr
.
push
(
_tempObject
)
})
:
(
/* code3 */
// ** 可能是单一多选 attributeValObjArr可能为多个
_tempArr
.
push
({
_tempArr
.
push
({
customerAttribute
:
{
id
:
attributeObjArr
[
0
].
customerAttributeId
,
id
:
attributeObjArr
[
0
].
customerAttributeId
,
name
:
attributeObjArr
[
0
].
attributeName
},
customerAttributeValue
:
{
...
...
@@ -414,7 +414,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
)
/* code3 end */
/* code2 end */
_paramsArray
.
push
({
goodsId
:
_tableDataSource
[
index
]
?
_tableDataSource
[
index
][
'对应货品'
]
:
0
,
attributeAndValueList
:
_tempArr
,
attributeAndValueList
:
_tempArr
,
unitPrice
:
_tableDataSource
[
index
]
&&
_tableDataSource
[
index
][
'单价'
],
id
:
_tableDataSource
[
index
]
&&
_tableDataSource
[
index
][
'规格ID'
],
})
/*带上货品id 带上单价*/
...
...
@@ -432,7 +432,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/**
* @description table选择货品改变对应的data数据
* @param v modal数据对象
* @param record table行记录
* @param record table行记录
*/
const
tableSelelctChange
=
(
v
:
number
,
record
:
any
)
=>
{
let
_row
=
{
...
record
,
对应货品
:
v
}
...
...
@@ -526,12 +526,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if
(
numberArray
[
0
][
0
]
===
minOrder
){
let
tempArr
=
[];
numberArray
.
map
((
_item
,
_index
)
=>
{
tempArr
.
push
({
numberPrice
:
priceArray
[
_index
],
numberRange
:
{
numberMin
:
_item
[
0
],
numberMax
:
_item
[
1
]
}
})
tempArr
.
push
({
numberPrice
:
priceArray
[
_index
],
numberRange
:
{
numberMin
:
_item
[
0
],
numberMax
:
_item
[
1
]
}
})
})
setPriceForm
.
setFieldsValue
({
ladderPrice
:
true
,
ladderRange
:
tempArr
})
}
else
{
let
tempArr
=
[];
tempArr
.
push
({
numberPrice
:
null
,
numberRange
:
{
numberMin
:
minOrder
,
numberMax
:
null
}
})
tempArr
.
push
({
numberPrice
:
null
,
numberRange
:
{
numberMin
:
minOrder
,
numberMax
:
null
}
})
setPriceForm
.
setFieldsValue
({
ladderPrice
:
true
,
ladderRange
:
tempArr
})
}
}
...
...
@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 校验阶梯范围
const
validatorNumberRange
=
(
rule
,
value
,
callback
)
=>
{
let
minOrder
=
Number
(
minOrderNumber
)
let
precision
;
if
(
Number
.
isInteger
(
minOrder
))
{
// 整数取1
precision
=
1
}
else
{
// 小数取最小精度(最多三位)
switch
(
minOrderNumber
.
toString
().
split
(
"."
)[
1
].
length
)
{
case
1
:
precision
=
0.1
break
;
case
2
:
precision
=
0.01
break
;
case
3
:
precision
=
0.001
break
;
default
:
precision
=
1
}
}
try
{
if
(
Array
.
isArray
(
value
)){
let
range
=
value
.
map
(
item
=>
{
...
...
@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
return
Object
.
values
(
item
.
numberRange
)
}).
reduce
(
function
(
a
,
b
)
{
// 判断首位数是否满足精度
if
(
a
.
length
&&
b
.
length
)
{
if
((
Number
(
b
[
0
])
*
1000
-
Number
(
a
[
a
.
length
-
1
])
*
1000
)
/
1000
!==
precision
)
{
throw
new
Error
(
'请正确输入阶梯数量范围'
);
}
}
return
a
.
concat
(
b
);
},
[]
...
...
@@ -589,8 +614,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/**
* 按属性归类
* @param objectArray
* @param {string} property
* @param objectArray
* @param {string} property
*/
const
groupBy
=
(
objectArray
,
property
)
=>
{
...
...
@@ -615,7 +640,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {isMemberPrice: false, priceType: planPrice}}
autoComplete=
"off"
>
<
Form
.
Item
<
Form
.
Item
name=
"unitId"
label=
{
<
span
>
...
...
@@ -725,10 +750,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
{
planPrice
!=
2
&&
productName
&&
<
Button
type=
"text"
style=
{
{
float
:
'right'
}
}
onClick=
{
clickBatchSetPrice
}
><
SettingOutlined
/>
{
planPrice
===
3
?
'批量设置积分'
:
'批量设置价格'
}
</
Button
>
}
<
Table
rowKey=
"索引"
dataSource=
{
tableDataSource
}
columns=
{
planPrice
===
2
?
colums
.
slice
(
0
,
colums
.
length
-
2
)
:
colums
}
<
Table
rowKey=
"索引"
dataSource=
{
tableDataSource
}
columns=
{
planPrice
===
2
?
colums
.
slice
(
0
,
colums
.
length
-
2
)
:
colums
}
pagination=
{
false
}
locale=
{
{
emptyText
:<>
暂无数据
<
br
/>
请先完善商品基本信息项!
</>}
}
style=
{
{
clear
:
'both'
}
}
...
...
@@ -750,7 +775,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
initialValues=
{
{
ladderPrice
:
false
}
}
autoComplete=
"off"
>
{
{
planPrice
!==
3
&&
<
Form
.
Item
label=
""
...
...
@@ -874,4 +899,4 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</>)
}
export
default
observer
(
PriceAttributeForm
)
\ No newline at end of file
export
default
observer
(
PriceAttributeForm
)
src/pages/commodity/products/fastModifyPrice.tsx
View file @
3d5b83d4
...
...
@@ -197,7 +197,7 @@ const FastModifyPrice: React.FC<{}> = () => {
let
priceArray
=
Object
.
values
(
data
)
let
tempArr
=
[];
numberArray
.
map
((
_item
,
_index
)
=>
{
tempArr
.
push
({
numberPrice
:
priceArray
[
_index
],
numberRange
:
{
numberMin
:
_item
[
0
],
numberMax
:
_item
[
1
]
}
})
tempArr
.
push
({
numberPrice
:
priceArray
[
_index
],
numberRange
:
{
numberMin
:
_item
[
0
],
numberMax
:
_item
[
1
]
}
})
})
setForm
.
setFieldsValue
({
ladderPrice
:
true
,
ladderRange
:
tempArr
})
}
...
...
@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => {
// 校验阶梯范围
const
validatorNumberRange
=
(
rule
,
value
,
callback
)
=>
{
let
minOrder
=
Number
(
currentRow
.
minOrder
)
let
precision
;
if
(
Number
.
isInteger
(
minOrder
))
{
// 整数取1
precision
=
1
}
else
{
// 小数取最小精度(最多三位)
switch
(
minOrder
.
toString
().
split
(
"."
)[
1
].
length
)
{
case
1
:
precision
=
0.1
break
;
case
2
:
precision
=
0.01
break
;
case
3
:
precision
=
0.001
break
;
default
:
precision
=
1
}
}
try
{
if
(
Array
.
isArray
(
value
)){
let
range
=
value
.
map
(
item
=>
{
...
...
@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => {
return
Object
.
values
(
item
.
numberRange
)
}).
reduce
(
function
(
a
,
b
)
{
// 判断首位数是否满足精度
if
(
a
.
length
&&
b
.
length
)
{
if
((
Number
(
b
[
0
])
*
1000
-
Number
(
a
[
1
])
*
1000
)
/
1000
!==
precision
)
{
throw
new
Error
(
'请正确输入阶梯数量范围'
);
}
}
return
a
.
concat
(
b
);
},
[]
...
...
@@ -283,7 +308,7 @@ const FastModifyPrice: React.FC<{}> = () => {
FormEffectHooks
.
onFieldChange$
(
'customerCategoryId'
).
subscribe
(
state
=>
{
searchCustomerCategoryOptionEffect
(
actions
,
'customerCategoryId'
)
})
}
}
}
}
schema=
{
fastSchema
}
/>
}
...
...
@@ -406,9 +431,9 @@ const FastModifyPrice: React.FC<{}> = () => {
label=
{
priceType
===
3
?
"积分"
:
"单价"
}
name=
"uniquePrice"
rules=
{
[
{
{
required
:
true
,
message
:
priceType
===
3
?
'请输入积分!'
:
'请输入单价!'
message
:
priceType
===
3
?
'请输入积分!'
:
'请输入单价!'
},
{
pattern
:
priceType
!==
3
?
/^
\d
+
(\.\d
{1,4}
)?
$/
:
/^
[
1-9
]\d
*$/
,
...
...
@@ -425,4 +450,4 @@ const FastModifyPrice: React.FC<{}> = () => {
)
}
export
default
FastModifyPrice
\ No newline at end of file
export
default
FastModifyPrice
src/pages/commodity/products/viewProducts.tsx
View file @
3d5b83d4
...
...
@@ -14,10 +14,10 @@ import cx from 'classnames'
import
ReutrnEle
from
'@/components/ReturnEle'
import
styles
from
"./index.less"
import
{
PublicApi
}
from
'@/services/api'
import
{
GetProductCommodityGetCommodityResponse
,
GetProductCommodityGetCommodityCheckRecordResponse
,
GetProductCommodityGetShopResponse
import
{
GetProductCommodityGetCommodityResponse
,
GetProductCommodityGetCommodityCheckRecordResponse
,
GetProductCommodityGetShopResponse
}
from
'@/services/ProductApi'
import
moment
from
'moment'
import
{
isGetAccessor
}
from
'typescript'
...
...
@@ -92,13 +92,13 @@ const viewProducts: React.FC<{}> = () => {
setLogisticResourceSendAddress
(
provinceName
+
cityName
+
districtName
+
address
)
})
},
[
productDetail
])
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'序号'
,
dataIndex
:
'memberRoleId'
,
key
:
'memberRoleId'
,
render
:
(
t
,
c
,
i
)
=>
i
+
1
render
:
(
t
,
c
,
i
)
=>
i
+
1
},
{
title
:
'角色'
,
...
...
@@ -139,7 +139,7 @@ const viewProducts: React.FC<{}> = () => {
title
:
'操作时间'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
,
render
:
(
text
:
any
)
=>
moment
(
text
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
render
:
(
text
:
any
)
=>
moment
(
text
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
},
{
title
:
'意见'
,
...
...
@@ -190,7 +190,7 @@ const viewProducts: React.FC<{}> = () => {
component
=
null
}
else
if
(
status
===
5
)
component
=
(<
span
style=
{
{
color
:
'#00B37A'
,
padding
:
'2px 5px'
,
background
:
'rgba(235,247,242,1)'
,
borderRadius
:
'4px'
}
}
>
已上架
</
span
>)
component
=
(<
span
style=
{
{
color
:
'#00B37A'
,
padding
:
'2px 5px'
,
background
:
'rgba(235,247,242,1)'
,
borderRadius
:
'4px'
}
}
>
已上架
</
span
>)
else
if
(
status
===
6
)
component
=
(<
span
style=
{
{
padding
:
'2px 5px'
,
background
:
'rgba(244,245,247,1)'
,
borderRadius
:
'4px'
}
}
>
已下架
</
span
>)
else
...
...
@@ -212,7 +212,7 @@ const viewProducts: React.FC<{}> = () => {
<
Descriptions
.
Item
label=
"商品品牌"
>
{
productDetail
?.
brand
?.
name
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品品类"
>
{
productDetail
?.
customerCategory
?.
fullName
}
</
Descriptions
.
Item
>
{
/* {
productDetail?.commodityShopList?.length>0 &&
productDetail?.commodityShopList?.length>0 &&
<Descriptions.Item label="上架商城">
{
productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>)
...
...
@@ -224,7 +224,7 @@ const viewProducts: React.FC<{}> = () => {
<
Descriptions
.
Item
label=
"商品类型"
><
span
className=
"commonStatusValid"
></
span
>
{
renderCustomerCategoryType
(
productDetail
?.
customerCategory
?.
type
)
}
</
Descriptions
.
Item
>
</
Descriptions
>
</>
const
renderPriceType
=
(
type
:
number
)
=>
{
if
(
type
===
1
)
return
'现货价格'
if
(
type
===
2
)
return
'价格需要询价'
...
...
@@ -262,22 +262,22 @@ const viewProducts: React.FC<{}> = () => {
})
attributeByValue
.
map
(
_
=>
{
_col
.
push
({
title
:
_
.
name
,
dataIndex
:
_
.
name
,
title
:
_
.
name
,
dataIndex
:
_
.
name
,
key
:
'索引'
})
})
}
if
(
item
.
goods
?.
id
){
// 存在货品
_col
.
push
({
title
:
'对应货品'
,
dataIndex
:
'对应货品'
,
key
:
'索引'
,
title
:
'对应货品'
,
dataIndex
:
'对应货品'
,
key
:
'索引'
,
})
}
}
_col
.
push
({
title
:
product
?.
priceType
===
3
?
'所需积分'
:
'单价(元)'
,
title
:
product
?.
priceType
===
3
?
'所需积分'
:
'单价(元)'
,
dataIndex
:
'单价'
,
key
:
'单价'
,
render
:
(
text
,
record
)
=>
{
...
...
@@ -344,8 +344,8 @@ const viewProducts: React.FC<{}> = () => {
return
<>
<
p
>
{
str
===
'area'
?
str
===
'area'
?
showDataSource
.
map
((
_item
,
_i
)
=>
<
p
key=
{
_i
}
>
{
_item
.
provinceName
+
'/'
+
(
_item
.
cityName
||
''
)
}
</
p
>)
:
showDataSource
.
map
((
_item
,
_i
)
=>
<
p
key=
{
_i
}
>
{
_item
.
name
}
</
p
>)
...
...
@@ -419,7 +419,7 @@ const viewProducts: React.FC<{}> = () => {
</
Col
>
</
Row
>
{
productDetail
?.
commodityShopList
?.
length
>
0
&&
productDetail
?.
commodityShopList
?.
length
>
0
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
上架商城:
</
p
>
...
...
@@ -438,7 +438,7 @@ const viewProducts: React.FC<{}> = () => {
<
Col
span=
{
8
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"物流信息"
style=
{
{
height
:
'100%'
}
}
>
{
renderDeliveryType
(
productDetail
?.
logistics
?.
deliveryType
)
&&
renderDeliveryType
(
productDetail
?.
logistics
?.
deliveryType
)
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
配送方式:
</
p
>
...
...
@@ -460,7 +460,7 @@ const viewProducts: React.FC<{}> = () => {
</
Row
>
}
{
productDetail
?.
logistics
?.
weight
&&
productDetail
?.
logistics
?.
weight
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
重量:
</
p
>
...
...
@@ -471,7 +471,7 @@ const viewProducts: React.FC<{}> = () => {
</
Row
>
}
{
logisticTemplateName
&&
logisticTemplateName
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
运费模版:
</
p
>
...
...
@@ -482,7 +482,7 @@ const viewProducts: React.FC<{}> = () => {
</
Row
>
}
{
logisticResourceCompanyName
&&
logisticResourceCompanyName
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
物流公司:
</
p
>
...
...
@@ -493,7 +493,7 @@ const viewProducts: React.FC<{}> = () => {
</
Row
>
}
{
logisticResourceSendAddress
&&
logisticResourceSendAddress
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
发货地址:
</
p
>
...
...
@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => {
<
Col
span=
{
6
}
>
<
p
>
{
productDetail
?.
isMemberPrice
&&
'允许使用会员折扣购买
'
productDetail
?.
isMemberPrice
?
'允许使用会员折扣购买'
:
'无
'
}
</
p
>
</
Col
>
...
...
@@ -637,7 +637,7 @@ const viewProducts: React.FC<{}> = () => {
{
/* 没有价格属性默认一行直接显示图片 */
}
<
div
className=
{
styles
.
productImgBox
}
>
{
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
length
>
0
&&
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
map
((
_item
,
index
)
=>
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
length
>
0
&&
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
map
((
_item
,
index
)
=>
<
div
key=
{
index
}
className=
{
styles
.
imgItem
}
><
img
className=
{
styles
.
pic
}
src=
{
_item
}
alt=
""
/>
</
div
>)
}
...
...
@@ -665,7 +665,7 @@ const viewProducts: React.FC<{}> = () => {
<
Divider
/>
<
div
className=
{
styles
.
productImgBox
}
>
{
imageArrByImageRender
.
length
>
0
&&
imageArrByImageRender
[
index
].
map
((
_item
,
_index
)
=>
imageArrByImageRender
.
length
>
0
&&
imageArrByImageRender
[
index
].
map
((
_item
,
_index
)
=>
<
div
key=
{
_index
}
className=
{
styles
.
imgItem
}
><
img
className=
{
styles
.
pic
}
src=
{
_item
}
alt=
""
/>
</
div
>)
}
...
...
@@ -680,7 +680,7 @@ const viewProducts: React.FC<{}> = () => {
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"商品描述"
>
{
/* 文字区块 */
}
{
productDetail
?.
commodityRemark
?.
word
?.
length
>
0
&&
productDetail
?.
commodityRemark
?.
word
?.
length
>
0
&&
<
div
className=
{
cx
(
styles
.
descriptionBox
,
styles
.
descriptionWordBox
)
}
>
{
productDetail
?.
commodityRemark
?.
word
.
map
((
_item
,
_index
)
=>
...
...
@@ -691,7 +691,7 @@ const viewProducts: React.FC<{}> = () => {
}
{
/* 视频区块 */
}
{
productDetail
?.
commodityRemark
?.
video
?.
length
>
0
&&
productDetail
?.
commodityRemark
?.
video
?.
length
>
0
&&
<
div
className=
{
styles
.
descriptionBox
}
>
{
productDetail
?.
commodityRemark
?.
video
.
map
((
_item
,
_index
)
=>
<
div
key=
{
_index
}
className=
{
styles
.
videoItem
}
>
...
...
@@ -704,7 +704,7 @@ const viewProducts: React.FC<{}> = () => {
}
{
/* 图片区块 */
}
{
productDetail
?.
commodityRemark
?.
image
?.
length
>
0
&&
productDetail
?.
commodityRemark
?.
image
?.
length
>
0
&&
<
div
className=
{
styles
.
descriptionBox
}
>
{
productDetail
?.
commodityRemark
?.
image
.
map
((
_item
,
_index
)
=>
_item
&&
<
div
key=
{
_index
}
className=
{
styles
.
imgItem
}
>
...
...
src/pages/lxMall/order/payway/index.tsx
View file @
3d5b83d4
...
...
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
import
cx
from
'classnames'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetPayCreditGetCreditResponse
}
from
'@/services/PayApi'
import
{
message
}
from
'antd'
import
{
DownOutlined
}
from
'@ant-design/icons'
import
alipayIcon
from
'@/assets/imgs/alipay_icon.png'
import
wechatIcon
from
'@/assets/imgs/wechat_icon.png'
...
...
@@ -48,6 +49,7 @@ const PayWay: React.FC<PayWayProps> = (props) => {
}
PublicApi
.
getPayCreditGetCredit
(
param
).
then
(
res
=>
{
message
.
destroy
()
if
(
res
.
code
===
1000
)
{
setCreditInfo
(
res
.
data
)
}
...
...
src/pages/transaction/components/orderPayModal/index.tsx
View file @
3d5b83d4
...
...
@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setBalanceInfo
(
res
.
data
)
}
else
{
message
.
error
(
res
.
message
)
}
setIsSpin
(
false
)
})
...
...
src/pages/transaction/purchaseOrder/orderCollect/effects/index.ts
View file @
3d5b83d4
import
{
ISchemaFormActions
,
FormEffectHooks
,
IFieldState
,
ISchemaFormAsyncActions
,
createEffectHook
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
orderCombination
}
from
'../constant'
;
import
{
history
}
from
'umi'
;
import
{
fetchOrderApi
}
from
'../apis'
;
import
{
useUpdate
}
from
'@umijs/hooks'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
filterProductDataById
}
from
'../components/productModalTable'
import
{
getUnitPriceTotal
}
from
'../model/useProductTable'
;
// 异步填充表格字段
const
asyncPadDataForProduct
=
async
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
productValue
:
any
)
=>
{
const
productData
=
productValue
.
value
const
loading
=
productValue
.
loading
if
(
productData
.
length
===
0
||
loading
)
{
return
false
}
ctx
.
setFieldState
(
productValue
.
path
,
state
=>
{
state
.
loading
=
true
})
// 折扣请求
const
asyncPriceRequests
:
any
[]
=
await
Promise
.
all
(
productData
.
filter
(
v
=>
v
.
memberPrice
===
undefined
).
map
(
async
v
=>
{
const
{
code
,
data
}
=
await
PublicApi
.
getMemberManageUpperCreditParamGet
({
parentMemberId
:
v
.
memberId
,
parentMemberRoleId
:
v
.
memberRoleId
},
{
ttl
:
60
*
1000
,
useCache
:
true
})
// return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
return
code
===
1000
?
{
value
:
data
.
parameter
,
id
:
v
.
id
}
:
{
value
:
''
,
id
:
0
}
}
))
// const asyncAddressRequests = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => {
// const {code, data} = await PublicApi.getLogisticsShipperAddressGet({
// id: v.logistics.sendAddress
// }, {ttl: 60 * 1000, useCache: true})
// return code === 1000 ? data : null
// }
// ))
// 存在需要异步请求的, 则进行赋值
if
(
asyncPriceRequests
.
length
>
0
)
{
const
newData
=
productData
.
map
((
v
,
i
)
=>
{
if
(
!
v
.
memberPrice
)
{
v
.
memberPrice
=
asyncPriceRequests
.
find
(
j
=>
j
.
id
===
v
.
id
)?.
value
||
''
}
return
v
})
ctx
.
setFieldValue
(
'orderProductRequests'
,
newData
)
}
ctx
.
setFieldState
(
productValue
.
path
,
state
=>
{
state
.
loading
=
false
})
// if (asyncAddressRequests.length > 0) {
// ctx.setFieldValue('orderProductRequests', productData.map((v, i) => {
// v.memberPrice = asyncPriceRequests[i]
// return v
// }))
// }
// 配送方式请求
// const asyncAddressRequests = productData.filter(v => v.distributeMode !== undefined)
}
export
const
createEffects
=
context
=>
()
=>
{
}
export
const
useModelTypeChange
=
(
callback
)
=>
{
const
utils
=
useLinkageUtils
()
// 下单模式发生改变时
FormEffectHooks
.
onFieldValueChange$
(
'orderModel'
).
subscribe
(
state
=>
{
callback
(
state
)
})
}
export
const
useEditHideField
=
()
=>
{
const
{
pageStatus
}
=
usePageStatus
()
const
utils
=
useLinkageUtils
()
FormEffectHooks
.
onFormInit$
().
subscribe
(()
=>
{
if
(
pageStatus
===
PageStatus
.
ADD
)
{
utils
.
hide
(
'orderNo'
)
utils
.
hide
(
'createTime'
)
}
})
}
export
const
useProductTableChangeForPay
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
update
)
=>
{
const
{
pageStatus
}
=
usePageStatus
()
FormEffectHooks
.
onFieldValueChange$
(
'orderProductRequests'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
const
payInfoData
=
ctx
.
getFieldValue
(
'paymentInformationResponses'
)
// 强制渲染一次, 用于触发金额总数
update
()
// // 已经存在数据 无需请求
// if (payInfoData && payInfoData.length > 0) {
// } else
if
(
value
&&
value
.
length
>
0
){
// 请求一次并复制给支付信息
const
productItem
=
value
[
0
]
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
// 编辑下 支付信息联动实现
}
else
if
(
pageStatus
===
PageStatus
.
ADD
)
{
// 新增下 需要支付信息生成支付次数
fetchOrderApi
.
getPayInfoList
({
productId
:
productItem
?.
commodityId
?
productItem
.
id
:
productItem
.
productId
,
memberId
:
productItem
.
memberId
,
memberRoleId
:
productItem
.
memberRoleId
,
orderModel
:
ctx
.
getFieldValue
(
'orderModel'
),
}).
then
(
data
=>
{
ctx
.
setFieldValue
(
'paymentInformationResponses'
,
data
)
}).
catch
(
err
=>
{
})
}
}
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
// 由于商品存在多个, 需对接口做一定缓存
asyncPadDataForProduct
(
ctx
,
state
)
})
}
// 表单初始化时,对应操作
export
const
useOrderFormInitEffect
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
{
modelType
=
0
,
spam_id
}
=
history
.
location
.
query
const
typeEnums
=
parseInt
(
modelType
)
let
auth
=
JSON
.
parse
(
localStorage
.
getItem
(
'auth'
))
FormEffectHooks
.
onFormMount$
().
subscribe
(
async
()
=>
{
ctx
.
setFieldState
(
'orderModel'
,
state
=>
{
state
.
props
.
enum
=
state
.
props
.
enum
.
map
(
v
=>
{
const
assign
:
any
=
Object
.
assign
({},
v
)
// 过滤服务提供者
if
(
auth
.
memberRoleType
===
2
)
{
// 采购商
// 企业+个人
// if ((auth.memberType === 1 || auth.memberType === 2) && (assign.value > 9 && assign.value !== 24)) {
if
((
auth
.
memberType
===
1
||
auth
.
memberType
===
2
)
&&
assign
.
value
>
9
)
{
assign
.
disabled
=
true
}
// 渠道(企业+个人)
if
((
auth
.
memberType
===
3
||
auth
.
memberType
===
4
)
&&
assign
.
value
<
10
)
{
assign
.
disabled
=
true
}
// 商城下单
if
(
orderCombination
.
queryPageOrderModal
.
includes
(
assign
.
value
)
&&
typeEnums
!==
assign
.
value
)
{
assign
.
disabled
=
true
}
}
else
{
assign
.
disabled
=
true
}
// if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
// assign.disabled = true
// }
return
assign
}).
sort
((
prev
,
next
)
=>
prev
.
disabled
?
prev
.
value
:
next
.
value
-
prev
.
value
)
})
// query中存在modelType参数, 则是从其他页面跳转而来,需禁用其余query选项
// 商城跳转过来的数据
const
initValue
=
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
spam_id
))
// 从商城跳转, 需回显数据
if
(
initValue
)
{
const
fn
=
async
(
initValue
)
=>
{
const
productInfo
=
initValue
.
orderList
[
0
].
orderList
ctx
.
setFieldValue
(
'supplyMembersId'
,
initValue
.
supplyMembersId
)
ctx
.
setFieldValue
(
'supplyMembersRoleId'
,
initValue
.
supplyMembersRoleId
)
ctx
.
setFieldValue
(
'supplyMembersName'
,
initValue
.
supplyMembersName
)
initValue
.
idList
&&
ctx
.
setFieldValue
(
'idList'
,
initValue
.
idList
)
initValue
.
productType
&&
ctx
.
setFieldValue
(
'productType'
,
initValue
.
productType
)
ctx
.
setFieldValue
(
'orderProductRequests'
,
await
filterProductDataById
([],
productInfo
.
map
(
v
=>
{
return
{
...
v
,
unitPrice
:
v
.
priceRange
.
reduce
((
prev
,
next
)
=>
{
prev
[
next
.
range
]
=
next
.
price
return
prev
},
{}),
isMemberPrice
:
v
.
isMemberPrice
,
purchaseCount
:
v
.
count
,
money
:
v
.
count
*
v
.
unitPrice
,
productId
:
v
.
id
,
memberId
:
initValue
.
supplyMembersId
,
// 添加 memberId 字段
commodityId
:
v
.
id
,
// 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他)
memberPrice
:
v
.
memberDiscount
!==
1
?
v
.
memberDiscount
:
1
,
// 添加会员折扣
}
})
))
}
// 回显的数据保存在表单中, 当切换下单模式时,可以再次回显
ctx
.
setFieldState
(
'orderModel'
,
state
=>
{
state
.
remoteDataFn
=
fn
})
// ctx.setFormState(state => {
// state.remoteDataFn = fn
// })
fn
(
initValue
)
}
// 写入收货地址数据
useProductAddress
(
ctx
)
})
FormEffectHooks
.
onFieldValueChange$
(
'needTheInvoice'
).
subscribe
(
state
=>
{
if
(
state
.
value
)
{
useInvoiceList
(
ctx
)
}
})
}
export
const
useProductAddress
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
fetchOrderApi
.
getProductAddressAll
().
then
(
data
=>
{
ctx
.
setFieldState
(
'deliveryAddresId'
,
state
=>
{
if
(
data
.
length
>
0
&&
!
state
.
value
)
{
// 初始化时存在数据, 默认帮用户选中第一个(默认地址)
state
.
value
=
data
[
0
]
}
state
.
dataSource
=
data
state
.
showMore
=
data
.
length
>
3
})
})
}
// 获取发票信息
export
const
useInvoiceList
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
fetchOrderApi
.
getInvoicesList
().
then
(
data
=>
{
ctx
.
setFieldState
(
'theInvoiceId'
,
state
=>
{
if
(
data
.
length
>
0
&&
!
state
.
value
)
{
// 初始化时存在数据, 默认帮用户选中第一个
state
.
value
=
data
[
0
]
}
state
.
dataSource
=
data
state
.
showMore
=
data
.
length
>
3
})
})
}
import
{
ISchemaFormActions
,
FormEffectHooks
,
IFieldState
,
ISchemaFormAsyncActions
,
createEffectHook
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
orderCombination
}
from
'../constant'
;
import
{
history
}
from
'umi'
;
import
{
fetchOrderApi
}
from
'../apis'
;
import
{
useUpdate
}
from
'@umijs/hooks'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
filterProductDataById
}
from
'../components/productModalTable'
import
{
getUnitPriceTotal
}
from
'../model/useProductTable'
;
// 异步填充表格字段
const
asyncPadDataForProduct
=
async
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
productValue
:
any
)
=>
{
const
productData
=
productValue
.
value
const
loading
=
productValue
.
loading
if
(
productData
.
length
===
0
||
loading
)
{
return
false
}
ctx
.
setFieldState
(
productValue
.
path
,
state
=>
{
state
.
loading
=
true
})
// 折扣请求
const
asyncPriceRequests
:
any
[]
=
await
Promise
.
all
(
productData
.
filter
(
v
=>
v
.
memberPrice
===
undefined
).
map
(
async
v
=>
{
const
{
code
,
data
}
=
await
PublicApi
.
getMemberManageUpperCreditParamGet
({
parentMemberId
:
v
.
memberId
,
parentMemberRoleId
:
v
.
memberRoleId
},
{
ttl
:
60
*
1000
,
useCache
:
true
})
// return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
return
code
===
1000
?
{
value
:
data
.
parameter
,
id
:
v
.
id
}
:
{
value
:
''
,
id
:
0
}
}
))
// const asyncAddressRequests = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => {
// const {code, data} = await PublicApi.getLogisticsShipperAddressGet({
// id: v.logistics.sendAddress
// }, {ttl: 60 * 1000, useCache: true})
// return code === 1000 ? data : null
// }
// ))
// 存在需要异步请求的, 则进行赋值
if
(
asyncPriceRequests
.
length
>
0
)
{
const
newData
=
productData
.
map
((
v
,
i
)
=>
{
if
(
!
v
.
memberPrice
)
{
v
.
memberPrice
=
asyncPriceRequests
.
find
(
j
=>
j
.
id
===
v
.
id
)?.
value
||
''
}
return
v
})
ctx
.
setFieldValue
(
'orderProductRequests'
,
newData
)
}
ctx
.
setFieldState
(
productValue
.
path
,
state
=>
{
state
.
loading
=
false
})
// if (asyncAddressRequests.length > 0) {
// ctx.setFieldValue('orderProductRequests', productData.map((v, i) => {
// v.memberPrice = asyncPriceRequests[i]
// return v
// }))
// }
// 配送方式请求
// const asyncAddressRequests = productData.filter(v => v.distributeMode !== undefined)
}
export
const
createEffects
=
context
=>
()
=>
{
}
export
const
useModelTypeChange
=
(
callback
)
=>
{
const
utils
=
useLinkageUtils
()
// 下单模式发生改变时
FormEffectHooks
.
onFieldValueChange$
(
'orderModel'
).
subscribe
(
state
=>
{
callback
(
state
)
})
}
export
const
useEditHideField
=
()
=>
{
const
{
pageStatus
}
=
usePageStatus
()
const
utils
=
useLinkageUtils
()
FormEffectHooks
.
onFormInit$
().
subscribe
(()
=>
{
if
(
pageStatus
===
PageStatus
.
ADD
)
{
utils
.
hide
(
'orderNo'
)
utils
.
hide
(
'createTime'
)
}
})
}
export
const
useProductTableChangeForPay
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
update
)
=>
{
const
{
pageStatus
}
=
usePageStatus
()
FormEffectHooks
.
onFieldValueChange$
(
'orderProductRequests'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
const
payInfoData
=
ctx
.
getFieldValue
(
'paymentInformationResponses'
)
// 强制渲染一次, 用于触发金额总数
update
()
// // 已经存在数据 无需请求
// if (payInfoData && payInfoData.length > 0) {
// } else
if
(
value
&&
value
.
length
>
0
){
// 请求一次并复制给支付信息
const
productItem
=
value
[
0
]
console
.
log
(
productItem
,
'pp'
)
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
// 编辑下 支付信息联动实现
}
else
if
(
pageStatus
===
PageStatus
.
ADD
)
{
// 新增下 需要支付信息生成支付次数
fetchOrderApi
.
getPayInfoList
({
productId
:
productItem
?.
commodityId
?
productItem
.
id
:
productItem
.
productId
,
memberId
:
productItem
?.
memberId
||
ctx
.
getFieldValue
(
'supplyMembersId'
),
memberRoleId
:
productItem
?.
memberRoleId
||
ctx
.
getFieldValue
(
'supplyMembersRoleId'
),
orderModel
:
ctx
.
getFieldValue
(
'orderModel'
),
}).
then
(
data
=>
{
ctx
.
setFieldValue
(
'paymentInformationResponses'
,
data
)
}).
catch
(
err
=>
{
})
}
}
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
// 由于商品存在多个, 需对接口做一定缓存
asyncPadDataForProduct
(
ctx
,
state
)
})
}
// 表单初始化时,对应操作
export
const
useOrderFormInitEffect
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
{
modelType
=
0
,
spam_id
}
=
history
.
location
.
query
const
typeEnums
=
parseInt
(
modelType
)
let
auth
=
JSON
.
parse
(
localStorage
.
getItem
(
'auth'
))
FormEffectHooks
.
onFormMount$
().
subscribe
(
async
()
=>
{
ctx
.
setFieldState
(
'orderModel'
,
state
=>
{
state
.
props
.
enum
=
state
.
props
.
enum
.
map
(
v
=>
{
const
assign
:
any
=
Object
.
assign
({},
v
)
// 过滤服务提供者
if
(
auth
.
memberRoleType
===
2
)
{
// 采购商
// 企业+个人
// if ((auth.memberType === 1 || auth.memberType === 2) && (assign.value > 9 && assign.value !== 24)) {
if
((
auth
.
memberType
===
1
||
auth
.
memberType
===
2
)
&&
assign
.
value
>
9
)
{
assign
.
disabled
=
true
}
// 渠道(企业+个人)
if
((
auth
.
memberType
===
3
||
auth
.
memberType
===
4
)
&&
assign
.
value
<
10
)
{
assign
.
disabled
=
true
}
// 商城下单
if
(
orderCombination
.
queryPageOrderModal
.
includes
(
assign
.
value
)
&&
typeEnums
!==
assign
.
value
)
{
assign
.
disabled
=
true
}
}
else
{
assign
.
disabled
=
true
}
// if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
// assign.disabled = true
// }
return
assign
}).
sort
((
prev
,
next
)
=>
prev
.
disabled
?
prev
.
value
:
next
.
value
-
prev
.
value
)
})
// query中存在modelType参数, 则是从其他页面跳转而来,需禁用其余query选项
// 商城跳转过来的数据
const
initValue
=
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
spam_id
))
// 从商城跳转, 需回显数据
if
(
initValue
)
{
const
fn
=
async
(
initValue
)
=>
{
const
productInfo
=
initValue
.
orderList
[
0
].
orderList
ctx
.
setFieldValue
(
'shopId'
,
initValue
.
shopId
)
ctx
.
setFieldValue
(
'supplyMembersId'
,
initValue
.
supplyMembersId
)
ctx
.
setFieldValue
(
'supplyMembersRoleId'
,
initValue
.
supplyMembersRoleId
)
ctx
.
setFieldValue
(
'supplyMembersName'
,
initValue
.
supplyMembersName
)
initValue
.
idList
&&
ctx
.
setFieldValue
(
'idList'
,
initValue
.
idList
)
initValue
.
productType
&&
ctx
.
setFieldValue
(
'productType'
,
initValue
.
productType
)
ctx
.
setFieldValue
(
'orderProductRequests'
,
await
filterProductDataById
([],
productInfo
.
map
(
v
=>
{
return
{
...
v
,
unitPrice
:
v
.
priceRange
.
reduce
((
prev
,
next
)
=>
{
prev
[
next
.
range
]
=
next
.
price
return
prev
},
{}),
isMemberPrice
:
v
.
isMemberPrice
,
purchaseCount
:
v
.
count
,
money
:
v
.
count
*
v
.
unitPrice
,
productId
:
v
.
id
,
memberId
:
initValue
.
supplyMembersId
,
// 添加 memberId 字段
commodityId
:
v
.
id
,
// 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他)
memberPrice
:
v
.
memberDiscount
!==
1
?
v
.
memberDiscount
:
1
,
// 添加会员折扣
}
})
))
}
// 回显的数据保存在表单中, 当切换下单模式时,可以再次回显
ctx
.
setFieldState
(
'orderModel'
,
state
=>
{
state
.
remoteDataFn
=
fn
})
// ctx.setFormState(state => {
// state.remoteDataFn = fn
// })
fn
(
initValue
)
}
// 写入收货地址数据
useProductAddress
(
ctx
)
})
FormEffectHooks
.
onFieldValueChange$
(
'needTheInvoice'
).
subscribe
(
state
=>
{
if
(
state
.
value
)
{
useInvoiceList
(
ctx
)
}
})
}
export
const
useProductAddress
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
fetchOrderApi
.
getProductAddressAll
().
then
(
data
=>
{
ctx
.
setFieldState
(
'deliveryAddresId'
,
state
=>
{
if
(
data
.
length
>
0
&&
!
state
.
value
)
{
// 初始化时存在数据, 默认帮用户选中第一个(默认地址)
state
.
value
=
data
[
0
]
}
state
.
dataSource
=
data
state
.
showMore
=
data
.
length
>
3
})
})
}
// 获取发票信息
export
const
useInvoiceList
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
fetchOrderApi
.
getInvoicesList
().
then
(
data
=>
{
ctx
.
setFieldState
(
'theInvoiceId'
,
state
=>
{
if
(
data
.
length
>
0
&&
!
state
.
value
)
{
// 初始化时存在数据, 默认帮用户选中第一个
state
.
value
=
data
[
0
]
}
state
.
dataSource
=
data
state
.
showMore
=
data
.
length
>
3
})
})
}
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
View file @
3d5b83d4
...
...
@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
orderProductList
:
logsiticsDataMaps
.
map
(
v
=>
({
templateId
:
v
.
logistics
.
templateId
,
weight
:
v
.
logistics
.
weight
,
count
:
v
?.
purchaseCount
||
null
count
:
v
?.
purchaseCount
||
0
})),
receiverAddressId
:
typeof
receiverAddressId
===
'object'
?
receiverAddressId
.
id
:
receiverAddressId
},
{
ttl
:
10
*
1000
,
useCache
:
true
,
ctlType
:
'none'
}).
then
(
res
=>
{
...
...
src/pages/transaction/purchaseOrder/orderCollect/model/usePaymentInfo.tsx
View file @
3d5b83d4
...
...
@@ -9,7 +9,7 @@ import { message } from 'antd'
export
const
usePaymentInfo
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
memberId
:
any
,
memberRoleId
:
any
,
orderProducts
:
any
):
any
=>
{
const
paywayData
=
useRef
<
any
>
({})
const
[
columns
,
setColumns
]
=
useState
<
any
[]
>
(
paymentInformationColumns
)
const
{
productSumPrice
}
=
useContext
(
ReadyAddOrderDetailContext
)
// const { schemaActions, detailData
} = useContext(ReadyAddOrderDetailContext)
const
components
=
{
body
:
{
row
:
EditableRow
,
...
...
@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
// })
// }, [])
useEffect
(()
=>
{
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if
(
memberId
)
{
...
...
@@ -75,28 +76,36 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}
},
[
memberId
])
// useEffect(() => {
// // 当有商品数据传入的时 判断商品只有是物流的才能使用到付
// if(orderProducts?.length) {
// const newColumns = [...columns]
// let options = newColumns[5].formItemProps.options
// if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) {
// if(options.filter(_item => _item.payType === 4).length) {
// options.filter(_item => _item.payType === 4)[0].disabled = true
// }
// } else {
// if(options.filter(_item => _item.payType === 4).length) {
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// // 多次支付也要禁用到付
// if(ctx.getFieldValue('paymentInformationResponses').length > 1) {
// if(options.filter(_item => _item.payType === 4).length)
// options.filter(_item => _item.payType === 4)[0].disabled = true
// } else {
// if(options.filter(_item => _item.payType === 4).length)
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// }, [orderProducts, columns])
useEffect
(()
=>
{
// 当有商品数据传入的时 判断商品只有是物流的才能使用到付
if
(
orderProducts
?.
length
)
{
const
newColumns
=
[...
columns
]
let
options
=
newColumns
[
5
].
formItemProps
.
options
if
(
orderProducts
.
filter
(
item
=>
item
.
deliveryType
===
1
).
length
!==
orderProducts
.
length
)
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
true
}
else
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
false
}
// 多次支付也要禁用到付
if
(
ctx
.
getFieldValue
(
'paymentInformationResponses'
).
length
>
1
)
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
true
}
else
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
false
}
restrictArrivalPay
(
columns
,
orderProducts
)
}
},
[
orderProducts
,
columns
])
},
[
orderProducts
])
const
getPayLists
=
(
memberId
,
memberRoleId
)
=>
{
PublicApi
.
getPayPayWayList
({
memberId
,
memberRoleId
}).
then
(
res
=>
{
...
...
@@ -105,7 +114,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
const
newColumns
=
[...
columns
]
newColumns
[
5
].
formItemProps
.
options
=
initPayWayList
(
data
)
paywayData
.
current
=
data
restrictArrivalPay
(
newColumns
,
orderProducts
)
setColumns
(
newColumns
)
}
else
{
message
.
error
(
res
.
message
)
...
...
@@ -113,6 +122,39 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
})
}
// 限制使用到付(多次支付和商品仅有物流)
const
restrictArrivalPay
=
(
cols
,
pros
)
=>
{
if
(
pros
?.
length
)
{
// const newColumns = [...columns]
const
newColumns
=
[...
cols
]
let
options
=
newColumns
[
5
].
formItemProps
.
options
if
(
pros
.
filter
(
item
=>
item
.
deliveryType
===
1
).
length
!==
pros
.
length
)
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
{
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
true
}
}
else
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
{
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
false
}
}
setTimeout
(()
=>
{
let
payment
=
ctx
.
getFieldValue
(
'paymentInformationResponses'
)
// 多次支付也要禁用到付
if
(
payment
?.
length
>
1
)
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
true
}
else
{
if
(
options
.
filter
(
_item
=>
_item
.
payType
===
4
).
length
)
options
.
filter
(
_item
=>
_item
.
payType
===
4
)[
0
].
disabled
=
false
}
}
,
1000
)
setColumns
(
newColumns
)
}
}
const
handleSave
=
row
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'paymentInformationResponses'
)];
...
...
src/pages/transaction/purchaseOrder/orderCollect/schema/index.ts
View file @
3d5b83d4
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
moment
from
'moment'
import
{
DELIVERY_TYPE_ENUM
}
from
'@/constants'
;
/**
* 除了订单必填字段, 默认
*/
export
const
tableListSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
orderNo
:
{
type
:
'string'
,
"x-component"
:
'SearchFilter'
,
'x-component-props'
:
{
placeholder
:
'请输入订单编号'
,
align
:
'flex-end'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
inline
:
true
,
colStyle
:
{
marginLeft
:
20
}
},
properties
:
{
orderThe
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'请输入订单摘要'
,
}
},
"supplyMembersName"
:
{
type
:
'string'
,
"x-component-props"
:
{
placeholder
:
'请输入供应会员名称'
}
},
"[startCreateTime,endCreateTime]"
:
{
type
:
'array'
,
"x-component"
:
'DateRangePickerUnix'
,
'x-component-props'
:
{
placeholder
:
[
'开始时间'
,
'结束时间'
],
},
},
submit
:
{
'x-component'
:
'Submit'
,
'x-component-props'
:
{
children
:
'查询'
,
},
},
},
},
}
}
// 基本信息
const
basicInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'基本信息'
,
className
:
'useConnectBtnWrapper'
},
properties
:
{
NO_SUBMIT_LAYOUT
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
,
wrapperCol
:
10
},
properties
:
{
orderModel
:
{
type
:
'string'
,
required
:
true
,
enum
:
GlobalConfig
.
web
.
orderMode
.
map
(
v
=>
{
delete
v
.
platformType
;
return
v
}),
title
:
'下单模式'
,
"x-linkages"
:
[
// 联动显示单据字段
{
type
:
'value:visible'
,
"target"
:
"quotationNo"
,
"condition"
:
`{{orderCombination.showQuotationNoOrder.includes($value)}}`
},
// 联动显示单据按钮
{
type
:
"value:schema"
,
"target"
:
"quotationNo"
,
condition
:
`{{!!$value && orderCombination.showQuotationNoOrderBtn.includes($value)}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{orderNoPrice}}"
}
},
otherwise
:
{
visible
:
true
,
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
""
}
}
},
// 联动显示供应会员按钮
{
type
:
"value:schema"
,
"target"
:
"supplyMembersName"
,
condition
:
`{{$self.editable && $value && orderCombination.showSupplyMembersNameBtn.includes($value)}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{orderMember}}"
}
},
otherwise
:
{
visible
:
true
,
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
""
}
}
},
],
},
orderThe
:
{
type
:
'string'
,
title
:
'订单摘要'
,
required
:
true
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
}
]
},
quotationNo
:
{
type
:
'string'
,
title
:
'对应报价单号'
,
visible
:
false
,
"x-component-props"
:
{
disabled
:
true
,
},
"x-linkages"
:
[
{
type
:
'value:schema'
,
target
:
"supplyMembersName"
,
condition
:
`{{$self.editable && handleQuotation($value)}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
""
}
}
}
],
},
supplyMembersName
:
{
type
:
'string'
,
title
:
'供应会员'
,
"x-component-props"
:
{
disabled
:
true
,
},
required
:
true
,
},
supplyMembersId
:
{
type
:
'string'
,
display
:
false
},
supplyMembersRoleId
:
{
type
:
'string'
,
display
:
false
},
idList
:
{
type
:
'array'
,
display
:
false
},
productType
:
{
type
:
'number'
,
display
:
false
},
orderNo
:
{
type
:
'string'
,
title
:
'订单编号'
,
"x-component"
:
'text'
,
visible
:
false
},
type
:
{
type
:
'string'
,
title
:
'订单类型'
,
"x-component"
:
'text'
},
createTime
:
{
type
:
'string'
,
title
:
'下单时间'
,
visible
:
false
},
interiorState
:
{
type
:
'string'
,
title
:
'内部状态'
,
visible
:
false
},
externalState
:
{
type
:
'string'
,
title
:
'外部状态'
,
visible
:
false
},
}
},
}
}
// 订单商品
const
orderProduct
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'订单商品'
},
properties
:
{
orderProductRequests
:
{
type
:
'array'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{productColumns}}"
,
components
:
"{{productComponents}}"
,
},
// default: [{id: 904}]
},
NO_SUBMIT_SPY
:
{
type
:
'object'
,
"x-component"
:
"moneyTotalBox"
}
}
}
// 支付信息
const
payInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'支付信息'
,
},
properties
:
{
paymentInformationResponses
:
{
type
:
'array'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'payCount'
,
columns
:
"{{paymentColumns}}"
,
components
:
"{{paymentComponents}}"
},
// default: [
// {
// payCount: 1,
// id: 1,
// payRatio: 123
// }
// ]
}
}
}
// 交付信息
const
submitInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'交付信息'
},
properties
:
{
NO_SUBMIT_LAYOUT_2
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
grid
:
true
,
columns
:
2
,
full
:
true
},
properties
:
{
FLEX_LAYOUT_LEFT
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
properties
:
{
deliveryTime
:
{
type
:
'string'
,
"x-component"
:
'date'
,
title
:
'交付日期'
,
required
:
true
,
"x-component-props"
:
{
disabledDate
:
current
=>
{
return
current
&&
current
<
moment
().
startOf
(
'day'
)
}
}
},
}
},
deliveryAddresId
:
{
type
:
'string'
,
"x-component"
:
'SelectAddress'
,
"x-mega-props"
:
{
style
:
{
full
:
true
}
},
"x-component-props"
:
{
dataSource
:
[]
},
"x-rules"
:
[
{
required
:
true
,
message
:
'请选择收货方式'
}
],
title
:
'收货方式'
}
}
}
}
}
// 其他信息
const
ortherInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'其他信息'
},
properties
:
{
NO_SUBMIT_LAYOUT_ORTHER
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
4
,
wrapperCol
:
10
},
properties
:
{
needTheInvoice
:
{
type
:
'number'
,
"x-component"
:
'CheckboxSingle'
,
"x-component-props"
:
{
children
:
'需要发票'
},
title
:
'发票'
,
default
:
0
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'theInvoiceId'
,
condition
:
"{{!!$value}}"
}
]
},
theInvoiceId
:
{
type
:
'number'
,
title
:
' '
,
"x-component"
:
"theInvoiceList"
,
},
pageRequire
:
{
type
:
'string'
,
"x-component"
:
'textarea'
,
"x-component-props"
:
{
rows
:
4
},
title
:
'包装要求'
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
100
}
]
},
restsRequire
:
{
type
:
'string'
,
"x-component"
:
'textarea'
,
"x-component-props"
:
{
rows
:
4
},
title
:
'其他要求'
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
100
}
]
}
}
}
}
}
// 审核单据
const
auditRecord
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'审核单据'
},
properties
:
{
NO_SUBMIT_LAYOUT_3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
4
,
wrapperCol
:
10
},
properties
:
{
state
:
{
title
:
'是否审核通过'
,
type
:
'radio'
,
required
:
true
,
enum
:
[
{
label
:
'审核通过'
,
value
:
1
},
{
label
:
'审核不通过'
,
value
:
0
}
],
editable
:
true
,
default
:
1
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'cause'
,
condition
:
"{{$value === 0}}"
}
]
},
cause
:
{
type
:
'textarea'
,
title
:
'审核不通过原因'
,
required
:
true
,
"x-component-props"
:
{
rows
:
3
},
editable
:
true
,
}
}
}
}
}
// 电子合同
const
electronicResult
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'电子合同'
},
properties
:
{
NO_SUBMIT_LAYOUT_3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
4
,
wrapperCol
:
10
},
properties
:
{
electronic
:
{
title
:
'电子合同'
,
type
:
'checkbox'
,
required
:
true
,
enum
:
[
{
label
:
'pdf'
,
value
:
true
}
],
editable
:
true
,
default
:
false
}
}
}
}
}
// 流转记录
const
transformRecord
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'流转记录'
},
properties
:
{
RECORD
:
{
type
:
'object'
,
"x-component"
:
'VirtualChildren'
,
"x-component-props"
:
{
children
:
"{{CirculationRecord}}"
}
}
}
}
// 新增订单详情
export
const
orderDetailSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
transformRecord
,
}
}
}
}
// 一级审核详情
export
const
auditOneSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
auditRecord
,
transformRecord
}
}
}
}
// 新增时使用的schema
export
const
orderAddSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
}
}
}
}
// 确认电子合同
export
const
orderElectronicSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
electronicResult
,
transformRecord
}
}
}
}
// 根据传入的query参数 判断当前使用哪个schema
export
const
mergeAllSchemas
=
{
// 新增订单详情
"-1"
:
orderDetailSchema
,
0
:
orderAddSchema
,
// 一级审核详情
1
:
auditOneSchema
,
// 二级审核详情
2
:
auditOneSchema
,
// 待提交订单详情
3
:
orderDetailSchema
,
// 电子合同详情
4
:
orderElectronicSchema
,
// 订单支付
5
:
orderDetailSchema
}
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
moment
from
'moment'
import
{
DELIVERY_TYPE_ENUM
}
from
'@/constants'
;
/**
* 除了订单必填字段, 默认
*/
export
const
tableListSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
orderNo
:
{
type
:
'string'
,
"x-component"
:
'SearchFilter'
,
'x-component-props'
:
{
placeholder
:
'请输入订单编号'
,
align
:
'flex-end'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
inline
:
true
,
colStyle
:
{
marginLeft
:
20
}
},
properties
:
{
orderThe
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'请输入订单摘要'
,
}
},
"supplyMembersName"
:
{
type
:
'string'
,
"x-component-props"
:
{
placeholder
:
'请输入供应会员名称'
}
},
"[startCreateTime,endCreateTime]"
:
{
type
:
'array'
,
"x-component"
:
'DateRangePickerUnix'
,
'x-component-props'
:
{
placeholder
:
[
'开始时间'
,
'结束时间'
],
},
},
submit
:
{
'x-component'
:
'Submit'
,
'x-component-props'
:
{
children
:
'查询'
,
},
},
},
},
}
}
// 基本信息
const
basicInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'基本信息'
,
className
:
'useConnectBtnWrapper'
},
properties
:
{
NO_SUBMIT_LAYOUT
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
,
wrapperCol
:
10
},
properties
:
{
orderModel
:
{
type
:
'string'
,
required
:
true
,
enum
:
GlobalConfig
.
web
.
orderMode
.
map
(
v
=>
{
delete
v
.
platformType
;
return
v
}),
title
:
'下单模式'
,
"x-linkages"
:
[
// 联动显示单据字段
{
type
:
'value:visible'
,
"target"
:
"quotationNo"
,
"condition"
:
`{{orderCombination.showQuotationNoOrder.includes($value)}}`
},
// 联动显示单据按钮
{
type
:
"value:schema"
,
"target"
:
"quotationNo"
,
condition
:
`{{!!$value && orderCombination.showQuotationNoOrderBtn.includes($value)}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{orderNoPrice}}"
}
},
otherwise
:
{
visible
:
true
,
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
""
}
}
},
// 联动显示供应会员按钮
{
type
:
"value:schema"
,
"target"
:
"supplyMembersName"
,
condition
:
`{{$self.editable && $value && orderCombination.showSupplyMembersNameBtn.includes($value)}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{orderMember}}"
}
},
otherwise
:
{
visible
:
true
,
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
""
}
}
},
],
},
orderThe
:
{
type
:
'string'
,
title
:
'订单摘要'
,
required
:
true
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
}
]
},
quotationNo
:
{
type
:
'string'
,
title
:
'对应报价单号'
,
visible
:
false
,
"x-component-props"
:
{
disabled
:
true
,
},
"x-linkages"
:
[
{
type
:
'value:schema'
,
target
:
"supplyMembersName"
,
condition
:
`{{$self.editable && handleQuotation($value)}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
""
}
}
}
],
},
supplyMembersName
:
{
type
:
'string'
,
title
:
'供应会员'
,
"x-component-props"
:
{
disabled
:
true
,
},
required
:
true
,
},
supplyMembersId
:
{
type
:
'string'
,
display
:
false
},
supplyMembersRoleId
:
{
type
:
'string'
,
display
:
false
},
idList
:
{
type
:
'array'
,
display
:
false
},
productType
:
{
type
:
'number'
,
display
:
false
},
orderNo
:
{
type
:
'string'
,
title
:
'订单编号'
,
"x-component"
:
'text'
,
visible
:
false
},
type
:
{
type
:
'string'
,
title
:
'订单类型'
,
"x-component"
:
'text'
},
createTime
:
{
type
:
'string'
,
title
:
'下单时间'
,
visible
:
false
},
interiorState
:
{
type
:
'string'
,
title
:
'内部状态'
,
visible
:
false
},
externalState
:
{
type
:
'string'
,
title
:
'外部状态'
,
visible
:
false
},
}
},
}
}
// 订单商品
const
orderProduct
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'订单商品'
},
properties
:
{
orderProductRequests
:
{
type
:
'array'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{productColumns}}"
,
components
:
"{{productComponents}}"
,
},
// default: [{id: 904}]
},
NO_SUBMIT_SPY
:
{
type
:
'object'
,
"x-component"
:
"moneyTotalBox"
}
}
}
// 支付信息
const
payInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'支付信息'
,
},
properties
:
{
paymentInformationResponses
:
{
type
:
'array'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'payCount'
,
columns
:
"{{paymentColumns}}"
,
components
:
"{{paymentComponents}}"
},
// default: [
// {
// payCount: 1,
// id: 1,
// payRatio: 123
// }
// ]
}
}
}
// 交付信息
const
submitInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'交付信息'
},
properties
:
{
NO_SUBMIT_LAYOUT_2
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
grid
:
true
,
columns
:
2
,
full
:
true
},
properties
:
{
FLEX_LAYOUT_LEFT
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
properties
:
{
deliveryTime
:
{
type
:
'string'
,
"x-component"
:
'date'
,
title
:
'交付日期'
,
required
:
true
,
"x-component-props"
:
{
disabledDate
:
current
=>
{
return
current
&&
current
<
moment
().
startOf
(
'day'
)
}
}
},
}
},
deliveryAddresId
:
{
type
:
'string'
,
"x-component"
:
'SelectAddress'
,
"x-mega-props"
:
{
style
:
{
full
:
true
}
},
"x-component-props"
:
{
dataSource
:
[]
},
"x-rules"
:
[
{
required
:
true
,
message
:
'请选择收货方式'
}
],
title
:
'收货方式'
}
}
}
}
}
// 其他信息
const
ortherInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'其他信息'
},
properties
:
{
NO_SUBMIT_LAYOUT_ORTHER
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
4
,
wrapperCol
:
10
},
properties
:
{
needTheInvoice
:
{
type
:
'number'
,
"x-component"
:
'CheckboxSingle'
,
"x-component-props"
:
{
children
:
'需要发票'
},
title
:
'发票'
,
default
:
0
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'theInvoiceId'
,
condition
:
"{{!!$value}}"
}
]
},
theInvoiceId
:
{
type
:
'number'
,
title
:
' '
,
"x-component"
:
"theInvoiceList"
,
},
pageRequire
:
{
type
:
'string'
,
"x-component"
:
'textarea'
,
"x-component-props"
:
{
rows
:
4
},
title
:
'包装要求'
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
100
}
]
},
restsRequire
:
{
type
:
'string'
,
"x-component"
:
'textarea'
,
"x-component-props"
:
{
rows
:
4
},
title
:
'其他要求'
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
100
}
]
},
// 仅进货单下单传入接口使用
shopId
:
{
type
:
'string'
,
title
:
'店铺ID'
,
visible
:
false
},
}
}
}
}
// 审核单据
const
auditRecord
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'审核单据'
},
properties
:
{
NO_SUBMIT_LAYOUT_3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
4
,
wrapperCol
:
10
},
properties
:
{
state
:
{
title
:
'是否审核通过'
,
type
:
'radio'
,
required
:
true
,
enum
:
[
{
label
:
'审核通过'
,
value
:
1
},
{
label
:
'审核不通过'
,
value
:
0
}
],
editable
:
true
,
default
:
1
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'cause'
,
condition
:
"{{$value === 0}}"
}
]
},
cause
:
{
type
:
'textarea'
,
title
:
'审核不通过原因'
,
required
:
true
,
"x-component-props"
:
{
rows
:
3
},
editable
:
true
,
}
}
}
}
}
// 电子合同
const
electronicResult
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'电子合同'
},
properties
:
{
NO_SUBMIT_LAYOUT_3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
4
,
wrapperCol
:
10
},
properties
:
{
electronic
:
{
title
:
'电子合同'
,
type
:
'checkbox'
,
required
:
true
,
enum
:
[
{
label
:
'pdf'
,
value
:
true
}
],
editable
:
true
,
default
:
false
}
}
}
}
}
// 流转记录
const
transformRecord
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'流转记录'
},
properties
:
{
RECORD
:
{
type
:
'object'
,
"x-component"
:
'VirtualChildren'
,
"x-component-props"
:
{
children
:
"{{CirculationRecord}}"
}
}
}
}
// 新增订单详情
export
const
orderDetailSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
transformRecord
,
}
}
}
}
// 一级审核详情
export
const
auditOneSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
auditRecord
,
transformRecord
}
}
}
}
// 新增时使用的schema
export
const
orderAddSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
}
}
}
}
// 确认电子合同
export
const
orderElectronicSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
basicInfo
,
submitInfo
,
orderProduct
,
payInfo
,
ortherInfo
,
electronicResult
,
transformRecord
}
}
}
}
// 根据传入的query参数 判断当前使用哪个schema
export
const
mergeAllSchemas
=
{
// 新增订单详情
"-1"
:
orderDetailSchema
,
0
:
orderAddSchema
,
// 一级审核详情
1
:
auditOneSchema
,
// 二级审核详情
2
:
auditOneSchema
,
// 待提交订单详情
3
:
orderDetailSchema
,
// 电子合同详情
4
:
orderElectronicSchema
,
// 订单支付
5
:
orderDetailSchema
}
src/pages/transaction/saleOrder/readyAddLogisticsOrder/model/useSelfTable.tsx
View file @
3d5b83d4
...
...
@@ -95,6 +95,9 @@ export const useSelfTable = () => {
{
record
.
purchaseOrderInteriorState
===
SaleOrderInsideWorkState
.
DELIVERY_APPROVED_SUCCESS
&&
<
Button
type=
'link'
onClick=
{
()
=>
handlePreview
(
record
)
}
>
查看物流单
</
Button
>
}
{
record
.
purchaseOrderInteriorState
===
SaleOrderInsideWorkState
.
NOT_ACCEPTED_DELIVERY
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleModify
(
record
)
}
>
修改物流单
</
Button
>
}
</>
}
]
...
...
@@ -115,6 +118,11 @@ export const useSelfTable = () => {
history
.
push
(
`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=
${
logisticsId
}
&invoicesTypeId=2`
)
}
const
handleModify
=
async
(
record
)
=>
{
const
logisticsId
=
record
.
logisticsId
history
.
push
(
`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit?id=
${
logisticsId
}
`
)
}
return
{
columns
:
customOrderColumns
}
...
...
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