瀏覽代碼

更新参数

lex 1 年之前
父節點
當前提交
1acf46bcf0

+ 1 - 0
src/student/live-class/live-detail.tsx

@@ -226,6 +226,7 @@ export default defineComponent({
               orderStatus.orderObject.orderNo = result.orderNo
               orderStatus.orderObject.actualPrice = result.actualPrice
               orderStatus.orderObject.discountPrice = result.discountPrice
+              orderStatus.orderObject.paymentConfig = result.paymentConfig
               this.routerTo()
             })
             .catch(() => {

+ 271 - 269
src/student/trade/tradeOrder.ts

@@ -1,269 +1,271 @@
-import { memberType } from '@/constant'
-import request from '@/helpers/request'
-import { state } from '@/state'
-import { orderStatus } from '@/views/order-detail/orderStatus'
-import dayjs from 'dayjs'
-
-const apiSuffix =
-  state.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
-// LIVE: '直播课',
-// PRACTICE: '陪练课',
-// VIDEO: '视频课',
-// VIP: '开通会员',
-// MUSIC: '单曲点播'
-interface IAmount {
-  couponAmount: number
-  discountPrice: number
-}
-export const formatOrderDetail = async (item: any, amount?: IAmount) => {
-  const type = item.goodType
-  let tempList: any = {}
-
-  switch (type) {
-    case 'LIVE':
-      {
-        try {
-          const live = await getLiveDetail(item.bizId)
-          const courseInfo: any[] = []
-          const coursePlanList = live.planList || []
-          coursePlanList.forEach((item: any) => {
-            const startTime = item.startTime || new Date()
-            const endTime = item.endTime || new Date()
-            courseInfo.push({
-              courseTime: `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(
-                startTime
-              ).format('HH:mm')}~${dayjs(endTime).format('HH:mm')}`,
-              coursePlan: item.plan,
-              id: item.courseId
-            })
-          })
-          tempList = {
-            orderType: item.goodType,
-            goodName: item.goodName,
-            courseGroupId: live.courseGroupId,
-            courseGroupName: live.courseGroupName,
-            coursePrice: live.coursePrice,
-            teacherName: live.userName || `游客${live.teacherId || ''}`,
-            teacherId: live.teacherId,
-            avatar: live.avatar,
-            courseInfo
-          }
-        } catch (e: any) {
-          throw new Error(e.message)
-        }
-      }
-      break
-    case 'PRACTICE': {
-      const bizContent: any = JSON.parse(item.bizContent)
-      tempList = {
-        ...bizContent,
-        teacherName: item.username,
-        starGrade: item.starGrade,
-        avatar: item.avatar
-      }
-      break
-    }
-    case 'VIDEO': {
-      try {
-        const res = await getVideoDetail(item.bizId)
-        const { lessonGroup, detailList } = res
-        tempList = {
-          orderType: item.goodType,
-          goodName: item.goodName,
-          courseGroupId: lessonGroup.id,
-          courseGroupName: lessonGroup.lessonName,
-          coursePrice: lessonGroup.lessonPrice,
-          teacherName: lessonGroup.username,
-          teacherId: lessonGroup.teacherId,
-          avatar: lessonGroup.avatar,
-          courseInfo: detailList
-        }
-      } catch (e: any) {
-        throw new Error(e.message)
-      }
-      break
-    }
-    case 'VIP':
-      {
-        try {
-          const res = await getVipDetail(item.id)
-          tempList = {
-            orderType: item.goodType,
-            goodName: item.goodName,
-            id: item.id,
-            title: memberType[res.period] || '',
-            // 判断是否有优惠金额
-            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')
-          }
-        } catch (e: any) {
-          throw new Error(e.message)
-        }
-      }
-      break
-    case 'MUSIC':
-      {
-        try {
-          const res = await getMusicDetail(item.bizId)
-          tempList = {
-            orderType: item.goodType,
-            goodName: item.goodName,
-            ...res
-          }
-        } catch (e: any) {
-          throw new Error(e.message)
-        }
-      }
-      break
-    case 'ALBUM':
-      {
-        console.log(item)
-        try {
-          const res = await getAlbumDetail(item.bizId)
-          tempList = {
-            orderType: item.goodType,
-            goodName: item.goodName,
-            ...res
-          }
-        } catch (e: any) {
-          throw new Error(e.message)
-        }
-      }
-      break
-    case 'ACTI_REGIST':
-      {
-        try {
-          const res = await getMusicActiveTrack(item.bizId)
-          tempList = {
-            orderType: item.goodType,
-            goodsName: res.activityName,
-            activityId: res.id,
-            actualPrice: res.registrationPrice
-          }
-        } catch (e: any) {
-          throw new Error(e.message)
-        }
-      }
-      break
-  }
-  tempList.orderType = type
-  tempList.goodName = item.goodName
-  orderStatus.orderObject.orderList.push(tempList)
-}
-// 获取视频课详情
-export const getVideoDetail = async (groupId: any) => {
-  try {
-    const res = await request.get(
-      `${apiSuffix}/videoLesson/selectVideoLesson`,
-      {
-        params: {
-          groupId
-        }
-      }
-    )
-    return res.data
-  } catch {
-    throw new Error('获取视频课详情失败')
-  }
-}
-
-// 获取直播课详情
-export const getLiveDetail = async (groupId: any) => {
-  try {
-    const res = await request.get(
-      `${apiSuffix}/courseGroup/queryLiveCourseInfo`,
-      {
-        params: {
-          groupId
-        }
-      }
-    )
-    return res.data
-  } catch {
-    throw new Error('获取直播课详情失败')
-  }
-}
-
-// 获取会员详情
-export const getVipDetail = async (id: any) => {
-  try {
-    const setting = await request.get(`${apiSuffix}/vipCardRecord/detail/` + id)
-    return setting.data || []
-  } catch {
-    throw new Error('获取会员详情失败')
-  }
-}
-
-// 获取曲目详情
-export const getMusicDetail = async (id: any) => {
-  try {
-    const res = await request.get(`${apiSuffix}/music/sheet/detail/${id}`)
-    return res.data
-  } catch {
-    throw new Error('获取曲目详情失败')
-  }
-}
-
-// 活动列表
-// 获取曲目详情
-export const getMusicActiveTrack = async (id: any) => {
-  try {
-    const res = await request.post(`${apiSuffix}/open/activity/info/${id}`)
-    return res.data
-  } catch {
-    throw new Error('获取曲目详情失败')
-  }
-}
-
-// 获取专辑详情
-export const getAlbumDetail = async (id: any) => {
-  try {
-    const res = await request.post(`${apiSuffix}/music/album/detail`, {
-      data: { id }
-    })
-    return res.data
-  } catch {
-    throw new Error('获取专辑详情失败')
-  }
-}
-
-// 为了处理继续支付逻辑
-export const tradeOrder = (result: any, callBack?: any) => {
-  const {
-    orderNo,
-    actualPrice,
-    orderDesc,
-    orderName,
-    orderType,
-    orderDetailList,
-    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.discountPrice = discountPrice
-  orderStatus.orderObject.orderList = []
-  try {
-    orderDetailList.forEach(async (item: any) => {
-      await formatOrderDetail(item, {
-        couponAmount,
-        discountPrice
-      })
-    })
-    callBack && callBack()
-  } catch {
-    //
-  }
-}
+import { memberType } from '@/constant'
+import request from '@/helpers/request'
+import { state } from '@/state'
+import { orderStatus } from '@/views/order-detail/orderStatus'
+import dayjs from 'dayjs'
+
+const apiSuffix =
+  state.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
+// LIVE: '直播课',
+// PRACTICE: '陪练课',
+// VIDEO: '视频课',
+// VIP: '开通会员',
+// MUSIC: '单曲点播'
+interface IAmount {
+  couponAmount: number
+  discountPrice: number
+}
+export const formatOrderDetail = async (item: any, amount?: IAmount) => {
+  const type = item.goodType
+  let tempList: any = {}
+
+  switch (type) {
+    case 'LIVE':
+      {
+        try {
+          const live = await getLiveDetail(item.bizId)
+          const courseInfo: any[] = []
+          const coursePlanList = live.planList || []
+          coursePlanList.forEach((item: any) => {
+            const startTime = item.startTime || new Date()
+            const endTime = item.endTime || new Date()
+            courseInfo.push({
+              courseTime: `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(
+                startTime
+              ).format('HH:mm')}~${dayjs(endTime).format('HH:mm')}`,
+              coursePlan: item.plan,
+              id: item.courseId
+            })
+          })
+          tempList = {
+            orderType: item.goodType,
+            goodName: item.goodName,
+            courseGroupId: live.courseGroupId,
+            courseGroupName: live.courseGroupName,
+            coursePrice: live.coursePrice,
+            teacherName: live.userName || `游客${live.teacherId || ''}`,
+            teacherId: live.teacherId,
+            avatar: live.avatar,
+            courseInfo
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
+      break
+    case 'PRACTICE': {
+      const bizContent: any = JSON.parse(item.bizContent)
+      tempList = {
+        ...bizContent,
+        teacherName: item.username,
+        starGrade: item.starGrade,
+        avatar: item.avatar
+      }
+      break
+    }
+    case 'VIDEO': {
+      try {
+        const res = await getVideoDetail(item.bizId)
+        const { lessonGroup, detailList } = res
+        tempList = {
+          orderType: item.goodType,
+          goodName: item.goodName,
+          courseGroupId: lessonGroup.id,
+          courseGroupName: lessonGroup.lessonName,
+          coursePrice: lessonGroup.lessonPrice,
+          teacherName: lessonGroup.username,
+          teacherId: lessonGroup.teacherId,
+          avatar: lessonGroup.avatar,
+          courseInfo: detailList
+        }
+      } catch (e: any) {
+        throw new Error(e.message)
+      }
+      break
+    }
+    case 'VIP':
+      {
+        try {
+          const res = await getVipDetail(item.id)
+          tempList = {
+            orderType: item.goodType,
+            goodName: item.goodName,
+            id: item.id,
+            title: memberType[res.period] || '',
+            // 判断是否有优惠金额
+            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')
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
+      break
+    case 'MUSIC':
+      {
+        try {
+          const res = await getMusicDetail(item.bizId)
+          tempList = {
+            orderType: item.goodType,
+            goodName: item.goodName,
+            ...res
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
+      break
+    case 'ALBUM':
+      {
+        console.log(item)
+        try {
+          const res = await getAlbumDetail(item.bizId)
+          tempList = {
+            orderType: item.goodType,
+            goodName: item.goodName,
+            ...res
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
+      break
+    case 'ACTI_REGIST':
+      {
+        try {
+          const res = await getMusicActiveTrack(item.bizId)
+          tempList = {
+            orderType: item.goodType,
+            goodsName: res.activityName,
+            activityId: res.id,
+            actualPrice: res.registrationPrice
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
+      break
+  }
+  tempList.orderType = type
+  tempList.goodName = item.goodName
+  orderStatus.orderObject.orderList.push(tempList)
+}
+// 获取视频课详情
+export const getVideoDetail = async (groupId: any) => {
+  try {
+    const res = await request.get(
+      `${apiSuffix}/videoLesson/selectVideoLesson`,
+      {
+        params: {
+          groupId
+        }
+      }
+    )
+    return res.data
+  } catch {
+    throw new Error('获取视频课详情失败')
+  }
+}
+
+// 获取直播课详情
+export const getLiveDetail = async (groupId: any) => {
+  try {
+    const res = await request.get(
+      `${apiSuffix}/courseGroup/queryLiveCourseInfo`,
+      {
+        params: {
+          groupId
+        }
+      }
+    )
+    return res.data
+  } catch {
+    throw new Error('获取直播课详情失败')
+  }
+}
+
+// 获取会员详情
+export const getVipDetail = async (id: any) => {
+  try {
+    const setting = await request.get(`${apiSuffix}/vipCardRecord/detail/` + id)
+    return setting.data || []
+  } catch {
+    throw new Error('获取会员详情失败')
+  }
+}
+
+// 获取曲目详情
+export const getMusicDetail = async (id: any) => {
+  try {
+    const res = await request.get(`${apiSuffix}/music/sheet/detail/${id}`)
+    return res.data
+  } catch {
+    throw new Error('获取曲目详情失败')
+  }
+}
+
+// 活动列表
+// 获取曲目详情
+export const getMusicActiveTrack = async (id: any) => {
+  try {
+    const res = await request.post(`${apiSuffix}/open/activity/info/${id}`)
+    return res.data
+  } catch {
+    throw new Error('获取曲目详情失败')
+  }
+}
+
+// 获取专辑详情
+export const getAlbumDetail = async (id: any) => {
+  try {
+    const res = await request.post(`${apiSuffix}/music/album/detail`, {
+      data: { id }
+    })
+    return res.data
+  } catch {
+    throw new Error('获取专辑详情失败')
+  }
+}
+
+// 为了处理继续支付逻辑
+export const tradeOrder = (result: any, callBack?: any) => {
+  const {
+    orderNo,
+    actualPrice,
+    orderDesc,
+    orderName,
+    orderType,
+    orderDetailList,
+    couponAmount, // 优惠金额
+    discountPrice,
+    paymentConfig
+  } = result
+  orderStatus.orderObject.orderType = orderType
+  orderStatus.orderObject.orderName = orderName
+  orderStatus.orderObject.orderDesc = orderDesc
+  orderStatus.orderObject.actualPrice = actualPrice
+  orderStatus.orderObject.orderNo = orderNo
+  orderStatus.orderObject.discountPrice = discountPrice
+  orderStatus.orderObject.paymentConfig = paymentConfig
+  orderStatus.orderObject.orderList = []
+  try {
+    orderDetailList.forEach(async (item: any) => {
+      await formatOrderDetail(item, {
+        couponAmount,
+        discountPrice
+      })
+    })
+    callBack && callBack()
+  } catch {
+    //
+  }
+}

+ 5 - 3
src/tenant/music/train-tool/index.tsx

@@ -425,9 +425,11 @@ export default defineComponent({
                       <span>¥</span>
                       {moneyFormat(item.salePrice, '0,0[.]00')}
                     </p>
-                    <del class={styles.originalPrice}>
-                      ¥{moneyFormat(item.costPrice, '0,0[.]00')}
-                    </del>
+                    {item.salePrice < item.costPrice && (
+                      <del class={styles.originalPrice}>
+                        ¥{moneyFormat(item.costPrice, '0,0[.]00')}
+                      </del>
+                    )}
                   </div>
                 ))}
               </div>

+ 3 - 0
src/views/order-detail/index.tsx

@@ -208,6 +208,7 @@ export default defineComponent({
         }
       }
 
+      console.log(orderStatus.orderObject, 'orderInfo')
       // 判断是否有订单号
       if (orderStatus.orderObject.orderNo) {
         this.paymentStatus = true
@@ -272,6 +273,8 @@ export default defineComponent({
             }
           })
           const result = res.data || {}
+          orderStatus.orderObject.paymentConfig = res.data || {}
+          orderStatus.orderObject.orderNo = res.data?.orderNo
           this.orderInfo = result
           this.orderNo = result.orderNo
         }

+ 4 - 0
src/views/order-detail/orderStatus.ts

@@ -176,6 +176,10 @@ export const orderTenantInfos = () => {
       params.bizId = item.id
       params.buyNumber = 1
       params.buyMultiple = item.purchaseCycle / 6
+    } else if (item.orderType === 'LIVE') {
+      params.bizContent = {
+        groupId: item.courseGroupId
+      }
     }
     return params
   })