order-detail-107ff3ac.js 12 KB

1
  1. import{d as S,q as D,e as w,a,A as l,I as j,F as T,P as z,x as V,r as H,y as M,U as g,W as L,X as N,C as R,S as C,D as m,Y as G,V as J,Z as X,_ as K,$ as Q,a0 as Z,N as h,K as P}from"./index-62e2a3f6.js";import{C as f}from"./index-5514dfc9.js";import{T as b}from"./index-700fde59.js";import{M as W}from"./index-7fbcafd9.js";import{P as Y,Q as $,U as ee,b as te}from"./user-auth-60121eb7.js";import{O as ae}from"./index-9a0f147a.js";import{O as oe}from"./index-f54ff1ed.js";import{C as se}from"./index-b8b0afb7.js";import{I as ne}from"./index-426d7470.js";import"./index-258a6b70.js";import"./index-1fc18b9c.js";import"./Checker-66b545df.js";import"./index-89ef9410.js";import"./browser-e949d08f.js";import"./index-5688a17b.js";import"./index-3f465cf8.js";const re="_cartConfirm_1c37u_1",ce="_cartConfirmBox_1c37u_9",le="_cartItem_1c37u_15",ie="_mlr13_1c37u_24",ue="_protocol_1c37u_28",de="_paymentContainer_1c37u_36",me="_needPrice_1c37u_48",pe="_allPrice_1c37u_64",fe="_cellItem_1c37u_72",ye="_img_1c37u_77",_e="_cellPrice_1c37u_85",ge="_numFont_1c37u_91",he="_numPrefix_1c37u_94",Te="_goodsContent_1c37u_98",Ie="_goodsNum_1c37u_98",Ae="_goodsPrice_1c37u_104",Ne="_free_1c37u_110",Ce="_goodsNums_1c37u_113",Pe="_brandName_1c37u_128",Se="_model_1c37u_137",De="_popupCode_1c37u_143",we="_codeContainer_1c37u_147",be="_codeClose_1c37u_150",xe="_codeImg_1c37u_160",Ee="_codeTitle_1c37u_167",Oe="_codeName_1c37u_175",Be="_codeQr_1c37u_182",ve="_codeBtnText_1c37u_195",Ue="_codeTips_1c37u_206",qe="_tipsTitle_1c37u_220",ke="_close_1c37u_226",Fe="_codeBottom_1c37u_231",je="_title_1c37u_238",ze="_shareImg_1c37u_253",Ve="_shareText_1c37u_257",He="_freight_1c37u_263",Me="_submitBtn_1c37u_275",r={cartConfirm:re,cartConfirmBox:ce,cartItem:le,mlr13:ie,protocol:ue,paymentContainer:de,needPrice:me,allPrice:pe,cellItem:fe,img:ye,cellPrice:_e,numFont:ge,numPrefix:he,goodsContent:Te,goodsNum:Ie,goodsPrice:Ae,free:Ne,goodsNums:Ce,brandName:Pe,model:Se,popupCode:De,codeContainer:we,codeClose:be,codeImg:xe,codeTitle:Ee,codeName:Oe,codeQr:Be,codeBtnText:ve,codeTips:Ue,tipsTitle:qe,close:ke,codeBottom:Fe,title:je,shareImg:ze,shareText:Ve,freight:He,submitBtn:Me},Le="_cellEntry_1kuxn_1",Re="_cell_1kuxn_1",Ge="_userName_1kuxn_36",Je="_phone_1kuxn_41",Xe="_addressInfo_1kuxn_46",Ke="_emtry_1kuxn_51",p={cellEntry:Le,cell:Re,userName:Ge,phone:Je,addressInfo:Xe,emtry:Ke},Qe="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/rGQBKLmeAAAARXRSTlMAB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r3NrnADhoa8s8eLF5wHbF2udgu4INUmufYx9r15Ip2JLxJtDa52ATiG2nlc+ZdFoa3WanCka3lbXmFcFaW4b4sx0z3/7fh//zfdvlEDfKRQAAAABJRU5ErkJggg==",Ze=S({name:"cart-address",props:{item:{type:Object,default:()=>({})},isLink:{type:Boolean,default:!0},setAddress:{type:Function,default:s=>{}}},setup(s){const i=D(),e=w(()=>[s.item.provinceName,s.item.cityName,s.item.regionName,s.item.detailAddress].join("")),u=()=>{s.isLink&&i.push("/shopAddress")};return()=>a(T,null,[s.item&&s.item.phoneNumber?a(f,{class:p.cell,"is-link":s.isLink,onClick:()=>u(),titleStyle:{marginLeft:"0"}},{title:()=>a("div",null,[a("span",{class:p.userName},[s.item.name]),a("span",{class:p.phone},[s.item&&s.item.phoneNumber&&s.item.phoneNumber.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")]),s.item.defaultStatus&&a(b,{type:"primary",color:"linear-gradient(90deg, #FF8633 0%, #FFB047 100%)",round:!0,style:{"vertical-align":"text-top",marginLeft:"10px",padding:"1px 8px"}},{default:()=>[l("默认")]})]),label:()=>a("span",{class:p.addressInfo},[e.value])}):a(f,{class:p.cell,"is-link":s.isLink,onClick:()=>u()},{icon:()=>a(j,{name:Qe,size:28},null),title:()=>a("div",{class:p.emtry},[l("去填写收货地址")])})])}}),We={WAIT_PAY:"待支付",PAYING:"支付中",PAID:"已付款",TIMEOUT:"已关闭",FAIL:"支付失败",CLOSED:"已关闭",REFUNDING:"退款中",REFUNDED:"已退款"},ft=S({name:"order-detail",setup(){const s=z(),i=D(),e=V({orderTimer:null,paymentStatus:!1,showQrcode:!1,qrCodeUrl:"",pay_channel:"",orderNo:s.query.orderNo,paymentType:s.query.paymentType,paymentChannel:s.query.paymentChannel,orderInfo:{},goodsInfos:[],config:s.query.config?JSON.parse(s.query.config):{},hasFreight:!s.query.hf,freight:"",agreeStatus:!0,showHeader:!1,authShow:!1,selectGoodsId:null,currentPrice:0,hasInstrument:!1,dialogStatus:!1,dialogMessage:"",submitStatus:!1}),u=w(()=>e.orderInfo.orderType),d=H({}),x=async()=>{try{const{data:t}=await m.get("/edu-app/userPaymentOrder/detail/"+e.orderNo),o=t.goodsInfos||[];e.orderInfo=t;let n=!1;o.forEach(c=>{const F=c.goodsUrl?c.goodsUrl.split(",")[0]:"";c.goodsUrl=F,c.goodsType==="INSTRUMENTS"&&(n=!0)}),e.goodsInfos=o,d.value.id||(d.value=t.addresses||{}),e.hasInstrument=n,n?e.freight="到付":e.freight="免运费",t.status!=="WAIT_PAY"&&t.status!=="PAYING"&&(e.dialogStatus=!0,e.dialogMessage="订单"+We[t.status])}catch(t){}},y=t=>{const o=e.config;if(e.pay_channel=t.pay_channel,t.pay_channel.indexOf("wxpay-app")!==-1||t.pay_channel.indexOf("alipay-app")!==-1){O();return}const n=G.stringify({pay_channel:t.pay_channel,wxAppId:o.wxAppId,alipayAppId:o.alipayAppId,paymentType:e.paymentType,body:o.body,price:o.price,orderNo:o.merOrderNo,userId:o.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(()=>{E()},300))},E=async()=>{const t=setInterval(async()=>{if(s.name!="order-detail"){clearInterval(t);return}e.orderTimer=t;try{const{data:o}=await m.post("/edu-app/open/userOrder/paymentStatus/"+e.orderNo,{hideLoading:!0});o.status!=="WAIT_PAY"&&o.status!=="PAYING"&&(e.showQrcode=!1,clearInterval(e.orderTimer),setTimeout(()=>{_()},100))}catch(o){clearInterval(e.orderTimer)}},5e3)},O=async()=>{try{const{data:t}=await m.post("/edu-app/open/userOrder/executePayment",{data:{...e.config}});let n=e.config.paymentChannel.indexOf("wxpay")!==-1?"wx_app":"ali_app";J({api:"paymentOrder",content:{orderNo:e.orderNo,payChannel:n,payInfo:t.reqParams.body||JSON.stringify(t.reqParams)}}),X({message:"支付中...",forbidClick:!0,duration:3e3,loadingType:"spinner"}),K("paymentOperation",c=>{console.log(c,"init paymentOperation"),B(c==null?void 0:c.content)})}catch(t){console.log(t)}},B=t=>{if(console.log(t,"paymentOperation"),Q(),t.status==="success"||t.status==="error")i.replace({path:"/payment-result",query:{orderNo:e.orderNo}});else if(t.status!=="cancel"){if(t.status==="fail"){const n=e.config.paymentChannel.indexOf("wxpay")!==-1?"您尚未安装微信":"您尚未安装支付宝";Z({title:"提示",message:n})}}},I=async()=>{clearInterval(e.orderTimer),u.value==="VIP"?v(A):U(A)},A=()=>{const t=e.pay_channel;if(t){const o=te(e.pay_channel);y({payCode:o,pay_channel:t})}else u.value==="VIP"?e.paymentStatus=!0:y({payCode:"payResult",pay_channel:"wx_pub"})},v=async t=>{try{if(!e.agreeStatus){h("请先阅读并同意《音乐数字课堂服务协议》");return}const o=P.user.data;if(!(o!=null&&o.account.realName)||!(o!=null&&o.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"?i.replace({path:"/payment-result",query:{orderNo:e.orderNo}}):(t&&t(),e.submitStatus=!1)}catch(o){e.submitStatus=!1}},U=async t=>{if(!d.value.id&&e.hasInstrument){h("请选择收货地址");return}if(!e.agreeStatus){h("请先阅读并同意《音乐数字课堂服务协议》");return}const o=P.user.data;if(!(o!=null&&o.account.realName)||!(o!=null&&o.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:d.value.id||""}});e.pay_channel=n.paymentChannel,n.status!=="WAIT_PAY"&&n.status!=="PAYING"?_():(t&&t(),e.submitStatus=!1)}catch(n){e.submitStatus=!1}},_=()=>{i.replace({path:"/payment-result",query:{orderNo:e.orderNo}})},q=async()=>{try{await m.post("/edu-app/userPaymentOrder/cancelPayment/"+e.orderNo),i.back()}catch(t){}},k=()=>{e.authShow=!1,I()};return M(()=>{g().isApp?e.showHeader=!0:e.showHeader=!1;let t=sessionStorage.getItem("addressDetails");t=t?JSON.parse(t):{},d.value=t,sessionStorage.removeItem("addressDetails"),x()}),()=>a(T,null,[g().isApp&&a(L,{border:!1},null),a("div",{class:r.cartConfirm},[e.hasInstrument&&a("div",{class:r.cartConfirmBox},[a(Ze,{item:d.value},null)]),a(se,{style:{margin:0},border:!1},{default:()=>[e.goodsInfos&&e.goodsInfos.map(t=>a(f,{class:r.cellItem},{icon:()=>a(ne,{class:r.img,src:t.goodsUrl},null),title:()=>a("div",{class:r.goodsContent},[a("h2",null,[a("span",null,[t.goodsName]),a("span",{class:r.goodsNum},[l("x "),t.goodsNum])]),a("div",{class:r.goodsPrice},[a(b,{class:r.brandName},{default:()=>[t.goodsType==="VIP"?"12个月":t.brandName]}),a("span",{class:[r.goodsNums,t.paymentCashAmount>0?r.numFont:r.free]},[t.paymentCashAmount>0?a(T,null,[a("span",{class:r.numPrefix},[l("¥ ")]),N(t.paymentCashAmount)]):"免费"])]),a("p",{class:r.model},[t.description])])}))]}),e.hasInstrument&&a(f,{class:r.freight,title:"运费",value:e.freight},null)]),a(W,{position:"bottom"},{default:()=>[a("div",{class:r.paymentContainer},[a("div",{class:r.payemntPrice},[a("p",{class:r.needPrice},[l("支付金额:"),a("span",null,[a("i",null,[l("¥")]),N(e.orderInfo.currentPrice)])])]),a("div",{class:r.paymentBtn},[a(R,{round:!0,class:[r.submitBtn],onClick:I,loading:e.submitStatus,disabled:e.submitStatus},{default:()=>[l("提交")]})])])]}),a(C,{show:e.paymentStatus,closeOnClickOverlay:!1,position:"bottom",round:!0,closeOnPopstate:!0,safeAreaInsetBottom:!0,style:{minHeight:"30%"}},{default:()=>[a(Y,{paymentConfig:e.orderInfo,config:{paymentType:e.paymentType,paymentChannel:e.paymentChannel},onClose:()=>e.paymentStatus=!1,onBackOut:q,onConfirm:t=>y(t),onConfirmNative:t=>{e.config.paymentChannel=t.payChannel}},null)]}),a(C,{show:e.showQrcode,"onUpdate:show":t=>e.showQrcode=t,round:!0,onClose:()=>{clearInterval(e.orderTimer)}},{default:()=>[a($,{url:e.qrCodeUrl,pay_channel:e.pay_channel,orderType:u.value},null)]}),a(ae,{modelValue:e.authShow,"onUpdate:modelValue":t=>e.authShow=t},{default:()=>[a(ee,{onSuccess:k,hideHeader:!g().isApp},null)]}),a(oe,{title:"提示",show:e.dialogStatus,"onUpdate:show":t=>e.dialogStatus=t,message:e.dialogMessage,confirmButtonText:"确定",onConfirm:()=>{_()}},null)])}});export{ft as default};