import { Button, Text, View } from "@tarojs/components";
import Taro from "@tarojs/taro";

const SUPPORT_PHONE = "18786174929";
const CONTACT_WAY_CONFIG_ID = "5f8a2d2756e2c69776c186ef28fc48ee";
const CONTACT_WAY_STYLE = 1;

export default function ContactPage() {
  const callSupport = () => {
    void Taro.makePhoneCall({ phoneNumber: SUPPORT_PHONE });
  };

  return (
    <View className="page contact-page">
      <View className="contact-hero">
        <Text className="eyebrow">联系万趣定制管家</Text>
        <Text className="contact-title">联系万趣定制管家</Text>
      </View>
      {CONTACT_WAY_CONFIG_ID ? (
        <View className="contact-plugin-card">
          <Text className="contact-card-title">添加企微服务管家</Text>
          <Text className="contact-card-note">点击按钮后将进入企微添加流程</Text>
          <cell plugid={CONTACT_WAY_CONFIG_ID} styleType={CONTACT_WAY_STYLE} />
        </View>
      ) : (
        <View className="contact-plugin-card contact-fallback">
          <Text className="contact-card-title">企微入口正在准备</Text>
          <Text className="contact-card-note">当前可以直接电话联系服务管家，我们会继续跟进你的出行需求。</Text>
          <Button className="phone-cta" onClick={callSupport}>拨打 {SUPPORT_PHONE}</Button>
        </View>
      )}
      <Button className="contact-back" onClick={() => void Taro.navigateBack()}>返回上一页</Button>
    </View>
  );
}
