addArena.js 8.8 KB
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_arenaControl/addArena/addArena"],{1487:function(e,t,n){"use strict";(function(e,t){var r=n("47a9");n("c5a3");r(n("3240"));var u=r(n("4ea4"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(u.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"4ea4":function(e,t,n){"use strict";n.r(t);var r=n("78e7"),u=n("eb2f");for(var o in u)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(o);n("b5c7");var i=n("828b"),a=Object(i["a"])(u["default"],r["b"],r["c"],!1,null,"315d12ba",null,!1,r["a"],void 0);t["default"]=a.exports},"78e7":function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return r}));var r={"u-Form":function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u--form/u--form")]).then(n.bind(null,"6c79"))},uFormItem:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-form-item/u-form-item")]).then(n.bind(null,"c7a5"))},uniDataSelect:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uni-data-select/components/uni-data-select/uni-data-select")]).then(n.bind(null,"4171"))},uInput:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-input/u-input")]).then(n.bind(null,"8a3a"))},uSwitch:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-switch/u-switch")]).then(n.bind(null,"a696"))},uUpload:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-upload/u-upload")]).then(n.bind(null,"6777"))},uNumberBox:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-number-box/u-number-box")]).then(n.bind(null,"603f"))},uButton:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-button/u-button")]).then(n.bind(null,"ca10"))}},u=function(){var e=this,t=e.$createElement,n=(e._self._c,e.__map(e.showTimeList,(function(t,n){var r=e.__get_orig(t),u=e.formatTextColor(n),o=e.formatBgColor(n),i=e.formatborderColor(n);return{$orig:r,m0:u,m1:o,m2:i}})));e.$mp.data=Object.assign({},{$root:{l0:n}})},o=[]},8311:function(e,t,n){},b5c7:function(e,t,n){"use strict";var r=n("8311"),u=n.n(r);u.a},eb2f:function(e,t,n){"use strict";n.r(t);var r=n("fe24"),u=n.n(r);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);t["default"]=u.a},fe24:function(e,t,n){"use strict";(function(e){var r=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=r(n("7eb4")),o=r(n("af34")),i=r(n("ee10")),a=r(n("d3fb")),s=n("362d"),c=n("c748"),l={mixins:[a.default],components:{BallList:function(){n.e("components/home/ballList").then(function(){return resolve(n("4ae7"))}.bind(null,n)).catch(n.oe)}},data:function(){return{groundId:"",weekday:["周一","周二","周三","周四","周五","周六","周日"],weekCurrent:0,ballList:[],range:[],isEdit:!0,totalPrice:"",showTimeList:[],Timelist:[],form:{businessId:"",groundId:"",belongGym:"",groundCode:"",groundNum:"",isOutdoor:0,address:"",sportsRange:"",weekday:"",orderHours:"",discount:"",longitude:"",latitude:"",groundPhotos:"",weekdayList:[]},rules:{sportsRange:[{required:!0,message:"选择运动类型",trigger:["change"]}],groundNum:[{required:!0,message:"请输入球场号",trigger:["change"]},{type:"number",message:"只能输入数字",trigger:["change"]}],address:[{required:!0,message:"请填写地址",trigger:["change"]}]}}},onLoad:function(e){var t=this;return(0,i.default)(u.default.mark((function n(){var r,o,i;return u.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.groundId=e.groundId,n.next=3,(0,s.getSportList)();case 3:r=n.sent,o=r.rows,t.ballList=o,t.range=o.map((function(e){return{value:e.sportsName,text:e.sportsName}})),i=1;case 8:if(!(i<=7)){n.next=19;break}return n.t0=t.Timelist,n.t1=i,n.next=13,t.getTime();case 13:n.t2=n.sent,n.t3={weekday:n.t1,hourList:n.t2},n.t0.push.call(n.t0,n.t3);case 16:i++,n.next=8;break;case 19:if("add"!==e.groundId){n.next=22;break}return t.isEdit=!1,n.abrupt("return",t.showTimeList=t.Timelist[0].hourList);case 22:t.getDetail(e.groundId);case 23:case"end":return n.stop()}}),n)})))()},computed:{formatBgColor:function(){return function(e){switch(!0){case e>=0&&e<=5:return"#FFF8E6";case e>=6&&e<=11:return"#E8F4FF";case e>=12&&e<=17:return"#E7FAF0";case e>=18&&e<=23:return"#FFE6E6";default:return"#FFE6E6"}}},formatborderColor:function(){return function(e){switch(!0){case e>=0&&e<=5:return"#FFE9B0";case e>=6&&e<=11:return"#B6DCFF";case e>=12&&e<=17:return"#A6EDC7";case e>=18&&e<=23:return"#FFB0B0";default:return"#FFB0B0"}}},formatTextColor:function(){return function(e){switch(!0){case e>=0&&e<=5:return"#FFB336";case e>=6&&e<=11:return"#50ABFF";case e>=12&&e<=17:return"#27B500";case e>=18&&e<=23:return"#D90000";default:return"#D90000"}}}},methods:{toggleWeek:function(e,t){this.weekCurrent=t,this.togglePrice(t)},getDetail:function(e){var t=this;return(0,i.default)(u.default.mark((function n(){var r,i,a,l,f,d;return u.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,(0,s.getGroundDetail)(e);case 2:if(i=n.sent,t.form=i,a=t.form.groundPhotos.split(","),l=a.map((function(e){return{url:c.pro_http+e,fileName:e}})),(r=t.mainCoverList).push.apply(r,(0,o.default)(l)),t.isEdit)for(f=function(e){t.form.weekdayList[e].hourList.forEach((function(n){t.Timelist[e].hourList.forEach((function(e){if(n.startHour===e.startHour)return e.price=n.price}))}))},d=0;d<t.form.weekdayList.length;d++)f(d);t.togglePrice(0);case 9:case"end":return n.stop()}}),n)})))()},changePrice:function(){},togglePrice:function(e){var t=this;return(0,i.default)(u.default.mark((function n(){return u.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:t.showTimeList=t.Timelist[e].hourList;case 1:case"end":return n.stop()}}),n)})))()},getTime:function(){return(0,i.default)(u.default.mark((function e(){var t,n;return u.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,s.getPriods)();case 2:return t=e.sent,n=t.map((function(e){return{startHour:e.dictLabel.split("-")[0],endHour:e.dictLabel.split("-")[1],price:"00.00"}})),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))()},fillPrice:function(){var t=this;e.showModal({title:"提示",content:"是否填充价格,填充后每个时间段价格相同,是否填充",success:function(){var n=(0,i.default)(u.default.mark((function n(r){var o;return u.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:r.confirm?(o=t.totalPrice,t.showTimeList.forEach((function(e){e.price=o})),e.$u.toast("填充成功")):r.cancel&&e.$u.toast("已取消");case 1:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})},fillWeekRules:function(){var t=this;e.showModal({title:"提示",content:"选择填充规则后,其他星期与当前星期设置相同,是否填充",success:function(){var n=(0,i.default)(u.default.mark((function n(r){var o;return u.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:r.confirm?(o=t.showTimeList,t.Timelist.forEach((function(e){e.hourList=o})),e.$u.toast("填充成功")):r.cancel&&e.$u.toast("已取消");case 1:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})},delArena:function(){var t=this.groundId;e.showModal({title:"提示",content:"该操作不可复原,是否要删除该场地",success:function(){var n=(0,i.default)(u.default.mark((function n(r){return u.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!r.confirm){n.next=7;break}return n.next=3,(0,s.delGroundInfo)(t);case 3:e.$u.toast("删除成功"),e.navigateBack(),n.next=8;break;case 7:r.cancel&&e.$u.toast("取消删除");case 8:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})},submit:function(){var t,n=this;void 0!==this.Timelist&&this.Timelist.forEach((function(e){e.hourList=e.hourList.filter((function(e){return"00.00"!==e.price}))})),this.form.weekdayList=[],(t=this.form.weekdayList).push.apply(t,(0,o.default)(this.Timelist)),this.mainCoverList.length>0&&(this.form.groundPhotos=this.mainCoverList.map((function(e){return e.fileName})).join()),this.$refs.uForm.validate().then(function(){var t=(0,i.default)(u.default.mark((function t(r){return u.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!n.isEdit){t.next=9;break}return t.next=3,(0,s.updateGroundInfo)(n.form);case 3:return t.next=5,n.getDetail(n.groundId);case 5:e.$u.toast("添加成功"),e.navigateBack(),t.next=13;break;case 9:return t.next=11,(0,s.addGround)(n.form);case 11:e.$u.toast("添加成功"),e.navigateBack();case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){e.$u.toast("校验失败")}))}}};t.default=l}).call(this,n("df3c")["default"])}},[["1487","common/runtime","common/vendor"]]]);