Commit 3307f15f authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:交易规则排除已设置商品

parent 429dc474
import React, {useEffect, useState} from 'react' import React, {useEffect, useRef, useState} from 'react'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus' import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { useInitValue } from '@/formSchema/effects/useInitValue' import { useInitValue } from '@/formSchema/effects/useInitValue'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
...@@ -35,6 +35,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -35,6 +35,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const [productRowSelection, productRowCtl] = useRowSelectionTable({customKey: 'id'}) const [productRowSelection, productRowCtl] = useRowSelectionTable({customKey: 'id'})
const [productsLength, setProductsLength] = useState(0) const [productsLength, setProductsLength] = useState(0)
const [initValue, setInitialValue] = useState({}) const [initValue, setInitialValue] = useState({})
const [idNotInList, setIdNotInList] = useState([])
const { const {
id, id,
...@@ -51,6 +52,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -51,6 +52,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...params, ...params,
shopType: shopInfo[0].type, shopType: shopInfo[0].type,
environment: shopInfo[0].environment, environment: shopInfo[0].environment,
idNotInList: idNotInList,
}) })
return res.data return res.data
}else{ }else{
...@@ -266,6 +268,14 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -266,6 +268,14 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
} }
} }
// // 查询已设置交易规则的列表
const fatchSetedProducts = (id) => {
PublicApi.getOrderTradingRulesProductIdList({shopId: id}).then(res => {
const { data, code } = res
setIdNotInList(() => data?.productIds || [])
})
}
return ( return (
<> <>
<NiceForm <NiceForm
...@@ -295,6 +305,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => { ...@@ -295,6 +305,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
setFieldState('isTacitlyApprove', state => { setFieldState('isTacitlyApprove', state => {
state.value = 1 state.value = 1
}) })
fatchSetedProducts(parentState.value[0])
}) })
}} }}
onSubmit={handleSubmit} onSubmit={handleSubmit}
......
...@@ -173,7 +173,8 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({ ...@@ -173,7 +173,8 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
"x-component-props": { "x-component-props": {
rowKey: 'id', rowKey: 'id',
columns: "{{tableColumns}}", columns: "{{tableColumns}}",
prefix: "{{tableAddButton}}" prefix: "{{tableAddButton}}",
idNotList: []
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment