✨ feat(码单大货基本对接完):
This commit is contained in:
parent
23f4885111
commit
6048dd888c
@ -3,6 +3,7 @@ import { memo, useCallback, useMemo, useRef } from 'react'
|
|||||||
import Big from 'big.js'
|
import Big from 'big.js'
|
||||||
import type { NumberParam } from '../settingNumber'
|
import type { NumberParam } from '../settingNumber'
|
||||||
import SettingNumber from '../settingNumber'
|
import SettingNumber from '../settingNumber'
|
||||||
|
import useCommon from '../../useHook/useCommon'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import ProductBlock from './productBlock'
|
import ProductBlock from './productBlock'
|
||||||
import { useCurrenCode } from '@/context/ContextCodeSetting'
|
import { useCurrenCode } from '@/context/ContextCodeSetting'
|
||||||
@ -20,6 +21,8 @@ export default memo((props: Parma) => {
|
|||||||
return orderData?.product_details
|
return orderData?.product_details
|
||||||
}, [orderData])
|
}, [orderData])
|
||||||
|
|
||||||
|
const { updateCustomOrderTotal } = useCommon()
|
||||||
|
|
||||||
// 更新整体数据
|
// 更新整体数据
|
||||||
const updateData = useRef({
|
const updateData = useRef({
|
||||||
price: 0,
|
price: 0,
|
||||||
@ -27,6 +30,7 @@ export default memo((props: Parma) => {
|
|||||||
weight_error: 0,
|
weight_error: 0,
|
||||||
adjust_type: 1,
|
adjust_type: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
const getNumber: NumberParam = useCallback((num, type) => {
|
const getNumber: NumberParam = useCallback((num, type) => {
|
||||||
if (type === 'weight') {
|
if (type === 'weight') {
|
||||||
updateData.current.weight = num * 1000
|
updateData.current.weight = num * 1000
|
||||||
@ -51,11 +55,21 @@ export default memo((props: Parma) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
orderData.product_details = productList
|
orderData.product_details = productList
|
||||||
|
console.log('orderData::', orderData)
|
||||||
|
dispatch(updateCustomOrderTotal(orderData))
|
||||||
dispatch({ type: 'updateData', data: JSON.parse(JSON.stringify(orderData)) })
|
dispatch({ type: 'updateData', data: JSON.parse(JSON.stringify(orderData)) })
|
||||||
}, [productList])
|
}, [productList])
|
||||||
|
|
||||||
|
const defaultNum = useMemo(() => {
|
||||||
|
return {
|
||||||
|
weight: Big(orderData?.weight_admin || 0).div(Big(1000)).toNumber(),
|
||||||
|
sale_price: Big(orderData?.price_admin || 0).div(Big(100)).toNumber(),
|
||||||
|
weight_error: Big(orderData?.weight_error_admin || 0).div(Big(1000)).toNumber(),
|
||||||
|
}
|
||||||
|
}, [orderData])
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<SettingNumber onNumber={getNumber} />
|
<SettingNumber onNumber={getNumber} defaultValue={defaultNum} />
|
||||||
<View className={styles.product_list}>
|
<View className={styles.product_list}>
|
||||||
{productList?.map((item) => {
|
{productList?.map((item) => {
|
||||||
return <ProductBlock key={item.id} productInfo={item} sale_mode_name={orderData?.sale_mode_name} />
|
return <ProductBlock key={item.id} productInfo={item} sale_mode_name={orderData?.sale_mode_name} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user