import { onMounted, reactive } from 'vue'

export default function () {
  const totalSummary = reactive({   // 初始化, 不添加也可以通过后端请求添加进去
    TotalSales: 0,
    ACOS: 0,
    // 其他需要显示的合计数据
  })

  // 定义合计数据的对象, 键是字段名, 值是处理逻辑
  const summaryFormats = {
    TotalSales: value => `$${value}`, // 格式化为货币格式
    TotalOrderItems: (value) => `${value}`,
    TotalUnitOrdered: (value) => `${value}`,
    SAP: (value) => `${value}`,
    TotalAdSales: (value) => `${value}`,
    TotalAdSalesSameSKU: (value) => `${value}`,
    TotalAdPurchases: (value) => `${value}`,
    TotalAdPurchasesSameSKU: (value) => `${value}`,
    TotalAdUnitOrdered: (value) => `${value}`,
    TotalAdUnitOrderedSameSKU: (value) => `${value}`,
    Spend: (value) => `${value}`,
    ACOS: (value) => `${value}`,
    ROAS: (value) => `${value}`,
    TACOS: (value) => `${value}`,
    CR: (value) => `${value}`,
    CTR: (value) => `${value}`,
    CPC: (value) => `${value}`,
    CPO: (value) => `${value}`,
    CPA: (value) => `${value}`,
    Impression: (value) => `${value}`,
    Click: (value) => `${value}`,
    ProductCr: (value) => `${value}`,
    BuyBoxPercentage: (value) => `${value}`,
    Sessions: (value) => `${value}`,
    PageViews: (value) => `${value}`,
    // FBAQuantity: (value) => `${value}`,
    // FBMQuantity: (value) => `${value}`,
    gapTotalUnitOrdered: value => `${value}`,
    gapTotalSales: value => `$${value}`,
    gapTotalOrderItems: value => `${value}`,
    gapSessions: value => `${value}`,
    gapPageViews: value => `${value}`,
    gapBuyBoxPercentage: value => `${value}`,
    gapImpression: value => `${value}`,
    gapClick: value => `${value}`,
    gapSpend: value => `${value}`,
    gapTotalAdPurchases: value => `${value}`,
    gapTotalAdSales: value => `${value}`,
    gapTotalAdUnitOrdered: value => `${value}`,
    gapTotalAdSalesSameSKU: value => `${value}`,
    gapTotalAdPurchasesSameSKU: value => `${value}`,
    gapTotalAdUnitOrderedSameSKU: value => `${value}`,
    gapSAP: value => `${value}`,
    gapACOS: value => `${value}`,
    gapROAS: value => `${value}`,
    gapTACOS: value => `${value}`,
    gapCR: value => `${value}`,
    gapCTR: value => `${value}`,
    gapCPC: value => `$${value}`,
    gapCPO: value => `${value}`,
    gapCPA: value => `${value}`,
    gapProductCr: value => `${value}`,
    parentAsin: value => `${value}`,
    Asin: value => `${value}`,
    sku: value => `${value}`,
    status: value => `${value}`,
    launchDatetime: value => `${value}`,
  }

  return { totalSummary, summaryFormats }
}
