2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
"use strict";const e=require("../../common/vendor.js"),o=require("../../api/index.js"),n=require("../../utils/helper.js");if(!Array){(e.resolveComponent("nut-button")+e.resolveComponent("nut-input")+e.resolveComponent("nut-form-item")+e.resolveComponent("nut-textarea")+e.resolveComponent("nut-form")+e.resolveComponent("nut-popup"))()}Math||((()=>"../../uni_modules/nutui-uni/components/button/button.js")+(()=>"../../uni_modules/nutui-uni/components/input/input.js")+(()=>"../../uni_modules/nutui-uni/components/formitem/formitem.js")+(()=>"../../uni_modules/nutui-uni/components/textarea/textarea.js")+(()=>"../../uni_modules/nutui-uni/components/form/form.js")+(()=>"../../uni_modules/nutui-uni/components/popup/popup.js"))();const t={__name:"index",setup(t){const a=e.ref(!1),s=e.ref(""),l=e.ref(""),r=()=>{""!==s.value?""!==l.value?o.fetchLogin({user_name:s.value,password:l.value}).then((o=>{console.log(o),e.index.setStorageSync("token",o.token),e.index.setStorageSync("uid",o.user.user_id),e.index.setStorageSync("user_name",o.user.user_name),e.index.setStorageSync("staff_name",o.user.staff_name),e.index.setStorageSync("role",o.user.role.value),a.value=!0,e.index.showTabBar(),e.index.showToast({title:"登录成功",icon:"success"})})):e.index.showToast({title:"请输入密码",icon:"none"}):e.index.showToast({title:"请输入用户名",icon:"none"})},i=e.reactive({room_id:0,tel:"",remarks:""}),u=e.ref([]),d=e=>{let o="";switch(e){case 1:default:o="#d9d9d9";break;case 2:o="#ffa39e";break;case 3:o="#b7eb8f"}return{"background-color":o}},c=e.ref(!1),p=e=>{console.log("----",e),Object.assign(g,e),c.value=!0},m=()=>{Object.assign(g,{}),c.value=!1,console.log("关闭")},v=e.ref(!1),g=e.reactive({}),h=()=>{Object.assign(g,{}),Object.assign(i,{room_id:0,tel:"",remarks:""}),v.value=!1,console.log("关闭")},b=()=>{console.log("房间"),o.fetchRooms().then((e=>{console.log(e),u.value=e}))},f=()=>{o.fetchBooking(i).then((o=>{console.log(o),e.index.showToast({icon:"none",title:"预约成功"}),h(),b()}))};e.onLoad((()=>{console.log("onshow---"),e.index.hideTabBar(),x(),b()})),e.onShow((()=>{console.log("onshow---"),e.index.hideTabBar(),x(),b()}));const x=()=>{let o=e.index.getStorageSync("token");console.log("token",o),o?(e.index.showTabBar(),a.value=!0):(e.index.hideTabBar(),a.value=!1)};return e.onMounted((()=>{console.log("init"),e.index.hideTabBar(),x(),b()})),(t,x)=>e.e({a:a.value},a.value?e.e({b:e.o((o=>e.unref(n.navigateTo)("/pages/index/goodsOrderAdd"))),c:e.p({type:"primary",block:!0,plain:!0}),d:e.s("top:0px"),e:e.f(u.value,((t,a,s)=>e.e({a:e.t(t.room_name),b:t.tel},t.tel?{c:e.t(t.tel),d:e.o((e=>p(t)),a)}:{},{e:t.remarks},t.remarks?{f:e.t(t.remarks),g:e.o((e=>p(t)),a)}:{},{h:1===t.status},1===t.status?{i:e.o((e=>(e=>{console.log("----",e),Object.assign(g,e),i.room_id=e.id,v.value=!0})(t)),a),j:"7379209a-1-"+s,k:e.p({size:"small",type:"primary",shape:"square"})}:2===t.status?{m:e.o((n=>(n=>{o.fetchUnBooking({id:n.id}).then((o=>{console.log(o),e.index.showToast({icon:"none",title:"取消预约成功"}),b()}))})(t)),a),n:"7379209a-2-"+s,o:e.p({size:"small",type:"warning",plain:!0,shape:"square"})}:{},{l:2===t.status,p:3===t.status},3===t.status?{q:e.o((o=>e.unref(n.navigateTo)(`/pages/index/orderEdit?roomId=${t.id}`)),a),r:"7379209a-3-"+s,s:e.p({size:"small",type:"info",plain:!0,shape:"square"})}:{t:e.o((o=>e.unref(n.navigateTo)(`/pages/index/orderAdd?roomId=${t.id}`)),a),v:"7379209a-4-"+s,w:e.p({size:"small",type:"success",plain:!0,shape:"square"})},{x:a,y:e.s(d(t.status))}))),f:e.t(null==g?void 0:g.room_name),g:e.o((e=>i.tel=e)),h:e.p({placeholder:"请输入尾号",modelValue:i.tel}),i:e.p({label:"尾号"}),j:e.o((e=>i.remarks=e)),k:e.p({rows:3,placeholder:"请输入备注",modelValue:i.remarks}),l:e.p({label:"备注"}),m:e.o(f),n:e.p({type:"primary",block:!0}),o:e.o(h),p:e.o((e=>v.value=e)),q:e.p({"custom-style":{height:"75%"},position:"bottom","safe-area-inset-bottom":!0,"close-on-click-overlay":!0,visible:v.value}),r:e.t(null==g?void 0:g.room_name),s:null==g?void 0:g.tel},(null==g?void 0:g.tel)?{t:e.t(g.tel)}:{},{v:null==g?void 0:g.remarks},(null==g?void 0:g.remarks)?{w:e.t(g.remarks)}:{},{x:e.o(m),y:e.o((e=>c.value=e)),z:e.p({"custom-style":{height:"50%"},position:"bottom","safe-area-inset-bottom":!0,"close-on-click-overlay":!0,visible:c.value})}):{A:e.o((e=>s.value=e)),B:e.p({placeholder:"请输入用户名",clearable:!0,label:"用户名",modelValue:s.value}),C:e.o((e=>l.value=e)),D:e.p({placeholder:"请输入密码",clearable:!0,label:"密码",type:"password",modelValue:l.value}),E:e.o(r),F:e.p({type:"primary",block:!0})})}},a=e._export_sfc(t,[["__scopeId","data-v-7379209a"]]);wx.createPage(a);
|