瀏覽代碼

Update tradeOrder.ts

lex 9 月之前
父節點
當前提交
9b949a987d
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      src/student/trade/tradeOrder.ts

+ 9 - 9
src/student/trade/tradeOrder.ts

@@ -88,6 +88,14 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
       {
         try {
           const res = await getVipDetail(item.id)
+
+          // couponAmount 总的优惠金额
+          // discountPrice 优惠券金额
+          let tempPrice = res.salePrice || item.actualPrice
+          if (amount?.couponAmount) {
+            tempPrice = Number(((res.salePrice - (amount.couponAmount -
+              amount.discountPrice) / res.times)).toFixed(2))
+          }
           tempList = {
             orderType: item.goodType,
             goodName: item.goodName,
@@ -96,15 +104,7 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
             title: memberType[res.period] || '',
             vipEndDays: item.vipEndDays,
             // 判断是否有优惠金额
-            price: amount?.couponAmount
-              ? Number(
-                (
-                  res.salePrice -
-                  amount.couponAmount +
-                  amount.discountPrice
-                ).toFixed(2)
-              )
-              : res.salePrice || item.actualPrice,
+            price: tempPrice,
             startTime: dayjs(res.startTime).format('YYYY-MM-DD'),
             endTime: dayjs(res.endTime).format('YYYY-MM-DD')
           }