Commit 4ba71484 by Sweet Zhang

改bug和弹窗

parent 8b993217
......@@ -9,10 +9,6 @@ import api from '@api/api.ts'
Vue.config.productionTip = false;
Vue.prototype.axios = axios;
Vue.prototype.$api = api;
import { numberToCurrencyNo } from './util/numberPipe';
// 配置全局过滤器,实现数字千分位格式
Vue.filter('numberToCurrency', numberToCurrencyNo)
App.mpType = 'app'
const app = new Vue({
api,
......
......@@ -92,7 +92,7 @@
name:'dataImport',
onLoad() {
this.bindPickerChange({detail:{value:this.index}});
this.calcuteData = uni.getStorageSync('calcuteData');
this.calcuteData = uni.getStorageSync('calcuteData') ? JSON.parse(uni.getStorageSync('calcuteData')) : null;
},
methods:{
// 选择间隔
......@@ -193,8 +193,24 @@
this.pasteData = '';
this.irrAndSimpleInfos.forEach(item=>item.cashValue='');
},
// 开始计算
calcuteIrr(){
this.policyYearLists = this.irrAndSimpleInfos.filter(item=>item.cashValue!=='')
if(this.policyYearLists.length<=0){
uni.showModal({
title: '必填提醒',
content:`系统检测到您并未录入有效的现金价值数据!`,
showCancel:false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
return;
}
console.log(this.policyYearLists)
for(let i=0;i<this.policyYearLists.length;i++){
if(this.policyYearLists[i].cashValue<0 || isNaN(this.policyYearLists[i].cashValue)){
......
......@@ -14,7 +14,7 @@
<title>sfp</title>
<!--preload-links-->
<!--app-context-->
<script type="module" crossorigin src="/sfp/assets/index.ac2778ca.js"></script>
<script type="module" crossorigin src="/sfp/assets/index.154fcd7e.js"></script>
<link rel="stylesheet" href="/sfp/assets/index.13d2da89.css">
</head>
<body>
......
export function numberToCurrencyNo(value) {
debugger;
if (!value) return 0;
// 获取整数部分
const intPart = Math.trunc(value)
// 整数部分处理,增加,
const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
// 预定义小数部分
let floatPart = ''
// 将数值截取为小数部分和整数部分
const valueArray = value.toString().split('.')
if (valueArray.length === 2) { // 有小数部分
floatPart = valueArray[1].toString() // 取得小数部分
return intPartFormat + '.' + floatPart
}
return intPartFormat + floatPart
}
\ No newline at end of file
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