Commit ed793325 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'dev' into test

parents 54334763 a8260a1d
...@@ -72,7 +72,7 @@ export const productModalSchema: ISchema = { ...@@ -72,7 +72,7 @@ export const productModalSchema: ISchema = {
type: 'string', type: 'string',
'x-component': 'ModalSearch', 'x-component': 'ModalSearch',
'x-component-props': { 'x-component-props': {
placeholder: '请输入商品名称/ID', placeholder: '请输入商品名称',
align: 'flex-left', align: 'flex-left',
}, },
}, },
......
...@@ -72,7 +72,7 @@ export const productModalSchema: ISchema = { ...@@ -72,7 +72,7 @@ export const productModalSchema: ISchema = {
type: 'string', type: 'string',
'x-component': 'ModalSearch', 'x-component': 'ModalSearch',
'x-component-props': { 'x-component-props': {
placeholder: '请输入商品名称/ID', placeholder: '请输入商品名称',
align: 'flex-left', align: 'flex-left',
}, },
}, },
......
...@@ -33,7 +33,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -33,7 +33,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [form] = Form.useForm() const [form] = Form.useForm()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false) const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [operationType, setOprationType] = useState<string>(OPERATION_TYPE.list) // 操作类型:list:显示已选列表;select:选择列表 const [operationType, setOprationType] = useState<string>(OPERATION_TYPE.list) // 操作类型:list:显示已选列表;select:选择列表
let [isHighSearch, setIsHighSearch] = useState(false) const [isHighSearch, setIsHighSearch] = useState(false)
const { templateid, categoryid, goodsList = [], templateType } = props const { templateid, categoryid, goodsList = [], templateType } = props
const [current, setCurrent] = useState<number>(1) const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10) const [pageSize, setPageSize] = useState<number>(10)
...@@ -49,33 +49,27 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -49,33 +49,27 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [categoryResponseList, setCategoryResponseList] = useState<any>([]) const [categoryResponseList, setCategoryResponseList] = useState<any>([])
const [noSelectBrands, setNoSelectBrands] = useState<any[]>([]) const [noSelectBrands, setNoSelectBrands] = useState<any[]>([])
const changeNewProps = (key: string, data: any) => {
const newProps = { ...props }
newProps[key] = data
setNewProps(newProps)
}
useEffect(() => { useEffect(() => {
fetchBrandsList() fetchBrandsList()
fetchCategoryList() fetchCategoryList()
}, []) }, [])
const fetchCategoryList = () => { const fetchCategoryList = () => {
let param = { const param: any = {
categoryId: categoryid, categoryId: categoryid,
templateId: templateid templateId: templateid
} }
setSpinLoading(true)
//@ts-ignore
PublicApi.getTemplatePlatformFindCategoryList(param).then(res => { PublicApi.getTemplatePlatformFindCategoryList(param).then(res => {
if (res.code === 1000) {
const data = res.data const data = res.data
setCategoryResponseList(data.categoryBOList || []) setCategoryResponseList(data.categoryBOList || [])
setSpinLoading(false) }
}) })
} }
const fetchBrandsList = () => { const fetchBrandsList = () => {
let param = { const param: any = {
type: 0, type: 0,
templateId: templateid, templateId: templateid,
categoryId: categoryid, categoryId: categoryid,
...@@ -83,7 +77,6 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -83,7 +77,6 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
pageSize: 100 pageSize: 100
} }
//@ts-ignore
PublicApi.getTemplatePlatformFindBrandList(param).then((res: any) => { PublicApi.getTemplatePlatformFindBrandList(param).then((res: any) => {
if (res.code === 1000) { if (res.code === 1000) {
const dataInfo = res.data const dataInfo = res.data
...@@ -98,7 +91,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -98,7 +91,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}, [filterParam, current]) }, [filterParam, current])
const fetchGoodsList = () => { const fetchGoodsList = () => {
let param = { let param: any = {
type: 0, type: 0,
templateId: templateid, templateId: templateid,
categoryId: categoryid, categoryId: categoryid,
...@@ -115,13 +108,14 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -115,13 +108,14 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
getFn = PublicApi.getTemplateShopFindGoodsList getFn = PublicApi.getTemplateShopFindGoodsList
} }
//@ts-ignore setSpinLoading(true)
getFn(param).then((res: any) => { getFn(param).then((res: any) => {
if (res.code === 1000) { if (res.code === 1000) {
const dataInfo = res.data const dataInfo = res.data
setTotalCount(dataInfo.totalCount) setTotalCount(dataInfo.totalCount)
setNoSelectGoods(dataInfo.data || []) setNoSelectGoods(dataInfo.data || [])
} }
setSpinLoading(false)
}) })
} }
...@@ -154,7 +148,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -154,7 +148,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handleSearch = () => { const handleSearch = () => {
setCurrent(1) setCurrent(1)
let param = filterProps(form.getFieldsValue()) const param = filterProps(form.getFieldsValue())
setFilterParam(param) setFilterParam(param)
} }
...@@ -228,13 +222,13 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -228,13 +222,13 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const saveGoods = () => { const saveGoods = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let param: any = { const param: any = {
templateId: templateid, templateId: templateid,
categoryId: categoryid, categoryId: categoryid,
} }
let ids: number[] = [] const ids: number[] = []
for (let item of selectGoodsList) { for (const item of selectGoodsList) {
ids.push(item.goodsId) ids.push(item.goodsId)
} }
param.goodsIds = ids param.goodsIds = ids
...@@ -258,8 +252,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -258,8 +252,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handleChangeOprationType = (type: string) => { const handleChangeOprationType = (type: string) => {
setOprationType(type) setOprationType(type)
let keys: number[] = [] const keys: number[] = []
for (let item of selectGoodsList) { for (const item of selectGoodsList) {
keys.push(item.goodsId) keys.push(item.goodsId)
} }
setGoodsIds(keys) setGoodsIds(keys)
...@@ -314,7 +308,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -314,7 +308,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
</Col> </Col>
<Col> <Col>
<Button onClick={() => setIsHighSearch(isHighSearch = !isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button> <Button onClick={() => setIsHighSearch(!isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
</Col> </Col>
<Col> <Col>
<Button onClick={() => handleReset()}>重置</Button> <Button onClick={() => handleReset()}>重置</Button>
...@@ -336,7 +330,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -336,7 +330,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
> >
<Select placeholder="品类" style={{ width: 180 }}> <Select placeholder="品类" style={{ width: 180 }}>
{ {
categoryResponseList.map((item, index) => <Select.Option kye={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>) categoryResponseList.map((item, index) => <Select.Option key={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>)
} }
</Select> </Select>
</Form.Item> </Form.Item>
...@@ -348,7 +342,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -348,7 +342,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
> >
<Select placeholder="品牌" style={{ width: 180 }}> <Select placeholder="品牌" style={{ width: 180 }}>
{ {
noSelectBrands.map((item, index) => (<Select.Option kye={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>)) noSelectBrands.map((item, index) => (<Select.Option key={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>))
} }
</Select> </Select>
</Form.Item> </Form.Item>
......
...@@ -13,7 +13,9 @@ import ProcessProducts from '../../components/ProcessProducts'; ...@@ -13,7 +13,9 @@ import ProcessProducts from '../../components/ProcessProducts';
import ProcessOrder from '../../components/ProcessOrder'; import ProcessOrder from '../../components/ProcessOrder';
import {WrapUploadFile} from '../../components/UploadFile'; import {WrapUploadFile} from '../../components/UploadFile';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import ProcessDetail from '../../components/ProcessDetail' import ProcessDetail from '../../components/ProcessDetail';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
/* /*
* @Author: Bill * @Author: Bill
* @Date: 2020-10-12 11:36:38 * @Date: 2020-10-12 11:36:38
...@@ -33,7 +35,16 @@ const Add: React.FC<{}> = () => { ...@@ -33,7 +35,16 @@ const Add: React.FC<{}> = () => {
// 加工订单 modal 框 // 加工订单 modal 框
const [modalOrderVisible, setModalOrderVisible] = useState<boolean>(false); const [modalOrderVisible, setModalOrderVisible] = useState<boolean>(false);
/* --------以下是 element-------- */ const [rowSelection, selectRowCtl] = useRowSelectionTable({
customKey: 'fullId',
extendsSelection: {
getCheckboxProps: record => ({
disabled: record.purchaseCount - (record.processNum || 0) <= 0,
}),
}
});
const [productRowSelection, productSelectRowCtl] = useRowSelectionTable({ customKey: 'id' });
// 选择加工企业 modal 层 // 选择加工企业 modal 层
const connectProduct = ( const connectProduct = (
<div> <div>
...@@ -209,10 +220,9 @@ const Add: React.FC<{}> = () => { ...@@ -209,10 +220,9 @@ const Add: React.FC<{}> = () => {
formActions.setFieldValue('Tabs.tab-1.layout.processName', name); formActions.setFieldValue('Tabs.tab-1.layout.processName', name);
formActions.setFieldValue('Tabs.tab-1.layout.processMemberId', memberId); formActions.setFieldValue('Tabs.tab-1.layout.processMemberId', memberId);
formActions.setFieldValue('Tabs.tab-1.layout.processRoleId', roleId); formActions.setFieldValue('Tabs.tab-1.layout.processRoleId', roleId);
} }
const getChangeRows = (rows, primaryKey) => { const getChangeRows = (rows, primaryKey: string) => {
const {selectedRowKeys, selectRow} = rows; const {selectedRowKeys, selectRow} = rows;
const currentList = formActions.getFieldValue('Tabs.tab-2.layout.someLists'); const currentList = formActions.getFieldValue('Tabs.tab-2.layout.someLists');
// 首先去除掉没有在selectedRowkeys 的那些数据 // 首先去除掉没有在selectedRowkeys 的那些数据
...@@ -238,8 +248,8 @@ const Add: React.FC<{}> = () => { ...@@ -238,8 +248,8 @@ const Add: React.FC<{}> = () => {
* 加工商品Modal框 行勾选回调 * 加工商品Modal框 行勾选回调
* @param rows * @param rows
*/ */
const processProductSelected = (rows) => { const processProductSelected = () => {
const newRows = getChangeRows(rows, "id") const newRows = getChangeRows(productSelectRowCtl, "id")
formActions.setFieldValue('Tabs.tab-2.layout.someLists', newRows) formActions.setFieldValue('Tabs.tab-2.layout.someLists', newRows)
} }
...@@ -247,8 +257,8 @@ const Add: React.FC<{}> = () => { ...@@ -247,8 +257,8 @@ const Add: React.FC<{}> = () => {
* 加工订单Modal框 行勾选回调 * 加工订单Modal框 行勾选回调
* @param row * @param row
*/ */
const processOrderOnok = (rows) => { const processOrderOnok = () => {
const newRows = getChangeRows(rows, "fullId") const newRows = getChangeRows(selectRowCtl, "fullId")
formActions.setFieldValue('Tabs.tab-2.layout.someLists', newRows) formActions.setFieldValue('Tabs.tab-2.layout.someLists', newRows)
} }
...@@ -257,7 +267,6 @@ const Add: React.FC<{}> = () => { ...@@ -257,7 +267,6 @@ const Add: React.FC<{}> = () => {
*/ */
const handleSubmit = (values: any) => { const handleSubmit = (values: any) => {
console.log(values) console.log(values)
setSubmitLoading(true);
const SELF_MENTION = 2; // 自提 const SELF_MENTION = 2; // 自提
const { const {
deliveryDate, deliveryDate,
...@@ -277,11 +286,12 @@ const Add: React.FC<{}> = () => { ...@@ -277,11 +286,12 @@ const Add: React.FC<{}> = () => {
const isSomeFieldNotFill = someLists.some((item) => { const isSomeFieldNotFill = someLists.some((item) => {
return typeof item.processNum === 'undefined' || typeof item.processUnitPrice === 'undefined' return typeof item.processNum === 'undefined' || typeof item.processUnitPrice === 'undefined'
}) })
if(isSomeFieldNotFill) { if(isSomeFieldNotFill) {
message.error("通知单明细中有加工商品的加工数量或加工单价未填写"); message.error("通知单明细中有加工商品的加工数量或加工单价未填写");
return return
} }
setSubmitLoading(true);
const detailList = someLists.map((item) => { const detailList = someLists.map((item) => {
return { return {
orederNo: item.orderNo, // 如果是商品加工,那么他没有订单号 orederNo: item.orderNo, // 如果是商品加工,那么他没有订单号
...@@ -356,11 +366,22 @@ const Add: React.FC<{}> = () => { ...@@ -356,11 +366,22 @@ const Add: React.FC<{}> = () => {
} }
} }
/**
* 移除数据, 这里有个bug,移除数据时,对应的modal的rowSelection 没有跟着删除
* 尝试从父组件给rowSelection
* @param id
*/
const handleRemoveRow = (id: number) => { const handleRemoveRow = (id: number) => {
const currentList = formActions.getFieldValue('Tabs.tab-2.layout.someLists'); const currentList = formActions.getFieldValue('Tabs.tab-2.layout.someLists');
const primaryKey = activeSource === '加工订单' ? 'fullId' : 'id' const primaryKey = activeSource === '加工订单' ? 'fullId' : 'id'
const newList = currentList.filter((item) => item[primaryKey] !== id); const newList = currentList.filter((item) => item[primaryKey] !== id);
formActions.setFieldValue('Tabs.tab-2.layout.someLists', newList) formActions.setFieldValue('Tabs.tab-2.layout.someLists', newList)
const newSelectedKeys = newList.map((item) => item.id);
if(activeSource === '加工订单') {
selectRowCtl.setSelectedRowKeys(newSelectedKeys);
} else {
productSelectRowCtl.setSelectedRowKeys(newSelectedKeys)
}
} }
return ( return (
...@@ -406,12 +427,14 @@ const Add: React.FC<{}> = () => { ...@@ -406,12 +427,14 @@ const Add: React.FC<{}> = () => {
visible={modalProductVisible} visible={modalProductVisible}
cancel={() => setModalProductVisible(false)} cancel={() => setModalProductVisible(false)}
onOk={processProductSelected} onOk={processProductSelected}
rowSelection={productRowSelection}
></ProcessProducts> ></ProcessProducts>
<ProcessOrder <ProcessOrder
visible={modalOrderVisible} visible={modalOrderVisible}
cancel={() => setModalOrderVisible(false)} cancel={() => setModalOrderVisible(false)}
onOk={processOrderOnok} onOk={processOrderOnok}
rowSelection={rowSelection}
> >
</ProcessOrder> </ProcessOrder>
</Card> </Card>
......
...@@ -29,16 +29,56 @@ const ADD_PROCESS_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills ...@@ -29,16 +29,56 @@ const ADD_PROCESS_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills
const ADD_DELIVERY_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills/add'; const ADD_DELIVERY_PATH = '/memberCenter/tranactionAbility/stockSellStorage/bills/add';
const ADD_LOGISTICS_PATH = '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add'; const ADD_LOGISTICS_PATH = '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/add';
const SERVICE_MAPS = { const SERVICE_MAPS = {
[PENDING_ADD_PROCESS_PATH]: PublicApi.getEnhanceSupplierToBeAddStorageList, [PENDING_ADD_PROCESS_PATH]: PublicApi.getEnhanceSupplierToBeAddStorageList,
[PROCESSING_INVOICE_TO_BE_ADD_PATH]: PublicApi.getEnhanceProcessToBeAddDeliveryList, [PROCESSING_INVOICE_TO_BE_ADD_PATH]: PublicApi.getEnhanceProcessToBeAddDeliveryList,
[PENDING_ADD_LOGISTICS_PATH]: PublicApi.getEnhanceProcessToBeAddLogisticsList, [PENDING_ADD_LOGISTICS_PATH]: PublicApi.getEnhanceProcessToBeAddLogisticsList,
///enhance/process/toBeDelivery/list
[PENDING_DELIVERD_PATH]: PublicApi.getEnhanceProcessToBeDeliveryList, [PENDING_DELIVERD_PATH]: PublicApi.getEnhanceProcessToBeDeliveryList,
[PENDING_RECEIPT_PATH]: PublicApi.getEnhanceProcessToBeConfirmReceiptList, [PENDING_RECEIPT_PATH]: PublicApi.getEnhanceProcessToBeConfirmReceiptList,
[ASSIGN_PENDING_RECEIVE]: PublicApi.getEnhanceSupplierToBeReceiveList [ASSIGN_PENDING_RECEIVE]: PublicApi.getEnhanceSupplierToBeReceiveList
} }
/**
* 记录 outerStatus 还有 innerStatus, 在不同状态的时候会渲染不同的组件
* 例子 3_15 此时 状态为待审核加工发货单, 那么对应的columns 的render组件是 <a>审核</a>
*/
enum OuterAndInnerStatus {
pending_add_process = '待新增加工发货单',
/**
* 待审核加工发货单
*/
pending_exam_add_process = '3_15',
/**
* 待新增物流单
*/
pending_add_logistics = '4_16',
/**
* 待确认物流单
*/
pending_confirm_logistics = '待确认物流单',
/**
* 待确认发货
*/
pending_confirm_deliver = '5_18',
/**
* 待新增加工入库单
*/
pending_add_process_in_warehouse = '6_18',
/**
* 待审核加工入库单
*/
pending_exam_process_in_warehouse = '6_20',
/**
* 待确认收货
*/
pending_confirm_receive = '7_21',
/**
* 待确认回单
*/
pending_confirm_receipt = '8_22'
}
enum ExamType { enum ExamType {
delivery = "deliver", //加工发货单 delivery = "deliver", //加工发货单
warehouseReceipt = 'warehouseReceipt', // 加工入库单 warehouseReceipt = 'warehouseReceipt', // 加工入库单
...@@ -86,12 +126,14 @@ const processStock: React.FC<{}> = () => { ...@@ -86,12 +126,14 @@ const processStock: React.FC<{}> = () => {
{ {
title: () => pathname == PENDING_ADD_PROCESS_PATH ? '入库单号' : '发货单号', title: () => pathname == PENDING_ADD_PROCESS_PATH ? '入库单号' : '发货单号',
dataIndex: 'deliveryNo', dataIndex: 'deliveryNo',
render: (text) => { render: (text, record: any) => {
if(!text) { if(!text) {
return null return null
} }
const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail';
const type = pathname == PENDING_ADD_PROCESS_PATH ? DOC_TYPE_PROCESS_RECEIPT : DOC_TYPE_PROCESS_INVOICE
return ( return (
<EyePreview url="/" >{text}</EyePreview> <EyePreview url={`${url}?relevanceInvoicesId=${record.id}&invoicesTypeId=${type}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`} >{text}</EyePreview>
) )
} }
}, },
...@@ -102,62 +144,58 @@ const processStock: React.FC<{}> = () => { ...@@ -102,62 +144,58 @@ const processStock: React.FC<{}> = () => {
dataIndex: 'action', dataIndex: 'action',
render: (text, record: any) => { render: (text, record: any) => {
// 这里暂时不知道status的状态, 先用内部状态判断, 审核的先不处理, 感觉应该用入库单号去判断吧 // 这里暂时不知道status的状态, 先用内部状态判断, 审核的先不处理, 感觉应该用入库单号去判断吧
const outerStatus = record.outerStatus;
const innerStatus = record.innerStatus;
const MAP = { const MAP = {
// outerStatus = 5, innerStatus = 18 [OuterAndInnerStatus.pending_add_process]: (
'待确认发货': <Link to={`${PENDING_DELIVERD_PATH}/detail?id=${record.id}`}>发货</Link>,
// outerStatus = 6, innerStatus = 19
'待新增加工入库单': (
<Link <Link
to={`${ADD_DELIVERY_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_RECEIPT}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`} to={`${ADD_PROCESS_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_INVOICE}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`}
> >
新增加工入库 新增加工发货
</Link> </Link>
), ),
// outerStatus = 6, innerStatus = 20 [OuterAndInnerStatus.pending_exam_add_process]: (
'待审核加工入库单': (
<Popconfirm <Popconfirm
title={`是否确认审核入库单号为${record.deliveryNo}的加工入库单?`} title={`是否确认审核发货单号为${record.deliveryNo}的加工发货单?`}
visible={visibleID === record.id} visible={visibleID === record.id}
placement="left" placement="left"
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
onCancel={handleCancel} onCancel={handleCancel}
okButtonProps={{ loading: confirmLoading }} okButtonProps={{ loading: confirmLoading }}
onConfirm={() => handleExam(record.id, ExamType.warehouseReceipt)} onConfirm={() => handleExam(record.id, ExamType.delivery)}
> >
<a onClick={() => handleVisible(record.id)}>审核</a> <a onClick={() => handleVisible(record.id)}>审核</a>
</Popconfirm> </Popconfirm>
), ),
// outerStatus = 7, innerStatus = 21 [OuterAndInnerStatus.pending_add_logistics]: <Link to={`${ADD_LOGISTICS_PATH}`}>新增</Link>,
'待确认收货': <Link to={`${ASSIGN_PENDING_RECEIVE}/detail?id=${record.id}`}>收货</Link>, [OuterAndInnerStatus.pending_confirm_logistics]: <a>查看</a>,
[OuterAndInnerStatus.pending_confirm_deliver]: <Link to={`${PENDING_DELIVERD_PATH}/detail?id=${record.id}`}>发货</Link>,
'待新增加工发货单': ( [OuterAndInnerStatus.pending_add_process_in_warehouse]: (
<Link <Link
to={`${ADD_PROCESS_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_INVOICE}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`} to={`${ADD_DELIVERY_PATH}?relevanceInvoicesId=${record.id}&invoicesTypeId=${DOC_TYPE_PROCESS_RECEIPT}&relevanceInvoices=${DEPENDENT_DOC_PRODUCTION}`}
> >
新增加工发货 新增加工入库
</Link> </Link>
), ),
'待审核加工发货单': ( [OuterAndInnerStatus.pending_exam_process_in_warehouse]: (
<Popconfirm <Popconfirm
title={`是否确认审核发货单号为${record.deliveryNo}的加工发货单?`} title={`是否确认审核入库单号为${record.deliveryNo}的加工入库单?`}
visible={visibleID === record.id} visible={visibleID === record.id}
placement="left" placement="left"
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
onCancel={handleCancel} onCancel={handleCancel}
okButtonProps={{ loading: confirmLoading }} okButtonProps={{ loading: confirmLoading }}
onConfirm={() => handleExam(record.id, ExamType.delivery)} onConfirm={() => handleExam(record.id, ExamType.warehouseReceipt)}
> >
<a onClick={() => handleVisible(record.id)}>审核</a> <a onClick={() => handleVisible(record.id)}>审核</a>
</Popconfirm> </Popconfirm>
), ),
'待新增物流单': <Link to={`${ADD_LOGISTICS_PATH}`}>新增</Link>, [OuterAndInnerStatus.pending_confirm_receive]: <Link to={`${ASSIGN_PENDING_RECEIVE}/detail?id=${record.id}`}>收货</Link>,
'待确认物流单': <a>查看</a>, [OuterAndInnerStatus.pending_confirm_receipt]: <Link to={`${PENDING_RECEIPT_PATH}/detail?id=${record.id}`}>确认回单</Link>
// outerStatus = 8, innerStatus = 22
'待确认回单': <Link to={`${PENDING_RECEIPT_PATH}/detail?id=${record.id}`}>确认回单</Link>
} }
return MAP[record.innerStatusName] return MAP[`${outerStatus}_${innerStatus}`] || MAP[record.innerStatusName]
} }
} }
] ]
......
...@@ -173,6 +173,7 @@ export const SUPPLIER_INNER_STATUS_COLOR = { ...@@ -173,6 +173,7 @@ export const SUPPLIER_INNER_STATUS_COLOR = {
'4': 'processing', '4': 'processing',
"5": "success", "5": "success",
"9": "error", "9": "error",
"10": "success"
} }
...@@ -226,8 +227,24 @@ export const SUPPLIER_OUTER_STATUS_COLOR: SUPPLIER_OUTER_STATUS_COLOR_TYPE= [ ...@@ -226,8 +227,24 @@ export const SUPPLIER_OUTER_STATUS_COLOR: SUPPLIER_OUTER_STATUS_COLOR_TYPE= [
"success" "success"
] ]
/**
* 确认生产通知单 -> 列表页 -> 内部状态
*/
export const PROCESS_OUTER_STATUS_COLOR: ("default" | "processing" | "error"| "success" | "warning")[] = [
"error", // 不接受申请
"default", // 待提交审核 processInnerStatus = 1,
"warning", // 待审核 processInnerStatus = 2,
"error", // 待审核(1级) processInnerStatus = 3 不通过
"success", // 待审核(2级) processInnerStatus = 4 审核通过
"processing", // 待新增加工发货单 processInnerStatus = 5
"warning", // 待审核加工发货单 processInnerStatus = 6
"default", // 待新增物流单 processInnerStatus = 7
"processing", // 待确认物流单 processInnerStatus = 8
"warning", // 待确认发货 processInnerStatus = 9
"success", // 已确认发货 processInnerStatus = 10
"default", // processInnerStatus = 11 待确认回单
"success", // 完成 processInnerStatus = 12
]
/** /**
* 待新增加工入库单 * 待新增加工入库单
......
...@@ -10,9 +10,15 @@ const TablePagination = (props) => { ...@@ -10,9 +10,15 @@ const TablePagination = (props) => {
} }
return ( return (
<div style={parentStyle}> <>
{
total > 0
? <div style={parentStyle}>
<Pagination {...componentProps} current={props.value?.current || 1} onChange={handleChange} ></Pagination> <Pagination {...componentProps} current={props.value?.current || 1} onChange={handleChange} ></Pagination>
</div> </div>
: null
}
</>
) )
} }
......
...@@ -22,7 +22,7 @@ const expandRowColumn = [ ...@@ -22,7 +22,7 @@ const expandRowColumn = [
]; ];
const ProcessProducts = ({visible, cancel, ...restProps}) => { const ProcessProducts = ({visible, cancel, rowSelection, ...restProps}) => {
// const [mainTableSelectRow, mainTableSelectRowCtl] = useRowSelectionTable({customKey: 'id'}); // const [mainTableSelectRow, mainTableSelectRowCtl] = useRowSelectionTable({customKey: 'id'});
const [selectRow, selectRowCtl] = useRowSelectionTable({ const [selectRow, selectRowCtl] = useRowSelectionTable({
customKey: 'fullId', customKey: 'fullId',
...@@ -73,7 +73,8 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -73,7 +73,8 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
<Table <Table
columns={expandRowColumn} columns={expandRowColumn}
rowKey={(row) => row.fullId} rowKey={(row) => row.fullId}
rowSelection={selectRow} // rowSelection={selectRow}
rowSelection={rowSelection}
dataSource={renderData} dataSource={renderData}
pagination={false} pagination={false}
/> />
...@@ -85,8 +86,9 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -85,8 +86,9 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
const handleSubmit = () => { const handleSubmit = () => {
// console.log(selectRowCtl, mainTableSelectRowCtl); // console.log(selectRowCtl, mainTableSelectRowCtl);
console.log(selectRowCtl) // console.log(selectRowCtl)
restProps.onOk(selectRowCtl) // restProps.onOk(selectRowCtl)
restProps.onOk()
cancel(); cancel();
} }
......
...@@ -118,18 +118,29 @@ export const schema = { ...@@ -118,18 +118,29 @@ export const schema = {
width: '150px', width: '150px',
margin: '0 20px 0 0' margin: '0 20px 0 0'
}, },
default: 0, defaultValue: 0,
} }
}, },
type: { type: {
type: 'string', type: 'string',
'x-component': 'Select', 'x-component': 'Select',
'x-component-props': { 'x-component-props': {
options: [], options: [
{label: '询价采购', value: 1},
{label: '需求采购', value: 2},
{label: '现货采购', value: 3},
{label: '集采', value: 4},
{label: '积分兑换', value: 5},
{label: '渠道直采', value: 6},
{label: '渠道现货', value: 7},
{label: '渠道积分兑换', value: 8},
],
style: { style: {
width: '150px', width: '150px',
margin: '0 20px 0 0' margin: '0 20px 0 0'
} },
placeholder: '订单类型',
allowClear: true
} }
}, },
queryBtn: { queryBtn: {
......
...@@ -4,11 +4,9 @@ import { PublicApi } from '@/services/api'; ...@@ -4,11 +4,9 @@ import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
import { BasicForm, TablePagination, SearchForm } from '../ModalForTable' import { BasicForm, TablePagination, SearchForm } from '../ModalForTable'
import { createAsyncFormActions, FormEffectHooks } from '@formily/antd'; import { createAsyncFormActions, FormEffectHooks } from '@formily/antd';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { schema } from './schema'; import { schema } from './schema';
import { getAuth } from '@/utils/auth'; import { getAuth } from '@/utils/auth';
const { onFieldInit$ } = FormEffectHooks const { onFieldInit$ } = FormEffectHooks
const actions = createAsyncFormActions(); const actions = createAsyncFormActions();
...@@ -20,8 +18,7 @@ const MALL_NAME = { ...@@ -20,8 +18,7 @@ const MALL_NAME = {
"3": "渠道商城", "3": "渠道商城",
"4": "渠道自有商城" "4": "渠道自有商城"
} }
const ProcessProducts = ({visible, cancel, ...restProps}) => { const ProcessProducts = ({visible, cancel, rowSelection, ...restProps}) => {
const [selectRow, setSelectRow] = useRowSelectionTable({ customKey: 'id' });
const authInfo = getAuth(); const authInfo = getAuth();
const fetchData = useCallback(async (params: any) => { const fetchData = useCallback(async (params: any) => {
console.log(params); console.log(params);
...@@ -32,7 +29,6 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -32,7 +29,6 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
memberId:authInfo.memberId, memberId:authInfo.memberId,
...params, ...params,
} }
console.log(postData);
let res = await PublicApi.getProductCommodityCommonGetCommodityListByBuyer(postData); let res = await PublicApi.getProductCommodityCommonGetCommodityListByBuyer(postData);
return res; return res;
}, []) }, [])
...@@ -52,13 +48,13 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -52,13 +48,13 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
] ]
const onOk = () => { const onOk = () => {
restProps.onOk(setSelectRow) // restProps.onOk(setSelectRow)
restProps.onOk()
cancel(); cancel();
} }
const effects = () => { const effects = () => {
onFieldInit$('branchId').subscribe((fieldState) => { onFieldInit$('branchId').subscribe((fieldState) => {
///product/select/getSelectBrand
PublicApi.getProductSelectGetSelectBrand({name: ''}).then(res => { PublicApi.getProductSelectGetSelectBrand({name: ''}).then(res => {
let options = [] let options = []
if(res.code === 1000) { if(res.code === 1000) {
...@@ -70,7 +66,6 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -70,7 +66,6 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
}) })
}); });
onFieldInit$('categoryId').subscribe((fieldState) => { onFieldInit$('categoryId').subscribe((fieldState) => {
///product/select/getSelectBrand
PublicApi.getProductSelectGetSelectCategory({name: ''}).then(res => { PublicApi.getProductSelectGetSelectCategory({name: ''}).then(res => {
let options = [] let options = []
if(res.code === 1000) { if(res.code === 1000) {
...@@ -99,7 +94,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -99,7 +94,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
schema={schema} schema={schema}
actions={actions} actions={actions}
effects={effects} effects={effects}
expressionScope={{rowSelection: selectRow, columns: columns}} expressionScope={{rowSelection: rowSelection, columns: columns}}
></SearchForm> ></SearchForm>
: null : null
} }
......
...@@ -19,7 +19,8 @@ import { ...@@ -19,7 +19,8 @@ import {
CONFIRM_PENDING_SECOND, CONFIRM_PENDING_SECOND,
CONFIRM_PENDING_CONFIRM, CONFIRM_PENDING_CONFIRM,
SUPPLIER_INNER_STATUS_COLOR, SUPPLIER_INNER_STATUS_COLOR,
SUPPLIER_OUTER_STATUS_COLOR SUPPLIER_OUTER_STATUS_COLOR,
PROCESS_OUTER_STATUS_COLOR
} from '../../common' } from '../../common'
import { timeRange } from '@/utils'; import { timeRange } from '@/utils';
...@@ -72,8 +73,6 @@ const Query: React.FC<{}> = (props) => { ...@@ -72,8 +73,6 @@ const Query: React.FC<{}> = (props) => {
return {} return {}
}, [pathname]) }, [pathname])
// 初始化高级筛选选项 // 初始化高级筛选选项
const fetchSelectOptions = useCallback(async () => { const fetchSelectOptions = useCallback(async () => {
const { data, code } = await PublicApi.getEnhanceSupplierAllOuterAndInner() const { data, code } = await PublicApi.getEnhanceSupplierAllOuterAndInner()
...@@ -120,7 +119,7 @@ const Query: React.FC<{}> = (props) => { ...@@ -120,7 +119,7 @@ const Query: React.FC<{}> = (props) => {
dataIndex: 'innerStatusName', dataIndex: 'innerStatusName',
render: (text, record: any) => { render: (text, record: any) => {
return ( return (
<Badge status={SUPPLIER_INNER_STATUS_COLOR[record.processInnerStatus] || 'default'} text={text}></Badge> <Badge status={PROCESS_OUTER_STATUS_COLOR[record.processInnerStatus] || 'default'} text={text}></Badge>
) )
} }
} }
......
...@@ -10,12 +10,11 @@ interface Iprops {}; ...@@ -10,12 +10,11 @@ interface Iprops {};
const url = '/memberCenter/handling/assign/query' const url = '/memberCenter/handling/assign/query'
const KEY_TITLE = { const KEY_TITLE = {
processList: '指派生产通知单', supplierList: '指派生产通知单',
supplierList: '生产通知单处理' processList: '生产通知单处理'
} }
const ProcessCenter: React.FC<Iprops> = () => { const ProcessCenter: React.FC<Iprops> = () => {
///report/member/home/getEnhanceTally
const request = useCallback(async () => { const request = useCallback(async () => {
const res = await PublicApi.getReportMemberHomeGetEnhanceTally(); const res = await PublicApi.getReportMemberHomeGetEnhanceTally();
return res; return res;
......
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
.item { .item {
background: #F7F8FA; background: #F7F8FA;
width: 157px; width: 157px;
text-align: center;
color: #303133; color: #303133;
padding: 6px; padding: 6px;
margin-bottom: 16px; margin-bottom: 16px;
display: flex;
justify-content: center;
align-items: center;
a { a {
color: #303133; color: #303133;
} }
......
...@@ -501,7 +501,8 @@ const CommodityDetail = (props) => { ...@@ -501,7 +501,8 @@ const CommodityDetail = (props) => {
stockCount: stockCount, stockCount: stockCount,
minOrder: commodityDetail.minOrder, minOrder: commodityDetail.minOrder,
commodityPic: attrAndValList.commodityPic ? attrAndValList.commodityPic[0] : commodityDetail.mainPic, commodityPic: attrAndValList.commodityPic ? attrAndValList.commodityPic[0] : commodityDetail.mainPic,
attribute: attrAndValList.attributeAndValueList attribute: attrAndValList.attributeAndValueList,
isMemberPrice: commodityDetail.isMemberPrice ? 1 : 0
} }
const sessionKey = `${commodityDetail.id}${new Date().getTime()}` const sessionKey = `${commodityDetail.id}${new Date().getTime()}`
......
...@@ -34,9 +34,9 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -34,9 +34,9 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setLastCategoryId(null) setLastCategoryId(null)
setSelectAttrbuteList([]) setSelectAttrbuteList([])
} else { } else {
let initKeys = [] const initKeys = []
// let initAttrKeys = [] // let initAttrKeys = []
for (let item of filterList) { for (const item of filterList) {
if (item.type === FILTER_TYPE.category) { if (item.type === FILTER_TYPE.category) {
initKeys.push(String(item.key)) initKeys.push(String(item.key))
} }
...@@ -50,7 +50,7 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -50,7 +50,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect(() => { useEffect(() => {
let getCategoryListFn let getCategoryListFn
let param: any = {} const param: any = {}
let headers = {} let headers = {}
/** /**
* 根据不通过的页面类型,请求不同的品类接口 * 根据不通过的页面类型,请求不同的品类接口
...@@ -105,7 +105,7 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -105,7 +105,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect(() => { useEffect(() => {
if (lastCategoryId) { if (lastCategoryId) {
let param: any = { const param: any = {
categoryId: lastCategoryId categoryId: lastCategoryId
} }
let getAttributeFn let getAttributeFn
...@@ -160,8 +160,8 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -160,8 +160,8 @@ const Category: React.FC<CategoryPropsType> = (props) => {
if (!list) { if (!list) {
return [] return []
} }
let initExpandKeys = [] const initExpandKeys = []
let result: any = list.map(item => { const result: any = list.map(item => {
initExpandKeys.push(item.id) initExpandKeys.push(item.id)
return { return {
title: item.title, title: item.title,
...@@ -200,7 +200,7 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -200,7 +200,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setAttributeList([]) setAttributeList([])
onFilter({ onFilter({
type: FILTER_TYPE.attribute, type: FILTER_TYPE.attribute,
key: [], key: null,
title: `` title: ``
}) })
} }
...@@ -217,12 +217,12 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -217,12 +217,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const getDetailById = (attrId, attrValId, state = 2) => { const getDetailById = (attrId, attrValId, state = 2) => {
let detail = {} let detail = {}
for (let item of attributeList) { for (const item of attributeList) {
if (item.id === attrId) { if (item.id === attrId) {
if (state === 1) { if (state === 1) {
detail = item detail = item
} else { } else {
for (let childItem of item.attributeValueList) { for (const childItem of item.attributeValueList) {
if (childItem.value === attrValId) { if (childItem.value === attrValId) {
detail = childItem detail = childItem
} }
...@@ -235,7 +235,7 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -235,7 +235,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const getSelectAttributeList = (selectList) => { const getSelectAttributeList = (selectList) => {
let ids = [] let ids = []
for (let item of selectList) { for (const item of selectList) {
ids = [...ids, ...item.customerAttributeValueList.map(childItem => childItem.id)] ids = [...ids, ...item.customerAttributeValueList.map(childItem => childItem.id)]
} }
return ids return ids
...@@ -243,12 +243,12 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -243,12 +243,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const handleChange = (attrId, checkedList) => { const handleChange = (attrId, checkedList) => {
let tempSelect = [...initSelectAttributeList] let tempSelect = [...initSelectAttributeList]
let attrInfo: any = getDetailById(attrId, attrId, 1) const attrInfo: any = getDetailById(attrId, attrId, 1)
let tempItem = { const tempItem = {
customerAttributeId: attrId, customerAttributeId: attrId,
customerAttributeName: attrInfo.name, customerAttributeName: attrInfo.name,
customerAttributeValueList: checkedList.map(item => { customerAttributeValueList: checkedList.map(item => {
let detail: any = getDetailById(attrId, item) const detail: any = getDetailById(attrId, item)
return { return {
id: detail.value, id: detail.value,
name: detail.label name: detail.label
...@@ -268,7 +268,7 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -268,7 +268,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
tempSelect.push(tempItem) tempSelect.push(tempItem)
} }
let keys = getSelectAttributeList(tempSelect) const keys = getSelectAttributeList(tempSelect)
setSelectAttrbuteList(keys) setSelectAttrbuteList(keys)
tempSelect = tempSelect.filter(item => item.customerAttributeValueList.length > 0) tempSelect = tempSelect.filter(item => item.customerAttributeValueList.length > 0)
onFilter({ onFilter({
......
...@@ -27,8 +27,8 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => { ...@@ -27,8 +27,8 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
if (isEmpty(filterList)) { if (isEmpty(filterList)) {
setSelectKeys([]) setSelectKeys([])
} else { } else {
let initKeys = [] const initKeys = []
for (let item of filterList) { for (const item of filterList) {
if (item.type === FILTER_TYPE.commodityType) { if (item.type === FILTER_TYPE.commodityType) {
initKeys.push(Number(item.key)) initKeys.push(Number(item.key))
} }
...@@ -54,7 +54,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => { ...@@ -54,7 +54,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
} else { } else {
onFilter({ onFilter({
type: FILTER_TYPE.commodityType, type: FILTER_TYPE.commodityType,
key: [], key: false,
title: '' title: ''
}) })
} }
...@@ -62,7 +62,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => { ...@@ -62,7 +62,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
const getItemText = (key: number) => { const getItemText = (key: number) => {
let result = "" let result = ""
for (let item of styleOptions) { for (const item of styleOptions) {
if (item.value === key) { if (item.value === key) {
result = item.label result = item.label
} }
......
...@@ -73,11 +73,11 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -73,11 +73,11 @@ const Order: React.FC<OrderPropsType> = (props) => {
}, []) }, [])
const initOrderInfo = async () => { const initOrderInfo = async () => {
let result = [] const result = []
const sessionOrderInfo: any = await getOrderInfo(spam_id) const sessionOrderInfo: any = await getOrderInfo(spam_id)
for (let item of sessionOrderInfo.orderList) { for (const item of sessionOrderInfo.orderList) {
let tempOrderList = [] const tempOrderList = []
for (let orderItem of item.orderList) { for (const orderItem of item.orderList) {
let resData: any = {} let resData: any = {}
if (orderItem.logistics?.sendAddress) { if (orderItem.logistics?.sendAddress) {
try { try {
...@@ -103,17 +103,17 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -103,17 +103,17 @@ const Order: React.FC<OrderPropsType> = (props) => {
// 是否选用电子合同 // 是否选用电子合同
if (data.isElectronicContract) { if (data.isElectronicContract) {
setElectronicContractId(data.electronicContractId) setElectronicContractId(data.electronicContractId)
if (!!sessionStorage.getItem(`contract${spam_id}`)) { if (sessionStorage.getItem(`contract${spam_id}`)) {
setContractInfo(JSON.parse(sessionStorage.getItem(`contract${spam_id}`))) setContractInfo(JSON.parse(sessionStorage.getItem(`contract${spam_id}`)))
setIsElectronicContract(true) setIsElectronicContract(true)
} else { } else {
// 根据电子合同模板id获取生成电子合同 // 根据电子合同模板id获取生成电子合同
let param = { const param: any = {
contractTemplateId: data.electronicContractId, contractTemplateId: data.electronicContractId,
signMemberId: userInfo?.memberId, signMemberId: userInfo?.memberId,
orderNo: new Date().getTime() orderNo: new Date().getTime()
} }
//@ts-ignore
const signRes = await PublicApi.postOrderSignatureSignContractCreate(param) const signRes = await PublicApi.postOrderSignatureSignContractCreate(param)
const signData: any = signRes.data const signData: any = signRes.data
if (signRes.code === 1000) { if (signRes.code === 1000) {
...@@ -173,8 +173,8 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -173,8 +173,8 @@ const Order: React.FC<OrderPropsType> = (props) => {
const getCommodityAmount = () => { const getCommodityAmount = () => {
let amount = 0 let amount = 0
for (let item of orderInfo.orderList) { for (const item of orderInfo.orderList) {
for (let orderItem of item.orderList) { for (const orderItem of item.orderList) {
amount += (orderItem.unitPrice * orderItem.count) amount += (orderItem.unitPrice * orderItem.count)
} }
} }
...@@ -187,10 +187,10 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -187,10 +187,10 @@ const Order: React.FC<OrderPropsType> = (props) => {
const getLogisticsFeeAnync = async () => { const getLogisticsFeeAnync = async () => {
if (selectAddressInfo) { if (selectAddressInfo) {
let orderProductList = [] const orderProductList = []
for (let item of orderInfo.orderList) { for (const item of orderInfo.orderList) {
for (let orderItem of item.orderList) { for (const orderItem of item.orderList) {
let templateId = orderItem.logistics?.templateId const templateId = orderItem.logistics?.templateId
// 判断是否物流的方式和由买家承担费用并使用了运费模板 // 判断是否物流的方式和由买家承担费用并使用了运费模板
if (orderItem.logistics?.deliveryType === 1 && orderItem.logistics?.carriageType === 2 && orderItem.logistics?.useTemplate && templateId) { if (orderItem.logistics?.deliveryType === 1 && orderItem.logistics?.carriageType === 2 && orderItem.logistics?.useTemplate && templateId) {
orderProductList.push({ orderProductList.push({
...@@ -202,7 +202,7 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -202,7 +202,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
} }
} }
if (orderProductList.length > 0) { if (orderProductList.length > 0) {
let params: any = { const params: any = {
orderProductList, orderProductList,
receiverAddressId: selectAddressInfo.id receiverAddressId: selectAddressInfo.id
} }
...@@ -210,7 +210,9 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -210,7 +210,9 @@ const Order: React.FC<OrderPropsType> = (props) => {
const res: any = await PublicApi.postLogisticsFreightTemplateCalFreightPrice(params) const res: any = await PublicApi.postLogisticsFreightTemplateCalFreightPrice(params)
message.destroy() message.destroy()
setLogisticsFee(Number(res.data)) setLogisticsFee(Number(res.data))
} catch (error) { } } catch (error) {
console.log(error)
}
} }
} }
} }
...@@ -261,7 +263,7 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -261,7 +263,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
* 提交订单 * 提交订单
*/ */
const submitOrder = (signatureLogId?: number) => { const submitOrder = (signatureLogId?: number) => {
let params: any = { const params: any = {
orderModel: getOrderMode(), // 下单模式 orderModel: getOrderMode(), // 下单模式
needTheInvoice: needTheInvoice ? 1 : 0, needTheInvoice: needTheInvoice ? 1 : 0,
} }
...@@ -278,12 +280,12 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -278,12 +280,12 @@ const Order: React.FC<OrderPropsType> = (props) => {
// params.addres = selectAddressInfo.address // params.addres = selectAddressInfo.address
} }
let orderProductRequests = [] const orderProductRequests = []
let purchaseIds = [] const purchaseIds = []
for (let item of orderList) { for (const item of orderList) {
for (let orderItem of item.orderList) { for (const orderItem of item.orderList) {
let temp: any = {} const temp: any = {}
purchaseIds.push(orderItem.purchaseId) purchaseIds.push(orderItem.purchaseId)
temp.imgUrl = orderItem.commodityPic temp.imgUrl = orderItem.commodityPic
temp.productId = orderItem.id temp.productId = orderItem.id
...@@ -299,6 +301,7 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -299,6 +301,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
temp.minOrder = orderItem.minOrder temp.minOrder = orderItem.minOrder
temp.memberId = orderInfo.supplyMembersId temp.memberId = orderInfo.supplyMembersId
temp.memberRoleId = orderInfo.supplyMembersRoleId temp.memberRoleId = orderInfo.supplyMembersRoleId
temp.isMemberPrice = orderItem.isMemberPrice
orderProductRequests.push(temp) orderProductRequests.push(temp)
} }
} }
...@@ -316,7 +319,7 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -316,7 +319,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
params.theInvoiceId = selectInvoiceInfo.id params.theInvoiceId = selectInvoiceInfo.id
params.theInvoiceInfo = selectInvoiceInfo params.theInvoiceInfo = selectInvoiceInfo
} }
if (!!orderInfo.purchaseOrder) { if (orderInfo.purchaseOrder) {
params.idList = purchaseIds params.idList = purchaseIds
params.productType = (layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? 2 : 1 params.productType = (layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? 2 : 1
} }
...@@ -388,13 +391,13 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -388,13 +391,13 @@ const Order: React.FC<OrderPropsType> = (props) => {
} }
const handleSignModalConfirm = () => { const handleSignModalConfirm = () => {
let param = { const param: any = {
contractTemplateId: electronicContractId, contractTemplateId: electronicContractId,
contractName: contractInfo.contractName, contractName: contractInfo.contractName,
contractUrl: contractInfo.contractUrl, contractUrl: contractInfo.contractUrl,
} }
setAgreeSignLoading(true) setAgreeSignLoading(true)
// @ts-ignore
PublicApi.postOrderSignatureOrderSettleSign(param).then((res: any) => { PublicApi.postOrderSignatureOrderSettleSign(param).then((res: any) => {
if (res.code === 1000) { if (res.code === 1000) {
message.destroy() message.destroy()
...@@ -409,7 +412,7 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -409,7 +412,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
} }
const pollingCheckStatus = (signatureLogId) => { const pollingCheckStatus = (signatureLogId) => {
let param = { const param = {
signatureLogId signatureLogId
} }
PublicApi.getOrderSignatureOrderSettleSignDetail(param).then(res => { PublicApi.getOrderSignatureOrderSettleSignDetail(param).then(res => {
......
...@@ -458,7 +458,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -458,7 +458,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
* @param memberId * @param memberId
*/ */
const getPayWayListByMemberId = (memberId: number) => { const getPayWayListByMemberId = (memberId: number) => {
return new Promise((resolve) => { return new Promise((resolve, reject) => {
if (!memberId) { if (!memberId) {
resolve([]) resolve([])
return return
...@@ -469,6 +469,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -469,6 +469,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
PublicApi.getPayPayWayList(param).then(res => { PublicApi.getPayPayWayList(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
resolve(initPayWayList(res.data)) resolve(initPayWayList(res.data))
} else {
resolve([])
} }
}) })
}) })
...@@ -558,7 +560,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -558,7 +560,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
brand: item.commodityUnitPrice.commodity.brand.name, brand: item.commodityUnitPrice.commodity.brand.name,
commodityPic: item.commodityUnitPrice.commodity.mainPic, commodityPic: item.commodityUnitPrice.commodity.mainPic,
attribute: item.commodityUnitPrice.attributeAndValueList, attribute: item.commodityUnitPrice.attributeAndValueList,
stockCount: item.stockCount || 0 stockCount: item.stockCount || 0,
isMemberPrice: item.commodityUnitPrice.commodity.isMemberPrice ? 1 : 0
} }
if (item.commodityUnitPrice.commodity.isMemberPrice) { if (item.commodityUnitPrice.commodity.isMemberPrice) {
...@@ -582,7 +585,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -582,7 +585,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
orderList: buyOrderlist orderList: buyOrderlist
}] }]
} }
buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId) buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId)
PublicApi.postOrderIsWorkFlow({ productIds, memberId: selectItem.memberId }).then(res => { PublicApi.postOrderIsWorkFlow({ productIds, memberId: selectItem.memberId }).then(res => {
......
...@@ -48,3 +48,27 @@ export const useUnitPreview = (initValue, context) => { ...@@ -48,3 +48,27 @@ export const useUnitPreview = (initValue, context) => {
} }
}, [initValue]) }, [initValue])
} }
// 高级筛选schema中用于输入搜索品牌的Effect
export const searchBrandOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
PublicApi.getProductSelectGetSelectBrand({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
// 高级筛选schema中用于输入搜索商品品类的Effect
export const searchCustomerCategoryOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
PublicApi.getProductSelectGetSelectCustomerCategory({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
\ No newline at end of file
...@@ -35,11 +35,25 @@ import { FORM_FILTER_PATH } from '@/formSchema/const'; ...@@ -35,11 +35,25 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { repositSchema } from './schema'; import { repositSchema } from './schema';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effects';
const formActions = createFormActions(); const formActions = createFormActions();
// 模拟请求 // 模拟请求
const fetchData = async (params: any) => { const fetchData = async (params: any) => {
console.log(params)
if(params?.category) {
formActions.getFieldState('category', state => {
let categorys = state.props['x-component-props'].dataoption
params.category = categorys.filter(i => i.id === params.category)[0].name
})
}
if(params?.brand) {
formActions.getFieldState('brand', state => {
let brands = state.props['x-component-props'].dataoption
params.brand = brands.filter(i => i.id === params.brand)[0].name
})
}
const res = await PublicApi.getWarehouseFreightSpaceList(params); const res = await PublicApi.getWarehouseFreightSpaceList(params);
return res.data; return res.data;
}; };
...@@ -190,6 +204,12 @@ const Repositories: React.FC<{}> = () => { ...@@ -190,6 +204,12 @@ const Repositories: React.FC<{}> = () => {
'name', 'name',
FORM_FILTER_PATH, FORM_FILTER_PATH,
); );
FormEffectHooks.onFieldChange$('brand').subscribe(state => {
searchBrandOptionEffect(actions, 'brand')
})
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'category')
})
}} }}
schema={repositSchema} schema={repositSchema}
/> />
......
...@@ -99,30 +99,60 @@ export const repositSchema: ISchema = padRequiredMessage({ ...@@ -99,30 +99,60 @@ export const repositSchema: ISchema = padRequiredMessage({
placeholder: '商品名称' placeholder: '商品名称'
} }
}, },
category: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
placeholder: '请选择品类',
style: {
width: 160,
}
},
enum: []
},
brand: { brand: {
type: 'string', type: 'string',
"x-component": 'SearchSelect', 'x-component': 'CustomInputSearch',
"x-component-props": { 'x-component-props': {
fetchSearch: PublicApi.getProductSelectGetSelectBrand, placeholder: '商品品牌',
placeholder: '请选择品牌', showSearch: true,
style: { showArrow: true,
width: 160 defaultActiveFirstOption: false,
} filterOption: false,
notFoundContent: null,
style: { width: '160px' },
searchValue: null,
dataoption: [],
}, },
enum: []
}, },
category: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品类',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '160px' },
searchValue: null,
dataoption: []
},
},
// category: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
// placeholder: '请选择品类',
// style: {
// width: 160,
// }
// },
// enum: []
// },
// brand: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// fetchSearch: PublicApi.getProductSelectGetSelectBrand,
// placeholder: '请选择品牌',
// style: {
// width: 160
// }
// },
// enum: []
// },
} }
}, },
submit: { submit: {
......
...@@ -313,7 +313,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => { ...@@ -313,7 +313,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
dataIndex: 'memberPrice', dataIndex: 'memberPrice',
align: 'center', align: 'center',
key: 'memberPrice', key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text + '%') : null render: (text, record) => record.isMemberPrice ? (text * 100 + '%') : null
}, },
{ {
title: creditsCommodity ? '兑换数量' : '采购数量', title: creditsCommodity ? '兑换数量' : '采购数量',
......
...@@ -85,6 +85,7 @@ const warehouseColumns: any[] = [ ...@@ -85,6 +85,7 @@ const warehouseColumns: any[] = [
const modalPriceActions = createFormActions() const modalPriceActions = createFormActions()
// 总计金额联动框 // 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => { export const MoneyTotalBox = ({ dataSource, isEditData }) => {
const { reloadFormData } = useContext(OrderDetailContext)
const { orderProductRequests = [], receiverAddressId, freight, amount, orderModel } = dataSource || {} const { orderProductRequests = [], receiverAddressId, freight, amount, orderModel } = dataSource || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式 const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
...@@ -107,7 +108,11 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => { ...@@ -107,7 +108,11 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
useEffect(() => { useEffect(() => {
if(changeTotal){ if(changeTotal){
// 执行修改订单运费 // 执行修改订单运费
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2}) PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2}).then(res => {
if(res.code === 1000) {
reloadFormData()
}
})
} }
}, [amountMoney]) }, [amountMoney])
...@@ -291,7 +296,7 @@ const EditableCell: React.FC<EditableCellProps> = ({ ...@@ -291,7 +296,7 @@ const EditableCell: React.FC<EditableCellProps> = ({
}; };
const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const { ctl, data } = useContext(OrderDetailContext) const { ctl, data, reloadFormData } = useContext(OrderDetailContext)
const { page_type } = usePageStatus() const { page_type } = usePageStatus()
const { orderProductRequests = [], orderModel } = data || {} const { orderProductRequests = [], orderModel } = data || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式 const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
...@@ -351,7 +356,11 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -351,7 +356,11 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
...row, ...row,
}); });
// 执行修改订单价格 // 执行修改订单价格
PublicApi.postOrderProductPriceUpdate({orderId: data.id, orderDetailsId: row.id, price: row.price, type: 1}) PublicApi.postOrderProductPriceUpdate({orderId: data.id, orderDetailsId: row.id, price: row.price, type: 1}).then(res => {
if(res.code === 1000) {
reloadFormData()
}
})
ctl.setData({ ctl.setData({
...data, ...data,
orderProductRequests: newData orderProductRequests: newData
...@@ -406,7 +415,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -406,7 +415,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
dataIndex: 'memberPrice', dataIndex: 'memberPrice',
align: 'center', align: 'center',
key: 'memberPrice', key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text + '%') : null render: (text, record) => record.isMemberPrice ? (text * 100 + '%') : null
}, },
{ {
title: creditsCommodity ? '兑换数量' : '采购数量', title: creditsCommodity ? '兑换数量' : '采购数量',
...@@ -485,6 +494,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -485,6 +494,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
currentRef={warehouseRef} currentRef={warehouseRef}
confirm={() => setWarehouseVisible(false)} confirm={() => setWarehouseVisible(false)}
fetchTableData={params => fetchWarehouseData(params)} fetchTableData={params => fetchWarehouseData(params)}
resetModal={{
destroyOnClose: true
}}
/> />
</MellowCard> </MellowCard>
) )
......
...@@ -64,7 +64,7 @@ export const useSelfTable = () => { ...@@ -64,7 +64,7 @@ export const useSelfTable = () => {
}, },
{ title: '收货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' }, { title: '收货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 收货单号跳转 // @todo 收货单号跳转
{ title: '收货单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> }, { title: '入库单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> },
{ {
title: '订单类型', title: '订单类型',
align: 'center', align: 'center',
......
...@@ -3,7 +3,7 @@ import { PublicApi } from '@/services/api' ...@@ -3,7 +3,7 @@ import { PublicApi } from '@/services/api'
import { FILTER_TYPE } from '@/constants' import { FILTER_TYPE } from '@/constants'
interface FilterValueType { interface FilterValueType {
key: string | string[] | number; key: any;
title: string; title: string;
type: FILTER_TYPE; type: FILTER_TYPE;
} }
......
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