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 { useInitValue } from '@/formSchema/effects/useInitValue'
import EyePreview from '@/components/EyePreview'
......@@ -35,6 +35,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const [productRowSelection, productRowCtl] = useRowSelectionTable({customKey: 'id'})
const [productsLength, setProductsLength] = useState(0)
const [initValue, setInitialValue] = useState({})
const [idNotInList, setIdNotInList] = useState([])
const {
id,
......@@ -51,6 +52,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...params,
shopType: shopInfo[0].type,
environment: shopInfo[0].environment,
idNotInList: idNotInList,
})
return res.data
}else{
......@@ -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 (
<>
<NiceForm
......@@ -295,6 +305,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
setFieldState('isTacitlyApprove', state => {
state.value = 1
})
fatchSetedProducts(parentState.value[0])
})
}}
onSubmit={handleSubmit}
......
......@@ -173,7 +173,8 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
"x-component-props": {
rowKey: 'id',
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