(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-31cf3465"],{"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("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.value,callback:function(e){t.value=e},expression:"value"}}),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("c7eb"),i=n("1da1"),u=(n("d3b7"),n("159b"),n("50fc")),s={data:function(){return{dialogVisible:!1,value:new Date,appointments:{},formData:{date:"",num:"",id:""},rules:{num:[{required:!0,message:"请输入可预约数量",trigger:"blur"}]}}},created:function(){this.formData.id=this.$route.query.id,this.getList()},methods:{getList:function(){var t=this;return Object(i["a"])(Object(o["a"])().mark((function e(){var n;return Object(o["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(u["d"])(t.formData.id);case 2:n=e.sent,n&&0===n.error&&n.data.forEach((function(e){t.$set(t.appointments,e.date,{books_num:e.books_num,left_num:e.left_num})}));case 4:case"end":return e.stop()}}),e)})))()},isDateAvailable:function(t){var e=new Date;return e.setHours(0,0,0,0),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(i["a"])(Object(o["a"])().mark((function e(n){var a;return Object(o["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Object(u["a"])(t.formData);case 4:a=e.sent,0===a.error&&(t.$message.success("预约成功"),t.getList()),t.close();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},computed:{availableCount:function(){var t=this;return function(e){var n,a=e.toISOString().split("T")[0];return(null===(n=t.appointments[a])||void 0===n?void 0:n.left_num)||0}},bookedCount:function(){var t=this;return function(e){var n,a=e.toISOString().split("T")[0];return(null===(n=t.appointments[a])||void 0===n?void 0:n.books_num)||0}}}},c=s,l=(n("47df"),n("2877")),d=Object(l["a"])(c,a,r,!1,null,"21d88d0c",null);e["default"]=d.exports},4576:function(t,e,n){},"47df":function(t,e,n){"use strict";n("4576")},"50fc":function(t,e,n){"use strict";n.d(e,"e",(function(){return r})),n.d(e,"b",(function(){return o})),n.d(e,"f",(function(){return i})),n.d(e,"g",(function(){return u})),n.d(e,"d",(function(){return s})),n.d(e,"a",(function(){return c})),n.d(e,"c",(function(){return l})),n.d(e,"i",(function(){return d})),n.d(e,"h",(function(){return f}));n("99af");var a=n("b775");function r(){return Object(a["a"])({url:"admin/products/list",method:"get"})}function o(t){return Object(a["a"])({url:"/admin/products/add",method:"post",data:t})}function i(t){return Object(a["a"])({url:"/admin/products/list?page=".concat(t.page,"&limit=").concat(t.limit),method:"get"})}function u(t){return Object(a["a"])({url:"/admin/products/add",method:"post",data:t})}function s(t){return Object(a["a"])({url:"/admin/products/productschedules?id=".concat(t),method:"get"})}function c(t){return Object(a["a"])({url:"/admin/products/addproductschedules",method:"post",data:t})}function l(){return Object(a["a"])({url:"/admin/setting/getContractSetting",method:"get"})}function d(t){return Object(a["a"])({url:"/admin/setting/savecontractsetting",method:"post",data:t})}function f(){return Object(a["a"])({url:"/admin/setting/getContractSetting",method:"get"})}}}]);