Bladeren bron

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

修改四舍五入时因数据类型显示NaN问题
刘俊俊 2 jaren geleden
bovenliggende
commit
ab03cabe0f
2 gewijzigde bestanden met toevoegingen van 13 en 6 verwijderingen
  1. 8 1
      src/libs/tools.js
  2. 5 5
      src/views/salesManagement/sendOutOrder/chooseImportModal.vue

+ 8 - 1
src/libs/tools.js

@@ -233,7 +233,14 @@ export const numberToFixed = function (val, num) {
   return _value
 }
 export const toFixedDecimal = function (num, decimal) {
-  return parseFloat(num).toFixed(decimal)
+  let newNum= null;
+  let patrn=/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
+  if(!patrn.exec(num)){
+  newNum=parseFloat(num).toFixed(decimal)
+  }else{
+   newNum =num
+ }
+  return newNum
 }
 // 保留decimal位小数(不四舍五入)  num 数值,decimal要保留的小数位数
 export const formatDecimal = function (num, decimal) {

+ 5 - 5
src/views/salesManagement/sendOutOrder/chooseImportModal.vue

@@ -130,7 +130,7 @@ export default {
         { title: '立方/元', dataIndex: 'cubeAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '重量(kg)', dataIndex: 'goodsWeightStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '每吨/元', dataIndex: 'tonAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '运费(元)', dataIndex: 'transportAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '运费(元)', dataIndex: 'transportAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '送货费(元)', dataIndex: 'sendAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '其他(元)', dataIndex: 'otherAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '保价(万)', dataIndex: 'supportValueStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } }
@@ -141,20 +141,20 @@ export default {
         { title: '客户名称', dataIndex: 'customeName', width: '8%', align: 'left', customRender: renderContent },
         { title: '物流单号', dataIndex: 'transportNo', width: '8%', align: 'center', customRender: renderContent },
         { title: '物流电话', dataIndex: 'transportTele', width: '8%', align: 'center', customRender: renderContent },
-        { title: '托运日期', dataIndex: 'sendDate', width: '8%', align: 'center', customRender: renderContent },
+        { title: '托运日期', dataIndex: 'sendDateStr', width: '8%', align: 'center', customRender: renderContent },
         { title: '收货人', dataIndex: 'customerCacateName', width: '6%', align: 'left', customRender: renderContent },
         { title: '收货电话', dataIndex: 'customerCacatePhone', width: '8%', align: 'center', customRender: renderContent },
         { title: '收货地址', dataIndex: 'customerAddressDetail', width: '8%', align: 'center', customRender: renderContent },
         { title: '目的地', dataIndex: 'customerAddress', width: '6%', align: 'center', customRender: renderContent },
-        { title: '付款方式', dataIndex: 'payTypeDictValue', width: '6%', align: 'center', customRender: renderContent },
-        { title: '交货方式', dataIndex: 'handoverTypeDictValue', width: '6%', align: 'center', customRender: renderContent },
+        { title: '付款方式', dataIndex: 'payTypeStr', width: '6%', align: 'center', customRender: renderContent },
+        { title: '交货方式', dataIndex: 'handoverTypeStr', width: '6%', align: 'center', customRender: renderContent },
         { title: '货物名称', dataIndex: 'goodsName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '件数', dataIndex: 'goodsQtyStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '体积(m3)', dataIndex: 'goodsVolumeStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '立方/元', dataIndex: 'cubeAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '重量(kg)', dataIndex: 'goodsWeightStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '每吨/元', dataIndex: 'tonAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '运费(元)', dataIndex: 'transportAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '运费(元)', dataIndex: 'transportAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '送货费(元)', dataIndex: 'sendAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '其他(元)', dataIndex: 'otherAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },
         { title: '保价(万)', dataIndex: 'supportValueStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text,2) : '--') } },