123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- Vue.component('appoint-time', {
- template: '<div><div class="c-f16 c-border-b pb5">就诊时间</div>\
- <ul class="clearfix">\
- <li class="h28 mr10" v-for="(list, index) in visittime">\
- <a class="h28" v-show="judge ? timeIndex != index : index != visitindex" href="javascript:void(0)" title="切换日期" @click="changeTime(index)">{{handteTime(list)}}</a>\
- <a class="h28 active" v-show="judge ? timeIndex == index : index == visitindex">{{handteTime(list)}}</a>\
- </li>\
- </ul>\
- </div>',
- props: ["visittime", "visitindex"],
- data: function() {
- return {
- judge: false,
- timeIndex: null
- }
- },
- mounted: function() {
-
- },
- methods: {
- changeTime: function(index) {
- this.timeIndex = index
- this.judge = true
- this.$emit("changetime", this.visittime[index])
- },
- handteTime: function(data) {
- var dateTime = data.date+"";
- var date= dateTime.split(" ")[0];
- var week = getWeek(date);
- var riqi = date.split("/");
- riqi = this.add0(riqi[1]) + "月" + this.add0(riqi[2]) + "日";
- var isMo = data.time;
- if(isMo =="a"){
- isMo ="上午";
- }else{
- isMo ="下午";
- }
- return " " + riqi + " " + week + isMo + " "
- },
- add0: function(num) {
- if(num < 10) {
- return '0' + num
- } else {
- return num
- }
- }
- }
- })
|