1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| import * as Foundation from './Foundation.js';
|
| /**
| * 金钱单位置换 2999 --> 2,999.00
| * @param val
| * @param unit
| * @param location
| * @returns {*}
| */
| export function unitPrice (val, unit, location) {
| if (!val) val = 0;
| let price = Foundation.formatPrice(val);
| if (location === 'before') {
| return price.substr(0, price.length - 3);
| }
| if (location === 'after') {
| return price.substr(-2);
| }
| return (unit || '') + price;
| }
|
|