Browse Source

费用计算修改

wolyshaw 4 năm trước cách đây
mục cha
commit
97a3d547a9
1 tập tin đã thay đổi với 15 bổ sung3 xóa
  1. 15 3
      src/views/resetTeaming/modals/user-pay-form.vue

+ 15 - 3
src/views/resetTeaming/modals/user-pay-form.vue

@@ -51,6 +51,7 @@
       <template v-if="isUserType && paymentType == '0'">
         <el-form ref="payment" :model="payment">
           <el-form-item
+            label-width="160px"
             label="缴费方式"
             prop="paymentPattern"
             :rules="[{required: true, message: '请选择缴费方式', trigger: 'change'}]"
@@ -314,17 +315,28 @@ 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
+            console.log(remainder, item.courseCurrentPrice, this.cycles.length)
+            first += floorMoney + remainder
+            other += floorMoney
+          }
+        }
       }
       if (this.cycles && this.cycles.length) {
-        const floorMoney = Math.floor((money * 100) / this.cycles.length)
-        const remainder = (money * 100) % this.cycles.length
         if (this.paymentAmountDisabled) {
           this.cycles = this.cycles.map((item, index) => {
             return {
               ...item,
-              paymentAmount: (index === 0 ? (floorMoney + remainder) / 100 : (floorMoney / 100))
+              paymentAmount: (index === 0 ? first / 100 : (other / 100))
             }
           })
         } else {