acdr-ui/dist/build/mp-weixin/pages/order/components/OrderItem.js

2 lines
3.3 KiB
JavaScript

"use strict";var e=(e,t,s)=>new Promise(((r,i)=>{var o=e=>{try{n(s.next(e))}catch(t){i(t)}},a=e=>{try{n(s.throw(e))}catch(t){i(t)}},n=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);n((s=s.apply(e,t)).next())}));const t=require("../../../common/vendor.js"),s=require("../../../logic/pay.js"),r=require("../../../utils/commUtils.js"),i=require("../../../utils/http.js"),o={__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(o){const a=o,n=t.ref(""),c=()=>e(this,null,(function*(){const e=yield r.scanCodeAsync();if(e.result)try{const s=yield i.httpPost("/order/scan/"+a.id,{},{qrcode:e.result});200==s.code?(r.toast("支付成功"),t.index.$emit("refresh")):r.toast(s.message)}catch(s){r.toast(s.data.codeStr)}else r.toast("扫码失败")})),d=()=>e(this,null,(function*(){try{const e=yield s.payOrder(a.id);200==e.code?r.toast("支付成功"):r.toast(e.message)}catch(e){r.toast(e.data.codeStr)}})),l=()=>e(this,null,(function*(){const e=yield i.httpPost("/order/cancel/"+a.id);200==e.code?(r.toast("取消成功"),t.index.$emit("refresh")):r.toast(e.message)})),u=()=>{t.index.navigateTo({url:`/pages/order/order-detail?id=${a.id}`})},p=()=>e(this,null,(function*(){try{const e=yield r.showModalAsync({title:"取消订单",content:"",editable:!0,placeholderText:"请输入取消原因!"});if(e.confirm){n.value=e.content;const s=yield i.httpPost("/order/bookingCancel/"+a.id,{},{shopRemark:n.value});200==s.code?(r.toast("取消订单成功!"),t.index.$emit("refresh")):r.toast(s.message)}else e.cancel&&r.toast("取消操作已取消")}catch(e){r.toast("请求失败,请稍后再试")}})),v=()=>e(this,null,(function*(){try{const e=yield i.httpPost("/order/confirm/"+a.id);200==e.code?(r.toast("确认订单成功!"),t.index.$emit("refresh")):r.toast(e.message)}catch(e){r.toast(e.data.message)}}));return(e,s)=>t.e({a:o.serviceInfo&&o.serviceInfo.serviceName},o.serviceInfo&&o.serviceInfo.serviceName?{b:t.t(o.serviceInfo.serviceName)}:{},{c:t.t(o.state),d:o.serviceInfo&&o.serviceInfo.type},o.serviceInfo&&o.serviceInfo.type?{e:t.t(o.serviceInfo.type)}:{},{f:o.serviceInfo&&o.serviceInfo.address},o.serviceInfo&&o.serviceInfo.address?{g:t.t(o.serviceInfo.address)}:{},{h:t.t(o.reservationTime),i:t.t(o.serviceHours),j:t.unref(r.imgUrl)(o.pet.profileUrl),k:t.t(o.pet.name),l:t.t(o.pet.breed),m:t.t(o.user.nickname),n:t.t(o.user.phone),o:o.address},o.address?{p:t.t(o.address.province),q:t.t(o.address.city),r:t.t(o.address.district),s:t.t(o.address.detailAddress)}:{},{t:t.t(o.paymentMethod),v:t.t(o.isPay?"已支付":"未支付"),w:t.t(o.price),x:t.t(o.price),y:t.t(o.serviceHours),z:!o.isTake},o.isTake?{}:{A:t.o(u)},{B:!o.isTake},o.isTake?{}:{C:t.o(l)},{D:!o.isTake},o.isTake?{}:{E:t.o(d)},{F:o.isTake},o.isTake?{G:t.o(p)}:{},{H:o.isTake},o.isTake?{I:t.o(v)}:{},{J:o.state&&o.state.includes("已预约")&&o.user.userInfo.isPetNursery},o.state&&o.state.includes("已预约")&&o.user.userInfo.isPetNursery?{K:t.o(c)}:{})}},a=t._export_sfc(o,[["__scopeId","data-v-7c4ec580"]]);wx.createComponent(a);