diff --git a/src/pages/cutSampleListOrder/components/productCard/index.tsx b/src/pages/cutSampleListOrder/components/productCard/index.tsx new file mode 100644 index 0000000..f4f80b1 --- /dev/null +++ b/src/pages/cutSampleListOrder/components/productCard/index.tsx @@ -0,0 +1,80 @@ +import { Text, View } from '@tarojs/components' +import Taro, { getCurrentPages, useDidShow } from '@tarojs/taro' +import { memo, useCallback, useEffect, useState } from 'react' +import styles from './index.module.scss' +import Counter from '@/components/counter' +import LabAndImg from '@/components/LabAndImg' + +interface ProductItemParamType { + code: string + id: number + name: string +} + +export interface ParamItem { + id: number + affiliation_product: ProductItemParamType[] + color_card_name: string + texture_url: string + lab: { l: number; a: number; b: number } + rgb: { r: number; g: number; b: number } + is_add: boolean + count?: number +} + +export interface Param { + value: ParamItem + onChangeNum?: (val: { id: number; count: number }) => void + onDelData?: (val: number) => void +} + +export default memo((props: Param) => { + return +}) + +const ProductItem = memo((props: Param) => { + const { value } = props + const labAndImgObj = useCallback( + (item) => { + return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url } + }, + [value], + ) + const onChangeNum = (num) => { + props.onChangeNum?.({ id: value.id, count: num }) + } + const onMin = () => { + Taro.showModal({ + title: '确认删除所选色卡?', + success(res) { + if (res.confirm) { + props?.onDelData?.(value.id) + } + else if (res.cancel) { + props.onChangeNum?.({ id: value.id, count: 1 }) + } + }, + }) + } + return <> + + + + {value.color_card_name} + + + + + + + + +})