Commit 0b5da9ca authored by XieZhiXiong's avatar XieZhiXiong

Merge branch 'dev' into test

parents d5cf9e87 bd59a776
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09 * @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-14 09:42:05 * @LastEditTime: 2020-12-14 15:33:42
* @Description: 维修商品抽屉组件 * @Description: 维修商品抽屉组件
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -135,6 +135,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -135,6 +135,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
}; };
}; };
flattened = [];
tableColumn: ColumnType<any>[] = [ tableColumn: ColumnType<any>[] = [
{ {
title: '订单号', title: '订单号',
...@@ -222,42 +224,59 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -222,42 +224,59 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
current: `${page}`, current: `${page}`,
pageSize: `${size}`, pageSize: `${size}`,
...searchVal, ...searchVal,
}) });
if (orderListRes) { if (orderListRes) {
// 获取对应订单列表的工作流类型 // 获取对应订单列表的工作流类型
// const payload = []; const payload = [];
// orderListRes.data.forEach(item => { orderListRes.data.forEach(item => {
// item.productDateilss.forEach(product => { item.productDateilss.forEach(product => {
// const atom = { const atom = {
// productId: product.productId, productId: product.productId,
// memberId: product.memberId, memberId: product.memberId,
// memberRoleId: product.memberRoleId, memberRoleId: product.memberRoleId,
// shopId: item.shopId, shopId: item.shopId,
// type, // 流程类型 type, // 流程类型
// }; };
// payload.push(atom); payload.push(atom);
// }); });
// }); });
// const processEnumRes: any = await PublicApi.postOrderGetProcessEnum({ const processEnumRes: any = await PublicApi.postOrderGetProcessEnum({
// list: payload, list: payload,
// }, { }, {
// ctlType: 'none', ctlType: 'none',
// }); });
// console.log('processEnumRes', processEnumRes) if (processEnumRes.code !== 1000) {
// if (processEnumRes.code !== 1000) { message.error('获取工作流枚举失败,请稍候再试');
// message.error('获取工作流枚举失败,请稍候再试'); return;
// return; }
// }
// const mockMap = {
// 1: 18,
// 2: 25,
// };
// 组装数据
let i = 0;
orderListRes.data.forEach(item => {
item.productDateilss.forEach(product => {
product.processEnum = processEnumRes.data[i].processEnum;
// product.processEnum = mockMap[Math.floor(Math.random()*2 + 1)];
i++;
// 防止重复添加数据
if (!this.flattened.find(flat => flat.id === product.id)) {
this.flattened.push({
...product,
orderNo: item.orderNo,
payInfoList: item.payInfoList,
});
}
});
});
this.setState({ this.setState({
dataSource: { dataSource: orderListRes,
data: orderListRes.data.map((item, index) => ({
...item,
// processEnum: processEnumRes.data[index].processEnum,
})),
totalCount: orderListRes.totalCount,
},
}); });
} }
this.setState({ loading: false }); this.setState({ loading: false });
...@@ -299,7 +318,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -299,7 +318,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 子表格选中行 // 子表格选中行
handleChildSelectChange = (record: any, selected: any, selectedRows: any) => { handleChildSelectChange = (record: any, selected: any, selectedRows: any) => {
console.log('selectedRows', selectedRows)
const { const {
childSelectedRowKeys, childSelectedRowKeys,
dataSource: { dataSource: {
...@@ -314,11 +332,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -314,11 +332,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
childArr.splice(childArr.findIndex((item: any) => item === record.id), 1); childArr.splice(childArr.findIndex((item: any) => item === record.id), 1);
} }
// const filtered = this.filterProductByProcessEnum(childArr, data); const fullData = this.findFullProductArr(childArr, this.flattened);
const filtered = this.filterProductByProcessEnum(fullData);
const filteredKeys = filtered.map(item => item.id);
if (!('checked' in this.props)) { if (!('checked' in this.props)) {
this.setState({ childSelectedRowKeys: childArr }); this.setState({ childSelectedRowKeys: filteredKeys });
} }
this.triggerChange(childArr); this.triggerChange(filteredKeys);
}; };
// 子表格选中所有行 // 子表格选中所有行
...@@ -340,11 +361,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -340,11 +361,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
childArr = childArr.filter((item: any) => !changeRows.some((e: any) => e.id === item)); childArr = childArr.filter((item: any) => !changeRows.some((e: any) => e.id === item));
} }
// const filtered = this.filterProductByProcessEnum(childArr, data); const fullData = this.findFullProductArr(childArr, this.flattened);
const filtered = this.filterProductByProcessEnum(fullData);
const filteredKeys = filtered.map(item => item.id);
if (!('checked' in this.props)) { if (!('checked' in this.props)) {
this.setState({ childSelectedRowKeys: childArr }); this.setState({ childSelectedRowKeys: filteredKeys });
} }
this.triggerChange(childArr); this.triggerChange(filteredKeys);
}; };
// 表格选中行 // 表格选中行
...@@ -362,17 +386,20 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -362,17 +386,20 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 第一步 判断selected true:选中,false,取消选中 // 第一步 判断selected true:选中,false,取消选中
if (selected) { if (selected) {
// 第二步,父Table选中,子Table全选中(全部整合到一起,然后去重) // 第二步,父Table选中,子Table全选中(全部整合到一起,然后去重)
childArr = Array.from(new Set([...setChildArr, ...childArr])); childArr = Array.from(new Set([...childArr, ...setChildArr]));
} else { } else {
// 第二步,父Table取消选中,子Table全取消选中(针对childArr,过滤掉取消选中的父Table下的所有子Table的 id) // 第二步,父Table取消选中,子Table全取消选中(针对childArr,过滤掉取消选中的父Table下的所有子Table的 id)
childArr = childArr.filter((item: any) => !setChildArr.some((e: any) => e === item)); childArr = childArr.filter((item: any) => !setChildArr.some((e: any) => e === item));
} }
const fullData = this.findFullProductArr(childArr, this.flattened);
const filtered = this.filterProductByProcessEnum(fullData);
const filteredKeys = filtered.map(item => item.id);
// const filtered = this.filterProductByProcessEnum(childArr, data);
if (!('checked' in this.props)) { if (!('checked' in this.props)) {
this.setState({ childSelectedRowKeys: childArr }); this.setState({ childSelectedRowKeys: filteredKeys });
} }
this.triggerChange(childArr); this.triggerChange(filteredKeys);
}; };
// 表格选中所有行 // 表格选中所有行
...@@ -390,14 +417,17 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -390,14 +417,17 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
setChildArr = [...setChildArr, ...item.productDateilss.map((item: any) => item.id)]; setChildArr = [...setChildArr, ...item.productDateilss.map((item: any) => item.id)];
}); });
// const filtered = this.filterProductByProcessEnum(setChildArr, data);
// 第一步判断 selected true:全选,false:取消全选 // 第一步判断 selected true:全选,false:取消全选
if (selected) { if (selected) {
// 第二步:父Table选中,子Table全选中,设置子Table 的 SelectedRowKeys // 第二步:父Table选中,子Table全选中,设置子Table 的 SelectedRowKeys
const fullData = this.findFullProductArr(setChildArr, this.flattened);
const filtered = this.filterProductByProcessEnum(fullData);
const filteredKeys = filtered.map(item => item.id);
if (!('checked' in this.props)) { if (!('checked' in this.props)) {
this.setState({ childSelectedRowKeys: setChildArr }); this.setState({ childSelectedRowKeys: filteredKeys });
} }
this.triggerChange(setChildArr); this.triggerChange(filteredKeys);
} else { } else {
// 第二步:父Table取消选中,子Table 全取消选中,设置子 Table 的 SelectedRowKeys // 第二步:父Table取消选中,子Table 全取消选中,设置子 Table 的 SelectedRowKeys
if (!('checked' in this.props)) { if (!('checked' in this.props)) {
...@@ -419,38 +449,37 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -419,38 +449,37 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
if (onConfirm) { if (onConfirm) {
// 从选中的子表格行 key,找到完整的信息 // 从选中的子表格行 key,找到完整的信息
const fullDate = []; const fullDate = [];
data.forEach(item => {
item.productDateilss.forEach(product => { this.flattened.forEach(product => {
if (childSelectedRowKeys.find(key => key === product.id)) { if (childSelectedRowKeys.find(key => key === product.id)) {
fullDate.push({ fullDate.push({
...product, ...product,
orderNo: item.orderNo, // 手动补全订单单号 orderNo: product.orderNo, // 手动补全订单单号
payList: payList:
item.payInfoList ? product.payInfoList ?
item.payInfoList.map(item => { product.payInfoList.map(item => {
const { payPrice, payTime, payWay, channel, ...rest } = item; const { payPrice, payTime, payWay, channel, ...rest } = item;
return { return {
payAmount: payPrice, payAmount: payPrice,
payTime: moment(payTime).format('YYYY-MM-DD HH:mm:ss'), payTime: moment(payTime).format('YYYY-MM-DD HH:mm:ss'),
payWay, payWay,
channel, channel,
payWayName: PAYWAY[payWay], payWayName: PAYWAY[payWay],
channelName: PAY_CHANNEL[channel], channelName: PAY_CHANNEL[channel],
...rest, ...rest,
} }
}) : }) :
[] []
, ,
// 计算已支付金额,采购单价 * 支付比例 累加 // 计算已支付金额,采购单价 * 支付比例 累加
payAmount: payAmount:
item.payInfoList ? product.payInfoList ?
item.payInfoList.reduce((prev, now) => { product.payInfoList.reduce((prev, now) => {
return +((product.price * product.purchaseCount * (now.payRatio / 100)).toFixed(2)) + prev; return +((product.price * product.purchaseCount * (now.payRatio / 100)).toFixed(2)) + prev;
}, 0) : }, 0) :
0 0
}); });
} }
});
}); });
onConfirm(fullDate); onConfirm(fullDate);
} }
...@@ -470,8 +499,19 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -470,8 +499,19 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
} }
}; };
findFullProductArr = (selectKeys, data) => {
const ret = [];
selectKeys.forEach(item => {
const current = data.find(dataItem => dataItem.id === item);
if (current) {
ret.push(current);
}
});
return ret;
};
// 过滤工作流不同的 商品 // 过滤工作流不同的 商品
filterProductByProcessEnum = (selectKeys, data) => { filterProductByProcessEnum = (data) => {
const first = data.length ? data[0] : null; const first = data.length ? data[0] : null;
if (!first) { if (!first) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-09 10:48:12 * @Date: 2020-11-09 10:48:12
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-18 17:31:42 * @LastEditTime: 2020-12-14 16:38:53
* @Description: 手动发货弹窗 * @Description: 手动发货弹窗
*/ */
import React from 'react'; import React from 'react';
...@@ -10,6 +10,8 @@ import { Modal } from 'antd'; ...@@ -10,6 +10,8 @@ import { Modal } from 'antd';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd'; import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { DatePicker } from '@formily/antd-components' import { DatePicker } from '@formily/antd-components'
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api';
import { schema } from './schema'; import { schema } from './schema';
const modalFormActions = createFormActions(); const modalFormActions = createFormActions();
...@@ -42,6 +44,51 @@ const VerifyModal: React.FC<VerifyModalProps> = ({ ...@@ -42,6 +44,51 @@ const VerifyModal: React.FC<VerifyModalProps> = ({
onSubmit(values); onSubmit(values);
} }
}; };
// 获取发货地址
const fetchShipperAddress = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getLogisticsSelectListShipperAddress().then(res => {
if (res.code === 1000) {
const options =
res.data ?
res.data.map(item => ({
label: `${item.fullAddress}/${item.shipperName}/${item.phone}`,
value: item.id,
...item,
})) :
[];
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
// 获取物流公司
const fetchLogisticsCompany = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getLogisticsSelectListCompany({
cooperateType: '2', // 1-平台物流服务商,2-商户合作物流公司
}).then(res => {
if (res.code === 1000) {
const options =
res.data ?
res.data.map(item => ({
label: item.name,
value: item.id,
})) :
[];
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
return ( return (
<Modal <Modal
...@@ -54,7 +101,8 @@ const VerifyModal: React.FC<VerifyModalProps> = ({ ...@@ -54,7 +101,8 @@ const VerifyModal: React.FC<VerifyModalProps> = ({
> >
<NiceForm <NiceForm
effects={($, { setFieldState }) => { effects={($, { setFieldState }) => {
useAsyncSelect('deliveryAddress', fetchShipperAddress, ['label', 'value']);
useAsyncSelect('logisticsName', fetchLogisticsCompany, ['label', 'value']);
}} }}
components={{ components={{
DatePicker, DatePicker,
......
...@@ -17,17 +17,15 @@ export const schema: ISchema = { ...@@ -17,17 +17,15 @@ export const schema: ISchema = {
labelAlign: 'top', labelAlign: 'top',
}, },
properties: { properties: {
address: { deliveryAddress: {
type: 'string', type: 'string',
title: '发货地址', title: '发货地址',
enum: [ enum: [],
],
'x-component-props': { 'x-component-props': {
placeholder: '请选择', placeholder: '请选择',
}, },
}, },
sendTime: { deliveryTime: {
type: 'string', type: 'string',
title: '发货时间', title: '发货时间',
'x-component': 'DatePicker', 'x-component': 'DatePicker',
...@@ -38,7 +36,7 @@ export const schema: ISchema = { ...@@ -38,7 +36,7 @@ export const schema: ISchema = {
style: { width: '100%' }, style: { width: '100%' },
}, },
}, },
codeNo: { logisticsOrderNo: {
type: 'string', type: 'string',
title: '发货单号', title: '发货单号',
required: true, required: true,
...@@ -46,13 +44,11 @@ export const schema: ISchema = { ...@@ -46,13 +44,11 @@ export const schema: ISchema = {
placeholder: '请选择', placeholder: '请选择',
}, },
}, },
company: { logisticsName: {
type: 'string', type: 'string',
title: '物流公司', title: '物流公司',
required: true, required: true,
enum: [ enum: [],
],
'x-component-props': { 'x-component-props': {
placeholder: '请选择', placeholder: '请选择',
}, },
......
...@@ -277,3 +277,22 @@ export const REFUND_OUTER_STATUS_TAG_MAP = { ...@@ -277,3 +277,22 @@ export const REFUND_OUTER_STATUS_TAG_MAP = {
[REFUND_OUTER_STATUS_NOT_RECEIVED]: 'warning', [REFUND_OUTER_STATUS_NOT_RECEIVED]: 'warning',
[REFUND_OUTER_STATUS_RECEIVED]: 'success', [REFUND_OUTER_STATUS_RECEIVED]: 'success',
}; };
// 工作流相关
/**
* 售后退货外部流转
*/
export const RETURN_GOODS_OUTER_DELIVERY = 18;
/**
* 售后换货外部流转
*/
export const EXCHANGE_GOODS_OUTER_DELIVERY = 20;
/**
* 售后换货手工发货
*/
export const EXCHANGE_GOODS_MANUAL_DELIVERY = 30;
/**
* 售后退货手工发货
*/
export const RETURN_GOODS_MANUAL_DELIVERY = 31;
\ No newline at end of file
...@@ -541,6 +541,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({ ...@@ -541,6 +541,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
<GoodsDrawer <GoodsDrawer
title="选择换货商品" title="选择换货商品"
type={2}
visible={visibleGoodsDrawer} visible={visibleGoodsDrawer}
fetchOrderList={getOrderList} fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)} onClose={() => setVisibleGoodsDrawer(false)}
......
...@@ -370,6 +370,7 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -370,6 +370,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
</Card> </Card>
<GoodsDrawer <GoodsDrawer
type={4}
visible={visibleDrawer} visible={visibleDrawer}
fetchOrderList={getOrderList} fetchOrderList={getOrderList}
onClose={() => setVisibleDrawer(false)} onClose={() => setVisibleDrawer(false)}
......
...@@ -6,6 +6,7 @@ import { SettingOutlined } from '@ant-design/icons'; ...@@ -6,6 +6,7 @@ import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import ManualDeliveryModal from '../../components/ManualDeliveryModal'; import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo'; import DetailInfo from '../components/DetailInfo';
import { RETURN_GOODS_MANUAL_DELIVERY } from '../../constants';
const ReturnPrDeliverVerify: React.FC = () => { const ReturnPrDeliverVerify: React.FC = () => {
const { id } = usePageStatus(); const { id } = usePageStatus();
...@@ -36,14 +37,18 @@ const ReturnPrDeliverVerify: React.FC = () => { ...@@ -36,14 +37,18 @@ const ReturnPrDeliverVerify: React.FC = () => {
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={() => ( headExtra={info => (
<Button <>
type="default" {(info && info.taskType === RETURN_GOODS_MANUAL_DELIVERY) && (
icon={<SettingOutlined />} <Button
onClick={() => handleVisible(true)} type="default"
> icon={<SettingOutlined />}
手工退货发货 onClick={() => handleVisible(true)}
</Button> >
手工退货发货
</Button>
)}
</>
)} )}
/> />
......
...@@ -63,7 +63,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -63,7 +63,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [unsaved, setUnsaved] = useState(false); const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false); const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false); const [submitLoading, setSubmitLoading] = useState(false);
const [returnGoodsLoading, setReturnGoodsLoading] = useState(false);
const [orderInfo, setOrderInfo] = useState<OrderInfo>(null); const [orderInfo, setOrderInfo] = useState<OrderInfo>(null);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false); const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false); const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false);
...@@ -153,7 +152,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -153,7 +152,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
// 缺 // 缺
{ {
title: '已退款金额', title: '已退款金额',
dataIndex: 'returnCount2', dataIndex: 'refunded',
align: 'center', align: 'center',
}, },
]; ];
...@@ -248,47 +247,29 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -248,47 +247,29 @@ const ReturnForm: React.FC<BillsFormProps> = ({
, ,
...rest, ...rest,
}); });
}
}).finally(() => {
setInfoLoading(false);
});
};
// 获取退货明细列表
const getReturnGoods = () => {
if (!id) {
return;
}
setReturnGoodsLoading(true);
PublicApi.getAsReturnGoodsPageReturnedGoods({
returnId: id,
current: `${1}`,
pageSize: `${99999}`,
}).then(res => {
if (res.code === 1000) {
setReturnGoodsList(res.data);
setReturnGoodsList({ setReturnGoodsList({
data: res.data.data.map(item => ({ data: goodsDetailList.map(item => ({
...item, ...item,
returnedCount:item.purchaseCount || 0, // 已退货数量,这里取 采购数量判断即可 returnedCount: item.purchaseCount || 0, // 已退货数量,这里取 采购数量判断即可
extraData: { extraData: {
id: item.orderRecordId,
returnReason: item.returnReason, returnReason: item.returnReason,
payList: item.payList, payList: item.payList || [],
id: item.orderRecordId || [],
taskType,
}, },
})), })),
totalCount: res.data.totalCount, totalCount: goodsDetailList.length,
}); });
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []); setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
} }
}).finally(() => { }).finally(() => {
setReturnGoodsLoading(false); setInfoLoading(false);
}); });
}; };
useEffect(() => { useEffect(() => {
getDetailInfo(); getDetailInfo();
getReturnGoods();
}, []); }, []);
const handleAddGoods = () => { const handleAddGoods = () => {
...@@ -405,7 +386,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -405,7 +386,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}), }),
isNeedReturn: 1, isNeedReturn: 1,
})), })),
taskType: 18, // taskType: returnGoodsList[0].taskType,
taskType: 31,
}; };
PublicApi.postAsReturnGoodsSave(payload) PublicApi.postAsReturnGoodsSave(payload)
...@@ -490,6 +472,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -490,6 +472,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
id: item.id, id: item.id,
returnReason: '', returnReason: '',
payList: item.payList, payList: item.payList,
taskType: item.processEnum,
}, },
}; };
value.push(atom); value.push(atom);
...@@ -541,7 +524,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -541,7 +524,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
); );
return ( return (
<Spin spinning={infoLoading || returnGoodsLoading}> <Spin spinning={infoLoading}>
<PageHeaderWrapper <PageHeaderWrapper
style={{ style={{
padding: 24, padding: 24,
...@@ -575,14 +558,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -575,14 +558,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
<NiceForm <NiceForm
initialValues={{ initialValues={{
...detailInfo, ...detailInfo,
returnGoodsList: returnGoodsList.data.map(item => ({ returnGoodsList: returnGoodsList.data,
...item,
extraData: {
returnReason: item.returnReason,
payList: item.payList || [],
id: item.orderRecordId || [],
},
})),
}} }}
expressionScope={{ expressionScope={{
TableAddButton, TableAddButton,
......
...@@ -188,7 +188,10 @@ const QuotaMenage: React.FC = () => { ...@@ -188,7 +188,10 @@ const QuotaMenage: React.FC = () => {
render: (text, record) => ( render: (text, record) => (
<> <>
{/* 授信状态为 正常 时可申请调额 */} {/* 授信状态为 正常 时可申请调额 */}
{record.status === CREDIT_STATUS_NORMAL && ( {(
record.status === CREDIT_STATUS_NORMAL &&
record.isCanApply
) && (
<Button <Button
type="link" type="link"
onClick={() => handleAdjustment(record)} onClick={() => handleAdjustment(record)}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47 * @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 16:00:20 * @LastEditTime: 2020-12-14 16:55:09
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { Modal } from 'antd'; import { Modal } from 'antd';
...@@ -217,6 +217,8 @@ const fetchOrderPurchaseReceiptAddList = async (params: any) => { ...@@ -217,6 +217,8 @@ const fetchOrderPurchaseReceiptAddList = async (params: any) => {
data: res.data.data.map(item => ({ data: res.data.data.map(item => ({
...item, ...item,
memberName: item.supplyMembersName, memberName: item.supplyMembersName,
membersId: item.supplyMembersId,
membersRoleId: item.supplyMembersRoleId,
})), })),
total: res.data.totalCount, total: res.data.totalCount,
}; };
...@@ -234,6 +236,8 @@ const getOrderSalesInvoiceOrderList = async (params: any) => { ...@@ -234,6 +236,8 @@ const getOrderSalesInvoiceOrderList = async (params: any) => {
data: res.data.data.map(item => ({ data: res.data.data.map(item => ({
...item, ...item,
memberName: item.memberName, memberName: item.memberName,
membersId: item.memberId,
membersRoleId: item.memberRoleId,
})), })),
total: res.data.totalCount, total: res.data.totalCount,
}; };
...@@ -481,7 +485,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -481,7 +485,7 @@ export const useBusinessEffects = (context, actions) => {
const { originAsyncData = [] } = fieldState; const { originAsyncData = [] } = fieldState;
const current = originAsyncData.find(item => item.id === fieldState.value); const current = originAsyncData.find(item => item.id === fieldState.value);
const params = getParams(fieldState.value); const params = getParams(fieldState.value);
if (current) { if (current) {
linkage.value('invoicesTypeCode', current.number); linkage.value('invoicesTypeCode', current.number);
} }
...@@ -493,8 +497,11 @@ export const useBusinessEffects = (context, actions) => { ...@@ -493,8 +497,11 @@ export const useBusinessEffects = (context, actions) => {
if (fieldState.name === 'invoicesTypeId') { if (fieldState.name === 'invoicesTypeId') {
const invoicesTypeIdState = getFieldState('invoicesTypeId'); const invoicesTypeIdState = getFieldState('invoicesTypeId');
console.log('invoicesTypeIdState2', invoicesTypeIdState)
if (invoicesTypeIdState.value) { if (invoicesTypeIdState.value) {
const current = invoicesTypeIdState.originAsyncData.find(item => item.id === invoicesTypeIdState.value); const current = invoicesTypeIdState.originAsyncData.find(item => item.id === invoicesTypeIdState.value);
if (current) { if (current) {
linkage.value('invoicesTypeCode', current.number); linkage.value('invoicesTypeCode', current.number);
} }
...@@ -518,6 +525,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -518,6 +525,8 @@ export const useBusinessEffects = (context, actions) => {
// 设置单据公用的数据相关 // 设置单据公用的数据相关
setFieldValue('memberName', first ? first.memberName : ''); setFieldValue('memberName', first ? first.memberName : '');
setFieldValue('membersId', first ? first.membersId : '');
setFieldValue('membersRoleId', first ? first.membersRoleId : '');
setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : ''); setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : '');
// 以下数据只用于收集,不用于展示 // 以下数据只用于收集,不用于展示
......
...@@ -224,6 +224,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -224,6 +224,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
} }
const { const {
supplyMembersName, supplyMembersName,
supplyMembersId,
supplyMembersRoleId,
deliveryAddresId, deliveryAddresId,
orderNo, orderNo,
deliveryAddressInfo, deliveryAddressInfo,
...@@ -239,6 +241,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -239,6 +241,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
id: +relevanceInvoicesId, id: +relevanceInvoicesId,
deliveryAddresId: +deliveryAddresId, deliveryAddresId: +deliveryAddresId,
memberName: supplyMembersName, memberName: supplyMembersName,
membersId: supplyMembersId,
membersRoleId: supplyMembersRoleId,
fullAddress: deliveryAddressInfo.fullAddress || '', fullAddress: deliveryAddressInfo.fullAddress || '',
receiverName: deliveryAddressInfo.receiverName || '', receiverName: deliveryAddressInfo.receiverName || '',
phone: deliveryAddressInfo.phone || '', phone: deliveryAddressInfo.phone || '',
...@@ -265,6 +269,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -265,6 +269,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
} }
const { const {
createMemberName, createMemberName,
createMemberId,
createRoleId,
deliveryAddresId, deliveryAddresId,
orderNo, orderNo,
deliveryAddressInfo, deliveryAddressInfo,
...@@ -280,6 +286,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -280,6 +286,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
id: +relevanceInvoicesId, id: +relevanceInvoicesId,
deliveryAddresId: +deliveryAddresId, deliveryAddresId: +deliveryAddresId,
memberName: createMemberName, memberName: createMemberName,
membersId: createMemberId,
membersRoleId: createRoleId,
fullAddress: deliveryAddressInfo.fullAddress || '', fullAddress: deliveryAddressInfo.fullAddress || '',
receiverName: deliveryAddressInfo.receiverName || '', receiverName: deliveryAddressInfo.receiverName || '',
phone: deliveryAddressInfo.phone || '', phone: deliveryAddressInfo.phone || '',
...@@ -716,6 +724,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -716,6 +724,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
transport, transport,
invoicesDetailsRequests = [], invoicesDetailsRequests = [],
memberName, memberName,
membersId,
membersRoleId,
...rest ...rest
} = value; } = value;
const newInvoicesDetailsRequests = invoicesDetailsRequests.map(({ const newInvoicesDetailsRequests = invoicesDetailsRequests.map(({
...@@ -738,6 +748,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -738,6 +748,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
} }
PublicApi.postOrderPurchaseReceiptAdd({ PublicApi.postOrderPurchaseReceiptAdd({
...rest, ...rest,
invoicesTypeCode: invoicesTypeCode,
orderNo: orderNo[0].orderNo, orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id, relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime, transactionTime: newTransactionTime,
...@@ -766,6 +777,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -766,6 +777,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
}; };
}), }),
supplyMembersName: memberName, supplyMembersName: memberName,
supplyMembersId: membersId,
supplyMembersRoleId: membersRoleId,
}) })
.then(res => { .then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
...@@ -837,6 +850,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -837,6 +850,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
} }
PublicApi.postOrderSalesInvoiceOrder({ PublicApi.postOrderSalesInvoiceOrder({
...rest, ...rest,
invoicesTypeCode: invoicesTypeCode,
orderNo: orderNo[0].orderNo, orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id, relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime, transactionTime: newTransactionTime,
...@@ -864,7 +878,11 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -864,7 +878,11 @@ const BillsForm: React.FC<BillsFormProps> = ({
productCount: goodsCount, productCount: goodsCount,
}; };
}), }),
createMemberName: memberName, // 后台说 不管是 采购入库单,还是 销售发货单 都用这三个字段
// createMemberName: memberName,
supplyMembersName: memberName,
supplyMembersId: membersId,
supplyMembersRoleId: membersRoleId,
}) })
.then(res => { .then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
......
...@@ -377,6 +377,16 @@ export const addBillSchema: ISchema = { ...@@ -377,6 +377,16 @@ export const addBillSchema: ISchema = {
type: 'boolean', type: 'boolean',
display: false, display: false,
}, },
// 会员id,可以是采购会员id、销售会员id
membersId: {
type: 'boolean',
display: false,
},
// 会员角色id,可以是采购会员角色id、销售会员角色id
membersRoleId: {
type: 'boolean',
display: false,
},
}, },
}, },
}, },
......
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