Commit 7311d332de5958bbc32c2e6a3c54567e0a52832a

Authored by sanmu
1 parent 8ef6b19d

feat: add new column

src/api/project/order.ts
@@ -14,6 +14,7 @@ enum Api { @@ -14,6 +14,7 @@ enum Api {
14 QUERY_PROJECT_NO_AND_INNER_NO = '/order/erp/order/queryProjectNoAndInnerNo', //查询项目号和内部编号 14 QUERY_PROJECT_NO_AND_INNER_NO = '/order/erp/order/queryProjectNoAndInnerNo', //查询项目号和内部编号
15 EXPORT = '/order/erp/order/export', 15 EXPORT = '/order/erp/order/export',
16 UPLOAD = '/api/localStorage/uploadOss', 16 UPLOAD = '/api/localStorage/uploadOss',
  17 + PROFIT_RATE = '/order/erp/profit/calculate', // 编辑订单实时获取利润率
17 18
18 DICT_INIT = '/order/erp/dictionary/get_all', 19 DICT_INIT = '/order/erp/dictionary/get_all',
19 DICT_ADD = '/order/erp/dictionary/add', 20 DICT_ADD = '/order/erp/dictionary/add',
@@ -63,6 +64,10 @@ export const orderCreate = async (data: any) => { @@ -63,6 +64,10 @@ export const orderCreate = async (data: any) => {
63 return res; 64 return res;
64 }; 65 };
65 66
  67 +export const getOrderProfitRate = async (data: any) => {
  68 + return defHttp.post<any>({ url: Api.PROFIT_RATE, data });
  69 +};
  70 +
66 export const queryProjectNoAndInnerNo = async (data: any) => { 71 export const queryProjectNoAndInnerNo = async (data: any) => {
67 const res = await defHttp.post<any>({ url: Api.QUERY_PROJECT_NO_AND_INNER_NO, data }); 72 const res = await defHttp.post<any>({ url: Api.QUERY_PROJECT_NO_AND_INNER_NO, data });
68 return res; 73 return res;
src/utils/project.ts
1 export const getDisable = (code, id, value) => { 1 export const getDisable = (code, id, value) => {
2 - return code === 'LOCKED' && !!id && value; 2 + return code === 'LOCKED' && !!id && (value || value === 0);
3 }; 3 };
4 4
5 // 利润分析的权限校验 5 // 利润分析的权限校验
6 export const getProfitDisable = (field, code, id, value) => { 6 export const getProfitDisable = (field, code, id, value) => {
7 // 包装费用,汇率不允许修改 7 // 包装费用,汇率不允许修改
8 - if (['packetPrice', 'exchangeRate'].includes(field)) { 8 + if (['packetPrice', 'exchangeRate', 'profitRate'].includes(field)) {
9 return true; 9 return true;
10 } 10 }
11 // code是lock,编辑并且value存在,才需要审核 11 // code是lock,编辑并且value存在,才需要审核
12 - return code === 'LOCKED' && !!id && value; 12 + return code === 'LOCKED' && !!id && (value || value === 0);
13 }; 13 };
14 14
15 // 基本信息的权限校验 客户编码、项目号、生产科、内部编号、业务员 才需要审核 15 // 基本信息的权限校验 客户编码、项目号、生产科、内部编号、业务员 才需要审核
src/views/project/approve/ProfitPanel.vue
@@ -141,16 +141,17 @@ @@ -141,16 +141,17 @@
141 openDrawer(true, { data }); 141 openDrawer(true, { data });
142 id.value = data.id; 142 id.value = data.id;
143 fieldInfos.value = (FIELDS_PROFIT_INFO as any) 143 fieldInfos.value = (FIELDS_PROFIT_INFO as any)
144 - .concat({  
145 - label: '利润率',  
146 - field: 'profitRate',  
147 - })  
148 .map((field) => { 144 .map((field) => {
149 if (field.field === 'profitType') { 145 if (field.field === 'profitType') {
150 return { 146 return {
151 label: field.label, 147 label: field.label,
152 value: data.fieldInfos.profitAnalysisFields[field.field] == 0 ? '方式1' : '方式2', 148 value: data.fieldInfos.profitAnalysisFields[field.field] == 0 ? '方式1' : '方式2',
153 }; 149 };
  150 + } else if (field.field === 'profitRate') {
  151 + return {
  152 + label: field.label,
  153 + value: (data.fieldInfos.profitAnalysisFields[field.field] * 100).toFixed(2) + '%',
  154 + };
154 } 155 }
155 return { 156 return {
156 label: field.label, 157 label: field.label,
src/views/project/order/CheckDetail.vue
@@ -72,7 +72,12 @@ @@ -72,7 +72,12 @@
72 span: 6, 72 span: 6,
73 }, 73 },
74 })) 74 }))
75 - .filter((item) => item.field !== 'packetPrice' && item.field !== 'exchangeRate'); 75 + .filter(
  76 + (item) =>
  77 + item.field !== 'packetPrice' &&
  78 + item.field !== 'exchangeRate' &&
  79 + item.field !== 'profitRate',
  80 + );
76 81
77 export default defineComponent({ 82 export default defineComponent({
78 components: { BasicDrawer, BasicForm }, 83 components: { BasicDrawer, BasicForm },
src/views/project/order/ExportModal.vue
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 v-bind="$attrs" 3 v-bind="$attrs"
4 destroyOnClose 4 destroyOnClose
5 @register="register" 5 @register="register"
6 - title="利润分析表" 6 + title="导出"
7 width="500px" 7 width="500px"
8 :height="100" 8 :height="100"
9 wrapClassName="h-[260px]" 9 wrapClassName="h-[260px]"
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 > 12 >
13 <CheckboxGroup v-model:value="checkedList" :options="options" /> 13 <CheckboxGroup v-model:value="checkedList" :options="options" />
14 <div className="mt-6"> 14 <div className="mt-6">
15 - <a-button type="primary" @click="handleCalc" className="ml-4">导出</a-button> 15 + <a-button type="primary" @click="handleExport" className="ml-4">导出</a-button>
16 </div> 16 </div>
17 </BasicModal> 17 </BasicModal>
18 </template> 18 </template>
@@ -92,7 +92,7 @@ @@ -92,7 +92,7 @@
92 } 92 }
93 } 93 }
94 94
95 - async function handleCalc() { 95 + async function handleExport() {
96 const fieldVO: any = {}; 96 const fieldVO: any = {};
97 checkedList.value.forEach((item) => { 97 checkedList.value.forEach((item) => {
98 if (item === 'baseFields') { 98 if (item === 'baseFields') {
@@ -108,8 +108,13 @@ @@ -108,8 +108,13 @@
108 } else if (item === 'profitAnalysisFields') { 108 } else if (item === 'profitAnalysisFields') {
109 if (props.role === ROLE.TRACKER) { 109 if (props.role === ROLE.TRACKER) {
110 fieldVO.profitAnalysisFields = ORDER_LIST_PROFIT_FIELDS[0].children 110 fieldVO.profitAnalysisFields = ORDER_LIST_PROFIT_FIELDS[0].children
111 - .filter(  
112 - (k) => k.dataIndex === 'customerPrice' || k.dataIndex === 'customerTotalPrice', 111 + .filter((k) =>
  112 + [
  113 + 'customerPrice',
  114 + 'customerRmbPrice',
  115 + 'customerTotalPrice',
  116 + 'customerRmbTotalPrice',
  117 + ].includes(k.dataIndex),
113 ) 118 )
114 .map((item) => ({ 119 .map((item) => ({
115 [item.dataIndex]: 'selected', 120 [item.dataIndex]: 'selected',
@@ -144,7 +149,7 @@ @@ -144,7 +149,7 @@
144 handleShow, 149 handleShow,
145 info, 150 info,
146 manualPreform, 151 manualPreform,
147 - handleCalc, 152 + handleExport,
148 activeUser, 153 activeUser,
149 exchangeRate, 154 exchangeRate,
150 checkedList, 155 checkedList,
src/views/project/order/FormDetail/ProfitFormPanel.vue
@@ -2,13 +2,15 @@ @@ -2,13 +2,15 @@
2 <BasicForm @register="registerForm" /> 2 <BasicForm @register="registerForm" />
3 </template> 3 </template>
4 <script lang="ts"> 4 <script lang="ts">
5 - import { computed, defineComponent, reactive, ref, toRaw } from 'vue'; 5 + import { computed, defineComponent, reactive, ref, nextTick } from 'vue';
6 import { BasicForm, useForm } from '/@/components/Form/index'; 6 import { BasicForm, useForm } from '/@/components/Form/index';
7 import { FIELDS_PROFIT_INFO } from '../tableData'; 7 import { FIELDS_PROFIT_INFO } from '../tableData';
8 import { getProfitDisable } from '/@/utils/project'; 8 import { getProfitDisable } from '/@/utils/project';
9 - import { get } from 'lodash-es'; 9 + import { debounce, get } from 'lodash-es';
10 import { useOrderInfo } from '/@/hooks/component/order'; 10 import { useOrderInfo } from '/@/hooks/component/order';
11 import { useOrderStoreWithOut } from '/@/store/modules/order'; 11 import { useOrderStoreWithOut } from '/@/store/modules/order';
  12 + import message from '/@/views/form-design/utils/message';
  13 + import { getOrderProfitRate } from '/@/api/project/order';
12 14
13 export default defineComponent({ 15 export default defineComponent({
14 components: { BasicForm }, 16 components: { BasicForm },
@@ -23,6 +25,10 @@ @@ -23,6 +25,10 @@
23 profitFormData: { 25 profitFormData: {
24 type: Object, 26 type: Object,
25 }, 27 },
  28 + orderCount: {
  29 + type: Number,
  30 + default: 0,
  31 + },
26 }, 32 },
27 emits: ['success'], 33 emits: ['success'],
28 setup(props, { emit }) { 34 setup(props, { emit }) {
@@ -30,6 +36,43 @@ @@ -30,6 +36,43 @@
30 const orderStore = useOrderStoreWithOut(); 36 const orderStore = useOrderStoreWithOut();
31 37
32 const { exchangeRate } = useOrderInfo(orderStore); 38 const { exchangeRate } = useOrderInfo(orderStore);
  39 + const updateProfitRate = debounce(async (field) => {
  40 + const values = getFieldsValue();
  41 + const {
  42 + profitType,
  43 + packetPrice,
  44 + exchangeRate = 0,
  45 + customerPrice,
  46 + customerRmbPrice,
  47 + productionDepartmentPrice,
  48 + profitRate,
  49 + } = values;
  50 + if (customerPrice && exchangeRate && packetPrice && customerRmbPrice) {
  51 + const customerTotalPrice = (customerPrice * (props.orderCount || 0)).toFixed(2); // 客户总价,美元
  52 + const productionDepartmentTotalPrice = (
  53 + productionDepartmentPrice * (props.orderCount || 0)
  54 + ).toFixed(2); // 生成科总价¥
  55 + const packetTotalPrice = (packetPrice * (props.orderCount || 0)).toFixed(2); // 包装费用总价
  56 + if (
  57 + customerPrice &&
  58 + customerRmbPrice &&
  59 + productionDepartmentPrice &&
  60 + // 只修改单价和部门才会计算利润率
  61 + ['customerPrice', 'customerRmbPrice', 'productionDepartmentPrice'].includes(field)
  62 + ) {
  63 + const res = await getOrderProfitRate({
  64 + profitType: profitType || '0',
  65 + packetTotalPrice,
  66 + productionDepartmentTotalPrice,
  67 + customerTotalPrice,
  68 + exchangeRate,
  69 + });
  70 + if (profitRate !== (res * 100).toFixed(2)) {
  71 + setFieldsValue({ profitRate: (res * 100).toFixed(2) + '%' });
  72 + }
  73 + }
  74 + }
  75 + }, 300);
33 76
34 const schemas = computed(() => { 77 const schemas = computed(() => {
35 const options = { 78 const options = {
@@ -51,6 +94,29 @@ @@ -51,6 +94,29 @@
51 props.id, 94 props.id,
52 get(props.profitFormData, `${item.field}`), 95 get(props.profitFormData, `${item.field}`),
53 ), 96 ),
  97 + onChange: async (val) => {
  98 + const values = getFieldsValue();
  99 + const { exchangeRate = 0, customerPrice, customerRmbPrice } = values || {};
  100 + // 修改的客户单价
  101 + if (item.field === 'customerPrice' && val !== customerPrice) {
  102 + if (exchangeRate !== 0) {
  103 + await setFieldsValue({ customerRmbPrice: val * exchangeRate });
  104 + } else {
  105 + message.error('汇率等于0,美元人民币之间无法转换');
  106 + }
  107 + }
  108 + // 值不相等才变化,不然无限循环了
  109 + if (item.field === 'customerRmbPrice' && val !== customerRmbPrice) {
  110 + if (exchangeRate !== 0) {
  111 + await setFieldsValue({ customerPrice: val / exchangeRate });
  112 + } else {
  113 + message.error('汇率等于0,美元人民币之间无法转换');
  114 + }
  115 + }
  116 + nextTick(() => {
  117 + updateProfitRate(item.field);
  118 + });
  119 + },
54 }, 120 },
55 colProps: { 121 colProps: {
56 span: 24, 122 span: 24,
@@ -81,4 +147,3 @@ @@ -81,4 +147,3 @@
81 }, 147 },
82 }); 148 });
83 </script> 149 </script>
84 -../constant  
src/views/project/order/FormDetail/index.vue
@@ -33,7 +33,12 @@ @@ -33,7 +33,12 @@
33 > 33 >
34 <span className="text-red-600">{{ checkingMsg }}</span> 34 <span className="text-red-600">{{ checkingMsg }}</span>
35 35
36 - <ProfitFormPanel ref="profitFormPanelRef" :id="id" :profitFormData="profitFormData" /> 36 + <ProfitFormPanel
  37 + ref="profitFormPanelRef"
  38 + :orderCount="orderCount"
  39 + :id="id"
  40 + :profitFormData="profitFormData"
  41 + />
37 </TabPanel> 42 </TabPanel>
38 <TabPanel 43 <TabPanel
39 key="3" 44 key="3"
@@ -131,6 +136,7 @@ @@ -131,6 +136,7 @@
131 const reportFormPanelRef = ref(); 136 const reportFormPanelRef = ref();
132 const trackFormPanelRef = ref(); 137 const trackFormPanelRef = ref();
133 const inspectionFormPanelRef = ref(); 138 const inspectionFormPanelRef = ref();
  139 + const orderCount = ref(0);
134 140
135 // 编辑从接口获取的value 141 // 编辑从接口获取的value
136 const baseFormData = ref(); 142 const baseFormData = ref();
@@ -187,9 +193,10 @@ @@ -187,9 +193,10 @@
187 return; 193 return;
188 } 194 }
189 id.value = data.id; 195 id.value = data.id;
190 - profitFormData.value = data.profitAnalysisInfo; 196 + profitFormData.value =
  197 + data?.orderUpdateInfoVO?.profitAnalysisFields || data.profitAnalysisInfo;
191 inspectFormData.value = data.inspectionStageInfo; 198 inspectFormData.value = data.inspectionStageInfo;
192 - reportFormData.value = data.reportInfo; 199 + reportFormData.value = data?.orderUpdateInfoVO?.reportFields || data.reportInfo;
193 trackFormData.value = data.trackStageInfo; 200 trackFormData.value = data.trackStageInfo;
194 201
195 // 方式1 202 // 方式1
@@ -205,6 +212,8 @@ @@ -205,6 +212,8 @@
205 }; 212 };
206 213
207 if (id.value) { 214 if (id.value) {
  215 + orderCount.value = data.orderCount;
  216 +
208 setTimeout(() => { 217 setTimeout(() => {
209 // 基本信息 218 // 基本信息
210 if (baseFormPanelRef.value) { 219 if (baseFormPanelRef.value) {
@@ -231,7 +240,7 @@ @@ -231,7 +240,7 @@
231 profitFormPanelRef.value.fields = { ...data.lockFields?.profitAnalysisFields } || {}; 240 profitFormPanelRef.value.fields = { ...data.lockFields?.profitAnalysisFields } || {};
232 241
233 if (data?.orderUpdateInfoVO?.profitAnalysisFields) { 242 if (data?.orderUpdateInfoVO?.profitAnalysisFields) {
234 - const { customerPrice, productionDepartmentPrice } = 243 + const { customerPrice, productionDepartmentPrice, customerRmbPrice } =
235 data?.orderUpdateInfoVO?.profitAnalysisFields || {}; 244 data?.orderUpdateInfoVO?.profitAnalysisFields || {};
236 245
237 //给个审核中提示 246 //给个审核中提示
@@ -241,6 +250,7 @@ @@ -241,6 +250,7 @@
241 profitFormPanelRef?.value?.setFieldsValue({ 250 profitFormPanelRef?.value?.setFieldsValue({
242 ...toRaw(data?.orderUpdateInfoVO?.profitAnalysisFields), 251 ...toRaw(data?.orderUpdateInfoVO?.profitAnalysisFields),
243 customerPrice: Number(customerPrice || 0), 252 customerPrice: Number(customerPrice || 0),
  253 + customerRmbPrice: Number(customerRmbPrice || 0),
244 productionDepartmentPrice: Number(productionDepartmentPrice || 0), 254 productionDepartmentPrice: Number(productionDepartmentPrice || 0),
245 packetPrice: packetPrice?.relationValue || 0, 255 packetPrice: packetPrice?.relationValue || 0,
246 exchangeRate: exchangeRate?.settingValue, 256 exchangeRate: exchangeRate?.settingValue,
@@ -317,14 +327,24 @@ @@ -317,14 +327,24 @@
317 closeDrawer(); 327 closeDrawer();
318 emit('success', {}); 328 emit('success', {});
319 } else { 329 } else {
  330 + // 利润分析
320 if (activeKey.value === '2') { 331 if (activeKey.value === '2') {
321 await profitFormPanelRef?.value?.validate(); 332 await profitFormPanelRef?.value?.validate();
322 forms.profitAnalysisInfo = profitFormPanelRef?.value?.getFieldsValue() || {}; 333 forms.profitAnalysisInfo = profitFormPanelRef?.value?.getFieldsValue() || {};
  334 + delete forms.profitAnalysisInfo.profitRate;
  335 + forms.profitAnalysisInfo.customerRmbPrice =
  336 + forms.profitAnalysisInfo.customerRmbPrice.toFixed(2); // 客户单价¥
  337 + forms.profitAnalysisInfo.customerRmbTotalPrice = (
  338 + forms.profitAnalysisInfo.customerRmbPrice * orderCount.value
  339 + ).toFixed(2); // 客户总价¥
  340 + forms.profitAnalysisInfo.customerPrice =
  341 + forms.profitAnalysisInfo.customerPrice.toFixed(2); // 客户单价$
323 // 方式如果没有变化,默认方式1 342 // 方式如果没有变化,默认方式1
324 if (!forms.profitAnalysisInfo.profitType) { 343 if (!forms.profitAnalysisInfo.profitType) {
325 forms.profitAnalysisInfo.profitType = '0'; 344 forms.profitAnalysisInfo.profitType = '0';
326 } 345 }
327 } else if (activeKey.value === '3') { 346 } else if (activeKey.value === '3') {
  347 + // 项目报告书
328 await reportFormPanelRef?.value?.validate(); 348 await reportFormPanelRef?.value?.validate();
329 // 比重相加等于1 349 // 比重相加等于1
330 const values = reportFormPanelRef?.value?.getFieldsValue() || {}; 350 const values = reportFormPanelRef?.value?.getFieldsValue() || {};
@@ -385,6 +405,7 @@ @@ -385,6 +405,7 @@
385 handleSubmit, 405 handleSubmit,
386 businessUsers, 406 businessUsers,
387 checkingMsg, 407 checkingMsg,
  408 + orderCount,
388 }; 409 };
389 }, 410 },
390 }); 411 });
src/views/project/order/HistoryDetail.vue
@@ -132,13 +132,14 @@ @@ -132,13 +132,14 @@
132 const activeKey = ref(1); 132 const activeKey = ref(1);
133 133
134 const getOrderOptLogFunc = async (data, index, page) => { 134 const getOrderOptLogFunc = async (data, index, page) => {
  135 + console.log('%c [ data ]-135', 'font-size:13px; background:pink; color:#bf2c9f;', data);
135 if (index === 1) { 136 if (index === 1) {
136 - const res = await getOrderOptLog({ orderId: data.id, page: page, pageSize: 20 }); 137 + const res = await getOrderOptLog({ orderId: data, page: page, pageSize: 20 });
137 list1.value = res.records; 138 list1.value = res.records;
138 total1.value = res.total; 139 total1.value = res.total;
139 page1.value = page; 140 page1.value = page;
140 } else { 141 } else {
141 - const res = await getOrderAuditLog({ orderId: data.id, page: page, pageSize: 20 }); 142 + const res = await getOrderAuditLog({ orderId: data, page: page, pageSize: 20 });
142 list2.value = res.records; 143 list2.value = res.records;
143 total2.value = res.total; 144 total2.value = res.total;
144 page2.value = page; 145 page2.value = page;
src/views/project/order/ProfitAnalysis.vue
@@ -11,10 +11,10 @@ @@ -11,10 +11,10 @@
11 <div className="mb-2"> 11 <div className="mb-2">
12 公式: 12 公式:
13 <Select 13 <Select
14 - className="w-[200px]" 14 + className="w-[240px]"
15 :options="[ 15 :options="[
16 - { label: '公式1:1 -(LOCAL总金额 / 汇率 + 包装总金额)/客户总金额', value: '0' },  
17 - { label: '公式2:1 -(LOCAL总金额/汇率 / (客户总金额-包装费用总金额)', value: '1' }, 16 + { label: '公式1:1 -(LOCAL总金额 / 汇率 + 包装总金额)/ 客户总金额', value: '0' },
  17 + { label: '公式2:1 -(LOCAL总金额 / 汇率 / (客户总金额-包装费用总金额)', value: '1' },
18 ]" 18 ]"
19 v-model:value="profitType" 19 v-model:value="profitType"
20 placeholder="请选择" 20 placeholder="请选择"
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 <script lang="ts"> 49 <script lang="ts">
50 import { computed, defineComponent, onMounted, ref, toRaw, watch } from 'vue'; 50 import { computed, defineComponent, onMounted, ref, toRaw, watch } from 'vue';
51 import { BasicModal, useModalInner } from '/@/components/Modal'; 51 import { BasicModal, useModalInner } from '/@/components/Modal';
52 - import { Description, DescItem, useDescription } from '/@/components/Description/index'; 52 + import { Description, DescItem } from '/@/components/Description/index';
53 import { orderAnalysis } from '/@/api/project/order'; 53 import { orderAnalysis } from '/@/api/project/order';
54 import { Select, Space } from 'ant-design-vue'; 54 import { Select, Space } from 'ant-design-vue';
55 import { useOrderStoreWithOut } from '/@/store/modules/order'; 55 import { useOrderStoreWithOut } from '/@/store/modules/order';
@@ -82,18 +82,18 @@ @@ -82,18 +82,18 @@
82 { 82 {
83 field: 'customerTotalPrice', 83 field: 'customerTotalPrice',
84 label: '客户总金额', 84 label: '客户总金额',
85 - render: (val) => '$ ' + (val || ''), 85 + render: (val) => '$ ' + (val || 0).toFixed(2),
86 }, 86 },
87 { 87 {
88 field: 'packetTotalPrice', 88 field: 'packetTotalPrice',
89 label: '供应商总价', 89 label: '供应商总价',
90 - render: (val) => '¥ ' + (val || ''), 90 + render: (val) => '¥ ' + (val || 0).toFixed(2),
91 }, 91 },
92 { 92 {
93 field: 'productionDepartmentTotalPrice', 93 field: 'productionDepartmentTotalPrice',
94 label: '包装费用', 94 label: '包装费用',
95 show: isTracker, 95 show: isTracker,
96 - render: (val) => '$' + (val || ''), 96 + render: (val) => '$' + (val || 0).toFixed(2),
97 }, 97 },
98 { 98 {
99 field: 'profitRate', 99 field: 'profitRate',
src/views/project/order/tableData.tsx
@@ -224,72 +224,95 @@ export const ORDER_LIST_PROFIT_FIELDS = [ @@ -224,72 +224,95 @@ export const ORDER_LIST_PROFIT_FIELDS = [
224 dataIndex: 'profitAnalysisInfo', 224 dataIndex: 'profitAnalysisInfo',
225 children: [ 225 children: [
226 { 226 {
227 - title: '客户单价', 227 + title: '客户单价$',
228 width: 150, 228 width: 150,
229 dataIndex: 'customerPrice', 229 dataIndex: 'customerPrice',
230 customRender: (column) => { 230 customRender: (column) => {
231 const { record } = column || {}; 231 const { record } = column || {};
232 - return `${record?.profitAnalysisInfo?.customerCurrency || ''} ${  
233 - record?.profitAnalysisInfo?.customerPrice || ''  
234 - }`; 232 + return record?.profitAnalysisInfo?.customerPrice;
  233 + // ? `$ ${record?.profitAnalysisInfo?.customerPrice}`
  234 + // : '';
235 }, 235 },
236 }, 236 },
237 { 237 {
238 - title: '客户总价', 238 + title: '客户单价¥',
239 width: 150, 239 width: 150,
240 - dataIndex: 'customerTotalPrice', 240 + dataIndex: 'customerRmbPrice',
241 customRender: (column) => { 241 customRender: (column) => {
242 const { record } = column || {}; 242 const { record } = column || {};
243 -  
244 - return `${record?.profitAnalysisInfo?.customerCurrency || ''} ${  
245 - record?.profitAnalysisInfo?.customerTotalPrice || ''  
246 - }`; 243 + return record?.profitAnalysisInfo?.customerRmbPrice;
  244 + // ? `¥ ${record?.profitAnalysisInfo?.customerRmbPrice}`
  245 + // : '';
247 }, 246 },
248 }, 247 },
249 { 248 {
250 - title: '生产科单价', 249 + title: '客户总金额$',
251 width: 150, 250 width: 150,
252 - dataIndex: 'productionDepartmentPrice', 251 + dataIndex: 'customerTotalPrice',
253 customRender: (column) => { 252 customRender: (column) => {
254 const { record } = column || {}; 253 const { record } = column || {};
255 - return `${record?.profitAnalysisInfo?.productionDepartmentCurrency || ''} ${  
256 - record?.profitAnalysisInfo?.productionDepartmentPrice || ''  
257 - }`; 254 +
  255 + return record?.profitAnalysisInfo?.customerTotalPrice;
  256 + // ? `$ ${record?.profitAnalysisInfo?.customerTotalPrice}`
  257 + // : '';
258 }, 258 },
259 }, 259 },
260 { 260 {
261 - title: '生产科总价', 261 + title: '客户总金额¥',
262 width: 150, 262 width: 150,
263 - dataIndex: 'productionDepartmentTotalPrice', 263 + dataIndex: 'customerRmbTotalPrice',
264 customRender: (column) => { 264 customRender: (column) => {
265 const { record } = column || {}; 265 const { record } = column || {};
266 - return `${record?.profitAnalysisInfo?.productionDepartmentCurrency || ''} ${  
267 - record?.profitAnalysisInfo?.productionDepartmentTotalPrice || ''  
268 - }`; 266 +
  267 + return record?.profitAnalysisInfo?.customerRmbTotalPrice;
  268 + // ? `¥ ${record?.profitAnalysisInfo?.customerRmbTotalPrice}`
  269 + // : '';
269 }, 270 },
270 }, 271 },
271 { 272 {
272 - title: '包装费用', 273 + title: '生产科单价¥',
273 width: 150, 274 width: 150,
274 - dataIndex: 'packetPrice', 275 + dataIndex: 'productionDepartmentPrice',
275 customRender: (column) => { 276 customRender: (column) => {
276 const { record } = column || {}; 277 const { record } = column || {};
277 - return record?.profitAnalysisInfo?.packetPrice !== undefined  
278 - ? `$ ${record?.profitAnalysisInfo?.packetPrice || 0}`  
279 - : ''; 278 + return record?.profitAnalysisInfo?.productionDepartmentPrice;
  279 + // ? `¥ ${record?.profitAnalysisInfo?.productionDepartmentPrice}`
  280 + // : '';
280 }, 281 },
281 }, 282 },
282 { 283 {
283 - title: '包装费用合计', 284 + title: '生产科总价¥',
284 width: 150, 285 width: 150,
285 - dataIndex: 'packetTotalPrice', 286 + dataIndex: 'productionDepartmentTotalPrice',
286 customRender: (column) => { 287 customRender: (column) => {
287 const { record } = column || {}; 288 const { record } = column || {};
288 - return record?.profitAnalysisInfo?.packetTotalPrice !== undefined  
289 - ? '$ ' + record?.profitAnalysisInfo?.packetTotalPrice  
290 - : ''; 289 + return record?.profitAnalysisInfo?.productionDepartmentTotalPrice;
  290 + // ? `¥ ${record?.profitAnalysisInfo?.productionDepartmentTotalPrice}`
  291 + // : '';
291 }, 292 },
292 }, 293 },
  294 + // {
  295 + // title: '包装费用$',
  296 + // width: 150,
  297 + // dataIndex: 'packetPrice',
  298 + // customRender: (column) => {
  299 + // const { record } = column || {};
  300 + // return record?.profitAnalysisInfo?.packetPrice !== undefined;
  301 + // // ? `$ ${record?.profitAnalysisInfo?.packetPrice}`
  302 + // // : '';
  303 + // },
  304 + // },
  305 + // {
  306 + // title: '包装费用合计$',
  307 + // width: 150,
  308 + // dataIndex: 'packetTotalPrice',
  309 + // customRender: (column) => {
  310 + // const { record } = column || {};
  311 + // return record?.profitAnalysisInfo?.packetTotalPrice !== undefined;
  312 + // // ? '$ ' + record?.profitAnalysisInfo?.packetTotalPrice.toFixed(2)
  313 + // // : '';
  314 + // },
  315 + // },
293 { 316 {
294 title: '汇率', 317 title: '汇率',
295 width: 150, 318 width: 150,
@@ -314,7 +337,7 @@ export const ORDER_LIST_PROFIT_FIELDS = [ @@ -314,7 +337,7 @@ export const ORDER_LIST_PROFIT_FIELDS = [
314 { 337 {
315 title: '利润率计算方式', 338 title: '利润率计算方式',
316 width: 150, 339 width: 150,
317 - dataIndex: 'profitRate', 340 + dataIndex: 'profitType',
318 customRender: (column) => { 341 customRender: (column) => {
319 const { record } = column || {}; 342 const { record } = column || {};
320 return record?.profitAnalysisInfo?.profitType === '0' 343 return record?.profitAnalysisInfo?.profitType === '0'
@@ -960,54 +983,98 @@ export const FIELDS_PROFIT_INFO = [ @@ -960,54 +983,98 @@ export const FIELDS_PROFIT_INFO = [
960 { 983 {
961 field: 'customerPrice', 984 field: 'customerPrice',
962 component: 'InputNumber', 985 component: 'InputNumber',
963 - label: '客户单价', 986 + label: '客户单价$',
  987 + rules: [{ required: true }],
  988 + componentProps: {
  989 + precision: 2,
  990 + },
  991 + },
  992 + {
  993 + field: 'customerRmbPrice',
  994 + component: 'InputNumber',
  995 + label: '客户单价¥',
  996 + componentProps: {
  997 + precision: 2,
  998 + },
964 rules: [{ required: true }], 999 rules: [{ required: true }],
965 }, 1000 },
966 // { 1001 // {
  1002 + // field: 'customerPrice',
  1003 + // component: 'InputNumber',
  1004 + // label: '客户总金额',
  1005 + // rules: [{ required: true }],
  1006 + // },
  1007 + // {
  1008 + // field: 'customerPrice',
  1009 + // component: 'InputNumber',
  1010 + // label: '客户总金额(人民币)',
  1011 + // rules: [{ required: true }],
  1012 + // },
  1013 + // {
967 // field: 'customerTotalPrice', 1014 // field: 'customerTotalPrice',
968 // component: 'InputNumber', 1015 // component: 'InputNumber',
969 // label: '客户总价', 1016 // label: '客户总价',
970 // rules: [{ required: true }], 1017 // rules: [{ required: true }],
971 // }, 1018 // },
972 - {  
973 - field: 'customerCurrency',  
974 - component: 'Select',  
975 - label: '客户单价货币单位',  
976 - labelWidth: 400,  
977 - rules: [{ required: true }],  
978 - componentProps: {  
979 - options: [  
980 - { label: '$', value: '$' },  
981 - { label: '¥', value: '¥' },  
982 - ],  
983 - },  
984 - }, 1019 + // {
  1020 + // field: 'customerCurrency',
  1021 + // component: 'Select',
  1022 + // label: '客户单价货币单位',
  1023 + // labelWidth: 400,
  1024 + // rules: [{ required: true }],
  1025 + // componentProps: {
  1026 + // options: [
  1027 + // { label: '$', value: '$' },
  1028 + // { label: '¥', value: '¥' },
  1029 + // ],
  1030 + // },
  1031 + // },
985 { 1032 {
986 field: 'productionDepartmentPrice', 1033 field: 'productionDepartmentPrice',
987 component: 'InputNumber', 1034 component: 'InputNumber',
988 - label: '生产科单价', 1035 + label: '生产科单价¥',
989 rules: [{ required: true }], 1036 rules: [{ required: true }],
990 }, 1037 },
  1038 + // {
  1039 + // field: 'productionDepartmentCurrency',
  1040 + // component: 'Select',
  1041 + // label: '生产科货币单位',
  1042 + // rules: [{ required: true }],
  1043 + // componentProps: {
  1044 + // options: [
  1045 + // { label: '$', value: '$' },
  1046 + // { label: '¥', value: '¥' },
  1047 + // ],
  1048 + // },
  1049 + // },
  1050 + // {
  1051 + // field: 'productionDepartmentPrice',
  1052 + // component: 'InputNumber',
  1053 + // label: '生产科总价¥',
  1054 + // rules: [{ required: true }],
  1055 + // },
991 { 1056 {
992 - field: 'productionDepartmentCurrency', 1057 + label: '计算利润方式',
993 component: 'Select', 1058 component: 'Select',
994 - label: '生产科货币单位',  
995 - rules: [{ required: true }], 1059 + field: 'profitType',
996 componentProps: { 1060 componentProps: {
  1061 + defaultValue: '0',
997 options: [ 1062 options: [
998 - { label: '$', value: '$' },  
999 - { label: '¥', value: '¥' }, 1063 + { label: '公式1:1 -(LOCAL总金额 / 汇率 + 包装总金额)/ 客户总金额', value: '0' },
  1064 + { label: '公式2:1 -(LOCAL总金额 / 汇率 / (客户总金额 - 包装费用总金额)', value: '1' },
1000 ], 1065 ],
1001 }, 1066 },
  1067 + // rules: [{ required: true }],
  1068 + },
  1069 + {
  1070 + label: '利润率',
  1071 + component: 'InputNumber',
  1072 + field: 'profitRate',
  1073 + fieldComponent: { disabled: true },
  1074 + // rules: [{ required: true }],
1002 }, 1075 },
1003 - // {  
1004 - // field: 'productionDepartmentPrice',  
1005 - // component: 'InputNumber',  
1006 - // label: '生产科总价¥',  
1007 - // rules: [{ required: true }],  
1008 - // },  
1009 { 1076 {
1010 - label: '包装费用', 1077 + label: '包装费用$',
1011 component: 'InputNumber', 1078 component: 'InputNumber',
1012 field: 'packetPrice', 1079 field: 'packetPrice',
1013 fieldComponent: { disabled: true }, 1080 fieldComponent: { disabled: true },
@@ -1046,19 +1113,6 @@ export const FIELDS_PROFIT_INFO = [ @@ -1046,19 +1113,6 @@ export const FIELDS_PROFIT_INFO = [
1046 // field: 'exchangeRate', 1113 // field: 'exchangeRate',
1047 // // rules: [{ required: true }], 1114 // // rules: [{ required: true }],
1048 // }, 1115 // },
1049 - {  
1050 - label: '计算利润方式',  
1051 - component: 'Select',  
1052 - field: 'profitType',  
1053 - componentProps: {  
1054 - defaultValue: '0',  
1055 - options: [  
1056 - { label: '方式一: 1 -(LOCAL单价 / 汇率 + 包装费用)/ 客户单价', value: '0' },  
1057 - { label: '方式二: 1 -(LOCAL单价/汇率 / (客户单价-包装费用)', value: '1' },  
1058 - ],  
1059 - },  
1060 - // rules: [{ required: true }],  
1061 - },  
1062 ]; 1116 ];
1063 1117
1064 //质量检测信息 1118 //质量检测信息