import { h } from "vue" import { createTooltip } from "/@/utils/tootip" import { ElTable, ElTableColumn, ElTag } from "element-plus" import { cg_order_type_options, statusList } from "/@/utils/status" import { basicStatusOptions } from "/@/views/invoiceInOut/productManager/config/columns" export const goodColumns = [ { field: 'id', label: '商品ID', span: 6 }, { span: 6, label: '状态', render(_, { status }) { return h(ElTag, { size: 'small', type: statusList.find(item => item.value == status)?.type || 'warning' }, { default: () => statusList.find(item => item.value == status)?.label || '--' }) } }, { span: 6, field: 'apply_name', label: '创建人' }, { span: 6, field: 'create_time', label: '创建时间' }, { span: 12, field: 'seller_name', label: '销售方公司', render(_, { seller_code, seller_name }) { return createTooltip(seller_name, '销售方公司编号:' + seller_code, 300) } }, { span: 12, field: 'buyer_name', label: '购买方公司', render(_, { buyer_code, buyer_name }) { return createTooltip(buyer_name, '购买方公司编号:' + buyer_code, 300) } }, { span: 6, label: '商品来源', render(_, { good_source }) { return good_source == '1' ? '采销商品' : '非采销商品' } }, { span: 6, label: '组合类型', render(_, { is_combind }) { return is_combind == '0' ? '非组合商品' : '组合商品' } }, { span: 6, label: '商品类型', render(_, { good_type }) { return h(ElTag, { size: 'small' }, { default: () => cg_order_type_options.find(item => item.value == good_type)?.label || '--' }) } }, { span: 6, label: '进项成本状态', render(_, { basic_status }) { return h(ElTag, { size: 'small' }, { default: () => basicStatusOptions.find(item => item.value == basic_status)?.label || '--' }) } }, { span: 12, field: 'inv_good_name', label: '发票商品名称' }, { span: 12, field: 'goodName', label: '订单商品名称' }, { field: 'skuCode', label: '商品编号', span: 6 }, { span: 6, field: 'unit', label: '单位' }, { span: 6, field: 'spec', label: '规格' }, { span: 6, // field: 'unit_weight', label: '重量', render(_, { unit_weight }) { return unit_weight + 'g' } }, { span: 6, label: '发票类型', render(_, { inv_type }) { return inv_type.includes('special') ? '专票' : '普票' } }, { span: 6, field: 'subunit_price', label: '税前单价' }, { span: 6, field: 'unit_price', label: '税后单价' }, { span: 6, field: 'good_code', label: '商品代码' }, { field: 'cat_name', label: '进项类目', span: 12, render(_, { cat_code, cat_name, short_name }) { return `${cat_code}-${cat_name}-${short_name}` } }, { label: '进项税率', span: 6, render(_, { cat_tax }) { return cat_tax + '%' } }, { span: 6, field: 'spectral', label: '分光' }, ] export const goodHasChildColumns = [ { span: 12, field: 'seller_name', label: '销售方公司' }, { span: 12, field: 'buyer_name', label: '购买方公司' }, { span: 12, field: 'goodName', label: '订单商品名称' }, { span: 12, field: 'inv_good_name', label: '发票商品名称' }, { span: 6, label: '商品类型', render(_, { good_type }) { return h(ElTag, { size: 'small' }, { default: () => cg_order_type_options.find(item => item.value == good_type)?.label || '--' }) } }, { span: 6, field: 'good_code', label: '商品代码' }, { span: 6, field: 'spec', label: '规格' }, { span: 6, field: 'unit', label: '单位' }, { span: 6, field: 'unit_price', label: '税前单价' }, { span: 6, field: 'subunit_price', label: '税后单价' }, { span: 6, field: 'unit_weight', label: '重量' }, { span: 6, field: 'spectral', label: '分光' }, { field: 'cat_name', label: '进项类目', span: 24 }, { label: '子商品', span: 24, render(_, { ProductsCombind = [] }) { return h(ElTable, { size: 'small', data: ProductsCombind, border: true }, { default: () => [ h(ElTableColumn, { label: '比例', prop: 'child_num', width: 100, showOverflowTooltip: true }), h(ElTableColumn, { label: '商品编号', showOverflowTooltip: true }, { default: (scope) => scope.row.products?.skuCode }), h(ElTableColumn, { label: '商品类型', showOverflowTooltip: true }, { default: (scope) => h(ElTag, { size: 'small' }, { default: () => cg_order_type_options.find(item => item.value == scope.row.products?.good_type)?.label || '--' }) }), h(ElTableColumn, { label: '商品名称' }, { default: (scope) => scope.row.products?.goodName }), ] }) } } ]