2 lines
3.9 KiB
JavaScript
2 lines
3.9 KiB
JavaScript
|
"use strict";var e=(e,t,a)=>new Promise(((s,r)=>{var i=e=>{try{d(a.next(e))}catch(t){r(t)}},o=e=>{try{d(a.throw(e))}catch(t){r(t)}},d=e=>e.done?s(e.value):Promise.resolve(e.value).then(i,o);d((a=a.apply(e,t)).next())}));const t=require("../../../../common/vendor.js"),a=require("../../../../logic/pay.js"),s=require("../../../../utils/commUtils.js"),r=require("../../../../utils/http.js"),i={__name:"OrderItem",props:{id:String,userId:String,reservationTime:String,serviceHours:String,personalServiceId:String,personalServiceUserId:String,price:Number,isPay:Boolean,feedback:String,star:Number,state:String,paymentMethod:String,qrcode:String,createTime:String,updateTime:String,address:Object,pet:Object,user:Object,psUser:Object,serviceInfo:Object,isTake:!1},setup(i){const o=i,d=t.ref({}),c=()=>e(this,null,(function*(){try{const e=yield r.httpGet(`/order/info/${o.id()}`);200===e.code&&(d.value=e.data,d.value.id=data.id||o.id,d.value.userId=data.userId||o.userId,d.value.reservationTime=data.reservationTime||o.reservationTime,d.value.serviceHours=data.serviceHours||o.serviceHours,d.value.personalServiceId=data.personalServiceId||o.personalServiceId,d.value.personalServiceUserId=data.personalServiceUserId||o.personalServiceUserId,d.value.price=data.price||o.price,d.value.isPay=data.isPay||o.isPay,d.value.feedback=data.feedback||o.feedback,d.value.star=data.star||o.star,d.value.state=data.state||o.state,d.value.paymentMethod=data.paymentMethod||o.paymentMethod,d.value.qrcode=data.qrcode||o.qrcode,d.value.createTime=data.createTime||o.createTime,d.value.updateTime=data.updateTime||o.updateTime,d.value.address=data.address||o.address,d.value.pet=data.pet||o.pet,d.value.user=data.user||o.user,d.value.psUser=data.psUser||o.psUser,d.value.serviceInfo=data.serviceInfo||o.serviceInfo)}catch(e){}})),n=t.ref(""),l=()=>e(this,null,(function*(){const e=yield s.scanCodeAsync();if(e.result)try{const a=yield r.httpPost("/order/scan/"+o.id,{},{qrcode:e.result});200===a.code?(s.toast("支付成功"),t.index.$emit("refresh")):s.toast(a.message)}catch(a){s.toast(a.data.codeStr)}else s.toast("扫码失败")})),u=()=>e(this,null,(function*(){try{const e=yield a.payOrder(o.id);200==e.code?(yield c(),s.toast("支付成功")):s.toast(e.message)}catch(e){s.toast(e.data.codeStr)}})),v=()=>e(this,null,(function*(){const e=yield r.httpPost("/order/cancel/"+o.id);200==e.code?(yield c(),s.toast("取消成功"),t.index.$emit("refresh")):s.toast(e.message)})),p=()=>{t.index.navigateTo({url:`/modules/pet/order/order-detail?id=${o.id}`})},m=()=>e(this,null,(function*(){try{const e=yield s.showModalAsync({title:"取消订单",content:"",editable:!0,placeholderText:"请输入取消原因!"});if(e.confirm){n.value=e.content;const a=yield r.httpPost("/order/bookingCancel/"+o.id,{},{shopRemark:n.value});200==a.code?(yield c(),s.toast("取消订单成功!"),t.index.$emit("refresh")):s.toast(a.message)}else e.cancel&&s.toast("取消操作已取消")}catch(e){s.toast("请求失败,请稍后再试")}})),f=()=>e(this,null,(function*(){try{const e=yield r.httpPost("/order/confirm/"+o.id);200==e.code?(s.toast("确认订单成功!"),t.index.$emit("refresh")):s.toast(e.message)}catch(e){s.toast(e.data.message)}}));return(e,a)=>t.e({a:t.unref(s.imgUrl)(i.serviceInfo.url),b:i.serviceInfo&&i.serviceInfo.serviceName},i.serviceInfo&&i.serviceInfo.serviceName?{c:t.t(i.serviceInfo.serviceName)}:{},{d:t.t(i.state),e:t.t(i.serviceInfo.description),f:t.t(i.price),g:t.o(p),h:!i.isTake&&t.unref(s.isCancelOrder)(i.state)},!i.isTake&&t.unref(s.isCancelOrder)(i.state)?{i:t.o(v)}:{},{j:!i.isPay&&!i.isTake},i.isPay||i.isTake?{}:{k:t.o(u)},{l:i.isTake&&t.unref(s.isTakeCancelOrder)(i.state)},i.isTake&&t.unref(s.isTakeCancelOrder)(i.state)?{m:t.o(m)}:{},{n:i.isTake},i.isTake?{o:t.o(f)}:{},{p:i.isTake&&i.state.includes("已接单")},i.isTake&&i.state.includes("已接单")?{q:t.o(l)}:{})}},o=t._export_sfc(i,[["__scopeId","data-v-929c9b36"]]);wx.createComponent(o);
|