Commit af254178 authored by xishifeng's avatar xishifeng

业绩暂存2

parent cf1e53a7
......@@ -49,13 +49,27 @@ export default {
return str;
}
},
transCn(num) {
    let e = String(num).split(''),
a = [];
e.forEach((v,i)=>{
a[i] = ['零','一','二','三','四','五','六','七','八','九'][e[i]];
});
    return a.join('');
achieveInitTime(callback) {
//获取缓存里的时间
let _this = this;
let _session_startdate = sessionStorage.getItem('achieve_search_start_date'),
_session_enddate = sessionStorage.getItem('achieve_search_end_date');
if(_session_startdate && _session_enddate) {
//当缓存里有时间时,用缓存里的时间
callback(_session_startdate, _session_enddate);
} else {
//获取当前时间
let _currentDate = new Date();
_currentDate.setDate(_currentDate.getDate() - 1);
let _year = _currentDate.getFullYear(),
_moon = _this.dealDateNum(_currentDate.getMonth() + 1),
_end_day_temp = _currentDate.getDate(),
_end_day = _this.dealDateNum(_end_day_temp),
_start_day = _end_day_temp < 7 ? '01' : _this.dealDateNum(_end_day_temp - 6),
_enddate = _year + '-' + _moon + '-' + _end_day,
_startdate = _year + '-' + _moon + '-' + _start_day;
callback(_startdate, _enddate);
}
},
jineComma(s, n) {
//金额以32, 348, 000的形式显示
......@@ -86,10 +100,10 @@ export default {
dealJineNum(num) {
//处理金额类的数字
if(isFinite(num)) {
if(parseInt(num) == num || num.toString().split('.')[1].length < 4) {
if(parseInt(num) == num || num.toString().split('.')[1].length < 3) {
return num;
} else {
return Number((num).toFixed(3));
return Number((num).toFixed(2));
}
} else {
return 0;
......
......@@ -166,7 +166,7 @@
let _this = this;
_this.userId = localStorage.getItem('userid');
_this.token = localStorage.getItem('token');
_this.initTime(function(start_date, end_date) {
_this.common.achieveInitTime(function(start_date, end_date) {
_this.startDate = start_date;
_this.endDate = end_date;
_this.ajaxMainNum(function() {
......@@ -298,28 +298,6 @@
}];
} else {};
},
initTime(callback) {
//获取缓存里的时间
let _this = this;
let _session_startdate = sessionStorage.getItem('achieve_search_start_date'),
_session_enddate = sessionStorage.getItem('achieve_search_end_date');
if(_session_startdate && _session_enddate) {
//当缓存里有时间时,用缓存里的时间
callback(_session_startdate, _session_enddate);
} else {
//获取当前时间
let _currentDate = new Date();
_currentDate.setDate(_currentDate.getDate() - 1);
let _year = _currentDate.getFullYear(),
_moon = _this.common.dealDateNum(_currentDate.getMonth() + 1),
_end_day_temp = _currentDate.getDate(),
_end_day = _this.common.dealDateNum(_end_day_temp),
_start_day = _end_day_temp < 7 ? '01' : _this.common.dealDateNum(_end_day_temp - 6),
_enddate = _year + '-' + _moon + '-' + _end_day,
_startdate = _year + '-' + _moon + '-' + _start_day;
callback(_startdate, _enddate);
}
},
search(type) {
let _this = this;
if(type == 'today') {
......
<template>
<div>
<div class="timebox001 fl">
<div class="inputbox fl">
<input type="date" id="startdateid" v-model="startDate">
</div>
<img src="/app/images/yj_down_icon@2x.png" class="yj_down_icon">
<span class="fl" style="color:#FFFFFF;margin-left: 0.1rem"></span>
<div class=" inputbox fl">
<input type="date" id="enddateid" v-model="endDate">
</div>
<img src="/app/images/yj_down_icon@2x.png" class="yj_down_icon">
<div class="div_search" @click.prevent.stop="search('normal')">
<span></span>
<img src="/app/images/suods.png" />
</div>
</div>
<button id="searchBtn2" @click.prevent.stop="search('today')">今天</button>
</div>
</template>
<script>
import '@/assets/js/layer041002.js';
export default {
name: '',
props: {
data: {
type: Object,
default: () => ({
message: 'hello'
})
},
dataindex: {
type: [Number, String],
default: 0
}
},
components: {
},
data: () => ({
startDate: '',
endDate: '',
}),
created() {
let _this = this;
},
methods: {
search(type) {
var _this = this;
_this.resetSomeData(1);
if(type == 'today') {
_this.endDate = _this.startDate = _this.common.backNowDate();
} else {
var _tempTimeNow = new Date(_this.nowDate).getTime(),
_tempTimeStart = new Date(_this.startDate).getTime(),
_tempTimeEnd = new Date(_this.endDate).getTime();
if(_tempTimeNow === _tempTimeStart && _tempTimeNow === _tempTimeEnd) {
console.log('搜索为今天');
} else {
if(_tempTimeStart > _tempTimeEnd || _tempTimeEnd >= _tempTimeNow) {
layer.open({
content: '开始时间不能大于结束时间,且搜索日期需要小于今天。请重新选择日期',
btn: ['确定', '取消'],
yes(_index) {
layer.close(_index);
}
});
return false;
};
};
};
sessionStorage.setItem('achieve_search_start_date', _this.startDate);
sessionStorage.setItem('achieve_search_end_date', _this.endDate);
_this.ajaxMainNum(function() {
if(_this.userLevel == '30' || _this.userLevel == '40') {
_this.ajaxUl(_this.initTabNumMain === 0 ? 2 : 1);
} else {
_this.ajaxUl(1);
}
});
},
},
computed: {
}
}
</script>
<style scoped>
/*****************************************搜索起止时间部分******************************************/
.list-time {
width: 5.8rem;
height: 0.6rem;
box-sizing: border-box;
position: absolute;
left: 0.85rem;
border-radius: 0.06rem;
border: 1px solid #FFFFFF;
bottom: 0.3rem;
}
#searchBtn2 {
background-color: #ff9419;
width: 1rem;
height: .5rem;
border-radius: .05rem;
color: white;
position: absolute;
right: -1.2rem;
bottom: .05rem;
}
.tancu001 li a {
-webkit-touch-callout: none
}
.timebox001 {
width: 100%;
}
.timebox001 span {
font-size: 0.24rem;
color: #FFFFFF;
line-height: 0.6rem;
}
.timebox001 .inputbox {
height: 0.5rem;
width: 1.5rem;
width: 2.2rem;
overflow: hidden;
}
.timebox001 input {
float: left;
width: 90%;
color: #FFFFFF;
font-size: 0.26rem;
height: 0.6rem;
background: none;
margin-left: 11%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.timebox001 .select_a {
float: left;
padding: 0.04rem 0.3rem;
font-size: 0.25rem;
background: #ff9419;
color: #fff;
border-radius: 0.05rem;
margin-top: 0.3rem;
line-height: 0.4rem
}
.yj_down_icon {
float: left;
width: 0.2rem;
height: 0.1rem;
margin-top: 0.25rem;
margin-left: -0.1rem;
}
/*****************************搜索按钮相关************************/
.div_search {
float: left;
}
.div_search>span {
width: 0.02rem;
height: 0.3rem;
border-left: 1px solid rgba(255, 255, 255, 0.6);
display: block;
float: left;
margin-top: 0.15rem;
margin-left: 0.2rem;
}
.div_search>img {
width: 0.28rem;
height: 0.29rem;
display: block;
margin-top: 0.15rem;
float: left;
margin-left: 0.16rem;
}
/******************************************************************************************************/
</style>
\ 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