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

fix:处理销售订单一级审核通过异常,处理新增采购订单折扣价计算异常/获取运费异常

parent 21aae1ff
......@@ -816,12 +816,10 @@ export const PurchaseOrderInsideWorkStateTexts = {
2: '一级待审核订单',
3: '二级待审核订单',
4: '待提交订单',
// 5: '待确认电子合同',
5: '提交订单完成',
5: '待确认电子合同',
6: '提交一级审核订单不通过',
7: '提交二级审核订单不通过',
// 8: '待支付订单',
8: '确认电子合同',
8: '待支付订单',
10: '支付成功',
11: '支付失败',
12: '待确认收货',
......
......@@ -20,6 +20,7 @@ import {
GetProductCommodityGetShopResponse
} from '@/services/ProductApi'
import moment from 'moment'
import { isGetAccessor } from 'typescript'
interface IAttributeByValue {
groupName: string;
......@@ -365,11 +366,11 @@ const viewProducts: React.FC<{}> = () => {
onBack={() => history.goBack()}
backIcon={<ReutrnEle logoSrc={productDetail?.unitPriceAndPicList[0]?.commodityPic[0]} />}
content={content}
extra={[
<Button icon={<FormOutlined />} key="1" type="primary" disabled={productDetail?.status !== 3 && productDetail?.status !== 1 } onClick={clickModify}>
修改
</Button>,
]}
// extra={[
// <Button icon={<FormOutlined />} key="1" type="primary" disabled={productDetail?.status !== 3 && productDetail?.status !== 1 } onClick={clickModify}>
// 修改
// </Button>,
// ]}
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="流程进度">
......
......@@ -4,6 +4,7 @@ import { Row, Space, Popover } from 'antd'
import { DELIVERY_TYPE, OrderModalType, PurchaseOrderOutWorkStateTexts } from '@/constants'
import { EnvironmentOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { toPercent } from '@/utils/type'
// 简单控制价格区间的组件
// @todo 后续需要优化, 样式,目录文件等。
......@@ -277,11 +278,15 @@ export const productInfoColumns: any[] = [
align: 'left',
key: 'unitPrice',
render: (t, r) => {
if(r?.commodityId) {
return <PriceComp priceSection={r.unitPrice}/>
} else {
console.log(r,'rr')
// if(r?.commodityId) {
// return <PriceComp priceSection={r.unitPrice}/>
// } else {
// return r.price
// }
if(JSON.stringify(r.unitPrice) === '{}') {
return r.price
} else {
return <PriceComp priceSection={r.unitPrice}/>
}
}
},
......@@ -290,7 +295,7 @@ export const productInfoColumns: any[] = [
dataIndex: 'memberPrice',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? text : null
render: (text, record) => record.isMemberPrice ? toPercent(text) : null
},
{
title: '采购数量',
......
......@@ -28,7 +28,8 @@ const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsync
parentMemberId: v.memberId,
parentMemberRoleId: v.memberRoleId
}, {ttl: 60 * 1000, useCache: true})
return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
// return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
return code === 1000 ? { value: data.parameter, id: v.id } : { value: '', id: 0 }
}
))
......@@ -92,10 +93,11 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
const payInfoData = ctx.getFieldValue('paymentInformationResponses')
// 强制渲染一次, 用于触发金额总数
update()
// 已经存在数据 无需请求
if (payInfoData && payInfoData.length > 0) {
// // 已经存在数据 无需请求
// if (payInfoData && payInfoData.length > 0) {
} else if (value && value.length > 0){
// } else
if (value && value.length > 0){
// 请求一次并复制给支付信息
const productItem = value[0]
fetchOrderApi.getPayInfoList({
......
......@@ -3,7 +3,7 @@ import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import ReutrnEle from '@/components/ReturnEle'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { Button, Card, Row, Col, Drawer } from 'antd'
import { Button, Card, Row, Col, Drawer, message } from 'antd'
import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd'
import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
......@@ -70,7 +70,8 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
PublicApi.postLogisticsFreightTemplateCalFreightPrice({
orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId,
weight: v.logistics.weight
weight: v.logistics.weight,
count: v?.purchaseCount || 0
})),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......@@ -181,7 +182,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
orderProductRequests: _orderProductRequests.map(v => {
v.price = 1
v.isMemberPrice = Number(v.isMemberPrice)
v.memberPrice = v.memberPrice !== 1 ? toPoint(v.memberPrice) : 1
// v.memberPrice = v.memberPrice !== 1 ? toPoint(v.memberPrice) : 1
v.memberPrice = v.memberPrice
v.imgUrl = v.mainPic
v.minOrder = v.minOrder
// v.productId = v.id
......@@ -203,16 +205,27 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// theInvoiceInfo: value.theInvoiceInfo
}
// 校验是否选择支付渠道
let judgement = params.paymentInformationResponses.map(item => {
let judgementByPay = params.paymentInformationResponses.map(item => {
if(item.channel && item.payWay){
return true
} else {
return false
}
})
if(judgement.includes(false)){
if(judgementByPay.includes(false)){
throw new Error('请选择支付方式或者支付渠道')
}
// 校验采购数量
let judgementByCount = params.orderProductRequests.map(item => {
if(item.purchaseCount){
return true
} else {
return false
}
})
if(judgementByCount.includes(false)){
throw new Error('请填写商品采购数量')
}
// logistics render字段字符串化
params.orderProductRequests = params.orderProductRequests.map(item => {
let logs: any = { ...item.logistics, render: item.logistics?.render ? JSON.stringify(item.logistics.render) : '' };
......@@ -234,6 +247,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setBtnLoading(false)
} catch (error) {
setBtnLoading(false)
error?.message && message.error(error.message)
console.log(error)
}
}
......
......@@ -27,6 +27,10 @@ export const getUnitPriceTotal = (record) => {
if(record.unitPrice) {
record.unitPrice = sortByKey(record.unitPrice)
}
// fix 当没有传递unitPrice字段时 但有price字段时 补全unitPrice字段
if(record.price && JSON.stringify(record.unitPrice) === "{}") {
record.unitPrice = {'0-0': record.price}
}
let unitPrice = 0
Object.entries(record.unitPrice).forEach(([key, value]) => {
const [min, max] = key.split('-').map(v => Number(v))
......@@ -41,8 +45,13 @@ export const getUnitPriceTotal = (record) => {
}
})
// 考虑会员折扣
let memberPrice = record.memberPrice !== 1 ? toPoint(record.memberPrice) : 1
// let memberPrice = record.memberPrice !== 1 ? toPoint(record.memberPrice) : 1
let memberPrice = record.memberPrice
if(record.isMemberPrice) {
return unitPrice * purchaseCount * memberPrice
} else {
return unitPrice * purchaseCount
}
}
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const productRef = useRef<any>({})
......@@ -96,6 +105,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const newData = [...ctx.getFieldValue('orderProductRequests')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
console.log(getUnitPriceTotal(row), 'row')
row['money'] = getUnitPriceTotal(row)
// 新增的时候接口字段id,commodityId 编辑的时候id,productId
row['productId'] = row?.commodityId ? row.id : row.productId
......
......@@ -25,7 +25,7 @@ const SecondApprovedOrderDetail: React.FC = () => {
approvedRef.current.actions.submit().then(async () => {
const params = {
id: Number(id),
state: 1
state: approvedRef.current.actions.getFieldValue('state')
}
const result = await run(params)
......
......@@ -12,7 +12,7 @@ export const toPoint = (percent: string) => {
// 小数转分数
export const toPercent = (point: number) => {
// let str = Number(point * 100).toFixed(1);
let str = Number(point * 100);
let str: any = Number(point * 100);
str += "%";
return str;
}
\ No newline at end of file
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