Commit 332f2f17 by 郑炬波

feat: 精度

parent 3b30e32d
{ {
"name": "@ydl-packages/toolkit", "name": "@ydl-packages/toolkit",
"version": "1.0.3", "version": "1.0.1-next.33",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
...@@ -4224,6 +4224,11 @@ ...@@ -4224,6 +4224,11 @@
"blueimp-md5": { "blueimp-md5": {
"version": "2.19.0" "version": "2.19.0"
}, },
"decimal.js": {
"version": "10.4.2",
"resolved": "http://npm.ydl.com/decimal.js/-/decimal.js-10.4.2.tgz",
"integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA=="
},
"jest": { "jest": {
"version": "28.1.3", "version": "28.1.3",
"dev": true, "dev": true,
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
"dependencies": { "dependencies": {
"axios": "^0.27.2", "axios": "^0.27.2",
"blueimp-md5": "^2.19.0", "blueimp-md5": "^2.19.0",
"decimal.js": "^10.4.2",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"mathjs": "^11.0.1",
"qs": "^6.11.0" "qs": "^6.11.0"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -2,7 +2,7 @@ import {UNIT_PAY, IS_PAY, MY_BALANCE, PAY_CHECK_INTERVAL} from "./API"; ...@@ -2,7 +2,7 @@ import {UNIT_PAY, IS_PAY, MY_BALANCE, PAY_CHECK_INTERVAL} from "./API";
import md5 from 'blueimp-md5' import md5 from 'blueimp-md5'
import qs from 'qs' import qs from 'qs'
import {Utils} from "@/Utils/Utils"; import {Utils} from "@/Utils/Utils";
import {bignumber, subtract} from 'mathjs' import Decimal from 'decimal.js';
import {createRequest, defaultRequest, DefaultResponse} from "@/Request/Request"; import {createRequest, defaultRequest, DefaultResponse} from "@/Request/Request";
import { import {
BACK_ORDER_ID, BACK_ORDER_ID,
...@@ -180,7 +180,9 @@ export class Payment { ...@@ -180,7 +180,9 @@ export class Payment {
payAmount = totalAmount payAmount = totalAmount
} else if (balance > 0 && balance < totalAmount) { } else if (balance > 0 && balance < totalAmount) {
payBalance = balance; payBalance = balance;
payAmount = totalAmount - balance; const x = new Decimal(totalAmount);
const y = new Decimal(balance);
payAmount = Number(x.minus(y));
} else { } else {
payBalance = totalAmount payBalance = totalAmount
} }
......
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