From f3e2f7e796d9effcda07f1557556590375e8619a Mon Sep 17 00:00:00 2001 From: xuan Date: Tue, 28 Feb 2023 19:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=88=20style(=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96):=20=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.ts | 4 +- src/components/counter/index.module.scss | 3 +- src/components/goodsItem/index.module.scss | 4 +- src/components/goodsItem/index.tsx | 72 +++++++++---------- src/components/shoppingCart/index.tsx | 1 + .../colorCardList/index.module.scss | 3 +- 6 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/common/constant.ts b/src/common/constant.ts index 14bc3f1..fc4b7fe 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -1,11 +1,11 @@ -export const BASE_URL = CURRENT_BASE_URL +// export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 -// export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布 +export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布 // export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 diff --git a/src/components/counter/index.module.scss b/src/components/counter/index.module.scss index df134f5..43c481c 100644 --- a/src/components/counter/index.module.scss +++ b/src/components/counter/index.module.scss @@ -24,7 +24,7 @@ } .input { display: flex; - align-items: flex-end; + align-items: center; background-color: #fff; padding: 5px 10px; box-sizing: border-box; @@ -34,6 +34,7 @@ font-size: $font_size_medium; width: 100%; padding-right: 10px; + text-align: center; } } diff --git a/src/components/goodsItem/index.module.scss b/src/components/goodsItem/index.module.scss index e5c570e..1cc0b83 100644 --- a/src/components/goodsItem/index.module.scss +++ b/src/components/goodsItem/index.module.scss @@ -60,6 +60,9 @@ } .rightFontsbox { + display: flex; + flex-direction: column; + align-items: flex-end; .moneyFlex { margin-bottom: 14px; display: flex; @@ -79,7 +82,6 @@ } .inputBox { - width: 189px; height: 64px; border-radius: 8px; border: 1px solid #979797; diff --git a/src/components/goodsItem/index.tsx b/src/components/goodsItem/index.tsx index 62a27fe..6e923ad 100644 --- a/src/components/goodsItem/index.tsx +++ b/src/components/goodsItem/index.tsx @@ -3,17 +3,17 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' import classnames from 'classnames' import styles from './index.module.scss' import LabAndImg from '@/components/LabAndImg' +import { formatPriceDiv, formatWeightDiv } from '@/common/format' interface props { clickAdd: (any) => void - // onInputEven?: (a: any, c: any) => void, clickReduce: (any) => void handPlus: (any) => void modeFont?: number value: { showInput?: boolean nums?: string - bulk_price?: Number | 0 + bulk_price?: Number length_cut_price?: Number weight_cut_price?: Number code?: string @@ -33,21 +33,31 @@ interface props { onBlur?: (a: any, c: any) => void } const GoodsItem = (props: props) => { - const [value, setValue] = useState({ count: props.value.nums }) + const { + clickAdd, + clickReduce, + handPlus, + modeFont, + value: valueInfo, + onBlur, + } = props + + const [value, setValue] = useState({ count: valueInfo.nums }) + console.log(value.count, 'value.count') const onInputEven = (e) => { const res = e.detail.value - if (props.modeFont == 0) { + if (modeFont == 0) { if (Number(res) < 1) { setValue({ count: '' }) } } - if (props.modeFont == 1) { + if (modeFont == 1) { if (Number(res) < 0) { setValue({ count: '' }) } } - if (props.modeFont == 2) { + if (modeFont == 2) { if (Number(res) < 0) { setValue({ count: '' }) } @@ -55,63 +65,50 @@ const GoodsItem = (props: props) => { } const type = useMemo(() => { - if (props.modeFont === 0) { + if (modeFont === 0) { return 'number' } else { return 'digit' } - }, [props.modeFont]) + }, [modeFont]) const labAndImgObj = useCallback((item) => { return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url } }, []) + return ( - - {/* { - props?.value?.rgb?.r == 0 && props?.value?.rgb?.g == 0 && props?.value?.rgb?.b == 0 && - } - { - (props?.value?.rgb?.r != 0 || props?.value?.rgb?.g != 0 || props?.value?.rgb?.b != 0) - && - } */} - + - {props.value?.code} {props.value?.name} - 剩:{props.value?.roll}件 + {valueInfo?.code} {valueInfo?.name} + 剩:{valueInfo?.roll}件 { - props?.modeFont === 0 && 空差:{props?.value?.weight_error as number / 1000 || 0}Kg + modeFont === 0 && 空差:{formatWeightDiv(valueInfo?.weight_error) || 0}Kg } { - props?.modeFont === 0 && props.value?.last_bulk_price !== props.value?.bulk_price && ¥{props?.modeFont === 0 ? Number(props.value?.last_bulk_price) / 100 : props.modeFont === 1 ? Number(props.value?.last_length_cut_price) / 100 : Number(props.value?.last_weight_cut_price) / 100} {props.modeFont as any != 1 ? '/Kg' : '/m'} + modeFont === 0 && valueInfo?.last_bulk_price !== valueInfo?.bulk_price && ¥{modeFont === 0 ? formatPriceDiv(valueInfo?.last_bulk_price) : modeFont === 1 ? formatPriceDiv(valueInfo?.last_length_cut_price) : formatPriceDiv(valueInfo?.last_weight_cut_price)} {modeFont as any != 1 ? '/Kg' : '/m'} } - ¥{props?.modeFont === 0 ? Number(props.value?.bulk_price) / 100 : props.modeFont === 1 ? Number(props.value?.length_cut_price) / 100 : Number(props.value?.weight_cut_price) / 100}{props.modeFont != 1 ? '/Kg' : '/m'} + ¥{modeFont === 0 ? formatPriceDiv(valueInfo?.bulk_price) : modeFont === 1 ? formatPriceDiv(valueInfo?.length_cut_price) : formatPriceDiv(valueInfo?.weight_cut_price)}{modeFont != 1 ? '/Kg' : '/m'} { - props.value.showInput && - { props.clickReduce?.(props.value) }}> - + valueInfo.showInput + ? + { clickReduce?.(valueInfo) }}> + + + onBlur?.(e, valueInfo.id)}> + + handPlus?.(valueInfo)}>+ - - props.onBlur?.(e, props.value.id)}> - - {/* onInputEven($event, props.value)}> */} - - { props.handPlus?.(props.value) }}> - + - - - } - { - !props.value.showInput && props.clickAdd?.(props.value)}>+ + : clickAdd?.(valueInfo)}>+ } @@ -119,4 +116,3 @@ const GoodsItem = (props: props) => { ) } export default memo(GoodsItem) -// ($event) => onInputEven($event, props.value) diff --git a/src/components/shoppingCart/index.tsx b/src/components/shoppingCart/index.tsx index 626007c..b7c7661 100644 --- a/src/components/shoppingCart/index.tsx +++ b/src/components/shoppingCart/index.tsx @@ -108,6 +108,7 @@ const ShoppingCart = (props: prosObj, ref) => { const rows = ({ id, index, style, data }: any) => { const item = data[index] + console.log('item', item) return ( <>