订单列表对接

This commit is contained in:
2022-05-31 10:27:07 +08:00
parent 864f2342b6
commit b5c4500866
2 changed files with 23 additions and 10 deletions
+11 -9
View File
@@ -6,14 +6,16 @@ import { useCallback, useRef, memo } from "react"
import styles from './index.module.scss'
type Param = {
status?: number, //订单状态
orderId: number, //订单id
payModel: number, //支付方式
realPayPrice: number, //实付金额
pendingPayPrice: number, //待付金额
orderInfo: {
status?: number, //订单状态
orderId: number, //订单id
payModel: number, //支付方式
realPayPrice: number, //实付金额
pendingPayPrice: number, //待付金额
},
onClick?: (val: number) => void //点击后触发的事件,返回订单状态
}
export default memo(({status = 0, orderId = 0, onClick, realPayPrice = 0, pendingPayPrice = 0}:Param) => {
export default memo(({orderInfo, onClick}:Param) => {
//订单按钮按订单状态归类
const orderBtnsList = useRef([
{
@@ -55,10 +57,10 @@ export default memo(({status = 0, orderId = 0, onClick, realPayPrice = 0, pendin
//判断是否显示该按钮
const orderBtnsShow = useCallback((item, status) => {
if(item.id == 1) {
return( realPayPrice == 0 && status <= 4) //在代发货之前没有付过款
return( orderInfo.realPayPrice == 0 && status <= 4) //在代发货之前没有付过款
}
if(item.id == 2) {
return( pendingPayPrice != 0 && status <= 4) //在代发货之前没有付完款
return( orderInfo.pendingPayPrice != 0 && status <= 4) //在代发货之前没有付完款
}
return item.value.includes(status)
},[])
@@ -76,7 +78,7 @@ export default memo(({status = 0, orderId = 0, onClick, realPayPrice = 0, pendin
title: '要取消该订单吗?',
success: async function (res) {
if (res.confirm) {
let res = await cancelFetchData({id: orderId})
let res = await cancelFetchData({id: orderInfo.orderId})
if(res.success) {
alert.success('取消成功')
onClick?.(1)