|
@@ -10,6 +10,7 @@ Component({
|
|
|
mixins: [],
|
|
|
data: {
|
|
|
dateIndex: "1",
|
|
|
+ day: app.globalData.day,//日
|
|
|
year: app.globalData.year,//年
|
|
|
month: app.globalData.month,//月
|
|
|
jdYear: app.globalData.year,//季度年
|
|
@@ -20,6 +21,9 @@ Component({
|
|
|
jdYearIndex:yearIndex,
|
|
|
isShowArr:[true,true,true],
|
|
|
showSelect:false,
|
|
|
+ customIndOn: app.globalData.day,
|
|
|
+ customIndTw: app.globalData.day,
|
|
|
+ // custom: '',
|
|
|
},
|
|
|
props: {
|
|
|
onClose: (data) => console.log(data),
|
|
@@ -56,6 +60,11 @@ Component({
|
|
|
this.setData({
|
|
|
jdji:data.substr(data.length-1,1)-1
|
|
|
})
|
|
|
+ }else if(this.props.dateObj.type==4){
|
|
|
+ this.setData({
|
|
|
+ customIndOn: this.props.dateObj.date.start_date,
|
|
|
+ customIndTw: this.props.dateObj.date.end_date,
|
|
|
+ })
|
|
|
}else{
|
|
|
this.setData({
|
|
|
month:this.props.dateObj.date,
|
|
@@ -109,6 +118,27 @@ Component({
|
|
|
date: this.data.month
|
|
|
}
|
|
|
break
|
|
|
+ case "4":
|
|
|
+ function tsTamp(ydm) {
|
|
|
+ return new Date(ydm).getTime()
|
|
|
+ }
|
|
|
+ let timeC = (tsTamp(this.data.customIndOn) - tsTamp(this.data.customIndTw)) / (60 * 60 * 24 * 1000)
|
|
|
+ if(timeC > 0){
|
|
|
+ app.globalData.showToast("开始时间不能大于结束时间")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(Math.abs(timeC) > 31) {
|
|
|
+ app.globalData.showToast("自定义事件区间不能大于一个月")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ obj = {
|
|
|
+ type: this.data.dateIndex,
|
|
|
+ date: {
|
|
|
+ start_date: this.data.customIndOn,
|
|
|
+ end_date: this.data.customIndTw
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break
|
|
|
};
|
|
|
this.props.onConfirm(obj);
|
|
|
this.props.onClose();
|
|
@@ -142,6 +172,21 @@ Component({
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ customDate(e) {
|
|
|
+ console.log(e)
|
|
|
+ let cust = e.target.dataset.index
|
|
|
+ dd.datePicker({
|
|
|
+ format: 'yyyy-MM-dd',
|
|
|
+ currentDate: this.data[cust],
|
|
|
+ success : res =>{
|
|
|
+ console.log(res)
|
|
|
+ this.setData({
|
|
|
+ [cust]: res.date
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
activeDate(e) {
|
|
|
this.setData({ dateIndex: e.target.dataset.index })
|
|
|
},
|