Browse Source

日历组件优化

master
xuxubarca 4 years ago
parent
commit
ad0e2bec56
  1. 12
      components/vant/calendar/components/month/index.js
  2. 10
      components/vant/calendar/index.js
  3. 3
      components/vant/calendar/index.wxs
  4. 20
      pages/service/myService/myService.wxml
  5. 6
      pages/service/settle/settle.js
  6. 4
      pages/service/settle/settle.wxml

12
components/vant/calendar/components/month/index.js

@ -4,20 +4,20 @@ VantComponent({
props: { props: {
date: { date: {
type: null, type: null,
observer: 'setDays' // observer: 'setDays'
}, },
type: { type: {
type: String, type: String,
observer: 'setDays' // observer: 'setDays'
}, },
color: String, color: String,
minDate: { minDate: {
type: null, type: null,
observer: 'setDays' // observer: 'setDays'
}, },
maxDate: { maxDate: {
type: null, type: null,
observer: 'setDays' // observer: 'setDays'
}, },
holiday:Array, holiday:Array,
showMark: Boolean, showMark: Boolean,
@ -38,6 +38,9 @@ VantComponent({
visible: true, visible: true,
days: [] days: []
}, },
mounted() {
this.setDays()
},
methods: { methods: {
onClick(event) { onClick(event) {
const { index } = event.currentTarget.dataset; const { index } = event.currentTarget.dataset;
@ -124,6 +127,7 @@ VantComponent({
if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) { if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
return 'disabled'; return 'disabled';
} }
// console.log('dateFormat',dateFormat)
if(holiday.includes(dateFormat)){ if(holiday.includes(dateFormat)){
return 'disabled'; return 'disabled';
} }

10
components/vant/calendar/index.js

@ -39,11 +39,11 @@ VantComponent({
}, },
minDate: { minDate: {
type: null, type: null,
value: Date.now() // value: Date.now()
}, },
maxDate: { maxDate: {
type: null, type: null,
value: new Date(new Date().getFullYear(), new Date().getMonth() + 6, new Date().getDate()).getTime() // value: new Date(new Date().getFullYear(), new Date().getMonth() + 6, new Date().getDate()).getTime()
}, },
holiday:{ holiday:{
type: Array, type: Array,
@ -100,9 +100,9 @@ VantComponent({
scrollIntoView: '' scrollIntoView: ''
}, },
created() { created() {
this.setData({ // this.setData({
currentDate: this.getInitialDate() // currentDate: this.getInitialDate()
}); // });
}, },
mounted() { mounted() {
if (this.data.show || !this.data.poppable) { if (this.data.show || !this.data.poppable) {

3
components/vant/calendar/index.wxs

@ -2,6 +2,9 @@
var utils = require('./utils.wxs'); var utils = require('./utils.wxs');
function getMonths(minDate, maxDate) { function getMonths(minDate, maxDate) {
if(!minDate || !maxDate){
return 0
}
var months = []; var months = [];
var cursor = getDate(minDate); var cursor = getDate(minDate);

20
pages/service/myService/myService.wxml

@ -19,20 +19,21 @@
</block> </block>
<block wx:if="{{detail.car_number}}"> <block wx:if="{{detail.car_number}}">
<view class="date">车牌号码: {{detail.car_number}}</view> <view class="date">车牌号码: {{detail.car_number}}</view>
<view class="date">停车地点: {{detail.depart_name}}</view> <view class="date">停车地点: {{detail.affiliate_org_name}}</view>
</block> </block>
<block wx:if="{{detail.appointment_time}}"> <block wx:if="{{detail.appointment_time}}">
<view class="date">预约时间: {{detail.appointment_time}}</view> <view class="date">预约时间: {{detail.appointment_time}}</view>
</block> </block>
<block wx:if="{{detail.depart_name}}"> <block wx:if="{{detail.depart_name}}">
<view class="date"> <view class="date">
<block wx:if="{{detail.server_code == 'cjkf'}}">预约场馆: {{detail.depart_name}}</block> <block wx:if="{{detail.server_code == 'cjkf'}}">预约场馆: {{detail.affiliate_org_name}}</block>
<block wx:if="{{detail.server_code == 'whly'}}">参观景点: {{detail.depart_name}}</block> <block wx:if="{{detail.server_code == 'tycg'}}">体育场馆: {{detail.affiliate_org_name}}</block>
<block wx:if="{{detail.server_code == 'whly'}}">参观景点: {{detail.affiliate_org_name}}</block>
<block wx:if="{{detail.server_code == 'zwfw'}}">办理部门: {{detail.depart_name}}</block> <block wx:if="{{detail.server_code == 'zwfw'}}">办理部门: {{detail.depart_name}}</block>
</view> </view>
</block> </block>
<block wx:if="{{detail.attendance}}"> <block wx:if="{{detail.attendance}}">
<view class="date">参人数: {{detail.attendance}}</view> <view class="date">参人数: {{detail.attendance}}</view>
</block> </block>
<block wx:if="{{detail.invoice_prove}}"> <block wx:if="{{detail.invoice_prove}}">
@ -126,7 +127,16 @@
</view> </view>
</block> </block>
<block wx:if="{{detail.demand}}"> <block wx:if="{{detail.demand}}">
<view class="con">{{detail.demand}}</view> <block wx:if="{{detail.server_code == 'cjkf'}}">
<view class="date">用途: {{detail.demand}}</view>
</block>
<block wx:elif="{{detail.server_code == 'whly'}}">
<view class="date">参观人员: {{detail.demand}}</view>
</block>
<block wx:else>
<view class="con">{{detail.demand}}</view>
</block>
</block> </block>

6
pages/service/settle/settle.js

@ -106,10 +106,10 @@ Page({
}) })
}) })
serviceModel.timeRange(this.data.type,res=>{ serviceModel.timeRange(this.data.code,res=>{
this.setData({ this.setData({
start:new Date(res.result.startTime).getTime(), start:new Date(res.result.startTime.replace(/-/g, "/")).getTime(),
end:new Date(res.result.endTime).getTime(), end:new Date(res.result.endTime.replace(/-/g, "/")).getTime(),
holiday:res.result.holidays holiday:res.result.holidays
}) })
}) })

4
pages/service/settle/settle.wxml

@ -114,7 +114,7 @@
class="textArea" class="textArea"
maxlength="1000" maxlength="1000"
value="{{demand}}" value="{{demand}}"
bindinput="bindTextAreaInput" bindinput="inputDemand"
placeholder="请描述您的服务需求" placeholder="请描述您的服务需求"
placeholder-style="font-size:12px;color:rgb(202,202,202)" placeholder-style="font-size:12px;color:rgb(202,202,202)"
/> />
@ -718,7 +718,7 @@
<block wx:if="{{code == 'ylbj'}}"> <block wx:if="{{code == 'ylbj'}}">
<view class="tips"> <view class="tips">
提醒:为提高效率便于安排,请您至少提前5个工作日提出预约申请,申请市场不超过1个月 提醒:为提高效率便于安排,请您至少提前5个工作日提出预约申请,申请时长不超过1个月
</view> </view>
</block> </block>

Loading…
Cancel
Save