feat: 优化线下收款展示细节
This commit is contained in:
@@ -332,7 +332,14 @@ enum OfflineCollectionMoney {
|
||||
|
||||
static func responseFen(_ value: String) -> Int? { parseFen(value) }
|
||||
static func apiAmount(_ fen: Int) -> String { "\(fen / 100).\(String(format: "%02d", fen % 100))" }
|
||||
static func display(_ fen: Int) -> String { "¥\(apiAmount(fen))" }
|
||||
static func displayAmount(_ fen: Int) -> String {
|
||||
let whole = fen / 100
|
||||
let cents = fen % 100
|
||||
if cents == 0 { return "\(whole)" }
|
||||
if cents.isMultiple(of: 10) { return "\(whole).\(cents / 10)" }
|
||||
return "\(whole).\(String(format: "%02d", cents))"
|
||||
}
|
||||
static func display(_ fen: Int) -> String { "¥\(displayAmount(fen))" }
|
||||
}
|
||||
|
||||
/// 线下收款统一使用的营业日工具。
|
||||
|
||||
Reference in New Issue
Block a user