| | |
| | | getBallMirrorList, |
| | | getColumnMirrorList, |
| | | getOptometryBallMirrorList, |
| | | getOptometryColumnMirrorList, |
| | | } from '@/utils/mirror'; |
| | | import FrameModelSelect from '@/components/FrameModelSelect'; |
| | | import LensSeriesSelect from '@/components/LensSeriesSelect'; |
| | |
| | | |
| | | // 球镜可选列表(非库存镜片-2000到2000,每25一跳、库存镜片0到-1000,每25一跳,没有-25),选择后除以100 |
| | | const [ballMirrorList, setBallMirrorList] = useState([]); |
| | | const [columnMirrorList, setColumnMirrorList] = useState( |
| | | getColumnMirrorList() |
| | | ); |
| | | const [columnMirrorList, setColumnMirrorList] = useState([]); |
| | | |
| | | const resetBallMirrorList = (series: any) => { |
| | | // 球镜可选列表(非库存镜片-2000到2000,每25一跳、库存镜片0到-1000,每25一跳,没有-25),选择后除以100 |
| | | // 如果是非库存, |
| | | let lastBallMirrorList = []; |
| | | let lastColumnMirrorList = []; |
| | | if (series.type == 2) { |
| | | lastBallMirrorList = getOptometryBallMirrorList(); |
| | | lastColumnMirrorList = getOptometryColumnMirrorList(); |
| | | } else { |
| | | lastBallMirrorList = getBallMirrorList(); |
| | | lastColumnMirrorList = getColumnMirrorList(); |
| | | } |
| | | if (lastBallMirrorList.length !== ballMirrorList.length) { |
| | | // 重置球镜,因为可选项变了(也可以检查下值有没有再说,以后再说) |
| | |
| | | ballMirrorL: undefined, |
| | | }); |
| | | } |
| | | if (lastColumnMirrorList.length !== columnMirrorList.length) { |
| | | // 重置柱镜,因为可选项变了(也可以检查下值有没有再说,以后再说) |
| | | form.setFieldsValue({ |
| | | columnMirrorR: undefined, |
| | | columnMirrorL: undefined, |
| | | }); |
| | | } |
| | | setBallMirrorList(lastBallMirrorList); |
| | | setColumnMirrorList(lastColumnMirrorList); |
| | | }; |
| | | |
| | | const frameModelRef = useRef(null); |
| | |
| | | lensTypeName: currentLensType?.label || '', |
| | | refractiveIndex: values.refractiveIndex, |
| | | ballMirror: (values.ballMirrorR / 100).toFixed(2), |
| | | columnMirror: values.columnMirrorR, |
| | | columnMirror: |
| | | columnMirrorList.length > 8 |
| | | ? (values.columnMirrorR / 100).toFixed(2) |
| | | : values.columnMirrorR, |
| | | price: currentRefractiveIndex?.sales || 0, |
| | | cost: currentRefractiveIndex?.cost || 0, |
| | | frameModelId: undefined, |
| | |
| | | lensTypeName: currentLensType?.label || '', |
| | | refractiveIndex: values.refractiveIndex, |
| | | ballMirror: (values.ballMirrorL / 100).toFixed(2), |
| | | columnMirror: values.columnMirrorL, |
| | | columnMirror: |
| | | columnMirrorList.length > 8 |
| | | ? (values.columnMirrorL / 100).toFixed(2) |
| | | : values.columnMirrorL, |
| | | price: currentRefractiveIndex?.sales || 0, |
| | | cost: currentRefractiveIndex?.cost || 0, |
| | | frameModelId: undefined, |
| | |
| | | renderFormat={(option, value) => { |
| | | return option ? ( |
| | | <span> |
| | | {+option.value === 0 ? '-' : option.value} |
| | | {columnMirrorList.length > 8 |
| | | ? `${(+option.value / 100).toFixed(2)}` |
| | | : +option.value === 0 |
| | | ? '-' |
| | | : option.value} |
| | | </span> |
| | | ) : ( |
| | | value |
| | | ); |
| | | }} |
| | | // renderFormat={(option, value) => { |
| | | // return option ? ( |
| | | // <span> |
| | | // {+option.value === 0 ? '-' : option.value} |
| | | // </span> |
| | | // ) : ( |
| | | // value |
| | | // ); |
| | | // }} |
| | | > |
| | | {columnMirrorList.map((item) => { |
| | | return ( |