12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- Vue.component('doctor-select', {
- template:
- '<div><div class="c-f16 c-border-b pb5 mb20 lh20" style="margin-bottom:15px">医生列表<input class="h34 ml30 bd1 inp_border" v-model="keyword" @click="selDoc" @input="selDoc" placeholder="输入医生姓名"/></div>\
- <ul class="pd0" v-show="!iswuhaoyuan">\
- <li class="clearfix pt10 pb10 bd1 disbox mb20" v-for="(doctor, index) in doctorList" v-show="!doctor.isShow">\
- <div class="fl w200 mt10 mb10">\
- <h3 class="c-f20 mb10">{{doctor.name}}<span class="c-f16 ml20">{{doctor.title}}</span></h3>\
- <p class="c-f16 h24 mb10">诊查费:<span class="fc-red">{{doctor.fee ? doctor.fee : handleFee(doctortime[index])}}</span>元</p>\
- <p class="over-scroll lh20">{{doctor.introduce}}</p>\
- </div>\
- <ul class="fl w500 mb0 ml10 pd0 pt20">\
- <li class="fl li-time" v-for="(list, ind) in doctortime[index]">\
- <a v-show="list.status == 1" class="bgc-fff" title="选择日期" @click="seldetailTime(list, index, ind)">{{handteTime(list)}}<span class="bgc-12b7f5">{{add0(list.max - list.used)}}</span></a>\
- <a v-show="list.status == 2" class="bgc-d7dce6 fc-fff">{{handteTime(list)}}<span class="bgc-c3c8d2">满</span></a>\
- <a v-show="list.status == 0" class="bgc-d7dce6 fc-fff">{{handteTime(list)}}<span class="bgc-c3c8d2">停</span></a>\
- </li>\
- </ul>\
- </li>\
- </ul>\
- <div class="pt60" v-show="iswuhaoyuan"><img class="setauto" width="250px" src="../../img/wuhaoyuan_img.png" alt="无号源" /></div>\
- </div>',
- props: ['doctors', 'doctortime', 'iswuhaoyuan'],
- data: function () {
- return {
- keyword: '',
- doctorList: [],
- docName: [],
- selIndex: []
- }
- },
- mounted: function () {},
- methods: {
- seldetailTime: function (list, index, ind) {
- $.extend(list, { 'index': index, 'ind': ind })
- this.$emit('seldetail', list)
- },
- 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
- }
- },
- selDoc: function () {
- var len = this.doctorList.length
- if (this.keyword.length < 1) {
- for (var i = 0; i < len; i++) {
- this.$set(this.doctorList, i, $.extend({}, this.doctorList[i], { 'isShow': false }))
- }
- return
- }
- var reg = new RegExp(this.keyword)
- for (var i = 0; i < len; i++) {
- if (this.docName[i].match(reg)) {
- this.$set(this.doctorList, i, $.extend({}, this.doctorList[i], { 'isShow': false }))
- } else {
- this.$set(this.doctorList, i, $.extend({}, this.doctorList[i], { 'isShow': true }))
- }
- }
- },
- handleFee: function (arr) {
- if (arr && arr.length > 0) {
- return arr[0].fee
- } else {
- return ''
- }
- }
- },
- watch: {
- doctors: function (list) {
- this.doctorList = list
- for (var i = 0, len = list.length; i < len; i++) {
- this.docName[i] = list[i].name
- }
- }
- }
- })
|