gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 
import { DICT_TYPE } from '..\..\..\..\packages\constants\src';
 
/** 产品详情列表的列定义 */
export function useDetailListColumns(
  showBusinessPrice: boolean,
): VxeTableGridOptions['columns'] {
  return [
    {
      field: 'productName',
      title: '产品名称',
    },
    {
      field: 'productNo',
      title: '产品条码',
    },
    {
      field: 'productUnit',
      title: '产品单位',
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
      },
    },
    {
      field: 'productPrice',
      title: '产品价格(元)',
      formatter: 'formatAmount2',
    },
    {
      field: 'businessPrice',
      title: '商机价格(元)',
      formatter: 'formatAmount2',
      visible: showBusinessPrice,
    },
    {
      field: 'contractPrice',
      title: '合同价格(元)',
      formatter: 'formatAmount2',
      visible: !showBusinessPrice,
    },
    {
      field: 'count',
      title: '数量',
      formatter: 'formatAmount3',
    },
    {
      field: 'totalPrice',
      title: '合计金额(元)',
      formatter: 'formatAmount2',
    },
  ];
}
 
/** 产品编辑表格的列定义 */
export function useProductEditTableColumns(): VxeTableGridOptions['columns'] {
  return [
    { type: 'seq', title: '序号', minWidth: 50 },
    {
      field: 'productId',
      title: '产品名称',
      minWidth: 100,
      slots: { default: 'productId' },
    },
    {
      field: 'productNo',
      title: '条码',
      minWidth: 150,
    },
    {
      field: 'productUnit',
      title: '单位',
      minWidth: 100,
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
      },
    },
    {
      field: 'productPrice',
      title: '价格(元)',
      minWidth: 100,
      formatter: 'formatAmount2',
    },
    {
      field: 'sellingPrice',
      title: '售价(元)',
      minWidth: 100,
      slots: { default: 'sellingPrice' },
    },
    {
      field: 'count',
      title: '数量',
      minWidth: 100,
      slots: { default: 'count' },
    },
    {
      field: 'totalPrice',
      title: '合计',
      minWidth: 100,
      formatter: 'formatAmount2',
    },
    {
      title: '操作',
      width: 80,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}