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