lex-xin 4 лет назад
Родитель
Сommit
06f57b2fd1
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      src/views/teamDetail/components/modals/create-user-pay.vue

+ 14 - 1
src/views/teamDetail/components/modals/create-user-pay.vue

@@ -211,8 +211,20 @@ export default {
     },
     syncAllMoney() {
       let money = 0;
+      let first = 0
+      let other = 0
       for (const item of this.eclass) {
         money += item.courseCurrentPrice;
+        if (this.cycles && this.cycles.length) {
+          if (item.isStudentOptional) {
+            first += (item.courseCurrentPrice * 100)
+          } else {
+            const floorMoney = Math.floor((item.courseCurrentPrice * 100) / this.cycles.length)
+            const remainder = (item.courseCurrentPrice * 100) % this.cycles.length
+            first += floorMoney + remainder
+            other += floorMoney
+          }
+        }
       }
       if (this.cycles.length) {
         const floorMoney = Math.floor(money / this.cycles.length)
@@ -220,7 +232,7 @@ export default {
         this.cycles = this.cycles.map((item, index) => {
           return {
             ...item,
-            paymentAmount: (index === 0 ? floorMoney + remainder : floorMoney)
+            paymentAmount: (index === 0 ? first / 100 : (other / 100))
           }
         })
       }
@@ -323,6 +335,7 @@ export default {
           paymentPattern: this.payment.paymentPattern,
           musicGroupId: this.musicGroupId,
           paymentType: 'ADD_STUDENT',
+          payUserType: 'STUDENT',
           studentIds: this.createdUserId,
           musicGroupPaymentCalenderCourseSettingsList: this.eclass,
         }