lex-xin 7 months ago
parent
commit
fceb13aab7

+ 1 - 2
src/student/discount-card/index.tsx

@@ -82,7 +82,6 @@ export default defineComponent({
             data: { goodType: 'DISCOUNT' }
           }
         )
-        console.log(resPadding, 'resPadding')
         if (resPadding?.data?.id) {
           state.orderVisible = true
           state.orderDetail = resPadding.data || {}
@@ -121,7 +120,7 @@ export default defineComponent({
             salePrice: state.discountDetail.salePrice,
             period: state.discountDetail.period,
             price: state.discountDetail.salePrice,
-            startTime: dayjs(startTime).format('YYYY-MM-DD'),
+            startTime: userInfo.value.discountCardFlag ? dayjs(startTime).add(1, 'day').format('YYYY-MM-DD') : dayjs(startTime).format('YYYY-MM-DD'),
             endTime: dayjs(endTime).format('YYYY-MM-DD')
           }
         ]

+ 2 - 1
src/student/teacher-dependent/teacher-style/index.module.less

@@ -99,7 +99,7 @@
 
     .teUserName {
       padding-right: 6px;
-      margin-right: 6px;
+      // margin-right: 6px;
       max-width: 65px;
       // &::after {
       //   content: '|';
@@ -108,6 +108,7 @@
     }
   }
   .teUserNum {
+    font-size: 12px;
     color: #999999;
   }
 }

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

@@ -225,7 +225,7 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
     case 'DISCOUNT':
       {
         const users = state.user.data || {}
-        const endTime = users.discountCardFlag ? dayjs(users.discountEndTime || new Date()).add(1, 'day').toDate() : new Date()
+        const endTime = users.discountCardFlag ? dayjs(users.discountEndTime || new Date()).toDate() : new Date()
         tempList = {
           orderType: item.goodType,
           goodName: item.goodName,

+ 20 - 1
src/views/order-detail/index.tsx

@@ -35,7 +35,7 @@ import { moneyFormat } from '@/helpers/utils'
 import OrderPinao from './order-pinao'
 import { getMusicDetail } from '@/student/trade/tradeOrder'
 import OrderActive from './order-active'
-import UseCoupon from './use-coupons'
+import UseCoupon, { couponToOrderTypeEnum } from './use-coupons'
 import OrderAlbum from './order-album'
 import { useRect } from '@vant/use'
 import QrcodePayment from './qrcode-payment'
@@ -454,10 +454,29 @@ export default defineComponent({
     },
     onCouponSelect(item: any) {
       let discountCount = 0
+      let universalCount = 0
+      const tempPrice: any = {}
+      this.orderGoodsType.forEach((type: any) => {
+        tempPrice[type.orderType] = type.price
+      })
       ;(item || []).forEach((item: any) => {
         discountCount += Number(item.discountPrice)
+        if(item.couponCategory === 'UNIVERSAL') {
+          universalCount += Number(item.discountPrice)
+        } else {
+          const tempCoupon = couponToOrderTypeEnum[item.couponCategory]
+          const price = tempPrice[tempCoupon] - Number(item.discountPrice)
+          tempPrice[tempCoupon] = price >= 0 ? price : 0
+        }
       })
 
+      // 获取金额
+      let tempAllAmount = 0
+      for(let i in tempPrice) {
+        tempAllAmount += tempPrice[i]
+      }
+      console.log(tempAllAmount, 'tempAllAmount')
+
       const lastAmount = Number(
         numberToTwoUp(
           Number(this.orderAmount) -

+ 21 - 0
src/views/order-detail/use-coupons/index.tsx

@@ -23,6 +23,27 @@ export const couponEnum = {
   ALBUM: 'ALBUM'
 }
 
+
+/*
+ * 优惠券类型对应订单类型
+ */
+export const couponToOrderTypeEnum = {
+  UNIVERSAL: 'UNIVERSAL',
+  VIP: 'VIP',
+  SVIP: 'SVIP',
+  PIANO: 'PIANO_ROOM',
+  MALL: 'GOODS',
+  MUSIC: 'MUSIC',
+  VIP_COURSE: 'VIP_COURSE',
+  DISCOUNT: 'DISCOUNT',
+  PRACTICE: 'SPARRING',
+  LIVE: 'LIVE',
+  VIDEO: 'VIDEO',
+  ALBUM: 'ALBUM'
+}
+
+
+
 export default defineComponent({
   name: 'use-conpon',
   props: {