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

fix: 对接新增销售发货单,处理表单布尔值必填校验

parent efdaf2b9
......@@ -65,6 +65,11 @@ export const isFieldLegal = (value: any): boolean => {
if (!isNaN(parseFloat(value))) {
return true;
}
// 校验布尔值,若字段值为true/false,符合规则
if(typeof value === 'boolean') {
return true;
}
return !!value;
};
......
......@@ -391,6 +391,7 @@ export default {
'saleOrder.shengchengzhifulian': 'Generate payment link',
'saleOrder.songhuodizhi': 'shipping address',
'saleOrder.caozuo': 'Operation',
'saleOrder.delete': 'Delete',
'saleOrder.daochu': 'Export',
'saleOrder.dangqiangouyunle': 'Currently out of order',
'saleOrder.zhangdingdanjinhang': 'An order is transferred, and the purchase order generated after the transfer can pass the member role',
......@@ -552,6 +553,7 @@ export default {
'saleOrder.ziti': 'noutoasiakas',
'saleOrder.wuxupeisong': 'No distribution',
'saleOrder.shuzhijingduyi': 'Numerical accuracy overflow',
'saleOrder.shuzhidayuling': 'Value greater than 0',
'saleOrder.bixutianxie': 'Must fill in the',
'saleOrder.caigoushuliangjin': 'Purchase quantity is limited to three decimal places',
'saleOrder.danjiajinxiansi': 'The unit price is only four decimal places',
......@@ -572,6 +574,7 @@ export default {
'saleOrder.wuliudanmingxi': 'Logistics details',
'saleOrder.yunfeixinxi': 'The freight information',
'saleOrder.yunfei': 'freight',
'saleOrder.weibaojia': 'No quotation',
'saleOrder.jiesuanfangshi': 'clearing form',
'saleOrder.dingdan': 'order',
'saleOrder.productTableCell.validator1': 'x must be entered',
......@@ -580,6 +583,7 @@ export default {
'saleOrder.qingwanshanwuliudan': 'Please improve the detailed data of logistics order',
'saleOrder.qingwanshanfahuodan': 'Please improve the detailed data of invoice',
'saleOrder.shouhuoshuliangjin': 'The quantity received is limited to three decimal places only',
'saleOrder.qingtianxiefahuoshuliang': 'Please fill in the delivery quantity',
// Requisitions
......
......@@ -391,6 +391,7 @@ export default {
'saleOrder.shengchengzhifulian': '결제 링크 생성',
'saleOrder.songhuodizhi': '배송 주소',
'saleOrder.caozuo': '조작하다',
'saleOrder.delete': '지우다',
'saleOrder.daochu': '내보내기',
'saleOrder.dangqiangouyunle': '지금 운이 트였다',
'saleOrder.zhangdingdanjinhang': '장 주문서 이체, 이체 후 생성된 구매 주문서는 회원 역할을 통해',
......@@ -550,6 +551,7 @@ export default {
'saleOrder.ziti': '이후 제기',
'saleOrder.wuxupeisong': '배송이 필요 없습니다',
'saleOrder.shuzhijingduyi': '수치 정밀도가 오버플로우됩니다',
'saleOrder.shuzhidayuling': '값이 0보다 크다',
'saleOrder.bixutianxie': '필수로 기입하다',
'saleOrder.caigoushuliangjin': '구입 수량은 세 자리 소수로만 제한한다',
'saleOrder.danjiajinxiansi': '단가는 단지 네 자리 소수로만 제한된다',
......@@ -570,6 +572,7 @@ export default {
'saleOrder.wuliudanmingxi': '물류 명세서',
'saleOrder.yunfeixinxi': '운임 정보',
'saleOrder.yunfei': '운송비',
'saleOrder.weibaojia': '미오퍼',
'saleOrder.jiesuanfangshi': '결제방법',
'saleOrder.dingdan': '주문',
'saleOrder.productTableCell.validator1': 'x는 반드시',
......@@ -578,6 +581,7 @@ export default {
'saleOrder.qingwanshanwuliudan': '물류 명세서 데이터를 완벽히 하세요',
'saleOrder.qingwanshanfahuodan': '인보이스 명세 데이터를 보완해 주세요',
'saleOrder.shouhuoshuliangjin': '상품을 받을 수 있는 수량은 세 자리 소수로만 제한한다',
'saleOrder.qingtianxiefahuoshuliang': '발송수량을 기입해 주세요',
// 请购单
......
......@@ -390,6 +390,7 @@ export default {
'saleOrder.shengchengzhifulian': '生成支付链接',
'saleOrder.songhuodizhi': '送货地址',
'saleOrder.caozuo': '操作',
'saleOrder.delete': '删除',
'saleOrder.daochu': '导出',
'saleOrder.dangqiangouyunle': '当前勾运了',
'saleOrder.zhangdingdanjinhang': '张订单进行转单,转单后生成的采购订单可通过会员角色',
......@@ -549,6 +550,7 @@ export default {
'saleOrder.ziti': '自提',
'saleOrder.wuxupeisong': '无需配送',
'saleOrder.shuzhijingduyi': '数值精度溢出',
'saleOrder.shuzhidayuling': '数值大于0',
'saleOrder.bixutianxie': '必须填写',
'saleOrder.caigoushuliangjin': '采购数量仅限三位小数',
'saleOrder.danjiajinxiansi': '单价仅限四位小数',
......@@ -569,6 +571,7 @@ export default {
'saleOrder.wuliudanmingxi': '物流单明细',
'saleOrder.yunfeixinxi': '运费信息',
'saleOrder.yunfei': '运费',
'saleOrder.weibaojia': '未报价',
'saleOrder.jiesuanfangshi': '结算方式',
'saleOrder.dingdan': '订单',
'saleOrder.productTableCell.validator1': 'x必须填写',
......@@ -577,6 +580,7 @@ export default {
'saleOrder.qingwanshanwuliudan': '请完善物流单明细数据',
'saleOrder.qingwanshanfahuodan': '请完善发货单明细数据',
'saleOrder.shouhuoshuliangjin': '收货数量仅限三位小数',
'saleOrder.qingtianxiefahuoshuliang': '请填写发货数量',
// 请购单
......
......@@ -114,6 +114,7 @@ const ClassProperty: React.FC<{}> = () => {
// 保存后要将是否填写过表单设为false
setIsEditForm(false)
flag = false
setUnsaved(false)
})
}
......
import React, { useState, useEffect, useRef, useMemo } from 'react'
import { history, useIntl } from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col, InputNumber, Space } from 'antd'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col, InputNumber } from 'antd'
import styles from './index.less'
import { ColumnType } from 'antd/lib/table/interface'
import { QuestionCircleOutlined, SettingOutlined, PlusOutlined, MinusOutlined, } from '@ant-design/icons'
......
import React from 'react'
/**
* 待新增 销售发货单/采购收货单/物流单详情 仅供显示收货地址
* @param props
* @returns
*/
const AddressText = (props) => {
return (<div {...props.props['x-component-props']}>
<p style={{margin: 0, height: 22}}>{props.value?.consignee}/{props.value?.phone}</p>
<p style={{color: "#909399", margin: 0, height: 22}}>{props.value?.areaName}{props.value?.address}</p>
</div>
)
}
AddressText.defaultProps = {}
AddressText.isFieldComponent = true;
export default AddressText
......@@ -54,7 +54,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
const save = async () => {
try {
const values = await form.validateFields();
values.purchaseCount = Number(values.purchaseCount) || 0
values[dataIndex] = Number(values[dataIndex]) || 0
handleSave({ ...record, ...values });
formContext.ctl.setInnerFormErrors(0)
} catch (errInfo) {
......@@ -84,7 +84,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
const customRules = (dataIndex) => {
let rule = [];
switch (dataIndex) {
case 'purchaseCount':
case 'amount':
rule = [
{
required: true,
......@@ -96,7 +96,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
},
]
break;
case 'boxCount':
case 'carton':
rule = [
{
required: true,
......
......@@ -21,78 +21,49 @@ export const PriceComp = (props) => {
/**新增物流单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
...initValue.requirement,
vendorMemberId: initValue.vendorMemberId,
vendorMemberName: initValue.vendorMemberName,
vendorRoleId: initValue.vendorRoleId,
product: initValue.product,
deliveryAddresId: initValue.consignee.consigneeId,
// ...initValue.requirement,
// vendorMemberId: initValue.vendorMemberId,
// vendorMemberName: initValue.vendorMemberName,
// vendorRoleId: initValue.vendorRoleId,
// product: initValue.product,
digest: initValue.digest,
orderId: initValue.orderId,
orderNo: initValue.orderNo,
shipmentOrderId: initValue.deliveryNo,
relevanceOrderId: initValue.orderId,
relevanceOrderCode: initValue.orderNo,
memberName: initValue.buyerMemberName,
receiver: initValue.consignee.consignee,
receiveAddress: `${initValue.consignee.consignee}/${initValue.consignee.phone}/${initValue.consignee.areaName}${initValue.consignee.address}`,
receiverAddress: initValue.consignee,
receiverAddressId: initValue.consignee.consigneeId,
receiverName: initValue.consignee.consignee,
receiverPhone: initValue.consignee.phone,
receiverFullAddress: initValue.consignee.areaName + initValue.consignee.address,
freight: intl.formatMessage({ id: 'saleOrder.weibaojia', defaultMessage: '未报价' }),
}
}
/** 新增物流单 回显商品字段转换 */
export const procurementRenderField = (data) => {
const _orderProductRequests = data.product.products
const _orderProductRequests = data.detailList
return _orderProductRequests.map(item => {
return {
...item,
commodityId: item.productId,
productId: item.skuId,
productName: item.name,
logistics: item.deliverType,
deliveryType: item.deliverType,
unitPrice: item.price,
purchaseCount: item.quantity,
taxInclusive: item.tax,
money: item.amount,
imgUrl: item.logo,
stockCount: item.stock,
// 冗余memberId memberRoleId查询自提地址使用
memberId: data.vendorMemberId,
memberRoleId: data.vendorRoleId,
// 冗余运费
freight: data.product.freight,
// 冗余shopId orderMode查询支付方式使用
shopId: data.shopId,
orderMode: data.orderMode,
// 转换上游字段
upperMemberId: item.supplyMemberId,
upperMemberName: item.supplyMemberName,
upperMemberRoleId: item.supplyRoleId,
// 订单中amount是金额 物流单里面amount是商品数量
amount: item.deliveryQuantity,
}
})
}
/** 新增物流单 字段转换 */
export const procurementProcessField = (value) => {
value.products = value.products.map(item => {
value.detailList = value.detailList.map(item => {
return {
...item,
productId: item.commodityId,
skuId: item.id,
logo: item.mainPic,
quantity: item.purchaseCount,
logisticsTemplateId: item.logistics.templateId,
weight: item.logistics.weight,
stock: item.stockCount,
discount: item.isMemberPrice ? item.memberPrice : 1, // 字段需求 无折扣为1
price: item.isMemberPrice ? Number((item.money / item.purchaseCount / item.memberPrice).toFixed(2)) : Number((item.money / item.purchaseCount).toFixed(2)),
tax: item.taxRate > 0,
vendorMemberId: item.memberId,
vendorRoleId: item.memberRoleId,
vendorMemberName: item.memberName,
// 上游字段
supplyMemberId: item.upperMemberId,
supplyRoleId: item.upperMemberRoleId,
supplyMemberName: item.upperMemberName,
productId: item.id,
productName: item.name,
categoryName: item.category,
brandName: item.brand,
unitName: item.unit,
}
})
return value
......@@ -133,18 +104,18 @@ export const productInfoColumns: any[] = [
},
{
title: intl.formatMessage({ id: 'saleOrder.shuliang', defaultMessage: '数量' }),
dataIndex: 'purchaseCount',
dataIndex: 'amount',
align: 'center',
key: 'purchaseCount',
key: 'amount',
formItem: 'input',
editable: true,
width: 140
},
{
title: intl.formatMessage({ id: 'saleOrder.xiangshu', defaultMessage: '箱数' }),
dataIndex: 'boxCount',
dataIndex: 'carton',
align: 'center',
key: 'boxCount',
key: 'carton',
formItem: 'input',
editable: true,
width: 140
......
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { getProductCustomerGetMemberCustomerCategoryTree, getProductSelectGetMemberBrand } from '@/services/ProductV2Api';
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
export const useMaterialTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('products').subscribe(state => {
// 强制渲染一次, 用于触发金额总数
FormEffectHooks.onFieldValueChange$('detailList').subscribe(state => {
// 强制渲染一次, 用于统计总数
update()
})
}
export const useInitShowField = () => {
const { pageStatus } = usePageStatus()
const utils = useLinkageUtils()
FormEffectHooks.onFormInit$().subscribe(() => {
// 初始化一些详情数据
// if (pageStatus === PageStatus.ADD) {
// utils.hide('orderNo')
// utils.hide('createTime')
// }
})
}
/**
* 高级筛选schema中用于获取供应商 商品品类Effect
* @param ctx 外部表单action
......
......@@ -16,11 +16,14 @@ import FormDetailWrapper from '@/components/FormDetailWrapper'
import { FormDetailContext } from '@/formSchema/context'
import { useProductTable } from './model/useProductTable'
import { useFormDetail } from '@/formSchema/effects/useFormDetail'
import { postPurchaseRequisitionCreate, postPurchaseRequisitionUpdate } from '@/services/PurchaseV2Api'
import ProductModalTable from './components/productModalTable'
import { getOrderVendorDetail } from '@/services/OrderNewV2Api'
import { getOrderVendorCreateLogisticsDetail, getOrderVendorSellDeliveryDetail } from '@/services/OrderNewV2Api'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { getLogisticsCompanyPage, getLogisticsShipperAddressPage } from '@/services/LogisticsV2Api'
import addressText from '../../components/addressText'
import { getAuth } from '@/utils/auth'
import { getSettleAccountsPlatformConfigGetSettlementWay } from '@/services/SettleV2Api'
import { postLogisticsOrderWaitSubmitAdd } from '@/services/LogiticsV2Api'
const addSchemaAction = createFormActions()
......@@ -38,23 +41,25 @@ const RowStyle = styled(props => <Row style={{marginTop: 12, justifyContent: "fl
// 总计金额联动框
export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const intl = useIntl()
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'products']], reducer: v => v })
const data = form.getFieldValue('products')
const sum = data.reduce((prev, next) => (prev*1000 + (next.amount || 0)*1000)/1000, 0)
const total = data.reduce((prev, next) => (prev*1000 + (next.quantity || 0)*1000)/1000, 0)
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'detailList']], reducer: v => v })
const data = form.getFieldValue('detailList')
const totalCarton = data.reduce((prev, next) => (prev*1000 + (next.carton || 0)*1000)/1000, 0)
const totalWeight = data.reduce((prev, next) => (prev*1000 + (next.weight || 0)*1000)/1000, 0)
const totalVolume = data.reduce((prev, next) => (prev*1000 + (next.volume || 0)*1000)/1000, 0)
return <RowStyle>
<Col span={2}>
<div>{intl.formatMessage({ id: 'saleOrder.zongxiangshu', defaultMessage: '总箱数' })}</div>
<div style={{fontSize: 24, color: '#1F2C3D'}}>{total.toFixed(2)}</div>
<div style={{fontSize: 24, color: '#1F2C3D'}}>{totalCarton.toFixed(1)}</div>
</Col>
<Col span={2}>
<div>{intl.formatMessage({ id: 'saleOrder.zongzhongliang', defaultMessage: '总重量' })}(KG)</div>
<div style={{fontSize: 24, color: '#1F2C3D'}}>{(sum).toFixed(2)}</div>
<div style={{fontSize: 24, color: '#1F2C3D'}}>{totalWeight.toFixed(3)}</div>
</Col>
<Col span={2}>
<div>{intl.formatMessage({ id: 'saleOrder.zongtiji', defaultMessage: '总体积' })}(m³)</div>
<div style={{fontSize: 24, color: '#1F2C3D'}}>{(sum).toFixed(2)}</div>
<div style={{fontSize: 24, color: '#1F2C3D'}}>{totalVolume.toFixed(3)}</div>
</Col>
</RowStyle>
})
......@@ -68,25 +73,32 @@ const AddLogisticsOrder:React.FC<{}> = () => {
const [initFormValue, setInitFormValue] = useState<any>({})
const { formContext } = useFormDetail()
const intl = useIntl()
const { memberRoleId, memberId } = getAuth() || {}
useEffect(() => {
if (id) {
setFormLoading(true)
getOrderVendorDetail({ orderId: id }).then(res => {
getOrderVendorCreateLogisticsDetail({ orderId: '5870' }).then(res => {
const { data } = res
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests)
}, 1000)
// const _orderProductRequests = procurementRenderField(data)
// setTimeout(() => {
// addSchemaAction.setFieldValue('detailList', _orderProductRequests)
// }, 1000)
setFormLoading(false)
})
getSettleAccountsPlatformConfigGetSettlementWay({memberId: memberId + '', roleId: memberRoleId + ''}).then(res => {
const { code ,data } = res
if(code === 1000) {
addSchemaAction.setFieldValue('settlementWay', data)
}
})
}
}, [])
const handleSubmit = async (value) => {
try {
let fnResult = null
// let fnResult = null
// 新增物流单/编辑物流单
const params = { ...value }
console.log(value)
......@@ -94,17 +106,17 @@ const AddLogisticsOrder:React.FC<{}> = () => {
throw new Error(intl.formatMessage({ id: 'saleOrder.qingwanshanwuliudan', defaultMessage: '请完善物流单明细数据' }))
}
setBtnLoading(true)
const _params = procurementProcessField(params)
console.log(_params)
if(id) {
fnResult = await postPurchaseRequisitionUpdate({..._params, id})
} else {
fnResult = await postPurchaseRequisitionCreate(_params)
}
// if(id) {
// fnResult = await postPurchaseRequisitionUpdate({..._params, id})
// } else {
// fnResult = await postPurchaseRequisitionCreate(_params)
// }
const fnResult = await postLogisticsOrderWaitSubmitAdd(_params)
if (fnResult.code === 1000) {
setTimeout(() => {
history.push("/memberCenter/procurementAbility/purchaseRequisition/readyAddBill")
history.push("/memberCenter/tranactionAbility/saleOrder/readyAddLogisticsOrder")
}, 1000)
} else {
setBtnLoading(false)
......@@ -135,11 +147,9 @@ const AddLogisticsOrder:React.FC<{}> = () => {
const renderTitle = () => {
// intl.formatMessage({ id: 'saleOrder.xiugaiwuliudan', defaultMessage: '修改物流单' })
// intl.formatMessage({ id: 'saleOrder.xinzengwuliudan', defaultMessage: '新增物流单' })
// intl.formatMessage({ id: 'saleOrder.chakanwuliudan', defaultMessage: '查看物流单' })
if(preview) {
return intl.formatMessage({ id: 'saleOrder.chakanwuliudan', defaultMessage: '查看物流单' })
}
// if(preview) {
// return intl.formatMessage({ id: 'saleOrder.chakanwuliudan', defaultMessage: '查看物流单' })
// }
return intl.formatMessage({ id: 'saleOrder.xinzengwuliudan', defaultMessage: '新增物流单' })
}
......@@ -166,22 +176,25 @@ const AddLogisticsOrder:React.FC<{}> = () => {
onSubmit={handleSubmit}
effects={($, ctx) => {
$('onFormMount').subscribe(() => { })
// 物信息的改动 渲染总额
// 物流明细信息的改动 渲染总额
useMaterialTableChangeForAmount(ctx, update)
// 注入表单完成进度
formContext.useAttachmentChangeForContext(ctx)
useAsyncSelect(
'deliverAddress',
'shipperAddressId',
fetchDeliverAddressSelectOptions,
)
useAsyncSelect(
'logisticProvider',
'companyId',
fetchLogisticProviderSelectOptions,
)
}}
components={{
addressText
}}
expressionScope={{
productColumns,
productComponents,
......
......@@ -72,7 +72,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const intl = useIntl()
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('products')]
const newData = [...ctx.getFieldValue('detailList')]
// 删除formvalue
const colIndex = newData.findIndex(v => v.id === record.id)
newData.splice(colIndex, 1)
......@@ -80,7 +80,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
// 删除选中的项
rowSelectionCtl.setSelectRow(newData)
rowSelectionCtl.setSelectedRowKeys(newData.map(v => v.id))
ctx.setFieldValue('products', newData)
ctx.setFieldValue('detailList', newData)
// 商品行数变动 清空之前的支付信息
if (pageStatus === PageStatus.ADD) {
......@@ -89,7 +89,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
}
const [productColumns, setProductColumns] = useState(() => {
if (pageStatus === PageStatus.ADD) {
// if (pageStatus === PageStatus.ADD) {
// 渲染操作
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'saleOrder.delete'})}</Button>
......@@ -102,18 +102,19 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
return r.id
}
} else {
// 渲染单价
productInfoColumns[5].render = (t, r) => <span style={{color: 'red'}}>{r.price}</span>
// } else {
// // 渲染单价
// productInfoColumns[5].render = (t, r) => <span style={{color: 'red'}}>¥ {r.price}</span>
// 渲染商品ID
productInfoColumns[0].render = (t, r) => r.productId
// // 渲染商品ID
// productInfoColumns[0].render = (t, r) => r.productId
return [...productInfoColumns].slice(0, productInfoColumns.length - 1)
}
// return [...productInfoColumns].slice(0, productInfoColumns.length - 1)
// }
return productInfoColumns
})
const handleShowProduct = () => {
const buyerMemberId = ctx.getFieldValue('buyerMemberId')
const shopId = ctx.getFieldValue('shopId')
......@@ -123,7 +124,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
message.error(intl.formatMessage({id: 'purchaseOrder.orderCollect.model.message'}))
}
}
console.log(preview, 'ppp')
const productAddButton = !preview && <Button onClick={handleShowProduct} block type='default' style={{margin: '24px auto'}}>{intl.formatMessage({ id: 'saleOrder.xuanzeshangpin', defaultMessage: '选择商品' })}</Button>
const productComponents = {
......@@ -140,7 +141,7 @@ console.log(preview, 'ppp')
ctx.setFieldValue('payments', [])
}
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')];
const newData = [...ctx.getFieldValue('detailList')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
row['money'] = getUnitPriceTotal(row)
......@@ -149,7 +150,7 @@ console.log(preview, 'ppp')
...item,
...row,
});
ctx.setFieldValue('products', newData)
ctx.setFieldValue('detailList', newData)
resolve({item, newData})
})
};
......
......@@ -43,21 +43,40 @@ const basicInfo: ISchema = {
span: 1
}
},
logisticProvider: {
companyId: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.wuliufuwushang', defaultMessage: '物流服务商' }),
enum: [],
required: true,
},
deliverAddress: {
companyName: {
type: 'string',
title: '物流服务商名称',
visible: false,
},
shipperAddressId: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.fahuodizhi', defaultMessage: '发货地址' }),
enum: [],
required: true,
},
shipperName: {
type: 'string',
title: '发货方名称',
visible: false,
},
shipperPhone: {
type: 'string',
title: '发货方手机',
visible: false,
},
shipperFullAddress: {
type: 'string',
title: '发货方全地址',
visible: false,
}
}
},
}
}
......@@ -84,26 +103,67 @@ const relatedInfo: ISchema = {
columns: 2,
},
properties: {
deliveryNo: {
shipmentOrderCode: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.duiyingfahuodan', defaultMessage: '对应发货单号' }),
"x-component": 'text',
},
receiveAddress: {
shipmentOrderId: {
type: 'string',
title: '发货单号ID',
visible: false,
},
receiverAddress: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.shouhuodizhi', defaultMessage: '收货地址' }),
"x-component": 'text',
"x-component": 'addressText',
},
receiverAddressId: {
type: 'string',
title: '收货地址ID',
visible: false,
},
orderNo: {
relevanceOrderCode: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.duiyingdingdanhao', defaultMessage: '对应订单号/售后单' }),
"x-component": 'text',
},
receiver: {
relevanceOrderId: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.shouhuofang', defaultMessage: '收货方' }),
title: '对应订单号ID',
visible: false,
},
receiverName: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.shouhuofang', defaultMessage: '收货人' }),
"x-component": 'text',
},
receiverPhone: {
type: 'string',
title: '收货人手机',
visible: false,
},
receiverFullAddress: {
type: 'string',
title: '收货人全地址',
visible: false,
},
// @此字段名称文档注释“收货方会员名称”与receiverName有异议,可能是采购会员名称、物流服务商名称,待确定后再做处理。
receiverMemberName: {
type: 'string',
title: '采购会员名称',
visible: false,
},
receiverMemberId: {
type: 'string',
title: '采购会员ID',
visible: false,
},
receiverRoleId: {
type: 'string',
title: '采购会员角色ID',
visible: false,
},
}
},
......@@ -120,7 +180,7 @@ const material: ISchema = {
id: 'orderMaterial',
},
properties: {
products: {
detailList: {
type: 'array',
"x-component": 'MultTable',
required: true,
......@@ -166,7 +226,7 @@ const freightInfo: ISchema = {
title: intl.formatMessage({ id: 'saleOrder.yunfei', defaultMessage: '运费' }),
"x-component": 'text',
},
settlement: {
settlementWay: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.jiesuanfangshi', defaultMessage: '结算方式' }),
"x-component": 'text',
......
......@@ -131,6 +131,8 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
let _value = Number(value)
if(_value > Number.MAX_SAFE_INTEGER) {
throw new Error(intl.formatMessage({ id: 'saleOrder.shuzhijingduyi', defaultMessage: '数值精度溢出' }))
} else if(_value <= 0) {
throw new Error(intl.formatMessage({ id: 'saleOrder.shuzhidayuling', defaultMessage: '数值大于0' }))
}
callback()
} catch (err) {
......
......@@ -3,27 +3,29 @@ import { getIntl } from "umi"
/** 新增销售发货单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
product: initValue.product,
detailList: initValue.detailList,
receipts: getIntl().formatMessage({ id: 'saleOrder.dingdan', defaultMessage: '订单' }),
receiptsType: getIntl().formatMessage({ id: 'saleOrder.xiaoshoufahuodan', defaultMessage: '销售发货单' }),
orderId: initValue.orderId,
orderNo: initValue.orderNo,
memberName: initValue.buyerMemberName,
address: `${initValue.consignee.consignee}/${initValue.consignee.phone}/${initValue.consignee.areaName}${initValue.consignee.address}`,
digest: initValue.digest,
buyerMemberName: initValue.buyerMemberName,
buyerMemberId: initValue.buyerMemberId,
buyerRoleId: initValue.buyerRoleId,
address: initValue.consignee,
// digest: initValue.digest,
inventoryName: initValue.inventoryName,
inventoryRole: initValue.inventoryRole,
remark: initValue.remark,
}
}
/** 新增销售发货单 回显物料/商品字段转换 */
export const procurementRenderField = (data) => {
const _orderProductRequests = data.product.products
const _orderProductRequests = data.detailList
return _orderProductRequests.map(item => {
return {
...item,
id: item.productId,
code: item.productNo,
type: item.spec,
orderQuantity: item.quantity,
}
})
}
......@@ -39,7 +41,7 @@ export const procurementProcessField = (value) => {
return value
}
const intl = getIntl()
const intl = getIntl();
// 单据明细 商品列表
export const productInfoColumns: any[] = [
{
......
......@@ -13,7 +13,8 @@ import FormDetailHeader from '@/components/FormDetailHeader'
import FormDetailWrapper from '@/components/FormDetailWrapper'
import { FormDetailContext } from '@/formSchema/context'
import { useFormDetail } from '@/formSchema/effects/useFormDetail'
import { getOrderVendorDetail, postOrderVendorCreateSellDelivery } from '@/services/OrderNewV2Api'
import { getOrderVendorSellDeliveryDetail, postOrderVendorCreateSellDelivery } from '@/services/OrderNewV2Api'
import addressText from '../../components/addressText'
const addSchemaAction = createFormActions()
......@@ -32,17 +33,18 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
useEffect(() => {
if (id) {
setFormLoading(true)
getOrderVendorDetail({ orderId: id }).then(res => {
const { data } = res
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('detailList', _orderProductRequests)
}, 1000)
getOrderVendorSellDeliveryDetail({ orderId: id }).then(res => {
const { data, code } = res
if(code === 1000) {
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('detailList', _orderProductRequests)
}, 1000)
}
setFormLoading(false)
})
}
}, [])
const handleSubmit = async (value) => {
......@@ -52,10 +54,13 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
if(formContext.innerFormErrors) {
throw new Error(intl.formatMessage({ id: 'saleOrder.qingwanshanfahuodan', defaultMessage: '请完善发货单明细数据' }))
}
// 校验是否填写发货数量
if(!params.detailList.every(item => item?.deliveryQuantity)) {
throw new Error(intl.formatMessage({ id: 'saleOrder.qingtianxiefahuoshuliang', defaultMessage: '请填写发货数量' }))
}
setBtnLoading(true)
const _params = procurementProcessField(params)
console.log(_params)
const fnResult = await postOrderVendorCreateSellDelivery({..._params, id})
if (fnResult.code === 1000) {
setTimeout(() => {
......@@ -77,10 +82,8 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
const renderTitle = () => {
// intl.formatMessage({ id: 'saleOrder.bianjixiaoshoufahuodan', defaultMessage: '编辑销售发货单' })
// intl.formatMessage({ id: 'saleOrder.xinzengxiaoshoufahuodan', defaultMessage: '新增销售发货单' })
// intl.formatMessage({ id: 'saleOrder.chakanxiaoshoufahuodan', defaultMessage: '查看销售发货单' })
if(preview) {
intl.formatMessage({ id: 'saleOrder.chakanxiaoshoufahuodan', defaultMessage: '查看销售发货单' })
}
return intl.formatMessage({ id: 'saleOrder.xinzengxiaoshoufahuodan', defaultMessage: '新增销售发货单' })
}
......@@ -111,6 +114,9 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
formContext.useAttachmentChangeForContext(ctx)
}}
components={{
addressText
}}
expressionScope={{
productColumns,
productComponents,
......
......@@ -6,7 +6,6 @@ import { useIntl } from 'umi';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
export const getUnitPriceTotal = (record) => {
console.log(record, 'rrr')
const purchaseCount = Number(record['deliveryQuantity']) || 0
return Number(((record.price || 0) * purchaseCount).toFixed(2))
}
......
......@@ -141,7 +141,7 @@ const relatedInfo: ISchema = {
title: intl.formatMessage({ id: 'saleOrder.guanliandanju', defaultMessage: '关联单据' }),
"x-component": 'text',
},
memberName: {
buyerMemberName: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.huiyuanmingcheng', defaultMessage: '会员名称' }),
"x-component": 'text',
......@@ -149,7 +149,7 @@ const relatedInfo: ISchema = {
address: {
type: 'string',
title: intl.formatMessage({ id: 'saleOrder.shouhuodizhi', defaultMessage: '收货地址' }),
"x-component": 'text',
"x-component": 'addressText',
},
orderId: {
type: 'number',
......
......@@ -19,7 +19,7 @@ const fetchTableData = async (params) => {
}
/** 待新增销售发货单 */
const ReadyAddSaleDelevedOrder:React.FC<ReadyAddSaleDelevedOrderProps> = (props) => {
const ReadyAddSaleDelevedOrder:React.FC<ReadyAddSaleDelevedOrderProps> = () => {
const {
columns,
ref
......
......@@ -61,8 +61,8 @@ export const useSelfTable = () => {
{
title: intl.formatMessage({ id: 'saleOrder.caigouhuiyuan', defaultMessage: '采购会员' }),
align: 'left',
dataIndex: 'buyerMemberName',
key: 'buyerMemberName',
dataIndex: 'memberName',
key: 'memberName',
},
{
title: intl.formatMessage({ id: 'saleOrder.zongjine', defaultMessage: '总金额(元)' }),
......
......@@ -9,14 +9,14 @@ import Submit from '@/components/NiceForm/components/Submit'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import '../index.less'
import { useSelfTable } from './model/useSelfTable'
import { getOrderVendorPage } from '@/services/OrderNewV2Api';
import { getOrderVendorCreateLogisticsPage } from '@/services/OrderNewV2Api';
// 待新增物流单
export interface ReadyAddLogisticsOrderProps {}
const fetchTableData = async (params) => {
const { data } = await getOrderVendorPage(params)
const { data } = await getOrderVendorCreateLogisticsPage(params)
return data
}
......@@ -30,7 +30,7 @@ const ReadyAddLogisticsOrder:React.FC<ReadyAddLogisticsOrderProps> = (props) =>
<StandardTable
fetchTableData={params => fetchTableData(params)}
columns={columns}
rowKey={'orderNo'}
rowKey='orderNo'
formilyLayouts={{
justify: 'space-between'
}}
......
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { getSaleOrderReadyDistributionPageSelectOption } from '@/pages/transaction/effect';
import { useIntl } from 'umi';
export const tableListSchema: any = () => {
const intl = useIntl()
return {
type: 'object',
properties: {
orderNo: {
type: 'string',
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdanOrderNo', defaultMessage: '请输入订单编号' }),
align: 'flex-start',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
}
},
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdanDigest', defaultMessage: '请输入订单摘要' }),
}
const data = getSaleOrderReadyDistributionPageSelectOption()
if(data) {
return {
type: 'object',
properties: {
orderNo: {
type: 'string',
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdanOrderNo', defaultMessage: '请输入订单编号' }),
align: 'flex-start',
},
"memberName": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurucaigou', defaultMessage: '请输入采购会员名称' })
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
}
},
"type": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingxuanzedingdanOrderType', defaultMessage: '请选择订单类型' })
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurudingdanDigest', defaultMessage: '请输入订单摘要' }),
}
},
enum: []
},
"[startCreateTime,endCreateTime]": {
type: 'array',
"x-component": 'DateRangePickerUnix',
'x-component-props': {
placeholder: [intl.formatMessage({ id: 'saleOrder.kaishishijian', defaultMessage: '开始时间' }),intl.formatMessage({ id: 'saleOrder.jieshushijian', defaultMessage: '结束时间' })],
"memberName": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingshurucaigou', defaultMessage: '请输入采购会员名称' })
}
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'saleOrder.chaxun', defaultMessage: '查询' }),
"type": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'saleOrder.qingxuanzedingdanOrderType', defaultMessage: '请选择订单类型' })
},
enum: data.map(item => ({
label: item['text'],
value: item['id'],
}))
},
"[startCreateTime,endCreateTime]": {
type: 'array',
"x-component": 'DateRangePickerUnix',
'x-component-props': {
placeholder: [intl.formatMessage({ id: 'saleOrder.kaishishijian', defaultMessage: '开始时间' }),intl.formatMessage({ id: 'saleOrder.jieshushijian', defaultMessage: '结束时间' })],
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'saleOrder.chaxun', defaultMessage: '查询' }),
},
},
},
},
},
}
}
}
}
......@@ -105,7 +105,7 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
</SelectStyles>
{dataSource.length > 3 &&
<div onClick={toogleMore} style={{ textAlign: 'center', cursor: 'pointer' }}>
{intl.formatMessage({ id: 'processRuleSetting.xianshigengduo', defaultMessage: '显示更多' })}{showMore ? <CaretDownOutlined /> : <CaretUpOutlined />}
{intl.formatMessage({ id: 'processRuleSetting.xianshigengduo', defaultMessage: '显示更多' })}{showMore ? <CaretUpOutlined /> : <CaretDownOutlined />}
</div>
}
</div>
......
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