Prechádzať zdrojové kódy

Merge branch 'develop_yh12' of jianguan-web/jg-ocs-html into pre-release

李磊 2 rokov pred
rodič
commit
02756e2807

+ 20 - 23
src/libs/tools.js

@@ -5,20 +5,18 @@ export const getOperationalPrecision = (num1, num2) => {
 }
 
 // 金额转大写
-export const dealBigMoney = (n) =>{       
-   if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n))
-   return "数据非法";
-   let unit = "千百拾亿千百拾万千百拾元角分", str = "";
-   n += "00";
-   let p = n.indexOf('.');
-   if (p >= 0){
-      n = n.substring(0, p) + n.substr(p+1, 2);
-      unit = unit.substr(unit.length - n.length);
+export const dealBigMoney = (n) => {
+  if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) { return '数据非法' }
+  let unit = '千百拾亿千百拾万千百拾元角分'; let str = ''
+  n += '00'
+  const p = n.indexOf('.')
+  if (p >= 0) {
+    n = n.substring(0, p) + n.substr(p + 1, 2)
+    unit = unit.substr(unit.length - n.length)
   }
-   
-   for (var i=0; i < n.length; i++)
-   str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i);
-   return  str.replace(/零(千|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
+
+  for (var i = 0; i < n.length; i++) { str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i) }
+  return str.replace(/零(千|百|拾|角)/g, '零').replace(/(零)+/g, '零').replace(/零(万|亿|元)/g, '$1').replace(/(亿)万|壹(拾)/g, '$1$2').replace(/^元零?|零分/g, '').replace(/元$/g, '元整')
 }
 
 export const forEach = (arr, fn) => {
@@ -233,13 +231,13 @@ export const numberToFixed = function (val, num) {
   return _value
 }
 export const toFixedDecimal = function (num, decimal) {
-  let newNum= null;
-  let patrn=/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
-  if(!patrn.exec(num)){
-  newNum=parseFloat(num).toFixed(decimal)
-  }else{
-   newNum =num
- }
+  let newNum = null
+  const patrn = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi
+  if (!patrn.exec(num)) {
+    newNum = parseFloat(num).toFixed(decimal)
+  } else {
+    newNum = num
+  }
   return newNum
 }
 // 保留decimal位小数(不四舍五入)  num 数值,decimal要保留的小数位数
@@ -258,8 +256,8 @@ export const toThousands = (num, decimal) => {
   if (num == undefined) {
     return '--'
   }
-  num = formatDecimal(num, decimal || decimal==0 ? decimal : 2)
-  return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
+  num = formatDecimal(num, decimal || decimal == 0 ? decimal : 2)
+  return '¥' + num.toString().replace(/\d+/, function (n) { // 先提取整数部分
     return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
       return $1 + ','
     })
@@ -483,4 +481,3 @@ export const checkIdNumberValid = (tex) => {
   }
   return true
 }
-

+ 2 - 2
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -151,7 +151,6 @@ import chooseDepartUserModal from './chooseDepartUserModal.vue'
 import reviewProgressModal from './reviewProgressModal.vue'
 import reportModal from '@/views/common/reportModal.vue'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { toThousands } from '@/libs/tools.js'
 import supplier from '@/views/common/supplier.js'
 import { sparePartsReturnList, sparePartsReturnDelete, sparePartsReturnExportDetail, againSubmit } from '@/api/sparePartsReturn'
 export default {
@@ -202,6 +201,7 @@ export default {
   },
   computed: {
     columns () {
+      let _this=this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -214,7 +214,7 @@ export default {
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '9%', align: 'center' }
       ]
       if (this.$hasPermissions('B_isShowCost')) { //  售价权限
-        arr.splice(6, 0, { title: '退货金额', dataIndex: 'totalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } })
+        arr.splice(6, 0, { title: '退货金额', dataIndex: 'totalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
       }
       return arr
     }

+ 4 - 4
src/views/purchasingManagement/purchaseReturn/purchaseReturnDeatil.vue

@@ -146,7 +146,6 @@ import {
   sparePartsReturnInfo,
   sparePartsReturnDetailSaveBatch
 } from '@/api/sparePartsReturn'
-import { toThousands } from '@/libs/tools.js'
 export default {
   name: 'PurchaseReturnEdit',
   mixins: [commonMixin],
@@ -196,6 +195,7 @@ export default {
   },
   computed: {
     columns () {
+      const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
         {
@@ -254,7 +254,7 @@ export default {
           width: '8%',
           align: 'right',
           customRender: function (text) {
-            return text || text == 0 ? toThousands(text, 2) : '--'
+            return text || text == 0 ? _this.toThousands(text, 2) : '--'
           }
         })
         arr.splice(8, 0, {
@@ -263,7 +263,7 @@ export default {
           width: '8%',
           align: 'right',
           customRender: function (text) {
-            return text || text == 0 ? toThousands(text, 2) : '--'
+            return text || text == 0 ? _this.toThousands(text, 2) : '--'
           }
         })
       }
@@ -470,7 +470,7 @@ export default {
       queryPageCount({ sparePartsReturnSn: this.sparePartsReturnSn }).then(res => {
         if (res.status == 200) {
           if (res.data) {
-            res.data.totalCost = res.data && (res.data.totalCost || res.data.totalCost == 0) ? toThousands(res.data.totalCost, 2) : '--'
+            res.data.totalCost = res.data && (res.data.totalCost || res.data.totalCost == 0) ? this.toThousands(res.data.totalCost, 2) : '--'
             this.statisticsObj = res.data
           } else {
             this.statisticsObj = null

+ 3 - 1
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -118,7 +118,8 @@ export default {
         beginDate: '',
         endDate: '',
         sparePartsNo: '',
-        isZero: 0
+        isZero: 0,
+        createDate: undefined
       },
       warehousingDate: [], // 入库时间
       rowSelectionInfo: null,
@@ -127,6 +128,7 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.queryParam.supplierSn = this.buyerSn
+        this.queryParam.createDate = '2023-01-01 00:00:00'
         return queryDetailStockPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {

+ 3 - 3
src/views/reportData/urchaseReturn/list.vue

@@ -100,7 +100,6 @@ import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import supplier from '@/views/common/supplier.js'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { toThousands } from '@/libs/tools.js'
 import reportModal from '@/views/common/reportModal.vue'
 import { sparePartsReturnReportList, sparePartsReturnReportStat, sparePartsReturnReportExport } from '@/api/reportData'
 export default {
@@ -150,6 +149,7 @@ export default {
   },
   computed: {
     columns () {
+      const _this = this
       const arr = [
         { title: '采购退货单号', dataIndex: 'sparePartsReturnNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货完成日期', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
@@ -162,7 +162,7 @@ export default {
         { title: '操作员', dataIndex: 'submitorName', width: 130, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
       ]
       if (this.$hasPermissions('B_isShowCost')) { //  售价权限
-        arr.splice(8, 0, { title: '退货金额', dataIndex: 'totalCost', width: 60, align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } })
+        arr.splice(8, 0, { title: '退货金额', dataIndex: 'totalCost', width: 60, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
       }
       return arr
     }
@@ -191,7 +191,7 @@ export default {
     getCount (params) {
       sparePartsReturnReportStat(params).then(res => {
         if (res.status == 200 && res.data) {
-          res.data.totalCost = res.data && (res.data.totalCost || res.data.totalCost == 0) ? toThousands(res.data.totalCost, 2) : '--'
+          res.data.totalCost = res.data && (res.data.totalCost || res.data.totalCost == 0) ? this.toThousands(res.data.totalCost, 2) : '--'
           this.totalData = res.data
         } else {
           this.totalData = null