lex-xin 7 months ago
parent
commit
7ba55d10f5

+ 1 - 0
src/constant/index.ts

@@ -7,6 +7,7 @@ export const goodsType = {
   MUSIC: '单曲点播',
   ALBUM: '专辑购买',
   VIP_COURSE: 'VIP定制课',
+  DISCOUNT: '畅学卡',
   PIANO_ROOM: '琴房时长充值',
   ACTI_REGIST: '活动报名',
   TENANT_ALBUM: '机构专辑'

+ 2 - 2
src/student/teacher-dependent/components/video-item/index.module.less

@@ -25,8 +25,8 @@
     font-weight: 600;
     font-size: 15px;
     color: #131415;
-    line-height: 21px;
-    max-width: 180px;
+    line-height: 21px;  
+    max-width: 165px;
   }
 
   .viUserNum {

+ 4 - 0
src/student/trade/tradeOrder.ts

@@ -136,6 +136,10 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
                     (amount.couponAmount - amount.discountPrice)) / item.goodNum
                 ).toFixed(2)
               )
+          } else {
+            tempPrice = Number(
+              tempPrice / item.goodNum
+              ).toFixed(2)
           }
           // 判断是否有会员
           let startTime = new Date()

+ 35 - 4
src/views/trade/trade-detail.tsx

@@ -59,8 +59,28 @@ export default defineComponent({
   },
   computed: {
     orderDetailList() {
+
       const result: any = this.result
-      return result.orderDetailList || []
+      const orderDetailList = result.orderDetailList || []
+
+      orderDetailList.forEach((item: any) => {
+        let tempPrice = item?.expectPrice || item.actualPrice
+        if (item?.couponAmount) {
+            tempPrice = Number(
+              (
+                (tempPrice - result.couponAmount) / item.goodNum
+              ).toFixed(2)
+            )
+        } else {
+          tempPrice = Number(
+            tempPrice / item.goodNum
+            ).toFixed(2)
+        }
+
+        item.showPrice = tempPrice || 0
+      })
+
+      return orderDetailList || []
     }
   },
   async mounted() {
@@ -204,10 +224,13 @@ export default defineComponent({
                     ),
                     default: () => (
                       <div class={styles.content}>
-                        <span class={styles.price}>
+                        {item.giftFlag ? <span class={styles.price}>
+                          赠送
+                        </span>: <span class={styles.price}>
-                          {(this as any).$filters.moneyFormat(item.expectPrice)}
-                        </span>
+                          {(this as any).$filters.moneyFormat(item.showPrice)}
+                        </span>}
+                        
                         <span class={styles.num}>x{item.goodNum}</span>
                       </div>
                     )
@@ -215,6 +238,14 @@ export default defineComponent({
                 />
               ))}
 
+              {this.result.couponAmount > 0 && <Row class={styles.optionRow}>
+                <Col span="8" offset={1}>
+                  优惠金额:
+                </Col>
+                <Col span="14">{(this as any).$filters.moneyFormat(item.showPrice)}</Col>
+                <Col span="1"> </Col>
+              </Row>}
+              
               <Row class={styles.optionRow}>
                 <Col span="8" offset={1}>
                   订单号: