Commit c69c8242 authored by Mac's avatar Mac

1

parent b65022f2
......@@ -159,10 +159,13 @@
"path": "buyInterest/index"
},
{
"path":"salesvolume",
"path":"salesvolume",//销售额
"style": {
"navigationStyle": "custom"
}
},
{
"path":"time/choiceDate"//时间选择
}
]
},
......
......@@ -98,22 +98,14 @@
</view>
<view style="width: 100%;display: flex;align-items: center;justify-content: center;">
<view style="display: flex;align-items: center;" @click="show=true">
<view style="display: flex;align-items: center;" @click="gourltiem">
<text style="font-size: 14px;color: #000000;">{{msg.StartTime}} ~ {{msg.EndTime}}</text>
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/salesxiala.png" style="width: 17px;height: 17px;margin-left: 7px;"></image>
</view>
</view>
<canvas canvas-id="canvasColumn" id="canvasColumn" class="charts" disable-scroll=true
@touchstart="touchColumn" @touchmove="moveColumn" @touchend="touchEndColumn">
<cover-view>
<calendar ref="calendar" v-if="show"
@cancel="show=false"
:startDate="msg.StartTime"
:height="height"
:endDate="msg.EndTime"
@selectDate="selectDate"
:limit="limit" />
</cover-view>
</canvas>
<view class="zongjie">
<view class="zongjie-item">
......@@ -130,6 +122,14 @@
</view>
<!-- <calendar ref="calendar" v-if="show"
@cancel="show=false"
:startDate="msg.StartTime"
:height="height"
:endDate="msg.EndTime"
@selectDate="selectDate"
:limit="limit" /> -->
</view>
</scroll-view>
......@@ -137,13 +137,13 @@
<script>
import uCharts from '../school/components/u-charts/u-charts.min.js';
import calendar from './cp/fl-calendar.vue'
// import calendar from './cp/fl-calendar.vue'
var canvaColumn = null;
var _self;
export default {
components: {
calendar
},
data() {
......@@ -210,19 +210,11 @@
},
methods: {
// 获取传参
selectDate(data) {
console.log(data)
if(data.dayNum>30){
uni.showToast({
title: '时间不能超过30天',
icon:'none',
duration: 2000
});
}else{
this.msg.StartTime = data.startDate
this.msg.EndTime = data.endDate
this.init()
}
children(startDate,endDate) {
this.msg.StartTime = startDate
this.msg.EndTime = endDate
this.init()
},
getTime() {
var myDate = new Date();
......@@ -380,7 +372,13 @@
},
btnStart(val){
console.log(val)
}
},
gourltiem(){//时间选择
uni.navigateTo({
url: '/pages/share/time/choiceDate?StartTime='+this.msg.StartTime +'&EndTime='+this.msg.EndTime
});
},
}
}
</script>
......
<template>
<view style="height: 100vh;">
<calendar ref="calendar"
:startDate="StartTime"
:height="height"
:endDate="EndTime"
@selectDate="selectDate"
:limit="limit" />
</view>
</template>
<script>
import calendar from './fl-calendar.vue'
export default{
components:{
calendar
},
data(){
return{
pageTitle: "日期选择",
contentHeight: 0,
height:500, //日历容器高度
limit:36,
StartTime:'',
EndTime:'',
}
},
created() {
this.height = this.$utils.calcContentHeight(-40) ;
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad(options) {
if(options){
this.StartTime = options.StartTime
this.EndTime = options.EndTime
}
},
methods:{
selectDate(data){
console.log(data)
if(data.dayNum>30){
uni.showToast({
title: '时间不能超过30天',
icon:'none',
duration: 2000
});
}else{
if(new Date(data.startDate).getTime() < new Date(data.endDate).getTime()){
let pages = getCurrentPages(); // 当前页面
let beforePage = pages[pages.length - 2]; // 前一个页面
let that = this
setTimeout(()=>{
uni.navigateBack({
success: function() {
beforePage.$vm.children(data.startDate,data.endDate); // 执行前一个页面的方法
}
});
},500)
}else{
uni.showToast({
title: '开始时间小于结束时间',
icon:'none',
duration: 2000
});
}
}
}
}
}
</script>
<style>
</style>
......@@ -13,13 +13,13 @@
<!-- 使用方法:在页面限制使用容器作为节点挂载该组件,并对节点设置heigth,以达到想要的高度,头部80rpx,底部按钮112rpx安全区域,若是要自定义样式请自行修改dateView的定位值 -->
<view class="container" :animation="animationData" :style="{height:height+'px'}">
<view class="navTop">
<!-- <view class="navTop">
<view class="cancel" @tap="cancel()">取消</view>
<view class="title">日期选择器</view>
</view>
</view> -->
<!-- 周一至周日 -->
<view class="week">
<view v-for="(item,index) in weekList" :class="{sunDay:index==0}" :key="index">{{item.title}}</view>
<view v-for="(item,index) in weekList" :key="index">{{item.title}}</view>
</view>
<!-- 日期的显示容器 -->
<view class="dateView">
......@@ -171,12 +171,21 @@
let dayNum = ((this.endTimeString - this.startTimeString)/1000/3600/24)+1
// 此处调用传参
this.$emit('selectDate',{startDate:startDate,endDate:endDate,dayNum:dayNum})
setTimeout(()=>{ //隐藏
this.$emit('cancel')
},this.speck)
this.hideCalendar()
// 此处调用传参
if(new Date(startDate).getTime() < new Date(endDate).getTime()){
this.$emit('selectDate',{startDate:startDate,endDate:endDate,dayNum:dayNum})
setTimeout(()=>{ //隐藏
this.$emit('cancel')
},this.speck)
// this.hideCalendar()
}else{
uni.showToast({
title: '开始时间小于结束时间',
icon:'none',
duration: 2000
});
}
}else{
uni.showModal({
title:'提示',
......@@ -238,13 +247,19 @@
// 处理出dateList用于最终渲染
dealDateList() {
let start;
if (this.startDate) { //如果开始时间不为空则以开始时间为开始月份的基准
start= this.startDate.replace('/','-')
} else { //否则以当日时间为开始月份的基准
start = this.today
// if (this.startDate) { //如果开始时间不为空则以开始时间为开始月份的基准
// start= this.startDate.replace('/','-')
// } else { //否则以当日时间为开始月份的基准
// start = this.today
// }
if (this.endDate) { //如果开始时间不为空则以开始时间为开始月份的基准
start= this.endDate.replace('/','-')
} else { //否则以当日时间为开始月份的基准
// start = this.today
}
let year = new Date(start).getFullYear();
let month = new Date(start).getMonth()+2;
let month = new Date(start).getMonth()+2;
console.log(month)
for (let i = 0; i < this.limit; i++) { //limit默认为渲染6个月
month--
if (month < 1) { //若是月份大于12,年份+1
......@@ -434,7 +449,7 @@
// 日期视口容器
.dateView {
position: absolute; //绝对定位
top: 220rpx; //头部操作区域以及想要的margin-bottomm
top: 80rpx; //头部操作区域以及想要的margin-bottomm
bottom: 112rpx; //底部操作区域高度
left: 62rpx;
right: 62rpx;
......
static/images/xiaoshoue.png

4.35 KB | W: | H:

static/images/xiaoshoue.png

3.03 KB | W: | H:

static/images/xiaoshoue.png
static/images/xiaoshoue.png
static/images/xiaoshoue.png
static/images/xiaoshoue.png
  • 2-up
  • Swipe
  • Onion skin
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