template.tsx 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import { Card, Col, Row } from "antd";
  2. import jb from '../../../../public//jb.png';
  3. import vip from '../../../../public//vip.png';
  4. import top from '../../../../public//top-r1.png';
  5. import { createStyles } from "antd-style";
  6. export function Template(params: { data: any, enmuList: any }) {
  7. let { data, enmuList } = params
  8. let { firstRecharge, rechargeConfigList } = data
  9. const useStyles = createStyles((props) => {
  10. let { token } = props
  11. let navTheme = localStorage.getItem("navTheme")//2亮 3黑
  12. return {
  13. cardBox: {
  14. position: 'relative'
  15. },
  16. bgVip: {
  17. backgroundImage: "linear-gradient(180deg, #fff1dc 60%, #fffdfa 100%)",
  18. color: navTheme == "3" ? "#000" : "unset"
  19. },
  20. bg: {
  21. backgroundImage: 'linear-gradient(180deg, #ffeced 60%, #fffafa 100%)',
  22. color: navTheme == "3" ? "#000" : "unset"
  23. },
  24. topRight: {
  25. lineHeight: '20px',
  26. background: "#ff2441",
  27. position: 'absolute',
  28. top: 0,
  29. right: 0,
  30. fontSize: 12,
  31. borderRadius: "0px 8px 0 8px",
  32. },
  33. topRightVip: {
  34. background: "#ffd89d !important",
  35. },
  36. //
  37. topRightSpan1: { display: 'inline-block', background: `url(${top}) no-repeat`, minWidth: 40, height: 20, padding: "0 10px 0 6px", backgroundSize: "100% 100%", color: "#fff" },
  38. topRightSpan2: { color: "#fff", display: 'inline-block', padding: "0 5px" },
  39. del: { fontSize: 14, textDecoration: 'line-through', marginLeft: 7, color: token.colorTextTertiary, fontWeight: "500" }
  40. }
  41. });
  42. let { styles } = useStyles()
  43. return <Card bordered={false} >
  44. <Row gutter={[0, 15]}>
  45. {
  46. rechargeConfigList?.map((item: any, index: any) => {
  47. let {
  48. color,//背景色
  49. description,//整数购买文案
  50. extra,//右上角描述值
  51. gearType,//充值类型
  52. gift,//赠送
  53. obtain,//获得书币/vip每天价格
  54. price,//价格
  55. subscript,//右上角文案 首充|超值等
  56. vipDays,//vip天数
  57. } = item
  58. switch (gearType) {
  59. case 1://充值
  60. return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
  61. <Card className={`${styles.cardBox} ${color && styles.bg}`} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
  62. {/* 右上角 */}
  63. <div className={`${styles.topRight}`} style={subscript ? { borderRadius: "8px 8px 0 8px", } : {}} >
  64. {
  65. <>
  66. {subscript && <span className={styles.topRightSpan1}>{subscript}</span>}
  67. <span className={styles.topRightSpan2} style={subscript ? { transform: 'translateX(-4px)' } : {}}>多送{extra}元</span>
  68. </>
  69. }
  70. </div>
  71. <div style={{ display: 'flex', flexFlow: 'column' }}>
  72. <strong >
  73. <span style={{ fontSize: '20px', marginRight: 3 }} >¥</span>
  74. <span style={{ fontSize: 22, fontFamily: 'Yuewen Font' }}>{price}</span>
  75. </strong>
  76. <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>{obtain}书币 送{gift}书券</span>
  77. </div>
  78. {color && <img src={jb} style={{ position: 'absolute', right: 0, bottom: 0, width: 50 }} />}
  79. </Card>
  80. </Col>
  81. case 2://vip
  82. let vipEnum = enmuList?.VIP_DAYS?.values;
  83. let vipStr = vipEnum?.find((i: { value: any; }) => i.value === vipDays)?.description || ""
  84. return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
  85. <Card className={`${styles.cardBox} ${color && styles.bgVip}`} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
  86. {/* 右上角 */}
  87. <div className={`${styles.topRight} ${styles.topRightVip}`} style={subscript ? { borderRadius: "8px 8px 0 8px", } : {}}>
  88. {
  89. <>
  90. {subscript && <span className={styles.topRightSpan1}>{subscript}</span>}
  91. <span className={styles.topRightSpan2}>{vipStr}</span>
  92. </>
  93. }
  94. </div>
  95. <div style={{ display: 'flex', flexFlow: 'column' }}>
  96. <strong >
  97. <span style={{ fontSize: '20px', marginRight: 3 }} >¥</span>
  98. <span style={{ fontSize: 22, fontFamily: 'Yuewen Font' }}>{price}</span>
  99. </strong>
  100. <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>¥{obtain}元/天</span>
  101. </div>
  102. {color && <img src={vip} style={{ position: 'absolute', right: 0, bottom: 0, width: 30 }} />}
  103. </Card>
  104. </Col>
  105. case 3://整本
  106. return <Col key={index} span={11} offset={index % 2 === 0 ? 0 : 1} >
  107. <Card className={`${styles.cardBox} `} styles={{ body: { maxHeight: 90, padding: '20px 15px' } }}>
  108. {/* 右上角 */}
  109. <div className={styles.topRight}>
  110. {
  111. subscript ? <> <span>{item.description}</span></> : <>
  112. <span className={styles.topRightSpan1}>{subscript}</span>
  113. <span className={styles.topRightSpan2}>{item.description}</span>
  114. </>
  115. }
  116. </div>
  117. <div style={{ display: 'flex', flexFlow: 'column' }}>
  118. <strong >
  119. <span style={{ fontSize: '20px', marginRight: 3 }} >¥</span>
  120. <span style={{ fontSize: 22, fontFamily: 'Yuewen Font' }}>{price}</span>
  121. {/* {isVip && item.gift && <span className={styles.del}>¥{item.gift}</span>} */}
  122. </strong>
  123. {/* {isVip ?
  124. <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>{isOne ? "仅" : "¥"}{item.extra}元/天</span>
  125. :
  126. <span style={{ fontSize: 12, marginTop: 2, color: "#777", display: 'block' }}>{item.gift}书币 送{item.extra}书券</span>} */}
  127. </div>
  128. {/* {isOne && <img src={isVip ? vip : jb} style={{ position: 'absolute', right: 0, bottom: 0, width: isVip ? 30 : 50 }} />} */}
  129. </Card>
  130. </Col>
  131. default:
  132. break;
  133. }
  134. })
  135. }
  136. </Row>
  137. </Card >
  138. }