"use strict";var e=(e,r,o)=>new Promise(((t,n)=>{var d=e=>{try{a(o.next(e))}catch(r){n(r)}},s=e=>{try{a(o.throw(e))}catch(r){n(r)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(d,s);a((o=o.apply(e,r)).next())}));const r=require("../../../common/vendor.js"),o=require("../../../sheep/index.js"),t=require("../../../sheep/hooks/useGoods.js"),n=require("../../../sheep/api/trade/order.js"),d=require("../../../sheep/api/trade/delivery.js");if(!Array){(r.resolveComponent("s-goods-item")+r.resolveComponent("su-fixed")+r.resolveComponent("s-layout")+r.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../sheep/components/s-goods-item/s-goods-item.js")+s+(()=>"../../../sheep/ui/su-fixed/su-fixed.js")+(()=>"../../../sheep/components/s-layout/s-layout.js"))();const s=()=>"./pickUpVerify.js",a={__name:"detail",setup(s){r.useCssVars((e=>({"4d6faa6f":r.unref(i)})));const a=2*o.sheep.$platform.device.statusBarHeight,i=o.sheep.$url.css("/static/img/shop/order/order_bg.png"),u=r.reactive({orderInfo:{},merchantTradeNo:"",comeinType:""}),c=r.ref({}),f=()=>{o.sheep.$helper.copyText(u.orderInfo.no)};function l(t,d=!1){return e(this,null,(function*(){if("WechatMiniProgram"===o.sheep.$platform.name&&!r.isEmpty(u.orderInfo.wechat_extra_data)&&!d)return void function(e){if(!r.wx$1.openBusinessView)return void o.sheep.$helper.toast("请升级微信版本");r.wx$1.openBusinessView({businessType:"weappOrderConfirm",extraData:{merchant_trade_no:u.orderInfo.wechat_extra_data.merchant_trade_no,transaction_id:u.orderInfo.wechat_extra_data.transaction_id},success(r){"openBusinessView:ok"===r.errMsg&&"success"===r.extraData.status&&l(e,!0)},fail(e){},complete(e){}})}(t);const{code:e}=yield n.OrderApi.receiveOrder(t);0===e&&(yield m(t))}))}const p=r.ref();function m(r){return e(this,null,(function*(){let e;if(e="wechat"===u.comeinType?yield n.OrderApi.getOrder(r,{merchant_trade_no:u.merchantTradeNo}):yield n.OrderApi.getOrder(r),0===e.code){if(u.orderInfo=e.data,t.handleOrderButtons(u.orderInfo),e.data.pickUpStoreId){const{data:r}=yield d.DeliveryApi.getDeliveryPickUpStore(e.data.pickUpStoreId);c.value=r||{}}2===u.orderInfo.deliveryType&&u.orderInfo.payStatus&&p.value&&p.value.markCode(e.data.pickUpVerifyCode)}else o.sheep.$router.back()}))}return r.onLoad((r=>e(this,null,(function*(){let e=0;r.id&&(e=r.id),u.comeinType=r.comein_type,"wechat"===u.comeinType&&(u.merchantTradeNo=r.merchant_trade_no),yield m(e)})))),(d,s)=>{var i,I,h,y,v,_,g,x,b,P,S,$,T,w;return r.e({a:"unpaid"==u.orderInfo.status_code||10===u.orderInfo.status||"nocomment"==u.orderInfo.status_code},"unpaid"==u.orderInfo.status_code||10===u.orderInfo.status||"nocomment"==u.orderInfo.status_code?{b:r.unref(o.sheep).$url.static("/static/img/shop/order/order_loading.png")}:{},{c:"completed"==u.orderInfo.status_code||"refund_agree"==u.orderInfo.status_code},"completed"==u.orderInfo.status_code||"refund_agree"==u.orderInfo.status_code?{d:r.unref(o.sheep).$url.static("/static/img/shop/order/order_success.png")}:{},{e:"cancel"==u.orderInfo.status_code||"closed"==u.orderInfo.status_code},"cancel"==u.orderInfo.status_code||"closed"==u.orderInfo.status_code?{f:r.unref(o.sheep).$url.static("/static/img/shop/order/order_close.png")}:{},{g:"noget"==u.orderInfo.status_code},"noget"==u.orderInfo.status_code?{h:r.unref(o.sheep).$url.static("/static/img/shop/order/order_express.png")}:{},{i:r.t(r.unref(t.formatOrderStatus)(u.orderInfo)),j:r.t(r.unref(t.formatOrderStatusDescription)(u.orderInfo)),k:r.s({marginTop:"-"+Number(a+88)+"rpx",paddingTop:Number(a+88)+"rpx"}),l:u.orderInfo.receiverAreaId>0},u.orderInfo.receiverAreaId>0?{m:r.t(u.orderInfo.receiverName),n:r.t(u.orderInfo.receiverMobile),o:r.t(u.orderInfo.receiverAreaName),p:r.t(u.orderInfo.receiverDetailAddress)}:{},{q:r.f(u.orderInfo.items,((e,t,n)=>r.e({a:[10,20,30].includes(u.orderInfo.status)&&0===e.afterSaleStatus},[10,20,30].includes(u.orderInfo.status)&&0===e.afterSaleStatus?{b:r.o((t=>r.unref(o.sheep).$router.go("/modules/mall/order/aftersale/apply",{orderId:u.orderInfo.id,itemId:e.id})),e.goods_id)}:{},{c:10===e.afterSaleStatus},10===e.afterSaleStatus?{d:r.o((t=>r.unref(o.sheep).$router.go("/modules/mall/order/aftersale/detail",{id:e.afterSaleId})),e.goods_id)}:{},{e:20===e.afterSaleStatus},20===e.afterSaleStatus?{f:r.o((t=>r.unref(o.sheep).$router.go("/modules/mall/order/aftersale/detail",{id:e.afterSaleId})),e.goods_id)}:{},{g:e.status_text},e.status_text?{h:r.t(e.status_text)}:{},{i:r.o((r=>{return t=e.spuId,void o.sheep.$router.go("/modules/mall/goods/index",{id:t});var t}),e.goods_id),j:"839ea55a-2-"+n+",839ea55a-1",k:r.p({img:e.picUrl,title:e.spuName,skuText:e.properties.map((e=>e.valueName)).join(" "),price:e.price,num:e.count}),l:e.goods_id}))),r:r.s({marginTop:u.orderInfo.receiverAreaId>0?"0":"-40rpx"}),s:r.sr(p,"839ea55a-3,839ea55a-1",{k:"pickUpVerifyRef"}),t:r.p({"order-info":u.orderInfo,systemStore:c.value}),v:r.t(u.orderInfo.no),w:r.o(f),x:r.t(r.unref(o.sheep).$helper.timeFormat(u.orderInfo.createTime,"yyyy-mm-dd hh:MM:ss")),y:u.orderInfo.payTime},u.orderInfo.payTime?{z:r.t(r.unref(o.sheep).$helper.timeFormat(u.orderInfo.payTime,"yyyy-mm-dd hh:MM:ss"))}:{},{A:r.t(u.orderInfo.payChannelName||"-"),B:r.t(r.unref(t.fen2yuan)(u.orderInfo.totalPrice)),C:r.t(r.unref(t.fen2yuan)(u.orderInfo.deliveryPrice)),D:u.orderInfo.couponPrice>0},u.orderInfo.couponPrice>0?{E:r.t(r.unref(t.fen2yuan)(u.orderInfo.couponPrice))}:{},{F:u.orderInfo.pointPrice>0},u.orderInfo.pointPrice>0?{G:r.t(r.unref(t.fen2yuan)(u.orderInfo.pointPrice))}:{},{H:u.orderInfo.discountPrice>0},u.orderInfo.discountPrice>0?{I:r.t(r.unref(t.fen2yuan)(u.orderInfo.discountPrice))}:{},{J:u.orderInfo.vipPrice>0},u.orderInfo.vipPrice>0?{K:r.t(r.unref(t.fen2yuan)(u.orderInfo.vipPrice))}:{},{L:r.t(u.orderInfo.payStatus?"已付款":"需付款"),M:r.t(r.unref(t.fen2yuan)(u.orderInfo.payPrice)),N:u.orderInfo.refundPrice>0},u.orderInfo.refundPrice>0?{O:r.t(r.unref(t.fen2yuan)(u.orderInfo.refundPrice))}:{},{P:null==(i=u.orderInfo.buttons)?void 0:i.length},(null==(I=u.orderInfo.buttons)?void 0:I.length)?r.e({Q:null==(h=u.orderInfo.buttons)?void 0:h.includes("cancel")},(null==(y=u.orderInfo.buttons)?void 0:y.includes("cancel"))?{R:r.o((o=>function(o){return e(this,null,(function*(){r.index.showModal({title:"提示",content:"确定要取消订单吗?",success:function(r){return e(this,null,(function*(){if(!r.confirm)return;const{code:e}=yield n.OrderApi.cancelOrder(o);0===e&&(yield m(o))}))}})}))}(u.orderInfo.id)))}:{},{S:null==(v=u.orderInfo.buttons)?void 0:v.includes("pay")},(null==(_=u.orderInfo.buttons)?void 0:_.includes("pay"))?{T:r.o((e=>{return r=u.orderInfo.payOrderId,void o.sheep.$router.go("/modules/mall/pay/index",{id:r});var r}))}:{},{U:null==(g=u.orderInfo.buttons)?void 0:g.includes("combination")},(null==(x=u.orderInfo.buttons)?void 0:x.includes("combination"))?{V:r.o((e=>r.unref(o.sheep).$router.go("/modules/mall/activity/groupon/detail",{id:u.orderInfo.combinationRecordId})))}:{},{W:null==(b=u.orderInfo.buttons)?void 0:b.includes("express")},(null==(P=u.orderInfo.buttons)?void 0:P.includes("express"))?{X:r.o((r=>function(r){return e(this,null,(function*(){o.sheep.$router.go("/modules/mall/order/express/log",{id:r})}))}(u.orderInfo.id)))}:{},{Y:null==(S=u.orderInfo.buttons)?void 0:S.includes("confirm")},(null==($=u.orderInfo.buttons)?void 0:$.includes("confirm"))?{Z:r.o((e=>l(u.orderInfo.id)))}:{},{aa:null==(T=u.orderInfo.buttons)?void 0:T.includes("comment")},(null==(w=u.orderInfo.buttons)?void 0:w.includes("comment"))?{ab:r.o((e=>{return r=u.orderInfo.id,void o.sheep.$router.go("/modules/mall/goods/comment/add",{id:r});var r}))}:{},{ac:r.p({bottom:!0,placeholder:!0,bg:"bg-white"})}):{},{ad:r.p({title:"订单详情",navbar:"inner"}),ae:r.s(d.__cssVars())})}}},i=r._export_sfc(a,[["__scopeId","data-v-839ea55a"]]);wx.createPage(i);