浏览代码

添加是否赠送辅件

lex-xin 3 年之前
父节点
当前提交
a5934d5a39

+ 21 - 32
src/views/resetTeaming/modals/accessories.vue

@@ -1,21 +1,10 @@
 <template>
   <div class="courseModel" style="margin-top: 12px;">
-    <h2
-      class="titles"
-      v-if="
-        accessOries.length > 0
-      "
-    >
+    <h2 class="titles" v-if="accessOries.length > 0">
       <img :src="trainSmallBg" />
       <span>辅件</span>
     </h2>
-    <div
-      class="section"
-      v-if="
-        accessOries.length > 0
-      "
-      key="accessOries"
-    >
+    <div class="section" v-if="accessOries.length > 0" key="accessOries">
       <!-- <h2 class="titles">辅件</h2> -->
       <el-row class="title-row">
         <el-col :span="12">辅件商品</el-col>
@@ -29,9 +18,7 @@
           <el-col :span="12">
             <i
               class="check_default"
-              :class="[
-                instr.isStatus ? 'check_active' : ''
-              ]"
+              :class="[instr.isStatus ? 'check_active' : '']"
             ></i
             >{{ instr.name }}
           </el-col>
@@ -46,7 +33,9 @@
           </el-col>
           <el-col :span="6">
             <span style="color: #1a1a1a" v-if="instr.price == 0">免费</span>
-            <span style="color: #1a1a1a" v-else>¥{{ instr.price | moneyFormat }}</span>
+            <span style="color: #1a1a1a" v-else
+              >¥{{ (isGiveAccessories ? 0 : instr.price) | moneyFormat }}</span
+            >
           </el-col>
         </el-row>
         <el-row style="padding-left: 24px" v-if="instr.childGoodsList">
@@ -67,23 +56,23 @@
 
 <script>
 export default {
-    name: 'courseModel',
-    props: {
-			trainSmallBg: String,
-			accessOries: Array
-    },
-    data() {
-        return {
-        }
-    },
-    methods: {
-        onAuxiliarie(item) {
-            this.$emit('onAuxiliarie', item)
-        },
+  name: "courseModel",
+  props: {
+    trainSmallBg: String,
+    accessOries: Array,
+    isGiveAccessories: Boolean, // 是否赠送辅件,如果为是,则不价格为0
+  },
+  data() {
+    return {};
+  },
+  methods: {
+    onAuxiliarie(item) {
+      this.$emit("onAuxiliarie", item);
     }
-}
+  }
+};
 </script>
 
 <style lang="less" scoped>
 @import url("./signUpPayment.less");
-</style>
+</style>

+ 1 - 1
src/views/resetTeaming/modals/activity.vue

@@ -20,7 +20,7 @@
             </span>
           </el-col>
           <el-col :span="6">
-						<span style="color: #AAA; font-size: 12px">{{ item.num }}节</span>
+						<span style="color: #AAA; font-size: 12px">{{ item.num }}()</span>
 					</el-col>
           <el-col :span="6">
             <span style="color: #1A1A1A">¥{{ item.actualAmount | moneyFormat }}</span>

+ 1 - 1
src/views/resetTeaming/modals/courseModel.vue

@@ -57,7 +57,7 @@
           </el-col>
           <el-col :span="6">
             <span style="color: #AAA; font-size: 12px;"
-              >{{ item.courseTotalMinuties }}分钟</span
+              >{{ item.courseTotalMinuties }}(分钟)</span
             >
           </el-col>
           <el-col :span="6">

+ 7 - 6
src/views/resetTeaming/modals/member.vue

@@ -19,7 +19,7 @@
 
     <div class="section">
       <el-row class="title-row">
-        <el-col :span="12">练习系统</el-col>
+        <el-col :span="12">练习系统{{ isGiveAccessories ? '(赠送辅件一套)' : null }}</el-col>
         <el-col :span="5" :offset="1" style="text-align: right;">时长</el-col>
         <el-col :span="6" style="text-align: right;">价格</el-col>
       </el-row>
