order-detail-78f0c2cd.js 11 KB

1
  1. import{d as D,q as S,e as b,a as o,A as c,I as F,F as I,P as O,x as j,r as z,y as V,S as g,V as H,W as N,C as R,R as P,D as m,X as M,N as h,K as C}from"./index-869d77fb.js";import{C as f}from"./index-1c6c2ec0.js";import{T as E}from"./index-70d6770d.js";import{M as L}from"./index-3eb77ad0.js";import{P as G,Q as X,U as J,b as K}from"./user-auth-8e7edf72.js";import{O as Q}from"./index-ba9324bc.js";import{O as W}from"./index-b286ae32.js";import{C as Z}from"./index-cff93552.js";import{I as Y}from"./index-e76f2a88.js";import"./index-155c29c2.js";import"./index-62365511.js";import"./Checker-4ac02e10.js";import"./index-32adfdfb.js";import"./browser-e949d08f.js";import"./index-988f61a4.js";import"./index-0153d173.js";const $="_cartConfirm_1c37u_1",ee="_cartConfirmBox_1c37u_9",te="_cartItem_1c37u_15",oe="_mlr13_1c37u_24",se="_protocol_1c37u_28",ae="_paymentContainer_1c37u_36",re="_needPrice_1c37u_48",ne="_allPrice_1c37u_64",ce="_cellItem_1c37u_72",le="_img_1c37u_77",ue="_cellPrice_1c37u_85",ie="_numFont_1c37u_91",de="_numPrefix_1c37u_94",me="_goodsContent_1c37u_98",pe="_goodsNum_1c37u_98",fe="_goodsPrice_1c37u_104",_e="_free_1c37u_110",ye="_goodsNums_1c37u_113",ge="_brandName_1c37u_128",he="_model_1c37u_137",Ie="_popupCode_1c37u_143",Ae="_codeContainer_1c37u_147",Te="_codeClose_1c37u_150",Ne="_codeImg_1c37u_160",Pe="_codeTitle_1c37u_167",Ce="_codeName_1c37u_175",De="_codeQr_1c37u_182",Se="_codeBtnText_1c37u_195",be="_codeTips_1c37u_206",Ee="_tipsTitle_1c37u_220",we="_close_1c37u_226",xe="_codeBottom_1c37u_231",Be="_title_1c37u_238",ve="_shareImg_1c37u_253",Ue="_shareText_1c37u_257",ke="_freight_1c37u_263",qe="_submitBtn_1c37u_275",r={cartConfirm:$,cartConfirmBox:ee,cartItem:te,mlr13:oe,protocol:se,paymentContainer:ae,needPrice:re,allPrice:ne,cellItem:ce,img:le,cellPrice:ue,numFont:ie,numPrefix:de,goodsContent:me,goodsNum:pe,goodsPrice:fe,free:_e,goodsNums:ye,brandName:ge,model:he,popupCode:Ie,codeContainer:Ae,codeClose:Te,codeImg:Ne,codeTitle:Pe,codeName:Ce,codeQr:De,codeBtnText:Se,codeTips:be,tipsTitle:Ee,close:we,codeBottom:xe,title:Be,shareImg:ve,shareText:Ue,freight:ke,submitBtn:qe},Fe="_cellEntry_1kuxn_1",Oe="_cell_1kuxn_1",je="_userName_1kuxn_36",ze="_phone_1kuxn_41",Ve="_addressInfo_1kuxn_46",He="_emtry_1kuxn_51",i={cellEntry:Fe,cell:Oe,userName:je,phone:ze,addressInfo:Ve,emtry:He},Re="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAMAAACfWMssAAABiVBMVEUAAAD/qDn/oED/pDf/iTT/jjf/sEf/sEf/rEb/rkb/oED/qEL/sEf/oD//oD//sEf/kDf/jzf/ljr/ijX/kDb/oUH/rkr/kTb/sUX/kTP/jTb/sEf/iDP/r0b/qkT/lTr/izb/mT3/lzv/sEf/jzf/sEf/rEX/kzn/sEf/o0H/nT7/iDT/sEf/p0P/mTz/iTT/pEH/nD3/iDP/sEf/pUL/nD3/ijT/skf/jjX/skj/jDX/rkP/oUP/r0f/r0b/iDP/iDT/skj/sEj/mD3/mDr/////r0b/kDf/kzn/jjb/rUX/nD3/o0D/q0T/oT//nT7/qUP/rkb/pUH/p0L/lzv/jDX/lTn/mjz/ljr/nz7/iDT/mTv/ijT/1Kr/+vX/8eP/7dr/zJX/+PL/7t7/6NP/q07/oUv//fz//Pr/8+b/3Lj/2rD/xo3/um//9uz/5cr/3sH/wob/vn//wnn/tHP/tGz/s17/6M7/x5X/yo7/uGH/qFr/qFj/sFT/pVL/p0f/1bH/0pv/rGQBKLmeAAAARXRSTlMABAoH7eDfl4NN+O7r69/NzZWDg041JiYaGhP4+PPz8/Pw6+np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a52ATiG2nlc+ZdFoa3WanCka3lbXmFcFaW4b4sx0z3/7fh//zfdvlEDfKRQAAAABJRU5ErkJggg==",Me=D({name:"cart-address",props:{item:{type:Object,default:()=>({})},isLink:{type:Boolean,default:!0},setAddress:{type:Function,default:a=>{}}},setup(a){const d=S(),e=b(()=>[a.item.provinceName,a.item.cityName,a.item.regionName,a.item.detailAddress].join("")),l=()=>{a.isLink&&d.push("/shopAddress")};return()=>o(I,null,[a.item&&a.item.phoneNumber?o(f,{class:i.cell,"is-link":a.isLink,onClick:()=>l(),titleStyle:{marginLeft:"0"}},{title:()=>o("div",null,[o("span",{class:i.userName},[a.item.name]),o("span",{class:i.phone},[a.item&&a.item.phoneNumber&&a.item.phoneNumber.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")]),a.item.defaultStatus&&o(E,{type:"primary",color:"linear-gradient(90deg, #FF8633 0%, #FFB047 100%)",round:!0,style:{"vertical-align":"text-top",marginLeft:"10px",padding:"1px 8px"}},{default:()=>[c("默认")]})]),label:()=>o("span",{class:i.addressInfo},[e.value])}):o(f,{class:i.cell,"is-link":a.isLink,onClick:()=>l()},{icon:()=>o(F,{name:Re,size:28},null),title:()=>o("div",{class:i.emtry},[c("去填写收货地址")])})])}}),Le={WAIT_PAY:"待支付",PAYING:"支付中",PAID:"已付款",TIMEOUT:"已关闭",FAIL:"支付失败",CLOSED:"已关闭",REFUNDING:"退款中",REFUNDED:"已退款"},ct=D({name:"order-detail",setup(){const a=O(),d=S(),e=j({paymentType:"adapay",orderTimer:null,paymentStatus:!1,showQrcode:!1,qrCodeUrl:"",pay_channel:"",orderNo:a.query.orderNo,orderInfo:{},goodsInfos:[],config:a.query.config?JSON.parse(a.query.config):{},hasFreight:!a.query.hf,freight:"",agreeStatus:!0,showHeader:!1,authShow:!1,selectGoodsId:null,currentPrice:0,hasInstrument:!1,dialogStatus:!1,dialogMessage:"",submitStatus:!1}),l=b(()=>e.orderInfo.orderType),u=z({}),w=async()=>{try{const{data:t}=await m.get("/edu-app/userPaymentOrder/detail/"+e.orderNo),s=t.goodsInfos||[];e.orderInfo=t;let n=!1;s.forEach(p=>{const q=p.goodsUrl?p.goodsUrl.split(",")[0]:"";p.goodsUrl=q,p.goodsType==="INSTRUMENTS"&&(n=!0)}),e.goodsInfos=s,u.value.id||(u.value=t.addresses||{}),e.hasInstrument=n,n?e.freight="到付":e.freight="免运费",t.status!=="WAIT_PAY"&&t.status!=="PAYING"&&(e.dialogStatus=!0,e.dialogMessage="订单"+Le[t.status])}catch(t){}},_=t=>{const s=e.config;e.pay_channel=t.pay_channel;const n=M.stringify({pay_channel:t.pay_channel,wxAppId:s.wxAppId,alipayAppId:s.alipayAppId,paymentType:e.paymentType,body:s.body,price:s.price,orderNo:s.merOrderNo,userId:s.userId});t.payCode==="payResult"?window.location.href=window.location.origin+"/classroom-app/#/payResult?"+n:(e.qrCodeUrl=window.location.origin+"/classroom-app/#/payDefine?"+n,e.showQrcode=!0,e.paymentStatus=!1,setTimeout(()=>{x()},300))},x=async()=>{const t=setInterval(async()=>{if(a.name!="order-detail"){clearInterval(t);return}e.orderTimer=t;try{const{data:s}=await m.post("/edu-app/open/userOrder/paymentStatus/"+e.orderNo,{hideLoading:!0});s.status!=="WAIT_PAY"&&s.status!=="PAYING"&&(e.showQrcode=!1,clearInterval(e.orderTimer),setTimeout(()=>{y()},100))}catch(s){clearInterval(e.orderTimer)}},5e3)},A=async()=>{clearInterval(e.orderTimer),l.value==="VIP"?B(T):v(T)},T=()=>{const t=e.pay_channel;if(t){const s=K(e.pay_channel);_({payCode:s,pay_channel:t})}else l.value==="VIP"?e.paymentStatus=!0:_({payCode:"payResult",pay_channel:"wx_pub"})},B=async t=>{try{if(!e.agreeStatus){h("请先阅读并同意《音乐数字课堂服务协议》");return}const s=C.user.data;if(!(s!=null&&s.account.realName)||!(s!=null&&s.account.idCardNo)){e.authShow=!0;return}e.submitStatus=!0;const{data:n}=await m.post("/edu-app/userPaymentOrder/updateReceiveAddress",{hideLoading:!1,data:{orderNo:e.orderNo,orderType:"VIP"}});e.pay_channel=n.paymentChannel,n.status!=="WAIT_PAY"&&n.status!=="PAYING"?d.replace({path:"/payment-result",query:{orderNo:e.orderNo}}):(t&&t(),e.submitStatus=!1)}catch(s){e.submitStatus=!1}},v=async t=>{if(!u.value.id&&e.hasInstrument){h("请选择收货地址");return}if(!e.agreeStatus){h("请先阅读并同意《音乐数字课堂服务协议》");return}const s=C.user.data;if(!(s!=null&&s.account.realName)||!(s!=null&&s.account.idCardNo)){e.authShow=!0;return}e.submitStatus=!0;try{const{data:n}=await m.post("/edu-app/userPaymentOrder/updateReceiveAddress",{hideLoading:!1,data:{orderNo:e.orderNo,orderType:"SCHOOL_REGISTER",receiveAddress:u.value.id||""}});e.pay_channel=n.paymentChannel,n.status!=="WAIT_PAY"&&n.status!=="PAYING"?y():(t&&t(),e.submitStatus=!1)}catch(n){e.submitStatus=!1}},y=()=>{d.replace({path:"/payment-result",query:{orderNo:e.orderNo}})},U=async()=>{try{await m.post("/edu-app/userPaymentOrder/cancelPayment/"+e.orderNo),d.back()}catch(t){}},k=()=>{e.authShow=!1,A()};return V(()=>{g().isApp?e.showHeader=!0:e.showHeader=!1;let t=sessionStorage.getItem("addressDetails");t=t?JSON.parse(t):{},u.value=t,sessionStorage.removeItem("addressDetails"),w()}),()=>o(I,null,[g().isApp&&o(H,{border:!1},null),o("div",{class:r.cartConfirm},[e.hasInstrument&&o("div",{class:r.cartConfirmBox},[o(Me,{item:u.value},null)]),o(Z,{style:{margin:0},border:!1},{default:()=>[e.goodsInfos&&e.goodsInfos.map(t=>o(f,{class:r.cellItem},{icon:()=>o(Y,{class:r.img,src:t.goodsUrl},null),title:()=>o("div",{class:r.goodsContent},[o("h2",null,[o("span",null,[t.goodsName]),o("span",{class:r.goodsNum},[c("x "),t.goodsNum])]),o("div",{class:r.goodsPrice},[o(E,{class:r.brandName},{default:()=>[t.goodsType==="VIP"?"12个月":t.brandName]}),o("span",{class:[r.goodsNums,t.paymentCashAmount>0?r.numFont:r.free]},[t.paymentCashAmount>0?o(I,null,[o("span",{class:r.numPrefix},[c("¥ ")]),N(t.paymentCashAmount)]):"免费"])]),o("p",{class:r.model},[t.description])])}))]}),e.hasInstrument&&o(f,{class:r.freight,title:"运费",value:e.freight},null)]),o(L,{position:"bottom"},{default:()=>[o("div",{class:r.paymentContainer},[o("div",{class:r.payemntPrice},[o("p",{class:r.needPrice},[c("支付金额:"),o("span",null,[o("i",null,[c("¥")]),N(e.orderInfo.currentPrice)])])]),o("div",{class:r.paymentBtn},[o(R,{round:!0,class:[r.submitBtn],onClick:A,loading:e.submitStatus,disabled:e.submitStatus},{default:()=>[c("提交")]})])])]}),o(P,{show:e.paymentStatus,closeOnClickOverlay:!1,position:"bottom",round:!0,closeOnPopstate:!0,safeAreaInsetBottom:!0,style:{minHeight:"30%"}},{default:()=>[o(G,{paymentConfig:e.orderInfo,onClose:()=>e.paymentStatus=!1,onBackOut:U,onConfirm:t=>_(t)},null)]}),o(P,{show:e.showQrcode,"onUpdate:show":t=>e.showQrcode=t,round:!0,onClose:()=>{clearInterval(e.orderTimer)}},{default:()=>[o(X,{url:e.qrCodeUrl,pay_channel:e.pay_channel,orderType:l.value},null)]}),o(Q,{modelValue:e.authShow,"onUpdate:modelValue":t=>e.authShow=t},{default:()=>[o(J,{onSuccess:k,hideHeader:!g().isApp},null)]}),o(W,{title:"提示",show:e.dialogStatus,"onUpdate:show":t=>e.dialogStatus=t,message:e.dialogMessage,confirmButtonText:"确定",onConfirm:()=>{y()}},null)])}});export{ct as default};