Commit 6bc3822b authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'dev' into test

parents 221da183 251ac9fc
...@@ -202,14 +202,19 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -202,14 +202,19 @@ const AddProducts: React.FC<{}> = (props) => {
_item.goods = { id: _item.goodsId } // id为0表示无货品 _item.goods = { id: _item.goodsId } // id为0表示无货品
delete _item.goodsId delete _item.goodsId
// 过滤掉上传失败时 返回null等无效数据
if (_item.commodityPic.length > 0) { if (_item.commodityPic.length > 0) {
// 编辑情况下兼顾手动添加图片列表属性 // 编辑情况下兼顾手动添加图片列表属性
_item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url) _item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url)
if(_item.commodityPic.filter(Boolean).length === 0){
throw new Error('每项请至少上传一张商品图片!')
}
// 多种属性组合 所有属性共用的情况下 每一行都是用第一项 // 多种属性组合 所有属性共用的情况下 每一行都是用第一项
if (isAllAttributePic) if (isAllAttributePic){
_item.commodityPic = _productAttributeAndImageParams[0].commodityPic _item.commodityPic = _productAttributeAndImageParams[0].commodityPic
}
} else { } else {
if (isAllAttributePic && _productAttributeAndImageParams[0].commodityPic.length > 0) { //处理所有属性共用 if (isAllAttributePic && _productAttributeAndImageParams[0].commodityPic.length > 0 && _productAttributeAndImageParams[0].commodityPic.filter(Boolean).length > 0) { //处理所有属性共用
_item.commodityPic = _productAttributeAndImageParams[0].commodityPic _item.commodityPic = _productAttributeAndImageParams[0].commodityPic
} }
else else
......
...@@ -148,7 +148,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => { ...@@ -148,7 +148,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => {
</div> </div>
} }
{ {
fileImageList?.length>0 fileImageList?.length>0
? ?
fileImageList.map((item, index)=> <div key={index} className={cx(styles.descriptBox, styles.mediaContentBox)}> fileImageList.map((item, index)=> <div key={index} className={cx(styles.descriptBox, styles.mediaContentBox)}>
<p className={styles.divImage}><img src={item} /></p> <p className={styles.divImage}><img src={item} /></p>
......
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