li.shaoyi 1 年間 前
コミット
6c18ebd621

+ 2 - 2
oem/tss/config/appconfig.json

@@ -1,8 +1,8 @@
 {
   "appId": "com.muchinfo.tss",
   "appName": "TCE",
-  "version": "1.0.9",
-  "versionCode": "100009",
+  "version": "1.0.10",
+  "versionCode": "100010",
   "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
   "tradeChannel": "ws",
   "modules": [

+ 16 - 22
src/filters/index.ts

@@ -146,11 +146,11 @@ export function handleRequestBigNumber(value: string) {
  * @param value 
  * @param decimal 保留小数位
  */
-export function parsePercent(value = 0, decimal = 2) {
+export function parsePercent(value = 0, decimal = 2, round = false) {
     if (Number.isNaN(value)) {
         return '0%'
     }
-    const val = formatDecimal(value * 100, decimal, false)
+    const val = formatDecimal(value * 100, decimal, round)
     return val + '%'
 }
 
@@ -191,27 +191,21 @@ export function pow(base:number, exponent:number) {
  * @param round 是否四舍五入
  * @returns 
  */
-export function formatDecimal(value: number | string, decimal = 2, round = true) {
-    const val = Number(value)
-    if (decimal <= 0) {
-        if (round) {
-            return Math.round(val).toString()
-        }
-        return Math.trunc(val).toString()
-    } else {
-        if (round) {
-            const res = val.toFixed(decimal)
-            return res === '-0.00' ? '0.00' : res // 计算精度丢失,临时处理,只适合两位小数
-        }
-        let num = val.toString()
-        const index = num.indexOf('.')
-        if (index !== -1) {
-            num = num.substring(0, decimal + index + 1)
-        } else {
-            num = num.substring(0)
-        }
-        return parseFloat(num).toFixed(decimal)
+export function formatDecimal(value: number | string, decimals = 2, round = true) {
+    const num = Number(value)
+    if (decimals === 0) {
+        // 如果不需要四舍五入,则直接截断(向下取整)
+        return round ? Math.round(num).toString() : Math.floor(num).toString()
+    }
+    if (round) {
+        return num.toFixed(decimals)
     }
+    const factor = Math.pow(10, decimals)
+    const truncatedNum = Math.floor(num * factor) / factor
+    const [integerPart, decimalPart = ''] = truncatedNum.toString().split('.')
+    // 补全小数部分到指定位数
+    const zerosToAdd = decimals - decimalPart.length
+    return `${integerPart}.${decimalPart}${zerosToAdd > 0 ? '0'.repeat(zerosToAdd) : ''}`
 }
 
 /**

+ 2 - 4
src/packages/gcszt/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/gstj/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/gzcj/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/mobile/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -259,8 +258,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 9 - 5
src/packages/mobile/views/ballot/list/Index.vue

@@ -30,8 +30,9 @@
             <Waterfall class="g-goods-waterfall" :data-list="endList">
                 <template #default="{ item }">
                     <div class="goods" @click="toDetail(item)">
-                        <div class="goods-image mask">
+                        <div class="goods-image">
                             <img :src="getFileUrl(item.attachmenturl)" />
+                            <span class="goods-image__mask">已结束</span>
                         </div>
                         <div class="goods-info">
                             <div class="goods-info__title">{{ item.goodsname }}</div>
@@ -66,7 +67,10 @@
             <Divider>{{ $t('quote.ballot.historypresale') }}</Divider>
             <ul class="g-goods-list">
                 <li class="list-item" v-for="(item, index) in endList" :key="index" @click="toDetail(item)">
-                    <div class="img mask"><img :src="getFirstImage(item.attachmenturl)" /></div>
+                    <div class="img">
+                        <img :src="getFirstImage(item.attachmenturl)" />
+                        <span class="img__mask">已结束</span>
+                    </div>
                     <div class="info">
                         <div class="title"><span>{{ item.goodscode }}/{{ item.goodsname }}</span></div>
                         <div class="desc">
@@ -106,7 +110,7 @@ const props = defineProps({
     }
 })
 
-const { global: { t }} = i18n
+const { global: { t } } = i18n
 const isWaterfall = shallowRef(false)
 const { router, getQueryString, setGlobalUrlParams } = useNavigation()
 const bannerList = shallowRef<string[]>([])
@@ -137,9 +141,9 @@ useRequest(queryPresaleAuctions, {
         presalemode: 5,
         presalestatusstr: '3,4'
     },
-    onSuccess:( res => {
+    onSuccess: (res => {
         endList.value = res.data.sort((a, b) => {
-            return b.endtime.localeCompare(a.endtime) 
+            return b.endtime.localeCompare(a.endtime)
         })
     })
 })

+ 8 - 4
src/packages/mobile/views/presale/list/Index.vue

@@ -30,8 +30,9 @@
             <Waterfall class="g-goods-waterfall" :data-list="endList">
                 <template #default="{ item }">
                     <div class="goods" @click="toDetail(item)">
-                        <div class="goods-image mask">
+                        <div class="goods-image">
                             <img :src="getFileUrl(item.attachmenturl)" />
+                            <span class="goods-image__mask">已结束</span>
                         </div>
                         <div class="goods-info">
                             <div class="goods-info__title">{{ item.goodsname }}</div>
@@ -66,7 +67,10 @@
             <Divider>{{ $t('quote.presale.presalehistory') }}</Divider>
             <ul class="g-goods-list">
                 <li class="list-item" v-for="(item, index) in endList" :key="index" @click="toDetail(item)">
-                    <div class="img mask"><img :src="getFirstImage(item.attachmenturl)" /></div>
+                    <div class="img">
+                        <img :src="getFirstImage(item.attachmenturl)" />
+                        <span class="img__mask">已结束</span>
+                    </div>
                     <div class="info">
                         <div class="title">{{ item.goodscode }}/{{ item.goodsname }}</div>
                         <div class="desc">
@@ -140,9 +144,9 @@ useRequest(queryPresaleAuctions, {
         presalemode: 4,
         presalestatus: 3
     },
-    onSuccess:( res => {
+    onSuccess: (res => {
         endList.value = res.data.sort((a, b) => {
-            return b.endtime.localeCompare(a.endtime) 
+            return b.endtime.localeCompare(a.endtime)
         })
     })
 })

+ 2 - 4
src/packages/nhgj/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/qdhs/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/qxst/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/tc/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/thj/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/tjmd/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/tss/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/zrwyt/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 2 - 4
src/packages/zrwyt2/assets/themes/global/global.less

@@ -174,8 +174,7 @@
                 border-radius: 8px;
                 overflow: hidden;
 
-                &.mask::after {
-                    content: '已结束';
+                &__mask {
                     position: absolute;
                     top: 0;
                     left: 0;
@@ -247,8 +246,7 @@
             border-radius: 8px;
             overflow: hidden;
 
-            &.mask::after {
-                content: '已结束';
+            &__mask {
                 position: absolute;
                 top: 0;
                 left: 0;

+ 4 - 8
src/stores/modules/position.ts

@@ -93,7 +93,7 @@ export const usePositionStore = defineStore(() => {
     }
 
     // 接收头寸变化通知
-    const posChangedNtf = eventBus.$on('PosChangedNtf', () => { 
+    const posChangedNtf = eventBus.$on('PosChangedNtf', () => {
         getTradePosition()
     })
 
@@ -187,11 +187,8 @@ export const useSBYJOrderStore = defineStore(() => {
         return orderComputedList.value.filter((e) => e.tHDetailEx.goodsID === goodsId)
     }
 
-    // 接收委托单成交通知
-    const orderDealedNtf = eventBus.$on('OrderDealedNtf', () => getSBYJMyOrders())
-
-    // 接收头寸变化通知通知
-    const posChangedNtf = eventBus.$on('PosChangedNtf', () => getSBYJMyOrders())
+    // 接收通知
+    const eventNotify = eventBus.$on(['OrderDealedNtf', 'PosChangedNtf'], () => getSBYJMyOrders())
 
     // 接收登入请求数据
     eventBus.$on('LoginNotify', () => {
@@ -208,8 +205,7 @@ export const useSBYJOrderStore = defineStore(() => {
         orderComputedList,
         getSBYJMyOrders,
         getOrderListByGoodsId,
-        orderDealedNtf,
-        posChangedNtf,
+        eventNotify,
         subscribe
     }
 })