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

fix: 处理订单下单价格字段传参异常

parent 5e92b7d4
...@@ -206,8 +206,9 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => { ...@@ -206,8 +206,9 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
// 开始数量合并 // 开始数量合并
let processOrderProductRequests = schemaAction.getFieldValue("orderProductRequests") let processOrderProductRequests = schemaAction.getFieldValue("orderProductRequests")
let __ = processOrderProductRequests.map(item => { console.log(processOrderProductRequests, '合并之前')
item["productId"] = item.id let __ = [...processOrderProductRequests].map(item => {
item["productId"] = item.productId || item.id
if(item.id === currentClickRow.id) { if(item.id === currentClickRow.id) {
// let count = _childSelectedRows.length > 1 ? _childSelectedRows.reduce((a, b) => a.purchaseCount + b.purchaseCount) : _childSelectedRows[0].purchaseCount // let count = _childSelectedRows.length > 1 ? _childSelectedRows.reduce((a, b) => a.purchaseCount + b.purchaseCount) : _childSelectedRows[0].purchaseCount
// @to fix 第一次合并无法填入采购数量 新增情况下:手工模式不累加,报价单模式累加;编辑模式都累加 // @to fix 第一次合并无法填入采购数量 新增情况下:手工模式不累加,报价单模式累加;编辑模式都累加
......
...@@ -102,11 +102,12 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor ...@@ -102,11 +102,12 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用 if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用
// 请求一次并复制给支付信息 // 请求一次并复制给支付信息
const productItem = value[0] const productItem = value[0]
console.log(productItem, 'pitem')
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现 if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD && ctx.getFieldValue('orderModel') < OrderModalType.PURCHASE_ENQUIRY_CONTRACT_ORDER) { // 新增下 需要支付信息生成支付次数 // @采购合同下单无需支付信息 } else if(pageStatus === PageStatus.ADD && ctx.getFieldValue('orderModel') < OrderModalType.PURCHASE_ENQUIRY_CONTRACT_ORDER) { // 新增下 需要支付信息生成支付次数 // @采购合同下单无需支付信息
fetchOrderApi.getPayInfoList({ fetchOrderApi.getPayInfoList({
productId: (orderModel === OrderModalType["HAND_ORDER"] || orderModel === OrderModalType["CHANNEL_DIRECT_MINING_ORDER"] || orderModel === OrderModalType["CHANNEL_SPOT_MANUAL_ORDER"]) ? productItem.id : productItem.productId, productId: (orderModel === OrderModalType["HAND_ORDER"] || orderModel === OrderModalType["CHANNEL_DIRECT_MINING_ORDER"] || orderModel === OrderModalType["CHANNEL_SPOT_MANUAL_ORDER"]) ? productItem.id : (productItem.productId || productItem.id),
memberId: productItem?.memberId || ctx.getFieldValue('supplyMembersId'), memberId: productItem?.memberId || ctx.getFieldValue('supplyMembersId'),
memberRoleId: productItem?.memberRoleId || ctx.getFieldValue('supplyMembersRoleId'), memberRoleId: productItem?.memberRoleId || ctx.getFieldValue('supplyMembersRoleId'),
orderModel: orderModel, orderModel: orderModel,
......
...@@ -207,6 +207,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -207,6 +207,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}, []) }, [])
const handleSubmit = async (value) => { const handleSubmit = async (value) => {
console.log(value, 'value')
let _orderProductRequests = JSON.parse(JSON.stringify(value.orderProductRequests)) let _orderProductRequests = JSON.parse(JSON.stringify(value.orderProductRequests))
let processEnum = value['processEnum'] let processEnum = value['processEnum']
let usingElectronicContracts = value['usingElectronicContracts'] let usingElectronicContracts = value['usingElectronicContracts']
...@@ -231,7 +232,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -231,7 +232,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
roleId: value['supplyMembersRoleId'], roleId: value['supplyMembersRoleId'],
quotationNo: value["quotationNo"], quotationNo: value["quotationNo"],
orderProductRequests: _orderProductRequests.map(v => { orderProductRequests: _orderProductRequests.map(v => {
v.price = 1 // v.price = 1
v.price = v.price
v.isMemberPrice = Number(v.isMemberPrice) v.isMemberPrice = Number(v.isMemberPrice)
v.memberPrice = v.memberPrice v.memberPrice = v.memberPrice
v.imgUrl = v.mainPic ? v.mainPic : v.imgUrl v.imgUrl = v.mainPic ? v.mainPic : v.imgUrl
...@@ -269,7 +271,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -269,7 +271,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
deliveryTime: moment(value.deliveryTime).valueOf(), deliveryTime: moment(value.deliveryTime).valueOf(),
// 没用的字段 // 没用的字段
orderProductRequests: _orderProductRequests.map(v => { orderProductRequests: _orderProductRequests.map(v => {
v.price = 1 // v.price = 1
v.price = v.price
v.isMemberPrice = Number(v.isMemberPrice) || 0 v.isMemberPrice = Number(v.isMemberPrice) || 0
v.memberPrice = v.memberPrice v.memberPrice = v.memberPrice
v.imgUrl = v.mainPic ? v.mainPic : v.imgUrl v.imgUrl = v.mainPic ? v.mainPic : v.imgUrl
......
...@@ -40,6 +40,10 @@ export const getUnitPriceTotal = (record) => { ...@@ -40,6 +40,10 @@ export const getUnitPriceTotal = (record) => {
if(record.price && JSON.stringify(record.unitPrice) === "{}") { if(record.price && JSON.stringify(record.unitPrice) === "{}") {
record.unitPrice = {'0-0': record.price} record.unitPrice = {'0-0': record.price}
} }
// fix 当有unitPrice字段时 没有price字段时 补全price字段
if(!record?.price && JSON.stringify(record.unitPrice) !== "{}") {
if(Object.keys(record.unitPrice)[0] === '0-0') record.price = record.unitPrice['0-0']
}
let unitPrice = 0 let unitPrice = 0
Object.entries(record.unitPrice).forEach(([key, value]) => { Object.entries(record.unitPrice).forEach(([key, value]) => {
const [min, max] = key.split('-').map(v => Number(v)) const [min, max] = key.split('-').map(v => Number(v))
...@@ -129,7 +133,8 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -129,7 +133,8 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
if(orderModel === OrderModalType["HAND_ORDER"]) { if(orderModel === OrderModalType["HAND_ORDER"]) {
return r.id return r.id
} else { } else {
return r.id ? r.id : r.productId // return r.id ? r.id : r.productId
return r.productId || r.id
} }
} }
......
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