diff --git a/project.private.config.json b/project.private.config.json index 5b5567e..89e3126 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -23,8 +23,7 @@ "launchMode": "default", "scene": null } - ] } } -} +} \ No newline at end of file diff --git a/src/api/favorite.ts b/src/api/favorite.ts index 937138a..107fc1d 100644 --- a/src/api/favorite.ts +++ b/src/api/favorite.ts @@ -87,3 +87,11 @@ export const MoveFavoriteProductApi = () => { method: 'put', }) } + +// 查看特色说明 +export const Mallproductinstruct = () => { + return useRequest({ + url: '/v2/mall/product/instruct', + method: 'get', + }) +} diff --git a/src/pages/details/components/feature/index.module.scss b/src/pages/details/components/feature/index.module.scss new file mode 100644 index 0000000..02ec54e --- /dev/null +++ b/src/pages/details/components/feature/index.module.scss @@ -0,0 +1,22 @@ +.main { + padding: 32px; + width: 686px; + .title { + font-size: 34px; + font-weight: 600; + color: #333333; + } + .line { + margin-top: 24px; + margin-bottom: 32px; + background-color: #f2f2f2; + height: 1px; + } + .topFont { + margin-top: 20px; + margin-bottom: 24px; + font-size: 28px; + font-weight: 700; + color: rgba(0, 0, 0, 0.8); + } +} diff --git a/src/pages/details/components/feature/index.tsx b/src/pages/details/components/feature/index.tsx new file mode 100644 index 0000000..39ac702 --- /dev/null +++ b/src/pages/details/components/feature/index.tsx @@ -0,0 +1,70 @@ +import { Button, Image, Input, RichText, ScrollView, Text, View } from '@tarojs/components' +import Taro, { useDidShow, usePullDownRefresh, useReady } from '@tarojs/taro' +import classnames from 'classnames' +import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' +import Goods from '../goods' +import styles from './index.module.scss' +import Popup from '@/components/popup' +import { GetProductKindListApi } from '@/api/material' +import { getFilterData } from '@/common/util' +import { alert, goLink } from '@/common/common' +import { Mallproductinstruct } from '@/api/favorite' + +interface Props { + showPopup: boolean + closePopup: () => void + productName?: string + productIds?: number +} + +const FeaturePopup = (param: Props) => { + const { productIds, showPopup } = param + const { fetchData } = Mallproductinstruct() + + const [nodes, setnodes] = useState('') + + const [list, setlist] = useState([]) + const getRich = async() => { + Taro.showLoading({ + title: '加载中...', + }) + + const res = await fetchData({ product_id: productIds }) + if (res.data) { + setnodes(res.data.instructions) + setlist([...res.data.product_list]) + Taro.hideLoading() + } + else { + Taro.hideLoading() + } + } + + useEffect(() => { + if (showPopup) { + getRich() + } + }, [showPopup]) + + return ( + param.closePopup?.()}> + + + {param.productName} + + + 推荐面料 + { + list.map((item, index) => { + return ( + goLink(`/pages/details/index?id=${item.id}`)} key={index} data={item}> + ) + }) + } + + + + ) +} + +export default memo(FeaturePopup) diff --git a/src/pages/details/components/goods/index.module.scss b/src/pages/details/components/goods/index.module.scss new file mode 100644 index 0000000..9ee203f --- /dev/null +++ b/src/pages/details/components/goods/index.module.scss @@ -0,0 +1,123 @@ +.itemBox { + width: 686px; + padding-bottom: 18px; + border-bottom: 1px solid #e7e7e7; + display: flex; + // margin-left: 32px; + margin-bottom: 24px; + + .picBox { + margin-right: 24px; + width: 144px; + height: 144px; + border-radius: 8px; + position: relative; + + .pic { + width: 144px; + height: 144px; + border-radius: 8px; + } + + .posBox { + position: absolute; + bottom: 0px; + right: 0px; + width: 69px; + height: 29px; + background: #000000; + border-radius: 15px 0px 8px 0px; + font-size: 18px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #ffffff; + text-align: center; + line-height: 29px; + + opacity: 0.55; + } + } + + .leftBox { + width: 144px; + height: 144px; + border-radius: 8px; + position: relative; + margin-right: 24px; + + .pic { + width: 144px; + height: 144px; + border-radius: 8px; + } + + .posBox { + position: absolute; + bottom: 0px; + right: 0px; + width: 69px; + height: 29px; + background: #000000; + border-radius: 15px 0px 8px 0px; + font-size: 18px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #ffffff; + text-align: center; + line-height: 29px; + + opacity: 0.55; + } + } + + .rightBox { + .productName { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + margin-bottom: 6px; + } + + .tips { + font-size: 24px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #a6a6a6; + margin-bottom: 17px; + } + + .flexTag { + display: flex; + + .tagOne { + padding-left: 8px; + padding-right: 8px; + padding-top: 3px; + padding-bottom: 3px; + background: #e3ecff; + border-radius: 8px; + font-size: 22px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #4581ff; + text-align: center; + margin-right: 16px; + } + + .tagTwo { + padding-left: 8px; + padding-right: 8px; + padding-top: 3px; + padding-bottom: 3px; + background: #ffeedb; + border-radius: 8px; + font-size: 22px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #fe8e0f; + text-align: center; + } + } + } +} diff --git a/src/pages/details/components/goods/index.tsx b/src/pages/details/components/goods/index.tsx new file mode 100644 index 0000000..18c9b16 --- /dev/null +++ b/src/pages/details/components/goods/index.tsx @@ -0,0 +1,42 @@ +import { Image, View } from '@tarojs/components' +import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' +import styles from '../goods/index.module.scss' +import LabAndImg from '@/components/LabAndImg' + +const Goods = (props: any) => { + const labAndImgObj = useCallback((item) => { + return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url } + }, []) + return ( + props?.clickItem?.()}> + { + props.data?.texture_url === '' && <> + + + + {props.data?.product_color_count}色 + + + } + { + props.data?.texture_url !== '' + && <> + + + {/* */} + {props.data?.product_color_count}色 + + + } + + {props.data?.code}#{props.data?.name} + {props.data?.component} + + {props.data?.width} + {props.data?.weight_density} + + + + ) +} +export default memo(Goods) diff --git a/src/pages/details/index.module.scss b/src/pages/details/index.module.scss index 9b238eb..7f843a8 100644 --- a/src/pages/details/index.module.scss +++ b/src/pages/details/index.module.scss @@ -58,12 +58,23 @@ padding: 24px; margin-top: 16px; border-radius: 16px; - .title { - font-size: $font_size; - font-weight: 500; - color: $color_font_one; + .flexBox { + display: flex; + justify-content: space-between; + align-items: center; margin-bottom: 20px; + .title { + font-size: $font_size; + font-weight: 500; + color: $color_font_one; + } + .flexRight { + font-size: 26px; + font-weight: 500; + color: #337fff; + } } + .con { display: grid; grid-template-columns: 50% 50%; diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index e4d34e8..79bdafd 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import DesSwiper from './components/swiper' import OrderCount from './components/orderCount' import styles from './index.module.scss' +import FeaturePopup from './components/feature' import ShopCart from '@/components/shopCart' import { formatHashTag, formatImgUrl, formatPriceDiv, formatRemoveHashTag } from '@/common/fotmat' import { GetProductDetailApi } from '@/api/material' @@ -175,6 +176,8 @@ const Details = (props: Params) => { getProductDetail() }) + const [showPopup, setshowPopup] = useState(false) + return ( @@ -200,7 +203,12 @@ const Details = (props: Params) => { - 商品参数 + + 商品参数 + { + productInfo.is_instruct && setshowPopup(true)}>{'特色百科 >'} + } + 编号:{productInfo.code} @@ -280,6 +288,7 @@ const Details = (props: Params) => { setShowOrderCount(false)} title={productName} productId={productInfo.id} /> setShowCart(false)} /> + setshowPopup(false)} productName={productName} productIds={Number(params?.id)}> )