gcj 3 years ago
parent
commit
61f3d98898
3 changed files with 32 additions and 29 deletions
  1. 10 9
      src/components/pyment/Confirmorder.vue
  2. 11 10
      src/components/pyment/Payment.vue
  3. 11 10
      src/views/TextbookDetail.vue

+ 10 - 9
src/components/pyment/Confirmorder.vue

@@ -168,15 +168,16 @@ export default {
         this.receivables_money = res.receivables_money; // 应收款
       });
     },
-     changePrice(price,fontSize) {
-      let str = "";
-      price = price ? price.toString() : "0.00";
-      if (price.indexOf(".") > -1) {
-        let arr = price.split(".");
-        str = `<span style="font-size: ${fontSize?fontSize:16}px;">${arr[0]}</span>.<span style="font-size: 16px;">${arr[1]}</span>`;
-      } else {
-        str = `<span style="font-size: ${fontSize?fontSize:16}px;">${price}</span>.<span  style="font-size: 16px;">00</span>`;
-      }
+    changePrice(price, fontSize1, fontSize2) {
+      price = price ? price : 0;
+      price = price.toFixed(2);
+      price = price.toString();
+      let arr = price.split(".");
+      let str = `<span style="font-size: ${fontSize1 ? fontSize1 : 16}px;">${
+        arr[0]
+      }</span>.<span style="font-size: ${fontSize2 ? fontSize2 : 16}px;">${
+        arr[1]
+      }</span>`;
 
       return str;
     },

+ 11 - 10
src/components/pyment/Payment.vue

@@ -15,7 +15,7 @@
         <p class="p3">{{ data.author }}</p>
       </div>
       <div class="price">
-        <p>¥<span v-html="changePrice(data.price,16)"></span></p>
+        <p>¥<span v-html="changePrice(data.price,16,16)"></span></p>
       </div>
     </div>
     <div class="pay-platform">
@@ -122,15 +122,16 @@ export default {
           this.loading = false;
         });
     },
-    changePrice(price,fontSize) {
-      let str = "";
-      price = price ? price.toString() : "0.00";
-      if (price.indexOf(".") > -1) {
-        let arr = price.split(".");
-        str = `<span style="font-size: ${fontSize?fontSize:16}px;">${arr[0]}</span>.<span style="font-size: 16px;">${arr[1]}</span>`;
-      } else {
-        str = `<span style="font-size: ${fontSize?fontSize:16}px;">${price}</span>.<span  style="font-size: 16px;">00</span>`;
-      }
+    changePrice(price, fontSize1, fontSize2) {
+      price = price ? price : 0;
+      price = price.toFixed(2);
+      price = price.toString();
+      let arr = price.split(".");
+      let str = `<span style="font-size: ${fontSize1 ? fontSize1 : 16}px;">${
+        arr[0]
+      }</span>.<span style="font-size: ${fontSize2 ? fontSize2 : 16}px;">${
+        arr[1]
+      }</span>`;
 
       return str;
     },

+ 11 - 10
src/views/TextbookDetail.vue

@@ -25,7 +25,7 @@
             <span class="price">
               ¥<span
                 class="price_1"
-                v-html="changePrice(TextbookData.price)"
+                v-html="changePrice(TextbookData.price,24,26)"
               ></span>
             </span>
             <button @click="getPurchase" class="get">
@@ -260,15 +260,16 @@ export default {
     SelectShowEvent(num) {
       this.SelectShow = num;
     },
-    changePrice(price) {
-      let str = "";
-      price = price ? price.toString() : "0.00";
-      if (price.indexOf(".") > -1) {
-        let arr = price.split(".");
-        str = `<span style="font-size: 24px;">${arr[0]}</span>.<span style="font-size: 16px;">${arr[1]}</span>`;
-      } else {
-        str = `<span style="font-size: 24px;">${price}</span>.<span  style="font-size: 16px;">00</span>`;
-      }
+    changePrice(price, fontSize1, fontSize2) {
+      price = price ? price : 0;
+      price = price.toFixed(2);
+      price = price.toString();
+      let arr = price.split(".");
+      let str = `<span style="font-size: ${fontSize1 ? fontSize1 : 16}px;">${
+        arr[0]
+      }</span>.<span style="font-size: ${fontSize2 ? fontSize2 : 16}px;">${
+        arr[1]
+      }</span>`;
 
       return str;
     },