|
@@ -11,7 +11,11 @@ const apiSuffix =
|
|
|
// VIDEO: '视频课',
|
|
|
// VIP: '开通会员',
|
|
|
// MUSIC: '单曲点播'
|
|
|
-export const formatOrderDetail = async (item: any, couponAmount?: number) => {
|
|
|
+interface IAmount {
|
|
|
+ couponAmount: number
|
|
|
+ discountPrice: number
|
|
|
+}
|
|
|
+export const formatOrderDetail = async (item: any, amount?: IAmount) => {
|
|
|
const type = item.goodType
|
|
|
let tempList: any = {}
|
|
|
|
|
@@ -89,8 +93,14 @@ export const formatOrderDetail = async (item: any, couponAmount?: number) => {
|
|
|
id: item.id,
|
|
|
title: memberType[res.period] || '',
|
|
|
// 判断是否有优惠金额
|
|
|
- price: couponAmount
|
|
|
- ? Number((res.salePrice - couponAmount).toFixed(2))
|
|
|
+ price: amount?.couponAmount
|
|
|
+ ? Number(
|
|
|
+ (
|
|
|
+ res.salePrice -
|
|
|
+ amount.couponAmount +
|
|
|
+ amount.discountPrice
|
|
|
+ ).toFixed(2)
|
|
|
+ )
|
|
|
: res.salePrice || item.actualPrice,
|
|
|
startTime: dayjs(res.startTime).format('YYYY-MM-DD'),
|
|
|
endTime: dayjs(res.endTime).format('YYYY-MM-DD')
|
|
@@ -208,18 +218,22 @@ export const tradeOrder = (result: any, callBack?: any) => {
|
|
|
orderName,
|
|
|
orderType,
|
|
|
orderDetailList,
|
|
|
- couponAmount // 优惠金额
|
|
|
+ couponAmount, // 优惠金额
|
|
|
+ discountPrice
|
|
|
} = result
|
|
|
orderStatus.orderObject.orderType = orderType
|
|
|
orderStatus.orderObject.orderName = orderName
|
|
|
orderStatus.orderObject.orderDesc = orderDesc
|
|
|
orderStatus.orderObject.actualPrice = actualPrice
|
|
|
orderStatus.orderObject.orderNo = orderNo
|
|
|
- // orderStatus.orderObject.actualPrice = actualPrice
|
|
|
+ orderStatus.orderObject.discountPrice = discountPrice
|
|
|
orderStatus.orderObject.orderList = []
|
|
|
try {
|
|
|
orderDetailList.forEach(async (item: any) => {
|
|
|
- await formatOrderDetail(item, couponAmount)
|
|
|
+ await formatOrderDetail(item, {
|
|
|
+ couponAmount,
|
|
|
+ discountPrice
|
|
|
+ })
|
|
|
})
|
|
|
callBack && callBack()
|
|
|
} catch {
|