Commit 39caf487 authored by XieZhiXiong's avatar XieZhiXiong
parents 156967c1 d7684fbd
...@@ -798,10 +798,12 @@ export const PurchaseOrderInsideWorkStateTexts = { ...@@ -798,10 +798,12 @@ export const PurchaseOrderInsideWorkStateTexts = {
2: '一级待审核订单', 2: '一级待审核订单',
3: '二级待审核订单', 3: '二级待审核订单',
4: '待提交订单', 4: '待提交订单',
5: '待确认电子合同', // 5: '待确认电子合同',
5: '提交订单完成',
6: '提交一级审核订单不通过', 6: '提交一级审核订单不通过',
7: '提交二级审核订单不通过', 7: '提交二级审核订单不通过',
8: '待支付订单', // 8: '待支付订单',
8: '确认电子合同',
10: '支付成功', 10: '支付成功',
11: '支付失败', 11: '支付失败',
12: '待确认收货', 12: '待确认收货',
......
...@@ -111,7 +111,7 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -111,7 +111,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
setIsAllAttributePic(setImageType) setIsAllAttributePic(setImageType)
_priceAttributeParams = priceAttributeParams.map((_item, _index) => { _priceAttributeParams = priceAttributeParams.map((_item, _index) => {
let _obj = {..._item, goodsId: _item.goods.id} let _obj = {..._item, goodsId: _item?.goods?.id || _item.goodsId}
_obj.commodityPic = maintainImageData[_index] || [] _obj.commodityPic = maintainImageData[_index] || []
return _obj return _obj
}) })
......
...@@ -189,8 +189,9 @@ const CreateOrderElectronModal:React.FC<OrderElectronModalProps> = (props) => { ...@@ -189,8 +189,9 @@ const CreateOrderElectronModal:React.FC<OrderElectronModalProps> = (props) => {
effects={($, actions) => { effects={($, actions) => {
// $('onFormInit').subscribe(() => { // $('onFormInit').subscribe(() => {
if (data.isElectronicContract === 1) { if (data.isElectronicContract === 1) {
useAsyncSelect('contractTemplateId', async () => (await PublicApi.getOrderSelectListContractTemplate()).data, ['name', 'id']) useAsyncSelect('contractTemplateId', async () => (await PublicApi.getOrderSelectListContractTemplate()).data, ['name', 'id']).then(()=>{
actions.setFieldValue("contractTemplateId", data.contractTemplateId) actions.setFieldValue("contractTemplateId", data.contractTemplateId)
})
} else { } else {
actions.setFieldState('usingElectronicContracts', state => { actions.setFieldState('usingElectronicContracts', state => {
state.value = 0 state.value = 0
......
...@@ -95,20 +95,24 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => { ...@@ -95,20 +95,24 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
} }
const [amountMoney, setAmountMoney] = useState<number>(amount || sum + freePrice) const [amountMoney, setAmountMoney] = useState<number>(amount || sum + freePrice)
const [changeTotal, setChangeTotal] = useState<boolean>(false) // 是否改变总价
// useEffect(() => {
// const _sum = orderProductRequests.reduce((prev, next) => prev + Number((next.money || 0)), 0)
// setSum(_sum)
// }, [])
// 总计金额 // 总计金额
useEffect(() => { useEffect(() => {
setAmountMoney(() => (sum*1000 + freePrice*1000)/1000) setAmountMoney(() => (sum*1000 + freePrice*1000)/1000)
}, [sum, freePrice]) }, [sum, freePrice])
useEffect(() => {
if(changeTotal){
// 执行修改订单运费
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2})
}
}, [amountMoney])
const handleConfirm = () => { const handleConfirm = () => {
setFreePrice(Number(modalPriceActions.getFieldValue('freePrice') || 0)) setFreePrice(Number(modalPriceActions.getFieldValue('freePrice') || 0))
modelRef.current.setVisible(false) modelRef.current.setVisible(false)
setChangeTotal(true)
} }
useEffect(() => { useEffect(() => {
...@@ -294,7 +298,6 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -294,7 +298,6 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const warehouseRef = useRef<any>({}) const warehouseRef = useRef<any>({})
// 判断是否可操作当前表格 // 判断是否可操作当前表格
console.log(SaleOrderInsideWorkStateTexts[data.purchaseOrderInteriorState],data, 'data')
const isEditData = SaleOrderInsideWorkStateTexts[data.purchaseOrderInteriorState] === '待审核订单' const isEditData = SaleOrderInsideWorkStateTexts[data.purchaseOrderInteriorState] === '待审核订单'
const productComponents = { const productComponents = {
body: { body: {
...@@ -338,12 +341,14 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -338,12 +341,14 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const handleSave = row => { const handleSave = row => {
const newData = [...orderProductRequests]; const newData = [...orderProductRequests];
const index = newData.findIndex(item => row.key === item.key); const index = newData.findIndex(item => row.id === item.id);
const item = newData[index]; const item = newData[index];
newData.splice(index, 1, { newData.splice(index, 1, {
...item, ...item,
...row, ...row,
}); });
// 执行修改订单价格
PublicApi.postOrderProductPriceUpdate({orderId: data.id, orderDetailsId: row.id, price: row.price, type: 1})
ctl.setData({ ctl.setData({
...data, ...data,
orderProductRequests: newData orderProductRequests: newData
......
...@@ -30,6 +30,7 @@ import { changeRouterTitleByStatus } from '../../_public/order/utils' ...@@ -30,6 +30,7 @@ import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { ReadyAddOrderDetailContext } from '../context' import { ReadyAddOrderDetailContext } from '../context'
import AuditProcess from '@/components/AuditProcess' import AuditProcess from '@/components/AuditProcess'
import styles from './index.less' import styles from './index.less'
import { toPoint } from '@/utils/type'
export interface PurchaseOrderDetailProps {} export interface PurchaseOrderDetailProps {}
...@@ -180,7 +181,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -180,7 +181,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
orderProductRequests: _orderProductRequests.map(v => { orderProductRequests: _orderProductRequests.map(v => {
v.price = 1 v.price = 1
v.isMemberPrice = Number(v.isMemberPrice) v.isMemberPrice = Number(v.isMemberPrice)
v.memberPrice = parseInt(v.memberPrice) v.memberPrice = toPoint(v.memberPrice)
v.imgUrl = v.mainPic v.imgUrl = v.mainPic
v.minOrder = v.minOrder v.minOrder = v.minOrder
// v.productId = v.id // v.productId = v.id
......
...@@ -5,6 +5,7 @@ import { productInfoColumns } from '../constant'; ...@@ -5,6 +5,7 @@ import { productInfoColumns } from '../constant';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell'; import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
import { useModalTable } from './useModalTable'; import { useModalTable } from './useModalTable';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'; import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { toPoint } from '@/utils/type';
export const getUnitPriceTotal = (record) => { export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['purchaseCount']) || 0 const purchaseCount = Number(record['purchaseCount']) || 0
...@@ -27,7 +28,9 @@ export const getUnitPriceTotal = (record) => { ...@@ -27,7 +28,9 @@ export const getUnitPriceTotal = (record) => {
return false return false
} }
}) })
return unitPrice * purchaseCount // 考虑会员折扣
let memberPrice = record?.memberPrice ? toPoint(record.memberPrice) : 1
return unitPrice * purchaseCount * memberPrice
} }
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => { export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const productRef = useRef<any>({}) const productRef = useRef<any>({})
......
import React from 'react' import React, { useRef } from 'react'
import { history } from 'umi' import { history } from 'umi'
import { Card, Button, Space, Dropdown, Menu } from 'antd' import { Card, Button, Space, Dropdown, Menu } from 'antd'
import { StandardTable } from 'god' import { StandardTable } from 'god'
...@@ -24,14 +24,17 @@ const fetchTableData = async (params) => { ...@@ -24,14 +24,17 @@ const fetchTableData = async (params) => {
// TODO // TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => { const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const refTable = useRef<any>({})
const { const {
columns columns
} = useSelfTable() } = useSelfTable(refTable)
return <PageHeaderWrapper> return <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
fetchTableData={params => fetchTableData(params)} fetchTableData={params => fetchTableData(params)}
ref={refTable}
columns={columns} columns={columns}
rowKey={'orderNo'} rowKey={'orderNo'}
formilyLayouts={{ formilyLayouts={{
......
import React, { useRef } from 'react' import React, { useRef } from 'react'
import { history, Link } from 'umi' import { history, Link } from 'umi'
import { Button, Row, Col, Progress } from 'antd' import { Button, Row, Col, Progress, Popconfirm } from 'antd'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
...@@ -49,8 +49,18 @@ const CircleChart = props => { ...@@ -49,8 +49,18 @@ const CircleChart = props => {
} }
// 业务hooks, 待支付订单 // 业务hooks, 待支付订单
export const useSelfTable = () => { export const useSelfTable = (props) => {
const { refTable } = props
const ref = useRef<any>({}) const ref = useRef<any>({})
const handleCancel = (param) => {
PublicApi.postOrderPurchaseOrderCancel({id: param}).then(res => {
if(res.code === 1000) {
refTable.current.reload()
}
})
}
const payOrderColumns: any[] = [ const payOrderColumns: any[] = [
{ {
title: '订单号', title: '订单号',
...@@ -124,27 +134,41 @@ export const useSelfTable = () => { ...@@ -124,27 +134,41 @@ export const useSelfTable = () => {
title: '当前支付', align: 'center', dataIndex: 'currentPayments', width: 140, render: (text, record) => <> title: '当前支付', align: 'center', dataIndex: 'currentPayments', width: 140, render: (text, record) => <>
<Row justify='space-between'> <Row justify='space-between'>
<Col>{record.currentPayments} / {record.sum}</Col> <Col>{record.currentPayments} / {record.sum}</Col>
<Col> {/* <Col>
{ {
record.currentPayments !== record.sum && record.currentPayments !== record.sum &&
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) && (record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
<Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link> <Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link>
} }
</Col> </Col> */}
</Row> </Row>
<Progress percent={Math.ceil(record.currentPayments / record.sum)} showInfo={false} /> <Progress percent={Math.ceil(record.currentPayments / record.sum)} showInfo={false} />
</> </>
}, },
// { {
// title: '操作', title: '操作',
// align: 'center', align: 'center',
// dataIndex: 'ctl', dataIndex: 'ctl',
// key: 'ctl', key: 'ctl',
// render: (text, record) => <> render: (text, record) => <>
// <Button type='link' onClick={() => handleConfirm(record)}>支付</Button> {
// <Button type='link' onClick={() => handleCancel(record.id)}>取消订单</Button> record.currentPayments !== record.sum &&
// </> (record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
// } <Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link>
}
{
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER && !record.signatureLogId || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
<Popconfirm
title="是否要取消该订单?"
onConfirm={() => handleCancel(record.id)}
okText="是"
cancelText="否"
>
<Button type='link'>取消订单</Button>
</Popconfirm>
}
</>
}
] ]
return { return {
......
export function isString(str: any):str is string { export function isString(str: any):str is string {
return typeof str === 'string' return typeof str === 'string'
}
// 分数转小数
export const toPoint = (percent: string) => {
let str: any = percent.replace("%","");
str = str / 100;
return str;
}
// 小数转分数
export const toPercent = (point: number) => {
let str = Number(point * 100).toFixed(1);
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