Commit fe7f1a53 authored by 潘自豪's avatar 潘自豪

营业额

parent 8da7109a
......@@ -20,12 +20,32 @@ export const userLogin = (username, pass, captchaSign, verificationcode, captcha
}
}, 'POST');
//首页营业额率值 -汇总
export const getBusinessConditionDatas = (cur_day) => fetch('/api/query/*/action/get_business_condition_datas', {
aux: {
cur_day: cur_day
}
}, 'POST');
//明细页营业额汇月 -汇总
export const getBusinessConditionDataByMonth = (cur_day) => fetch('/api/query/*/action/get_business_condition_datas_by_month', {
aux: {
cur_day: cur_dayS
}
}, 'POST');
//明细页营业额汇年 -汇总
export const getBusinessConditionDatasByYear = (cur_day) => fetch('/api/query/*/action/get_business_condition_datas_by_year', {
aux: {
cur_day: cur_dayS
}
}, 'POST');
This diff is collapsed.
//环比值=(当日营业额-昨日营业额)/昨日营业额*100%计算
export const calc_hb_str = function (cur, pre) {
return conver_num_rate(formater((cur - pre) / pre * 100));
};
//同比值=(当日营业额上个月同一日营业额)/上个月同一日营业额*100%计算
export const calc_tb_str = function (cur, pre) {
return conver_num_rate(formater(cur / pre * 100));
};
//conver amont
export const conver_amont = function (amont) {
return formater(amont / 10000);
};
//Positive and negative
export const conver_num_rate = function (amont) {
if (amont > 0) {
return "+" + amont + "%"
} else {
return "-" + amont + "%"
}
};
//数字金额显示
function formater(data) {
if (!data) return '0.00'
// 将数据分割,保留两位小数
data = data.toFixed(2)
// 获取整数部分
const intPart = Math.trunc(data)
// 整数部分处理,增加,
const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
// 预定义小数部分
let floatPart = '.00'
// 将数据分割为小数部分和整数部分
const newArr = data.toString().split('.')
if (newArr.length === 2) { // 有小数部分
floatPart = newArr[1].toString() // 取得小数部分
return intPartFormat + '.' + floatPart
}
return intPartFormat + floatPart
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment