From 24773447e96a310c2041a9f9e62e3cde112bf425 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 16 Nov 2022 13:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ID1000708=20=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=8C=89=E9=92=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 +- src/components/moveBtn/index.tsx | 89 ++--- .../components/orderCount/index.module.scss | 336 +++++++++--------- .../details/components/orderCount/index.tsx | 3 +- src/pages/details/index.module.scss | 333 ++++++++--------- src/pages/details/index.tsx | 5 +- src/pages/user/index.tsx | 11 +- 7 files changed, 403 insertions(+), 378 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 8434c8f..415802b 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -1,4 +1,4 @@ -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` @@ -14,7 +14,7 @@ export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.22:50002/lymarket` // 婷 -// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/moveBtn/index.tsx b/src/components/moveBtn/index.tsx index c4a125b..4ece3b6 100644 --- a/src/components/moveBtn/index.tsx +++ b/src/components/moveBtn/index.tsx @@ -1,48 +1,53 @@ -import { MovableArea, MovableView, View } from "@tarojs/components" -import Taro, { useReady } from "@tarojs/taro" -import { ReactElement, useEffect, useRef, useState } from "react" -import classnames from "classnames"; -import styles from './index.module.scss' -import { GetShoppingCartApi } from "@/api/shopCart"; -import useCommonData from "@/use/useCommonData"; -import { useSelector } from "@/reducers/hooks"; +import { MovableArea, MovableView, View } from '@tarojs/components' +import Taro, { useReady } from '@tarojs/taro' +import { ReactElement, useEffect, useLayoutEffect, useRef, useState } from 'react' +import classnames from 'classnames' +import styles from './index.module.scss' +import { GetShoppingCartApi } from '@/api/shopCart' +import useCommonData from '@/use/useCommonData' +import { useSelector } from '@/reducers/hooks' type param = { - children?: ReactElement|null, - onClick?: () => void + children?: ReactElement | null + onClick?: () => void } -export default ({children = null, onClick}:param) => { - //获取购物车数据数量 - const {getShopCount, commonData} = useCommonData() - - const [screenHeight, setScreenHeight] = useState(0) - const [showMoveBtn, setShowMoveBtn] = useState(false) - const screenWidthRef = useRef(0) - useReady(() => { - const res = Taro.getSystemInfoSync() - if(res.screenHeight) { - let ratio = 750 / res.screenWidth - setScreenHeight(res.screenHeight*ratio - 460) - screenWidthRef.current = res.screenWidth/2 - } - setShowMoveBtn(true) - }) - - useEffect(() => { - getShopCount() - }, []) - - const dragEnd = (e) => { +export default ({ children = null, onClick }: param) => { + //获取购物车数据数量 + const { getShopCount, commonData } = useCommonData() + const [screenHeight, setScreenHeight] = useState(0) + const [showMoveBtn, setShowMoveBtn] = useState(false) + const screenWidthRef = useRef(0) + useLayoutEffect(() => { + const res = Taro.getSystemInfoSync() + if (res.screenHeight) { + let ratio = 750 / res.screenWidth + setScreenHeight(res.screenHeight * ratio - 460) + screenWidthRef.current = res.screenWidth / 2 } + setShowMoveBtn(true) + }) - return ( - - {children} - {showMoveBtn&& dragEnd(e)}> - - {(commonData.shopCount > 0)&&{commonData.shopCount > 99?'99+':commonData.shopCount}} - } - - ) -} \ No newline at end of file + useEffect(() => { + getShopCount() + }, []) + + const dragEnd = (e) => {} + + return ( + + {children} + dragEnd(e)}> + + {commonData.shopCount > 0 && {commonData.shopCount > 99 ? '99+' : commonData.shopCount}} + + + ) +} diff --git a/src/pages/details/components/orderCount/index.module.scss b/src/pages/details/components/orderCount/index.module.scss index 705cf29..fe825c9 100644 --- a/src/pages/details/components/orderCount/index.module.scss +++ b/src/pages/details/components/orderCount/index.module.scss @@ -1,176 +1,180 @@ -.shop_cart_main{ - .popup_con{ - height: 80vh; +.shop_cart_main { + .popup_con { + height: 80vh; + display: flex; + flex-direction: column; + } + .header { + color: $color_font_one; + font-size: 32px; + font-weight: 700; + padding: 20px; + } + .colorFind { + padding: 10px 20px; + display: flex; + align-items: center; + .search { + flex: 1; + } + .text { + font-size: $font_size_medium; + color: $color_main; + } + } + .search { + display: flex; + align-items: center; + padding: 20px; + .search_title { + font-size: $font_size; + color: #000; + width: 160px; + } + .search_list { + display: flex; + justify-content: space-between; + flex: 1; + } + .search_item { + width: 148px; + height: 55px; + text-align: center; + line-height: 55px; + color: $color_font_two; + font-size: $font_size_medium; + background-color: #f0f0f0; + border-radius: 50px; + } + .search_item_select { + border: 2px solid $color_main; + background-color: #ecf5ff; + color: $color_main; + width: 144px; + height: 51px; + } + } + .colorNum { + display: flex; + justify-content: space-between; + padding: 20px; + .title { + font-size: 26px; + } + .miconfont { + font-size: 36px; + color: $color_font_two; + } + } + .product_color_con { + flex: 1; + height: 0; + padding-bottom: 151px; + } + .color_con { + .virtual_list { + padding-bottom: 300px; + } + .item { + display: flex; + justify-content: space-between; + padding: 0 20px; + margin-bottom: 40px; + .item_color { + width: 156.5px; + height: 156.5px; + border-radius: 20px; + } + .item_con { + flex: 1; display: flex; flex-direction: column; - } - .header{ - color: $color_font_one; - font-size: 32px; - font-weight: 700; - padding: 20px; - } - .colorFind{ - padding: 10px 20px; - display: flex; - align-items: center; - .search{ - flex:1; - } - .text{ - font-size: $font_size_medium; - color: $color_main; - } - } - .search{ - display: flex; - align-items: center; - padding: 20px; - .search_title{ - font-size: $font_size; - color: #000; - width: 160px; - } - .search_list{ - display: flex; - justify-content: space-between; - flex:1; - } - .search_item{ - width: 148px; - height: 55px; - text-align: center; - line-height: 55px; - color: $color_font_two; - font-size: $font_size_medium; - background-color: #f0f0f0; - border-radius: 50px; - } - .search_item_select{ - border: 2px solid $color_main; - background-color: #ecf5ff; - color: $color_main; - width: 144px; - height: 51px; - } - } - .colorNum{ - display: flex; justify-content: space-between; - padding: 20px; - .title{ - font-size: 26px; + padding: 20px 0 20px 20px; + .title { + font-size: $font_size_big; + font-weight: 700; } - .miconfont{ - font-size: 36px; - color: $color_font_two; + .num { + font-size: $font_size; + color: $color_main; + padding-top: 10px; } - } - .product_color_con{ - flex:1; - height: 0; - padding-bottom:151px; - } - .color_con{ - .virtual_list{ - padding-bottom: 300px; + .weight_error { + font-size: 28px; + color: #666666; } - .item { - display: flex; - justify-content: space-between; - padding: 0 20px; - margin-bottom: 40px; - .item_color{ - width: 156.5px; - height: 156.5px; - border-radius: 20px; - - } - .item_con{ - flex:1; - display: flex; - flex-direction: column; - justify-content: space-between; - padding: 20px 0 20px 20px; - .title{ - font-size: $font_size_big; - font-weight: 700; - } - .num{ - font-size: $font_size; - color: $color_main; - } - .priceText{ - font-size: $font_size_big; - Text{ - font-size: $font_size_min; - } - } - } - .btn_con{ - display: flex; - align-items: flex-end; - .btn{ - width: 116px; - height: 64px; - background-color: $color_main; - border-radius: 40px 0px 16px 0px; - font-size: $font_size_medium; - text-align: center; - line-height: 64px; - color: #fff; - } - .btn_count{ - width: 235px; - height: 64px; - background-color: #ECF5FF; - border-radius: 40px 0px 16px 0px; - padding: 0 20px; - display: flex; - align-items: center; - } - } + .priceText { + font-size: $font_size_big; + Text { + font-size: $font_size_min; + } } - } - .noData{ - width:100%; - height: 100%; + } + .btn_con { display: flex; - justify-content: center; - align-items: center; - color: $color_font_three; - font-size: $font_size_medium; + align-items: flex-end; + .btn { + width: 116px; + height: 64px; + background-color: $color_main; + border-radius: 40px 0px 16px 0px; + font-size: $font_size_medium; + text-align: center; + line-height: 64px; + color: #fff; + } + .btn_count { + width: 235px; + height: 64px; + background-color: #ecf5ff; + border-radius: 40px 0px 16px 0px; + padding: 0 20px; + display: flex; + align-items: center; + } + } } - .buy_btn{ - width: 100%; - padding: 0 40px; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); - box-sizing: border-box; - position: fixed; - bottom:0; - font-size: $font_size_medium; - color: $color_font_two; - background-color: #fff; - box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); - .buy_btn_con{ - display: flex; - justify-content: space-between; - align-items: center; - height: 151px; - } - .add_cart{ - width: 260px; - height: 90px; - font-size: $font_size_big; - text-align: center; - line-height: 90px; - border-radius: 50px; - color: #fff; - background: linear-gradient(38deg,#5cabff, #7cbcfc 100%, #99ccff 100%); - } - .select_add_cart{ - background: linear-gradient(38deg,#007aff, #4fa6ff 100%, #68b4ff 100%); - } + } + .noData { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + color: $color_font_three; + font-size: $font_size_medium; + } + .buy_btn { + width: 100%; + padding: 0 40px; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + box-sizing: border-box; + position: fixed; + bottom: 0; + font-size: $font_size_medium; + color: $color_font_two; + background-color: #fff; + box-shadow: 6px 0px 12px 0px rgba(0, 0, 0, 0.16); + .buy_btn_con { + display: flex; + justify-content: space-between; + align-items: center; + height: 151px; } -} \ No newline at end of file + .add_cart { + width: 260px; + height: 90px; + font-size: $font_size_big; + text-align: center; + line-height: 90px; + border-radius: 50px; + color: #fff; + background: linear-gradient(38deg, #5cabff, #7cbcfc 100%, #99ccff 100%); + } + .select_add_cart { + background: linear-gradient(38deg, #007aff, #4fa6ff 100%, #68b4ff 100%); + } + } +} diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index 0fb5e37..cd90c9c 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -12,7 +12,7 @@ import { GetColorList } from '@/api/materialColor' import { AddShoppingCartApi } from '@/api/shopCart' import Taro, { useRouter } from '@tarojs/taro' import UseLogin from '@/use/useLogin' -import { formatHashTag, formatPriceDiv } from '@/common/fotmat' +import { formatHashTag, formatPriceDiv, formatWeightDiv } from '@/common/fotmat' import { getFilterData } from '@/common/util' import LabAndImg from '@/components/LabAndImg' import VirtualList from '@tarojs/components/virtual-list' @@ -228,6 +228,7 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param {formatHashTag(item.code, item.name)} + 空差:{formatWeightDiv(item.weight_error)}kg {formatPrice(item)} diff --git a/src/pages/details/index.module.scss b/src/pages/details/index.module.scss index ec682c6..f10e48b 100644 --- a/src/pages/details/index.module.scss +++ b/src/pages/details/index.module.scss @@ -1,174 +1,179 @@ -.main{ - min-height: 100%; - background-color: $color_bg_one; - padding-bottom: 100px; - .product_header{ - padding: 0 20px; +.main { + min-height: 100%; + background-color: $color_bg_one; + padding-bottom: 100px; + .product_header { + padding: 0 20px; + display: flex; + align-items: center; + height: 163.57px; + background-color: #fff; + .title { + flex: 1; + .name { + font-size: 32px; + font-weight: 700; + color: $color_font_one; + @include common_ellipsis(1); + } + .des { + font-size: $font_size_medium; + color: $color_font_three; + @include common_ellipsis(1); + margin-top: 20px; + } + } + .share, + .collect { + width: 76px; + font-size: $font_size_min; + text-align: center; + color: $color_font_three; + position: relative; + .text { + margin-top: 10px; + font-size: $font_size_medium; + } + } + .shareBtn { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + } + .miconfont { + font-size: 45px; + } + .collected { + color: #ffc300; + } + } + .des_data { + background-color: #fff; + padding: 20px; + margin-top: 16px; + .title { + font-size: $font_size; + font-weight: 700; + color: $color_font_one; + margin-bottom: 20px; + } + .con { + display: grid; + grid-template-columns: 260px auto; + font-size: $font_size_medium; + color: $color_font_three; + .des_text { display: flex; - align-items: center; - height: 163.57px; - background-color: #fff; - .title{ - flex:1; - .name{ - font-size: 32px; - font-weight: 700; - color: $color_font_one; - @include common_ellipsis(1); - } - .des{ - font-size: $font_size_medium; - color: $color_font_three; - @include common_ellipsis(1); - margin-top: 20px; - } + margin-bottom: 16px; + text { + flex: 1; + @include common_ellipsis(1); } - .share, .collect { - width: 76px; - font-size: $font_size_min; - text-align: center; - color: $color_font_three; - position: relative; - .text{ - margin-top: 10px; - font-size: $font_size_medium; - } - } - .shareBtn { - position: absolute; - top: 0; - left: 0; + } + } + } + .product_color { + background-color: #fff; + margin-top: 16px; + padding: 30px 20px 0; + color: $color_font_one; + font-size: $font_size_medium; + .title { + } + .list { + margin-top: 30px; + display: grid; + grid-template-columns: 210px 210px 210px; + justify-content: space-between; + .item { + width: 210px; + margin-bottom: 28px; + .item_color { + width: 210px; + height: 210px; + border-radius: 20px; + image { width: 100%; height: 100%; - opacity: 0; + border-radius: 20px; + } } - .miconfont{ - font-size: 45px; + .item_name { + text-align: center; + margin-top: 10px; + @include common_ellipsis; } - .collected{ - color: #FFC300; + .bulk_price { + color: #8a8a8a; + font-size: 24px; + text-align: center; } + } } - .des_data{ - background-color: #fff; - padding: 20px; - margin-top: 16px; - .title{ - font-size: $font_size; - font-weight: 700; - color: $color_font_one; - margin-bottom: 20px; - } - .con{ - display: grid; - grid-template-columns: 260px auto; - font-size: $font_size_medium; - color: $color_font_three; - .des_text{ - display: flex; - margin-bottom: 16px; - text{ - flex:1; - @include common_ellipsis(1); - } - } - } + } + .product_detail { + // padding: 20px; + background-color: #fff; + margin-top: 16px; + } + .product_buy { + display: flex; + justify-content: space-between; + align-items: center; + height: 95px; + width: 100vw; + position: fixed; + bottom: 0; + left: 0; + background-color: #fff; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + + .buy_cart { + width: 150px; + color: $color_font_three; + text-align: center; + position: relative; + .text { + font-size: $font_size_min; + } + .miconfont { + font-size: 36px; + } + .product_num { + position: absolute; + font-size: 23px; + background-color: red; + color: #fff; + height: 36px; + line-height: 36px; + padding: 0 6px; + border-radius: 72px; + min-width: 25px; + text-align: center; + top: 0; + right: 20px; + } } - .product_color{ - background-color: #fff; - margin-top: 16px; - padding: 30px 20px 0; - color: $color_font_one; - font-size: $font_size_medium; - .title{ - - } - .list{ - margin-top: 30px; - display: grid; - grid-template-columns: 210px 210px 210px ; - justify-content: space-between; - .item { - width:210px; - margin-bottom: 20px; - .item_color{ - width:210px; - height: 210px; - border-radius: 20px; - image{ - width: 100%; - height: 100%; - border-radius: 20px; - } - } - .item_name{ - text-align: center; - margin-top: 10px; - } - } - } + .buy_btn { + display: flex; + justify-content: center; + align-items: center; + width: 297px; + height: 100%; + background-color: $color_main; + font-size: $font_size; + color: #fff; + position: relative; + .phoneBtn { + background-color: rgba(0, 0, 0, 0); + position: absolute; + width: 100%; + height: 100%; + } } - .product_detail{ - // padding: 20px; - background-color: #fff; - margin-top: 16px; - } - .product_buy{ - display: flex; - justify-content: space-between; - align-items: center; - height:95px; - width: 100vw; - position: fixed; - bottom: 0; - left: 0; - background-color: #fff; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); - - - .buy_cart{ - width: 150px; - color: $color_font_three; - text-align: center; - position: relative; - .text{ - font-size: $font_size_min; - } - .miconfont{ - font-size: 36px; - } - .product_num{ - position: absolute; - font-size: 23px; - background-color: red; - color: #fff; - height: 36px; - line-height: 36px; - padding: 0 6px; - border-radius: 72px; - min-width: 25px; - text-align: center; - top: 0; - right: 20px; - } - } - .buy_btn{ - display: flex; - justify-content: center; - align-items: center; - width: 297px; - height: 100%; - background-color: $color_main; - font-size: $font_size; - color: #fff; - position: relative; - .phoneBtn{ - background-color: rgba(0, 0, 0, 0); - position: absolute; - width: 100%; - height: 100%; - } - } - } -} \ No newline at end of file + } +} diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index e801c00..54c21af 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -6,7 +6,7 @@ import OrderCount from './components/orderCount' import ShopCart from '@/components/shopCart' import styles from './index.module.scss' import { useCallback, useEffect, useMemo, useState } from 'react' -import { formatHashTag, formatImgUrl } from '@/common/fotmat' +import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat' import { GetProductDetailApi } from '@/api/material' import useLogin from '@/use/useLogin' import { AnalysisShortCodeApi, GetShortCodeApi } from '@/api/share' @@ -218,7 +218,8 @@ export default (props: Params) => { - {item.code} + {formatHashTag(item.code, item.name)} + {formatPriceDiv(item.bulk_price)}/Kg ) })} diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 3ceaa50..f9fa34d 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -341,7 +341,16 @@ const Main = memo(() => { - {item.type === 'customer' && } + {item.type === 'customer' && ( + + )} ) })}