travel/service/public/static/js/chunk-45f7d646.33b5c85f.js

1 line
6.3 KiB
JavaScript
Raw Normal View History

2024-10-28 16:52:59 +08:00
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-45f7d646"],{"005a":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"pro_scheduling"},[n("div",{staticClass:"pick"},[n("span",[t._v("当前日期:"+t._s(t.yue?t.yue:t.dDate))]),n("el-date-picker",{attrs:{"value-format":"yyyy-MM",format:"yyyy 年 MM 月",type:"month",placeholder:"选择日期"},on:{change:t.changeYue},model:{value:t.yue,callback:function(e){t.yue=e},expression:"yue"}})],1),n("el-calendar",{scopedSlots:t._u([{key:"dateCell",fn:function(e){var a=e.date;return[n("div",[n("div",[t._v(t._s(a.getDate()))]),t.isDateAvailable(a)?n("div",[n("el-button",{attrs:{type:"primary",disabled:!t.isDateAvailable(a)},on:{click:function(e){return t.bookDate(a)}}},[t._v(" 可预约 ")]),n("div",{staticClass:"yy"},[t._v("已约 "+t._s(t.bookedCount(a)))]),n("div",{staticClass:"yy"},[t._v("剩余 "+t._s(t.availableCount(a)))])],1):n("div",[n("el-button",{attrs:{disabled:""}},[t._v("不可预约")]),n("div",{staticClass:"test"},[t._v("已约 "+t._s(t.bookedCount(a)))]),n("div",{staticClass:"test"},[t._v("剩余 0")])],1)])]}}]),model:{value:t.yue,callback:function(e){t.yue=e},expression:"yue"}}),n("el-dialog",{attrs:{visible:t.dialogVisible,title:"编辑"},on:{"update:visible":function(e){t.dialogVisible=e},open:t.onOpen,close:t.onClose}},[n("el-form",{ref:"elForm",attrs:{model:t.formData,rules:t.rules,size:"medium","label-width":"100px"}},[n("el-form-item",{attrs:{label:"出行日期",prop:"date"}},[n("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入单行文本单行文本",disabled:!0,clearable:""},model:{value:t.formData.date,callback:function(e){t.$set(t.formData,"date",e)},expression:"formData.date"}})],1),n("el-form-item",{attrs:{label:"可预约数量",prop:"num"}},[n("el-input",{style:{width:"100%"},attrs:{type:"number",placeholder:"请输入可预约数量",clearable:""},model:{value:t.formData.num,callback:function(e){t.$set(t.formData,"num",e)},expression:"formData.num"}})],1)],1),n("div",{attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:t.close}},[t._v("取消")]),n("el-button",{attrs:{type:"primary"},on:{click:t.handelConfirm}},[t._v("确定")])],1)],1)],1)},r=[],o=n("ade3"),i=n("c7eb"),u=n("1da1"),c=(n("99af"),n("d3b7"),n("4d90"),n("159b"),n("50fc")),s={data:function(){return{dialogVisible:!1,value:new Date,appointments:{},formData:{date:"",num:"",id:""},yue:"",dDate:"",rules:{num:[{required:!0,message:"请输入可预约数量",trigger:"blur"}]}}},created:function(){this.formData.id=this.$route.query.id,this.getList()},methods:Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])({getList:function(t){var e=this;return Object(u["a"])(Object(i["a"])().mark((function n(){var a,r,o,u,s,l;return Object(i["a"])().wrap((function(n){while(1)switch(n.prev=n.next){case 0:return a=e.value,r=a.getFullYear(),o=String(a.getMonth()+1).padStart(2,"0"),u="".concat(r,"-").concat(o),e.dDate=u,s={id:e.formData.id,date:t||u},n.next=8,Object(c["d"])(s);case 8:l=n.sent,l&&0===l.error&&(e.appointments={},l.data.forEach((function(t){e.$set(e.appointments,t.date,{books_num:t.books_num,left_num:t.left_num})})));case 10:case"end":return n.stop()}}),n)})))()},changeYue:function(){this.getList(this.yue)},isDateAvailable:function(t){var e=new Date;return e.setHours(0,0,0,0),t>=e}},"isDateAvailable",(function(t){var e=new Date;e.setHours(0,0,0,0);var n=this.yue?new Date(this.yue).getFullYear():e.getFullYear(),a=this.yue?new Date(this.yue).getMonth():e.getMonth(),r=t.getFullYear(),o=t.getMonth();return r>n||r===n&&o>a||r===n&&o===a&&t>=e})),"bookDate",(function(t){console.log("预约日期: ".concat(t.toLocaleDateString())),this.dialogVisible=!0,this.formData.date=t.toLocaleDateString()})),"onOpen",(function(){})),"onClose",(function(){this.$refs["elForm"].resetFields()})),"close",(function(){this.dialogVisible=!1})),"handelConfirm",(function(){var t=this;this.$refs["elForm"].validate(function(){var e=Object(u["a"])(Object(i["a"])().mark((fun