"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _vtxBaseModal = _interopRequireDefault(require("../../../vtx-base-modal"));
var _react = _interopRequireWildcard(require("react"));
var _index = require("../../index");
var _vmCard = _interopRequireDefault(require("../../../vm-card"));
var _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _api = require("../../api");
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _utils = require("@vtx/utils");
require("./index.less");
var _antd = require("antd");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
var Content = function Content(_ref) {
  var id = _ref.id;
  var data = _api.BasicService.contactInfo({
    id: id
  });
  var scheduleList = data.scheduleJson ? JSON.parse(data.scheduleJson) : [];
  var infoData = [{
    label: '合同编号',
    value: data.contractNumber,
    key: 'contractNumber'
  }, {
    label: '垃圾类型',
    value: data.garbageTypeStr,
    key: 'garbageTypeStr'
  }, {
    label: '甲方名称',
    value: data.firstParty,
    key: 'firstParty'
  }, {
    label: '乙方名称',
    value: data.secondParty,
    key: 'secondParty'
  }, {
    label: '运输地址',
    value: data.transportAddress,
    key: 'transportAddress',
    isAddress: true
  }].concat(_toConsumableArray(data.garbageType === 'ccfqw' ? [{
    label: '运输频次',
    value: data.frequencyStr,
    key: 'frequencyStr'
  }].concat(_toConsumableArray(scheduleList.length > 0 ? [{
    label: '运输时间',
    render: function render() {
      return /*#__PURE__*/_react["default"].createElement("div", null, scheduleList.map(function (item, i) {
        return /*#__PURE__*/_react["default"].createElement("div", {
          key: i,
          style: {
            marginTop: i === 0 ? 0 : 10
          }
        }, item.startTime || '-', /*#__PURE__*/_react["default"].createElement("span", {
          style: {
            padding: '0 10px'
          }
        }, "\u81F3"), item.endTime || '-');
      }));
    },
    key: 'scheduleList'
  }] : [])) : []), [{
    label: '运输量',
    value: data.garbageType === 'fqyz' ? "".concat(data.trafficWeek || '-', "\u516C\u65A4/\u5468\uFF0C").concat(data.trafficMonth || '-') : "".concat(data.trafficDay || '-', "\u516C\u65A4/\u5929"),
    key: 'trafficDay'
  }], _toConsumableArray(data.garbageType === 'fqyz' ? [{
    label: '收运频次',
    value: data.frequencyStr,
    key: 'frequencyStr'
  }].concat(_toConsumableArray(scheduleList.length > 0 ? [{
    label: '收运时间',
    render: function render() {
      return /*#__PURE__*/_react["default"].createElement("div", null, scheduleList.map(function (item, i) {
        return /*#__PURE__*/_react["default"].createElement("div", {
          key: i,
          style: {
            marginTop: i === 0 ? 0 : 10
          }
        }, item.startTime || '-', /*#__PURE__*/_react["default"].createElement("span", {
          style: {
            padding: '0 10px'
          }
        }, "\u81F3"), item.endTime || '-');
      }));
    },
    key: 'scheduleList'
  }] : []), [{
    label: '费用支付方式',
    value: data.paymentMethod,
    key: 'paymentMethod'
  }]) : [{
    label: '签约金额',
    value: "".concat(data.contractAmount || '-', "\u5143/\u5E74"),
    key: 'contractAmount'
  }]), [{
    label: '甲方未按规定分类违约金',
    value: "".concat(data.classifyPenalty || '-', "\u5143/\u5428"),
    key: 'classifyPenalty'
  }], _toConsumableArray(data.garbageType === 'fqyz' ? [{
    label: '协议违反解约期限',
    value: "".concat(data.terminationPeriod || '-', "\u5929"),
    key: 'terminationPeriod'
  }] : [{
    label: '甲方转交其他单位个人收运违约金',
    value: "".concat(data.transferOtherPenalty || '-', "\u5143/\u6B21"),
    key: 'terminationPeriod'
  }]));
  var columns = [{
    title: '容量',
    dataIndex: 'capacity',
    align: 'center'
  }, {
    title: '桶数',
    dataIndex: 'barrelage',
    align: 'center'
  }];
  var token = (0, _utils.getVtxToken)('token');
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      padding: 10
    }
  }, /*#__PURE__*/_react["default"].createElement(_vmCard["default"], {
    title: "\u5408\u540C\u4FE1\u606F",
    rightContent: /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
      onClick: function onClick() {
        if (data.contractId) {
          (0, _utils.downloadFile)("/cloudFile/common/downloadFile?id=".concat(data.contractId, "&token=").concat(token), {}, 'form');
        } else {
          _antd.message.warning('还没有合同生成');
        }
      }
    }, "\u4E0B\u8F7D\u5408\u540C(word)"), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
      type: "primary",
      onClick: function onClick() {
        if (data.contractPdfId) {
          (0, _utils.downloadFile)("/cloudFile/common/downloadFile?id=".concat(data.contractPdfId, "&token=").concat(token), {}, 'form');
        } else {
          _antd.message.warning('还没有合同生成');
        }
      }
    }, "\u4E0B\u8F7D\u5408\u540C(pdf)"))
  }, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: infoData,
    horizontal: true,
    width: "50%",
    ellipsis: true
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "vtx-res-contact-detail"
  }, "\u5783\u573E\u6876\u914D\u7F6E"), /*#__PURE__*/_react["default"].createElement(_vmTable["default"], {
    columns: columns,
    dataSource: [{
      capacity: '120L',
      barrelage: data.bucketNumberOne || ''
    }, {
      capacity: '240L',
      barrelage: data.bucketNumberTwo || ''
    }],
    height: 220,
    pagination: false
  }), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: [{
      label: '押金',
      value: "".concat(data.deposit || '-', "\u5143"),
      key: 'deposit'
    }].concat(_toConsumableArray(data.garbageType === 'ccfqw' ? [{
      label: '小桶',
      value: "".concat(data.keg || '-', "\u4E2A"),
      key: 'keg'
    }] : [])),
    horizontal: true,
    width: "50%",
    ellipsis: true
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "vtx-res-contact-detail"
  }, "\u7532\u65B9\u4FE1\u606F"), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: [{
      label: '签字',
      value: data.firstSign,
      key: 'firstSign',
      render: data.firstSign ? function () {
        return /*#__PURE__*/_react["default"].createElement(_antd.Image, {
          src: "/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id=".concat(data === null || data === void 0 ? void 0 : data.firstSign, "&token=").concat(token),
          preview: {
            destroyOnClose: true,
            src: "/cloudFile/common/downloadFile?id=".concat(data === null || data === void 0 ? void 0 : data.firstSign, "&token=").concat(token),
            maskClassName: 'maskClass'
          },
          alt: "\u7B7E\u5B57",
          style: {
            width: 100,
            height: 100
          }
        });
      } : undefined
    }, {
      label: '签章',
      value: data.firstSignature,
      key: 'firstSignature',
      componentType: 'image'
    }, {
      label: '法定代表人',
      value: data.firstRepresentative,
      key: 'firstRepresentative'
    }, {
      label: '委托代理人',
      value: data.firstProxy,
      key: 'firstProxy'
    }, {
      label: '通讯地址',
      value: data.firstMailingAddress,
      key: 'firstMailingAddress',
      isAddress: true
    }, {
      label: '联系电话',
      value: data.firstPhone,
      key: 'firstPhone',
      isAddress: true
    }],
    horizontal: true,
    width: "50%",
    ellipsis: true
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "vtx-res-contact-detail"
  }, "\u4E59\u65B9\u4FE1\u606F"), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: [{
      label: '签字',
      value: data.secondSign,
      key: 'secondSign',
      render: data.secondSign ? function () {
        return /*#__PURE__*/_react["default"].createElement(_antd.Image, {
          src: "/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id=".concat(data === null || data === void 0 ? void 0 : data.secondSign, "&token=").concat(token),
          preview: {
            destroyOnClose: true,
            src: "/cloudFile/common/downloadFile?id=".concat(data === null || data === void 0 ? void 0 : data.secondSign, "&token=").concat(token),
            maskClassName: 'maskClass'
          },
          alt: "\u7B7E\u5B57",
          style: {
            width: 100,
            height: 100
          }
        });
      } : undefined
    }, {
      label: '签章',
      value: data.collectSignature,
      key: 'collectSignature',
      componentType: 'image'
    }, {
      label: '法定代表人',
      value: data.secondRepresentative,
      key: 'secondRepresentative'
    }, {
      label: '委托代理人',
      value: data.secondProxy,
      key: 'secondProxy'
    }, {
      label: '通讯地址',
      value: data.secondMailingAddress,
      key: 'secondMailingAddress',
      isAddress: true
    }, {
      label: '联系电话',
      value: data.secondPhone,
      key: 'secondPhone',
      isAddress: true
    }],
    horizontal: true,
    width: "50%",
    ellipsis: true
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "vtx-res-contact-detail"
  }, "\u65F6\u6548\u4FE1\u606F"), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: [{
      label: '合同期限',
      value: data.contractPeriodStr,
      key: 'contractPeriodStr'
    }, {
      label: '生效日期',
      value: data.effectiveTime,
      key: 'effectiveTime'
    }, {
      label: '终止日期',
      value: data.terminationTime,
      key: 'terminationTime'
    }, {
      label: '签约日期',
      value: data.signTime,
      key: 'signTime'
    }, {
      label: '纸质合同附件',
      value: data.paperContractAttachments,
      key: 'paperContractAttachments',
      componentType: 'ATTACHS'
    }],
    horizontal: true,
    width: "50%",
    ellipsis: true
  }))));
};
var ContactDetail = function ContactDetail(_ref2) {
  var onCancel = _ref2.onCancel,
    id = _ref2.id;
  var _useContext = (0, _react.useContext)(_index.RestaurantContext),
    theme = _useContext.theme;
  return /*#__PURE__*/_react["default"].createElement(_vtxBaseModal["default"], {
    title: '餐厨废弃物产生单位签约管理 > ',
    subTitle: '查看',
    tabs: [{
      key: 'info'
    }],
    contents: {
      info: /*#__PURE__*/_react["default"].createElement(Content, {
        id: id
      })
    },
    visible: true,
    onCancel: onCancel,
    theme: theme
  });
};
var _default = exports["default"] = ContactDetail;
//# sourceMappingURL=ContactDetail.js.map
