| | |
| | | ## å¼å |
| | | |
| | | > æ¬ç®å½ `opo-web/` å³ PC åç«¯å·¥ç¨æ ¹ç®å½ï¼åè¥ä¾æ¨¡æ¿å为 `ruoyi-ui`ï¼æ¤å¤å·²æ¹åï¼ã |
| | | > 以ä¸å½ä»¤**åå¨ `opo-web/` 䏿§è¡**ã |
| | | |
| | | ```bash |
| | | # å
éé¡¹ç® |
| | | git clone https://gitee.com/y_project/RuoYi-Vue |
| | | |
| | | # è¿å
¥é¡¹ç®ç®å½ |
| | | cd ruoyi-ui |
| | | |
| | | # å®è£
ä¾èµ |
| | | npm install |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #!/usr/bin/env node |
| | | /** |
| | | * éé¢ç²¾åº¦æ£æ¥ï¼é²å¤åé¨ç¦ï¼ |
| | | * |
| | | * èæ¯ï¼é颿µ®ç¹ç´¯å 卿¬é¡¹ç®åå¤å¼å线ä¸é®é¢ï¼å
¸åçç¶æ¯ |
| | | * ãå计对ä¸ä¸ããåºç° -0.00ããéé¢å¸¦ä¸é¿ä¸²å°æ°ããæ ¹å æ¯ JS ç Number |
| | | * æ¯ IEEE-754 å精度浮ç¹ï¼å¯¹ 2 ä½å°æ°éé¢å + - * ä¼å¼å
¥äºè¿å¶èå
¥è¯¯å·®ï¼ |
| | | * ä¸è¯¯å·®ä¼éæç»æ¡æ°ç´¯ç§¯ï¼å®æµçº¦ 39% ç夿ç»ç»åä¼åºç°å°¾å·®ï¼ã |
| | | * |
| | | * å æ¤çº¦å®ï¼éé¢è¿ç®ä¸å¾ä½¿ç¨ @/utils/moneyï¼å
é¨åºäº decimal.jsï¼åè¿å¶ç²¾ç¡®è¿ç®ï¼ã |
| | | * |
| | | * æ¬èæ¬æ«æ src ä¸ç .js / .vueï¼æ¾åºãç似对éé¢åæµ®ç¹ç´¯å ãç忳并æ¥ééåºï¼ |
| | | * ä»¥ä¾¿å¨æäº¤åæ¦ä½åå½ã建议æå° pre-commit æ CIã |
| | | * |
| | | * ç¨æ³ï¼ |
| | | * node build/checkMoney.js |
| | | * æ npm run check:money |
| | | * |
| | | * è¥ç¡®è®¤æå¤æ¯è¯¯æ¥ï¼ä¾å¦ç´¯å ç䏿¯éé¢ï¼èæ¯æ°éã天æ°çï¼ï¼ |
| | | * å¨è¯¥è¡ä¸æ¹å 注éï¼// money-check-ignore |
| | | */ |
| | | const fs = require("fs"); |
| | | const path = require("path"); |
| | | |
| | | const SRC_DIR = path.resolve(__dirname, "../src"); |
| | | const IGNORE_COMMENT = "money-check-ignore"; |
| | | |
| | | // å±é©åæ³ï¼å¯¹ parseFloat ç»æåç´¯å ï¼æä»¥ parseFloat ç¸ä¹ååä¸ç´¯å |
| | | const RULES = [ |
| | | { |
| | | id: "float-accumulate", |
| | | // å½¢å¦ totalFee += parseFloat(...) |
| | | pattern: /\+=\s*parseFloat\s*\(/, |
| | | message: "对 parseFloat ç»æåç´¯å ï¼éé¢ä¼ç´¯ç§¯æµ®ç¹è¯¯å·®" |
| | | }, |
| | | { |
| | | id: "float-subtract-assign", |
| | | // å½¢å¦ totalFee -= parseFloat(...) |
| | | pattern: /-=\s*parseFloat\s*\(/, |
| | | message: "对 parseFloat ç»æååæ³ç´¯å ï¼éé¢ä¼ç´¯ç§¯æµ®ç¹è¯¯å·®" |
| | | }, |
| | | { |
| | | id: "float-text-math", |
| | | // å½¢å¦ a = (parseFloat(x) - parseFloat(y)).toFixed(2) |
| | | pattern: /=\s*\(?\s*parseFloat\s*\([^)]*\)\s*[-+*]\s*parseFloat\s*\(/, |
| | | message: "parseFloat ä¹é´ç´æ¥åç®æ¯è¿ç®åæ ¼å¼åï¼ç»æå¯è½å¸¦æµ®ç¹å°¾å·®" |
| | | } |
| | | ]; |
| | | |
| | | // æé¤ç¬¬ä¸æ¹åºä¸æå»ºäº§ç©ï¼ä»
æ£æ¥ä¸å¡æºç |
| | | const EXCLUDE_DIRS = [ |
| | | path.join(SRC_DIR, "echarts"), // echarts ç¬¬ä¸æ¹åºæºç |
| | | path.join(SRC_DIR, "assets") |
| | | ]; |
| | | |
| | | // å
许çåæ³ï¼è¿äºæ¯å¯¹å个å¼çåæ³æ§/é¶å¼æ ¡éªï¼ä¸ææç´¯å ï¼ä¸ä¼æ¾å¤§è¯¯å·® |
| | | const ALLOW = [/parseFloat\([^)]*\)\s*==\s*0/, /parseFloat\([^)]*\)\s*!=\s*0/]; |
| | | |
| | | function walk(dir, out) { |
| | | for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { |
| | | const full = path.join(dir, entry.name); |
| | | if (entry.isDirectory()) { |
| | | if (entry.name === "node_modules") continue; |
| | | if (EXCLUDE_DIRS.indexOf(full) >= 0) continue; |
| | | walk(full, out); |
| | | } else if (/\.(js|vue)$/.test(entry.name)) { |
| | | out.push(full); |
| | | } |
| | | } |
| | | return out; |
| | | } |
| | | |
| | | function checkFile(file) { |
| | | const lines = fs.readFileSync(file, "utf8").split(/\r?\n/); |
| | | const hits = []; |
| | | let inBlockComment = false; |
| | | |
| | | lines.forEach((line, idx) => { |
| | | const code = line.trim(); |
| | | |
| | | // è·è¸ªè·¨è¡å注éï¼å注éä¸ç代ç ä¸å䏿£æ¥ï¼é¿å
对已注éæç代ç 误æ¥ï¼ |
| | | if (inBlockComment) { |
| | | if (code.indexOf("*/") >= 0) inBlockComment = false; |
| | | return; |
| | | } |
| | | if (code.indexOf("/*") === 0) { |
| | | if (code.indexOf("*/") < 0) inBlockComment = true; |
| | | return; |
| | | } |
| | | // è¡æ³¨é |
| | | if (code.indexOf("//") === 0 || code.indexOf("*") === 0) return; |
| | | // å
许çåæ³ï¼å个å¼çåæ³æ§/é¶å¼æ ¡éª |
| | | if (ALLOW.some((re) => re.test(line))) return; |
| | | // æ¾å¼è¯¯æ¥æ è®° |
| | | const prev = idx > 0 ? lines[idx - 1] : ""; |
| | | if (prev.indexOf(IGNORE_COMMENT) >= 0) return; |
| | | |
| | | RULES.forEach((rule) => { |
| | | if (rule.pattern.test(line)) { |
| | | hits.push({ line: idx + 1, id: rule.id, message: rule.message, code: code.slice(0, 120) }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | return hits; |
| | | } |
| | | |
| | | function main() { |
| | | if (!fs.existsSync(SRC_DIR)) { |
| | | console.error(`æ¾ä¸å°æºç ç®å½ï¼${SRC_DIR}`); |
| | | process.exit(1); |
| | | } |
| | | |
| | | const files = walk(SRC_DIR, []); |
| | | let total = 0; |
| | | const report = []; |
| | | |
| | | files.forEach((file) => { |
| | | const hits = checkFile(file); |
| | | if (hits.length) { |
| | | total += hits.length; |
| | | report.push({ file: path.relative(path.resolve(__dirname, ".."), file), hits }); |
| | | } |
| | | }); |
| | | |
| | | if (total === 0) { |
| | | console.log(`éé¢ç²¾åº¦æ£æ¥éè¿ï¼å·²æ«æ ${files.length} 个æä»¶ï¼`); |
| | | process.exit(0); |
| | | } |
| | | |
| | | console.error("éé¢ç²¾åº¦æ£æ¥æªéè¿ï¼åç°çä¼¼é颿µ®ç¹ç´¯å \n"); |
| | | report.forEach(({ file, hits }) => { |
| | | console.error(` ${file}`); |
| | | hits.forEach((h) => { |
| | | console.error(` L${h.line} [${h.id}] ${h.message}`); |
| | | console.error(` ${h.code}`); |
| | | }); |
| | | console.error(""); |
| | | }); |
| | | console.error("请æ¹ç¨ @/utils/money æä¾çæ¹æ³ï¼ä¾å¦ï¼"); |
| | | console.error(' import { moneySum, moneyAdd, moneyMul, moneyRound } from "@/utils/money";'); |
| | | console.error(" const total = moneyRound(moneySum(list, \"amount\"));"); |
| | | console.error(" éé¢ç¸çæ¯è¾ç¨ moneyEq()ï¼ä¸è¦ç¨ parseFloat(...) == æ ===ã"); |
| | | console.error(" ç¡®å±è¯¯æ¥æ¶ï¼å¨è¯¥è¡ä¸æ¹å 注é // money-check-ignore"); |
| | | process.exit(1); |
| | | } |
| | | |
| | | main(); |
| | |
| | | "build": "vue-cli-service build", |
| | | "build:stage": "vue-cli-service build --mode staging", |
| | | "preview": "node build/index.js --preview", |
| | | "lint": "eslint --ext .js,.vue src" |
| | | "lint": "eslint --ext .js,.vue src", |
| | | "check:money": "node build/checkMoney.js" |
| | | }, |
| | | "husky": { |
| | | "hooks": { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * éé¢è®¡ç®å·¥å
· |
| | | * |
| | | * èæ¯ï¼æ¬ç³»ç»éé¢ä¸å¾ä»¥ãå
ã为åä½ãä¿ç 2 ä½å°æ°ï¼å±è´¢å¡æ°æ®ã |
| | | * JS ç Number æ¯ IEEE-754 å精度浮ç¹ï¼ç´æ¥åå åä¹ä¼å¼å
¥äºè¿å¶èå
¥è¯¯å·®ï¼ |
| | | * å
¸å表ç°ï¼ |
| | | * 0.1 + 0.2 -> 0.30000000000000004 |
| | | * 1.1 * 3 -> 3.3000000000000003 |
| | | * 0.3 - 0.2 - 0.1 -> -2.7755575615628914e-17 ï¼éè´¹/æ£ç¨ç¸ååæ®çå°¾å·®ï¼ |
| | | * è¿ç±»å°¾å·®å¯¼è´ãå计对ä¸ä¸ããé颿¾ç¤ºä¸º -0ããç¸çå¤æå¤±è´¥ãç线ä¸é®é¢ï¼ |
| | | * ä¸ä¼éåæ®æµè½¬è¢«åå
¥æ°æ®åºï¼äºåé¾ä»¥è¿½æº¯ã |
| | | * |
| | | * å æ¤ï¼ææéé¢è¿ç®ç»ä¸èµ°æ¬æ¨¡åï¼ç¦æ¢ç´æ¥å¯¹éé¢ä½¿ç¨ + - * / ä¸ parseFloat ç´¯å ã |
| | | * å
é¨åºäº decimal.jsï¼package.json å·²å¼å
¥ï¼ï¼ä¿è¯åè¿å¶ç²¾ç¡®è¿ç®ã |
| | | * |
| | | * ç¨æ³ç¤ºä¾ï¼ |
| | | * import { moneySum, moneyMul, moneySub, moneyRound, moneyEq } from "@/utils/money"; |
| | | * |
| | | * // ç´¯å æç»ï¼è¿æ»¤éæ°åä¸ç©ºå¼ï¼ä¸ä¼æ NaN ä¼ æç»åè®¡ï¼ |
| | | * const total = moneySum(this.rbDetails, "amount"); |
| | | * |
| | | * // åä»· Ã æ°é |
| | | * const preTax = moneyMul(row.price, row.quantity); |
| | | * |
| | | * // ç¨å - æ£ç¨ = ç¨å |
| | | * const afterTax = moneySub(row.amount, row.taxamount); |
| | | * |
| | | * // è½åº/å±ç¤ºåç»ä¸ä¿ç 2 ä½ï¼åèäºå
¥ï¼ |
| | | * this.form.amountrequested = moneyRound(total); |
| | | * |
| | | * // é颿¯è¾ï¼å¿ç¨ == / === æ parseFloat åç¸åï¼ |
| | | * if (!moneyEq(sumOfPayees, this.form.amountrequested)) { ... } |
| | | */ |
| | | import Decimal from 'decimal.js' |
| | | |
| | | /** éé¢ä¿çå°æ°ä½ */ |
| | | export const MONEY_SCALE = 2 |
| | | |
| | | /** |
| | | * 转为 Decimalï¼æ æ³è¯å«çå¼ï¼ç©ºä¸²/undefined/null/NaN/éæ°åï¼ä¸å¾æ 0 å¤çã |
| | | * æ 0 å¤çèéæéï¼æ¯ä¸ºäºä¿ææ¢æé¡µé¢ã!isNaN(parseFloat(x)) æç´¯å ãçè¡ä¸ºï¼ |
| | | * åæ¶é¿å
NaN æ±¡ææ´æ¡å计é¾ã |
| | | * |
| | | * @param {string|number|Decimal|null|undefined} value |
| | | * @returns {Decimal} |
| | | */ |
| | | export function toMoney(value) { |
| | | if (value === null || value === undefined || value === '') { |
| | | return new Decimal(0) |
| | | } |
| | | if (value instanceof Decimal) { |
| | | return value |
| | | } |
| | | let d |
| | | try { |
| | | d = new Decimal(value) |
| | | } catch (e) { |
| | | return new Decimal(0) |
| | | } |
| | | return d.isFinite() ? d : new Decimal(0) |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºææéé¢ï¼å¯åä¸è®¡ç®ï¼ãç¨äºåæ¬ !isNaN(parseFloat(x)) çæ ¡éªåºæ¯ã |
| | | * |
| | | * @param {*} value |
| | | * @returns {boolean} |
| | | */ |
| | | export function isValidMoney(value) { |
| | | if (value === null || value === undefined || value === '') { |
| | | return false |
| | | } |
| | | if (value instanceof Decimal) { |
| | | return value.isFinite() |
| | | } |
| | | if (typeof value === 'number') { |
| | | return Number.isFinite(value) |
| | | } |
| | | const s = String(value).trim() |
| | | if (s === '') { |
| | | return false |
| | | } |
| | | try { |
| | | return new Decimal(s).isFinite() |
| | | } catch (e) { |
| | | return false |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç´¯å æ±åã |
| | | * |
| | | * @param {Array} list å¾
ç´¯å çæ°ç» |
| | | * @param {string|Function} [selector] åéé¢çæ¹å¼ï¼ |
| | | * å符串 -> å该项çè¯¥å±æ§åï¼å¦ "amount"ï¼ |
| | | * 彿° -> ç¨è¿åå¼ï¼å¦ (item) => item.detail && item.detail.amountï¼ |
| | | * çç¥ -> ç´æ¥ç´¯å æ°ç»å
ç´ æ¬èº«ã |
| | | * @returns {number} æ±åç»æï¼Numberï¼ä¾¿äºèµå¼ç»è¡¨ååæ®µï¼ |
| | | */ |
| | | export function moneySum(list, selector) { |
| | | if (!Array.isArray(list) || list.length === 0) { |
| | | return 0 |
| | | } |
| | | let acc = new Decimal(0) |
| | | for (let i = 0; i < list.length; i++) { |
| | | const raw = |
| | | selector === undefined |
| | | ? list[i] |
| | | : typeof selector === 'function' |
| | | ? selector(list[i]) |
| | | : list[i][selector] |
| | | acc = acc.plus(toMoney(raw)) |
| | | } |
| | | return acc.toNumber() |
| | | } |
| | | |
| | | /** |
| | | * æ±ååä¿ç 2 ä½å°æ°ï¼ä¼å
å¨å±ç¤º/è½åºæ¶ä½¿ç¨ï¼ã |
| | | */ |
| | | export function moneySumRound(list, selector) { |
| | | return roundNumber(moneySum(list, selector)) |
| | | } |
| | | |
| | | /** |
| | | * ç²¾ç¡®å æ³ãæ¯æå¤åæ°ææ°ç»ï¼moneyAdd(1.1, 2.2) / moneyAdd([1.1, 2.2]) |
| | | */ |
| | | export function moneyAdd(...args) { |
| | | const list = args.length === 1 && Array.isArray(args[0]) ? args[0] : args |
| | | let acc = new Decimal(0) |
| | | list.forEach((v) => { |
| | | acc = acc.plus(toMoney(v)) |
| | | }) |
| | | return acc.toNumber() |
| | | } |
| | | |
| | | /** |
| | | * ç²¾ç¡®åæ³ a - bï¼å¯ä¼ å¤ä¸ªï¼a - b - cï¼ |
| | | */ |
| | | export function moneySub(a, ...rest) { |
| | | let acc = toMoney(a) |
| | | rest.forEach((v) => { |
| | | acc = acc.minus(toMoney(v)) |
| | | }) |
| | | return acc.toNumber() |
| | | } |
| | | |
| | | /** |
| | | * ç²¾ç¡®ä¹æ³ï¼åä»· à æ°éãéé¢ Ã ç¨çï¼ |
| | | */ |
| | | export function moneyMul(a, ...rest) { |
| | | let acc = toMoney(a) |
| | | rest.forEach((v) => { |
| | | acc = acc.times(toMoney(v)) |
| | | }) |
| | | return acc.toNumber() |
| | | } |
| | | |
| | | /** |
| | | * ç²¾ç¡®é¤æ³ï¼éé¢ Ã· æ°éï¼ï¼divideBy 为 0 æ¶è¿å 0ï¼ä¸äº§ç Infinity |
| | | */ |
| | | export function moneyDiv(a, b) { |
| | | const divisor = toMoney(b) |
| | | if (divisor.isZero()) { |
| | | return 0 |
| | | } |
| | | return toMoney(a).div(divisor).toNumber() |
| | | } |
| | | |
| | | /** |
| | | * é颿¯å¦ç¸çï¼åè¿å¶ç²¾ç¡®æ¯è¾ï¼ä¸åæµ®ç¹å°¾å·®å½±åï¼ã |
| | | * ä¼èªå¨å½ä¸åå° 2 ä½ï¼é¿å
100 ä¸ 100.001 è¿ç±»è¾¹ç误å¤ã |
| | | * |
| | | * @returns {boolean} |
| | | */ |
| | | export function moneyEq(a, b) { |
| | | return roundDecimal(a).eq(roundDecimal(b)) |
| | | } |
| | | |
| | | /** |
| | | * éé¢å¤§å°æ¯è¾ï¼a > b è¿å 1ï¼a < b è¿å -1ï¼ç¸çè¿å 0 |
| | | */ |
| | | export function moneyCmp(a, b) { |
| | | return roundDecimal(a).cmp(roundDecimal(b)) |
| | | } |
| | | |
| | | /** |
| | | * ä¿ç 2 ä½å°æ°å¹¶è¿å Numberï¼åèäºå
¥ï¼ROUND_HALF_UPï¼ã |
| | | * ç¨äºèµå¼ç»è¡¨ååæ®µãåä¸å端交äºã |
| | | * |
| | | * @param {*} value |
| | | * @param {number} [scale=2] |
| | | * @returns {number} |
| | | */ |
| | | export function moneyRound(value, scale = MONEY_SCALE) { |
| | | return roundDecimal(value, scale).toNumber() |
| | | } |
| | | |
| | | /** |
| | | * ä¿ç 2 ä½å°æ°å¹¶è¿åå符串ï¼ç¨äºéé¢å±ç¤ºï¼é¿å
大颿¶åºç°ç§å¦è®¡æ°æ³ï¼ã |
| | | * |
| | | * @param {*} value |
| | | * @param {number} [scale=2] |
| | | * @returns {string} |
| | | */ |
| | | export function moneyText(value, scale = MONEY_SCALE) { |
| | | return roundDecimal(value, scale).toFixed(scale) |
| | | } |
| | | |
| | | /** |
| | | * ä¿ç 2 ä½å°æ°å¹¶è¿å Decimalï¼ä¾åç»ç»§ç»ç²¾ç¡®è¿ç® |
| | | */ |
| | | export function moneyDecimal(value, scale = MONEY_SCALE) { |
| | | return roundDecimal(value, scale) |
| | | } |
| | | |
| | | function roundDecimal(value, scale = MONEY_SCALE) { |
| | | return toMoney(value).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP) |
| | | } |
| | | |
| | | // moneySum å
é¨å·²è¿å Numberï¼è¿éç»ä¸èµ°åä¸å¥åèäºå
¥ |
| | | function roundNumber(value) { |
| | | return roundDecimal(value).toNumber() |
| | | } |
| | | |
| | | export default { |
| | | MONEY_SCALE, |
| | | toMoney, |
| | | isValidMoney, |
| | | moneySum, |
| | | moneySumRound, |
| | | moneyAdd, |
| | | moneySub, |
| | | moneyMul, |
| | | moneyDiv, |
| | | moneyEq, |
| | | moneyCmp, |
| | | moneyRound, |
| | | moneyText, |
| | | moneyDecimal |
| | | } |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | data() { |
| | | return { |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null, |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart, |
| | | }, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | options: {} |
| | | options: {}, |
| | | // èªå¨è½®æå®æ¶å¨å¥æï¼ä¸æ¸
çä¼å¨ç»ä»¶éæ¯åç»§ç»è§¦åï¼å¯¼è´å¯¹å·²éæ¯å®ä¾æä½ |
| | | intervalId: null |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId !== null) { |
| | | clearInterval(this.intervalId); |
| | | this.intervalId = null; |
| | | } |
| | | }, |
| | | components: { |
| | | Echart |
| | | }, |
| | |
| | | import Li_area_select from "@/components/Address"; |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyRound } from "@/utils/money"; |
| | | import debounce from "lodash/debounce"; |
| | | export default { |
| | | components: { |
| | |
| | | submitForm: debounce(function(data) { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | //æ ¡éªãè´¹ç¨å计 |
| | | let ChargeSum = 0; |
| | | let ChargeamountSum = 0; |
| | | //æ ¡éªãè´¹ç¨å计ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | let organname = ""; |
| | | |
| | | try { |
| | | for (let i = 0; i < this.donorchargeorgans.length; i++) { |
| | | organname += this.donorchargeorgans[i].organname + ","; |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) { |
| | | ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge); |
| | | } |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) { |
| | | ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount); |
| | | } |
| | | } |
| | | this.form.donateorgan = organname.substring( |
| | | 0, |
| | | organname.lastIndexOf(",") |
| | | ); |
| | | this.form.chargeamount = ChargeSum.toFixed(2); |
| | | this.form.chargeamounted = ChargeamountSum.toFixed(2); |
| | | this.form.chargeamount = moneyRound( |
| | | moneySum(this.donorchargeorgans, "organcharge") |
| | | ).toFixed(2); |
| | | this.form.chargeamounted = moneyRound( |
| | | moneySum(this.donorchargeorgans, "amount") |
| | | ).toFixed(2); |
| | | } catch {} |
| | | |
| | | //ä¿å |
| | |
| | | }); |
| | | }, 500), |
| | | |
| | | //计ç®è´¹ç¨å计 |
| | | //计ç®è´¹ç¨å计ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | chargeSum() { |
| | | let ChargeSum = 0; |
| | | let ChargeamountSum = 0; |
| | | |
| | | //è´¹ç¨å计 |
| | | try { |
| | | for (let i = 0; i < this.donorchargeorgans.length; i++) { |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) { |
| | | ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge); |
| | | } |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) { |
| | | ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount); |
| | | } |
| | | } |
| | | |
| | | this.form.chargeamount = ChargeSum.toFixed(2); |
| | | this.form.chargeamounted = ChargeamountSum.toFixed(2); |
| | | this.form.chargeamount = moneyRound( |
| | | moneySum(this.donorchargeorgans, "organcharge") |
| | | ).toFixed(2); |
| | | this.form.chargeamounted = moneyRound( |
| | | moneySum(this.donorchargeorgans, "amount") |
| | | ).toFixed(2); |
| | | } catch {} |
| | | }, |
| | | |
| | |
| | | import Li_area_select from "@/components/Address"; |
| | | import OrgSelecter from "@/views/project/components/orgselect"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyMul, moneySub, moneyRound } from "@/utils/money"; |
| | | import CustomImageViewer from "@/components/CustomImageViewer"; // æ ¹æ®ä½ çè·¯å¾è°æ´ |
| | | |
| | | export default { |
| | |
| | | let tempDetail = this.rbDetails[j]; |
| | | if ( |
| | | isNaN(parseFloat(tempDetail.amount)) || |
| | | parseFloat(tempDetail.amount) == 0 |
| | | moneyRound(tempDetail.amount) == 0 |
| | | ) { |
| | | this.$modal.msgWarning( |
| | | "æå¡é¡¹ç®è¡¨ä¸ï¼ç¬¬" + |
| | |
| | | let tempDetail = this.rbDetails[j]; |
| | | if ( |
| | | isNaN(parseFloat(tempDetail.amount)) || |
| | | parseFloat(tempDetail.amount) == 0 |
| | | moneyRound(tempDetail.amount) == 0 |
| | | ) { |
| | | this.$modal.msgWarning( |
| | | "æå¡é¡¹ç®è¡¨ä¸ï¼ç¬¬" + |
| | |
| | | } |
| | | if ( |
| | | isNaN(parseFloat(tempDetail.taxamount)) || |
| | | parseFloat(tempDetail.taxamount) == 0 |
| | | moneyRound(tempDetail.taxamount) == 0 |
| | | ) { |
| | | tempDetail.taxedamount = parseFloat(tempDetail.amount); |
| | | } else { |
| | |
| | | |
| | | //计ç®ä¸ªç¨ï¼type(A:å·²ç¥ç¨åéé¢ï¼è®¡ç®ç¨åéé¢ï¼Bï¼å·²ç¥ç¨åéé¢ï¼è®¡ç®ç¨åéé¢) |
| | | calculateTax(row, type) { |
| | | let targetValue = 0; |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | if (!this.rbDetails[i].amount) { |
| | | this.rbDetails[i].amount = 0; |
| | | } |
| | | targetValue += parseFloat(this.rbDetails[i].amount); // å设æ¯ä¸ªå¯¹è±¡ä¸çç¹å®å¼åå¨å¨'specificValue'屿§ä¸ |
| | | } |
| | | this.form.pretaxcost = targetValue; |
| | | // å计éé¢å¿
须精确累å ï¼å¦åä¼åå
¥ form.pretaxcost å¹¶è½åº |
| | | this.form.pretaxcost = moneySum(this.rbDetails, "amount"); |
| | | }, |
| | | |
| | | //导å
¥ææé¡¹ç® |
| | |
| | | let tempDetail = this.rbDetails[j]; |
| | | if ( |
| | | isNaN(parseFloat(tempDetail.amount)) || |
| | | parseFloat(tempDetail.amount) == 0 |
| | | moneyRound(tempDetail.amount) == 0 |
| | | ) { |
| | | this.$modal.msgWarning( |
| | | "æå¡é¡¹ç®è¡¨ä¸ï¼ç¬¬" + |
| | |
| | | let tempDetail = this.rbDetails[j]; |
| | | if ( |
| | | isNaN(parseFloat(tempDetail.amount)) || |
| | | parseFloat(tempDetail.amount) == 0 |
| | | moneyRound(tempDetail.amount) == 0 |
| | | ) { |
| | | this.$modal.msgWarning( |
| | | "æå¡é¡¹ç®è¡¨ä¸ï¼ç¬¬" + |
| | |
| | | } |
| | | if ( |
| | | isNaN(parseFloat(tempDetail.taxamount)) || |
| | | parseFloat(tempDetail.taxamount) == 0 |
| | | moneyRound(tempDetail.taxamount) == 0 |
| | | ) { |
| | | tempDetail.taxedamount = parseFloat(tempDetail.amount); |
| | | } else { |
| | |
| | | }); |
| | | //å
¨é¨å é¤åæ·»å 䏿¡æ°è¡ |
| | | }, |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee(row) { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | const detail = this.rbDetails[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.rbDetails[i].amount))) { |
| | | totalFee += parseFloat(this.rbDetails[i].amount); |
| | | taxFee += parseFloat(this.rbDetails[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneySub(totalFee, -parseFloat(detail.amount)); |
| | | taxFee = moneySub(taxFee, -parseFloat(detail.amount)); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].taxamount))) { |
| | | totalFee -= parseFloat(this.rbDetails[i].taxamount); |
| | | taxFee -= parseFloat(this.rbDetails[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | taxFee = moneySub(taxFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3 || this.form.applytype == 4) { |
| | | //åä»·*æ°é=ç¨åéé¢ |
| | | if ( |
| | | !isNaN(parseFloat(this.rbDetails[i].price)) && |
| | | !isNaN(parseFloat(this.rbDetails[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.rbDetails[i].price) * |
| | | parseFloat(this.rbDetails[i].quantity); |
| | | this.rbDetails[i].amount = totalFee; |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | detail.amount = totalFee; |
| | | } |
| | | } |
| | | |
| | |
| | | // this.rbDetails[i].taxedamount = taxFee.toFixed(2); |
| | | // } |
| | | |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | const allSum = moneyRound(moneySum(detailsArr)); |
| | | // this.form.amountrequested = allSum.toFixed(2); |
| | | // this.$forceUpdate(); |
| | | }, |
| | |
| | | |
| | | //çå½å¨æ - æè½½å®æï¼å¯ä»¥è®¿é®DOMå
ç´ ï¼ |
| | | mounted() { |
| | | window.addEventListener("beforeunload", e => this.beforeunloadHandler(e)); |
| | | // åä½åä¸ä¸ªå¼ç¨ï¼å¦å removeEventListener ä¼ æ°ç®å¤´å½æ°æ æ³çæ£ç§»é¤ï¼ä¼æ³æ¼çå¬å¨ |
| | | this._beforeUnloadHandler = e => this.beforeunloadHandler(e); |
| | | window.addEventListener("beforeunload", this._beforeUnloadHandler); |
| | | this.getUserList(); |
| | | let apiaccountselectform = this.accountselectform; |
| | | let apiform = this.form; |
| | |
| | | updated() { }, //çå½å¨æ - æ´æ°ä¹å |
| | | beforeDestroy() { }, //çå½å¨æ - 鿝ä¹å |
| | | destroyed() { |
| | | window.removeEventListener("beforeunload", e => this.beforeunloadFn(e)); |
| | | if (this._beforeUnloadHandler) { |
| | | window.removeEventListener("beforeunload", this._beforeUnloadHandler); |
| | | this._beforeUnloadHandler = null; |
| | | } |
| | | }, //çå½å¨æ - 鿝宿 |
| | | activated() { } //妿页颿keep-aliveç¼ååè½ï¼è¿ä¸ªå½æ°ä¼è§¦å |
| | | }; |
| | |
| | | import Li_area_select from "@/components/Address"; |
| | | import OrgSelecter from "@/views/project/components/orgselect"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | //importå¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | |
| | | } |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | sumTotalFee(row) { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | const detail = this.rbDetails[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.rbDetails[i].amount))) { |
| | | totalFee += parseFloat(this.rbDetails[i].amount); |
| | | taxFee += parseFloat(this.rbDetails[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].taxamount))) { |
| | | totalFee -= parseFloat(this.rbDetails[i].taxamount); |
| | | taxFee -= parseFloat(this.rbDetails[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3 || this.form.applytype == 4) { |
| | | //åä»·*æ°é=ç¨åéé¢ |
| | | if ( |
| | | !isNaN(parseFloat(this.rbDetails[i].price)) && |
| | | !isNaN(parseFloat(this.rbDetails[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.rbDetails[i].price) * |
| | | parseFloat(this.rbDetails[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | this.rbDetails[i].amount = totalFee; |
| | | } |
| | | } |
| | |
| | | // this.rbDetails[i].taxedamount = taxFee.toFixed(2); |
| | | // } |
| | | |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | // this.form.amountrequested = allSum.toFixed(2); |
| | | // this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2); |
| | | // this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | |
| | | //çå½å¨æ - æè½½å®æï¼å¯ä»¥è®¿é®DOMå
ç´ ï¼ |
| | | mounted() { |
| | | window.addEventListener("beforeunload", e => this.beforeunloadHandler(e)); |
| | | // åä½åä¸ä¸ªå¼ç¨ï¼å¦å removeEventListener ä¼ æ°ç®å¤´å½æ°æ æ³çæ£ç§»é¤ï¼ä¼æ³æ¼çå¬å¨ |
| | | this._beforeUnloadHandler = e => this.beforeunloadHandler(e); |
| | | window.addEventListener("beforeunload", this._beforeUnloadHandler); |
| | | this.getUserList(); |
| | | this.getUserProfile(); |
| | | let apifunddetailForm = this.funddetailForm; |
| | | let apiform = this.form; |
| | | console.log(apiform); |
| | | console.log(apifunddetailForm); |
| | | |
| | | // this.getFeeUnitList(); |
| | | }, |
| | |
| | | beforeMount() {}, //çå½å¨æ - æè½½ä¹å |
| | | beforeUpdate() {}, //çå½å¨æ - æ´æ°ä¹å |
| | | updated() {}, //çå½å¨æ - æ´æ°ä¹å |
| | | beforeDestroy() {}, //çå½å¨æ - 鿝ä¹å |
| | | beforeDestroy() { |
| | | if (this._beforeUnloadHandler) { |
| | | window.removeEventListener("beforeunload", this._beforeUnloadHandler); |
| | | this._beforeUnloadHandler = null; |
| | | } |
| | | }, //çå½å¨æ - 鿝ä¹å |
| | | destroyed() {}, //çå½å¨æ - 鿝宿 |
| | | activated() {} //妿页颿keep-aliveç¼ååè½ï¼è¿ä¸ªå½æ°ä¼è§¦å |
| | | }; |
| | |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { listFundflow } from "@/api/project/fundflow"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | //importå¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | |
| | | // } catch { |
| | | // tempDetail.unitname = tempDetail.unitno; |
| | | // } |
| | | if (!isNaN(parseFloat(tempDetail.amount))) { |
| | | totalPreTaxAmount += parseFloat(tempDetail.amount); |
| | | totalAmount += parseFloat(tempDetail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(tempDetail.taxedamount))) { |
| | | totalAfterTaxAmount += parseFloat(tempDetail.taxedamount); |
| | | totalAmount += parseFloat(tempDetail.taxedamount); |
| | | } |
| | | } |
| | | //éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å |
| | | totalPreTaxAmount = moneySum(this.fundDetailArr, "amount"); |
| | | totalAfterTaxAmount = moneySum(this.fundDetailArr, "taxedamount"); |
| | | totalAmount = moneyAdd(totalPreTaxAmount, totalAfterTaxAmount); |
| | | try { |
| | | this.form.unitname = this.$refs.orgSelecter.getOptionByValue( |
| | | this.form.unitno |
| | |
| | | }); |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | let preTaxSum = 0; |
| | | let taxedSum = 0; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetailArr.length; i++) { |
| | | const detail = this.fundDetailArr[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetailArr[i].amount); |
| | | taxFee += parseFloat(this.fundDetailArr[i].amount); |
| | | preTaxSum += parseFloat(this.fundDetailArr[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | preTaxSum = moneyAdd(preTaxSum, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | } |
| | | //taxedamount |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxedamount))) { |
| | | taxedSum += parseFloat(this.fundDetailArr[i].taxedamount); |
| | | if (!isNaN(parseFloat(detail.taxedamount))) { |
| | | taxedSum = moneyAdd(taxedSum, detail.taxedamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetailArr[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetailArr[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetailArr[i].price) * |
| | | parseFloat(this.fundDetailArr[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | // if (!isNaN(parseFloat(taxFee))) { |
| | | // this.fundDetailArr[i].taxedamount = taxFee.toFixed(2); |
| | | // } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.pretaxcost = preTaxSum.toFixed(2); |
| | | this.form.taxedcost = taxedSum.toFixed(2); |
| | | this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2); |
| | | this.form.pretaxcost = moneyRound(preTaxSum).toFixed(2); |
| | | this.form.taxedcost = moneyRound(taxedSum).toFixed(2); |
| | | this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | import OrgSelecter from "@/views/project/components/orgselect"; |
| | | import elementIcons from "../../../components/icons/element-icons"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | //importå¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | |
| | | //计ç®ä¸ªç¨ |
| | | calculateTax() {}, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | sumTotalFee(row) { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetails.length; i++) { |
| | | const detail = this.fundDetails[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetails[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetails[i].amount); |
| | | taxFee += parseFloat(this.fundDetails[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetails[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetails[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetails[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetails[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetails[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetails[i].price) * |
| | | parseFloat(this.fundDetails[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | |
| | | //ç¨åãç¨åéè¦ç¬ç«å½å
¥ |
| | | // if (!isNaN(parseFloat(taxFee))) { |
| | | // this.fundDetails[i].taxedamount = taxFee.toFixed(2); |
| | | // } |
| | | |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | // this.form.amountrequested = allSum.toFixed(2); |
| | | // å计ä»å¨ç¡®è®¤å£å¾åå¯ç¨ï¼å
ä¿è¯è®¡ç®æ¬èº«æ¯ç²¾ç¡®ç |
| | | // this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2); |
| | | // this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { listFundflow } from "@/api/project/fundflow"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | //importå¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | |
| | | }); |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee(row) { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetails.length; i++) { |
| | | const detail = this.fundDetails[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetails[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetails[i].amount); |
| | | taxFee += parseFloat(this.fundDetails[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | taxFee = moneyAdd(taxFee, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetails[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetails[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetails[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | taxFee = moneySub(taxFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetails[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetails[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetails[i].price) * |
| | | parseFloat(this.fundDetails[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | if (!isNaN(parseFloat(taxFee))) { |
| | | this.fundDetails[i].taxedamount = taxFee.toFixed(2); |
| | | this.fundDetails[i].taxedamount = moneyRound(taxFee).toFixed(2); |
| | | } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | //this.form.amountrequested = allSum.toFixed(2); |
| | | this.$set(this.form, "amountrequested", allSum.toFixed(2)); |
| | | this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2)); |
| | | //this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | }); |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee(row) { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetails.length; i++) { |
| | | const detail = this.fundDetails[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetails[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetails[i].amount); |
| | | taxFee += parseFloat(this.fundDetails[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | taxFee = moneyAdd(taxFee, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetails[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetails[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetails[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | taxFee = moneySub(taxFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetails[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetails[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetails[i].price) * |
| | | parseFloat(this.fundDetails[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | if (!isNaN(parseFloat(taxFee))) { |
| | | this.fundDetails[i].taxedamount = taxFee.toFixed(2); |
| | | this.fundDetails[i].taxedamount = moneyRound(taxFee).toFixed(2); |
| | | } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | //this.form.amountrequested = allSum.toFixed(2); |
| | | this.$set(this.form, "amountrequested", allSum.toFixed(2)); |
| | | this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2)); |
| | | //this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | import Li_area_select from "@/components/Address"; |
| | | import OrgSelecter from "@/views/project/components/orgselect"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd, moneySub, moneyRound } from "@/utils/money"; |
| | | import CustomImageViewer from "@/components/CustomImageViewer"; |
| | | |
| | | export default { |
| | |
| | | } |
| | | }, |
| | | |
| | | //ç¨åæ£ç¨ç®ç¨å |
| | | //ç¨åæ£ç¨ç®ç¨åï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | chargeSum(row, type) { |
| | | let targetValue = 0; |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | if (!this.rbDetails[i].amount) { |
| | | this.rbDetails[i].amount = 0; |
| | |
| | | if (!this.rbDetails[i].taxamount) { |
| | | this.rbDetails[i].taxamount = 0; |
| | | } |
| | | this.rbDetails[i].taxedamount = ( |
| | | parseFloat(this.rbDetails[i].amount) - |
| | | parseFloat(this.rbDetails[i].taxamount) |
| | | //ç¨å - æ£ç¨ = ç¨åï¼æµ®ç¹ç¸å伿®çæå°å°¾å·®ï¼å¯¼è´åºç° -0.00ï¼ |
| | | this.rbDetails[i].taxedamount = moneySub( |
| | | this.rbDetails[i].amount, |
| | | this.rbDetails[i].taxamount |
| | | ).toFixed(2); |
| | | targetValue += parseFloat(this.rbDetails[i].amount); // å设æ¯ä¸ªå¯¹è±¡ä¸çç¹å®å¼åå¨å¨'specificValue'屿§ä¸ |
| | | console.log(this.rbDetails[i].taxedamount, "å计"); |
| | | } |
| | | console.log(targetValue, "å计"); |
| | | this.form.pretaxcost = targetValue; |
| | | //å计å¿
须精确累å ï¼å¦åä¼åå
¥ form.pretaxcost å¹¶è½åº |
| | | this.form.pretaxcost = moneySum(this.rbDetails, "amount"); |
| | | }, |
| | | //ç¨åæ£ç¨ç®ç¨å |
| | | //ç¨åæ£ç¨ç®ç¨åï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | queenchargeSum(row, type) { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | if (!this.rbDetails[i].amount) { |
| | |
| | | if (!this.rbDetails[i].taxamount) { |
| | | this.rbDetails[i].taxamount = 0; |
| | | } |
| | | this.rbDetails[i].amount = |
| | | parseFloat(this.rbDetails[i].taxamount) + |
| | | parseFloat(this.rbDetails[i].taxedamount); |
| | | //æ£ç¨ + ç¨å = ç¨åï¼å¿
须精确ç¸å å¹¶å½ä¸åå° 2 ä½ï¼å¦å伿®çé¿å°æ°ï¼ |
| | | this.rbDetails[i].amount = moneyRound( |
| | | moneyAdd(this.rbDetails[i].taxamount, this.rbDetails[i].taxedamount) |
| | | ); |
| | | } |
| | | }, |
| | | |
| | |
| | | |
| | | // 导å
¥æ¬å°åå¨çæ¹æ³ |
| | | import { setItem, grtItem, removeItem } from "@/utils/storage.js"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | }); |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | let preTaxSum = 0; |
| | | let taxedSum = 0; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetailArr.length; i++) { |
| | | const detail = this.fundDetailArr[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetailArr[i].amount); |
| | | taxFee += parseFloat(this.fundDetailArr[i].amount); |
| | | preTaxSum += parseFloat(this.fundDetailArr[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | preTaxSum = moneyAdd(preTaxSum, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | } |
| | | //taxedamount |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxedamount))) { |
| | | taxedSum += parseFloat(this.fundDetailArr[i].taxedamount); |
| | | if (!isNaN(parseFloat(detail.taxedamount))) { |
| | | taxedSum = moneyAdd(taxedSum, detail.taxedamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetailArr[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetailArr[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetailArr[i].price) * |
| | | parseFloat(this.fundDetailArr[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | // if (!isNaN(parseFloat(taxFee))) { |
| | | // this.fundDetailArr[i].taxedamount = taxFee.toFixed(2); |
| | | // } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.pretaxcost = preTaxSum.toFixed(2); |
| | | this.form.taxedcost = taxedSum.toFixed(2); |
| | | this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2); |
| | | this.form.pretaxcost = moneyRound(preTaxSum).toFixed(2); |
| | | this.form.taxedcost = moneyRound(taxedSum).toFixed(2); |
| | | this.$forceUpdate(); |
| | | console.log(this.form); |
| | | }, |
| | |
| | | import { listDept } from "@/api/system/dept"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { setItem, grtItem, removeItem } from "@/utils/storage.js"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | // }); |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetailArr.length; i++) { |
| | | const detail = this.fundDetailArr[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetailArr[i].amount); |
| | | taxFee += parseFloat(this.fundDetailArr[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | taxFee = moneyAdd(taxFee, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | taxFee = moneySub(taxFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetailArr[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetailArr[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetailArr[i].price) * |
| | | parseFloat(this.fundDetailArr[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | if (!isNaN(parseFloat(taxFee))) { |
| | | this.fundDetailArr[i].taxedamount = taxFee.toFixed(2); |
| | | this.fundDetailArr[i].taxedamount = moneyRound(taxFee).toFixed(2); |
| | | } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | //this.form.amountrequested = allSum.toFixed(2); |
| | | this.$set(this.form, "amountrequested", allSum.toFixed(2)); |
| | | this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2)); |
| | | //this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | import { listDept } from "@/api/system/dept"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { setItem, grtItem, removeItem } from "@/utils/storage.js"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | // }); |
| | | }, |
| | | |
| | | //è®¡ç®æ»éé¢ |
| | | //è®¡ç®æ»éé¢ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetailArr.length; i++) { |
| | | const detail = this.fundDetailArr[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetailArr[i].amount); |
| | | taxFee += parseFloat(this.fundDetailArr[i].amount); |
| | | //计ç®å½åæ¥éå
容费ç¨å计ï¼ç¨å - æ£ç¨ |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | taxFee = moneyAdd(taxFee, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | taxFee = moneySub(taxFee, detail.taxamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetailArr[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetailArr[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetailArr[i].price) * |
| | | parseFloat(this.fundDetailArr[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | if (!isNaN(parseFloat(taxFee))) { |
| | | this.fundDetailArr[i].taxedamount = taxFee.toFixed(2); |
| | | this.fundDetailArr[i].taxedamount = moneyRound(taxFee).toFixed(2); |
| | | } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | //this.form.amountrequested = allSum.toFixed(2); |
| | | this.$set(this.form, "amountrequested", allSum.toFixed(2)); |
| | | this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2)); |
| | | //this.$forceUpdate(); |
| | | }, |
| | | |
| | |
| | | import Li_area_select from "@/components/Address"; |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyRound } from "@/utils/money"; |
| | | import { |
| | | ExpertfeeListnb, |
| | | getFundtax, |
| | |
| | | this.$modal.msgError("注æå®æ¶éé¢ä¸çäºåºæ¶éé¢ï¼è¯·æ ¸å¯¹æ°æ®ï¼"); |
| | | } |
| | | }, |
| | | //ä¿®æ¹å®æ¶æåºæ¶å触å |
| | | //ä¿®æ¹å®æ¶æåºæ¶å触åï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | chargeSum() { |
| | | let ChargeSum = 0; |
| | | let ChargeamountSum = 0; |
| | | |
| | | //è´¹ç¨å计 |
| | | try { |
| | | for (let i = 0; i < this.donorchargeorgans.length; i++) { |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) { |
| | | ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge); |
| | | } |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) { |
| | | ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount); |
| | | } |
| | | } |
| | | this.form.receivableamount = ChargeSum.toFixed(2); |
| | | this.form.receivedamount = ChargeamountSum.toFixed(2); |
| | | this.form.receivableamount = moneyRound( |
| | | moneySum(this.donorchargeorgans, "organcharge") |
| | | ).toFixed(2); |
| | | this.form.receivedamount = moneyRound( |
| | | moneySum(this.donorchargeorgans, "amount") |
| | | ).toFixed(2); |
| | | } catch {} |
| | | }, |
| | | |
| | |
| | | } from "@/api/project/organization"; |
| | | import { listDonatebaseinfo } from "@/api/project/donatebaseinfo"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum } from "@/utils/money"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | //å ç¹åæ¶çæç¤º |
| | | }); |
| | | }, |
| | | //计ç®è´¹ç¨å计 |
| | | //计ç®è´¹ç¨å计ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | try { |
| | | for (let i = 0; i < this.applicationDetailArr.length; i++) { |
| | | let totalFee = 0; |
| | | const row = this.applicationDetailArr[i]; |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].trafficexpense))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].trafficexpense); |
| | | const totalFee = moneySum([ |
| | | row.trafficexpense, |
| | | row.cityfee, |
| | | row.hotelexpense, |
| | | row.otherexpense, |
| | | row.foodexpenses, |
| | | row.foodallowance, |
| | | row.otherfeeamount |
| | | ]); |
| | | row.total = totalFee.toFixed(2); |
| | | this.$set(this.applicationDetailArr, i, row); |
| | | } |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].cityfee))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].hotelexpense))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].otherexpense))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].foodexpenses))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].foodallowance))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].otherfeeamount))) { |
| | | totalFee += parseFloat(this.applicationDetailArr[i].otherfeeamount); |
| | | } |
| | | this.applicationDetailArr[i].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.applicationDetailArr, i, this.applicationDetailArr[i]); |
| | | if (!isNaN(parseFloat(this.applicationDetailArr[i].total))) { |
| | | allSum += parseFloat(this.applicationDetailArr[i].total); |
| | | } |
| | | } |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.amountrequested = moneySum(this.applicationDetailArr, "total").toFixed(2); |
| | | this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested); |
| | | } catch { } |
| | | }, |
| | |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm" v-if="dialogType == 'edit'">ä¿ å</el-button> |
| | | <el-button type="primary" :loading="saveLoading" @click="submitForm" v-if="dialogType == 'edit'">ä¿ å</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | |
| | | import { addorupdateFund } from "@/api/project/fund"; |
| | | import { listReportname, listUser } from "@/api/project/organization"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd } from "@/utils/money"; |
| | | export default { |
| | | components: { |
| | | Treeselect, |
| | |
| | | loading: true, |
| | | // 导åºé®ç½©å± |
| | | exportLoading: false, |
| | | // ä¿åæé® loadingï¼é²æ¢éå¤æäº¤ |
| | | saveLoading: false, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | // éå个ç¦ç¨ |
| | |
| | | |
| | | //è·åæ¥éä¸»ä¿¡æ¯ |
| | | const id = row.id || this.ids; |
| | | getReimbursement(id).then(response => { |
| | | getReimbursement(id) |
| | | .then(async response => { |
| | | this.form = response.data; |
| | | this.fileList = this.form.annexfiles |
| | | ? this.form.annexfiles |
| | |
| | | : []; |
| | | this.form.recordstatus = response.data.recordstatus + ""; |
| | | |
| | | let ids = response.data.id; |
| | | //è·åæ¥éæç»ä¿¡æ¯ |
| | | getReimbursementdetaillist(ids).then(res => { |
| | | this.rbDetails = res.data; |
| | | const ids = response.data.id; |
| | | this.queryParamsPayee.rbid = ids; |
| | | |
| | | //æç»ä¸ææ¬¾ä¿¡æ¯äºä¸ä¾èµï¼å¹¶åè·åï¼åå°çå¾
æ¶é´ |
| | | const [detailRes, payeeRes] = await Promise.all([ |
| | | getReimbursementdetaillist(ids), |
| | | listReimbursementpayee(this.queryParamsPayee) |
| | | ]); |
| | | |
| | | this.rbDetails = detailRes.data; |
| | | if (this.rbDetails.length == 0) { |
| | | this.addDetailRow(0); |
| | | } |
| | |
| | | |
| | | //宿¶å计éé¢ |
| | | //this.sumTotalFee(); |
| | | }); |
| | | |
| | | //è·åæ¥éææ¬¾ä¿¡æ¯ |
| | | this.queryParamsPayee.rbid = ids; |
| | | listReimbursementpayee(this.queryParamsPayee).then(res => { |
| | | this.rbPayees = res.rows; |
| | | this.rbPayees = payeeRes.rows; |
| | | if (this.rbPayees.length == 0) { |
| | | this.addPayeeRow(0); |
| | | } |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | this.$modal.msgError("æ¥éåä¿¡æ¯å 载失败ï¼è¯·éè¯ï¼"); |
| | | }); |
| | | }, |
| | | |
| | |
| | | this.open = true; |
| | | const id = row.id || this.ids; |
| | | |
| | | getReimbursement(id).then(response => { |
| | | getReimbursement(id) |
| | | .then(async response => { |
| | | this.form = response.data; |
| | | //éä»¶ |
| | | this.fileList = this.form.annexfiles |
| | |
| | | //å®¡æ ¸ç¶æ |
| | | this.form.recordstatus = response.data.recordstatus + ""; |
| | | |
| | | let ids = response.data.id; |
| | | let listFundflowparams = { |
| | | const ids = response.data.id; |
| | | const listFundflowparams = { |
| | | fundid: row.id, |
| | | fundtype: 1 |
| | | }; |
| | | listFundflow(listFundflowparams).then(res => { |
| | | this.fundflowList = res.rows; |
| | | }); |
| | | this.queryParamsPayee.rbid = ids; |
| | | |
| | | //æ¥éæç» |
| | | getReimbursementdetaillist(ids).then(res => { |
| | | this.rbDetails = res.data; |
| | | /* |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | this.rbDetails[i].index = i; |
| | | this.rbDetails[i].searchAddress = { |
| | | sheng: this.rbDetails[i].travelprovincename, |
| | | shi: this.rbDetails[i].travelcityname, |
| | | qu: this.rbDetails[i].traveltownname, |
| | | }; |
| | | } |
| | | */ |
| | | }); |
| | | //èµéæµæ°´ãæ¥éæç»ãææ¬¾ä¿¡æ¯äºä¸ä¾èµï¼å¹¶åè·å |
| | | const [fundflowRes, detailRes, payeeRes] = await Promise.all([ |
| | | listFundflow(listFundflowparams), |
| | | getReimbursementdetaillist(ids), |
| | | listReimbursementpayee(this.queryParamsPayee) |
| | | ]); |
| | | |
| | | this.fundflowList = fundflowRes.rows; |
| | | this.rbDetails = detailRes.data; |
| | | |
| | | //æç»å è½½å®æåå计ç®å计ï¼ä¿®å¤å代ç 卿ç»è¿ååå°± sumTotalFee çç«æé®é¢ |
| | | if (this.rbDetails.length > 0) this.sumTotalFee(); |
| | | |
| | | //仿¬¾ä¿¡æ¯ |
| | | this.queryParamsPayee.rbid = ids; |
| | | listReimbursementpayee(this.queryParamsPayee).then(res => { |
| | | this.rbPayees = res.rows; |
| | | this.rbPayees = payeeRes.rows; |
| | | if (this.rbPayees.length == 0) { |
| | | this.addPayeeRow(0); |
| | | } |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | this.$modal.msgError("æ¥éåä¿¡æ¯å 载失败ï¼è¯·éè¯ï¼"); |
| | | }); |
| | | }, |
| | | |
| | | /** æäº¤æé® */ |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | //鲿¢éå¤æäº¤ï¼ä¿åä¸ç´æ¥å¿½ç¥å次ç¹å» |
| | | if (this.saveLoading) return; |
| | | this.$refs["form"].validate(async valid => { |
| | | if (!valid) return; |
| | | /** |
| | | let indexErrTime = this.rbDetails.findIndex((item) => { |
| | | if (item.endtime && item.starttime) { |
| | |
| | | } |
| | | */ |
| | | |
| | | try { |
| | | this.saveLoading = true; |
| | | //éä»¶æä»¶å¤ç |
| | | let list = this.fileList; |
| | | if (list.length > 0) { |
| | |
| | | const rbDetails = [...this.rbDetails]; |
| | | const rbPayees = [...this.rbPayees]; |
| | | if (this.form.id != null) { |
| | | updateReimbursement(this.form) |
| | | .then(res => { |
| | | //ä¿åæç» |
| | | for (let i = 0; i < rbDetails.length; i++) { |
| | | if (rbDetails[i].rbid != null) { |
| | | updateReimbursementdetail(rbDetails[i]); |
| | | } else { |
| | | //rbidå
³è主表Id |
| | | rbDetails[i].rbid = this.form.id; |
| | | addReimbursementdetail(rbDetails[i]); |
| | | } |
| | | } |
| | | //第1æ¥ï¼æ´æ°ä¸»è¡¨ï¼æåååå¤çå表 |
| | | await updateReimbursement(this.form); |
| | | |
| | | //ä¿åè´¦æ· |
| | | for (let i = 0; i < rbPayees.length; i++) { |
| | | if (rbPayees[i].rbid != null) { |
| | | updateReimbursementpayee(rbPayees[i]); |
| | | } else { |
| | | //第2æ¥ï¼å¹¶åä¿åæç»ï¼çå¾
å
¨é¨å®æï¼ä»»ä¸å¤±è´¥åèµ° catch æç¤º |
| | | await Promise.all( |
| | | rbDetails.map(detail => { |
| | | if (detail.rbid != null) { |
| | | return updateReimbursementdetail(detail); |
| | | } |
| | | //rbidå
³è主表Id |
| | | rbPayees[i].rbid = this.form.id; |
| | | addReimbursementpayee(rbPayees[i]); |
| | | detail.rbid = this.form.id; |
| | | return addReimbursementdetail(detail); |
| | | }) |
| | | ); |
| | | |
| | | //第3æ¥ï¼å¹¶åä¿åè´¦æ· |
| | | await Promise.all( |
| | | rbPayees.map(payee => { |
| | | if (payee.rbid != null) { |
| | | return updateReimbursementpayee(payee); |
| | | } |
| | | } |
| | | //rbidå
³è主表Id |
| | | payee.rbid = this.form.id; |
| | | return addReimbursementpayee(payee); |
| | | }) |
| | | ); |
| | | |
| | | this.$modal.msgSuccess("ä¿®æ¹æ¥éåä¿åæå!"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }) |
| | | .catch(err => { |
| | | this.$modal.msgError("ä¿®æ¹æ¥éåä¿å失败ï¼"); |
| | | }); |
| | | } else { |
| | | this.form.recordstatus = -1; |
| | | addReimbursement(this.form) |
| | | .then(response => { |
| | | //ä¿åæç» |
| | | for (let i = 0; i < rbDetails.length; i++) { |
| | | //rbidå
³è主表Id |
| | | rbDetails[i].rbid = response.data; |
| | | addReimbursementdetail(rbDetails[i]); |
| | | } |
| | | //第1æ¥ï¼æ°å¢ä¸»è¡¨ï¼è¿å主表Id |
| | | const response = await addReimbursement(this.form); |
| | | |
| | | //ä¿åè´¦å· |
| | | for (let i = 0; i < rbPayees.length; i++) { |
| | | //第2æ¥ï¼å¹¶åä¿åæç» |
| | | await Promise.all( |
| | | rbDetails.map(detail => { |
| | | //rbidå
³è主表Id |
| | | rbPayees[i].rbid = response.data; |
| | | addReimbursementpayee(rbPayees[i]); |
| | | } |
| | | detail.rbid = response.data; |
| | | return addReimbursementdetail(detail); |
| | | }) |
| | | ); |
| | | |
| | | //第3æ¥ï¼å¹¶åä¿åè´¦å· |
| | | await Promise.all( |
| | | rbPayees.map(payee => { |
| | | //rbidå
³è主表Id |
| | | payee.rbid = response.data; |
| | | return addReimbursementpayee(payee); |
| | | }) |
| | | ); |
| | | |
| | | this.$modal.msgSuccess("æ°å¢æ¥éåä¿åæå!"); |
| | | } |
| | | |
| | | //ææä¿åæ¥éª¤å
¨é¨æååæå
³éå¼¹çªå¹¶å·æ°å表 |
| | | this.open = false; |
| | | this.getList(); |
| | | }) |
| | | .catch(err => { |
| | | this.$modal.msgError("æ°å¢æ¥éåä¿å失败ï¼"); |
| | | }); |
| | | } catch (err) { |
| | | this.$modal.msgError("æ¥éåä¿å失败ï¼è¯·éè¯ï¼"); |
| | | } finally { |
| | | this.saveLoading = false; |
| | | } |
| | | } |
| | | }); |
| | | ); |
| | | }, |
| | | |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const ids = row.id || this.ids; |
| | | console.log(ids); |
| | | this.$modal |
| | | .confirm("æ¯å¦ç¡®è®¤å é¤è¯¥æ¡è®°å½ï¼") |
| | | .then(function () { |
| | |
| | | return delReimbursement(ids); |
| | | }) |
| | | .then(() => { |
| | | delReimbursementdetail(ids); |
| | | //çå¾
æç»å é¤å®æååå·æ°å表ï¼é¿å
åè¡¨å·æ°æ¶æç»å°æªå é¤ |
| | | return delReimbursementdetail(ids); |
| | | }) |
| | | .then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }) |
| | | .catch(() => { }); |
| | | .catch(() => { |
| | | //失败æ¶ä¹è¦å¤ä½ loadingï¼å¦åæé®æ°¸ä¹
转å |
| | | this.exportLoading = false; |
| | | }); |
| | | }, |
| | | |
| | | //æ°å¢ä¸è¡ |
| | |
| | | }, |
| | | |
| | | //计ç®ä¸è¡å计 |
| | | //计ç®å½åè¡æ¥éå
容费ç¨å计 |
| | | //计ç®å½åè¡æ¥éå
容费ç¨å计ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | sumRowFee(row) { |
| | | let totalFee = 0; |
| | | if (!isNaN(parseFloat(row.trafficexpense))) { |
| | | totalFee += parseFloat(row.trafficexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.cityfee))) { |
| | | totalFee += parseFloat(row.cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(row.hotelexpense))) { |
| | | totalFee += parseFloat(row.hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.otherexpense))) { |
| | | totalFee += parseFloat(row.otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.foodexpenses))) { |
| | | totalFee += parseFloat(row.foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(row.foodallowance))) { |
| | | totalFee += parseFloat(row.foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(row.otherfeeamount))) { |
| | | totalFee += parseFloat(row.otherfeeamount); |
| | | } |
| | | row.total = totalFee; |
| | | row.total = moneySum([ |
| | | row.trafficexpense, |
| | | row.cityfee, |
| | | row.hotelexpense, |
| | | row.otherexpense, |
| | | row.foodexpenses, |
| | | row.foodallowance, |
| | | row.otherfeeamount |
| | | ]); |
| | | |
| | | /* |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].trafficexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].trafficexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].otherfeeamount); |
| | | } |
| | | this.rbDetails[rowIndex].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, rowIndex, this.rbDetails[rowIndex]); |
| | | */ |
| | | //éæ°è®¡ç®æ´ä¸ªæ¥éåçå计 |
| | | this.sumTotalFee(); |
| | | }, |
| | | |
| | | //计ç®è´¹ç¨å计 |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | |
| | | //æç®è
å®¶å±è´¹ç¨ |
| | | if (!isNaN(parseFloat(this.form.donoramount))) { |
| | | allSum += parseFloat(this.form.donoramount); |
| | | } |
| | | |
| | | //æ¥éæç»è´¹ç¨ |
| | | try { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | /* |
| | | let totalFee = 0; |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | totalFee += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[i].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherfeeamount); |
| | | } |
| | | this.rbDetails[i].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, i, this.rbDetails[i]); |
| | | */ |
| | | |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | allSum += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | } |
| | | |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.amountrequested = moneyAdd( |
| | | moneySum(this.rbDetails, "total"), |
| | | this.form.donoramount |
| | | ).toFixed(2); |
| | | this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested); |
| | | } catch { } |
| | | }, |
| | |
| | | import { listReportname, listUser } from "@/api/project/organization"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import debounce from "lodash/debounce"; |
| | | import { moneySum, moneyAdd, moneyRound } from "@/utils/money"; |
| | | export default { |
| | | components: { |
| | | Treeselect, |
| | |
| | | }, |
| | | |
| | | //计ç®ä¸è¡å计 |
| | | //计ç®å½åè¡æ¥éå
容费ç¨å计 |
| | | //计ç®å½åè¡æ¥éå
容费ç¨å计ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | sumRowFee(row) { |
| | | let totalFee = 0; |
| | | if (!isNaN(parseFloat(row.trafficexpense))) { |
| | | totalFee += parseFloat(row.trafficexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.cityfee))) { |
| | | totalFee += parseFloat(row.cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(row.hotelexpense))) { |
| | | totalFee += parseFloat(row.hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.otherexpense))) { |
| | | totalFee += parseFloat(row.otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(row.foodexpenses))) { |
| | | totalFee += parseFloat(row.foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(row.foodallowance))) { |
| | | totalFee += parseFloat(row.foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(row.otherfeeamount))) { |
| | | totalFee += parseFloat(row.otherfeeamount); |
| | | } |
| | | row.total = totalFee.toFixed(2); |
| | | const totalFee = moneySum([ |
| | | row.trafficexpense, |
| | | row.cityfee, |
| | | row.hotelexpense, |
| | | row.otherexpense, |
| | | row.foodexpenses, |
| | | row.foodallowance, |
| | | row.otherfeeamount |
| | | ]); |
| | | row.total = moneyRound(totalFee).toFixed(2); |
| | | |
| | | /* |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].trafficexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].trafficexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[rowIndex].otherfeeamount); |
| | | } |
| | | this.rbDetails[rowIndex].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, rowIndex, this.rbDetails[rowIndex]); |
| | | */ |
| | | //éæ°è®¡ç®æ´ä¸ªæ¥éåçå计 |
| | | this.sumTotalFee(); |
| | | }, |
| | | |
| | | //计ç®è´¹ç¨å计 |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | |
| | | //æç®è
å®¶å±è´¹ç¨ |
| | | if (!isNaN(parseFloat(this.form.donoramount))) { |
| | | allSum += parseFloat(this.form.donoramount); |
| | | } |
| | | |
| | | //æ¥éæç»è´¹ç¨ |
| | | try { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | /* |
| | | let totalFee = 0; |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | totalFee += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[i].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherfeeamount); |
| | | } |
| | | this.rbDetails[i].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, i, this.rbDetails[i]); |
| | | */ |
| | | |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | allSum += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | } |
| | | |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.amountrequested = moneyAdd( |
| | | moneySum(this.rbDetails, "total"), |
| | | this.form.donoramount |
| | | ).toFixed(2); |
| | | this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested); |
| | | } catch { } |
| | | }, |
| | |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { setItem, grtItem, removeItem } from "@/utils/storage.js"; |
| | | import { moneySum } from "@/utils/money"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | }); |
| | | }, |
| | | |
| | | //计ç®è´¹ç¨å计 |
| | | //计ç®è´¹ç¨å计ï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ç¦æ¢ parseFloat ç´¯å ï¼ |
| | | sumTotalFee(scope) { |
| | | let allSum = 0; |
| | | try { |
| | | for (let i = 0; i < this.rbDetails.length; i++) { |
| | | let totalFee = 0; |
| | | const row = this.rbDetails[i]; |
| | | //计ç®å½åæ¥éå
容费ç¨å计 |
| | | if (!isNaN(parseFloat(this.rbDetails[i].trafficexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].trafficexpense); |
| | | const totalFee = moneySum([ |
| | | row.trafficexpense, |
| | | row.cityfee, |
| | | row.hotelexpense, |
| | | row.otherexpense, |
| | | row.foodexpenses, |
| | | row.foodallowance, |
| | | row.otherfeeamount |
| | | ]); |
| | | row.total = totalFee.toFixed(2); |
| | | this.$set(this.rbDetails, scope.$index, row); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) { |
| | | totalFee += parseFloat(this.rbDetails[i].cityfee); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].hotelexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].hotelexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherexpense))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherexpense); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodexpenses))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodexpenses); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].foodallowance))) { |
| | | totalFee += parseFloat(this.rbDetails[i].foodallowance); |
| | | } |
| | | if (!isNaN(parseFloat(this.rbDetails[i].otherfeeamount))) { |
| | | totalFee += parseFloat(this.rbDetails[i].otherfeeamount); |
| | | } |
| | | this.rbDetails[i].total = parseFloat(totalFee).toFixed(2); |
| | | this.$set(this.rbDetails, scope.$index, this.rbDetails[i]); |
| | | if (!isNaN(parseFloat(this.rbDetails[i].total))) { |
| | | allSum += parseFloat(this.rbDetails[i].total); |
| | | } |
| | | } |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.amountrequested = moneySum(this.rbDetails, "total").toFixed(2); |
| | | this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested); |
| | | } catch { } |
| | | }, |
| | |
| | | import Li_area_select from "@/components/Address"; |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyRound } from "@/utils/money"; |
| | | import debounce from "lodash/debounce"; |
| | | export default { |
| | | components: { |
| | |
| | | this.$modal.msgError("注æå®æ¶éé¢ä¸çäºåºæ¶éé¢ï¼è¯·æ ¸å¯¹æ°æ®ï¼"); |
| | | } |
| | | }, |
| | | //ä¿®æ¹å®æ¶æåºæ¶å触å |
| | | //ä¿®æ¹å®æ¶æåºæ¶å触åï¼éé¢ä¸å¾èµ°ç²¾ç¡®è¿ç®ï¼ |
| | | chargeSum() { |
| | | let ChargeSum = 0; |
| | | let ChargeamountSum = 0; |
| | | |
| | | //è´¹ç¨å计 |
| | | try { |
| | | for (let i = 0; i < this.donorchargeorgans.length; i++) { |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) { |
| | | ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge); |
| | | } |
| | | if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) { |
| | | ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount); |
| | | } |
| | | } |
| | | this.form.receivableamount = ChargeSum.toFixed(2); |
| | | this.form.receivedamount = ChargeamountSum.toFixed(2); |
| | | this.form.receivableamount = moneyRound( |
| | | moneySum(this.donorchargeorgans, "organcharge") |
| | | ).toFixed(2); |
| | | this.form.receivedamount = moneyRound( |
| | | moneySum(this.donorchargeorgans, "amount") |
| | | ).toFixed(2); |
| | | } catch {} |
| | | }, |
| | | |
| | |
| | | proxy: { |
| | | // detail: https://cli.vuejs.org/config/#devserver-proxy |
| | | [process.env.VUE_APP_BASE_API]: { |
| | | // target:`http://localhost:8080`, |
| | | target:`http://192.168.100.10:8081`, |
| | | target:`http://localhost:8080`, |
| | | // target:`http://192.168.100.10:8081`, |
| | | // target:`http://192.168.100.137:8080`, |
| | | // target: `https://slb.hospitalstar.com:9093`, |
| | | changeOrigin: true, |