lex-xin 5 months ago
parent
commit
65bf2858f9

+ 1 - 0
src/constant/index.ts

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

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

@@ -9,8 +9,8 @@
   align-items: center;
 
   .viCover {
-    height: 94px;
-    width: 100%;
+    height: 81px;
+    width: 146px;
     border-radius: 6px;
     vertical-align: middle;
     overflow: hidden;
@@ -26,6 +26,7 @@
     font-size: 15px;
     color: #131415;
     line-height: 21px;
+    max-width: 180px;
   }
 
   .viUserNum {

+ 1 - 1
src/student/teacher-dependent/components/video-item/index.tsx

@@ -36,7 +36,7 @@ export default defineComponent({
           this.onClick(item)
         }}
       >
-        <div style={{ position: 'relative' }}>
+        <div style={{ position: 'relative', flexShrink: 0 }}>
           <Image
             class={styles.viCover}
             fit="cover"

+ 13 - 9
src/student/teacher-dependent/teacher-style/index.module.less

@@ -1,9 +1,15 @@
 .elegant {
-  // display: flex;
-  // flex-wrap: wrap;
-  // justify-content: space-between; /* 让元素均匀分布在容器内 */
-  column-count: 2; /* 设置列数 */
+  display: flex;
+  // column-count: 2; /* 设置列数 */
   padding: 14px;
+
+  .line:first-child {
+    .tedeoItem:first-child {
+      .teCover {
+        height: 170px;
+      }
+    }
+  }
 }
 
 .itemBg {
@@ -17,6 +23,8 @@
   z-index: 89;
 }
 
+
+
 .tedeoItem {
   border-radius: 8px;
   background-color: #fff;
@@ -25,11 +33,7 @@
   margin-bottom: 12px;
   position: relative;
   display: inline-block;
-  &:first-child {
-    .teCover {
-      height: 170px;
-    }
-  }
+  
   position: relative;
   :global {
     .van-image {

+ 93 - 40
src/student/teacher-dependent/teacher-style/index.tsx

@@ -57,54 +57,107 @@ export default defineComponent({
         state.isAddBrowse = false
       } catch {}
     }
-    
+
     return () => (
       <div class={styles['teacher-elegant']}>
         <TheSticky>
-          <ColHeader
-            border={false}
-            background="transparent"
-            isFixed={false}
-          />
+          <ColHeader border={false} background="transparent" isFixed={false} />
         </TheSticky>
 
         {state.dataShow ? (
           <div class={[styles.elegant]}>
-            {state.list.map((item: any) => (
-              <div class={styles.tedeoItem}>
-                <div
-                  class={styles.itemBg}
-                  onClick={() => {
-                    state.videoStatus = true
-                    state.isAddBrowse = true
-                    state.videoItem = item
-                  }}
-                ></div>
-                <img class={styles.iconVideo} src={iconVideo} />
-                <div class={styles.teCover}>
-                  <Image src={item.cover || iconUploadPoster} fit="cover" />
-                </div>
-                <div class={styles.teSection}>
-                  <div class={styles.info}>
-                    <div class={styles.teUserInfo}>
-                      <Image
-                        src={item.avatar || iconTeacher}
-                        class={styles.teUserLogo}
-                      />
-                      <span
-                        class={[
-                          styles.teUserName,
-                          'van-hairline--right van-ellipsis'
-                        ]}
-                      >
-                        {item?.username || `游客${item?.userId || ''}`}
-                      </span>
+            <div class={styles.line}>
+              {state.list.map(
+                (item: any, index: number) =>
+                  index % 2 === 0 && (
+                    <div class={styles.tedeoItem}>
+                      <div
+                        class={styles.itemBg}
+                        onClick={() => {
+                          state.videoStatus = true
+                          state.isAddBrowse = true
+                          state.videoItem = item
+                        }}
+                      ></div>
+                      <img class={styles.iconVideo} src={iconVideo} />
+                      <div class={styles.teCover}>
+                        <Image
+                          src={item.cover || iconUploadPoster}
+                          fit="cover"
+                        />
+                      </div>
+                      <div class={styles.teSection}>
+                        <div class={styles.info}>
+                          <div class={styles.teUserInfo}>
+                            <Image
+                              src={item.avatar || iconTeacher}
+                              class={styles.teUserLogo}
+                            />
+                            <span
+                              class={[
+                                styles.teUserName,
+                                'van-hairline--right van-ellipsis'
+                              ]}
+                            >
+                              {state.userInfo?.username ||
+                                `游客${item?.userId || ''}`}
+                            </span>
+                          </div>
+                          <span class={styles.teUserNum}>
+                            {item.browse}浏览
+                          </span>
+                        </div>
+                      </div>
+                    </div>
+                  )
+              )}
+            </div>
+            <div class={styles.line}>
+              {state.list.map(
+                (item: any, index: number) =>
+                  index % 2 === 1 && (
+                    <div class={styles.tedeoItem}>
+                      <div
+                        class={styles.itemBg}
+                        onClick={() => {
+                          state.videoStatus = true
+                          state.isAddBrowse = true
+                          state.videoItem = item
+                        }}
+                      ></div>
+                      <img class={styles.iconVideo} src={iconVideo} />
+                      <div class={styles.teCover}>
+                        <Image
+                          src={item.cover || iconUploadPoster}
+                          fit="cover"
+                        />
+                      </div>
+                      <div class={styles.teSection}>
+                        <div class={styles.info}>
+                          <div class={styles.teUserInfo}>
+                            <Image
+                              src={item.avatar || iconTeacher}
+                              class={styles.teUserLogo}
+                            />
+                            <span
+                              class={[
+                                styles.teUserName,
+                                'van-hairline--right van-ellipsis'
+                              ]}
+                            >
+                              {state.userInfo?.username ||
+                                `游客${item?.userId || ''}`}
+                            </span>
+                          </div>
+                          <span class={styles.teUserNum}>
+                            {item.browse}浏览
+                          </span>
+                        </div>
+                      </div>
                     </div>
-                    <span class={styles.teUserNum}>{item.browse}浏览</span>
-                  </div>
-                </div>
-              </div>
-            ))}
+                  )
+              )}
+            </div>
           </div>
         ) : (
           <ColResult

+ 26 - 8
src/student/trade/tradeOrder.ts

@@ -35,6 +35,7 @@ interface IAmount {
   couponAmount: number
   discountPrice: number
   expectPrice: number
+  activityType: string
 }
 export const formatOrderDetail = async (item: any, amount?: IAmount) => {
   const type = item.goodType
@@ -107,19 +108,34 @@ export const formatOrderDetail = async (item: any, amount?: IAmount) => {
     case 'SVIP':
       {
         try {
+          // // couponAmount 总的优惠金额
+          // // discountPrice 优惠券金额
+          // let tempPrice = amount?.expectPrice || item.actualPrice
+          
+          // // 如果是赠送活动 就是一口价
+          // if (item.activityType !== 'MEMBER') {
+          //   if (amount?.couponAmount) {
+          //     tempPrice = Number(
+          //       (
+          //         (amount?.expectPrice -
+          //           (amount.couponAmount - amount.discountPrice)) / item.goodNum
+          //       ).toFixed(2)
+          //     )
+          //   }
+          // }
+
           // couponAmount 总的优惠金额
           // discountPrice 优惠券金额
           let tempPrice = amount?.expectPrice || item.actualPrice
-          // 如果是赠送活动 就是一口价
-          if (item.activityType !== 'MEMBER') {
-            if (amount?.couponAmount) {
+          
+          // 如果是赠送活动 就是一口价 amount?.activityType !== 'MEMBER' && 
+          if (amount?.couponAmount) {
               tempPrice = Number(
                 (
-                  amount?.expectPrice -
-                  (amount.couponAmount - amount.discountPrice) / item.goodNum
+                  (amount?.expectPrice -
+                    (amount.couponAmount - amount.discountPrice)) / item.goodNum
                 ).toFixed(2)
               )
-            }
           }
           // 判断是否有会员
           let startTime = new Date()
@@ -382,6 +398,7 @@ export const tradeOrder = async (result: any, callBack?: any) => {
     paymentConfig,
     paymentVendor,
     paymentVersion,
+    activityType, // 活动类型
     expectPrice
   } = result
   orderStatus.orderObject.orderType = orderType
@@ -410,12 +427,13 @@ export const tradeOrder = async (result: any, callBack?: any) => {
       }
     })
     orderDetails[0] && (orderDetails[0].activityList = orderDetailsActivity)
-
+    console.log(orderDetails, 'orderDetails')
     orderDetails.forEach(async (item: any) => {
       const child = await formatOrderDetail(item, {
         couponAmount,
         discountPrice,
-        expectPrice
+        expectPrice,
+        activityType
       })
       orderStatus.orderObject.orderList.push(child)
       moveToEnd()

+ 6 - 3
src/views/music/music-detail/index.tsx

@@ -261,8 +261,9 @@ export default defineComponent({
       })
 
       const config = await request.get(
-        '/api-student/sysConfig/queryByParamNameList',
+        '/sysConfig/queryByParamNameList',
         {
+          prefix: state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student',
           params: {
             paramNames: 'music_sheet_free_rate'
           }
@@ -407,7 +408,8 @@ export default defineComponent({
         }
       ]
 
-      const res = await request.post('/api-student/userOrder/getPendingOrder', {
+      const res = await request.post('/userOrder/getPendingOrder', {
+        prefix: state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student',
         data: {
           goodType: 'MUSIC',
           bizId: music.id
@@ -455,7 +457,8 @@ export default defineComponent({
     }
     const cancelPayment = async (orderNo: string) => {
       try {
-        await request.post('/api-student/userOrder/orderCancel', {
+        await request.post('/userOrder/orderCancel', {
+          prefix: state.platformType === 'TEACHER' ? '/api-teacher' : '/api-student',
           data: {
             orderNo
           }

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

@@ -117,7 +117,7 @@ export default defineComponent({
     },
     countDiscountPrice() {
       const orderObject = orderStatus.orderObject
-      return orderObject.couponAmount || numberToTwoUp(orderObject.couponDiscountPrice + orderObject.discountCardPrice + orderObject.discountCardPrice)
+      return orderObject.couponAmount || numberToTwoUp(orderObject.couponDiscountPrice + orderObject.discountPrice + orderObject.discountCardPrice)
     }
   },
   async mounted() {

+ 6 - 1
src/views/order-detail/use-coupons/index.tsx

@@ -89,7 +89,12 @@ export default defineComponent({
     },
     couponCategory() {
       // 如果订单类型不在优惠券类型里面,则默认查询通用券
-      const temp = this.orderGoodsType.map((item: any)=> couponEnum[item])
+      const temp: any[] = []
+      this.orderGoodsType.forEach((item: any) => {
+        if(couponEnum[item]) {
+          temp.push(couponEnum[item])
+        }
+      })
       return  temp.join(',') + (temp.length ? ',UNIVERSAL' : 'UNIVERSAL')
     }
   },