"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _components = require("@vtx/components");

var _vtxGasEnterpriseModal = _interopRequireDefault(require("../vtx-gas-enterprise-modal"));

var _antd = require("antd");

var _map = require("@vtx/map");

var _useMapInfo2 = _interopRequireDefault(require("../vm-hooks/useMapInfo"));

var _useRoleInfo2 = _interopRequireDefault(require("../vm-hooks/useRoleInfo"));

var _useSettings2 = _interopRequireDefault(require("../vm-hooks/useSettings"));

var _icons = require("@ant-design/icons");

var _ahooks = require("ahooks");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function desensitizeIDNumber(id) {
  return id.replace(/(?<=\d{3})\d{12}(?=\d{2})/, "************");
}

var UserFJMBaseContent = function UserFJMBaseContent(_ref) {
  var _info$location, _info$location$lngLat, _info$businessStatus, _info$supplyProtocolS, _info$fjUserType, _info$fjUserProperty;

  var info = _ref.info;

  var _useMapInfo = (0, _useMapInfo2["default"])(),
      mapInfo = _useMapInfo.mapInfo;

  var _useRoleInfo = (0, _useRoleInfo2["default"])(),
      roleCode = _useRoleInfo.roleCode;

  var _ref2 = (info === null || info === void 0 ? void 0 : (_info$location = info.location) === null || _info$location === void 0 ? void 0 : (_info$location$lngLat = _info$location.lngLats) === null || _info$location$lngLat === void 0 ? void 0 : _info$location$lngLat.split(',')) || [],
      _ref3 = _slicedToArray(_ref2, 2),
      lng = _ref3[0],
      lat = _ref3[1];

  var _useSetState = (0, _ahooks.useSetState)({
    legalPersonIdCard: info !== null && info !== void 0 && info.legalPersonIdCard ? desensitizeIDNumber(info === null || info === void 0 ? void 0 : info.legalPersonIdCard) : '',
    idCard: info !== null && info !== void 0 && info.idCard ? desensitizeIDNumber(info === null || info === void 0 ? void 0 : info.idCard) : ''
  }),
      _useSetState2 = _slicedToArray(_useSetState, 2),
      state = _useSetState2[0],
      setState = _useSetState2[1];

  var _useSettings = (0, _useSettings2["default"])(),
      theme = _useSettings.theme;

  return /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout, {
    cols: 3,
    mode: "view"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6CE8\u518C\u767B\u8BB0\u540D\u79F0"
  }, info.shopName || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u7528\u6237\u7F16\u53F7"
  }, info.userNo || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u7ECF\u8425\u72B6\u6001"
  }, ((_info$businessStatus = info.businessStatus) === null || _info$businessStatus === void 0 ? void 0 : _info$businessStatus.value) || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u4F9B\u6C14\u4F01\u4E1A"
  }, /*#__PURE__*/_react["default"].createElement(_vtxGasEnterpriseModal["default"], {
    id: info.supplyCompanyId,
    label: info.supplyCompanyName
  })), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u7B7E\u8BA2\u65F6\u95F4"
  }, info.supplyProtocolSignDate || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u884C\u653F\u533A\u5212"
  }, info.regionName || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6240\u5C5E\u5C0F\u533A"
  }, info.villageName || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u697C\u680B"
  }, info.buildNo || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u95E8\u724C\u53F7"
  }, info.houseNo || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8BE6\u7EC6\u5730\u5740"
  }, info.address || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u4F9B\u6C14\u4F01\u4E1A\u7C7B\u578B"
  }, info.supplyCompanyTypeValue ? info.supplyCompanyTypeValue : '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u534F\u8BAE\u6709\u6548\u671F"
  }, info.supplyProtocolExpireDate || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u534F\u8BAE\u72B6\u6001"
  }, ((_info$supplyProtocolS = info.supplyProtocolStatus) === null || _info$supplyProtocolS === void 0 ? void 0 : _info$supplyProtocolS.value) || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u4F9B\u6C14\u534F\u8BAE"
  }, info.supplyProtocolFileId ? JSON.parse(info.supplyProtocolFileId).map(function (item, i) {
    return /*#__PURE__*/_react["default"].createElement(_antd.Image, {
      width: 100,
      key: i,
      src: "/cloudFile/common/downloadFile?id=".concat(item.id)
    });
  }) : '--'), lng && lat && /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      width: '100%',
      height: 200
    }
  }, /*#__PURE__*/_react["default"].createElement(_map.VtxMap, {
    mapId: "userFJM",
    mapType: mapInfo.mapType,
    mapCenter: [lng, lat],
    mapZoomLevel: 15,
    mapPoints: [{
      id: '1',
      longitude: lng,
      latitude: lat
    }],
    mapStyle: theme === 'dark' ? theme : ''
  })), /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      width: '100%',
      marginTop: '20px',
      padding: '20px'
    }
  }, /*#__PURE__*/_react["default"].createElement(_antd.Descriptions, {
    bordered: true,
    column: 2
  }, /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u975E\u5C45\u7528\u6237\u7C7B\u578B"
  }, ' ', ((_info$fjUserType = info.fjUserType) === null || _info$fjUserType === void 0 ? void 0 : _info$fjUserType.value) || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u975E\u5C45\u7528\u6237\u6027\u8D28"
  }, ((_info$fjUserProperty = info.fjUserProperty) === null || _info$fjUserProperty === void 0 ? void 0 : _info$fjUserProperty.value) || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u975E\u5C45\u7528\u6237\u5355\u4F4D\u7535\u8BDD"
  }, info.fjCompanyPhone || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u6CE8\u518C\u767B\u8BB0\u5730\u5740"
  }, info.registerAddress || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u7EDF\u4E00\u793E\u4F1A\u4FE1\u7528\u4EE3\u7801"
  }, info.socialCreditCode || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u5DE5\u5546\u8425\u4E1A\u6267\u7167"
  }, info.licenseFileId ? JSON.parse(info.licenseFileId).map(function (item, i) {
    return /*#__PURE__*/_react["default"].createElement(_antd.Image, {
      width: 100,
      key: i,
      src: "/cloudFile/common/downloadFile?id=".concat(item.id)
    });
  }) : '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u6CD5\u4EBA\u59D3\u540D\uFF08\u8EAB\u4EFD\u8BC1\u53F7\uFF09"
  }, info.legalPersonName || '--', state.legalPersonIdCard ? /*#__PURE__*/_react["default"].createElement("span", null, "(", state.legalPersonIdCard, ")", roleCode.includes('sfzhmck') && (state.legalPersonIdCard.indexOf('*') > -1 ? /*#__PURE__*/_react["default"].createElement(_icons.EyeTwoTone, {
    style: {
      marginLeft: 5
    },
    onClick: function onClick() {
      return setState({
        legalPersonIdCard: info === null || info === void 0 ? void 0 : info.legalPersonIdCard
      });
    }
  }) : /*#__PURE__*/_react["default"].createElement(_icons.EyeInvisibleTwoTone, {
    style: {
      marginLeft: 5
    },
    onClick: function onClick() {
      return setState({
        legalPersonIdCard: info !== null && info !== void 0 && info.legalPersonIdCard ? desensitizeIDNumber(info === null || info === void 0 ? void 0 : info.legalPersonIdCard) : ''
      });
    }
  }))) : '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u6CD5\u4EBA\u8054\u7CFB\u65B9\u5F0F"
  }, info.legalPersonPhone || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u7ECF\u8425\u8005\u59D3\u540D\uFF08\u8EAB\u4EFD\u8BC1\u53F7\uFF09"
  }, info.businessmanName || '--', state.idCard ? /*#__PURE__*/_react["default"].createElement("span", null, "(", state.idCard, ")", roleCode.includes('sfzhmck') && (state.idCard.indexOf('*') > -1 ? /*#__PURE__*/_react["default"].createElement(_icons.EyeTwoTone, {
    style: {
      marginLeft: 5
    },
    onClick: function onClick() {
      return setState({
        idCard: info === null || info === void 0 ? void 0 : info.idCard
      });
    }
  }) : /*#__PURE__*/_react["default"].createElement(_icons.EyeInvisibleTwoTone, {
    style: {
      marginLeft: 5
    },
    onClick: function onClick() {
      return setState({
        idCard: info !== null && info !== void 0 && info.idCard ? desensitizeIDNumber(info === null || info === void 0 ? void 0 : info.idCard) : ''
      });
    }
  }))) : '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u7ECF\u8425\u8005\u8054\u7CFB\u65B9\u5F0F"
  }, info.phone || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u6237\u53F7"
  }, info.accountNo || '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u7167\u7247"
  }, info.pictureFileId ? JSON.parse(info.pictureFileId).map(function (item, i) {
    return /*#__PURE__*/_react["default"].createElement(_antd.Image, {
      width: 100,
      key: i,
      src: "/cloudFile/common/downloadFile?id=".concat(item.id)
    });
  }) : '--'), /*#__PURE__*/_react["default"].createElement(_antd.Descriptions.Item, {
    label: "\u5907\u6CE8"
  }, info.remark || '--'))));
};

UserFJMBaseContent.propTypes = {
  info: _propTypes["default"].object
};
var _default = UserFJMBaseContent;
exports["default"] = _default;
//# sourceMappingURL=UserFJMBaseContent.js.map
