/*
  @description:服务费-字典信息
  @Modifier:sunxinman
  @routerPath:
  @date:2020-4-6 14:02
*/
import { queryTenderProjectInitInfo } from '@/api/bidding/biddingProject' // 获取信息 字典信息
/* 公用方法*/
import { filterDictText, moneyFormat } from '@/assets/js/utils'// 常用方法
export const ServiceGroupMixin = {
  data() {
    return {
      paymentPartyLabel: '中标人', // 招标人/中标人
      // 服务费收取对象
      collectionObjList: [
        { typename: '中标人', typecode: '00' },
        { typename: '招标人', typecode: '01' }
      ],
      // 服务费收取方式
      collectionWayList: [
        { typename: '差额定律累进制', typecode: '00' },
        { typename: '固定金额', typecode: '01' },
        { typename: '固定比例', typecode: '02' }
      ],
      serviceInvoiceRecordStatusList: [
        { typename: '开票申请中', typecode: '00' },
        { typename: '开票申请撤回', typecode: '01' },
        { typename: '开票申请审批驳回', typecode: '02' },
        { typename: '待开票', typecode: '03' },
        { typename: '开票中', typecode: '04' },
        { typename: '开票失败', typecode: '05' },
        { typename: '已开票', typecode: '06' },
        { typename: '退款审批中', typecode: '07' },
        { typename: '退款审批驳回', typecode: '08' },
        { typename: '待红冲', typecode: '09' },
        { typename: '红冲中', typecode: '10' },
        { typename: '红冲失败', typecode: '11' },
        { typename: '已红冲', typecode: '12' },
        { typename: '退款中', typecode: '13' },
        { typename: '退款失败', typecode: '14' },
        { typename: '退款成功', typecode: '15' },
        { typename: '记账失败', typecode: '16' },
        { typename: '记账成功', typecode: '17' }
      ], // 服务费开票审批记录状态
      invoiceLevelList: [
        { typename: '普通', typecode: '00' },
        { typename: '紧急', typecode: '01' }
      ], // 开票级别
      invoiceTypeList: [
        { typename: '普通发票', typecode: '00' },
        { typename: '增值税专用发票', typecode: '01' }
      ], // 发票类型
      cityTransferList: [
        { typename: '否', typecode: '00' },
        { typename: '是', typecode: '01' }
      ], // 是否同城转账
      interbankTransferList: [
        { typename: '否', typecode: '00' },
        { typename: '是', typecode: '01' }
      ], // 是否跨行转账
      invoiceStatusList: [
        { typename: '待开票', typecode: '01' },
        { typename: '开票中', typecode: '02' },
        { typename: '开票失败', typecode: '03' },
        { typename: '已开票', typecode: '04' }
      ], // 服务费收款开票-开票状态
      postStatusList: [
        { typename: '未邮寄', typecode: '00' },
        { typename: '已邮寄', typecode: '01' }
      ], // 服务费收款开票-邮寄状态
      refundStatusList: [
        { typename: '待红冲', typecode: '01' },
        { typename: '红冲中', typecode: '02' },
        { typename: '红冲失败', typecode: '03' },
        { typename: '已红冲', typecode: '04' },
        { typename: '退款中', typecode: '05' },
        { typename: '退款失败', typecode: '06' },
        { typename: '退款成功', typecode: '07' }
      ], // 服务费退款开票 退款状态
      debtStatusList: [
        { typename: '未收款', typecode: '00' },
        { typename: '待确认', typecode: '01' },
        { typename: '待销账', typecode: '02' },
        { typename: '已销账', typecode: '03' }
      ] // 服务费欠款管理 欠款状态
    }
  },
  methods: {
    moneyFormat,
    filterDictText,
    /* ===========================服务费信息===========================*/
    // 服务费信息(立项-字典信息)
    initWebTypeGroup() {
      queryTenderProjectInitInfo().then(res => {
        // 遍历key存储相应的数据
        for (const key in res.data) {
          /* 是否有数据*/
          if (res.data[key]) {
            this[key + 'List'].push(...res.data[key].typeList)
          }
        }
      })
    },
    // 表格字典值替换文本-招标代理服务费收取对象
    formatPaymentParty(row, column, cellValue) {
      return filterDictText(this.collectionObjList, cellValue)
    },
    // 表格字典值替换文本-招标代理服务费收取方式
    formatPaymentMethod(row, column, cellValue) {
      return filterDictText(this.collectionWayList, cellValue)
    },
    // 表格字典值替换文本-发票类型
    formatInvoiceType(row, column, cellValue) {
      return filterDictText(this.invoiceTypeList, cellValue)
    },
    // 表格字典值替换文本-开票状态/退款状态
    formatAuditStatus(row, column, cellValue) {
      return filterDictText(this.serviceInvoiceRecordStatusList, cellValue)
    },
    // 表格字典值替换文本-邮寄状态
    formatPostStatus(row, column, cellValue) {
      return filterDictText(this.postStatusList, cellValue)
    },
    // 表格字典值替换文本-欠款状态
    formatPayStatus(row, column, cellValue) {
      return filterDictText(this.debtStatusList, cellValue)
    }
  }
}
