import { View } from "@tarojs/components";

export default function TotalAmount(props: { module: any }) {
  const { module } = props;
  const { config } = module;

  return (
    <View
      key={module.id}
      className={"preview grid w-full grid-cols-8 gap-0 text-base"}
    >
      {config.showTotalAmount && (
        <>
          <View className="col-span-1 flex items-end justify-center">
            {config.sumTitle || "合计金额"}:
          </View>
          <View className="col-span-2 flex items-end justify-center border-b border-black">
            {config.amount}
          </View>
          <View className="col-span-1 flex items-end justify-center border-b border-black">
            元
          </View>
        </>
      )}
      {config.showFarmer && (
        <>
          <View className="col-span-1 flex items-end justify-center">
            瓜农:
          </View>
          <View className="col-span-3 flex items-end justify-center border-b border-black">
            {config.farmer}
          </View>
        </>
      )}
    </View>
  );
}
