2022-07-11 20:06:35 +08:00

53 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Popup from "@/components/popup";
import { Input, ScrollView, Text, View } from "@tarojs/components";
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
import classnames from "classnames";
import styles from './index.module.scss'
import TextareaEnhance from "@/components/textareaEnhance";
import { CreateFavoriteApi, FavoriteListApi } from "@/api/favorite";
import { alert, goLink } from "@/common/common";
import { getFilterData } from "@/common/util";
//原因选择
type ReasonInfoParam = {
show?: boolean, //显示
onClose?: () => void, //关闭
onAdd?: (val: any) => void
}
export default memo(({show = false, onClose, onAdd}: ReasonInfoParam) => {
//获取列表
const [list, setList] = useState([])
const {fetchData: fetchDataList} = FavoriteListApi()
const getFavoriteList = async () => {
let res = await fetchDataList(getFilterData())
setList(() => res.data.list)
}
useEffect(() => {
if(show) getFavoriteList()
}, [show])
const onCreate = () => {
onClose?.()
goLink('/pages/collection/index')
}
return (
<Popup show={show} onClose={onClose} showTitle={false} >
<View className={styles.collection_con}>
<View className={styles.header}>
<Text className={styles.title}></Text>
<View className={styles.miconfont_con} >
<Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text>
<Text onClick={onCreate}></Text>
</View>
</View>
<ScrollView scrollY className={styles.scrollView}>
{list?.map((item: any) => <View onClick={() => onAdd?.(item)} className={styles.collection_item}>
<View className={styles.name}>{item.name}<Text>{item.product_color_list?.length||0}</Text></View>
<View className={styles.desc}>{item.remark}</View>
</View>)}
</ScrollView>
</View>
</Popup>
)
})