From e37e45cfe1123928dba5d9c5a427b0ee497b7ad6 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期二, 23 八月 2022 03:21:32 +0800
Subject: [PATCH] 修复算法配置的字段内容

---
 src/components/Price.vue |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/components/Price.vue b/src/components/Price.vue
index 9d641b5..1a03a7e 100644
--- a/src/components/Price.vue
+++ b/src/components/Price.vue
@@ -1,17 +1,19 @@
 
 <template>
-  <div class="Price" v-if="priceNew">
-    锟�<span class="newPrice">{{ priceN1 }}</span
+  <div class="Price" style="height: 30px">
+    <!--  锟�<span class="newPrice">{{ priceN1 }}</span
     >{{ priceN2 }}/骞�
     <span class="iconSave" v-if="showIcon">鐪�</span>
-    <span class="oldPrice">锟{ priceO1 }}{{ priceO2 }}/骞�</span>
+    <span class="oldPrice">锟{ priceO1 }}{{ priceO2 }}/骞�</span> -->
   </div>
 </template>
 
 <script>
 export default {
   props: {
-    priceNew: {},
+    priceNew: {
+      default: 0,
+    },
     showIcon: {
       default: false,
     },
@@ -42,6 +44,27 @@
       this.priceO2 = ".00";
     }
   },
+
+  watch: {
+    priceNew() {
+      const priceO = (this.priceNew * 1.2 + "").split(".");
+      const priceN = (this.priceNew + "").split(".");
+      if (priceN.length > 1) {
+        this.priceN1 = priceN[0];
+        this.priceN2 = "." + priceN[1];
+      } else {
+        this.priceN1 = priceN[0];
+        this.priceN2 = ".00";
+      }
+      if (priceO.length > 1) {
+        this.priceO1 = priceO[0];
+        this.priceO2 = "." + priceO[1];
+      } else {
+        this.priceO1 = priceO[0];
+        this.priceO2 = ".00";
+      }
+    },
+  },
 };
 </script>
 

--
Gitblit v1.8.0