Commit d95936b5 by 李伟康

commit 盯防

1 parent ce310f83
......@@ -12970,6 +12970,11 @@
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
},
"number-precision": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz",
"integrity": "sha512-05OLPgbgmnixJw+VvEh18yNPUo3iyp4BEWJcrLu4X9W05KmMifN7Mu5exYvQXqxxeNWhvIF+j3Rij+HmddM/hQ=="
},
"nwsapi": {
"version": "2.2.1",
"resolved": "https://registry.npmmirror.com/nwsapi/-/nwsapi-2.2.1.tgz",
......
......@@ -43,6 +43,7 @@
"jspdf": "^2.5.1",
"lowdb": "^1.0.0",
"nprogress": "^0.2.0",
"number-precision": "^1.6.0",
"qrcodejs2": "^0.0.2",
"qs": "^6.8.0",
"rfdc": "^1.3.0",
......
......@@ -78,6 +78,7 @@ import onShowMixin from './onShowMixin'
import { getBoardMerchantList, exportMerchantList } from '@api/earlyWarningManager'
import { deepClone, downLoadFile } from '@/common/util'
import dayjs from 'dayjs'
import NP from 'number-precision'
const RATIO_KEY = {
output: 'outputRatio',
orderNumber: 'orderNumberRatio',
......@@ -140,7 +141,8 @@ export default {
}, {
label: '主营品牌',
prop: "carBrandList",
addHtml: 'popoverHtml'
addHtml: 'popoverHtml',
minWidth: 200,
}, {
label: '业务性质',
prop: "businessScenario",
......@@ -199,11 +201,11 @@ export default {
this.originTableData = []
const res = await getBoardMerchantList(this.searchForm)
res.map(e => {
// e.output = Math.floor(Math.random() * 10001)
// e.output = Math.random() * 9999 + 1
// e.orderNumber = Math.floor(Math.random() * 10001)
// e.customerUnitPrice = Math.floor(Math.random() * 10001)
// e.penetrationRate = Math.floor(Math.random() * 100)
// e.touchConversionRate = Math.floor(Math.random() * 100)
// e.customerUnitPrice = Math.random() * 9999 + 1
// e.penetrationRate = Math.random() * 10 + 1
// e.touchConversionRate = Math.random() * 10 + 1
// e.outputRatio = Math.floor(Math.random() * 201) - 100
let supervisionNameList = []
e.supervisionList?.map(i => {
......@@ -246,13 +248,16 @@ export default {
},
formatterValue (e) {
const { scope, prop } = e
let str = scope[prop]
if (str != null) {
str = str.toLocaleString()
if (['output', 'customerUnitPrice'].includes(prop)) str = `¥${str}`
if (['penetrationRate', 'touchConversionRate'].includes(prop)) str = `${str}%`
} else str = '-'
return str
let num = scope[prop]
if (num != null) {
const isRate = ['penetrationRate', 'touchConversionRate'].includes(prop)
if (isRate) num = NP.times(num, 100)
if (num % 1 !== 0) num = num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
else num = num.toLocaleString();
if (['output', 'customerUnitPrice'].includes(prop)) num = `¥${num}`
if (isRate) num += '%'
} else num = '-'
return num
},
percentColor (e) {
const { scope, prop } = e,
......
......@@ -68,7 +68,7 @@
import SearchBox from '../SearchBox'
import BoardItem from './BoardItem'
import { getShopGuardIndexBoard } from '@api/earlyWarningManager'
import NP from 'number-precision'
export default {
name: '',
components: {
......@@ -166,6 +166,7 @@ export default {
const res = await getShopGuardIndexBoard(params)
Object.keys(res).map(key => {
if (res[key] != null) {
if (key == 'outputCompletionProgress') res[key] = NP.times(res[key], 0.01)
if (key == 'budget') res[key] = '¥' + res[key].toLocaleString()
} else res[key] = '-'
})
......
......@@ -22,6 +22,7 @@
</template>
<script type='text/ecmascript-6'>
import NP from 'number-precision'
export default {
name: '',
props: {
......@@ -66,8 +67,11 @@ export default {
},
formattedValue (num, unit) {
if (num != null) {
num = num.toLocaleString()
if (unit) num = `${num}%`
if (unit) num = NP.times(num, 100);
// 检查数字是否有小数部分
if (num % 1 !== 0) num = num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
else num = num.toLocaleString();
if (unit) num += '%';
}
else num = '-'
return num
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!