Coupon.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import React from "react";
  2. import { StyleSheet, View } from "react-native";
  3. import { Card, Text } from "@ui-kitten/components";
  4. import { SwipeAction } from "@ant-design/react-native";
  5. const styles = StyleSheet.create({
  6. main: {
  7. flexDirection: "row",
  8. alignItems: "center",
  9. backgroundColor: "transparent",
  10. },
  11. left: {
  12. width: 80,
  13. flexShrink: 0,
  14. alignItems: "center",
  15. },
  16. center: {
  17. flex: 1,
  18. marginLeft: 14,
  19. backgroundColor: "transparent",
  20. },
  21. text2: {
  22. paddingTop: 6,
  23. },
  24. code: {
  25. alignSelf: "flex-start",
  26. },
  27. icon: {
  28. width: 20,
  29. position: "absolute",
  30. right: 0,
  31. top: "50%",
  32. marginTop: -10,
  33. },
  34. });
  35. export default function Coupon(props) {
  36. const { info, delEvent, onPress } = props;
  37. const { amount, fullAmount, name, endDate, startDate } = info || {};
  38. const right = [
  39. {
  40. text: "删除",
  41. onPress: delEvent,
  42. style: { backgroundColor: "red", color: "white" },
  43. },
  44. ];
  45. return (
  46. <SwipeAction
  47. autoClose
  48. style={{ backgroundColor: "transparent" }}
  49. right={right}
  50. >
  51. <Card appearance="walletCard" onPress={onPress}>
  52. <View style={styles.main}>
  53. <View style={styles.left}>
  54. <Text category="h6" status="danger">
  55. <Text category="h1" status="danger">
  56. ¥
  57. </Text>
  58. {amount}
  59. </Text>
  60. <Text category="h1" status="info">
  61. {fullAmount ? `满 ${fullAmount} 元可用` : "无金额门槛"}
  62. </Text>
  63. </View>
  64. <View style={styles.center}>
  65. <Text category="h6">{name}</Text>
  66. <Text category="h1" status="info" style={styles.text2}>
  67. {startDate}
  68. {endDate}
  69. </Text>
  70. </View>
  71. </View>
  72. </Card>
  73. </SwipeAction>
  74. );
  75. }