lilei před 1 rokem
rodič
revize
d9a6f99e49

+ 10 - 1
src/libs/tools.js

@@ -3,7 +3,16 @@ export const getOperationalPrecision = (num1, num2) => {
   const val = ((num1 * 10000) * (num2 * 10000) / 100000000).toFixed(2) || 0
   return val != 0 ? val : 0
 }
-
+// 加粗替换字符串中的金额
+export const boldAmounts = (text) => {
+    let regex = /(\d+\.?\d*)元/g;
+    let regex1 = /再满(\d+\.?\d*)元,可享受优惠/g;
+    let regex2 = /(\d+\.?\d*)(/g
+    let rext = text.replace(regex1, '<b>再满$1元,可享受优惠</b>');
+    rext = rext.replace(regex, '<span>$1元</span>');
+    rext = rext.replace(regex2, '<span>$1</span>(');
+    return rext;
+}
 // 金额转大写
 export const dealBigMoney = (n) => {
   if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) { return '数据非法' }

+ 3 - 2
src/utils/mixin.js

@@ -1,6 +1,6 @@
 // import Vue from 'vue'
 import { deviceEnquire, DEVICE_TYPE } from '@/utils/device'
-import { toThousands } from '@/libs/tools'
+import { toThousands, boldAmounts } from '@/libs/tools'
 import { mapState } from 'vuex'
 
 // const mixinsComputed = Vue.config.optionMergeStrategies.computed
@@ -80,7 +80,8 @@ const AppDeviceEnquire = {
 const commonMixin = {
   data(){
     return {
-      toThousands
+      toThousands,
+      boldAmounts
     }
   },
   computed:{

+ 14 - 3
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -246,9 +246,7 @@
         <!-- 总计 -->
         <a-alert type="info" banner :showIcon="false">
             <div slot="message" class="alert-bar">
-              <div>
-                {{ countData&&countData.remarks }}
-              </div>
+              <div class="countData" v-html="boldAmounts(countData&&countData.remarks||'')"></div>
               <div style="display: flex;">
                 <div>
                   款数:<strong>{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? countData.totalCategory : 0 }}</strong>
@@ -768,6 +766,19 @@
     display: flex;
     justify-content: space-between;
     align-items: center;
+    .countData{
+      span{
+        margin: 0 3px;
+        color: rgb(0, 119, 255);
+        font-weight: bold;
+      }
+      b{
+        font-weight: bold;
+        span{
+          color: red;
+        }
+      }
+    }
     > div{
       &:first-child{
         flex-grow: 1;