Browse Source

playMedia

y595705120 5 days ago
parent
commit
b4afad831e
2 changed files with 38 additions and 36 deletions
  1. 3 2
      src/assets/css/course.css
  2. 35 34
      src/containers/center/market/index.vue

+ 3 - 2
src/assets/css/course.css

@@ -309,10 +309,11 @@
 
 .m-history-course {
   position: relative;
-  width: 48.5%;
+  width: 460px;
   height: 100px;
   border: 1px solid #ddd;
-  padding: 5px;
+  margin-top: 10px;
+  padding: 2px;
 }
 .m-history-course:after {
   content: "";

+ 35 - 34
src/containers/center/market/index.vue

@@ -118,7 +118,7 @@
     <el-dialog title="申请开通课程" :visible.sync="buyCourseDialog" width="550px" top="100px" align="left">
       <template v-if="!showPay">
         <el-form label-width="100px" :inline="false" :model="buyForm" :rules="rules"
-          ref="elForm">
+          ref="refBuyCourse">
           <el-form-item label="账户余额" prop="balance" >
             <p style="margin-left: 20px;font-size: 16px;">
               <span v-if="userInfo.balance>=buyForm.fee" style="color: green;"> ¥{{userInfo.balance/100}}元</span>
@@ -418,39 +418,40 @@
         });
       },
       generatePayQrcode() {
-        console.log('generatePayQrcode')
-        let payType = this.buyForm.payType;
-        let apiName = payType === 'wx' ? "weixin.DoWxpay" : "weixin.DoaliPay";
-        let {
-          courseId,
-          courseName,
-          title,
-          email,
-          phone,
-          needInvoice,
-          invoiceType
-        } = this.buyForm;
-        let param = {
-          courseId,
-          title,
-          phone,
-          email,
-          needInvoice,
-          invoiceType
-        };
-        httpServer(apiName, param).then((res) => {
-          if (res.code != 200) return;
-          let { outTradeNo, showUrl } = res.data;
-          this.outTradeNo = outTradeNo;
-          if (payType === 'wx') {
-            this.wxPayUrl = showUrl;
-          } else {
-            this.aliPayUrl = showUrl;
-          }
-          this.showPay = true
-          this.initTimer();
-
-        });
+        this.$refs["refBuyCourse"].validate((valid) => {
+          if(!valid) return;
+          let payType = this.buyForm.payType;
+          let apiName = payType === 'wx' ? "weixin.DoWxpay" : "weixin.DoaliPay";
+          let {
+            courseId,
+            courseName,
+            title,
+            email,
+            phone,
+            needInvoice,
+            invoiceType
+          } = this.buyForm;
+          let param = {
+            courseId,
+            title,
+            phone,
+            email,
+            needInvoice,
+            invoiceType
+          };
+          httpServer(apiName, param).then((res) => {
+            if (res.code != 200) return;
+            let { outTradeNo, showUrl } = res.data;
+            this.outTradeNo = outTradeNo;
+            if (payType === 'wx') {
+              this.wxPayUrl = showUrl;
+            } else {
+              this.aliPayUrl = showUrl;
+            }
+            this.showPay = true
+            this.initTimer();
+          });
+        })
       },
       getData() {
         let param = {