From 2731717a7d546264f31961e2639122e584303961 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 20 Apr 2022 11:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/shopCart/index.tsx | 3 ++- .../components/estimatedAmount/index.tsx | 22 ++++++++++++++----- src/pages/order/index.module.scss | 4 ++++ src/pages/order/index.tsx | 10 +++++++-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 8e22413..07ac3a7 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -7,6 +7,7 @@ import InfiniteScroll from "@/components/infiniteScroll"; import styles from "./index.module.scss" import { useEffect, useState } from "react"; import Taro from "@tarojs/taro"; +import { goLink } from "@/common/common"; type param = { show?: true|false, @@ -149,7 +150,7 @@ export default ({show = false, onClose}: param) => { 200 预估金额 - + goLink('/pages/order/index')}> 去结算 diff --git a/src/pages/order/components/estimatedAmount/index.tsx b/src/pages/order/components/estimatedAmount/index.tsx index 27d63f1..441627b 100644 --- a/src/pages/order/components/estimatedAmount/index.tsx +++ b/src/pages/order/components/estimatedAmount/index.tsx @@ -1,16 +1,28 @@ import { Text, View } from "@tarojs/components" +import { useCallback, useEffect, useMemo } from "react" import styles from './index.module.scss' type Param = { - style?: Object + style?: Object, + number?: number } -export default ({style}:Param) => { +export default ({style, number = 0}:Param) => { + const priceDom = useCallback(() => { + let res = number.toFixed(2).split('.') + let int_num = parseInt(res[0]).toLocaleString() + let decimals_num = res[1] + return ( + <> + ¥ + {int_num} + .{decimals_num} + + ) + }, [number]) return ( 预估金额 - ¥ - 6,001 - .00 + {priceDom()} ) diff --git a/src/pages/order/index.module.scss b/src/pages/order/index.module.scss index 84a37bd..b8c8cb1 100644 --- a/src/pages/order/index.module.scss +++ b/src/pages/order/index.module.scss @@ -202,6 +202,10 @@ align-items: center; color: #fff; } + .order_number_desc{ + font-size: $font_size_medium; + color: $color_font_two; + } } } \ No newline at end of file diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 7dc2644..1e3dea4 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -1,9 +1,12 @@ import { Text, View } from "@tarojs/components" import classnames from "classnames"; +import { useEffect, useState } from "react"; import EstimatedAmount from "./components/estimatedAmount"; import styles from './index.module.scss' export default () => { + const [price, setPrice] = useState(123000.33) + return ( @@ -88,7 +91,7 @@ import styles from './index.module.scss' - + (按照25kg/条, 预估金额) @@ -98,7 +101,10 @@ import styles from './index.module.scss' - + + + 2种面料,6种颜色,共6条 + 提交订单