Commit 869f9342 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理销售订单待审核订单修改价格异常,处理商品修改价格后切换到图片标签异常

parent 701fc12b
......@@ -111,7 +111,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
setIsAllAttributePic(setImageType)
_priceAttributeParams = priceAttributeParams.map((_item, _index) => {
let _obj = {..._item, goodsId: _item.goods.id}
let _obj = {..._item, goodsId: _item?.goods?.id || _item.goodsId}
_obj.commodityPic = maintainImageData[_index] || []
return _obj
})
......
......@@ -95,20 +95,24 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
}
const [amountMoney, setAmountMoney] = useState<number>(amount || sum + freePrice)
// useEffect(() => {
// const _sum = orderProductRequests.reduce((prev, next) => prev + Number((next.money || 0)), 0)
// setSum(_sum)
// }, [])
const [changeTotal, setChangeTotal] = useState<boolean>(false) // 是否改变总价
// 总计金额
useEffect(() => {
setAmountMoney(() => (sum*1000 + freePrice*1000)/1000)
}, [sum, freePrice])
useEffect(() => {
if(changeTotal){
// 执行修改订单运费
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2})
}
}, [amountMoney])
const handleConfirm = () => {
setFreePrice(Number(modalPriceActions.getFieldValue('freePrice') || 0))
modelRef.current.setVisible(false)
setChangeTotal(true)
}
useEffect(() => {
......@@ -294,7 +298,6 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const warehouseRef = useRef<any>({})
// 判断是否可操作当前表格
console.log(SaleOrderInsideWorkStateTexts[data.purchaseOrderInteriorState],data, 'data')
const isEditData = SaleOrderInsideWorkStateTexts[data.purchaseOrderInteriorState] === '待审核订单'
const productComponents = {
body: {
......@@ -338,12 +341,14 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const handleSave = row => {
const newData = [...orderProductRequests];
const index = newData.findIndex(item => row.key === item.key);
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
newData.splice(index, 1, {
...item,
...row,
});
// 执行修改订单价格
PublicApi.postOrderProductPriceUpdate({orderId: data.id, orderDetailsId: row.id, price: row.price, type: 1})
ctl.setData({
...data,
orderProductRequests: newData
......
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