Commit 91bac5ea authored by XieZhiXiong's avatar XieZhiXiong

fixbug

parent 02f6968f
......@@ -2,20 +2,16 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-10 17:56:20
* @LastEditTime: 2020-12-11 11:04:53
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
import { Drawer, Button, Pagination } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
import { ColumnType } from 'antd/lib/table/interface';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api';
import { GetOrderOneBatchOrderListResponse } from '@/services/OrderApi';
import { PurchaseOrderInsideWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import { PurchaseOrderOutWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import NiceForm from '@/components/NiceForm';
import NestTable from '@/components/NestTable';
import { goodItem, OrderListParams, OrderListRes } from './interface';
......@@ -155,7 +151,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
title: '订单状态',
dataIndex: 'externalState',
align: 'center',
render: text => PurchaseOrderInsideWorkStateTexts[text],
render: text => PurchaseOrderOutWorkStateTexts[text],
},
{
title: '订单类型',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-29 10:03:06
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-02 13:47:58
* @LastEditTime: 2020-12-11 10:58:36
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -75,7 +75,7 @@ export const listSearchSchema: ISchema = {
{ label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_POINTS], value: ORDER_TYPE2_CHANNEL_POINTS },
],
'x-component-props': {
placeholder: '外部状态(全部)',
placeholder: '订单类型(全部)',
allowClear: true,
},
},
......
......@@ -2,34 +2,18 @@
* @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 13:51:21
* @LastEditTime: 2020-12-11 10:29:51
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
import { FormEffectHooks, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import {
} from '@/constants';
import { PublicApi } from '@/services/api';
const {
onFieldInputChange$,
onFieldValueChange$,
} = FormEffectHooks;
// 获取采购入库单相关数据
const fetchOrderPurchaseReceiptAddList = async (params: any) => {
const res = await PublicApi.getOrderPurchaseReceiptAddList({
...params,
})
if (res.code === 1000) {
return res.data;
}
return [];
};
export const useBusinessEffects = (context, actions) => {
const {
getFieldValue,
......@@ -72,14 +56,14 @@ export const useBusinessEffects = (context, actions) => {
// 已换货数量
const replacedCountValue = getFieldState(
FormPath.transform(name, /\d/, $1 => {
return `repairGoodsList.${$1}.replacedCount`
return `replaceGoodsList.${$1}.extraData`
}),
state => state.value,
state => state.value.replacedCount,
);
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `repairGoodsList.${$1}.replaceCount`
return `replaceGoodsList.${$1}.replaceCount`
}),
state => {
if (+value > replacedCountValue) {
......
......@@ -47,6 +47,7 @@ interface DetailInfo {
outerStatusName?: string,
innerStatus?: number,
innerStatusName?: string,
deliveryType?: number,
}
const ExchangeForm: React.FC<BillsFormProps> = ({
......@@ -184,6 +185,18 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
supplierName,
parentMemberId,
parentMemberRoleId,
evaluate,
goodsDetailList,
innerTaskList,
manualReturnGoodsAddress,
replaceDeliveryGoodsList,
replaceStatisticsList,
taskType,
consumerName,
outerTaskList,
replaceBatch,
replaceId,
...rest
} = res.data;
......@@ -248,7 +261,16 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
pageSize: `${99999}`,
}).then(res => {
if (res.code === 1000) {
setReplaceGoodsList(res.data);
setReplaceGoodsList({
data: res.data.data.map(item => ({
...item,
extraData: {
replacedCount: item.purchaseCount || 0, // 已换货数量,这里取 采购数量判断即可
id: item.orderRecordId,
},
})),
totalCount: res.data.totalCount,
});
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []);
}
}).finally(() => {
......@@ -292,6 +314,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
deliveryAddress = {},
proofFileList = [],
replaceGoodsList = [],
outerStatus,
outerStatusName,
innerStatus,
innerStatusName,
applyNo,
applyTime,
...rest
} = value;
......@@ -334,9 +363,9 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
,
sendId:
deliveryType === 1 ?
shippingAddress.sendId :
shippingAddress.id :
deliveryType === 2 ?
pickupAddress.sendId :
pickupAddress.id :
''
,
},
......@@ -345,13 +374,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
filePath: item.data.url,
})),
replaceGoodsList: replaceGoodsList.map(({
id,
replaceCount,
brand,
unit,
extraData,
...rest
}) => ({
orderRecordId: id,
orderRecordId: extraData.id,
replaceCount: +replaceCount,
brand: brand || '',
unit: unit || '',
......@@ -415,8 +444,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
existing ?
existing :
{
id: item.id,
orderRecordId: item.orderId,
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
......@@ -426,8 +453,11 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
purchaseCount: item.purchaseCount,
purchasePrice: item.price,
purchaseAmount: +(item.price * item.purchaseCount).toFixed(2),
replacedCount: item.replaceCount || item.purchaseCount || 0, // 已换货数量
replaceReason: '',
extraData: {
replacedCount: item.replaceCount || item.purchaseCount || 0, // 已换货数量
id: item.id,
},
};
value.push(atom);
});
......
......@@ -60,6 +60,7 @@ const supplierSchema: ISchema = {
placeholder: '搜索',
align: 'flex-start',
advanced: false,
tip: '输入 供应会员名称 进行搜索',
},
},
},
......@@ -211,6 +212,8 @@ export const addBillSchema: ISchema = {
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
......@@ -315,16 +318,11 @@ export const addBillSchema: ISchema = {
type: 'string',
display: false,
},
// 不用于展示,只用于收集值
orderId: {
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
},
// 已换货数量
replacedCount: {
type: 'string',
visible: false,
},
},
}
},
......
......@@ -137,6 +137,17 @@ const ExchangePrSubmit: React.FC = () => {
提交
</Button>
)}
{(
record.innerStatus === EXCHANGE_INNER_STATUS_UNCOMMITTED ||
record.outerStatus === EXCHANGE_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/exchangeApplication/exchangePrSubmit/edit?id=${record.replaceId}`)}
>
编辑
</Button>
)}
{record.innerStatus === EXCHANGE_INNER_STATUS_UNCOMMITTED && (
<Popconfirm
title="确定要删除吗?"
......@@ -152,17 +163,6 @@ const ExchangePrSubmit: React.FC = () => {
</Button>
</Popconfirm>
)}
{(
record.innerStatus === EXCHANGE_INNER_STATUS_UNCOMMITTED ||
record.outerStatus === EXCHANGE_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/exchangeApplication/exchangePrSubmit/edit?id=${record.replaceId}`)}
>
编辑
</Button>
)}
</>
),
},
......
......@@ -33,9 +33,9 @@ export const useBusinessEffects = (context, actions) => {
// 已维修数量
const repairedCountValue = getFieldState(
FormPath.transform(name, /\d/, $1 => {
return `repairGoodsList.${$1}.repairedCount`
return `repairGoodsList.${$1}.extraData`
}),
state => state.value,
state => state.value.repairedCount,
);
setFieldState(
......
......@@ -122,6 +122,17 @@ const RepairForm: React.FC<BillsFormProps> = ({
}).then(res => {
if (res.code === 1000) {
setRepairGoodsList(res.data);
setRepairGoodsList({
data: res.data.data.map(item => ({
...item,
extraData: {
id: item.orderRecordId,
orderId: item.orderId,
repairedCount: item.purchaseCount || 0, // 已维修数量,这里取 采购数量判断即可
},
})),
totalCount: res.data.totalCount,
});
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []);
}
}).finally(() => {
......@@ -197,13 +208,14 @@ const RepairForm: React.FC<BillsFormProps> = ({
filePath: item.data.url,
})),
repairGoodsList: repairGoodsList.map(({
id,
repairCount,
brand,
unit,
extraData,
...rest
}) => ({
orderRecordId: id,
orderId: extraData.orderId,
orderRecordId: extraData.id,
repairCount: +repairCount,
brand: brand || '',
unit: unit || '',
......@@ -211,6 +223,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
})),
...rest,
};
PublicApi.postAsRepairGoodsSave(payload)
.then(res => {
if (res.code === 1000) {
......@@ -262,8 +275,6 @@ const RepairForm: React.FC<BillsFormProps> = ({
existing ?
existing :
{
id: item.id,
orderId: item.orderId,
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
......@@ -271,8 +282,12 @@ const RepairForm: React.FC<BillsFormProps> = ({
brand: item.unitName,
unit: item.costPrice,
purchaseCount: item.purchaseCount,
repairedCount: item.repairCount || item.purchaseCount || 0, // 已维修数量
repairReason: '',
extraData: {
id: item.id,
orderId: item.orderId,
repairedCount: item.repairCount || item.purchaseCount || 0, // 已维修数量
},
};
value.push(atom);
});
......
......@@ -60,6 +60,7 @@ const supplierSchema: ISchema = {
placeholder: '搜索',
align: 'flex-start',
advanced: false,
tip: '输入 供应会员名称 进行搜索',
},
},
},
......@@ -211,6 +212,8 @@ export const addBillSchema: ISchema = {
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
......@@ -301,21 +304,11 @@ export const addBillSchema: ISchema = {
}
],
},
// 不用于展示,只用于收集值
id: {
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
},
// 不用于展示,只用于收集值
orderId: {
type: 'string',
display: false,
},
// 已维修数量
repairedCount: {
type: 'string',
visible: false,
},
},
}
},
......
......@@ -130,6 +130,18 @@ const RepairPrSubmit: React.FC = () => {
提交
</Button>
)}
{/* 外部状态为不接受申请 或者 内部状态为 待提交申请 都可以进行编辑 */}
{(
record.outerStatus === REPAIR_OUTER_STATUS_FAILED ||
record.innerStatus === REPAIR_INNER_STATUS_UNCOMMITTED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/repairApplication/repairPrSubmit/edit?id=${record.applyId}`)}
>
编辑
</Button>
)}
{record.innerStatus === REPAIR_INNER_STATUS_UNCOMMITTED && (
<Popconfirm
title="确定要删除吗?"
......@@ -145,18 +157,6 @@ const RepairPrSubmit: React.FC = () => {
</Button>
</Popconfirm>
)}
{/* 外部状态为不接受申请 或者 内部状态为 待提交申请 都可以进行编辑 */}
{(
record.outerStatus === REPAIR_OUTER_STATUS_FAILED ||
record.innerStatus === REPAIR_INNER_STATUS_UNCOMMITTED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/repairApplication/repairPrSubmit/edit?id=${record.applyId}`)}
>
编辑
</Button>
)}
</>
),
},
......
......@@ -48,29 +48,4 @@ export const useBusinessEffects = (context, actions) => {
break
};
});
// 校验退货数量
onFieldInputChange$('returnGoodsList.*.returnCount').subscribe(fieldState => {
const { name, value } = fieldState;
// 已退货数量
const replacedCountValue = getFieldState(
FormPath.transform(name, /\d/, $1 => {
return `returnGoodsList.${$1}.returnedCount`
}),
state => state.value,
);
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `returnGoodsList.${$1}.returnCount`
}),
state => {
if (+value > replacedCountValue) {
state.errors = '填写值已超过最大可退货数量,请重新填写';
} else {
state.errors = '';
}
}
);
});
}
\ No newline at end of file
......@@ -267,6 +267,18 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}).then(res => {
if (res.code === 1000) {
setReturnGoodsList(res.data);
setReturnGoodsList({
data: res.data.data.map(item => ({
...item,
returnedCount:item.purchaseCount || 0, // 已退货数量,这里取 采购数量判断即可
extraData: {
id: item.orderRecordId,
returnReason: item.returnReason,
payList: item.payList,
},
})),
totalCount: res.data.totalCount,
});
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []);
}
}).finally(() => {
......@@ -321,8 +333,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
...rest
} = values;
console.log('value', values)
setSubmitLoading(true);
const payload = {
......@@ -357,9 +367,9 @@ const ReturnForm: React.FC<BillsFormProps> = ({
,
sendId:
deliveryType === 1 ?
shippingAddress.sendId :
shippingAddress.id :
deliveryType === 2 ?
pickupAddress.sendId :
pickupAddress.id :
''
,
},
......@@ -531,7 +541,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
);
return (
<Spin spinning={infoLoading}>
<Spin spinning={infoLoading || returnGoodsLoading}>
<PageHeaderWrapper
style={{
padding: 24,
......
......@@ -60,6 +60,7 @@ const supplierSchema: ISchema = {
placeholder: '搜索',
align: 'flex-start',
advanced: false,
tip: '输入 供应会员名称 进行搜索',
},
},
},
......@@ -211,6 +212,8 @@ export const addBillSchema: ISchema = {
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 10:13:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 14:31:30
* @LastEditTime: 2020-12-11 11:12:44
* @Description: 待提交退货申请单
*/
import React, { useState, useRef } from 'react';
......@@ -142,6 +142,17 @@ const ReturnPrSubmit: React.FC = () => {
提交
</Button>
)}
{(
record.innerStatus === RETURN_INNER_STATUS_UNCOMMITTED ||
record.outerStatus === RETURN_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/returnApplication/returnPrSubmit/edit?id=${record.returnId}`)}
>
编辑
</Button>
)}
{record.innerStatus === RETURN_INNER_STATUS_UNCOMMITTED && (
<Popconfirm
title="确定要删除吗?"
......@@ -157,17 +168,6 @@ const ReturnPrSubmit: React.FC = () => {
</Button>
</Popconfirm>
)}
{(
record.innerStatus === RETURN_INNER_STATUS_UNCOMMITTED ||
record.outerStatus === RETURN_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/returnApplication/returnPrSubmit/edit?id=${record.returnId}`)}
>
编辑
</Button>
)}
</>
),
},
......
......@@ -449,7 +449,9 @@ export function normalizeFiledata(url: any): any {
name: fileName,
status: 'done',
url,
data: url, // formily Upload value 需要这个字段
data: {
url,
}, // formily Upload value 需要这个字段
};
};
......@@ -519,7 +521,8 @@ export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): nu
// 循环数据,找到状态值,一直覆盖
for (let i = 0; i < data.length; i++) {
if (!data[i][customKey]) {
index = i - 1;
index = i;
break;
}
// 循环到最后如果 index 还是为 0 的话,说明工作流全部跑完了,此时 index 为 data.length - 1
if (i === data.length - 1 && index === 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment