lex-xin 3 سال پیش
والد
کامیت
d477266a18

+ 20 - 8
src/views/productService/components/cloudRecharge.vue

@@ -15,7 +15,7 @@
         <div class="descriptions">
           <div class="title">云教室扣费标准</div>
           <div class="tips">
-            <p style="padding-bottom: 10px">以1v1课程,既老师学员1对1教学,45分钟课程为例,每分钟收费标准0.2元,则该课程结束后将扣除云教室费用45分钟*0.2元/分钟=9元</p>
+            <p style="padding-bottom: 10px">以1v1课程,既老师学员1对1教学,45分钟课程为例,每分钟收费标准{{ stand }}元,则该课程结束后将扣除云教室费用45分钟*{{ stand }}元/分钟={{ 45 * stand }}元</p>
             <el-table
               :data="tableData"
               border
@@ -68,6 +68,7 @@
 <script>
 import rechargeModel from '@/views/productService/model/rechargeModel'
 export default {
+  props: ['tenant'],
   name: 'cloudRecharge',
   components: {
     rechargeModel
@@ -78,13 +79,24 @@ export default {
       form: {
         amount: null
       },
-      tableData: [{
-        num: 2,
-        minute: 0.5
-      }, {
-        num: 3,
-        minute: 0.5
-      }]
+      tableData: [],
+      stand: 0, //标准金额
+    }
+  },
+  mounted() {
+    if(this.tenant) {
+      let config = this.tenant?.config?.config
+      config = config ? JSON.parse(config) : {}
+      let cloud_room_rule = config?.cloud_room_rule?.cloud_room_config || {}
+      for (const i in cloud_room_rule) {
+        if(i == 2) {
+          this.stand = cloud_room_rule[i]
+        }
+        this.tableData.push({
+          num: i,
+          minute: cloud_room_rule[i]
+        })
+      }
     }
   },
   methods: {

+ 11 - 16
src/views/productService/components/serviceRenew.vue

@@ -63,10 +63,9 @@
 <script>
 import serviceModel from '@/views/productService/model/serviceModel'
 import version from '@/views/productService/model/version'
-import { tenantInfoInfo } from '@/views/organManager/api'
-import { getTenantId } from '@/utils/auth'
 import { paymentMode } from '@/constant'
 export default {
+  props: ['tenant'],
   name: 'serviceRenew',
   components: {
     serviceModel,
@@ -96,22 +95,18 @@ export default {
     }
   },
   mounted() {
-    this.__init();
+    if(this.tenant) {
+      let data = this.tenant
+      this.tenantInfo = {
+        platformServeName: data.platformServeName,
+        studentUpLimit: data.studentUpLimit,
+        contractPrice: data.productInfo?.contractPrice || 0,
+        originalPrice: data.productInfo?.originalPrice || 0,
+        expiryUnit: data.productInfo?.expiryUnit
+      }
+    }
   },
   methods: {
-    async __init() {
-      try {
-        const res = await tenantInfoInfo({ id: getTenantId() })
-        const { data } = res
-        this.tenantInfo = {
-          platformServeName: data.platformServeName,
-          studentUpLimit: data.studentUpLimit,
-          contractPrice: data.productInfo?.contractPrice || 0,
-          originalPrice: data.productInfo?.originalPrice || 0,
-          expiryUnit: data.productInfo?.expiryUnit
-        }
-      } catch(e) {}
-    },
     onRecharge() {
       this.$refs.form.validate(async (_) => {
         if(_) {

+ 8 - 3
src/views/productService/index.vue

@@ -67,7 +67,7 @@
           v-if="permission('/serviceRenew')"
           name="1"
         >
-          <service-renew v-if="activeIndex == 1" @getList="__init" />
+          <service-renew v-if="activeIndex == 1 && tenantInfo" @getList="__init" :tenant="tenantInfo" />
         </el-tab-pane>
         <el-tab-pane
           label="云教室充值"
@@ -75,7 +75,7 @@
           v-if="permission('/cloudRecharge')"
           name="2"
         >
-          <cloud-recharge v-if="activeIndex == 2" @getList="__init" />
+          <cloud-recharge v-if="activeIndex == 2 && tenantInfo" @getList="__init" :tenant="tenantInfo" />
         </el-tab-pane>
       </tab-router>
     </div>
@@ -84,6 +84,7 @@
 <script>
 import cloudRecharge from '@/views/productService/components/cloudRecharge'
 import serviceRenew from '@/views/productService/components/serviceRenew'
+import { tenantInfoInfo } from '@/views/organManager/api'
 import { permission } from "@/utils/directivePage";
 import { queryTenantInfoSumm } from "./api";
 import dayjs from 'dayjs'
@@ -107,7 +108,8 @@ export default {
         balance: 0,
         frozenAmount: 0,
         balance: 0
-      }
+      },
+      tenantInfo: null, // 机构信息
     };
   },
   mounted() {
@@ -122,6 +124,9 @@ export default {
         // this.dataInfo.expiryDate = res.data.expiryDate ? dayjs(res.data.expiryDate).format('YYYY-MM-DD') : null
         this.dataInfo.expiryDateEnd = res.data.expiryDateEnd ? dayjs(res.data.expiryDateEnd).format('YYYY-MM-DD') : null
         this.dataInfo.validRemaining = res.data.validRemaining || 0
+
+        const tenantInfo = await tenantInfoInfo({ id: this.$helpers.tenantId })
+        this.tenantInfo = tenantInfo.data
       } catch(e) { }
     },
     onDetail() {