<template>
  <div class="prowler-info">
    <!-- 客户详情 -->
    <el-descriptions border title="客户详情">
      <el-descriptions-item label="客户状态">{{ state.userMessage.yhinfozt }}</el-descriptions-item>
      <el-descriptions-item label="产品名称">{{ state.userMessage.yhinfoproductname }}</el-descriptions-item>

      <el-descriptions-item label="关联企业ID">{{ state.userMessage.yhinfoqyid }}</el-descriptions-item>
      <el-descriptions-item label="关联用户ID">{{ state.userMessage.yhinfocustomerid }}</el-descriptions-item>
      <el-descriptions-item label="关联订单ID">{{ state.userMessage.yhinfoproductorderid }}</el-descriptions-item>
      <el-descriptions-item label="客户帐号">{{ state.userMessage.yhinfozh }}</el-descriptions-item>
      <el-descriptions-item label="关联路由器设备">{{ state.userMessage.yhinfoboxid }}</el-descriptions-item>
      <el-descriptions-item label="客户手机号">{{ state.userMessage.yhinfotel }}</el-descriptions-item>
      <el-descriptions-item label="客户密码">{{ state.userMessage.yhinfomm }}</el-descriptions-item>
      <el-descriptions-item label="客户创建时间">{{ state.userMessage.yhinfocreatedate }}</el-descriptions-item>
    </el-descriptions>

    <!-- 客户详情 -->
    <el-descriptions border title="客户订单详细" class="mt-10">
      <el-descriptions-item label="订单是否开通">
        <el-tag size="" v-if="state.userMessage.payordersfkt">已开通</el-tag>
        <el-tag size="" v-if="!state.userMessage.payordersfkt">未开通</el-tag>{{}}
      </el-descriptions-item>

      <el-descriptions-item label="订单id">{{ state.userMessage.payorderid }}</el-descriptions-item>
      <el-descriptions-item label="关联支付方式id">{{ state.userMessage.payorderpaysortid }}</el-descriptions-item>
      <el-descriptions-item label="关联客户id">{{ state.userMessage.payordercustomerid }}</el-descriptions-item>
      <el-descriptions-item label="客户openid">{{ state.userMessage.payorderopenid }}</el-descriptions-item>
      <el-descriptions-item label="关联企业id">{{ state.userMessage.payorderqyid }}</el-descriptions-item>

      <el-descriptions-item label="关联客户企业码">{{ state.userMessage.payorderqym }}</el-descriptions-item>
      <el-descriptions-item label="产品名称">{{ state.userMessage.payorderproductname }}</el-descriptions-item>
      <el-descriptions-item label="关联产品id">{{ state.userMessage.payorderproductid }}</el-descriptions-item>
      <el-descriptions-item label="产品时长类型">{{ state.userMessage.payorderproductlimittype }}</el-descriptions-item>
      <el-descriptions-item label="产品时长">{{ state.userMessage.payorderproductlimit }}</el-descriptions-item>
      <el-descriptions-item label="产品赠送时长">{{ state.userMessage.payorderproductzslimit }}</el-descriptions-item>
      <el-descriptions-item label="产品原始金额">{{ state.userMessage.payorderproductprice }}</el-descriptions-item>
      <el-descriptions-item label="产品实付金额">{{ state.userMessage.payorderproductprice1 }}</el-descriptions-item>
      <el-descriptions-item label="下行平均速度">{{ state.userMessage.payorderradiusxxpj }}</el-descriptions-item>
      <el-descriptions-item label="下行最大速度">{{ state.userMessage.payorderradiusxxmax }}</el-descriptions-item>
      <el-descriptions-item label="上行平均速度">{{ state.userMessage.payorderradiussxpj }}</el-descriptions-item>
      <el-descriptions-item label="上行最大速度">{{ state.userMessage.payorderradiussxmax }}</el-descriptions-item>
      <el-descriptions-item label="支付标题">{{ state.userMessage.payorderpaytitle }}</el-descriptions-item>
      <el-descriptions-item label="支付金额">{{ state.userMessage.payorderprice }}</el-descriptions-item>
      <el-descriptions-item label="支付账号">{{ state.userMessage.payorderzfzh }}</el-descriptions-item>
      <el-descriptions-item label="支付状态">{{ state.userMessage.payorderstatus }}</el-descriptions-item>
      <el-descriptions-item label="支付结果返回时间">{{ state.userMessage.payorderreturndate }}</el-descriptions-item>
      <el-descriptions-item label="支付流水号">{{ state.userMessage.payorderlsh }}</el-descriptions-item>
      <el-descriptions-item label="支付时间">{{ state.userMessage.payorderfkdate }}</el-descriptions-item>
      <!-- <el-descriptions-item label="订单是否开通">{{ state.userMessage.payordersfkt }}</el-descriptions-item> -->
      <el-descriptions-item label="支付创建时间">{{ state.userMessage.payordercreatedate }}</el-descriptions-item>
      <!-- <el-descriptions-item label="审核人">{{ state.userMessage.payordershuser }}</el-descriptions-item>
      <el-descriptions-item label="审核状态">{{ state.userMessage.payordershzt }}</el-descriptions-item>
      <el-descriptions-item label="审核描述">{{ state.userMessage.payordershms }}</el-descriptions-item> -->
    </el-descriptions>
  </div>
</template>

<script setup name="Account">
import _ from 'lodash'
import allStoreApi from '@store/modules/allStoreApi'
import useSystemManageStore from '@store/modules/systemManage'
import usePagination from '@/hooks/usePagination'
import useFitColumn from '@/hooks/useFitColumn'
const filePath = import.meta.env.VITE_Hw_File_Path

const {proxy} = getCurrentInstance()
const systemManageStore = useSystemManageStore()
const {paginaionConfig, handleSizeChange, handleCurrentChange} = usePagination(handleQuery)
const {fitWidth} = useFitColumn()
// 接口封装文件
const alleApi = allStoreApi()

const state = reactive({
  tableLoading: false,
  tableData: [],
  queryParams: {
    'customername.value': ''
  },
  sfzfiles: {},
  userMessage: {}
})

function handleQuery(config) {
  if (config?.initPageIndex) paginaionConfig.query.pageindex = 1
  getList(Object.assign(_.cloneDeep(paginaionConfig.query), state.queryParams))
}

/** 查询菜单列表 */
const getList = async (query) => {
  state.tableLoading = true
  const {Total, Data} = await alleApi.list(query)
  paginaionConfig.total = Total
  state.tableData = Data
  state.tableLoading = false
}

// 查看详情
const handleDictInfo = async (query) => {
  let params = {}
  params['yhinfoid.value'] = query.yhinfoid
  params.pagevalue = 332
  // 客户信息
  let values = await alleApi.view(params)
  state.userMessage = {...values}
}

/** 删除 */
const handleDictDel = async (query) => {
  try {
    let params = JSON.parse(JSON.stringify(query))
    params['productid.value'] = state.editView.productid
    params['productid'] = state.editView.productid
    await proxy.$modal.confirm('请问确认删除吗？')
    await alleApi.del(params)
    proxy.$modal.msgSuccess('删除成功！')
    handleQuery()
  } catch (error) {}
}

onMounted((data) => {
  const route = useRoute()
  // 获取路由的get参数
  const getParams = route.query
  console.log(getParams, 'data')

  // 详情
  handleDictInfo(getParams)
})
</script>

<style scoped lang="scss">
.prowler-info {
  padding: 20px;
}
</style>
