import { viewGetFormList, divider } from "@/views/BMS/$common/model/formDetails/config.view.js"
import feeColumns from "./feeColumns"
import setMainColumns from '@/views/BMS/$common/tableConfig/shipbillTableConfig.js'
//查看运单单信息

export const shillpViewGetFormList = (self, expData = []) => {
  const list = viewGetFormList(self, expData);
  list.push(
    divider(self, '费用汇总信息'),
    {
      type: 'txt',
      label: '支出总价（含税）',
      name: 'payAmount',
      span: 10
    },
    {
      type: 'txt',
      label: '合同支出总价（含税）',
      name: 'contractPayAmount',
      span: 10,

    },
    {
      type: 'txt',
      label: '运费',
      name: '运费',
      span: 10
    },
    {
      type: 'txt',
      label: '提货费',
      name: 'pickUpFee',
      span: 10
    },
    {
      type: 'txt',
      label: '送货费',
      name: 'transportationPrice',
      span: 10
    },
    {
      type: 'txt',
      label: '送货疫情补贴',
      name: 'subsidies',
      span: 10
    },
    {
      span: 24,
      itemHeight: 'auto',
      wrapperCol: { span: 24 },
      customRender(v, form) {
        console.log(arguments)
        return self._c('p-card', {
          attrs: {
            title: '费用明细信息'
          }
        }, [
          self._c('t-table', {
            attrs: {
              scroll:{ x: true },
              vScrollX:{enabled:false},
              vScrollY:{enabled:true,rows:10},
              columns: feeColumns(self),
              dataSource: self.feeList,
              autoLoad: false,
              rowSelectType: false,
              pagination: false,
              dragle: true
            }
          })
        ])
      },
      //  scopedSlots: { customRender: 'feeTable' },
    }
  )
  return list
}


//查看派车单信息
export const loadingBillViewGetFormList = (self) => {
  let arr=[]

  if (self.subTitle == '支出') {
    arr = [ {
      name: "totalPayMileage",
      label: "支出公里数",
      type: "txt"
    },
    {
      name: "totalPayPcs",
      label: "支出总件数",
      type: "txt"
    },
    {
      name: "totalPayWeight",
      label: "支出总重量(kg)",
      type: "txt"
    },
    {
      name: "totalPayVolume",
      label: "支出体积(m³)",
      type: "txt"
    }
   ]
  } else {

   arr=[ {
      name: "totalMileage",
      label: "收入公里数",
      type: "txt"
    },
    {
      name: "totalPcs",
      label: "收入总件数",
      type: "txt"
    },
    {
      name: "totalWeight",
      label: "收入总重量(kg)",
      type: "txt"
    },
    {
      name: "totalVolume",
      label: "收入体积(m³)",
      type: "txt"
    }]
  }
  return [
    {
      name: "billNo",
      label: "派车单号",
      type: "txt"
    },
    {
      name: "statusName",
      label: "派车单状态",
      type: "txt"
    },
    {
      name: "cargoOwnerName",
      label: "货主",
      type: "txt"
    },
    {
      name: "settlementDepartment",
      label: "结算部门",
      type: "txt"
    },
    {
      name: "loadingDate",
      label: "调度日期",
      type: "txt"
    },
    {
      name: "loadingAuditDate",
      label: "调度审核日期",
      type: "txt"
    },
    {
      name: "groupName",
      label: "分组名称",
      type: "txt"
    },
    {
      name: "deliveryLines",
      label: "配送线路",
      type: "txt"
    },
    {
      name: "stationLines",
      label: "站点线路",
      type: "txt"
    },
    {
      name: "pickUpAreas",
      label: "提货区域",
      type: "txt"
    },
    {
      name: "deliveryAreas",
      label: "配送区域",
      type: "txt"
    },
    ...arr,
    {
      name: "remark",
      label: "备注",
      type: "txt"
    },
    {
      name: "carrierTypeName",
      label: "承运方类型",
      type: "txt"
    },
    {
      name: "carrierName",
      label: "承运方名称",
      type: "txt"
    },
    {
      name: "driverName",
      label: "司机",
      type: "txt"
    },
    {
      name: "driverPhoneNumber",
      label: "司机手机号",
      type: "txt"
    },
    {
      name: "deliverymanName",
      label: "送货员",
      type: "txt"
    },
    {
      name: "deliverymanPhoneNumber",
      label: "送货员手机号",
      type: "txt"
    },
    {
      name: "vehiclePlateNumber",
      label: "车辆",
      type: "txt"
    },
    {
      name: "vehicleTypeName",
      label: "车型",
      type: "txt"
    },
    {
      name: "vehicleAffiliationName",
      label: "隶属机构",
      type: "txt"
    },
    {
      name: "weightLoadingRate",
      label: "装载率",
      type: "txt"
    },
    {
      name: "vehicleTypeCategoryName",
      label: "车辆类别",
      type: "txt"
    },
    {
      name: "vehicleSpec",
      label: "车辆规格",
      type: "txt"
    },
    {
      span: 24,
      itemHeight: 'auto',
      wrapperCol: { span: 24 },
      customRender(v, form) {
        let card;
        const shillpTablte = self._c('t-table', {
          attrs: {
            scroll:{ x: true },
            vScrollX:{enabled:false},
            vScrollY:{enabled:true,rows:8},
            columns: setMainColumns(self).filter(item => item.dataIndex),
            dataSource: self.shipBillList,
            autoLoad: false,
            rowSelectType: false,
            pagination: false,
            dragle: true
          }
        })
        if (self.showFeedTable) {
          card = self._c('p-card', {
            on: {
              tabChange(key) {
                self.activeKey = key
              }
            },
            attrs: {
              activeTabKey: self.activeKey,
              tabList: [
                {
                  key: '1',
                  tab: '运单信息',

                },
                {
                  key: '2',
                  tab: '费用信息',
                }]
            },

          }, [
            self.activeKey == '1'? shillpTablte:self._c('t-table', {
              attrs: {
                scroll:{ x: true },
                vScrollX:{enabled:false},
                vScrollY:{enabled:true,rows:10},
                columns: feeColumns(self),
                dataSource: self.feeList,
                autoLoad: false,
                rowSelectType: false,
                pagination: false,
                dragle: true
              }
            }),
          ])
        } else {
          card = self._c('p-card', {
            attrs: {
              title: '运单信息'
            }
          }, [shillpTablte])
        }
        return card
      },
    }
  ]
}