diff --git a/.gitignore b/.gitignore index c2658d7..e768632 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +node_modules diff --git a/.gitignore 2 b/.gitignore 2 new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore 2 @@ -0,0 +1 @@ +node_modules/ diff --git a/App.vue b/App 2.vue similarity index 100% rename from App.vue rename to App 2.vue diff --git a/dist/build/mp-weixin/app.js b/dist/build/mp-weixin/app.js index 9340545..e5ac314 100644 --- a/dist/build/mp-weixin/app.js +++ b/dist/build/mp-weixin/app.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./common/vendor.js"),n=require("./utils/session.js");Math;function r(){setTimeout(()=>{try{if(n.isLoggedIn())return;const r=getCurrentPages(),t=r[r.length-1];if((e=>!(!e||!e.includes("pages/login/Login")&&!e.includes("pages/report-view/reportView")))(t&&t.route?t.route:""))return;e.index.reLaunch({url:"/pages/login/Login"})}catch(r){e.index.reLaunch({url:"/pages/login/Login"})}},50)}const t={onLaunch(){r()},onShow(){r()}};function o(){return{app:e.createSSRApp(t)}}o().app.mount("#app"),exports.createApp=o; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./common/vendor.js"),n=require("./utils/session.js");Math;function t(){setTimeout(()=>{try{if(n.isLoggedIn())return;const t=getCurrentPages();if(0===t.length)return;const r=t[t.length-1];if((e=>!(!e||!e.includes("pages/login/Login")&&!e.includes("pages/report-view/reportView")))(r&&r.route?r.route:""))return;e.index.reLaunch({url:"/pages/login/Login"})}catch(t){e.index.reLaunch({url:"/pages/login/Login"})}},50)}const r={onLaunch(){t()},onShow(){t()}};function o(){return{app:e.createSSRApp(r)}}o().app.mount("#app"),exports.createApp=o; diff --git a/dist/build/mp-weixin/pages/home/Home.js b/dist/build/mp-weixin/pages/home/Home.js index 91f76eb..a145d4d 100644 --- a/dist/build/mp-weixin/pages/home/Home.js +++ b/dist/build/mp-weixin/pages/home/Home.js @@ -1 +1 @@ -"use strict";const e=require("../../common/vendor.js"),t=require("../../api/index.js"),a=require("../../utils/session.js"),n=require("../../composables/useNavigator.js"),i=require("../../utils/datetime.js"),s=require("../../utils/appointment.js");Math||(l+o)();const o=()=>"../../components/TabBar.js",l=()=>"../../components/AppIcon.js",u={__name:"Home",emits:["change-page"],setup(o,{emit:l}){const u=a.getUserSession(),p=a.getStoreSession();u.id;const{goPage:r,navigateTo:c}=n.useNavigator(),v=(()=>{var t,a,n,i;const s=(null==(a=(t=e.index).getSystemInfoSync)?void 0:a.call(t).statusBarHeight)||20;let o=s+44;const l=null==(i=(n=e.index).getMenuButtonBoundingClientRect)?void 0:i.call(n);if(l&&l.top&&l.height){o=s+2*Math.max(l.top-s,4)+l.height}return`padding-top:${s}px;height:${o}px;`})(),d=e.ref("doing"),m=[{title:"待确认",name:"new"},{title:"进行中",name:"doing"},{title:"已完成",name:"done"}],T=e.ref([]),g=e.computed(()=>T.value.filter(e=>"new"===e.status).length),f=e.ref([]),h=e.ref(!1),y=e.ref(!1),w=[{label:"猫",value:"猫"},{label:"狗",value:"狗"},{label:"其他",value:"其他"}],x=e.ref({petName:"",petType:"",serviceType:"",appointmentTime:"",remark:""}),N=e.computed(()=>{const e=x.value.appointmentTime||"";return e.includes("T")?e.split("T")[0]:""}),$=e.computed(()=>{const e=x.value.appointmentTime||"";return e.includes("T")?(e.split("T")[1]||"").slice(0,5):""}),j=e.computed(()=>T.value.filter(e=>"new"===d.value?"new"===e.status:"doing"===d.value?"doing"===e.status:"done"!==d.value||("done"===e.status||"cancel"===e.status))),S=e=>{var t;const a=(null==(t=null==e?void 0:e.detail)?void 0:t.value)||"",n=$.value||"00:00";x.value.appointmentTime=a?`${a}T${n}`:""},b=t=>{var a;const n=(null==(a=null==t?void 0:t.detail)?void 0:a.value)||"",i=N.value;i?x.value.appointmentTime=`${i}T${n}`:e.index.showToast({title:"请先选择日期",icon:"none"})},q=async()=>{if(!p.id)return;const a=await t.getAppointmentList(null,p.id);if(200===a.code){T.value=a.data.map(e=>({id:e.id,title:e.serviceType||"洗澡美容预约",desc:`${e.petType||""} - ${e.petName||""}`,time:i.formatDateTimeCN(e.appointmentTime),status:e.status||"new",statusText:s.getAppointmentStatusText(e.status),petName:e.petName,petType:e.petType,serviceType:e.serviceType,appointmentTime:e.appointmentTime}));const t=T.value.filter(e=>"new"===e.status).length;t>0&&e.index.showToast({title:`有 ${t} 个待确认预约`,icon:"none"})}},A=async()=>{const a=x.value;if(!a.petName)return void e.index.showToast({title:"请输入宠物名字",icon:"none"});if(!a.petType)return void e.index.showToast({title:"请选择宠物类型",icon:"none"});if(!a.serviceType)return void e.index.showToast({title:"请选择服务类型",icon:"none"});if(!a.appointmentTime)return void e.index.showToast({title:"请选择预约时间",icon:"none"});y.value=!0;const n=await t.createAppointment({...a,storeId:p.id,userId:u.id});y.value=!1,200===n.code?(e.index.showToast({title:"预约创建成功",icon:"success"}),x.value={petName:"",petType:"",serviceType:"",appointmentTime:"",remark:""},h.value=!1,q()):e.index.showToast({title:n.message||"创建失败",icon:"none"})};return e.onMounted(()=>{q(),(async()=>{if(!p.id)return;const e=await t.getServiceTypeList(p.id);200===e.code&&(f.value=e.data.map(e=>({label:e.name,value:e.name})))})()}),(a,n)=>e.e({a:e.o(e=>h.value=!0),b:e.s(e.unref(v)),c:e.f(m,(t,a,n)=>e.e({a:e.t(t.title),b:"new"===t.name&&g.value>0},"new"===t.name&&g.value>0?{c:e.t(g.value)}:{},{d:t.name,e:e.n({active:d.value===t.name}),f:e.o(e=>d.value=t.name,t.name)})),d:j.value.length>0},j.value.length>0?{e:e.f(j.value,(a,n,i)=>{return e.e({a:e.n(`dot-${a.status}`),b:"d5a02c57-0-"+i,c:e.t(a.petName),d:e.t(a.statusText),e:e.n((o=a.status,s.getAppointmentTagClass(o))),f:e.t(a.serviceType),g:e.n(`tag-${a.status}`),h:"d5a02c57-1-"+i,i:e.t(a.time),j:"new"===a.status},"new"===a.status?{k:e.o(n=>(async a=>{const n=await t.startAppointment(a.id,u.id);200===n.code?(e.index.showToast({title:"已开始服务",icon:"success"}),q()):e.index.showToast({title:n.message||"操作失败",icon:"none"})})(a),a.id),l:e.o(n=>(async a=>{e.index.showModal({title:"提示",content:"确定取消该预约?",success:async n=>{if(!n.confirm)return;const i=await t.cancelAppointment(a.id);200===i.code?(e.index.showToast({title:"已取消",icon:"success"}),q()):e.index.showToast({title:i.message||"操作失败",icon:"none"})}})})(a),a.id)}:"doing"===a.status?{n:e.o(t=>(t=>{c("report"),e.index.setStorageSync("petstore_report_prefill",JSON.stringify({appointmentId:t.id,petName:t.petName,serviceType:t.serviceType,appointmentTime:t.appointmentTime}))})(a),a.id)}:{o:e.t("cancel"===a.status?"已取消":"已完成")},{m:"doing"===a.status,p:e.n(`card-${a.status}`),q:a.id});var o}),f:e.p({name:"profile",size:14}),g:e.p({name:"orders",size:13})}:{},{h:0===j.value.length},(j.value.length,{}),{i:h.value},h.value?{j:e.o(e=>h.value=!1),k:x.value.petName,l:e.o(e=>x.value.petName=e.detail.value),m:e.t(x.value.petType||"请选择"),n:w,o:e.o(e=>x.value.petType=w[e.detail.value].value),p:e.t(x.value.serviceType||"请选择"),q:f.value,r:e.o(e=>x.value.serviceType=f.value[e.detail.value].value),s:e.t(N.value||"请选择日期"),t:N.value,v:e.o(S),w:e.t($.value||"请选择时间"),x:$.value,y:e.o(b),z:x.value.remark,A:e.o(e=>x.value.remark=e.detail.value),B:e.o(e=>h.value=!1),C:y.value,D:e.o(A),E:e.o(()=>{}),F:e.o(e=>h.value=!1)}:{},{G:e.o(e.unref(r)),H:e.p({"current-page":"home"})})}},p=e._export_sfc(u,[["__scopeId","data-v-d5a02c57"]]);wx.createPage(p); +"use strict";const e=require("../../common/vendor.js"),t=require("../../api/index.js"),a=require("../../utils/session.js"),n=require("../../composables/useNavigator.js"),i=require("../../utils/datetime.js"),o=require("../../utils/appointment.js");Math||(l+s)();const s=()=>"../../components/TabBar.js",l=()=>"../../components/AppIcon.js",u={__name:"Home",emits:["change-page"],setup(s,{emit:l}){const u=a.getUserSession(),p=a.getStoreSession();u.id;const{goPage:v,navigateTo:r}=n.useNavigator(),c=(()=>{var t,a,n,i;const o=(null==(a=(t=e.index).getSystemInfoSync)?void 0:a.call(t).statusBarHeight)||20;let s=o+44;const l=null==(i=(n=e.index).getMenuButtonBoundingClientRect)?void 0:i.call(n);if(l&&l.top&&l.height){s=o+2*Math.max(l.top-o,4)+l.height}return`padding-top:${o}px;height:${s}px;`})(),m=e.ref("doing"),d=[{title:"待确认",name:"new"},{title:"进行中",name:"doing"},{title:"已完成",name:"done"}],T=e.ref([]),g=e.computed(()=>T.value.filter(e=>"new"===e.status).length),f=e.ref([]),y=e.ref(!1),h=e.ref(!1),w=[{label:"猫",value:"猫"},{label:"狗",value:"狗"},{label:"其他",value:"其他"}],x=e.ref({petName:"",petType:"",serviceType:"",appointmentTime:"",remark:""}),N=e.computed(()=>{const e=x.value.appointmentTime||"";return e.includes("T")?e.split("T")[0]:""}),$=e.computed(()=>{const e=x.value.appointmentTime||"";return e.includes("T")?(e.split("T")[1]||"").slice(0,5):""}),S=e.computed(()=>T.value.filter(e=>"new"===m.value?"new"===e.status:"doing"===m.value?"doing"===e.status:"done"!==m.value||("done"===e.status||"cancel"===e.status))),b=e=>{var t;const a=(null==(t=null==e?void 0:e.detail)?void 0:t.value)||"",n=$.value||"00:00";x.value.appointmentTime=a?`${a}T${n}`:""},j=t=>{var a;const n=(null==(a=null==t?void 0:t.detail)?void 0:a.value)||"",i=N.value;i?x.value.appointmentTime=`${i}T${n}`:e.index.showToast({title:"请先选择日期",icon:"none"})},k=async()=>{if(!p.id)return;const a=await t.getAppointmentList(null,p.id);if(200===a.code){T.value=a.data.map(e=>({id:e.id,title:e.serviceType||"洗澡美容预约",desc:`${e.petType||""} - ${e.petName||""}`,time:i.formatDateTimeCN(e.appointmentTime),status:e.status||"new",statusText:o.getAppointmentStatusText(e.status),petName:e.petName,petType:e.petType,serviceType:e.serviceType,appointmentTime:e.appointmentTime}));const t=T.value.filter(e=>"new"===e.status).length;t>0&&e.index.showToast({title:`有 ${t} 个待确认预约`,icon:"none"})}},q=async()=>{const a=x.value;if(!a.petName)return void e.index.showToast({title:"请输入宠物名字",icon:"none"});if(!a.petType)return void e.index.showToast({title:"请选择宠物类型",icon:"none"});if(!a.serviceType)return void e.index.showToast({title:"请选择服务类型",icon:"none"});if(!a.appointmentTime)return void e.index.showToast({title:"请选择预约时间",icon:"none"});h.value=!0;const n=await t.createAppointment({...a,storeId:p.id,userId:u.id});h.value=!1,200===n.code?(e.index.showToast({title:"预约创建成功",icon:"success"}),x.value={petName:"",petType:"",serviceType:"",appointmentTime:"",remark:""},y.value=!1,k()):e.index.showToast({title:n.message||"创建失败",icon:"none"})};return e.onMounted(()=>{k(),(async()=>{if(!p.id)return;const e=await t.getServiceTypeList(p.id);200===e.code&&(f.value=e.data.map(e=>({label:e.name,value:e.name})))})()}),(a,n)=>e.e({a:"customer"===e.unref(u).role},"customer"===e.unref(u).role?{b:e.s(e.unref(c)),c:e.t(e.unref(p).name||"宠伴生活馆"),d:x.value.petName,e:e.o(e=>x.value.petName=e.detail.value),f:e.t(x.value.petType||"请选择"),g:w,h:e.o(e=>x.value.petType=w[e.detail.value].value),i:e.t(x.value.serviceType||"请选择"),j:f.value,k:e.o(e=>x.value.serviceType=f.value[e.detail.value].value),l:e.t(N.value||"请选择日期"),m:N.value,n:e.o(b),o:e.t($.value||"请选择时间"),p:$.value,q:e.o(j),r:x.value.remark,s:e.o(e=>x.value.remark=e.detail.value),t:h.value,v:e.o(q)}:e.e({w:e.o(e=>y.value=!0),x:e.s(e.unref(c)),y:e.f(d,(t,a,n)=>e.e({a:e.t(t.title),b:"new"===t.name&&g.value>0},"new"===t.name&&g.value>0?{c:e.t(g.value)}:{},{d:t.name,e:e.n({active:m.value===t.name}),f:e.o(e=>m.value=t.name,t.name)})),z:S.value.length>0},S.value.length>0?{A:e.f(S.value,(a,n,i)=>{return e.e({a:e.n(`dot-${a.status}`),b:"36a15fc8-0-"+i,c:e.t(a.petName),d:e.t(a.statusText),e:e.n((s=a.status,o.getAppointmentTagClass(s))),f:e.t(a.serviceType),g:e.n(`tag-${a.status}`),h:"36a15fc8-1-"+i,i:e.t(a.time),j:"new"===a.status},"new"===a.status?{k:e.o(n=>(async a=>{const n=await t.startAppointment(a.id,u.id);200===n.code?(e.index.showToast({title:"已开始服务",icon:"success"}),k()):e.index.showToast({title:n.message||"操作失败",icon:"none"})})(a),a.id),l:e.o(n=>(async a=>{e.index.showModal({title:"提示",content:"确定取消该预约?",success:async n=>{if(!n.confirm)return;const i=await t.cancelAppointment(a.id);200===i.code?(e.index.showToast({title:"已取消",icon:"success"}),k()):e.index.showToast({title:i.message||"操作失败",icon:"none"})}})})(a),a.id)}:"doing"===a.status?{n:e.o(t=>(t=>{r("report"),e.index.setStorageSync("petstore_report_prefill",JSON.stringify({appointmentId:t.id,petName:t.petName,serviceType:t.serviceType,appointmentTime:t.appointmentTime}))})(a),a.id)}:{o:e.t("cancel"===a.status?"已取消":"已完成")},{m:"doing"===a.status,p:e.n(`card-${a.status}`),q:a.id});var s}),B:e.p({name:"profile",size:14}),C:e.p({name:"orders",size:13})}:{},{D:0===S.value.length},(S.value.length,{}),{E:y.value},y.value?{F:e.o(e=>y.value=!1),G:x.value.petName,H:e.o(e=>x.value.petName=e.detail.value),I:e.t(x.value.petType||"请选择"),J:w,K:e.o(e=>x.value.petType=w[e.detail.value].value),L:e.t(x.value.serviceType||"请选择"),M:f.value,N:e.o(e=>x.value.serviceType=f.value[e.detail.value].value),O:e.t(N.value||"请选择日期"),P:N.value,Q:e.o(b),R:e.t($.value||"请选择时间"),S:$.value,T:e.o(j),U:x.value.remark,V:e.o(e=>x.value.remark=e.detail.value),W:e.o(e=>y.value=!1),X:h.value,Y:e.o(q),Z:e.o(()=>{}),aa:e.o(e=>y.value=!1)}:{}),{ab:e.o(e.unref(v)),ac:e.p({"current-page":"home"})})}},p=e._export_sfc(u,[["__scopeId","data-v-36a15fc8"]]);wx.createPage(p); diff --git a/dist/build/mp-weixin/pages/home/Home.wxml b/dist/build/mp-weixin/pages/home/Home.wxml index 3674aa0..e34976d 100644 --- a/dist/build/mp-weixin/pages/home/Home.wxml +++ b/dist/build/mp-weixin/pages/home/Home.wxml @@ -1 +1 @@ -宠伴生活馆今日服务看板待确认、进行中、已完成实时同步,支持一键开始服务与快速填报。{{tab.a}} {{item.d}}{{item.i}}暂无数据新建预约填写基础信息后即可创建预约,后续可在列表中继续处理。宠物名字宠物类型{{m}}服务类型{{p}}预约日期{{s}}预约时间{{w}}备注(可选)