Tang 2 yıl önce
ebeveyn
işleme
fe1f29d4c1

+ 12 - 3
src/pages/cart/index.vue

@@ -94,7 +94,10 @@
                       v-if="scope.row.sevenYear && scope.row.goodsType == 1"
                     >
                       <span>七大员继教可选年份:</span>
-                      <el-checkbox-group v-model="scope.row.checkList">
+                      <el-checkbox-group
+                        v-model="scope.row.checkList"
+                        @change="checkFunc"
+                      >
                         <el-checkbox
                           v-for="(item, index) in computedSevenYear(
                             scope.row.sevenYear
@@ -246,6 +249,9 @@ export default {
   },
   methods: {
     ...mapMutations(["getCartCount"]),
+    checkFunc() {
+      this.caculate();
+    },
     areaChange(row, index) {
       console.log(row);
       let node = this.$refs["cascader" + index].getCheckedNodes()[0]; //选中的根节点
@@ -385,9 +391,12 @@ export default {
 
     caculate() {
       this.total = 0;
-
       this.multipleSelection.forEach(item => {
-        this.total += item.standPrice;
+        if (item.sevenYear) {
+          this.total += item.standPrice * item.checkList.length;
+        } else {
+          this.total += item.standPrice;
+        }
       });
     },
     pay() {

+ 1 - 1
src/pages/course-detail/components/CourseTree.vue

@@ -318,7 +318,6 @@
 
                   <div class="bank-section" v-if="menu.showList">
                     <div
-                      :id="'section-' + menu.typeId"
                       class="bank-section__item"
                       :class="{
                         active: isActive(section)
@@ -326,6 +325,7 @@
                       v-for="(section, sectionIndex) in menu.list"
                       :key="sectionIndex"
                       @click="getResource(section, 1, courseIndex)"
+                      :id="'section-' + section.typeId"
                     >
                       <template v-if="section.type != 2">
                         <template>