@@ -39,7 +39,7 @@
           </el-col>
           <el-col :span="6">
             <span style="color: #AAA; font-size: 12px;"
-              >{{ item.num }}{{ item.period | unitFormat }}</span
+              >{{ item.num }}({{ item.period | unitFormat }})</span
             >
           </el-col>
           <el-col :span="6">
@@ -87,7 +87,8 @@ export default {
   props: {
     courseViewType: [Number, String],
     toolsPackage: Array,
-    trainSmallBg: String
+    trainSmallBg: String,
+    isGiveAccessories: Boolean,
   },
   data() {
     return {
@@ -98,7 +99,7 @@ export default {
   methods: {
     onTrainChange(item) {
       // 团练宝点击时
-      this.$emit("onCheckItem", item);
+      this.$emit("onCheckItem", item, 'train');
     },
     onQuestions(item) {
       this.$emit("onQuestions", item);
@@ -108,8 +109,8 @@ export default {
     unitFormat(val) {
       let template = {
         YEAR: "年",
-        MONTH: "月",
-        QUARTERLY: "季度",
+        MONTH: "月",
+        QUARTERLY: "季度",
         YEAR_HALF: "半年"
       };
       return template[val];

+ 25 - 3
src/views/resetTeaming/modals/subject-preview.vue

@@ -20,6 +20,7 @@
     <member
       v-if="toolsPackage && toolsPackage.length > 0"
       :toolsPackage="toolsPackage"
+      :isGiveAccessories="isGiveAccessories"
       @onCheckItem="onCheckItem"
     />
 
@@ -53,7 +54,7 @@
             {{ item.name }}
 					</el-col>
 					<el-col :span="6">
-						<span style="color: #AAA; font-size: 12px;">{{ item.num }}年</span>
+						<span style="color: #AAA; font-size: 12px;">{{ item.num }}()</span>
 					</el-col>
 					<el-col :span="6">
 						<span style="color: #1A1A1A">¥{{ item.actualAmount | moneyFormat }}</span>
@@ -65,6 +66,7 @@
      <accessories
       :trainSmallBg="trainSmallBg"
       :accessOries="accessOries"
+      :isGiveAccessories="giveAccessoriesStatus"
       @onAuxiliarie="onCheckItem"
     />
 
@@ -173,6 +175,8 @@ export default {
       memberCourseShowFlag: false, // 是否显示赠送课程
       buyCloudTeacher: false, // 是否购买团练宝
       remissionCourseFeeStatus: false,
+      isGiveAccessories: false, // 是否赠送辅件
+      giveAccessoriesStatus: false,
     };
   },
   mounted() {
@@ -199,6 +203,7 @@ export default {
     __dataFormat(tempResult) {
       const preViewData = this.preViewData ? JSON.parse(JSON.stringify(this.preViewData)) : null
       this.courseViewType = tempResult.musicGroup.courseViewType || 0;
+      this.isGiveAccessories = tempResult.musicGroupSubject && tempResult.musicGroupSubject.isGiveAccessories || false; // 是否赠送辅件
       this.organId = tempResult.musicGroup.organId;
       const musicGroupStatus = tempResult.musicGroup.status
       this.cloudTeacherFee = tempResult.cloudTeacherFee || 0;
@@ -387,6 +392,8 @@ export default {
         this.instrumentGetStatus()
         this.setLeBaoStatus()
       }
+      // 如果选择的是乐保,则把所有辅件价格设置为0
+      this.giveAccessoriesSetStatus()
 
       // 初始化计算金额
       this.calcPrice();
@@ -441,6 +448,10 @@ export default {
         })
       }
       item.isStatus = !item.isStatus;
+      if(type == 'train') {
+        // 如果选择的是乐保,则把所有辅件价格设置为0
+        this.giveAccessoriesSetStatus()
+      }
       // 设置是否有减免金额
       this.instrumentGetStatus()
       // 重新设置乐保状态
@@ -448,6 +459,17 @@ export default {
       // 重新计算金额
       this.calcPrice();
     },
+    giveAccessoriesSetStatus() {
+      let status = false // 是否有选中团练宝
+      this.toolsPackage.forEach(item => {
+        if (item.isStatus) {
+          status = true;
+        } else {
+          status = false;
+        }
+      });
+      this.giveAccessoriesStatus = this.isGiveAccessories && status;
+    },
     instrumentGetStatus() {
       let childItem = {}
       this.instrumentResultList.forEach(group => {
@@ -619,8 +641,8 @@ export default {
         this.accessOries.forEach((item) => {
           //  && this.accessIsShowStatus
           if (item.isStatus) {
-            tempAccessPrice += parseFloat(item.price);
-            amount += parseFloat(item.price);
+            tempAccessPrice += this.giveAccessoriesStatus ? 0 : parseFloat(item.price);
+            amount += this.giveAccessoriesStatus ? 0 : parseFloat(item.price);
             if (item.goodsList && item.goodsList.length > 0) {
               item.goodsList.forEach((childGoods) => {
                 tempAccessMarketPrice += parseFloat(childGoods.marketPrice);

+ 31 - 5
src/views/teamBuild/components/teamBaseInfo.vue

@@ -352,7 +352,32 @@
           >
           </el-switch>
         </el-form-item>
-
+        <el-form-item
+          label="是否赠送辅件"
+          prop="memberCourseShowFlag"
+          label-width="200px"
+          :rules="[{ required: true, message: '是否赠送辅件不能为空' }]"
+        >
+          <template #label>
+            <p style="position: relative; display: inline-block">
+              是否赠送辅件
+              <el-tooltip placement="top" popper-class="mTooltip">
+                <div slot="content">购买团练宝是否赠送辅件</div>
+                <i
+                  class="el-icon-question"
+                  style="font-size: 18px; color: #f56c6c"
+                ></i>
+              </el-tooltip>
+            </p>
+          </template>
+          <el-switch
+            v-model="topFrom.isGiveAccessories"
+            :disabled="basdisabled"
+            :active-value="1"
+            :inactive-value="0"
+          >
+          </el-switch>
+        </el-form-item>
         <!-- <el-form-item
           label="是否显示免费课程"
           prop="memberCourseShowFlag"
@@ -465,6 +490,7 @@ export default {
         salary: "", // 收费模式
         head: "",
         homeworkPushFlag: 1, // 是否同步群消息
+        isGiveAccessories: 0, // 是否赠送辅件 默认不赠送
         memberCourseShowFlag: 0,
         isClass: false, //是否为课堂课
         startTime: "",
@@ -951,6 +977,7 @@ export default {
               feeType: this.topFrom.feeType,
               transactionTeacherId: this.topFrom.transactionTeacherId,
               homeworkPushFlag: this.topFrom.homeworkPushFlag,
+              isGiveAccessories: this.topFrom.isGiveAccessories,
               memberCourseShowFlag: this.topFrom.memberCourseShowFlag,
             };
             // obj.musicGroupPaymentEntities = [];
@@ -1069,6 +1096,7 @@ export default {
         ownershipType: "OWN", // 合作机构类型
         feeType: null,
         homeworkPushFlag: 1,
+        isGiveAccessories: 0,
         memberCourseShowFlag: 0,
       };
       this.$refs["topinfo"].resetFields();
@@ -1308,10 +1336,8 @@ export default {
       this.topFrom.transactionTeacherId =
         res.data.musicGroup.transactionTeacherId || "";
       this.topFrom.homeworkPushFlag = res.data.musicGroup.homeworkPushFlag;
-      this.topFrom.memberCourseShowFlag = res.data.musicGroup
-        .memberCourseShowFlag
-        ? 1
-        : 0;
+      this.topFrom.isGiveAccessories = res.data.musicGroup.isGiveAccessories ? 1 : 0;
+      this.topFrom.memberCourseShowFlag = res.data.musicGroup.memberCourseShowFlag ? 1 : 0;
       localStorage.setItem(`${this.teamid}base`, JSON.stringify(this.topFrom));
     },
     changeType(val) {