Browse Source

Merge branch 'iteration-20241126'

lex-xin 6 months ago
parent
commit
0718df3202

+ 1 - 0
src/constant/index.ts

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

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

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

+ 4 - 28
src/teacher/layout/login-cert.tsx

@@ -10,13 +10,11 @@ import topBg from './image-cert/top.png'
 import activeButtonIcon from '@common/images/icon_checkbox.png'
 import activeButtonIcon from '@common/images/icon_checkbox.png'
 import inactiveButtonIcon from '@common/images/icon_checkbox_default.png'
 import inactiveButtonIcon from '@common/images/icon_checkbox_default.png'
 
 
-type loginType = 'PWD' | 'SMS'
 export default defineComponent({
 export default defineComponent({
   name: 'login',
   name: 'login',
   data() {
   data() {
     return {
     return {
       checked: false,
       checked: false,
-      loginType: 'SMS' as loginType,
       username: '',
       username: '',
       password: '',
       password: '',
       smsCode: '',
       smsCode: '',
@@ -29,11 +27,8 @@ export default defineComponent({
   computed: {
   computed: {
     codeDisable() {
     codeDisable() {
       let status = true
       let status = true
-      if (this.loginType === 'PWD') {
-        this.username && this.password && (status = false)
-      } else {
         this.username && this.smsCode && this.checked && (status = false)
         this.username && this.smsCode && this.checked && (status = false)
-      }
+      
       return status
       return status
     }
     }
   },
   },
@@ -72,28 +67,16 @@ export default defineComponent({
     },
     },
     async onLogin() {
     async onLogin() {
       try {
       try {
-        let res: any
-        if (this.loginType === 'PWD') {
-          res = await request.post('/api-auth/usernameLogin', {
-            requestType: 'form',
-            data: {
-              username: this.username,
-              password: this.password,
-              clientId: 'teacher',
-              clientSecret: 'teacher'
-            }
-          })
-        } else {
-          res = await request.post('/api-auth/smsLogin', {
+        let res = await request.post('/api-auth/smsLogin', {
             requestType: 'form',
             requestType: 'form',
             data: {
             data: {
               clientId: 'teacher',
               clientId: 'teacher',
               clientSecret: 'teacher',
               clientSecret: 'teacher',
               phone: this.username,
               phone: this.username,
-              smsCode: this.smsCode
+              smsCode: this.smsCode,
+              isSurportRegister: true
             }
             }
           })
           })
-        }
 
 
         const { authentication } = res.data
         const { authentication } = res.data
         setAuth(authentication.token_type + ' ' + authentication.access_token)
         setAuth(authentication.token_type + ' ' + authentication.access_token)
@@ -120,13 +103,6 @@ export default defineComponent({
     onFinished() {
     onFinished() {
       this.countDownStatus = true
       this.countDownStatus = true
       this.countDownRef.reset()
       this.countDownRef.reset()
-    },
-    onChange() {
-      if (this.loginType === 'PWD') {
-        this.loginType = 'SMS'
-      } else if (this.loginType === 'SMS') {
-        this.loginType = 'PWD'
-      }
     }
     }
   },
   },
   render() {
   render() {

+ 4 - 1
src/views/music/music-detail/index.tsx

@@ -2,6 +2,7 @@ import {
   computed,
   computed,
   defineComponent,
   defineComponent,
   nextTick,
   nextTick,
+  onBeforeUnmount,
   onMounted,
   onMounted,
   onUnmounted,
   onUnmounted,
   reactive,
   reactive,
@@ -318,11 +319,13 @@ export default defineComponent({
 
 
       window.addEventListener('message', showLoading)
       window.addEventListener('message', showLoading)
     })
     })
-    onUnmounted(() => {
+    onBeforeUnmount(() => {
       postMessage({
       postMessage({
         api: 'setStatusBarTextColor',
         api: 'setStatusBarTextColor',
         content: { statusBarTextColor: false }
         content: { statusBarTextColor: false }
       })
       })
+    })
+    onUnmounted(() => {
       window.removeEventListener('message', showLoading)
       window.removeEventListener('message', showLoading)
     })
     })
 
 

+ 3 - 2
src/views/order-detail/add-discount/index.tsx

@@ -8,6 +8,7 @@ import request from '@/helpers/request'
 import { state } from '@/state'
 import { state } from '@/state'
 import { moneyFormat } from '@/helpers/utils'
 import { moneyFormat } from '@/helpers/utils'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
+import { numberToTwoDown } from '..'
 
 
 type DiscountDetail = {
 type DiscountDetail = {
   /** 编号 */
   /** 编号 */
@@ -69,10 +70,10 @@ export default defineComponent({
     // 格式化显示
     // 格式化显示
     const formatShowTime = () => {
     const formatShowTime = () => {
       if(checked.value) {
       if(checked.value) {
-        params.discountPrice = (
+        params.discountPrice = numberToTwoDown((
           props.actualPrice -
           props.actualPrice -
           (props.actualPrice * discountDetail.value.discountRate / 100)
           (props.actualPrice * discountDetail.value.discountRate / 100)
-        ).toFixed(2)
+        ))
         const users = state.user.data
         const users = state.user.data
         const startTime = users.discountEndTime || new Date()
         const startTime = users.discountEndTime || new Date()
         let endTime = dayjs(new Date()).format('YYYY-MM-DD')
         let endTime = dayjs(new Date()).format('YYYY-MM-DD')

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

@@ -48,8 +48,13 @@ import AddDiscount from './add-discount'
 /** 保留两位小数向上取整 */
 /** 保留两位小数向上取整 */
 export const numberToTwoUp = (num: number | string) => {
 export const numberToTwoUp = (num: number | string) => {
   num = Number(num)
   num = Number(num)
+  return Math.ceil(num * 1000) / 1000
+}
 
 
-  return Math.ceil(num * 100) / 100
+/** 保留两位小数向下取整 */
+export const numberToTwoDown = (num: number | string) => {
+  num = Number(num)
+  return Math.floor(num * 1000) / 1000
 }
 }
 
 
 export default defineComponent({
 export default defineComponent({
@@ -63,7 +68,7 @@ export default defineComponent({
       dialogBtnText: '确定',
       dialogBtnText: '确定',
       dialogType: 'back' as 'back' | 'refresh',
       dialogType: 'back' as 'back' | 'refresh',
       orderType: query.orderType as string,
       orderType: query.orderType as string,
-      orderGoodsType: [],
+      orderGoodsType: [] as any[],
       recomUserId: query.recomUserId, // 推荐人id
       recomUserId: query.recomUserId, // 推荐人id
       activityId: query.activityId, // 活动编号
       activityId: query.activityId, // 活动编号
       id: query.id,
       id: query.id,
@@ -166,6 +171,7 @@ export default defineComponent({
 
 
     this.orderAmount = orderStatus.orderObject.actualPrice || 0
     this.orderAmount = orderStatus.orderObject.actualPrice || 0
     this.orderPrice = orderStatus.orderObject.actualPrice || 0
     this.orderPrice = orderStatus.orderObject.actualPrice || 0
+    console.log(this.orderAmount, this.orderPrice, 'orderPrice')
 
 
     this.disabledCoupon = orderStatus.orderObject.orderNo ? true : false
     this.disabledCoupon = orderStatus.orderObject.orderNo ? true : false
     this.dataLoading = false
     this.dataLoading = false
@@ -637,12 +643,14 @@ export default defineComponent({
                   vipType: string
                   vipType: string
                 }) => {
                 }) => {
                   // 畅学卡变更状态时需要重新选择优惠券
                   // 畅学卡变更状态时需要重新选择优惠券
+                  // debugger
                   orderStatus.orderObject.couponId = ''
                   orderStatus.orderObject.couponId = ''
                   orderStatus.orderObject.couponDiscountPrice = 0
                   orderStatus.orderObject.couponDiscountPrice = 0
                   // 是否选中畅学卡
                   // 是否选中畅学卡
                   const index = this.selectGoods?.findIndex(
                   const index = this.selectGoods?.findIndex(
                     (child: any) => child.id === item.id
                     (child: any) => child.id === item.id
                   )
                   )
+                  const tempType = this.orderGoodsType
                   if (item.checked) {
                   if (item.checked) {
                     orderStatus.orderObject.discountCardPrice = Number(
                     orderStatus.orderObject.discountCardPrice = Number(
                       item.discountPrice
                       item.discountPrice
@@ -655,15 +663,30 @@ export default defineComponent({
                         num: 1,
                         num: 1,
                         id: item.id
                         id: item.id
                       })
                       })
+                      const typeIndex = tempType.findIndex((child: any) => child === item.vipType)
+                      if(typeIndex === -1) {
+                        tempType.push(item.vipType)
+                      }
                     }
                     }
                   } else {
                   } else {
                     orderStatus.orderObject.discountCardPrice = 0
                     orderStatus.orderObject.discountCardPrice = 0
                     if (index !== -1) {
                     if (index !== -1) {
                       this.selectGoods.splice(index, 1)
                       this.selectGoods.splice(index, 1)
                       this.orderAmount = this.orderAmount - item.salePrice
                       this.orderAmount = this.orderAmount - item.salePrice
+
+                      const typeIndex = tempType.findIndex((child: any) => child === item.vipType)
+                      if(typeIndex !== -1) {
+                        tempType.splice(typeIndex, 1)
+                      }
                     }
                     }
                   }
                   }
-
+                  this.orderGoodsType = tempType
+                  // 更新优惠券列表
+                  const useCouponRef: any =  this.$refs.useCouponRef
+                  if(useCouponRef) {
+                    console.log(useCouponRef, 'useCouponRef')
+                    useCouponRef.resetCouponList()
+                  }
                   this.orderPrice = Number(
                   this.orderPrice = Number(
                     numberToTwoUp(
                     numberToTwoUp(
                       Number(this.orderAmount) -
                       Number(this.orderAmount) -
@@ -671,6 +694,7 @@ export default defineComponent({
                       Number(orderStatus.orderObject.couponDiscountPrice)
                       Number(orderStatus.orderObject.couponDiscountPrice)
                     )
                     )
                   )
                   )
+                  this.$forceUpdate()
                 }}
                 }}
               />
               />
             ) : (
             ) : (
@@ -700,6 +724,7 @@ export default defineComponent({
             {/* 优惠券使用 */}
             {/* 优惠券使用 */}
             {!this.dataLoading && (
             {!this.dataLoading && (
               <UseCoupon
               <UseCoupon
+                ref="useCouponRef"
                 couponId={orderStatus.orderObject.couponId}
                 couponId={orderStatus.orderObject.couponId}
                 discountPrice={orderStatus.orderObject.discountPrice}
                 discountPrice={orderStatus.orderObject.discountPrice}
                 orderType={this.orderType}
                 orderType={this.orderType}

+ 1 - 1
src/views/order-detail/use-coupons/choice-coupon.tsx

@@ -142,7 +142,7 @@ export default defineComponent({
       if(this.usedLength === 'SINGLE') {
       if(this.usedLength === 'SINGLE') {
         // 判断使用优惠券之后还有没有其它优惠券可用
         // 判断使用优惠券之后还有没有其它优惠券可用
         this.list.forEach((item: any) => {
         this.list.forEach((item: any) => {
-          if (!item.checked && useList.length > 0) {
+          if (!item.checked && (useList.length > 0  || Number(item.useLimit) > useLastAmount)) {
             item.disabled = true
             item.disabled = true
           } else {
           } else {
             item.disabled = false
             item.disabled = false

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

@@ -109,6 +109,10 @@ export default defineComponent({
         }
         }
       });
       });
       this.useCouponList = selectCouponList
       this.useCouponList = selectCouponList
+    },
+    orderGoodsType(val: any) {
+      console.log(val, '121221')
+      this.getList()
     }
     }
   },
   },
   mounted() {
   mounted() {
@@ -116,6 +120,10 @@ export default defineComponent({
     this.getList()
     this.getList()
   },
   },
   methods: {
   methods: {
+    resetCouponList() {
+      this.list = []
+      this.getList()
+    },
     async getList() {
     async getList() {
       if (this.dataLoading) return
       if (this.dataLoading) return
       this.dataLoading = true
       this.dataLoading = true
@@ -142,6 +150,7 @@ export default defineComponent({
           // 如果使用金额大于订单金额则优惠券不可用
           // 如果使用金额大于订单金额则优惠券不可用
           if (item.useLimit > this.orderAmount) {
           if (item.useLimit > this.orderAmount) {
             item.disabled = true
             item.disabled = true
+            console.log(this.orderAmount, item.useLimit)
           } else {
           } else {
             item.disabled = false
             item.disabled = false
           }
           }

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

@@ -59,8 +59,28 @@ export default defineComponent({
   },
   },
   computed: {
   computed: {
     orderDetailList() {
     orderDetailList() {
+
       const result: any = this.result
       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() {
   async mounted() {
@@ -204,10 +224,13 @@ export default defineComponent({
                     ),
                     ),
                     default: () => (
                     default: () => (
                       <div class={styles.content}>
                       <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>
                         <span class={styles.num}>x{item.goodNum}</span>
                       </div>
                       </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}>
               <Row class={styles.optionRow}>
                 <Col span="8" offset={1}>
                 <Col span="8" offset={1}>
                   订单号:
                   订单号: