订单列表对接
This commit is contained in:
parent
864f2342b6
commit
b5c4500866
@ -6,14 +6,16 @@ import { useCallback, useRef, memo } from "react"
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
status?: number, //订单状态
|
orderInfo: {
|
||||||
orderId: number, //订单id
|
status?: number, //订单状态
|
||||||
payModel: number, //支付方式
|
orderId: number, //订单id
|
||||||
realPayPrice: number, //实付金额
|
payModel: number, //支付方式
|
||||||
pendingPayPrice: number, //待付金额
|
realPayPrice: number, //实付金额
|
||||||
|
pendingPayPrice: number, //待付金额
|
||||||
|
},
|
||||||
onClick?: (val: number) => void //点击后触发的事件,返回订单状态
|
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([
|
const orderBtnsList = useRef([
|
||||||
{
|
{
|
||||||
@ -55,10 +57,10 @@ export default memo(({status = 0, orderId = 0, onClick, realPayPrice = 0, pendin
|
|||||||
//判断是否显示该按钮
|
//判断是否显示该按钮
|
||||||
const orderBtnsShow = useCallback((item, status) => {
|
const orderBtnsShow = useCallback((item, status) => {
|
||||||
if(item.id == 1) {
|
if(item.id == 1) {
|
||||||
return( realPayPrice == 0 && status <= 4) //在代发货之前没有付过款
|
return( orderInfo.realPayPrice == 0 && status <= 4) //在代发货之前没有付过款
|
||||||
}
|
}
|
||||||
if(item.id == 2) {
|
if(item.id == 2) {
|
||||||
return( pendingPayPrice != 0 && status <= 4) //在代发货之前没有付完款
|
return( orderInfo.pendingPayPrice != 0 && status <= 4) //在代发货之前没有付完款
|
||||||
}
|
}
|
||||||
return item.value.includes(status)
|
return item.value.includes(status)
|
||||||
},[])
|
},[])
|
||||||
@ -76,7 +78,7 @@ export default memo(({status = 0, orderId = 0, onClick, realPayPrice = 0, pendin
|
|||||||
title: '要取消该订单吗?',
|
title: '要取消该订单吗?',
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
let res = await cancelFetchData({id: orderId})
|
let res = await cancelFetchData({id: orderInfo.orderId})
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
alert.success('取消成功')
|
alert.success('取消成功')
|
||||||
onClick?.(1)
|
onClick?.(1)
|
||||||
|
@ -162,6 +162,17 @@ import styles from './index.module.scss'
|
|||||||
setPayMentShow(() => false)
|
setPayMentShow(() => false)
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
|
|
||||||
|
//按钮所需数据
|
||||||
|
const orderInfo = useMemo(() => {
|
||||||
|
return {
|
||||||
|
status: orderDetail?.status,
|
||||||
|
orderId: orderDetail?.id,
|
||||||
|
payModel: orderDetail?.id, //支付方式
|
||||||
|
realPayPrice: orderDetail?.id, //实付金额
|
||||||
|
pendingPayPrice: orderDetail?.id, //待付金额
|
||||||
|
}
|
||||||
|
}, [orderDetail])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_main}>
|
<View className={styles.order_main}>
|
||||||
{/* <View className={styles.weight_memo_con}>
|
{/* <View className={styles.weight_memo_con}>
|
||||||
@ -196,7 +207,7 @@ import styles from './index.module.scss'
|
|||||||
<View className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></View>
|
<View className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.submit_order}>
|
<View className={styles.submit_order}>
|
||||||
<OrderBtns status={orderDetail?.status} orderId={orderDetail?.id} onClick={orderStateClick}/>
|
<OrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
|
||||||
{/* <View className={styles.order_btn} onClick={() => toPay()}>去支付</View> */}
|
{/* <View className={styles.order_btn} onClick={() => toPay()}>去支付</View> */}
|
||||||
</View>
|
</View>
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)} >
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)} >
|
||||||
|
Loading…
x
Reference in New Issue
Block a user