对接售后退款申请

This commit is contained in:
2022-06-24 19:54:01 +08:00
parent 9503d35dbb
commit 3d349d405a
14 changed files with 134 additions and 66 deletions
+25
View File
@@ -7,6 +7,7 @@ import {useRef, memo, useState, useMemo } from "react"
import classnames from "classnames";
import styles from './index.module.scss'
import { AddShoppingCartApi } from "@/api/shopCart"
import { ApplyRefundApi } from "@/api/salesAfterOrder"
type Param = {
orderInfo: {
@@ -133,6 +134,8 @@ export default memo(({orderInfo, onClick}:Param) => {
receiveOrder()
} else if(val == 5) {
goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
} else if(val == 8) {
applyRefund()
} else {
onClick?.(val)
}
@@ -181,6 +184,28 @@ export default memo(({orderInfo, onClick}:Param) => {
})
}
//退款
const {fetchData: fetchDataApplyRefund} = ApplyRefundApi()
const applyRefund = async () => {
Taro.showModal({
title: '确定退款?',
success: async function async (res) {
if(res.confirm) {
let res = await fetchDataApplyRefund({sale_order_id: orderInfo?.orderId})
if(res.success) {
alert.success('申请成功')
} else {
alert.error('申请失败')
}
onClick?.(8)
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
//显示更多按钮
const [showMore, setShowMore] = useState(false)