Commit 434f4005 authored by XieZhiXiong's avatar XieZhiXiong

feat: 跟进合同订单售后流程枚举从新接口获取

parent cdf335d5
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-14 17:12:16
* @LastEditTime: 2021-05-17 16:20:49
* @Description: 维修商品抽屉组件
*/
import React from 'react';
......@@ -187,13 +187,16 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
if (orderListRes) {
let processEnumRes = { data: [], code: 0 };
// 售后退货、换货才涉及工作流相关
// 售后退货、换货才涉及售后工作流相关
// 这里分两种状况,一种是普通的订单、而是合同订单
// 普通订单根据订单商品,请求商品的售后流程枚举组装数据
// 合同订单根据订单的合同id,请求合同的售后流程枚举组装数据
if (afterType === 2 || afterType === 3) {
// 获取对应订单列表的工作流类型
// 获取对应订单列表的售后工作流类型
const payload = [];
orderListRes.data.forEach(item => {
if (item.productDateilss) {
if (!isMateriel && item.productDateilss) {
item.productDateilss.forEach(product => {
const atom = {
productId: product.productId,
......@@ -205,6 +208,15 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
payload.push(atom);
});
}
if (isMateriel) {
const atom = {
contractId: item.contractId,
memberId: item.memberId,
memberRoleId: item.memberRoleId,
type: afterType, // 流程类型
};
payload.push(atom);
}
});
if (!payload.length) {
......@@ -215,16 +227,24 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
return;
}
if (!isMateriel) {
processEnumRes = await PublicApi.postOrderGetProcessEnum({
list: payload,
}, {
ctlType: 'none',
processEnumRes = (
!isMateriel
? await PublicApi.postOrderGetProcessEnum({
list: payload,
}, {
ctlType: 'none',
})
: await PublicApi.postManageRuleGetProcessEnums({
processEnumRequests: payload,
}, {
ctlType: 'none',
})
);
if (processEnumRes.code !== 1000) {
this.setState({
loading: false,
});
if (processEnumRes.code !== 1000) {
message.error('获取工作流枚举失败,请稍候再试');
return;
}
return;
}
}
......@@ -235,10 +255,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 组装数据
let i = 0;
orderListRes.data.forEach(item => {
orderListRes.data.forEach((item, j) => {
if (item.productDateilss) {
item.productDateilss.forEach(product => {
product.processEnum = !isMateriel ? processEnumRes.data[i] ? processEnumRes.data[i].processEnum : undefined : item.processEnum;
if (!isMateriel) {
product.processEnum = processEnumRes.data[i] ? processEnumRes.data[i].processEnum : undefined;
} else {
product.processEnum = processEnumRes.data[j] ? processEnumRes.data[j].processEnum : undefined;
}
// product.processEnum = mockMap[Math.floor(Math.random()*2 + 1)];
i++;
// 防止重复添加数据
......
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