Commit a849969c authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接售后维修相关

parent bc342a24
......@@ -56,7 +56,6 @@ interface DetailInfo extends GetAsRepairGoodsGetDetailByConsumerResponse {
const DetailInfo: React.FC<DetailInfoProps> = ({
id,
isEdit = false,
target,
headExtra = null,
}) => {
......@@ -90,61 +89,51 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
ellipsis: true,
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
}
]
: [
{
title: '物料编号',
dataIndex: 'materielNo',
align: 'center',
dataIndex: 'productId',
},
{
title: '物料名称、规格',
dataIndex: 'materielName',
align: 'center',
render: (text, record) => `${text}/${record.materielType}`,
dataIndex: 'productName',
render: (text, record) => `${text}${record.type ? '/' + record.type : ''}`,
},
{
title: '品类',
dataIndex: 'materielCategory',
align: 'center',
dataIndex: 'category',
},
{
title: '品牌',
dataIndex: 'materielBrand',
align: 'center',
dataIndex: 'brand',
},
{
title: '单位',
dataIndex: 'materielUnit',
align: 'center',
dataIndex: 'unit',
},
{
title: detailInfo?.orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
dataIndex: 'productId',
align: 'center',
render: (text, record) => `${text}/${record.productName}/${record.category}/${record.brand}`,
dataIndex: 'associatedProductId',
render: (text, record) => `${text}/${record.associatedProductName}/${record.associatedType || '无'}/${record.associatedCategory}/${record.associatedBrand}`,
},
]
),
......
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-25 10:55:49
* @Description:
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import RepairForm from './components/RepairForm';
const AddRepair: React.FC = () => {
const { orderId } = usePageStatus();
const { orderId, orderType } = usePageStatus();
return (
<RepairForm orderId={orderId} isEdit />
<RepairForm orderId={orderId} orderType={+orderType} isEdit />
);
};
......
......@@ -51,6 +51,10 @@ interface DetailInfo {
* 订单编号
*/
orderNo?: string,
/**
* 订单类型
*/
orderType?: number,
}
interface BillsFormProps {
......@@ -63,6 +67,10 @@ interface BillsFormProps {
* 订单id,从订单列表跳转过来的
*/
orderId?: number,
/**
* 订单类型
*/
orderType?: number,
};
interface OrderNoProps {
......@@ -86,6 +94,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
id,
isEdit = false,
orderId,
orderType: outerOrderType,
}) => {
const [detailInfo, setDetailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
......@@ -109,10 +118,9 @@ const RepairForm: React.FC<BillsFormProps> = ({
{
title: '订单号',
dataIndex: 'orderNo',
align: 'center',
render: (text) => (
render: (text, record) => (
<a
href={`/memberCenter/afterService/repairApplication/repairPrSubmit/orderDetail?orderNo=${text}`}
href={`/memberCenter/afterService/returnApplication/returnPrSubmit/orderDetail?id=${record.orderId}`}
target="_blank"
        >
{text}
......@@ -121,35 +129,28 @@ const RepairForm: React.FC<BillsFormProps> = ({
},
{
title: '订单摘要',
dataIndex: 'orderThe',
align: 'center',
dataIndex: 'digest',
ellipsis: true,
},
{
title: '供应会员',
dataIndex: 'supplyMembersName',
align: 'center',
dataIndex: 'vendorMemberName',
},
{
title: '下单时间',
dataIndex: 'createTime',
align: 'center',
render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '订单状态',
dataIndex: 'outerStatusName',
align: 'center',
},
{
title: '订单类型',
dataIndex: 'type',
align: 'center',
render: text => ORDER_TYPE2[text],
dataIndex: 'orderTypeName',
},
isMateriel ? {
title: '合同编号',
dataIndex: 'contractNo',
align: 'center',
render: (text, record) => (
<a
href={`/memberCenter/contract/manage/QueryList/QueryListdetails?contractId=${record.contractId}`}
......@@ -164,47 +165,38 @@ const RepairForm: React.FC<BillsFormProps> = ({
const childTableColumn: ColumnType<any>[] = [
!isMateriel ?{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
dataIndex: 'productNo',
} : {
title: '物料编号',
dataIndex: 'materialCode',
align: 'center',
dataIndex: 'productNo',
},
!isMateriel ? {
title: '商品名称',
dataIndex: 'productName',
align: 'center',
dataIndex: 'name',
} : {
title: '物料名称、规格',
dataIndex: 'materialName',
align: 'center',
render: (text, record) => `${text}/${record.materialType}`,
dataIndex: 'name',
render: (text, record) => `${text}/${record.quotedSpec}`,
},
{
title: '品类',
dataIndex: !isMateriel ? 'category' : 'materialCategory',
align: 'center',
dataIndex: !isMateriel ? 'category' : 'quotedCategory',
},
{
title: '品牌',
dataIndex: !isMateriel ? 'brand' : 'materialBrand',
align: 'center',
dataIndex: !isMateriel ? 'brand' : 'quotedBrand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
{
title: '订单数量',
dataIndex: 'purchaseCount',
align: 'center',
dataIndex: 'quantity',
},
{
title: '已维修数量',
dataIndex: 'repairCount',
align: 'center',
dataIndex: 'maintainCount',
},
];
......@@ -227,8 +219,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
orderId: item.orderId,
remaining: item.purchaseCount || 0, // 已维修数量,这里取 采购数量判断即可
},
associated: !item.materielId ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielNameAndType: `${item.materielName || ''}${item.materielType ? '/' + item.materielType : ''}`,
associated: !item.associatedProductId ? '' : `${item.associatedProductId}/${item.associatedProductName}/${item.associatedType || ' '}/${item.associatedCategory}/${item.associatedBrand}`,
})));
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []);
}
......@@ -305,16 +296,15 @@ const RepairForm: React.FC<BillsFormProps> = ({
return;
}
setInfoLoading(true);
PublicApi.getOrderProcurementOrderDetails({
id: `${orderId}`,
orderNo: '',
PublicApi.getOrderBuyerDetail({
orderId: `${orderId}`,
} as any)
.then(res => {
if (res.code === 1000) {
const {
supplyMembersName,
supplyMembersId,
supplyMembersRoleId,
vendorMemberName,
vendorMemberId,
vendorRoleId,
orderNo,
} = res.data;
......@@ -326,20 +316,22 @@ const RepairForm: React.FC<BillsFormProps> = ({
);
setDetailInfo({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
supplierMember:
supplyMembersName ?
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
supplierMember:
vendorMemberName ?
[
{
name: supplyMembersName,
memberId: supplyMembersId,
roleId: supplyMembersRoleId,
},
name: vendorMemberName,
memberId: vendorMemberId,
roleId: vendorRoleId,
},
] :
[]
,
orderNo,
,
orderNo,
orderType: +outerOrderType,
});
setOrderTypeValue(+outerOrderType);
}
})
.catch((err) => {
......@@ -353,14 +345,24 @@ const RepairForm: React.FC<BillsFormProps> = ({
// 根据供应会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
return new Promise((resolve, reject) => {
PublicApi.getOrderAfterSalesOrderList({
orderNo: detailInfo.orderNo,
...params,
supplyMembersId: supplierMemberValue[0].memberId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
type: orderTypeValue,
PublicApi.getOrderCommonAfterSalePage({
...payload,
vendorMemberId: supplierMemberValue[0].memberId,
vendorRoleId: supplierMemberValue[0].roleId,
orderType: orderTypeValue,
afterSalesType: 4, // 维修
orderNo: detailInfo.orderNo ? detailInfo.orderNo : params.orderNo || undefined,
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
......@@ -499,13 +501,15 @@ const RepairForm: React.FC<BillsFormProps> = ({
values.forEach(item => {
const atom = {
orderId: item.orderId,
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
productId: item.productNo,
productName: item.name,
category: item.category,
brand: item.brand,
unit: item.unit,
purchaseCount: item.purchaseCount,
purchaseCount: item.quantity,
type: item.type,
repairReason: '',
extraData: {
id: item.id,
......@@ -516,15 +520,13 @@ const RepairForm: React.FC<BillsFormProps> = ({
taxRate: item.taxRate,
contractId: item.contractId,
contractNo: item.contractNo,
associated: !isMateriel ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielId: item.materialId,
materielNo: item.materialCode,
materielNameAndType: `${item.materialName || ''}${item.materialType ? '/' + item.materialType : ''}`,
materielName: item.materialName,
materielType: item.materialType,
materielCategory: item.materialCategory,
materielBrand: item.materialBrand,
materielUnit: item.materialUnit,
associated: !isMateriel ? '' : `${item.quotedProductNo}/${item.quotedName}/${item.quotedSpec || ' '}/${item.quotedCategory}/${item.quotedBrand}`,
associatedProductId: item.quotedProductNo || '',
associatedProductName: `${item.quotedName || ''}`,
associatedType: `${item.quotedSpec || ''}`,
associatedCategory: item.quotedCategory || '',
associatedBrand: item.quotedBrand || '',
associatedUnit: item.unit || '',
};
value.push(atom);
});
......
......@@ -299,27 +299,27 @@ export const addSchema = (orderType: number): ISchema => {
title: '订单号',
'x-component': 'OrderNo',
},
materielNo: {
productId: {
type: 'string',
title: '物料编号',
'x-component': 'Text',
},
materielNameAndType: {
productName: {
type: 'string',
title: '物料名称、规格',
'x-component': 'Text',
},
materielCategory: {
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
materielBrand: {
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
materielUnit: {
associatedUnit: {
type: 'string',
title: '单位',
'x-component': 'Text',
......
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-25 10:55:56
* @Description:
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import RepairForm from './components/RepairForm';
const EditRepair: React.FC = () => {
const { id, creditId } = usePageStatus();
const { id } = usePageStatus();
return (
<RepairForm id={id} isEdit />
......
......@@ -90,61 +90,51 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
ellipsis: true,
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
}
]
: [
{
title: '物料编号',
dataIndex: 'materielNo',
align: 'center',
dataIndex: 'productId',
},
{
title: '物料名称、规格',
dataIndex: 'materielName',
align: 'center',
render: (text, record) => `${text}/${record.materielType}`,
dataIndex: 'productName',
render: (text, record) => `${text}${record.type ? '/' + record.type : ''}`,
},
{
title: '品类',
dataIndex: 'materielCategory',
align: 'center',
dataIndex: 'category',
},
{
title: '品牌',
dataIndex: 'materielBrand',
align: 'center',
dataIndex: 'brand',
},
{
title: '单位',
dataIndex: 'materielUnit',
align: 'center',
dataIndex: 'unit',
},
{
title: '关联报价商品ID、名称、规格、品类、品牌',
dataIndex: 'productId',
align: 'center',
render: (text, record) => `${text}/${record.productName}/${record.category}/${record.brand}`,
title: detailInfo?.orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
dataIndex: 'associatedProductId',
render: (text, record) => `${text}/${record.associatedProductName}/${record.associatedType || '无'}/${record.associatedCategory}/${record.associatedBrand}`,
},
]
),
......
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