<template>
    <view class="container" style="paddingBottom:1rpx;">
      <u-navbar
			leftIconSize="40rpx"
			leftIconColor="#333333"
			title="信用卡详情"
		>
		</u-navbar>
      <view class="section">
        <u-cell-group>
        <u-cell title="POS机名称:" titleStyle="font-weight:bolder" :value="detailInfo.name"></u-cell>
        <u-cell title="支付公司:" titleStyle="font-weight:bolder" :value="detailInfo.payCompany"></u-cell>
        <u-cell title="类型:" titleStyle="font-weight:bolder" :value="detailInfo.type"></u-cell>
        <u-cell title="商户名称:" titleStyle="font-weight:bolder" center :value="detailInfo.merchantName"> </u-cell>
        <u-cell title="刷卡费率:" titleStyle="font-weight:bolder" :value="detailInfo.rate"></u-cell>
        <u-cell title="费率+:" titleStyle="font-weight:bolder" :value="detailInfo.ratePlus+''"></u-cell>
        <u-cell title="结算卡:" titleStyle="font-weight:bolder" :value="detailInfo.bankNameCode"></u-cell>
        <u-cell title="商户类型:" titleStyle="font-weight:bolder" :value="detailInfo.merchantType"></u-cell>
        <u-cell title="商户码:" titleStyle="font-weight:bolder" :value="detailInfo.merchantCode"></u-cell>
        <u-cell title="厂商:" titleStyle="font-weight:bolder" :value="detailInfo.manufacture"></u-cell>
        <u-cell title="编号:" titleStyle="font-weight:bolder" :value="detailInfo.code"></u-cell>
        <u-cell title="启用日期:" titleStyle="font-weight:bolder" :value="detailInfo.activationDate"></u-cell>
        <u-cell title="备注:" titleStyle="font-weight:bolder" center :value="detailInfo.remark"> </u-cell>
      </u-cell-group>
      </view>
      <u-toast ref="uToast"></u-toast>
    </view>
  </template>
  
<script setup>
import {  getPosmachine } from '@/api/invest/posmachine'
import { getDicts } from '@/api/system/dict/data.js'
import {onLoad} from "@dcloudio/uni-app";
import {reactive ,toRefs,ref,computed }from "vue";
const id = ref('')
const data = reactive({
  detailInfo: {} 
})
const {detailInfo} = toRefs(data)
onLoad((option) => {
    id.value = option.id
    getInfo()
  })
  function getInfo() {
    getPosmachine(id.value).then(res => {
          detailInfo.value = res.data
                     // 类型
            getDicts('pos_type').then(result => {
         detailInfo.value.type=dictStr(detailInfo.value.type, result.data)
      })
                           // 类型
            getDicts('merchant_type').then(result => {
         detailInfo.value.merchantType=dictStr(detailInfo.value.merchantType, result.data)
      })
        })
  }
  function dictStr(val, arr) {
      let str = ''
      arr.map(item => {
        if (item.dictValue === val) {
          str = item.dictLabel
        }
      })
      return str
    }
  </script>
  
  <style lang="scss" scoped>
  .section {
    margin: 24rpx;
    padding: 16rpx 24rpx;
    background-color: #fff;
    border-radius: 8rpx;
  
    .section-title {
      width: 280rpx;
      color: #333333;
      line-height: 44rpx;
      font-size: 30rpx;
      border-left: 6rpx solid #2681FF;
      padding-left: 26rpx;
    }
  
    .content {
      width: 647rpx;
      font-size: 28rpx;
      color: #333333;
      line-height: 40rpx;
      text-align: left;
    }
  
    .img-con {
      display: flex;
      flex-wrap: wrap;
      gap: 20rpx
    }
    .form-view {
      padding: 20rpx 0rpx 0 10rpx;
  
      .form-btn {
        padding-top: 20rpx;
      }
    }
  }
  </style>