Commit b9e57133 authored by XieZhiXiong's avatar XieZhiXiong
parents efef4efe 1f43df86
......@@ -2,5 +2,5 @@ module.exports = function customName(name) {
if (name === 'interval') {
return 'bizcharts/lib/geometry/Interval'
}
return `bizcharts/lib/components/${name}`
return `bizcharts/lib/components/${name.slice(0, 1).toUpperCase() + name.slice(1)}`
};
\ No newline at end of file
......@@ -195,6 +195,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
})
callback()
}
}else{
callback()
}
} catch (err) {
callback(err)
......@@ -323,8 +325,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
<Select
mode="tags"
placeholder="请输入并选择商品卖点"
// maxTagCount={3}
// maxTagTextLength={8}
maxTagCount={3}
maxTagTextLength={8}
tagRender={tagRender}
/>
</Form.Item>
......
......@@ -20,6 +20,8 @@ const ProductImageForm: React.FC<{}> = (props) => {
const [previewImage, setPreviewImage] = useState('')
const [previewTitle, setPreviewTitle] = useState('')
const [setImageType, setSetImageType] = useState<boolean>(true)
// 处理新增二次变更价格保留图片数据
const [maintainImageData, setMaintainImageData] = useState<any>([])
const [openFileDialogFlag, setOpenFileDialogFlag] = useState<boolean>(false)
const flagRef = useRef<boolean>(false)
......@@ -60,10 +62,8 @@ const ProductImageForm: React.FC<{}> = (props) => {
useEffect(()=>{
if(priceAttributeParams.length > 0){
// console.log(priceAttributeParams, '对比')
constructImageListByRender(priceAttributeParams)
}else if(history.location.query?.id){ // 不点击前面 直接进入图片tab
// console.log(productInfoByEdit.unitPriceAndPicList, '对比')
constructImageListByRender(productInfoByEdit.unitPriceAndPicList)
}
},[priceAttributeParams])
......@@ -78,7 +78,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
_priceAttributeParams = priceAttributeParams.map((_item, _index) => {
// 为图片字符串数组手动添加 uid 和 status
// console.log(_item, '_____')
// 查询编辑详情中属性值id相匹配的图片
let _pic = null
let _priceAndPicList = productInfoByEdit.unitPriceAndPicList
......@@ -100,9 +99,11 @@ const ProductImageForm: React.FC<{}> = (props) => {
return _obj
})
}else{
_priceAttributeParams = priceAttributeParams.map(_item=>{
_priceAttributeParams = priceAttributeParams.map((_item, _i) => {
let _obj = {..._item}
_obj.commodityPic = []
// ****这里 新增情况下 价格属性参数变动引起constructImageListByRender数据构建 []会清空之前已经上传的图片
// _obj.commodityPic = []
_obj.commodityPic = maintainImageData[_i] || []
return _obj
})
}
......@@ -110,7 +111,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
clickItemTab(0)
setPriceAttributeParamsByRender(_priceAttributeParams)
setProductAttributeAndImageParams(_priceAttributeParams)
// console.log(_priceAttributeParams, priceAttributeParams, '_p')
// 初始化若是按所有属性共用做显示处理
if(setImageType && _priceAttributeParams.length>0){
setCommonImageList(_priceAttributeParams[0].commodityPic)
......@@ -118,7 +118,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
const clickItemTab = (_index: number) => {
// console.log(_index, '点击项')
setDefaultChecked(_index)
}
......@@ -184,14 +183,12 @@ const ProductImageForm: React.FC<{}> = (props) => {
const handleChange = ({ file, fileList }, index) => {
let _priceAttributeParams = [...priceAttributeParamsByRender]
// console.log(fileList, file, index, editRowIndexRef, '响应')
// console.log(uploadFileSelectRef.current)
const selectUuid = uploadFileSelectRef.current.uid
if (selectUuid) {
// 点了图片编辑
const editPicIndex = fileList.findIndex(v => v.uid === selectUuid)
// console.log(editPicIndex)
fileList.splice(editPicIndex, 1, file)
if (fileList.length > 1) {
fileList.pop()
......@@ -200,7 +197,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
setCommonImageList(fileList)
// console.log(index||editRowIndexRef.current, fileList, '132456')
_priceAttributeParams[index||editRowIndexRef.current].commodityPic = fileList
if(!file?.status && file?.status !== 'done'){
let ttt = _priceAttributeParams[index||editRowIndexRef.current].commodityPic.filter(_ => _.status === 'done')
......@@ -209,6 +205,8 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
setPriceAttributeParamsByRender(_priceAttributeParams)
setProductAttributeAndImageParams(_priceAttributeParams)
// 保留上传的数据在页面状态 用于处理前面价格变动后不重新更新图片数据
setMaintainImageData(_priceAttributeParams.map(item => item.commodityPic))
}
const onChangeSetImageType = (e) => {
......@@ -226,7 +224,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
const handlefileEdit = (file, index) => {
// console.log(file, index)
const uploadEle = document.querySelector(`#uploadEle${index}`) as any
uploadFileSelectRef.current = (file)
editRowIndexRef.current = index
......
......@@ -124,7 +124,7 @@ const OrderHandDeleveModal:React.FC<OrderHandDeleveModalProps> = (props) => {
}}
effects={($, actions) => {
useAsyncSelect('addresId', async () => (await PublicApi.getLogisticsSelectListShipperAddress()).data, ['fullAddress', 'id'])
useAsyncSelect('logisticsCompanyId', async () => (await PublicApi.getLogisticsSelectListCompany()).data, ['name', 'id'])
useAsyncSelect('logisticsCompanyId', async () => (await PublicApi.getLogisticsSelectListCompany({cooperateType: '2'})).data, ['name', 'id'])
// 获取联动的select后续事件, 为了设置对应的name值
$('requestAsyncSelect').subscribe(({ name, payload }) => {
if (name === 'addresId') {
......
......@@ -42,8 +42,13 @@ const RowStyle = styled(props => <Row style={{marginTop: 12}} justify='end' {...
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, preview }) => {
const { orderProductRequests = [], deliveryAddressInfo, freight = 0 } = dataSource || {}
const sum = orderProductRequests.reduce((prev, next) => prev + parseInt((next.price || 0)), 0)
const { orderProductRequests = [], deliveryAddressInfo, freight = 0, sumPrice, amount } = dataSource || {}
// 合计金额, 如果后端有传则用后端数据
const sum = sumPrice || orderProductRequests.reduce((prev, next) => prev + parseInt((next.money || 0)), 0)
// 总计金额
const amountMoney = amount || sum + freight
// const modelRef = useRef<any>({})
// const [freePrice, setFreePrice] = useState<number>(0)
// const handleSetting = () => {
......@@ -87,7 +92,7 @@ export const MoneyTotalBox = ({ dataSource, preview }) => {
</Col>
<Col span={2}>
<div>总计金额</div>
<div>{sum + freight}</div>
<div>{amountMoney}</div>
</Col>
{/* <ModalForm
modalTitle='设置运费'
......@@ -322,9 +327,9 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
},
{
title: '金额',
dataIndex: 'price',
dataIndex: 'money',
align: 'center',
key: 'price',
key: 'money',
},
// 接口调用
{
......
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