From 6d0bc162f468ea9c9eb4f350b652c90f327ce24b Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 22 Sep 2022 16:28:30 +0800 Subject: [PATCH] =?UTF-8?q?1)=20=E5=A2=9E=E5=8A=A0=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E7=AB=8B=E5=87=8F=E9=87=91=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/knockGold/mobileComponent.jsx | 138 ++++++++++++------- 1 file changed, 89 insertions(+), 49 deletions(-) diff --git a/src/components/knockGold/mobileComponent.jsx b/src/components/knockGold/mobileComponent.jsx index 799ce02e..2439acab 100644 --- a/src/components/knockGold/mobileComponent.jsx +++ b/src/components/knockGold/mobileComponent.jsx @@ -1,122 +1,160 @@ -import { Placeholder } from 'zent' -import { useEffect, useState } from 'react' -import './index.less' -import { sortWeeks } from '@/utils' -const widths = [24, 100, 100, 100, 80, 24, 100, 100, 100, 80, 100, 100, 100, 80] +import { Placeholder } from "zent"; +import { useEffect, useState } from "react"; +import { useSetState } from "ahooks"; +import "./index.less"; +import { sortWeeks } from "@/utils"; +const widths = [ + 24, 100, 100, 100, 80, 24, 100, 100, 100, 80, 100, 100, 100, 80, +]; export default ({ data }) => { - const [newWeek, setNewWeek] = useState([]) + const [newWeek, setNewWeek] = useState([]); + const [state, setState] = useSetState({ + keyType: sessionStorage.getItem("keyType") + ? Number(sessionStorage.getItem("keyType")) + : 1, + }); + useEffect(() => { - setNewWeek(sortWeeks(data.ruleWeek)) - }, [data.ruleWeek]) + setNewWeek(sortWeeks(data.ruleWeek)); + }, [data.ruleWeek]); + + function couponH5() { + return ( +
+
+
+
+

+ ¥ {data.denomination} +

+

共省¥ {data.reduce_amount}

+
+
+
立即支付
+
+
+ ); + } function createElement() { - if (data.usable_time === 'week') { + if (data.usable_time === "week") { return ( -
+

可用时间

-
    +
      {newWeek?.map((item) => (
    • {item} {data.ruleDate.map((item1) => { if (item1[1]) return ( -

      +

      {item1[0]}~{item1[1]}

      - ) + ); })}
    • ))}
- ) - } else if (data.usable_time === 'irregular') { + ); + } else if (data.usable_time === "irregular") { return ( -
+

可用时间

-
    +
      {data.irregularDate?.map((item) => (
    • - {item.join(' 至 ')} + {item.join(" 至 ")} {data.irregularTime.map((item1) => { if (item1[1]) return ( -

      +

      {item1[0]}~{item1[1]}

      - ) + ); })}
    • ))}
- ) + ); } } return ( -
-
-
-

+

+
+
+

- {data.reduce_amount ? data.reduce_amount : '0.00'} + {data.reduce_amount ? data.reduce_amount : "0.00"}

-

- 满{data.denomination ? data.denomination : '0.00'}可用 +

+ 满{data.denomination ? data.denomination : "0.00"}可用

-
+

- {data.batch_goods_name ? data.batch_goods_name : 'xxx'} + className={data.batch_goods_name.length < 20 ? "title" : "isTitle"} + > + {data.batch_goods_name ? data.batch_goods_name : "xxx"}

{data?.card_type.length > 0 ? data.card_type.map( - (item) => (item === '1' ? '借记卡' : '信用卡') + ' ' + (item) => (item === "1" ? "借记卡" : "信用卡") + " " ) - : 'xxx xxx xxx'}{' '} + : "xxx xxx xxx"}{" "} 可用

-

+

有效期: - {data?.entry_time ? data.entry_time[0] : 'xxxx-xx-xx xx:xx:xx'}至 - {data?.entry_time ? data.entry_time[1] : 'xxxx-xx-xx xx:xx:xx'} + {data?.entry_time ? data.entry_time[0] : "xxxx-xx-xx xx:xx:xx"}至 + {data?.entry_time ? data.entry_time[1] : "xxxx-xx-xx xx:xx:xx"}

-
立即领取
-
+ + {state.keyType == 1 ? ( +
立即领取
+ ) : ( +
+ )} + +

- - {data.batch_goods_name ? data.batch_goods_name : 'xxx'}兑换说明 - + - {data.batch_goods_name ? data.batch_goods_name : "xxx"}兑换说明 -

{createElement()} {data.instruction ? ( <> -
+

使用须知

- 1、在{data.channel === '1' ? '支付宝' : '微信'} + 1、在{data.channel === "1" ? "支付宝" : "微信"} APP内打开链接,点击【一键领取】完成领取 - {data.channel === '1' ? '支付宝' : '微信'}立减金 + {data.channel === "1" ? "支付宝" : "微信"}立减金
- 2、{data.channel === '1' ? '支付宝' : '微信'} + 2、{data.channel === "1" ? "支付宝" : "微信"} 里立减金一旦领取不可撤销、不可转让。注意不要将兑换券泄露给他人

-
+

使用规则

+ __html: data.instruction, + }} + >
) : ( { /> )}
+ + {state.keyType === 2 ? couponH5() : null}
- ) -} + ); +};