"use strict";const e=require("../../common/vendor.js"),a=require("../../common/assets.js"),t=require("../../config/user.js"),r={__name:"details",setup(r){const n=e.ref(""),u=e.ref({}),o=e.computed((()=>{switch(u.value.orderStatus){case"waiting_for_payment":return"待支付";case"in_used":default:return"使用中";case"used_done":return"已完成";case"order_cancelled":return"已取消"}}));e.onLoad((async a=>{a&&a.orderId?(n.value=a.orderId,await i()):(e.index.showToast({title:"订单信息不存在",icon:"none"}),setTimeout((()=>{e.index.navigateBack()}),1500))}));const i=async()=>{try{e.index.showLoading({title:"加载中"});const a=await t.queryById(n.value);if(200!==a.code||!a.data)throw new Error("获取订单详情失败");u.value=a.data,u.value.createTime&&(u.value.createTime=d(new Date(u.value.createTime))),u.value.startTime&&(u.value.startTime=d(new Date(u.value.startTime))),u.value.endTime&&(u.value.endTime=d(new Date(u.value.endTime))),e.index.hideLoading()}catch(a){e.index.hideLoading(),e.index.showToast({title:a.message||"获取订单详情失败",icon:"none"})}},d=e=>`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`,l=e=>{if(!e)return"";const a=parseInt(e);if(a<60)return`${a}分钟`;{const e=Math.floor(a/60),t=a%60;return t>0?`${e}小时${t}分钟`:`${e}小时`}};return(t,r)=>e.e({a:e.t(o.value),b:e.t(u.value.orderNo||"-"),c:e.t(u.value.deviceNo||"-"),d:"wx_score_pay"===u.value.payWay},"wx_score_pay"===u.value.payWay?{e:a._imports_0$3}:("wx_member_pay"===u.value.payWay||u.value.payWay,{}),{f:"wx_member_pay"===u.value.payWay,g:"wx_pay"===u.value.payWay,h:e.t(u.value.startTime||"-"),i:u.value.endTime},u.value.endTime?{j:e.t(u.value.endTime)}:{},{k:u.value.phone},u.value.phone?{l:e.t(u.value.phone)}:{},{m:u.value.depositAmount},u.value.depositAmount?{n:e.t(u.value.depositAmount)}:{},{o:u.value.packageTime&&u.value.packagePrice},u.value.packageTime&&u.value.packagePrice?{p:e.t(u.value.packagePrice),q:e.t(l(u.value.packageTime))}:{},{r:e.t(u.value.payAmount||0)})}},n=e._export_sfc(r,[["__scopeId","data-v-d8a382d6"]]);wx.createPage(n);
